add: some op
This commit is contained in:
parent
08c51a0232
commit
900df4f9b5
|
|
@ -33,6 +33,12 @@ blank [ \t\v\r]
|
||||||
{blank}+ { loc->step(); }
|
{blank}+ { loc->step(); }
|
||||||
\n+ { loc->lines(yyleng); loc->step(); }
|
\n+ { loc->lines(yyleng); loc->step(); }
|
||||||
|
|
||||||
|
"<=" { return token::TOKEN_LE; }
|
||||||
|
">=" { return token::TOKEN_GE; }
|
||||||
|
"<" { return token::TOKEN_LT; }
|
||||||
|
">" { return token::TOKEN_GT; }
|
||||||
|
"=" { return token::TOKEN_EQUAL; }
|
||||||
|
"/=" { return token::TOKEN_NE; }
|
||||||
"(" { return token::TOKEN_LPAREN; }
|
"(" { return token::TOKEN_LPAREN; }
|
||||||
")" { return token::TOKEN_RPAREN; }
|
")" { return token::TOKEN_RPAREN; }
|
||||||
"+" { return token::TOKEN_PLUS; }
|
"+" { return token::TOKEN_PLUS; }
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,12 @@ namespace DragonLisp {
|
||||||
%define parse.assert
|
%define parse.assert
|
||||||
|
|
||||||
%token
|
%token
|
||||||
|
LE "<="
|
||||||
|
GE ">="
|
||||||
|
EQUAL "="
|
||||||
|
NE "/="
|
||||||
|
LT "<"
|
||||||
|
GT ">"
|
||||||
LPAREN "("
|
LPAREN "("
|
||||||
RPAREN ")"
|
RPAREN ")"
|
||||||
PLUS "+"
|
PLUS "+"
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,6 @@ public:
|
||||||
void error(const DLParser::location_type& l, const std::string& m);
|
void error(const DLParser::location_type& l, const std::string& m);
|
||||||
void error(const std::string& m);
|
void error(const std::string& m);
|
||||||
|
|
||||||
enum Operator {
|
|
||||||
PLUS,
|
|
||||||
MINUS,
|
|
||||||
MULTIPLY,
|
|
||||||
DIVIDE
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DLParser* parser = nullptr;
|
DLParser* parser = nullptr;
|
||||||
DLScanner* scanner = nullptr;
|
DLScanner* scanner = nullptr;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue