Skip to content

Commit

Permalink
完善常量
Browse files Browse the repository at this point in the history
  • Loading branch information
wangziwenhk committed Oct 4, 2024
1 parent 9f1061e commit c875970
Show file tree
Hide file tree
Showing 18 changed files with 771 additions and 636 deletions.
1 change: 1 addition & 0 deletions RiddleLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ True:'true';
False:'false';
Static:'static';
Const:'const';
Null:'null';
//可见字符
//基本运算符
LeftBracket: '(';
Expand Down
1 change: 1 addition & 0 deletions RiddleParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ expression
| string #stringExpr
| number #numberExpr
| boolean #booleanExpr
| Null #nullExpr
;

id: Identifier;
Expand Down
273 changes: 138 additions & 135 deletions parser/RiddleLexer.cpp

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions parser/RiddleLexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ class RiddleLexer : public antlr4::Lexer {
enum {
Var = 1, Val = 2, For = 3, While = 4, If = 5, Else = 6, Func = 7, Return = 8,
Import = 9, Package = 10, Class = 11, Public = 12, Protected = 13, Private = 14,
Override = 15, True = 16, False = 17, Static = 18, Const = 19, LeftBracket = 20,
RightBracket = 21, LeftSquare = 22, RightSquare = 23, LeftCurly = 24,
RightCurly = 25, Colon = 26, Semi = 27, Comma = 28, Equal = 29, Assign = 30,
Greater = 31, Less = 32, LeftLeft = 33, RightRight = 34, RightRightRight = 35,
Add = 36, Sub = 37, Star = 38, Div = 39, Mod = 40, Not = 41, And = 42,
Or = 43, Xor = 44, Dot = 45, DoubleQuotes = 46, Quotes = 47, Endl = 48,
Identifier = 49, Hexadecimal = 50, Decimal = 51, Octal = 52, Binary = 53,
Float = 54, IntegerSequence = 55, HEX_DIGIT = 56, OCTAL_DIGIT = 57,
BINARY_DIGIT = 58, DIGIT = 59, STRING = 60, LINE_COMMENT = 61, BLOCK_COMMENT = 62,
WHITESPACE = 63
Override = 15, True = 16, False = 17, Static = 18, Const = 19, Null = 20,
LeftBracket = 21, RightBracket = 22, LeftSquare = 23, RightSquare = 24,
LeftCurly = 25, RightCurly = 26, Colon = 27, Semi = 28, Comma = 29,
Equal = 30, Assign = 31, Greater = 32, Less = 33, LeftLeft = 34, RightRight = 35,
RightRightRight = 36, Add = 37, Sub = 38, Star = 39, Div = 40, Mod = 41,
Not = 42, And = 43, Or = 44, Xor = 45, Dot = 46, DoubleQuotes = 47,
Quotes = 48, Endl = 49, Identifier = 50, Hexadecimal = 51, Decimal = 52,
Octal = 53, Binary = 54, Float = 55, IntegerSequence = 56, HEX_DIGIT = 57,
OCTAL_DIGIT = 58, BINARY_DIGIT = 59, DIGIT = 60, STRING = 61, LINE_COMMENT = 62,
BLOCK_COMMENT = 63, WHITESPACE = 64
};

explicit RiddleLexer(antlr4::CharStream *input);
Expand Down
5 changes: 4 additions & 1 deletion parser/RiddleLexer.interp

Large diffs are not rendered by default.

148 changes: 75 additions & 73 deletions parser/RiddleLexer.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -17,50 +17,51 @@ True=16
False=17
Static=18
Const=19
LeftBracket=20
RightBracket=21
LeftSquare=22
RightSquare=23
LeftCurly=24
RightCurly=25
Colon=26
Semi=27
Comma=28
Equal=29
Assign=30
Greater=31
Less=32
LeftLeft=33
RightRight=34
RightRightRight=35
Add=36
Sub=37
Star=38
Div=39
Mod=40
Not=41
And=42
Or=43
Xor=44
Dot=45
DoubleQuotes=46
Quotes=47
Endl=48
Identifier=49
Hexadecimal=50
Decimal=51
Octal=52
Binary=53
Float=54
IntegerSequence=55
HEX_DIGIT=56
OCTAL_DIGIT=57
BINARY_DIGIT=58
DIGIT=59
STRING=60
LINE_COMMENT=61
BLOCK_COMMENT=62
WHITESPACE=63
Null=20
LeftBracket=21
RightBracket=22
LeftSquare=23
RightSquare=24
LeftCurly=25
RightCurly=26
Colon=27
Semi=28
Comma=29
Equal=30
Assign=31
Greater=32
Less=33
LeftLeft=34
RightRight=35
RightRightRight=36
Add=37
Sub=38
Star=39
Div=40
Mod=41
Not=42
And=43
Or=44
Xor=45
Dot=46
DoubleQuotes=47
Quotes=48
Endl=49
Identifier=50
Hexadecimal=51
Decimal=52
Octal=53
Binary=54
Float=55
IntegerSequence=56
HEX_DIGIT=57
OCTAL_DIGIT=58
BINARY_DIGIT=59
DIGIT=60
STRING=61
LINE_COMMENT=62
BLOCK_COMMENT=63
WHITESPACE=64
'var'=1
'val'=2
'for'=3
Expand All @@ -80,32 +81,33 @@ WHITESPACE=63
'false'=17
'static'=18
'const'=19
'('=20
')'=21
'['=22
']'=23
'{'=24
'}'=25
':'=26
';'=27
','=28
'=='=29
'='=30
'>'=31
'<'=32
'<<'=33
'>>'=34
'>>>'=35
'+'=36
'-'=37
'*'=38
'/'=39
'%'=40
'!'=41
'&'=42
'|'=43
'^'=44
'.'=45
'"'=46
'\''=47
'\n'=48
'null'=20
'('=21
')'=22
'['=23
']'=24
'{'=25
'}'=26
':'=27
';'=28
','=29
'=='=30
'='=31
'>'=32
'<'=33
'<<'=34
'>>'=35
'>>>'=36
'+'=37
'-'=38
'*'=39
'/'=40
'%'=41
'!'=42
'&'=43
'|'=44
'^'=45
'.'=46
'"'=47
'\''=48
'\n'=49
Loading

0 comments on commit c875970

Please sign in to comment.