WARPXM v1.10.0
Loading...
Searching...
No Matches
wxcryptsetlexer.h
Go to the documentation of this file.
1#ifndef wxcryptsetlexer_h
2#define wxcryptsetlexer_h
3
4// WarpX includes
5
6// std includes
7#include <iostream>
8#include <istream>
9#include <string>
10
15// WarpX input file lexer tokens
16enum
17{
19 WX_DONE = -1,
25 WX_KEY = WX_ID, // key and value are just IDs
37};
38
44{
45public:
51 WxCryptSetLexer(std::istream& is) : _is(is), _lineno(1), _integer(0), _real(0.0)
52 {
53 }
54
58 int yylex()
59 {
60 _lastSym = _yylex();
61 return _lastSym;
62 }
63
67 unsigned lineno() const
68 {
69 return _lineno;
70 }
71
75 std::string YYText() const
76 {
77 return _yytext;
78 }
79
83 int integer() const
84 {
85 return _integer;
86 }
87
91 double real() const
92 {
93 return _real;
94 }
95
96 int lastSym() const
97 {
98 return _lastSym;
99 }
100
101private:
102 std::istream& _is; // input stream to tokenize
103 unsigned _lineno;
104 std::string _yytext; // text of last token read
105 int _integer; // scanned integer
106 double _real; // scanned real
107 unsigned _lastSym; // last symbol scanned
108
109 // do the actual tokenization
110 int _yylex();
111
112 // get next char with \'s interpreted
113 char _backslash(char c);
114
115 // look ahead for two character operators
116 unsigned _follow(char expect, unsigned ifyes, unsigned ifno);
117
118 // check if character can belong to WX_ID
119 bool _isidchar(char c);
120
121 // scans a number
122 int _scan_number();
123};
124
126#endif // wxcryptsetlexer_h_h
Class that provides utility to read an input stream into a WxCryptSet.
Definition: wxcryptsetlexer.h:44
int integer() const
Returns integer scanned.
Definition: wxcryptsetlexer.h:83
int lastSym() const
Definition: wxcryptsetlexer.h:96
std::string YYText() const
Returns a character pointer representing the current token scanned.
Definition: wxcryptsetlexer.h:75
unsigned lineno() const
Returns the current line number being scanned.
Definition: wxcryptsetlexer.h:67
double real() const
Returns real number scanned.
Definition: wxcryptsetlexer.h:91
WxCryptSetLexer(std::istream &is)
Set input stream to one supplied.
Definition: wxcryptsetlexer.h:51
int yylex()
Scans input stream and returns a single token.
Definition: wxcryptsetlexer.h:58
@ WX_ID
Definition: wxcryptsetlexer.h:24
@ WX_VALUE
Definition: wxcryptsetlexer.h:26
@ WX_ERROR
Definition: wxcryptsetlexer.h:18
@ WX_INT
Definition: wxcryptsetlexer.h:30
@ WX_KEY
Definition: wxcryptsetlexer.h:25
@ WX_COMMA
Definition: wxcryptsetlexer.h:29
@ WX_RIGHT_BOX
Definition: wxcryptsetlexer.h:21
@ WX_RIGHT_ANGLE
Definition: wxcryptsetlexer.h:23
@ WX_LEFT_ANGLE_FRONT_SLASH
Definition: wxcryptsetlexer.h:34
@ WX_SEMI_COLON
Definition: wxcryptsetlexer.h:33
@ WX_EQUAL
Definition: wxcryptsetlexer.h:27
@ WX_LEFT_ANGLE
Definition: wxcryptsetlexer.h:22
@ WX_REAL
Definition: wxcryptsetlexer.h:31
@ WX_LEFT_BOX
Definition: wxcryptsetlexer.h:20
@ WX_STRING
Definition: wxcryptsetlexer.h:32
@ WX_DONE
Definition: wxcryptsetlexer.h:19
@ WX_RIGHT_CURLY_BRACKET
Definition: wxcryptsetlexer.h:36
@ WX_LEFT_CURLY_BRACKET
Definition: wxcryptsetlexer.h:35
@ WX_FRONT_SLASH
Definition: wxcryptsetlexer.h:28