include and use
This commit is contained in:
@@ -3,7 +3,7 @@ grammar Wyst;
|
|||||||
WS: [ \t\r\n]+ -> skip;
|
WS: [ \t\r\n]+ -> skip;
|
||||||
NUMBER: [1-9][0-9]* | '0';
|
NUMBER: [1-9][0-9]* | '0';
|
||||||
HEX: '0x' [a-fA-F0-9]*;
|
HEX: '0x' [a-fA-F0-9]*;
|
||||||
IDENTIFIER: [a-zA-Z_] ([a-zA-Z0-9_] | '::')*;
|
IDENTIFIER: [a-zA-Z_] [a-zA-Z0-9_]* ('::' [a-zA-Z_] [a-zA-Z0-9_]*)*;
|
||||||
MATH: '+' | '-' | '*' | '/';
|
MATH: '+' | '-' | '*' | '/';
|
||||||
fragment ESC: '\\' ['"\\] ;
|
fragment ESC: '\\' ['"\\] ;
|
||||||
STRING: '"' (ESC | ~["\\])* '"';
|
STRING: '"' (ESC | ~["\\])* '"';
|
||||||
@@ -16,9 +16,9 @@ var_def: IDENTIFIER IDENTIFIER;
|
|||||||
var_def_set: var_def '=' expr;
|
var_def_set: var_def '=' expr;
|
||||||
call_tree: (fn_call|IDENTIFIER) ('.' (fn_call|IDENTIFIER))*;
|
call_tree: (fn_call|IDENTIFIER) ('.' (fn_call|IDENTIFIER))*;
|
||||||
struct_def: 'struct' IDENTIFIER enum_curly;
|
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)* '}';
|
namespace: 'namespace' IDENTIFIER '{' (((var_def|var_def_set) ';')|func_def)* '}';
|
||||||
|
import_statement: 'include' IDENTIFIER ';';
|
||||||
|
use_statement: 'use' IDENTIFIER ';';
|
||||||
|
|
||||||
expr:
|
expr:
|
||||||
(
|
(
|
||||||
@@ -34,9 +34,11 @@ code_block: '{' ((
|
|||||||
var_def |
|
var_def |
|
||||||
var_def_set
|
var_def_set
|
||||||
) ';')* '}';
|
) ';')* '}';
|
||||||
|
|
||||||
top: (
|
top: (
|
||||||
power_keyword_call |
|
|
||||||
func_def |
|
func_def |
|
||||||
struct_def |
|
struct_def |
|
||||||
namespace
|
namespace |
|
||||||
|
import_statement |
|
||||||
|
use_statement
|
||||||
)*;
|
)*;
|
||||||
+5
-5
File diff suppressed because one or more lines are too long
+3
-3
@@ -25,6 +25,6 @@ STRING=18
|
|||||||
'='=7
|
'='=7
|
||||||
'.'=8
|
'.'=8
|
||||||
'struct'=9
|
'struct'=9
|
||||||
'map'=10
|
'namespace'=10
|
||||||
'#'=11
|
'include'=11
|
||||||
'namespace'=12
|
'use'=12
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ null
|
|||||||
'='
|
'='
|
||||||
'.'
|
'.'
|
||||||
'struct'
|
'struct'
|
||||||
'map'
|
|
||||||
'#'
|
|
||||||
'namespace'
|
'namespace'
|
||||||
|
'include'
|
||||||
|
'use'
|
||||||
null
|
null
|
||||||
null
|
null
|
||||||
null
|
null
|
||||||
@@ -69,4 +69,4 @@ mode names:
|
|||||||
DEFAULT_MODE
|
DEFAULT_MODE
|
||||||
|
|
||||||
atn:
|
atn:
|
||||||
[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]
|
[4, 0, 18, 147, 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, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 4, 12, 86, 8, 12, 11, 12, 12, 12, 87, 1, 12, 1, 12, 1, 13, 1, 13, 5, 13, 94, 8, 13, 10, 13, 12, 13, 97, 9, 13, 1, 13, 3, 13, 100, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 106, 8, 14, 10, 14, 12, 14, 109, 9, 14, 1, 15, 1, 15, 5, 15, 113, 8, 15, 10, 15, 12, 15, 116, 9, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 123, 8, 15, 10, 15, 12, 15, 126, 9, 15, 5, 15, 128, 8, 15, 10, 15, 12, 15, 131, 9, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 5, 18, 141, 8, 18, 10, 18, 12, 18, 144, 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, 154, 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, 72, 1, 0, 0, 0, 23, 80, 1, 0, 0, 0, 25, 85, 1, 0, 0, 0, 27, 99, 1, 0, 0, 0, 29, 101, 1, 0, 0, 0, 31, 110, 1, 0, 0, 0, 33, 132, 1, 0, 0, 0, 35, 134, 1, 0, 0, 0, 37, 137, 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, 110, 0, 0, 63, 64, 5, 97, 0, 0, 64, 65, 5, 109, 0, 0, 65, 66, 5, 101, 0, 0, 66, 67, 5, 115, 0, 0, 67, 68, 5, 112, 0, 0, 68, 69, 5, 97, 0, 0, 69, 70, 5, 99, 0, 0, 70, 71, 5, 101, 0, 0, 71, 20, 1, 0, 0, 0, 72, 73, 5, 105, 0, 0, 73, 74, 5, 110, 0, 0, 74, 75, 5, 99, 0, 0, 75, 76, 5, 108, 0, 0, 76, 77, 5, 117, 0, 0, 77, 78, 5, 100, 0, 0, 78, 79, 5, 101, 0, 0, 79, 22, 1, 0, 0, 0, 80, 81, 5, 117, 0, 0, 81, 82, 5, 115, 0, 0, 82, 83, 5, 101, 0, 0, 83, 24, 1, 0, 0, 0, 84, 86, 7, 0, 0, 0, 85, 84, 1, 0, 0, 0, 86, 87, 1, 0, 0, 0, 87, 85, 1, 0, 0, 0, 87, 88, 1, 0, 0, 0, 88, 89, 1, 0, 0, 0, 89, 90, 6, 12, 0, 0, 90, 26, 1, 0, 0, 0, 91, 95, 7, 1, 0, 0, 92, 94, 7, 2, 0, 0, 93, 92, 1, 0, 0, 0, 94, 97, 1, 0, 0, 0, 95, 93, 1, 0, 0, 0, 95, 96, 1, 0, 0, 0, 96, 100, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 98, 100, 5, 48, 0, 0, 99, 91, 1, 0, 0, 0, 99, 98, 1, 0, 0, 0, 100, 28, 1, 0, 0, 0, 101, 102, 5, 48, 0, 0, 102, 103, 5, 120, 0, 0, 103, 107, 1, 0, 0, 0, 104, 106, 7, 3, 0, 0, 105, 104, 1, 0, 0, 0, 106, 109, 1, 0, 0, 0, 107, 105, 1, 0, 0, 0, 107, 108, 1, 0, 0, 0, 108, 30, 1, 0, 0, 0, 109, 107, 1, 0, 0, 0, 110, 114, 7, 4, 0, 0, 111, 113, 7, 5, 0, 0, 112, 111, 1, 0, 0, 0, 113, 116, 1, 0, 0, 0, 114, 112, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115, 129, 1, 0, 0, 0, 116, 114, 1, 0, 0, 0, 117, 118, 5, 58, 0, 0, 118, 119, 5, 58, 0, 0, 119, 120, 1, 0, 0, 0, 120, 124, 7, 4, 0, 0, 121, 123, 7, 5, 0, 0, 122, 121, 1, 0, 0, 0, 123, 126, 1, 0, 0, 0, 124, 122, 1, 0, 0, 0, 124, 125, 1, 0, 0, 0, 125, 128, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 127, 117, 1, 0, 0, 0, 128, 131, 1, 0, 0, 0, 129, 127, 1, 0, 0, 0, 129, 130, 1, 0, 0, 0, 130, 32, 1, 0, 0, 0, 131, 129, 1, 0, 0, 0, 132, 133, 7, 6, 0, 0, 133, 34, 1, 0, 0, 0, 134, 135, 5, 92, 0, 0, 135, 136, 7, 7, 0, 0, 136, 36, 1, 0, 0, 0, 137, 142, 5, 34, 0, 0, 138, 141, 3, 35, 17, 0, 139, 141, 8, 8, 0, 0, 140, 138, 1, 0, 0, 0, 140, 139, 1, 0, 0, 0, 141, 144, 1, 0, 0, 0, 142, 140, 1, 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 145, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0, 145, 146, 5, 34, 0, 0, 146, 38, 1, 0, 0, 0, 10, 0, 87, 95, 99, 107, 114, 124, 129, 140, 142, 1, 6, 0, 0]
|
||||||
@@ -25,6 +25,6 @@ STRING=18
|
|||||||
'='=7
|
'='=7
|
||||||
'.'=8
|
'.'=8
|
||||||
'struct'=9
|
'struct'=9
|
||||||
'map'=10
|
'namespace'=10
|
||||||
'#'=11
|
'include'=11
|
||||||
'namespace'=12
|
'use'=12
|
||||||
|
|||||||
@@ -75,24 +75,24 @@ func (s *BaseWystListener) EnterStruct_def(ctx *Struct_defContext) {}
|
|||||||
// ExitStruct_def is called when production struct_def is exited.
|
// ExitStruct_def is called when production struct_def is exited.
|
||||||
func (s *BaseWystListener) ExitStruct_def(ctx *Struct_defContext) {}
|
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.
|
// EnterNamespace is called when production namespace is entered.
|
||||||
func (s *BaseWystListener) EnterNamespace(ctx *NamespaceContext) {}
|
func (s *BaseWystListener) EnterNamespace(ctx *NamespaceContext) {}
|
||||||
|
|
||||||
// ExitNamespace is called when production namespace is exited.
|
// ExitNamespace is called when production namespace is exited.
|
||||||
func (s *BaseWystListener) ExitNamespace(ctx *NamespaceContext) {}
|
func (s *BaseWystListener) ExitNamespace(ctx *NamespaceContext) {}
|
||||||
|
|
||||||
|
// EnterImport_statement is called when production import_statement is entered.
|
||||||
|
func (s *BaseWystListener) EnterImport_statement(ctx *Import_statementContext) {}
|
||||||
|
|
||||||
|
// ExitImport_statement is called when production import_statement is exited.
|
||||||
|
func (s *BaseWystListener) ExitImport_statement(ctx *Import_statementContext) {}
|
||||||
|
|
||||||
|
// EnterUse_statement is called when production use_statement is entered.
|
||||||
|
func (s *BaseWystListener) EnterUse_statement(ctx *Use_statementContext) {}
|
||||||
|
|
||||||
|
// ExitUse_statement is called when production use_statement is exited.
|
||||||
|
func (s *BaseWystListener) ExitUse_statement(ctx *Use_statementContext) {}
|
||||||
|
|
||||||
// EnterExpr is called when production expr is entered.
|
// EnterExpr is called when production expr is entered.
|
||||||
func (s *BaseWystListener) EnterExpr(ctx *ExprContext) {}
|
func (s *BaseWystListener) EnterExpr(ctx *ExprContext) {}
|
||||||
|
|
||||||
|
|||||||
+63
-55
@@ -44,7 +44,7 @@ func wystlexerLexerInit() {
|
|||||||
}
|
}
|
||||||
staticData.LiteralNames = []string{
|
staticData.LiteralNames = []string{
|
||||||
"", "'('", "','", "')'", "'{'", "';'", "'}'", "'='", "'.'", "'struct'",
|
"", "'('", "','", "')'", "'{'", "';'", "'}'", "'='", "'.'", "'struct'",
|
||||||
"'map'", "'#'", "'namespace'",
|
"'namespace'", "'include'", "'use'",
|
||||||
}
|
}
|
||||||
staticData.SymbolicNames = []string{
|
staticData.SymbolicNames = []string{
|
||||||
"", "", "", "", "", "", "", "", "", "", "", "", "", "WS", "NUMBER",
|
"", "", "", "", "", "", "", "", "", "", "", "", "", "WS", "NUMBER",
|
||||||
@@ -57,64 +57,72 @@ func wystlexerLexerInit() {
|
|||||||
}
|
}
|
||||||
staticData.PredictionContextCache = antlr.NewPredictionContextCache()
|
staticData.PredictionContextCache = antlr.NewPredictionContextCache()
|
||||||
staticData.serializedATN = []int32{
|
staticData.serializedATN = []int32{
|
||||||
4, 0, 18, 128, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2,
|
4, 0, 18, 147, 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,
|
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,
|
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,
|
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, 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, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9,
|
||||||
1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1,
|
1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10,
|
||||||
11, 1, 12, 4, 12, 80, 8, 12, 11, 12, 12, 12, 81, 1, 12, 1, 12, 1, 13, 1,
|
1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 4, 12, 86, 8, 12, 11,
|
||||||
13, 5, 13, 88, 8, 13, 10, 13, 12, 13, 91, 9, 13, 1, 13, 3, 13, 94, 8, 13,
|
12, 12, 12, 87, 1, 12, 1, 12, 1, 13, 1, 13, 5, 13, 94, 8, 13, 10, 13, 12,
|
||||||
1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 100, 8, 14, 10, 14, 12, 14, 103, 9,
|
13, 97, 9, 13, 1, 13, 3, 13, 100, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 5,
|
||||||
14, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 109, 8, 15, 10, 15, 12, 15, 112,
|
14, 106, 8, 14, 10, 14, 12, 14, 109, 9, 14, 1, 15, 1, 15, 5, 15, 113, 8,
|
||||||
9, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 5, 18, 122,
|
15, 10, 15, 12, 15, 116, 9, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15,
|
||||||
8, 18, 10, 18, 12, 18, 125, 9, 18, 1, 18, 1, 18, 0, 0, 19, 1, 1, 3, 2,
|
123, 8, 15, 10, 15, 12, 15, 126, 9, 15, 5, 15, 128, 8, 15, 10, 15, 12,
|
||||||
5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25,
|
15, 131, 9, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18,
|
||||||
13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 0, 37, 18, 1, 0, 9, 3, 0, 9, 10,
|
5, 18, 141, 8, 18, 10, 18, 12, 18, 144, 9, 18, 1, 18, 1, 18, 0, 0, 19,
|
||||||
13, 13, 32, 32, 1, 0, 49, 57, 1, 0, 48, 57, 3, 0, 48, 57, 65, 70, 97, 102,
|
1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11,
|
||||||
3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 3,
|
23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 0, 37, 18, 1, 0, 9,
|
||||||
0, 42, 43, 45, 45, 47, 47, 3, 0, 34, 34, 39, 39, 92, 92, 2, 0, 34, 34,
|
3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 49, 57, 1, 0, 48, 57, 3, 0, 48, 57,
|
||||||
92, 92, 134, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7,
|
65, 70, 97, 102, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95,
|
||||||
1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0,
|
95, 97, 122, 3, 0, 42, 43, 45, 45, 47, 47, 3, 0, 34, 34, 39, 39, 92, 92,
|
||||||
15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0,
|
2, 0, 34, 34, 92, 92, 154, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1,
|
||||||
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, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13,
|
||||||
0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 1, 39, 1, 0,
|
1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0,
|
||||||
0, 0, 3, 41, 1, 0, 0, 0, 5, 43, 1, 0, 0, 0, 7, 45, 1, 0, 0, 0, 9, 47, 1,
|
21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0,
|
||||||
0, 0, 0, 11, 49, 1, 0, 0, 0, 13, 51, 1, 0, 0, 0, 15, 53, 1, 0, 0, 0, 17,
|
0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 37, 1, 0, 0,
|
||||||
55, 1, 0, 0, 0, 19, 62, 1, 0, 0, 0, 21, 66, 1, 0, 0, 0, 23, 68, 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, 25, 79, 1, 0, 0, 0, 27, 93, 1, 0, 0, 0, 29, 95, 1, 0, 0, 0, 31, 104,
|
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, 33, 113, 1, 0, 0, 0, 35, 115, 1, 0, 0, 0, 37, 118, 1, 0, 0,
|
1, 0, 0, 0, 17, 55, 1, 0, 0, 0, 19, 62, 1, 0, 0, 0, 21, 72, 1, 0, 0, 0,
|
||||||
0, 39, 40, 5, 40, 0, 0, 40, 2, 1, 0, 0, 0, 41, 42, 5, 44, 0, 0, 42, 4,
|
23, 80, 1, 0, 0, 0, 25, 85, 1, 0, 0, 0, 27, 99, 1, 0, 0, 0, 29, 101, 1,
|
||||||
1, 0, 0, 0, 43, 44, 5, 41, 0, 0, 44, 6, 1, 0, 0, 0, 45, 46, 5, 123, 0,
|
0, 0, 0, 31, 110, 1, 0, 0, 0, 33, 132, 1, 0, 0, 0, 35, 134, 1, 0, 0, 0,
|
||||||
0, 46, 8, 1, 0, 0, 0, 47, 48, 5, 59, 0, 0, 48, 10, 1, 0, 0, 0, 49, 50,
|
37, 137, 1, 0, 0, 0, 39, 40, 5, 40, 0, 0, 40, 2, 1, 0, 0, 0, 41, 42, 5,
|
||||||
5, 125, 0, 0, 50, 12, 1, 0, 0, 0, 51, 52, 5, 61, 0, 0, 52, 14, 1, 0, 0,
|
44, 0, 0, 42, 4, 1, 0, 0, 0, 43, 44, 5, 41, 0, 0, 44, 6, 1, 0, 0, 0, 45,
|
||||||
0, 53, 54, 5, 46, 0, 0, 54, 16, 1, 0, 0, 0, 55, 56, 5, 115, 0, 0, 56, 57,
|
46, 5, 123, 0, 0, 46, 8, 1, 0, 0, 0, 47, 48, 5, 59, 0, 0, 48, 10, 1, 0,
|
||||||
5, 116, 0, 0, 57, 58, 5, 114, 0, 0, 58, 59, 5, 117, 0, 0, 59, 60, 5, 99,
|
0, 0, 49, 50, 5, 125, 0, 0, 50, 12, 1, 0, 0, 0, 51, 52, 5, 61, 0, 0, 52,
|
||||||
0, 0, 60, 61, 5, 116, 0, 0, 61, 18, 1, 0, 0, 0, 62, 63, 5, 109, 0, 0, 63,
|
14, 1, 0, 0, 0, 53, 54, 5, 46, 0, 0, 54, 16, 1, 0, 0, 0, 55, 56, 5, 115,
|
||||||
64, 5, 97, 0, 0, 64, 65, 5, 112, 0, 0, 65, 20, 1, 0, 0, 0, 66, 67, 5, 35,
|
0, 0, 56, 57, 5, 116, 0, 0, 57, 58, 5, 114, 0, 0, 58, 59, 5, 117, 0, 0,
|
||||||
0, 0, 67, 22, 1, 0, 0, 0, 68, 69, 5, 110, 0, 0, 69, 70, 5, 97, 0, 0, 70,
|
59, 60, 5, 99, 0, 0, 60, 61, 5, 116, 0, 0, 61, 18, 1, 0, 0, 0, 62, 63,
|
||||||
71, 5, 109, 0, 0, 71, 72, 5, 101, 0, 0, 72, 73, 5, 115, 0, 0, 73, 74, 5,
|
5, 110, 0, 0, 63, 64, 5, 97, 0, 0, 64, 65, 5, 109, 0, 0, 65, 66, 5, 101,
|
||||||
112, 0, 0, 74, 75, 5, 97, 0, 0, 75, 76, 5, 99, 0, 0, 76, 77, 5, 101, 0,
|
0, 0, 66, 67, 5, 115, 0, 0, 67, 68, 5, 112, 0, 0, 68, 69, 5, 97, 0, 0,
|
||||||
0, 77, 24, 1, 0, 0, 0, 78, 80, 7, 0, 0, 0, 79, 78, 1, 0, 0, 0, 80, 81,
|
69, 70, 5, 99, 0, 0, 70, 71, 5, 101, 0, 0, 71, 20, 1, 0, 0, 0, 72, 73,
|
||||||
1, 0, 0, 0, 81, 79, 1, 0, 0, 0, 81, 82, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0,
|
5, 105, 0, 0, 73, 74, 5, 110, 0, 0, 74, 75, 5, 99, 0, 0, 75, 76, 5, 108,
|
||||||
83, 84, 6, 12, 0, 0, 84, 26, 1, 0, 0, 0, 85, 89, 7, 1, 0, 0, 86, 88, 7,
|
0, 0, 76, 77, 5, 117, 0, 0, 77, 78, 5, 100, 0, 0, 78, 79, 5, 101, 0, 0,
|
||||||
2, 0, 0, 87, 86, 1, 0, 0, 0, 88, 91, 1, 0, 0, 0, 89, 87, 1, 0, 0, 0, 89,
|
79, 22, 1, 0, 0, 0, 80, 81, 5, 117, 0, 0, 81, 82, 5, 115, 0, 0, 82, 83,
|
||||||
90, 1, 0, 0, 0, 90, 94, 1, 0, 0, 0, 91, 89, 1, 0, 0, 0, 92, 94, 5, 48,
|
5, 101, 0, 0, 83, 24, 1, 0, 0, 0, 84, 86, 7, 0, 0, 0, 85, 84, 1, 0, 0,
|
||||||
0, 0, 93, 85, 1, 0, 0, 0, 93, 92, 1, 0, 0, 0, 94, 28, 1, 0, 0, 0, 95, 96,
|
0, 86, 87, 1, 0, 0, 0, 87, 85, 1, 0, 0, 0, 87, 88, 1, 0, 0, 0, 88, 89,
|
||||||
5, 48, 0, 0, 96, 97, 5, 120, 0, 0, 97, 101, 1, 0, 0, 0, 98, 100, 7, 3,
|
1, 0, 0, 0, 89, 90, 6, 12, 0, 0, 90, 26, 1, 0, 0, 0, 91, 95, 7, 1, 0, 0,
|
||||||
0, 0, 99, 98, 1, 0, 0, 0, 100, 103, 1, 0, 0, 0, 101, 99, 1, 0, 0, 0, 101,
|
92, 94, 7, 2, 0, 0, 93, 92, 1, 0, 0, 0, 94, 97, 1, 0, 0, 0, 95, 93, 1,
|
||||||
102, 1, 0, 0, 0, 102, 30, 1, 0, 0, 0, 103, 101, 1, 0, 0, 0, 104, 110, 7,
|
0, 0, 0, 95, 96, 1, 0, 0, 0, 96, 100, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 98,
|
||||||
4, 0, 0, 105, 109, 7, 5, 0, 0, 106, 107, 5, 58, 0, 0, 107, 109, 5, 58,
|
100, 5, 48, 0, 0, 99, 91, 1, 0, 0, 0, 99, 98, 1, 0, 0, 0, 100, 28, 1, 0,
|
||||||
0, 0, 108, 105, 1, 0, 0, 0, 108, 106, 1, 0, 0, 0, 109, 112, 1, 0, 0, 0,
|
0, 0, 101, 102, 5, 48, 0, 0, 102, 103, 5, 120, 0, 0, 103, 107, 1, 0, 0,
|
||||||
110, 108, 1, 0, 0, 0, 110, 111, 1, 0, 0, 0, 111, 32, 1, 0, 0, 0, 112, 110,
|
0, 104, 106, 7, 3, 0, 0, 105, 104, 1, 0, 0, 0, 106, 109, 1, 0, 0, 0, 107,
|
||||||
1, 0, 0, 0, 113, 114, 7, 6, 0, 0, 114, 34, 1, 0, 0, 0, 115, 116, 5, 92,
|
105, 1, 0, 0, 0, 107, 108, 1, 0, 0, 0, 108, 30, 1, 0, 0, 0, 109, 107, 1,
|
||||||
0, 0, 116, 117, 7, 7, 0, 0, 117, 36, 1, 0, 0, 0, 118, 123, 5, 34, 0, 0,
|
0, 0, 0, 110, 114, 7, 4, 0, 0, 111, 113, 7, 5, 0, 0, 112, 111, 1, 0, 0,
|
||||||
119, 122, 3, 35, 17, 0, 120, 122, 8, 8, 0, 0, 121, 119, 1, 0, 0, 0, 121,
|
0, 113, 116, 1, 0, 0, 0, 114, 112, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115,
|
||||||
120, 1, 0, 0, 0, 122, 125, 1, 0, 0, 0, 123, 121, 1, 0, 0, 0, 123, 124,
|
129, 1, 0, 0, 0, 116, 114, 1, 0, 0, 0, 117, 118, 5, 58, 0, 0, 118, 119,
|
||||||
1, 0, 0, 0, 124, 126, 1, 0, 0, 0, 125, 123, 1, 0, 0, 0, 126, 127, 5, 34,
|
5, 58, 0, 0, 119, 120, 1, 0, 0, 0, 120, 124, 7, 4, 0, 0, 121, 123, 7, 5,
|
||||||
0, 0, 127, 38, 1, 0, 0, 0, 9, 0, 81, 89, 93, 101, 108, 110, 121, 123, 1,
|
0, 0, 122, 121, 1, 0, 0, 0, 123, 126, 1, 0, 0, 0, 124, 122, 1, 0, 0, 0,
|
||||||
6, 0, 0,
|
124, 125, 1, 0, 0, 0, 125, 128, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 127,
|
||||||
|
117, 1, 0, 0, 0, 128, 131, 1, 0, 0, 0, 129, 127, 1, 0, 0, 0, 129, 130,
|
||||||
|
1, 0, 0, 0, 130, 32, 1, 0, 0, 0, 131, 129, 1, 0, 0, 0, 132, 133, 7, 6,
|
||||||
|
0, 0, 133, 34, 1, 0, 0, 0, 134, 135, 5, 92, 0, 0, 135, 136, 7, 7, 0, 0,
|
||||||
|
136, 36, 1, 0, 0, 0, 137, 142, 5, 34, 0, 0, 138, 141, 3, 35, 17, 0, 139,
|
||||||
|
141, 8, 8, 0, 0, 140, 138, 1, 0, 0, 0, 140, 139, 1, 0, 0, 0, 141, 144,
|
||||||
|
1, 0, 0, 0, 142, 140, 1, 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 145, 1, 0,
|
||||||
|
0, 0, 144, 142, 1, 0, 0, 0, 145, 146, 5, 34, 0, 0, 146, 38, 1, 0, 0, 0,
|
||||||
|
10, 0, 87, 95, 99, 107, 114, 124, 129, 140, 142, 1, 6, 0, 0,
|
||||||
}
|
}
|
||||||
deserializer := antlr.NewATNDeserializer(nil)
|
deserializer := antlr.NewATNDeserializer(nil)
|
||||||
staticData.atn = deserializer.Deserialize(staticData.serializedATN)
|
staticData.atn = deserializer.Deserialize(staticData.serializedATN)
|
||||||
|
|||||||
+12
-12
@@ -35,15 +35,15 @@ type WystListener interface {
|
|||||||
// EnterStruct_def is called when entering the struct_def production.
|
// EnterStruct_def is called when entering the struct_def production.
|
||||||
EnterStruct_def(c *Struct_defContext)
|
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 is called when entering the namespace production.
|
||||||
EnterNamespace(c *NamespaceContext)
|
EnterNamespace(c *NamespaceContext)
|
||||||
|
|
||||||
|
// EnterImport_statement is called when entering the import_statement production.
|
||||||
|
EnterImport_statement(c *Import_statementContext)
|
||||||
|
|
||||||
|
// EnterUse_statement is called when entering the use_statement production.
|
||||||
|
EnterUse_statement(c *Use_statementContext)
|
||||||
|
|
||||||
// EnterExpr is called when entering the expr production.
|
// EnterExpr is called when entering the expr production.
|
||||||
EnterExpr(c *ExprContext)
|
EnterExpr(c *ExprContext)
|
||||||
|
|
||||||
@@ -80,15 +80,15 @@ type WystListener interface {
|
|||||||
// ExitStruct_def is called when exiting the struct_def production.
|
// ExitStruct_def is called when exiting the struct_def production.
|
||||||
ExitStruct_def(c *Struct_defContext)
|
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 is called when exiting the namespace production.
|
||||||
ExitNamespace(c *NamespaceContext)
|
ExitNamespace(c *NamespaceContext)
|
||||||
|
|
||||||
|
// ExitImport_statement is called when exiting the import_statement production.
|
||||||
|
ExitImport_statement(c *Import_statementContext)
|
||||||
|
|
||||||
|
// ExitUse_statement is called when exiting the use_statement production.
|
||||||
|
ExitUse_statement(c *Use_statementContext)
|
||||||
|
|
||||||
// ExitExpr is called when exiting the expr production.
|
// ExitExpr is called when exiting the expr production.
|
||||||
ExitExpr(c *ExprContext)
|
ExitExpr(c *ExprContext)
|
||||||
|
|
||||||
|
|||||||
+444
-457
File diff suppressed because it is too large
Load Diff
+19
-7
@@ -29,7 +29,7 @@ func TranspileToken(node ASTNode) string {
|
|||||||
res += fmt.Sprintf("%x", c)
|
res += fmt.Sprintf("%x", c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res = strings.ReplaceAll(res, "::", "::_0x")
|
res = strings.ReplaceAll(res, "::", "._0x")
|
||||||
case "HEX":
|
case "HEX":
|
||||||
res += node.Text
|
res += node.Text
|
||||||
case "MATH":
|
case "MATH":
|
||||||
@@ -40,6 +40,8 @@ func TranspileToken(node ASTNode) string {
|
|||||||
res += "\n "
|
res += "\n "
|
||||||
case "','":
|
case "','":
|
||||||
res += ", "
|
res += ", "
|
||||||
|
case "IDENT":
|
||||||
|
res += fmt.Sprintf("_%#x", node.Text)
|
||||||
default:
|
default:
|
||||||
fmt.Printf("\x1b[33mDEV NOTICE:\x1b[0m Missing token case for '%s'\n", node.Rule)
|
fmt.Printf("\x1b[33mDEV NOTICE:\x1b[0m Missing token case for '%s'\n", node.Rule)
|
||||||
|
|
||||||
@@ -56,7 +58,11 @@ func TranspileNode(node ASTNode) string {
|
|||||||
switch node.Rule {
|
switch node.Rule {
|
||||||
|
|
||||||
case "func_def":
|
case "func_def":
|
||||||
res += fmt.Sprintf("func %s%s %s %s", TranspileNode(node.Inner[1]), TranspileNode(node.Inner[2]), TranspileNode(node.Inner[0]), TranspileNode(node.Inner[3]))
|
return_type := TranspileNode(node.Inner[0])
|
||||||
|
if return_type == "_0x766f6964" {
|
||||||
|
return_type = ""
|
||||||
|
}
|
||||||
|
res += fmt.Sprintf("func %s%s %s %s", TranspileNode(node.Inner[1]), TranspileNode(node.Inner[2]), return_type, TranspileNode(node.Inner[3]))
|
||||||
case "expr":
|
case "expr":
|
||||||
res += TranspileNodes(node.Inner)
|
res += TranspileNodes(node.Inner)
|
||||||
case "code_block":
|
case "code_block":
|
||||||
@@ -64,11 +70,7 @@ func TranspileNode(node ASTNode) string {
|
|||||||
case "var_def":
|
case "var_def":
|
||||||
res += fmt.Sprintf("var %s %s", TranspileNode(node.Inner[1]), TranspileNode(node.Inner[0]))
|
res += fmt.Sprintf("var %s %s", TranspileNode(node.Inner[1]), TranspileNode(node.Inner[0]))
|
||||||
case "round_def":
|
case "round_def":
|
||||||
fmt.Sprintf("(%s)", strings.TrimSuffix(strings.ReplaceAll(TranspileNodes(node.Inner), "var ", ""), " "))
|
res += fmt.Sprintf("(%s)", strings.TrimSuffix(strings.ReplaceAll(TranspileNodes(node.Inner), "var ", ""), " "))
|
||||||
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})
|
|
||||||
}
|
|
||||||
case "call_tree":
|
case "call_tree":
|
||||||
for i, c := range node.Inner {
|
for i, c := range node.Inner {
|
||||||
res += TranspileNode(c)
|
res += TranspileNode(c)
|
||||||
@@ -116,6 +118,16 @@ func TranspileNode(node ASTNode) string {
|
|||||||
case "var_def_set":
|
case "var_def_set":
|
||||||
res += fmt.Sprintf("%s = %s", TranspileNode(node.Inner[0]), TranspileNode(node.Inner[1]))
|
res += fmt.Sprintf("%s = %s", TranspileNode(node.Inner[0]), TranspileNode(node.Inner[1]))
|
||||||
|
|
||||||
|
case "import_statement":
|
||||||
|
res += fmt.Sprintf("import . \"%s\"\n", TranspileNode(node.Inner[0]))
|
||||||
|
|
||||||
|
case "use_statement":
|
||||||
|
ident := strings.Split(TranspileNode(node.Inner[0]), ".")
|
||||||
|
res += fmt.Sprintf("import \"%s\"\n", ident[0])
|
||||||
|
if len(ident) > 1 {
|
||||||
|
res += fmt.Sprintf("var %s = %s\n", ident[len(ident)-1], strings.Join(ident, "."))
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fmt.Printf("\x1b[33mDEV NOTICE:\x1b[0m Missing case for '%s'\n", node.Rule)
|
fmt.Printf("\x1b[33mDEV NOTICE:\x1b[0m Missing case for '%s'\n", node.Rule)
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
#map _, _;
|
include io;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
|
||||||
int main() {
|
|
||||||
int x = 20;
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user