From 3dc94d7aeacb1b301438f1ec54e37a29adaad7e8 Mon Sep 17 00:00:00 2001 From: PedroJSilva2001 Date: Sun, 26 May 2024 17:52:32 +0100 Subject: [PATCH] Add - to members --- experiments/antlr/Declaration.g4 | 2 +- experiments/declparser/Declaration.interp | 4 +- experiments/declparser/Declaration.tokens | 38 +++--- .../declparser/DeclarationLexer.interp | 5 +- experiments/declparser/DeclarationLexer.py | 118 ++++++++-------- .../declparser/DeclarationLexer.tokens | 38 +++--- experiments/declparser/DeclarationParser.py | 129 ++++++++++-------- 7 files changed, 179 insertions(+), 155 deletions(-) diff --git a/experiments/antlr/Declaration.g4 b/experiments/antlr/Declaration.g4 index 8dddbb7..93f130e 100644 --- a/experiments/antlr/Declaration.g4 +++ b/experiments/antlr/Declaration.g4 @@ -29,7 +29,7 @@ declaration ; member - : MEMBER name=ID ':' memb_type=type ; + : '-'? MEMBER name=ID ':' memb_type=type ; // TODO think about pointers to arrays type diff --git a/experiments/declparser/Declaration.interp b/experiments/declparser/Declaration.interp index 212c375..30941cc 100644 --- a/experiments/declparser/Declaration.interp +++ b/experiments/declparser/Declaration.interp @@ -3,6 +3,7 @@ null ':' '->' ',' +'-' '.' null 'var' @@ -22,6 +23,7 @@ null null null null +null WS VAR FUNC @@ -43,4 +45,4 @@ enumeration atn: -[4, 1, 15, 80, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 1, 0, 3, 0, 12, 8, 0, 1, 0, 5, 0, 15, 8, 0, 10, 0, 12, 0, 18, 9, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 36, 8, 1, 10, 1, 12, 1, 39, 9, 1, 3, 1, 41, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 47, 8, 1, 10, 1, 12, 1, 50, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 58, 8, 1, 10, 1, 12, 1, 61, 9, 1, 3, 1, 63, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 3, 3, 72, 8, 3, 1, 3, 3, 3, 75, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 0, 0, 5, 0, 2, 4, 6, 8, 0, 0, 86, 0, 16, 1, 0, 0, 0, 2, 62, 1, 0, 0, 0, 4, 64, 1, 0, 0, 0, 6, 69, 1, 0, 0, 0, 8, 76, 1, 0, 0, 0, 10, 12, 3, 8, 4, 0, 11, 10, 1, 0, 0, 0, 11, 12, 1, 0, 0, 0, 12, 13, 1, 0, 0, 0, 13, 15, 3, 2, 1, 0, 14, 11, 1, 0, 0, 0, 15, 18, 1, 0, 0, 0, 16, 14, 1, 0, 0, 0, 16, 17, 1, 0, 0, 0, 17, 1, 1, 0, 0, 0, 18, 16, 1, 0, 0, 0, 19, 20, 5, 10, 0, 0, 20, 21, 5, 12, 0, 0, 21, 22, 5, 1, 0, 0, 22, 63, 3, 6, 3, 0, 23, 24, 5, 6, 0, 0, 24, 25, 5, 12, 0, 0, 25, 26, 5, 1, 0, 0, 26, 63, 3, 6, 3, 0, 27, 28, 5, 7, 0, 0, 28, 29, 5, 12, 0, 0, 29, 30, 5, 1, 0, 0, 30, 40, 3, 6, 3, 0, 31, 32, 5, 2, 0, 0, 32, 37, 3, 6, 3, 0, 33, 34, 5, 3, 0, 0, 34, 36, 3, 6, 3, 0, 35, 33, 1, 0, 0, 0, 36, 39, 1, 0, 0, 0, 37, 35, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 40, 31, 1, 0, 0, 0, 40, 41, 1, 0, 0, 0, 41, 63, 1, 0, 0, 0, 42, 43, 5, 8, 0, 0, 43, 44, 5, 12, 0, 0, 44, 48, 5, 1, 0, 0, 45, 47, 3, 4, 2, 0, 46, 45, 1, 0, 0, 0, 47, 50, 1, 0, 0, 0, 48, 46, 1, 0, 0, 0, 48, 49, 1, 0, 0, 0, 49, 63, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 51, 52, 5, 9, 0, 0, 52, 53, 5, 12, 0, 0, 53, 54, 5, 1, 0, 0, 54, 59, 5, 12, 0, 0, 55, 56, 5, 3, 0, 0, 56, 58, 5, 12, 0, 0, 57, 55, 1, 0, 0, 0, 58, 61, 1, 0, 0, 0, 59, 57, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 63, 1, 0, 0, 0, 61, 59, 1, 0, 0, 0, 62, 19, 1, 0, 0, 0, 62, 23, 1, 0, 0, 0, 62, 27, 1, 0, 0, 0, 62, 42, 1, 0, 0, 0, 62, 51, 1, 0, 0, 0, 63, 3, 1, 0, 0, 0, 64, 65, 5, 11, 0, 0, 65, 66, 5, 12, 0, 0, 66, 67, 5, 1, 0, 0, 67, 68, 3, 6, 3, 0, 68, 5, 1, 0, 0, 0, 69, 71, 5, 12, 0, 0, 70, 72, 5, 13, 0, 0, 71, 70, 1, 0, 0, 0, 71, 72, 1, 0, 0, 0, 72, 74, 1, 0, 0, 0, 73, 75, 5, 14, 0, 0, 74, 73, 1, 0, 0, 0, 74, 75, 1, 0, 0, 0, 75, 7, 1, 0, 0, 0, 76, 77, 5, 15, 0, 0, 77, 78, 5, 4, 0, 0, 78, 9, 1, 0, 0, 0, 9, 11, 16, 37, 40, 48, 59, 62, 71, 74] \ No newline at end of file +[4, 1, 16, 83, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 1, 0, 3, 0, 12, 8, 0, 1, 0, 5, 0, 15, 8, 0, 10, 0, 12, 0, 18, 9, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 36, 8, 1, 10, 1, 12, 1, 39, 9, 1, 3, 1, 41, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 47, 8, 1, 10, 1, 12, 1, 50, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 58, 8, 1, 10, 1, 12, 1, 61, 9, 1, 3, 1, 63, 8, 1, 1, 2, 3, 2, 66, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 3, 3, 75, 8, 3, 1, 3, 3, 3, 78, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 0, 0, 5, 0, 2, 4, 6, 8, 0, 0, 90, 0, 16, 1, 0, 0, 0, 2, 62, 1, 0, 0, 0, 4, 65, 1, 0, 0, 0, 6, 72, 1, 0, 0, 0, 8, 79, 1, 0, 0, 0, 10, 12, 3, 8, 4, 0, 11, 10, 1, 0, 0, 0, 11, 12, 1, 0, 0, 0, 12, 13, 1, 0, 0, 0, 13, 15, 3, 2, 1, 0, 14, 11, 1, 0, 0, 0, 15, 18, 1, 0, 0, 0, 16, 14, 1, 0, 0, 0, 16, 17, 1, 0, 0, 0, 17, 1, 1, 0, 0, 0, 18, 16, 1, 0, 0, 0, 19, 20, 5, 11, 0, 0, 20, 21, 5, 13, 0, 0, 21, 22, 5, 1, 0, 0, 22, 63, 3, 6, 3, 0, 23, 24, 5, 7, 0, 0, 24, 25, 5, 13, 0, 0, 25, 26, 5, 1, 0, 0, 26, 63, 3, 6, 3, 0, 27, 28, 5, 8, 0, 0, 28, 29, 5, 13, 0, 0, 29, 30, 5, 1, 0, 0, 30, 40, 3, 6, 3, 0, 31, 32, 5, 2, 0, 0, 32, 37, 3, 6, 3, 0, 33, 34, 5, 3, 0, 0, 34, 36, 3, 6, 3, 0, 35, 33, 1, 0, 0, 0, 36, 39, 1, 0, 0, 0, 37, 35, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 40, 31, 1, 0, 0, 0, 40, 41, 1, 0, 0, 0, 41, 63, 1, 0, 0, 0, 42, 43, 5, 9, 0, 0, 43, 44, 5, 13, 0, 0, 44, 48, 5, 1, 0, 0, 45, 47, 3, 4, 2, 0, 46, 45, 1, 0, 0, 0, 47, 50, 1, 0, 0, 0, 48, 46, 1, 0, 0, 0, 48, 49, 1, 0, 0, 0, 49, 63, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 51, 52, 5, 10, 0, 0, 52, 53, 5, 13, 0, 0, 53, 54, 5, 1, 0, 0, 54, 59, 5, 13, 0, 0, 55, 56, 5, 3, 0, 0, 56, 58, 5, 13, 0, 0, 57, 55, 1, 0, 0, 0, 58, 61, 1, 0, 0, 0, 59, 57, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 63, 1, 0, 0, 0, 61, 59, 1, 0, 0, 0, 62, 19, 1, 0, 0, 0, 62, 23, 1, 0, 0, 0, 62, 27, 1, 0, 0, 0, 62, 42, 1, 0, 0, 0, 62, 51, 1, 0, 0, 0, 63, 3, 1, 0, 0, 0, 64, 66, 5, 4, 0, 0, 65, 64, 1, 0, 0, 0, 65, 66, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 5, 12, 0, 0, 68, 69, 5, 13, 0, 0, 69, 70, 5, 1, 0, 0, 70, 71, 3, 6, 3, 0, 71, 5, 1, 0, 0, 0, 72, 74, 5, 13, 0, 0, 73, 75, 5, 14, 0, 0, 74, 73, 1, 0, 0, 0, 74, 75, 1, 0, 0, 0, 75, 77, 1, 0, 0, 0, 76, 78, 5, 15, 0, 0, 77, 76, 1, 0, 0, 0, 77, 78, 1, 0, 0, 0, 78, 7, 1, 0, 0, 0, 79, 80, 5, 16, 0, 0, 80, 81, 5, 5, 0, 0, 81, 9, 1, 0, 0, 0, 10, 11, 16, 37, 40, 48, 59, 62, 65, 74, 77] \ No newline at end of file diff --git a/experiments/declparser/Declaration.tokens b/experiments/declparser/Declaration.tokens index ac75ef2..96d9f54 100644 --- a/experiments/declparser/Declaration.tokens +++ b/experiments/declparser/Declaration.tokens @@ -2,24 +2,26 @@ T__0=1 T__1=2 T__2=3 T__3=4 -WS=5 -VAR=6 -FUNC=7 -STRUCT=8 -ENUM=9 -ALIAS=10 -MEMBER=11 -ID=12 -PTRS=13 -ARRS=14 -INT=15 +T__4=5 +WS=6 +VAR=7 +FUNC=8 +STRUCT=9 +ENUM=10 +ALIAS=11 +MEMBER=12 +ID=13 +PTRS=14 +ARRS=15 +INT=16 ':'=1 '->'=2 ','=3 -'.'=4 -'var'=6 -'func'=7 -'struct'=8 -'enum'=9 -'alias'=10 -'memb'=11 +'-'=4 +'.'=5 +'var'=7 +'func'=8 +'struct'=9 +'enum'=10 +'alias'=11 +'memb'=12 diff --git a/experiments/declparser/DeclarationLexer.interp b/experiments/declparser/DeclarationLexer.interp index 93f4d6a..18c4364 100644 --- a/experiments/declparser/DeclarationLexer.interp +++ b/experiments/declparser/DeclarationLexer.interp @@ -3,6 +3,7 @@ null ':' '->' ',' +'-' '.' null 'var' @@ -22,6 +23,7 @@ null null null null +null WS VAR FUNC @@ -39,6 +41,7 @@ T__0 T__1 T__2 T__3 +T__4 WS VAR FUNC @@ -59,4 +62,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 15, 125, 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, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 4, 4, 42, 8, 4, 11, 4, 12, 4, 43, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 5, 11, 82, 8, 11, 10, 11, 12, 11, 85, 9, 11, 1, 12, 1, 12, 5, 12, 89, 8, 12, 10, 12, 12, 12, 92, 9, 12, 4, 12, 94, 8, 12, 11, 12, 12, 12, 95, 1, 13, 1, 13, 5, 13, 100, 8, 13, 10, 13, 12, 13, 103, 9, 13, 1, 13, 1, 13, 5, 13, 107, 8, 13, 10, 13, 12, 13, 110, 9, 13, 4, 13, 112, 8, 13, 11, 13, 12, 13, 113, 1, 14, 1, 14, 1, 14, 5, 14, 119, 8, 14, 10, 14, 12, 14, 122, 9, 14, 3, 14, 124, 8, 14, 0, 0, 15, 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, 1, 0, 5, 3, 0, 9, 10, 13, 13, 32, 32, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 1, 0, 48, 57, 133, 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, 1, 31, 1, 0, 0, 0, 3, 33, 1, 0, 0, 0, 5, 36, 1, 0, 0, 0, 7, 38, 1, 0, 0, 0, 9, 41, 1, 0, 0, 0, 11, 47, 1, 0, 0, 0, 13, 51, 1, 0, 0, 0, 15, 56, 1, 0, 0, 0, 17, 63, 1, 0, 0, 0, 19, 68, 1, 0, 0, 0, 21, 74, 1, 0, 0, 0, 23, 79, 1, 0, 0, 0, 25, 93, 1, 0, 0, 0, 27, 111, 1, 0, 0, 0, 29, 123, 1, 0, 0, 0, 31, 32, 5, 58, 0, 0, 32, 2, 1, 0, 0, 0, 33, 34, 5, 45, 0, 0, 34, 35, 5, 62, 0, 0, 35, 4, 1, 0, 0, 0, 36, 37, 5, 44, 0, 0, 37, 6, 1, 0, 0, 0, 38, 39, 5, 46, 0, 0, 39, 8, 1, 0, 0, 0, 40, 42, 7, 0, 0, 0, 41, 40, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 41, 1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, 45, 1, 0, 0, 0, 45, 46, 6, 4, 0, 0, 46, 10, 1, 0, 0, 0, 47, 48, 5, 118, 0, 0, 48, 49, 5, 97, 0, 0, 49, 50, 5, 114, 0, 0, 50, 12, 1, 0, 0, 0, 51, 52, 5, 102, 0, 0, 52, 53, 5, 117, 0, 0, 53, 54, 5, 110, 0, 0, 54, 55, 5, 99, 0, 0, 55, 14, 1, 0, 0, 0, 56, 57, 5, 115, 0, 0, 57, 58, 5, 116, 0, 0, 58, 59, 5, 114, 0, 0, 59, 60, 5, 117, 0, 0, 60, 61, 5, 99, 0, 0, 61, 62, 5, 116, 0, 0, 62, 16, 1, 0, 0, 0, 63, 64, 5, 101, 0, 0, 64, 65, 5, 110, 0, 0, 65, 66, 5, 117, 0, 0, 66, 67, 5, 109, 0, 0, 67, 18, 1, 0, 0, 0, 68, 69, 5, 97, 0, 0, 69, 70, 5, 108, 0, 0, 70, 71, 5, 105, 0, 0, 71, 72, 5, 97, 0, 0, 72, 73, 5, 115, 0, 0, 73, 20, 1, 0, 0, 0, 74, 75, 5, 109, 0, 0, 75, 76, 5, 101, 0, 0, 76, 77, 5, 109, 0, 0, 77, 78, 5, 98, 0, 0, 78, 22, 1, 0, 0, 0, 79, 83, 7, 1, 0, 0, 80, 82, 7, 2, 0, 0, 81, 80, 1, 0, 0, 0, 82, 85, 1, 0, 0, 0, 83, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 24, 1, 0, 0, 0, 85, 83, 1, 0, 0, 0, 86, 90, 5, 42, 0, 0, 87, 89, 3, 9, 4, 0, 88, 87, 1, 0, 0, 0, 89, 92, 1, 0, 0, 0, 90, 88, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 94, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, 93, 86, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 93, 1, 0, 0, 0, 95, 96, 1, 0, 0, 0, 96, 26, 1, 0, 0, 0, 97, 101, 5, 91, 0, 0, 98, 100, 3, 9, 4, 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, 104, 1, 0, 0, 0, 103, 101, 1, 0, 0, 0, 104, 108, 5, 93, 0, 0, 105, 107, 3, 9, 4, 0, 106, 105, 1, 0, 0, 0, 107, 110, 1, 0, 0, 0, 108, 106, 1, 0, 0, 0, 108, 109, 1, 0, 0, 0, 109, 112, 1, 0, 0, 0, 110, 108, 1, 0, 0, 0, 111, 97, 1, 0, 0, 0, 112, 113, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 28, 1, 0, 0, 0, 115, 124, 5, 48, 0, 0, 116, 120, 7, 3, 0, 0, 117, 119, 7, 4, 0, 0, 118, 117, 1, 0, 0, 0, 119, 122, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 120, 121, 1, 0, 0, 0, 121, 124, 1, 0, 0, 0, 122, 120, 1, 0, 0, 0, 123, 115, 1, 0, 0, 0, 123, 116, 1, 0, 0, 0, 124, 30, 1, 0, 0, 0, 10, 0, 43, 83, 90, 95, 101, 108, 113, 120, 123, 1, 6, 0, 0] \ No newline at end of file +[4, 0, 16, 129, 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, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 4, 5, 46, 8, 5, 11, 5, 12, 5, 47, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 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, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 5, 12, 86, 8, 12, 10, 12, 12, 12, 89, 9, 12, 1, 13, 1, 13, 5, 13, 93, 8, 13, 10, 13, 12, 13, 96, 9, 13, 4, 13, 98, 8, 13, 11, 13, 12, 13, 99, 1, 14, 1, 14, 5, 14, 104, 8, 14, 10, 14, 12, 14, 107, 9, 14, 1, 14, 1, 14, 5, 14, 111, 8, 14, 10, 14, 12, 14, 114, 9, 14, 4, 14, 116, 8, 14, 11, 14, 12, 14, 117, 1, 15, 1, 15, 1, 15, 5, 15, 123, 8, 15, 10, 15, 12, 15, 126, 9, 15, 3, 15, 128, 8, 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, 15, 31, 16, 1, 0, 5, 3, 0, 9, 10, 13, 13, 32, 32, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 1, 0, 48, 57, 137, 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, 1, 33, 1, 0, 0, 0, 3, 35, 1, 0, 0, 0, 5, 38, 1, 0, 0, 0, 7, 40, 1, 0, 0, 0, 9, 42, 1, 0, 0, 0, 11, 45, 1, 0, 0, 0, 13, 51, 1, 0, 0, 0, 15, 55, 1, 0, 0, 0, 17, 60, 1, 0, 0, 0, 19, 67, 1, 0, 0, 0, 21, 72, 1, 0, 0, 0, 23, 78, 1, 0, 0, 0, 25, 83, 1, 0, 0, 0, 27, 97, 1, 0, 0, 0, 29, 115, 1, 0, 0, 0, 31, 127, 1, 0, 0, 0, 33, 34, 5, 58, 0, 0, 34, 2, 1, 0, 0, 0, 35, 36, 5, 45, 0, 0, 36, 37, 5, 62, 0, 0, 37, 4, 1, 0, 0, 0, 38, 39, 5, 44, 0, 0, 39, 6, 1, 0, 0, 0, 40, 41, 5, 45, 0, 0, 41, 8, 1, 0, 0, 0, 42, 43, 5, 46, 0, 0, 43, 10, 1, 0, 0, 0, 44, 46, 7, 0, 0, 0, 45, 44, 1, 0, 0, 0, 46, 47, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 49, 1, 0, 0, 0, 49, 50, 6, 5, 0, 0, 50, 12, 1, 0, 0, 0, 51, 52, 5, 118, 0, 0, 52, 53, 5, 97, 0, 0, 53, 54, 5, 114, 0, 0, 54, 14, 1, 0, 0, 0, 55, 56, 5, 102, 0, 0, 56, 57, 5, 117, 0, 0, 57, 58, 5, 110, 0, 0, 58, 59, 5, 99, 0, 0, 59, 16, 1, 0, 0, 0, 60, 61, 5, 115, 0, 0, 61, 62, 5, 116, 0, 0, 62, 63, 5, 114, 0, 0, 63, 64, 5, 117, 0, 0, 64, 65, 5, 99, 0, 0, 65, 66, 5, 116, 0, 0, 66, 18, 1, 0, 0, 0, 67, 68, 5, 101, 0, 0, 68, 69, 5, 110, 0, 0, 69, 70, 5, 117, 0, 0, 70, 71, 5, 109, 0, 0, 71, 20, 1, 0, 0, 0, 72, 73, 5, 97, 0, 0, 73, 74, 5, 108, 0, 0, 74, 75, 5, 105, 0, 0, 75, 76, 5, 97, 0, 0, 76, 77, 5, 115, 0, 0, 77, 22, 1, 0, 0, 0, 78, 79, 5, 109, 0, 0, 79, 80, 5, 101, 0, 0, 80, 81, 5, 109, 0, 0, 81, 82, 5, 98, 0, 0, 82, 24, 1, 0, 0, 0, 83, 87, 7, 1, 0, 0, 84, 86, 7, 2, 0, 0, 85, 84, 1, 0, 0, 0, 86, 89, 1, 0, 0, 0, 87, 85, 1, 0, 0, 0, 87, 88, 1, 0, 0, 0, 88, 26, 1, 0, 0, 0, 89, 87, 1, 0, 0, 0, 90, 94, 5, 42, 0, 0, 91, 93, 3, 11, 5, 0, 92, 91, 1, 0, 0, 0, 93, 96, 1, 0, 0, 0, 94, 92, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 98, 1, 0, 0, 0, 96, 94, 1, 0, 0, 0, 97, 90, 1, 0, 0, 0, 98, 99, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 99, 100, 1, 0, 0, 0, 100, 28, 1, 0, 0, 0, 101, 105, 5, 91, 0, 0, 102, 104, 3, 11, 5, 0, 103, 102, 1, 0, 0, 0, 104, 107, 1, 0, 0, 0, 105, 103, 1, 0, 0, 0, 105, 106, 1, 0, 0, 0, 106, 108, 1, 0, 0, 0, 107, 105, 1, 0, 0, 0, 108, 112, 5, 93, 0, 0, 109, 111, 3, 11, 5, 0, 110, 109, 1, 0, 0, 0, 111, 114, 1, 0, 0, 0, 112, 110, 1, 0, 0, 0, 112, 113, 1, 0, 0, 0, 113, 116, 1, 0, 0, 0, 114, 112, 1, 0, 0, 0, 115, 101, 1, 0, 0, 0, 116, 117, 1, 0, 0, 0, 117, 115, 1, 0, 0, 0, 117, 118, 1, 0, 0, 0, 118, 30, 1, 0, 0, 0, 119, 128, 5, 48, 0, 0, 120, 124, 7, 3, 0, 0, 121, 123, 7, 4, 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, 119, 1, 0, 0, 0, 127, 120, 1, 0, 0, 0, 128, 32, 1, 0, 0, 0, 10, 0, 47, 87, 94, 99, 105, 112, 117, 124, 127, 1, 6, 0, 0] \ No newline at end of file diff --git a/experiments/declparser/DeclarationLexer.py b/experiments/declparser/DeclarationLexer.py index 13b8190..53efaa7 100644 --- a/experiments/declparser/DeclarationLexer.py +++ b/experiments/declparser/DeclarationLexer.py @@ -10,50 +10,52 @@ def serializedATN(): return [ - 4,0,15,125,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, + 4,0,16,129,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,1,0,1,0,1,1,1,1,1,1,1,2,1,2,1,3,1,3,1,4,4,4,42, - 8,4,11,4,12,4,43,1,4,1,4,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,7, - 1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9, - 1,9,1,10,1,10,1,10,1,10,1,10,1,11,1,11,5,11,82,8,11,10,11,12,11, - 85,9,11,1,12,1,12,5,12,89,8,12,10,12,12,12,92,9,12,4,12,94,8,12, - 11,12,12,12,95,1,13,1,13,5,13,100,8,13,10,13,12,13,103,9,13,1,13, - 1,13,5,13,107,8,13,10,13,12,13,110,9,13,4,13,112,8,13,11,13,12,13, - 113,1,14,1,14,1,14,5,14,119,8,14,10,14,12,14,122,9,14,3,14,124,8, - 14,0,0,15,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,1,0,5,3,0,9,10,13,13,32,32,3,0,65,90,95,95, - 97,122,4,0,48,57,65,90,95,95,97,122,1,0,49,57,1,0,48,57,133,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,1,31,1,0, - 0,0,3,33,1,0,0,0,5,36,1,0,0,0,7,38,1,0,0,0,9,41,1,0,0,0,11,47,1, - 0,0,0,13,51,1,0,0,0,15,56,1,0,0,0,17,63,1,0,0,0,19,68,1,0,0,0,21, - 74,1,0,0,0,23,79,1,0,0,0,25,93,1,0,0,0,27,111,1,0,0,0,29,123,1,0, - 0,0,31,32,5,58,0,0,32,2,1,0,0,0,33,34,5,45,0,0,34,35,5,62,0,0,35, - 4,1,0,0,0,36,37,5,44,0,0,37,6,1,0,0,0,38,39,5,46,0,0,39,8,1,0,0, - 0,40,42,7,0,0,0,41,40,1,0,0,0,42,43,1,0,0,0,43,41,1,0,0,0,43,44, - 1,0,0,0,44,45,1,0,0,0,45,46,6,4,0,0,46,10,1,0,0,0,47,48,5,118,0, - 0,48,49,5,97,0,0,49,50,5,114,0,0,50,12,1,0,0,0,51,52,5,102,0,0,52, - 53,5,117,0,0,53,54,5,110,0,0,54,55,5,99,0,0,55,14,1,0,0,0,56,57, - 5,115,0,0,57,58,5,116,0,0,58,59,5,114,0,0,59,60,5,117,0,0,60,61, - 5,99,0,0,61,62,5,116,0,0,62,16,1,0,0,0,63,64,5,101,0,0,64,65,5,110, - 0,0,65,66,5,117,0,0,66,67,5,109,0,0,67,18,1,0,0,0,68,69,5,97,0,0, - 69,70,5,108,0,0,70,71,5,105,0,0,71,72,5,97,0,0,72,73,5,115,0,0,73, - 20,1,0,0,0,74,75,5,109,0,0,75,76,5,101,0,0,76,77,5,109,0,0,77,78, - 5,98,0,0,78,22,1,0,0,0,79,83,7,1,0,0,80,82,7,2,0,0,81,80,1,0,0,0, - 82,85,1,0,0,0,83,81,1,0,0,0,83,84,1,0,0,0,84,24,1,0,0,0,85,83,1, - 0,0,0,86,90,5,42,0,0,87,89,3,9,4,0,88,87,1,0,0,0,89,92,1,0,0,0,90, - 88,1,0,0,0,90,91,1,0,0,0,91,94,1,0,0,0,92,90,1,0,0,0,93,86,1,0,0, - 0,94,95,1,0,0,0,95,93,1,0,0,0,95,96,1,0,0,0,96,26,1,0,0,0,97,101, - 5,91,0,0,98,100,3,9,4,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,104,1,0,0,0,103,101,1,0,0,0,104,108,5,93, - 0,0,105,107,3,9,4,0,106,105,1,0,0,0,107,110,1,0,0,0,108,106,1,0, - 0,0,108,109,1,0,0,0,109,112,1,0,0,0,110,108,1,0,0,0,111,97,1,0,0, - 0,112,113,1,0,0,0,113,111,1,0,0,0,113,114,1,0,0,0,114,28,1,0,0,0, - 115,124,5,48,0,0,116,120,7,3,0,0,117,119,7,4,0,0,118,117,1,0,0,0, - 119,122,1,0,0,0,120,118,1,0,0,0,120,121,1,0,0,0,121,124,1,0,0,0, - 122,120,1,0,0,0,123,115,1,0,0,0,123,116,1,0,0,0,124,30,1,0,0,0,10, - 0,43,83,90,95,101,108,113,120,123,1,6,0,0 + 13,7,13,2,14,7,14,2,15,7,15,1,0,1,0,1,1,1,1,1,1,1,2,1,2,1,3,1,3, + 1,4,1,4,1,5,4,5,46,8,5,11,5,12,5,47,1,5,1,5,1,6,1,6,1,6,1,6,1,7, + 1,7,1,7,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,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,12,1,12, + 5,12,86,8,12,10,12,12,12,89,9,12,1,13,1,13,5,13,93,8,13,10,13,12, + 13,96,9,13,4,13,98,8,13,11,13,12,13,99,1,14,1,14,5,14,104,8,14,10, + 14,12,14,107,9,14,1,14,1,14,5,14,111,8,14,10,14,12,14,114,9,14,4, + 14,116,8,14,11,14,12,14,117,1,15,1,15,1,15,5,15,123,8,15,10,15,12, + 15,126,9,15,3,15,128,8,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,15,31,16,1,0,5,3,0,9,10, + 13,13,32,32,3,0,65,90,95,95,97,122,4,0,48,57,65,90,95,95,97,122, + 1,0,49,57,1,0,48,57,137,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,1,33,1,0,0,0,3,35,1,0,0,0,5,38, + 1,0,0,0,7,40,1,0,0,0,9,42,1,0,0,0,11,45,1,0,0,0,13,51,1,0,0,0,15, + 55,1,0,0,0,17,60,1,0,0,0,19,67,1,0,0,0,21,72,1,0,0,0,23,78,1,0,0, + 0,25,83,1,0,0,0,27,97,1,0,0,0,29,115,1,0,0,0,31,127,1,0,0,0,33,34, + 5,58,0,0,34,2,1,0,0,0,35,36,5,45,0,0,36,37,5,62,0,0,37,4,1,0,0,0, + 38,39,5,44,0,0,39,6,1,0,0,0,40,41,5,45,0,0,41,8,1,0,0,0,42,43,5, + 46,0,0,43,10,1,0,0,0,44,46,7,0,0,0,45,44,1,0,0,0,46,47,1,0,0,0,47, + 45,1,0,0,0,47,48,1,0,0,0,48,49,1,0,0,0,49,50,6,5,0,0,50,12,1,0,0, + 0,51,52,5,118,0,0,52,53,5,97,0,0,53,54,5,114,0,0,54,14,1,0,0,0,55, + 56,5,102,0,0,56,57,5,117,0,0,57,58,5,110,0,0,58,59,5,99,0,0,59,16, + 1,0,0,0,60,61,5,115,0,0,61,62,5,116,0,0,62,63,5,114,0,0,63,64,5, + 117,0,0,64,65,5,99,0,0,65,66,5,116,0,0,66,18,1,0,0,0,67,68,5,101, + 0,0,68,69,5,110,0,0,69,70,5,117,0,0,70,71,5,109,0,0,71,20,1,0,0, + 0,72,73,5,97,0,0,73,74,5,108,0,0,74,75,5,105,0,0,75,76,5,97,0,0, + 76,77,5,115,0,0,77,22,1,0,0,0,78,79,5,109,0,0,79,80,5,101,0,0,80, + 81,5,109,0,0,81,82,5,98,0,0,82,24,1,0,0,0,83,87,7,1,0,0,84,86,7, + 2,0,0,85,84,1,0,0,0,86,89,1,0,0,0,87,85,1,0,0,0,87,88,1,0,0,0,88, + 26,1,0,0,0,89,87,1,0,0,0,90,94,5,42,0,0,91,93,3,11,5,0,92,91,1,0, + 0,0,93,96,1,0,0,0,94,92,1,0,0,0,94,95,1,0,0,0,95,98,1,0,0,0,96,94, + 1,0,0,0,97,90,1,0,0,0,98,99,1,0,0,0,99,97,1,0,0,0,99,100,1,0,0,0, + 100,28,1,0,0,0,101,105,5,91,0,0,102,104,3,11,5,0,103,102,1,0,0,0, + 104,107,1,0,0,0,105,103,1,0,0,0,105,106,1,0,0,0,106,108,1,0,0,0, + 107,105,1,0,0,0,108,112,5,93,0,0,109,111,3,11,5,0,110,109,1,0,0, + 0,111,114,1,0,0,0,112,110,1,0,0,0,112,113,1,0,0,0,113,116,1,0,0, + 0,114,112,1,0,0,0,115,101,1,0,0,0,116,117,1,0,0,0,117,115,1,0,0, + 0,117,118,1,0,0,0,118,30,1,0,0,0,119,128,5,48,0,0,120,124,7,3,0, + 0,121,123,7,4,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,119,1,0,0, + 0,127,120,1,0,0,0,128,32,1,0,0,0,10,0,47,87,94,99,105,112,117,124, + 127,1,6,0,0 ] class DeclarationLexer(Lexer): @@ -66,32 +68,34 @@ class DeclarationLexer(Lexer): T__1 = 2 T__2 = 3 T__3 = 4 - WS = 5 - VAR = 6 - FUNC = 7 - STRUCT = 8 - ENUM = 9 - ALIAS = 10 - MEMBER = 11 - ID = 12 - PTRS = 13 - ARRS = 14 - INT = 15 + T__4 = 5 + WS = 6 + VAR = 7 + FUNC = 8 + STRUCT = 9 + ENUM = 10 + ALIAS = 11 + MEMBER = 12 + ID = 13 + PTRS = 14 + ARRS = 15 + INT = 16 channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] modeNames = [ "DEFAULT_MODE" ] literalNames = [ "", - "':'", "'->'", "','", "'.'", "'var'", "'func'", "'struct'", + "':'", "'->'", "','", "'-'", "'.'", "'var'", "'func'", "'struct'", "'enum'", "'alias'", "'memb'" ] symbolicNames = [ "", "WS", "VAR", "FUNC", "STRUCT", "ENUM", "ALIAS", "MEMBER", "ID", "PTRS", "ARRS", "INT" ] - ruleNames = [ "T__0", "T__1", "T__2", "T__3", "WS", "VAR", "FUNC", "STRUCT", - "ENUM", "ALIAS", "MEMBER", "ID", "PTRS", "ARRS", "INT" ] + ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "WS", "VAR", "FUNC", + "STRUCT", "ENUM", "ALIAS", "MEMBER", "ID", "PTRS", "ARRS", + "INT" ] grammarFileName = "Declaration.g4" diff --git a/experiments/declparser/DeclarationLexer.tokens b/experiments/declparser/DeclarationLexer.tokens index ac75ef2..96d9f54 100644 --- a/experiments/declparser/DeclarationLexer.tokens +++ b/experiments/declparser/DeclarationLexer.tokens @@ -2,24 +2,26 @@ T__0=1 T__1=2 T__2=3 T__3=4 -WS=5 -VAR=6 -FUNC=7 -STRUCT=8 -ENUM=9 -ALIAS=10 -MEMBER=11 -ID=12 -PTRS=13 -ARRS=14 -INT=15 +T__4=5 +WS=6 +VAR=7 +FUNC=8 +STRUCT=9 +ENUM=10 +ALIAS=11 +MEMBER=12 +ID=13 +PTRS=14 +ARRS=15 +INT=16 ':'=1 '->'=2 ','=3 -'.'=4 -'var'=6 -'func'=7 -'struct'=8 -'enum'=9 -'alias'=10 -'memb'=11 +'-'=4 +'.'=5 +'var'=7 +'func'=8 +'struct'=9 +'enum'=10 +'alias'=11 +'memb'=12 diff --git a/experiments/declparser/DeclarationParser.py b/experiments/declparser/DeclarationParser.py index 8fe3708..f015eeb 100644 --- a/experiments/declparser/DeclarationParser.py +++ b/experiments/declparser/DeclarationParser.py @@ -10,32 +10,33 @@ def serializedATN(): return [ - 4,1,15,80,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,1,0,3,0,12,8,0, + 4,1,16,83,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,1,0,3,0,12,8,0, 1,0,5,0,15,8,0,10,0,12,0,18,9,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,36,8,1,10,1,12,1,39,9,1,3,1, 41,8,1,1,1,1,1,1,1,1,1,5,1,47,8,1,10,1,12,1,50,9,1,1,1,1,1,1,1,1, - 1,1,1,1,1,5,1,58,8,1,10,1,12,1,61,9,1,3,1,63,8,1,1,2,1,2,1,2,1,2, - 1,2,1,3,1,3,3,3,72,8,3,1,3,3,3,75,8,3,1,4,1,4,1,4,1,4,0,0,5,0,2, - 4,6,8,0,0,86,0,16,1,0,0,0,2,62,1,0,0,0,4,64,1,0,0,0,6,69,1,0,0,0, - 8,76,1,0,0,0,10,12,3,8,4,0,11,10,1,0,0,0,11,12,1,0,0,0,12,13,1,0, - 0,0,13,15,3,2,1,0,14,11,1,0,0,0,15,18,1,0,0,0,16,14,1,0,0,0,16,17, - 1,0,0,0,17,1,1,0,0,0,18,16,1,0,0,0,19,20,5,10,0,0,20,21,5,12,0,0, - 21,22,5,1,0,0,22,63,3,6,3,0,23,24,5,6,0,0,24,25,5,12,0,0,25,26,5, - 1,0,0,26,63,3,6,3,0,27,28,5,7,0,0,28,29,5,12,0,0,29,30,5,1,0,0,30, - 40,3,6,3,0,31,32,5,2,0,0,32,37,3,6,3,0,33,34,5,3,0,0,34,36,3,6,3, - 0,35,33,1,0,0,0,36,39,1,0,0,0,37,35,1,0,0,0,37,38,1,0,0,0,38,41, - 1,0,0,0,39,37,1,0,0,0,40,31,1,0,0,0,40,41,1,0,0,0,41,63,1,0,0,0, - 42,43,5,8,0,0,43,44,5,12,0,0,44,48,5,1,0,0,45,47,3,4,2,0,46,45,1, - 0,0,0,47,50,1,0,0,0,48,46,1,0,0,0,48,49,1,0,0,0,49,63,1,0,0,0,50, - 48,1,0,0,0,51,52,5,9,0,0,52,53,5,12,0,0,53,54,5,1,0,0,54,59,5,12, - 0,0,55,56,5,3,0,0,56,58,5,12,0,0,57,55,1,0,0,0,58,61,1,0,0,0,59, - 57,1,0,0,0,59,60,1,0,0,0,60,63,1,0,0,0,61,59,1,0,0,0,62,19,1,0,0, - 0,62,23,1,0,0,0,62,27,1,0,0,0,62,42,1,0,0,0,62,51,1,0,0,0,63,3,1, - 0,0,0,64,65,5,11,0,0,65,66,5,12,0,0,66,67,5,1,0,0,67,68,3,6,3,0, - 68,5,1,0,0,0,69,71,5,12,0,0,70,72,5,13,0,0,71,70,1,0,0,0,71,72,1, - 0,0,0,72,74,1,0,0,0,73,75,5,14,0,0,74,73,1,0,0,0,74,75,1,0,0,0,75, - 7,1,0,0,0,76,77,5,15,0,0,77,78,5,4,0,0,78,9,1,0,0,0,9,11,16,37,40, - 48,59,62,71,74 + 1,1,1,1,1,5,1,58,8,1,10,1,12,1,61,9,1,3,1,63,8,1,1,2,3,2,66,8,2, + 1,2,1,2,1,2,1,2,1,2,1,3,1,3,3,3,75,8,3,1,3,3,3,78,8,3,1,4,1,4,1, + 4,1,4,0,0,5,0,2,4,6,8,0,0,90,0,16,1,0,0,0,2,62,1,0,0,0,4,65,1,0, + 0,0,6,72,1,0,0,0,8,79,1,0,0,0,10,12,3,8,4,0,11,10,1,0,0,0,11,12, + 1,0,0,0,12,13,1,0,0,0,13,15,3,2,1,0,14,11,1,0,0,0,15,18,1,0,0,0, + 16,14,1,0,0,0,16,17,1,0,0,0,17,1,1,0,0,0,18,16,1,0,0,0,19,20,5,11, + 0,0,20,21,5,13,0,0,21,22,5,1,0,0,22,63,3,6,3,0,23,24,5,7,0,0,24, + 25,5,13,0,0,25,26,5,1,0,0,26,63,3,6,3,0,27,28,5,8,0,0,28,29,5,13, + 0,0,29,30,5,1,0,0,30,40,3,6,3,0,31,32,5,2,0,0,32,37,3,6,3,0,33,34, + 5,3,0,0,34,36,3,6,3,0,35,33,1,0,0,0,36,39,1,0,0,0,37,35,1,0,0,0, + 37,38,1,0,0,0,38,41,1,0,0,0,39,37,1,0,0,0,40,31,1,0,0,0,40,41,1, + 0,0,0,41,63,1,0,0,0,42,43,5,9,0,0,43,44,5,13,0,0,44,48,5,1,0,0,45, + 47,3,4,2,0,46,45,1,0,0,0,47,50,1,0,0,0,48,46,1,0,0,0,48,49,1,0,0, + 0,49,63,1,0,0,0,50,48,1,0,0,0,51,52,5,10,0,0,52,53,5,13,0,0,53,54, + 5,1,0,0,54,59,5,13,0,0,55,56,5,3,0,0,56,58,5,13,0,0,57,55,1,0,0, + 0,58,61,1,0,0,0,59,57,1,0,0,0,59,60,1,0,0,0,60,63,1,0,0,0,61,59, + 1,0,0,0,62,19,1,0,0,0,62,23,1,0,0,0,62,27,1,0,0,0,62,42,1,0,0,0, + 62,51,1,0,0,0,63,3,1,0,0,0,64,66,5,4,0,0,65,64,1,0,0,0,65,66,1,0, + 0,0,66,67,1,0,0,0,67,68,5,12,0,0,68,69,5,13,0,0,69,70,5,1,0,0,70, + 71,3,6,3,0,71,5,1,0,0,0,72,74,5,13,0,0,73,75,5,14,0,0,74,73,1,0, + 0,0,74,75,1,0,0,0,75,77,1,0,0,0,76,78,5,15,0,0,77,76,1,0,0,0,77, + 78,1,0,0,0,78,7,1,0,0,0,79,80,5,16,0,0,80,81,5,5,0,0,81,9,1,0,0, + 0,10,11,16,37,40,48,59,62,65,74,77 ] class DeclarationParser ( Parser ): @@ -48,13 +49,13 @@ class DeclarationParser ( Parser ): sharedContextCache = PredictionContextCache() - literalNames = [ "", "':'", "'->'", "','", "'.'", "", + literalNames = [ "", "':'", "'->'", "','", "'-'", "'.'", "", "'var'", "'func'", "'struct'", "'enum'", "'alias'", "'memb'" ] symbolicNames = [ "", "", "", "", - "", "WS", "VAR", "FUNC", "STRUCT", "ENUM", - "ALIAS", "MEMBER", "ID", "PTRS", "ARRS", "INT" ] + "", "", "WS", "VAR", "FUNC", "STRUCT", + "ENUM", "ALIAS", "MEMBER", "ID", "PTRS", "ARRS", "INT" ] RULE_start = 0 RULE_declaration = 1 @@ -69,17 +70,18 @@ class DeclarationParser ( Parser ): T__1=2 T__2=3 T__3=4 - WS=5 - VAR=6 - FUNC=7 - STRUCT=8 - ENUM=9 - ALIAS=10 - MEMBER=11 - ID=12 - PTRS=13 - ARRS=14 - INT=15 + T__4=5 + WS=6 + VAR=7 + FUNC=8 + STRUCT=9 + ENUM=10 + ALIAS=11 + MEMBER=12 + ID=13 + PTRS=14 + ARRS=15 + INT=16 def __init__(self, input:TokenStream, output:TextIO = sys.stdout): super().__init__(input, output) @@ -135,11 +137,11 @@ def start(self): self.state = 16 self._errHandler.sync(self) _la = self._input.LA(1) - while (((_la) & ~0x3f) == 0 and ((1 << _la) & 34752) != 0): + while (((_la) & ~0x3f) == 0 and ((1 << _la) & 69504) != 0): self.state = 11 self._errHandler.sync(self) _la = self._input.LA(1) - if _la==15: + if _la==16: self.state = 10 self.enumeration() @@ -233,7 +235,7 @@ def declaration(self): self.state = 62 self._errHandler.sync(self) token = self._input.LA(1) - if token in [10]: + if token in [11]: self.enterOuterAlt(localctx, 1) self.state = 19 localctx.decl_type = self.match(DeclarationParser.ALIAS) @@ -244,7 +246,7 @@ def declaration(self): self.state = 22 localctx.aliased_type = self.type_() pass - elif token in [6]: + elif token in [7]: self.enterOuterAlt(localctx, 2) self.state = 23 localctx.decl_type = self.match(DeclarationParser.VAR) @@ -255,7 +257,7 @@ def declaration(self): self.state = 26 localctx.var_type = self.type_() pass - elif token in [7]: + elif token in [8]: self.enterOuterAlt(localctx, 3) self.state = 27 localctx.decl_type = self.match(DeclarationParser.FUNC) @@ -290,7 +292,7 @@ def declaration(self): pass - elif token in [8]: + elif token in [9]: self.enterOuterAlt(localctx, 4) self.state = 42 localctx.decl_type = self.match(DeclarationParser.STRUCT) @@ -301,7 +303,7 @@ def declaration(self): self.state = 48 self._errHandler.sync(self) _la = self._input.LA(1) - while _la==11: + while _la==4 or _la==12: self.state = 45 self.member() self.state = 50 @@ -309,7 +311,7 @@ def declaration(self): _la = self._input.LA(1) pass - elif token in [9]: + elif token in [10]: self.enterOuterAlt(localctx, 5) self.state = 51 localctx.decl_type = self.match(DeclarationParser.ENUM) @@ -383,15 +385,24 @@ def member(self): localctx = DeclarationParser.MemberContext(self, self._ctx, self.state) self.enterRule(localctx, 4, self.RULE_member) + self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 64 - self.match(DeclarationParser.MEMBER) self.state = 65 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==4: + self.state = 64 + self.match(DeclarationParser.T__3) + + + self.state = 67 + self.match(DeclarationParser.MEMBER) + self.state = 68 localctx.name = self.match(DeclarationParser.ID) - self.state = 66 + self.state = 69 self.match(DeclarationParser.T__0) - self.state = 67 + self.state = 70 localctx.memb_type = self.type_() except RecognitionException as re: localctx.exception = re @@ -442,21 +453,21 @@ def type_(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 69 + self.state = 72 localctx.type_specifier = self.match(DeclarationParser.ID) - self.state = 71 + self.state = 74 self._errHandler.sync(self) _la = self._input.LA(1) - if _la==13: - self.state = 70 + if _la==14: + self.state = 73 localctx.ptr_n = self.match(DeclarationParser.PTRS) - self.state = 74 + self.state = 77 self._errHandler.sync(self) _la = self._input.LA(1) - if _la==14: - self.state = 73 + if _la==15: + self.state = 76 localctx.arr_n = self.match(DeclarationParser.ARRS) @@ -499,10 +510,10 @@ def enumeration(self): self.enterRule(localctx, 8, self.RULE_enumeration) try: self.enterOuterAlt(localctx, 1) - self.state = 76 + self.state = 79 self.match(DeclarationParser.INT) - self.state = 77 - self.match(DeclarationParser.T__3) + self.state = 80 + self.match(DeclarationParser.T__4) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re)