namespaces & structs
This commit is contained in:
@@ -8,13 +8,17 @@ MATH: '+' | '-' | '*' | '/';
|
||||
fragment ESC: '\\' ['"\\] ;
|
||||
STRING: '"' (ESC | ~["\\])* '"';
|
||||
round_def: '(' (var_def (',' var_def)* ','?)? ')';
|
||||
enum_curly: '{' (var_def ';')* '}';
|
||||
round_call: '(' (expr (',' expr)* ','?)? ')';
|
||||
fn_call: IDENTIFIER round_call;
|
||||
func_def: IDENTIFIER IDENTIFIER round_def code_block;
|
||||
var_def: IDENTIFIER IDENTIFIER;
|
||||
var_def_set: var_def '=' expr;
|
||||
call_tree: (fn_call|IDENTIFIER) ('.' (fn_call|IDENTIFIER))*;
|
||||
asm: '%' IDENTIFIER expr (',' expr)* ';';
|
||||
struct_def: 'struct' IDENTIFIER enum_curly;
|
||||
power_keyword: 'map';
|
||||
power_keyword_call: '#' power_keyword expr (',' expr)* ';';
|
||||
namespace: 'namespace' IDENTIFIER '{' (((var_def|var_def_set) ';')|func_def)* '}';
|
||||
|
||||
expr:
|
||||
(
|
||||
@@ -30,4 +34,9 @@ code_block: '{' ((
|
||||
var_def |
|
||||
var_def_set
|
||||
) ';')* '}';
|
||||
top: (asm|func_def)*;
|
||||
top: (
|
||||
power_keyword_call |
|
||||
func_def |
|
||||
struct_def |
|
||||
namespace
|
||||
)*;
|
||||
+16
-6
File diff suppressed because one or more lines are too long
+18
-12
@@ -7,18 +7,24 @@ T__5=6
|
||||
T__6=7
|
||||
T__7=8
|
||||
T__8=9
|
||||
WS=10
|
||||
NUMBER=11
|
||||
HEX=12
|
||||
IDENTIFIER=13
|
||||
MATH=14
|
||||
STRING=15
|
||||
T__9=10
|
||||
T__10=11
|
||||
T__11=12
|
||||
WS=13
|
||||
NUMBER=14
|
||||
HEX=15
|
||||
IDENTIFIER=16
|
||||
MATH=17
|
||||
STRING=18
|
||||
'('=1
|
||||
','=2
|
||||
')'=3
|
||||
'='=4
|
||||
'.'=5
|
||||
'%'=6
|
||||
';'=7
|
||||
'{'=8
|
||||
'}'=9
|
||||
'{'=4
|
||||
';'=5
|
||||
'}'=6
|
||||
'='=7
|
||||
'.'=8
|
||||
'struct'=9
|
||||
'map'=10
|
||||
'#'=11
|
||||
'namespace'=12
|
||||
|
||||
+14
-5
@@ -3,12 +3,15 @@ null
|
||||
'('
|
||||
','
|
||||
')'
|
||||
'{'
|
||||
';'
|
||||
'}'
|
||||
'='
|
||||
'.'
|
||||
'%'
|
||||
';'
|
||||
'{'
|
||||
'}'
|
||||
'struct'
|
||||
'map'
|
||||
'#'
|
||||
'namespace'
|
||||
null
|
||||
null
|
||||
null
|
||||
@@ -27,6 +30,9 @@ null
|
||||
null
|
||||
null
|
||||
null
|
||||
null
|
||||
null
|
||||
null
|
||||
WS
|
||||
NUMBER
|
||||
HEX
|
||||
@@ -44,6 +50,9 @@ T__5
|
||||
T__6
|
||||
T__7
|
||||
T__8
|
||||
T__9
|
||||
T__10
|
||||
T__11
|
||||
WS
|
||||
NUMBER
|
||||
HEX
|
||||
@@ -60,4 +69,4 @@ mode names:
|
||||
DEFAULT_MODE
|
||||
|
||||
atn:
|
||||
[4, 0, 15, 101, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 4, 9, 53, 8, 9, 11, 9, 12, 9, 54, 1, 9, 1, 9, 1, 10, 1, 10, 5, 10, 61, 8, 10, 10, 10, 12, 10, 64, 9, 10, 1, 10, 3, 10, 67, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 73, 8, 11, 10, 11, 12, 11, 76, 9, 11, 1, 12, 1, 12, 1, 12, 1, 12, 5, 12, 82, 8, 12, 10, 12, 12, 12, 85, 9, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 5, 15, 95, 8, 15, 10, 15, 12, 15, 98, 9, 15, 1, 15, 1, 15, 0, 0, 16, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 0, 31, 15, 1, 0, 9, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 49, 57, 1, 0, 48, 57, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 3, 0, 42, 43, 45, 45, 47, 47, 3, 0, 34, 34, 39, 39, 92, 92, 2, 0, 34, 34, 92, 92, 107, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 1, 33, 1, 0, 0, 0, 3, 35, 1, 0, 0, 0, 5, 37, 1, 0, 0, 0, 7, 39, 1, 0, 0, 0, 9, 41, 1, 0, 0, 0, 11, 43, 1, 0, 0, 0, 13, 45, 1, 0, 0, 0, 15, 47, 1, 0, 0, 0, 17, 49, 1, 0, 0, 0, 19, 52, 1, 0, 0, 0, 21, 66, 1, 0, 0, 0, 23, 68, 1, 0, 0, 0, 25, 77, 1, 0, 0, 0, 27, 86, 1, 0, 0, 0, 29, 88, 1, 0, 0, 0, 31, 91, 1, 0, 0, 0, 33, 34, 5, 40, 0, 0, 34, 2, 1, 0, 0, 0, 35, 36, 5, 44, 0, 0, 36, 4, 1, 0, 0, 0, 37, 38, 5, 41, 0, 0, 38, 6, 1, 0, 0, 0, 39, 40, 5, 61, 0, 0, 40, 8, 1, 0, 0, 0, 41, 42, 5, 46, 0, 0, 42, 10, 1, 0, 0, 0, 43, 44, 5, 37, 0, 0, 44, 12, 1, 0, 0, 0, 45, 46, 5, 59, 0, 0, 46, 14, 1, 0, 0, 0, 47, 48, 5, 123, 0, 0, 48, 16, 1, 0, 0, 0, 49, 50, 5, 125, 0, 0, 50, 18, 1, 0, 0, 0, 51, 53, 7, 0, 0, 0, 52, 51, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 56, 1, 0, 0, 0, 56, 57, 6, 9, 0, 0, 57, 20, 1, 0, 0, 0, 58, 62, 7, 1, 0, 0, 59, 61, 7, 2, 0, 0, 60, 59, 1, 0, 0, 0, 61, 64, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 67, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 65, 67, 5, 48, 0, 0, 66, 58, 1, 0, 0, 0, 66, 65, 1, 0, 0, 0, 67, 22, 1, 0, 0, 0, 68, 69, 5, 48, 0, 0, 69, 70, 5, 120, 0, 0, 70, 74, 1, 0, 0, 0, 71, 73, 7, 3, 0, 0, 72, 71, 1, 0, 0, 0, 73, 76, 1, 0, 0, 0, 74, 72, 1, 0, 0, 0, 74, 75, 1, 0, 0, 0, 75, 24, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 77, 83, 7, 4, 0, 0, 78, 82, 7, 5, 0, 0, 79, 80, 5, 58, 0, 0, 80, 82, 5, 58, 0, 0, 81, 78, 1, 0, 0, 0, 81, 79, 1, 0, 0, 0, 82, 85, 1, 0, 0, 0, 83, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 26, 1, 0, 0, 0, 85, 83, 1, 0, 0, 0, 86, 87, 7, 6, 0, 0, 87, 28, 1, 0, 0, 0, 88, 89, 5, 92, 0, 0, 89, 90, 7, 7, 0, 0, 90, 30, 1, 0, 0, 0, 91, 96, 5, 34, 0, 0, 92, 95, 3, 29, 14, 0, 93, 95, 8, 8, 0, 0, 94, 92, 1, 0, 0, 0, 94, 93, 1, 0, 0, 0, 95, 98, 1, 0, 0, 0, 96, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 99, 1, 0, 0, 0, 98, 96, 1, 0, 0, 0, 99, 100, 5, 34, 0, 0, 100, 32, 1, 0, 0, 0, 9, 0, 54, 62, 66, 74, 81, 83, 94, 96, 1, 6, 0, 0]
|
||||
[4, 0, 18, 128, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 4, 12, 80, 8, 12, 11, 12, 12, 12, 81, 1, 12, 1, 12, 1, 13, 1, 13, 5, 13, 88, 8, 13, 10, 13, 12, 13, 91, 9, 13, 1, 13, 3, 13, 94, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 100, 8, 14, 10, 14, 12, 14, 103, 9, 14, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 109, 8, 15, 10, 15, 12, 15, 112, 9, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 5, 18, 122, 8, 18, 10, 18, 12, 18, 125, 9, 18, 1, 18, 1, 18, 0, 0, 19, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 0, 37, 18, 1, 0, 9, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 49, 57, 1, 0, 48, 57, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 3, 0, 42, 43, 45, 45, 47, 47, 3, 0, 34, 34, 39, 39, 92, 92, 2, 0, 34, 34, 92, 92, 134, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 1, 39, 1, 0, 0, 0, 3, 41, 1, 0, 0, 0, 5, 43, 1, 0, 0, 0, 7, 45, 1, 0, 0, 0, 9, 47, 1, 0, 0, 0, 11, 49, 1, 0, 0, 0, 13, 51, 1, 0, 0, 0, 15, 53, 1, 0, 0, 0, 17, 55, 1, 0, 0, 0, 19, 62, 1, 0, 0, 0, 21, 66, 1, 0, 0, 0, 23, 68, 1, 0, 0, 0, 25, 79, 1, 0, 0, 0, 27, 93, 1, 0, 0, 0, 29, 95, 1, 0, 0, 0, 31, 104, 1, 0, 0, 0, 33, 113, 1, 0, 0, 0, 35, 115, 1, 0, 0, 0, 37, 118, 1, 0, 0, 0, 39, 40, 5, 40, 0, 0, 40, 2, 1, 0, 0, 0, 41, 42, 5, 44, 0, 0, 42, 4, 1, 0, 0, 0, 43, 44, 5, 41, 0, 0, 44, 6, 1, 0, 0, 0, 45, 46, 5, 123, 0, 0, 46, 8, 1, 0, 0, 0, 47, 48, 5, 59, 0, 0, 48, 10, 1, 0, 0, 0, 49, 50, 5, 125, 0, 0, 50, 12, 1, 0, 0, 0, 51, 52, 5, 61, 0, 0, 52, 14, 1, 0, 0, 0, 53, 54, 5, 46, 0, 0, 54, 16, 1, 0, 0, 0, 55, 56, 5, 115, 0, 0, 56, 57, 5, 116, 0, 0, 57, 58, 5, 114, 0, 0, 58, 59, 5, 117, 0, 0, 59, 60, 5, 99, 0, 0, 60, 61, 5, 116, 0, 0, 61, 18, 1, 0, 0, 0, 62, 63, 5, 109, 0, 0, 63, 64, 5, 97, 0, 0, 64, 65, 5, 112, 0, 0, 65, 20, 1, 0, 0, 0, 66, 67, 5, 35, 0, 0, 67, 22, 1, 0, 0, 0, 68, 69, 5, 110, 0, 0, 69, 70, 5, 97, 0, 0, 70, 71, 5, 109, 0, 0, 71, 72, 5, 101, 0, 0, 72, 73, 5, 115, 0, 0, 73, 74, 5, 112, 0, 0, 74, 75, 5, 97, 0, 0, 75, 76, 5, 99, 0, 0, 76, 77, 5, 101, 0, 0, 77, 24, 1, 0, 0, 0, 78, 80, 7, 0, 0, 0, 79, 78, 1, 0, 0, 0, 80, 81, 1, 0, 0, 0, 81, 79, 1, 0, 0, 0, 81, 82, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 84, 6, 12, 0, 0, 84, 26, 1, 0, 0, 0, 85, 89, 7, 1, 0, 0, 86, 88, 7, 2, 0, 0, 87, 86, 1, 0, 0, 0, 88, 91, 1, 0, 0, 0, 89, 87, 1, 0, 0, 0, 89, 90, 1, 0, 0, 0, 90, 94, 1, 0, 0, 0, 91, 89, 1, 0, 0, 0, 92, 94, 5, 48, 0, 0, 93, 85, 1, 0, 0, 0, 93, 92, 1, 0, 0, 0, 94, 28, 1, 0, 0, 0, 95, 96, 5, 48, 0, 0, 96, 97, 5, 120, 0, 0, 97, 101, 1, 0, 0, 0, 98, 100, 7, 3, 0, 0, 99, 98, 1, 0, 0, 0, 100, 103, 1, 0, 0, 0, 101, 99, 1, 0, 0, 0, 101, 102, 1, 0, 0, 0, 102, 30, 1, 0, 0, 0, 103, 101, 1, 0, 0, 0, 104, 110, 7, 4, 0, 0, 105, 109, 7, 5, 0, 0, 106, 107, 5, 58, 0, 0, 107, 109, 5, 58, 0, 0, 108, 105, 1, 0, 0, 0, 108, 106, 1, 0, 0, 0, 109, 112, 1, 0, 0, 0, 110, 108, 1, 0, 0, 0, 110, 111, 1, 0, 0, 0, 111, 32, 1, 0, 0, 0, 112, 110, 1, 0, 0, 0, 113, 114, 7, 6, 0, 0, 114, 34, 1, 0, 0, 0, 115, 116, 5, 92, 0, 0, 116, 117, 7, 7, 0, 0, 117, 36, 1, 0, 0, 0, 118, 123, 5, 34, 0, 0, 119, 122, 3, 35, 17, 0, 120, 122, 8, 8, 0, 0, 121, 119, 1, 0, 0, 0, 121, 120, 1, 0, 0, 0, 122, 125, 1, 0, 0, 0, 123, 121, 1, 0, 0, 0, 123, 124, 1, 0, 0, 0, 124, 126, 1, 0, 0, 0, 125, 123, 1, 0, 0, 0, 126, 127, 5, 34, 0, 0, 127, 38, 1, 0, 0, 0, 9, 0, 81, 89, 93, 101, 108, 110, 121, 123, 1, 6, 0, 0]
|
||||
+18
-12
@@ -7,18 +7,24 @@ T__5=6
|
||||
T__6=7
|
||||
T__7=8
|
||||
T__8=9
|
||||
WS=10
|
||||
NUMBER=11
|
||||
HEX=12
|
||||
IDENTIFIER=13
|
||||
MATH=14
|
||||
STRING=15
|
||||
T__9=10
|
||||
T__10=11
|
||||
T__11=12
|
||||
WS=13
|
||||
NUMBER=14
|
||||
HEX=15
|
||||
IDENTIFIER=16
|
||||
MATH=17
|
||||
STRING=18
|
||||
'('=1
|
||||
','=2
|
||||
')'=3
|
||||
'='=4
|
||||
'.'=5
|
||||
'%'=6
|
||||
';'=7
|
||||
'{'=8
|
||||
'}'=9
|
||||
'{'=4
|
||||
';'=5
|
||||
'}'=6
|
||||
'='=7
|
||||
'.'=8
|
||||
'struct'=9
|
||||
'map'=10
|
||||
'#'=11
|
||||
'namespace'=12
|
||||
|
||||
@@ -27,6 +27,12 @@ func (s *BaseWystListener) EnterRound_def(ctx *Round_defContext) {}
|
||||
// ExitRound_def is called when production round_def is exited.
|
||||
func (s *BaseWystListener) ExitRound_def(ctx *Round_defContext) {}
|
||||
|
||||
// EnterEnum_curly is called when production enum_curly is entered.
|
||||
func (s *BaseWystListener) EnterEnum_curly(ctx *Enum_curlyContext) {}
|
||||
|
||||
// ExitEnum_curly is called when production enum_curly is exited.
|
||||
func (s *BaseWystListener) ExitEnum_curly(ctx *Enum_curlyContext) {}
|
||||
|
||||
// EnterRound_call is called when production round_call is entered.
|
||||
func (s *BaseWystListener) EnterRound_call(ctx *Round_callContext) {}
|
||||
|
||||
@@ -63,11 +69,29 @@ func (s *BaseWystListener) EnterCall_tree(ctx *Call_treeContext) {}
|
||||
// ExitCall_tree is called when production call_tree is exited.
|
||||
func (s *BaseWystListener) ExitCall_tree(ctx *Call_treeContext) {}
|
||||
|
||||
// EnterAsm is called when production asm is entered.
|
||||
func (s *BaseWystListener) EnterAsm(ctx *AsmContext) {}
|
||||
// EnterStruct_def is called when production struct_def is entered.
|
||||
func (s *BaseWystListener) EnterStruct_def(ctx *Struct_defContext) {}
|
||||
|
||||
// ExitAsm is called when production asm is exited.
|
||||
func (s *BaseWystListener) ExitAsm(ctx *AsmContext) {}
|
||||
// ExitStruct_def is called when production struct_def is exited.
|
||||
func (s *BaseWystListener) ExitStruct_def(ctx *Struct_defContext) {}
|
||||
|
||||
// EnterPower_keyword is called when production power_keyword is entered.
|
||||
func (s *BaseWystListener) EnterPower_keyword(ctx *Power_keywordContext) {}
|
||||
|
||||
// ExitPower_keyword is called when production power_keyword is exited.
|
||||
func (s *BaseWystListener) ExitPower_keyword(ctx *Power_keywordContext) {}
|
||||
|
||||
// EnterPower_keyword_call is called when production power_keyword_call is entered.
|
||||
func (s *BaseWystListener) EnterPower_keyword_call(ctx *Power_keyword_callContext) {}
|
||||
|
||||
// ExitPower_keyword_call is called when production power_keyword_call is exited.
|
||||
func (s *BaseWystListener) ExitPower_keyword_call(ctx *Power_keyword_callContext) {}
|
||||
|
||||
// EnterNamespace is called when production namespace is entered.
|
||||
func (s *BaseWystListener) EnterNamespace(ctx *NamespaceContext) {}
|
||||
|
||||
// ExitNamespace is called when production namespace is exited.
|
||||
func (s *BaseWystListener) ExitNamespace(ctx *NamespaceContext) {}
|
||||
|
||||
// EnterExpr is called when production expr is entered.
|
||||
func (s *BaseWystListener) EnterExpr(ctx *ExprContext) {}
|
||||
|
||||
+71
-54
@@ -43,64 +43,78 @@ func wystlexerLexerInit() {
|
||||
"DEFAULT_MODE",
|
||||
}
|
||||
staticData.LiteralNames = []string{
|
||||
"", "'('", "','", "')'", "'='", "'.'", "'%'", "';'", "'{'", "'}'",
|
||||
"", "'('", "','", "')'", "'{'", "';'", "'}'", "'='", "'.'", "'struct'",
|
||||
"'map'", "'#'", "'namespace'",
|
||||
}
|
||||
staticData.SymbolicNames = []string{
|
||||
"", "", "", "", "", "", "", "", "", "", "WS", "NUMBER", "HEX", "IDENTIFIER",
|
||||
"MATH", "STRING",
|
||||
"", "", "", "", "", "", "", "", "", "", "", "", "", "WS", "NUMBER",
|
||||
"HEX", "IDENTIFIER", "MATH", "STRING",
|
||||
}
|
||||
staticData.RuleNames = []string{
|
||||
"T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8",
|
||||
"WS", "NUMBER", "HEX", "IDENTIFIER", "MATH", "ESC", "STRING",
|
||||
"T__9", "T__10", "T__11", "WS", "NUMBER", "HEX", "IDENTIFIER", "MATH",
|
||||
"ESC", "STRING",
|
||||
}
|
||||
staticData.PredictionContextCache = antlr.NewPredictionContextCache()
|
||||
staticData.serializedATN = []int32{
|
||||
4, 0, 15, 101, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2,
|
||||
4, 0, 18, 128, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2,
|
||||
4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2,
|
||||
10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15,
|
||||
7, 15, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5,
|
||||
1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 4, 9, 53, 8, 9, 11, 9,
|
||||
12, 9, 54, 1, 9, 1, 9, 1, 10, 1, 10, 5, 10, 61, 8, 10, 10, 10, 12, 10,
|
||||
64, 9, 10, 1, 10, 3, 10, 67, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11,
|
||||
73, 8, 11, 10, 11, 12, 11, 76, 9, 11, 1, 12, 1, 12, 1, 12, 1, 12, 5, 12,
|
||||
82, 8, 12, 10, 12, 12, 12, 85, 9, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14,
|
||||
1, 15, 1, 15, 1, 15, 5, 15, 95, 8, 15, 10, 15, 12, 15, 98, 9, 15, 1, 15,
|
||||
1, 15, 0, 0, 16, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17,
|
||||
9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 0, 31, 15, 1, 0, 9, 3, 0,
|
||||
9, 10, 13, 13, 32, 32, 1, 0, 49, 57, 1, 0, 48, 57, 3, 0, 48, 57, 65, 70,
|
||||
97, 102, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97,
|
||||
122, 3, 0, 42, 43, 45, 45, 47, 47, 3, 0, 34, 34, 39, 39, 92, 92, 2, 0,
|
||||
34, 34, 92, 92, 107, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0,
|
||||
0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0,
|
||||
0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1,
|
||||
0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 31,
|
||||
1, 0, 0, 0, 1, 33, 1, 0, 0, 0, 3, 35, 1, 0, 0, 0, 5, 37, 1, 0, 0, 0, 7,
|
||||
39, 1, 0, 0, 0, 9, 41, 1, 0, 0, 0, 11, 43, 1, 0, 0, 0, 13, 45, 1, 0, 0,
|
||||
0, 15, 47, 1, 0, 0, 0, 17, 49, 1, 0, 0, 0, 19, 52, 1, 0, 0, 0, 21, 66,
|
||||
1, 0, 0, 0, 23, 68, 1, 0, 0, 0, 25, 77, 1, 0, 0, 0, 27, 86, 1, 0, 0, 0,
|
||||
29, 88, 1, 0, 0, 0, 31, 91, 1, 0, 0, 0, 33, 34, 5, 40, 0, 0, 34, 2, 1,
|
||||
0, 0, 0, 35, 36, 5, 44, 0, 0, 36, 4, 1, 0, 0, 0, 37, 38, 5, 41, 0, 0, 38,
|
||||
6, 1, 0, 0, 0, 39, 40, 5, 61, 0, 0, 40, 8, 1, 0, 0, 0, 41, 42, 5, 46, 0,
|
||||
0, 42, 10, 1, 0, 0, 0, 43, 44, 5, 37, 0, 0, 44, 12, 1, 0, 0, 0, 45, 46,
|
||||
5, 59, 0, 0, 46, 14, 1, 0, 0, 0, 47, 48, 5, 123, 0, 0, 48, 16, 1, 0, 0,
|
||||
0, 49, 50, 5, 125, 0, 0, 50, 18, 1, 0, 0, 0, 51, 53, 7, 0, 0, 0, 52, 51,
|
||||
1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0,
|
||||
55, 56, 1, 0, 0, 0, 56, 57, 6, 9, 0, 0, 57, 20, 1, 0, 0, 0, 58, 62, 7,
|
||||
1, 0, 0, 59, 61, 7, 2, 0, 0, 60, 59, 1, 0, 0, 0, 61, 64, 1, 0, 0, 0, 62,
|
||||
60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 67, 1, 0, 0, 0, 64, 62, 1, 0, 0,
|
||||
0, 65, 67, 5, 48, 0, 0, 66, 58, 1, 0, 0, 0, 66, 65, 1, 0, 0, 0, 67, 22,
|
||||
1, 0, 0, 0, 68, 69, 5, 48, 0, 0, 69, 70, 5, 120, 0, 0, 70, 74, 1, 0, 0,
|
||||
0, 71, 73, 7, 3, 0, 0, 72, 71, 1, 0, 0, 0, 73, 76, 1, 0, 0, 0, 74, 72,
|
||||
1, 0, 0, 0, 74, 75, 1, 0, 0, 0, 75, 24, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0,
|
||||
77, 83, 7, 4, 0, 0, 78, 82, 7, 5, 0, 0, 79, 80, 5, 58, 0, 0, 80, 82, 5,
|
||||
58, 0, 0, 81, 78, 1, 0, 0, 0, 81, 79, 1, 0, 0, 0, 82, 85, 1, 0, 0, 0, 83,
|
||||
81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 26, 1, 0, 0, 0, 85, 83, 1, 0, 0,
|
||||
0, 86, 87, 7, 6, 0, 0, 87, 28, 1, 0, 0, 0, 88, 89, 5, 92, 0, 0, 89, 90,
|
||||
7, 7, 0, 0, 90, 30, 1, 0, 0, 0, 91, 96, 5, 34, 0, 0, 92, 95, 3, 29, 14,
|
||||
0, 93, 95, 8, 8, 0, 0, 94, 92, 1, 0, 0, 0, 94, 93, 1, 0, 0, 0, 95, 98,
|
||||
1, 0, 0, 0, 96, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 99, 1, 0, 0, 0,
|
||||
98, 96, 1, 0, 0, 0, 99, 100, 5, 34, 0, 0, 100, 32, 1, 0, 0, 0, 9, 0, 54,
|
||||
62, 66, 74, 81, 83, 94, 96, 1, 6, 0, 0,
|
||||
7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 1, 0, 1, 0, 1, 1, 1, 1,
|
||||
1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7,
|
||||
1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10,
|
||||
1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1,
|
||||
11, 1, 12, 4, 12, 80, 8, 12, 11, 12, 12, 12, 81, 1, 12, 1, 12, 1, 13, 1,
|
||||
13, 5, 13, 88, 8, 13, 10, 13, 12, 13, 91, 9, 13, 1, 13, 3, 13, 94, 8, 13,
|
||||
1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 100, 8, 14, 10, 14, 12, 14, 103, 9,
|
||||
14, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 109, 8, 15, 10, 15, 12, 15, 112,
|
||||
9, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 5, 18, 122,
|
||||
8, 18, 10, 18, 12, 18, 125, 9, 18, 1, 18, 1, 18, 0, 0, 19, 1, 1, 3, 2,
|
||||
5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25,
|
||||
13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 0, 37, 18, 1, 0, 9, 3, 0, 9, 10,
|
||||
13, 13, 32, 32, 1, 0, 49, 57, 1, 0, 48, 57, 3, 0, 48, 57, 65, 70, 97, 102,
|
||||
3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 3,
|
||||
0, 42, 43, 45, 45, 47, 47, 3, 0, 34, 34, 39, 39, 92, 92, 2, 0, 34, 34,
|
||||
92, 92, 134, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7,
|
||||
1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0,
|
||||
15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0,
|
||||
0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0,
|
||||
0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 1, 39, 1, 0,
|
||||
0, 0, 3, 41, 1, 0, 0, 0, 5, 43, 1, 0, 0, 0, 7, 45, 1, 0, 0, 0, 9, 47, 1,
|
||||
0, 0, 0, 11, 49, 1, 0, 0, 0, 13, 51, 1, 0, 0, 0, 15, 53, 1, 0, 0, 0, 17,
|
||||
55, 1, 0, 0, 0, 19, 62, 1, 0, 0, 0, 21, 66, 1, 0, 0, 0, 23, 68, 1, 0, 0,
|
||||
0, 25, 79, 1, 0, 0, 0, 27, 93, 1, 0, 0, 0, 29, 95, 1, 0, 0, 0, 31, 104,
|
||||
1, 0, 0, 0, 33, 113, 1, 0, 0, 0, 35, 115, 1, 0, 0, 0, 37, 118, 1, 0, 0,
|
||||
0, 39, 40, 5, 40, 0, 0, 40, 2, 1, 0, 0, 0, 41, 42, 5, 44, 0, 0, 42, 4,
|
||||
1, 0, 0, 0, 43, 44, 5, 41, 0, 0, 44, 6, 1, 0, 0, 0, 45, 46, 5, 123, 0,
|
||||
0, 46, 8, 1, 0, 0, 0, 47, 48, 5, 59, 0, 0, 48, 10, 1, 0, 0, 0, 49, 50,
|
||||
5, 125, 0, 0, 50, 12, 1, 0, 0, 0, 51, 52, 5, 61, 0, 0, 52, 14, 1, 0, 0,
|
||||
0, 53, 54, 5, 46, 0, 0, 54, 16, 1, 0, 0, 0, 55, 56, 5, 115, 0, 0, 56, 57,
|
||||
5, 116, 0, 0, 57, 58, 5, 114, 0, 0, 58, 59, 5, 117, 0, 0, 59, 60, 5, 99,
|
||||
0, 0, 60, 61, 5, 116, 0, 0, 61, 18, 1, 0, 0, 0, 62, 63, 5, 109, 0, 0, 63,
|
||||
64, 5, 97, 0, 0, 64, 65, 5, 112, 0, 0, 65, 20, 1, 0, 0, 0, 66, 67, 5, 35,
|
||||
0, 0, 67, 22, 1, 0, 0, 0, 68, 69, 5, 110, 0, 0, 69, 70, 5, 97, 0, 0, 70,
|
||||
71, 5, 109, 0, 0, 71, 72, 5, 101, 0, 0, 72, 73, 5, 115, 0, 0, 73, 74, 5,
|
||||
112, 0, 0, 74, 75, 5, 97, 0, 0, 75, 76, 5, 99, 0, 0, 76, 77, 5, 101, 0,
|
||||
0, 77, 24, 1, 0, 0, 0, 78, 80, 7, 0, 0, 0, 79, 78, 1, 0, 0, 0, 80, 81,
|
||||
1, 0, 0, 0, 81, 79, 1, 0, 0, 0, 81, 82, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0,
|
||||
83, 84, 6, 12, 0, 0, 84, 26, 1, 0, 0, 0, 85, 89, 7, 1, 0, 0, 86, 88, 7,
|
||||
2, 0, 0, 87, 86, 1, 0, 0, 0, 88, 91, 1, 0, 0, 0, 89, 87, 1, 0, 0, 0, 89,
|
||||
90, 1, 0, 0, 0, 90, 94, 1, 0, 0, 0, 91, 89, 1, 0, 0, 0, 92, 94, 5, 48,
|
||||
0, 0, 93, 85, 1, 0, 0, 0, 93, 92, 1, 0, 0, 0, 94, 28, 1, 0, 0, 0, 95, 96,
|
||||
5, 48, 0, 0, 96, 97, 5, 120, 0, 0, 97, 101, 1, 0, 0, 0, 98, 100, 7, 3,
|
||||
0, 0, 99, 98, 1, 0, 0, 0, 100, 103, 1, 0, 0, 0, 101, 99, 1, 0, 0, 0, 101,
|
||||
102, 1, 0, 0, 0, 102, 30, 1, 0, 0, 0, 103, 101, 1, 0, 0, 0, 104, 110, 7,
|
||||
4, 0, 0, 105, 109, 7, 5, 0, 0, 106, 107, 5, 58, 0, 0, 107, 109, 5, 58,
|
||||
0, 0, 108, 105, 1, 0, 0, 0, 108, 106, 1, 0, 0, 0, 109, 112, 1, 0, 0, 0,
|
||||
110, 108, 1, 0, 0, 0, 110, 111, 1, 0, 0, 0, 111, 32, 1, 0, 0, 0, 112, 110,
|
||||
1, 0, 0, 0, 113, 114, 7, 6, 0, 0, 114, 34, 1, 0, 0, 0, 115, 116, 5, 92,
|
||||
0, 0, 116, 117, 7, 7, 0, 0, 117, 36, 1, 0, 0, 0, 118, 123, 5, 34, 0, 0,
|
||||
119, 122, 3, 35, 17, 0, 120, 122, 8, 8, 0, 0, 121, 119, 1, 0, 0, 0, 121,
|
||||
120, 1, 0, 0, 0, 122, 125, 1, 0, 0, 0, 123, 121, 1, 0, 0, 0, 123, 124,
|
||||
1, 0, 0, 0, 124, 126, 1, 0, 0, 0, 125, 123, 1, 0, 0, 0, 126, 127, 5, 34,
|
||||
0, 0, 127, 38, 1, 0, 0, 0, 9, 0, 81, 89, 93, 101, 108, 110, 121, 123, 1,
|
||||
6, 0, 0,
|
||||
}
|
||||
deserializer := antlr.NewATNDeserializer(nil)
|
||||
staticData.atn = deserializer.Deserialize(staticData.serializedATN)
|
||||
@@ -150,10 +164,13 @@ const (
|
||||
WystLexerT__6 = 7
|
||||
WystLexerT__7 = 8
|
||||
WystLexerT__8 = 9
|
||||
WystLexerWS = 10
|
||||
WystLexerNUMBER = 11
|
||||
WystLexerHEX = 12
|
||||
WystLexerIDENTIFIER = 13
|
||||
WystLexerMATH = 14
|
||||
WystLexerSTRING = 15
|
||||
WystLexerT__9 = 10
|
||||
WystLexerT__10 = 11
|
||||
WystLexerT__11 = 12
|
||||
WystLexerWS = 13
|
||||
WystLexerNUMBER = 14
|
||||
WystLexerHEX = 15
|
||||
WystLexerIDENTIFIER = 16
|
||||
WystLexerMATH = 17
|
||||
WystLexerSTRING = 18
|
||||
)
|
||||
|
||||
+28
-4
@@ -11,6 +11,9 @@ type WystListener interface {
|
||||
// EnterRound_def is called when entering the round_def production.
|
||||
EnterRound_def(c *Round_defContext)
|
||||
|
||||
// EnterEnum_curly is called when entering the enum_curly production.
|
||||
EnterEnum_curly(c *Enum_curlyContext)
|
||||
|
||||
// EnterRound_call is called when entering the round_call production.
|
||||
EnterRound_call(c *Round_callContext)
|
||||
|
||||
@@ -29,8 +32,17 @@ type WystListener interface {
|
||||
// EnterCall_tree is called when entering the call_tree production.
|
||||
EnterCall_tree(c *Call_treeContext)
|
||||
|
||||
// EnterAsm is called when entering the asm production.
|
||||
EnterAsm(c *AsmContext)
|
||||
// EnterStruct_def is called when entering the struct_def production.
|
||||
EnterStruct_def(c *Struct_defContext)
|
||||
|
||||
// EnterPower_keyword is called when entering the power_keyword production.
|
||||
EnterPower_keyword(c *Power_keywordContext)
|
||||
|
||||
// EnterPower_keyword_call is called when entering the power_keyword_call production.
|
||||
EnterPower_keyword_call(c *Power_keyword_callContext)
|
||||
|
||||
// EnterNamespace is called when entering the namespace production.
|
||||
EnterNamespace(c *NamespaceContext)
|
||||
|
||||
// EnterExpr is called when entering the expr production.
|
||||
EnterExpr(c *ExprContext)
|
||||
@@ -44,6 +56,9 @@ type WystListener interface {
|
||||
// ExitRound_def is called when exiting the round_def production.
|
||||
ExitRound_def(c *Round_defContext)
|
||||
|
||||
// ExitEnum_curly is called when exiting the enum_curly production.
|
||||
ExitEnum_curly(c *Enum_curlyContext)
|
||||
|
||||
// ExitRound_call is called when exiting the round_call production.
|
||||
ExitRound_call(c *Round_callContext)
|
||||
|
||||
@@ -62,8 +77,17 @@ type WystListener interface {
|
||||
// ExitCall_tree is called when exiting the call_tree production.
|
||||
ExitCall_tree(c *Call_treeContext)
|
||||
|
||||
// ExitAsm is called when exiting the asm production.
|
||||
ExitAsm(c *AsmContext)
|
||||
// ExitStruct_def is called when exiting the struct_def production.
|
||||
ExitStruct_def(c *Struct_defContext)
|
||||
|
||||
// ExitPower_keyword is called when exiting the power_keyword production.
|
||||
ExitPower_keyword(c *Power_keywordContext)
|
||||
|
||||
// ExitPower_keyword_call is called when exiting the power_keyword_call production.
|
||||
ExitPower_keyword_call(c *Power_keyword_callContext)
|
||||
|
||||
// ExitNamespace is called when exiting the namespace production.
|
||||
ExitNamespace(c *NamespaceContext)
|
||||
|
||||
// ExitExpr is called when exiting the expr production.
|
||||
ExitExpr(c *ExprContext)
|
||||
|
||||
+1056
-222
File diff suppressed because it is too large
Load Diff
+33
-1
@@ -65,7 +65,7 @@ func TranspileNode(node ASTNode) string {
|
||||
res += fmt.Sprintf("var %s %s", TranspileNode(node.Inner[1]), TranspileNode(node.Inner[0]))
|
||||
case "round_def":
|
||||
fmt.Sprintf("(%s)", strings.TrimSuffix(strings.ReplaceAll(TranspileNodes(node.Inner), "var ", ""), " "))
|
||||
case "asm":
|
||||
case "power_keyword_call":
|
||||
if node.Inner[0].Text == "map" && len(node.Inner) == 4 {
|
||||
wyst_map = append(wyst_map, wmap{node.Inner[1].Text, node.Inner[2].Text})
|
||||
}
|
||||
@@ -84,6 +84,38 @@ func TranspileNode(node ASTNode) string {
|
||||
case "round_call":
|
||||
res += fmt.Sprintf("(%s)", TranspileNodes(node.Inner))
|
||||
|
||||
case "struct_def":
|
||||
res += fmt.Sprintf("type %s struct %s\n", TranspileNode(node.Inner[0]), TranspileNode(node.Inner[1]))
|
||||
|
||||
case "enum_curly":
|
||||
res += fmt.Sprintf("{\n %s}", strings.TrimSuffix(TranspileNodes(node.Inner), " "))
|
||||
|
||||
case "namespace":
|
||||
namespace_name := "n" + TranspileNode(node.Inner[0])
|
||||
res += fmt.Sprintf("type %s struct {\n ", namespace_name)
|
||||
vals := ""
|
||||
for _, c := range node.Inner {
|
||||
if c.Rule == "var_def" {
|
||||
res += strings.TrimPrefix(TranspileNode(c), "var ")
|
||||
res += "\n "
|
||||
} else if c.Rule == "var_def_set" {
|
||||
res += strings.TrimPrefix(TranspileNode(c.Inner[0]), "var ")
|
||||
res += "\n "
|
||||
vals += fmt.Sprintf("%s: %s, ", TranspileNode(c.Inner[0].Inner[1]), TranspileNode(c.Inner[1]))
|
||||
}
|
||||
}
|
||||
res += "}\n"
|
||||
for _, c := range node.Inner {
|
||||
if c.Rule == "func_def" {
|
||||
res += fmt.Sprintf("func (%s) %s%s %s %s", namespace_name, TranspileNode(c.Inner[1]), TranspileNode(c.Inner[2]), TranspileNode(c.Inner[0]), TranspileNode(c.Inner[3]))
|
||||
res += "\n "
|
||||
}
|
||||
}
|
||||
res += fmt.Sprintf("var %s %s = %s{%s}", TranspileNode(node.Inner[0]), namespace_name, namespace_name, vals)
|
||||
|
||||
case "var_def_set":
|
||||
res += fmt.Sprintf("%s = %s", TranspileNode(node.Inner[0]), TranspileNode(node.Inner[1]))
|
||||
|
||||
default:
|
||||
fmt.Printf("\x1b[33mDEV NOTICE:\x1b[0m Missing case for '%s'\n", node.Rule)
|
||||
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
%map _, _;
|
||||
#map _, _;
|
||||
|
||||
int main(test x) {
|
||||
x::h.y.z(0, "test");
|
||||
int main() {
|
||||
int x = 20;
|
||||
}
|
||||
Reference in New Issue
Block a user