From 1b51d0ce8298b9397ae620eae63cfc0fd005160f Mon Sep 17 00:00:00 2001 From: anqiansong Date: Wed, 20 Jul 2022 22:49:41 +0800 Subject: [PATCH] fix: fix #2102, #2108 (#2131) * g4 code generation * Update grammar * g4 code generation * fix #2108 * fix #2102 * Remove comments --- tools/goctl/api/parser/g4/ApiLexer.g4 | 8 +- tools/goctl/api/parser/g4/ApiParser.g4 | 3 +- tools/goctl/api/parser/g4/ast/api.go | 2 +- .../g4/gen/api/apiparser_base_visitor.go | 4 + .../api/parser/g4/gen/api/apiparser_lexer.go | 280 ++++---- .../api/parser/g4/gen/api/apiparser_parser.go | 427 ++++++------ .../parser/g4/gen/api/apiparser_parser1.go | 176 +++-- .../parser/g4/gen/api/apiparser_parser2.go | 284 ++++---- .../parser/g4/gen/api/apiparser_parser3.go | 363 ++++++----- .../parser/g4/gen/api/apiparser_parser4.go | 452 +++++++------ .../parser/g4/gen/api/apiparser_parser5.go | 550 +++++++++------- .../parser/g4/gen/api/apiparser_parser6.go | 581 ++++++++++------- .../parser/g4/gen/api/apiparser_parser7.go | 610 +++++++++--------- .../parser/g4/gen/api/apiparser_parser8.go | 600 ++++++----------- .../parser/g4/gen/api/apiparser_parser9.go | 35 - .../parser/g4/gen/api/apiparser_visitor.go | 82 +-- .../goctl/api/parser/g4/test/service_test.go | 8 + tools/goctl/go.mod | 2 +- tools/goctl/go.sum | 4 +- tools/goctl/model/sql/converter/types.go | 30 +- tools/goctl/model/sql/converter/types_test.go | 12 +- tools/goctl/model/sql/example/sql/user.sql | 3 +- .../goctl/model/sql/model/infoschemamodel.go | 3 +- tools/goctl/model/sql/parser/parser.go | 8 +- 24 files changed, 2360 insertions(+), 2167 deletions(-) delete mode 100755 tools/goctl/api/parser/g4/gen/api/apiparser_parser9.go diff --git a/tools/goctl/api/parser/g4/ApiLexer.g4 b/tools/goctl/api/parser/g4/ApiLexer.g4 index ff423e403cee..bb6d4b3c5701 100644 --- a/tools/goctl/api/parser/g4/ApiLexer.g4 +++ b/tools/goctl/api/parser/g4/ApiLexer.g4 @@ -16,6 +16,10 @@ LINE_VALUE: ':' [ \t]* (STRING|(~[\r\n"`]*)); ID: Letter LetterOrDigit*; +LetterOrDigit + : Letter + | [0-9] + ; fragment ExponentPart : [eE] [+-]? Digits ; @@ -35,10 +39,6 @@ fragment Digits : [0-9] ([0-9_]* [0-9])? ; -fragment LetterOrDigit - : Letter - | [0-9] - ; fragment Letter : [a-zA-Z$_] // these are the "java letters" below 0x7F | ~[\u0000-\u007F\uD800-\uDBFF] // covers all characters above 0x7F which are not a surrogate diff --git a/tools/goctl/api/parser/g4/ApiParser.g4 b/tools/goctl/api/parser/g4/ApiParser.g4 index 2f31447d5345..93b116557891 100644 --- a/tools/goctl/api/parser/g4/ApiParser.g4 +++ b/tools/goctl/api/parser/g4/ApiParser.g4 @@ -70,4 +70,5 @@ replybody: returnToken='returns' lp='(' dataType? rp=')'; kvLit: key=ID {checkKeyValue(p)}value=LINE_VALUE; serviceName: (ID '-'?)+; -path: (('/' (ID ('-' ID)*))|('/:' (ID ('-' ID)?)))+ | '/'; \ No newline at end of file +path: (('/' (pathItem ('-' pathItem)*))|('/:' (pathItem ('-' pathItem)?)))+ | '/'; +pathItem: (ID|LetterOrDigit)+; \ No newline at end of file diff --git a/tools/goctl/api/parser/g4/ast/api.go b/tools/goctl/api/parser/g4/ast/api.go index cc747eafb300..d90b27d566bf 100644 --- a/tools/goctl/api/parser/g4/ast/api.go +++ b/tools/goctl/api/parser/g4/ast/api.go @@ -210,7 +210,7 @@ func (a *Api) Format() error { // Equal compares whether the element literals in two Api are equal func (a *Api) Equal(v interface{}) bool { - if v == nil { + if v == nil || a == nil { return false } diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_base_visitor.go b/tools/goctl/api/parser/g4/gen/api/apiparser_base_visitor.go index 1651d432277d..80cc07d1f63e 100644 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_base_visitor.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_base_visitor.go @@ -152,3 +152,7 @@ func (v *BaseApiParserVisitor) VisitServiceName(ctx *ServiceNameContext) interfa func (v *BaseApiParserVisitor) VisitPath(ctx *PathContext) interface{} { return v.VisitChildren(ctx) } + +func (v *BaseApiParserVisitor) VisitPathItem(ctx *PathItemContext) interface{} { + return v.VisitChildren(ctx) +} diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go b/tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go index 752b4b0bf0ad..568ce2b89028 100644 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go @@ -8,13 +8,11 @@ import ( ) // Suppress unused import error -var ( - _ = fmt.Printf - _ = unicode.IsLetter -) +var _ = fmt.Printf +var _ = unicode.IsLetter var serializedLexerAtn = []uint16{ - 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 26, 276, + 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 27, 276, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, @@ -36,114 +34,115 @@ var serializedLexerAtn = []uint16{ 23, 13, 23, 14, 23, 187, 3, 23, 3, 23, 3, 24, 3, 24, 7, 24, 194, 10, 24, 12, 24, 14, 24, 197, 11, 24, 3, 24, 3, 24, 7, 24, 201, 10, 24, 12, 24, 14, 24, 204, 11, 24, 5, 24, 206, 10, 24, 3, 25, 3, 25, 7, 25, 210, 10, - 25, 12, 25, 14, 25, 213, 11, 25, 3, 26, 3, 26, 5, 26, 217, 10, 26, 3, 26, - 3, 26, 3, 27, 3, 27, 3, 27, 3, 27, 5, 27, 225, 10, 27, 3, 27, 5, 27, 228, - 10, 27, 3, 27, 3, 27, 3, 27, 6, 27, 233, 10, 27, 13, 27, 14, 27, 234, 3, - 27, 3, 27, 3, 27, 3, 27, 3, 27, 5, 27, 242, 10, 27, 3, 28, 3, 28, 3, 28, - 7, 28, 247, 10, 28, 12, 28, 14, 28, 250, 11, 28, 3, 28, 5, 28, 253, 10, - 28, 3, 29, 3, 29, 3, 30, 3, 30, 7, 30, 259, 10, 30, 12, 30, 14, 30, 262, - 11, 30, 3, 30, 5, 30, 265, 10, 30, 3, 31, 3, 31, 5, 31, 269, 10, 31, 3, - 32, 3, 32, 3, 32, 3, 32, 5, 32, 275, 10, 32, 3, 153, 2, 33, 3, 3, 5, 4, - 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, - 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, - 45, 24, 47, 25, 49, 26, 51, 2, 53, 2, 55, 2, 57, 2, 59, 2, 61, 2, 63, 2, - 3, 2, 20, 5, 2, 11, 12, 14, 15, 34, 34, 4, 2, 12, 12, 15, 15, 4, 2, 36, - 36, 94, 94, 6, 2, 12, 12, 15, 15, 94, 94, 98, 98, 4, 2, 11, 11, 34, 34, - 6, 2, 12, 12, 15, 15, 36, 36, 98, 98, 4, 2, 71, 71, 103, 103, 4, 2, 45, - 45, 47, 47, 10, 2, 36, 36, 41, 41, 94, 94, 100, 100, 104, 104, 112, 112, - 116, 116, 118, 118, 3, 2, 50, 53, 3, 2, 50, 57, 5, 2, 50, 59, 67, 72, 99, - 104, 3, 2, 50, 59, 4, 2, 50, 59, 97, 97, 6, 2, 38, 38, 67, 92, 97, 97, - 99, 124, 4, 2, 2, 129, 55298, 56321, 3, 2, 55298, 56321, 3, 2, 56322, 57345, - 2, 293, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, - 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, - 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, - 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, - 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, - 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, - 2, 2, 2, 49, 3, 2, 2, 2, 3, 65, 3, 2, 2, 2, 5, 67, 3, 2, 2, 2, 7, 69, 3, - 2, 2, 2, 9, 71, 3, 2, 2, 2, 11, 73, 3, 2, 2, 2, 13, 75, 3, 2, 2, 2, 15, - 77, 3, 2, 2, 2, 17, 87, 3, 2, 2, 2, 19, 89, 3, 2, 2, 2, 21, 91, 3, 2, 2, - 2, 23, 99, 3, 2, 2, 2, 25, 101, 3, 2, 2, 2, 27, 103, 3, 2, 2, 2, 29, 106, - 3, 2, 2, 2, 31, 111, 3, 2, 2, 2, 33, 120, 3, 2, 2, 2, 35, 132, 3, 2, 2, - 2, 37, 141, 3, 2, 2, 2, 39, 147, 3, 2, 2, 2, 41, 161, 3, 2, 2, 2, 43, 172, - 3, 2, 2, 2, 45, 182, 3, 2, 2, 2, 47, 191, 3, 2, 2, 2, 49, 207, 3, 2, 2, - 2, 51, 214, 3, 2, 2, 2, 53, 241, 3, 2, 2, 2, 55, 243, 3, 2, 2, 2, 57, 254, - 3, 2, 2, 2, 59, 256, 3, 2, 2, 2, 61, 268, 3, 2, 2, 2, 63, 274, 3, 2, 2, - 2, 65, 66, 7, 63, 2, 2, 66, 4, 3, 2, 2, 2, 67, 68, 7, 42, 2, 2, 68, 6, - 3, 2, 2, 2, 69, 70, 7, 43, 2, 2, 70, 8, 3, 2, 2, 2, 71, 72, 7, 125, 2, - 2, 72, 10, 3, 2, 2, 2, 73, 74, 7, 127, 2, 2, 74, 12, 3, 2, 2, 2, 75, 76, - 7, 44, 2, 2, 76, 14, 3, 2, 2, 2, 77, 78, 7, 118, 2, 2, 78, 79, 7, 107, - 2, 2, 79, 80, 7, 111, 2, 2, 80, 81, 7, 103, 2, 2, 81, 82, 7, 48, 2, 2, - 82, 83, 7, 86, 2, 2, 83, 84, 7, 107, 2, 2, 84, 85, 7, 111, 2, 2, 85, 86, - 7, 103, 2, 2, 86, 16, 3, 2, 2, 2, 87, 88, 7, 93, 2, 2, 88, 18, 3, 2, 2, - 2, 89, 90, 7, 95, 2, 2, 90, 20, 3, 2, 2, 2, 91, 92, 7, 116, 2, 2, 92, 93, - 7, 103, 2, 2, 93, 94, 7, 118, 2, 2, 94, 95, 7, 119, 2, 2, 95, 96, 7, 116, - 2, 2, 96, 97, 7, 112, 2, 2, 97, 98, 7, 117, 2, 2, 98, 22, 3, 2, 2, 2, 99, - 100, 7, 47, 2, 2, 100, 24, 3, 2, 2, 2, 101, 102, 7, 49, 2, 2, 102, 26, - 3, 2, 2, 2, 103, 104, 7, 49, 2, 2, 104, 105, 7, 60, 2, 2, 105, 28, 3, 2, - 2, 2, 106, 107, 7, 66, 2, 2, 107, 108, 7, 102, 2, 2, 108, 109, 7, 113, - 2, 2, 109, 110, 7, 101, 2, 2, 110, 30, 3, 2, 2, 2, 111, 112, 7, 66, 2, - 2, 112, 113, 7, 106, 2, 2, 113, 114, 7, 99, 2, 2, 114, 115, 7, 112, 2, - 2, 115, 116, 7, 102, 2, 2, 116, 117, 7, 110, 2, 2, 117, 118, 7, 103, 2, - 2, 118, 119, 7, 116, 2, 2, 119, 32, 3, 2, 2, 2, 120, 121, 7, 107, 2, 2, - 121, 122, 7, 112, 2, 2, 122, 123, 7, 118, 2, 2, 123, 124, 7, 103, 2, 2, - 124, 125, 7, 116, 2, 2, 125, 126, 7, 104, 2, 2, 126, 127, 7, 99, 2, 2, - 127, 128, 7, 101, 2, 2, 128, 129, 7, 103, 2, 2, 129, 130, 7, 125, 2, 2, - 130, 131, 7, 127, 2, 2, 131, 34, 3, 2, 2, 2, 132, 133, 7, 66, 2, 2, 133, - 134, 7, 117, 2, 2, 134, 135, 7, 103, 2, 2, 135, 136, 7, 116, 2, 2, 136, - 137, 7, 120, 2, 2, 137, 138, 7, 103, 2, 2, 138, 139, 7, 116, 2, 2, 139, - 36, 3, 2, 2, 2, 140, 142, 9, 2, 2, 2, 141, 140, 3, 2, 2, 2, 142, 143, 3, - 2, 2, 2, 143, 141, 3, 2, 2, 2, 143, 144, 3, 2, 2, 2, 144, 145, 3, 2, 2, - 2, 145, 146, 8, 19, 2, 2, 146, 38, 3, 2, 2, 2, 147, 148, 7, 49, 2, 2, 148, - 149, 7, 44, 2, 2, 149, 153, 3, 2, 2, 2, 150, 152, 11, 2, 2, 2, 151, 150, - 3, 2, 2, 2, 152, 155, 3, 2, 2, 2, 153, 154, 3, 2, 2, 2, 153, 151, 3, 2, - 2, 2, 154, 156, 3, 2, 2, 2, 155, 153, 3, 2, 2, 2, 156, 157, 7, 44, 2, 2, - 157, 158, 7, 49, 2, 2, 158, 159, 3, 2, 2, 2, 159, 160, 8, 20, 3, 2, 160, - 40, 3, 2, 2, 2, 161, 162, 7, 49, 2, 2, 162, 163, 7, 49, 2, 2, 163, 167, - 3, 2, 2, 2, 164, 166, 10, 3, 2, 2, 165, 164, 3, 2, 2, 2, 166, 169, 3, 2, - 2, 2, 167, 165, 3, 2, 2, 2, 167, 168, 3, 2, 2, 2, 168, 170, 3, 2, 2, 2, - 169, 167, 3, 2, 2, 2, 170, 171, 8, 21, 3, 2, 171, 42, 3, 2, 2, 2, 172, - 177, 7, 36, 2, 2, 173, 176, 10, 4, 2, 2, 174, 176, 5, 53, 27, 2, 175, 173, - 3, 2, 2, 2, 175, 174, 3, 2, 2, 2, 176, 179, 3, 2, 2, 2, 177, 175, 3, 2, - 2, 2, 177, 178, 3, 2, 2, 2, 178, 180, 3, 2, 2, 2, 179, 177, 3, 2, 2, 2, - 180, 181, 7, 36, 2, 2, 181, 44, 3, 2, 2, 2, 182, 185, 7, 98, 2, 2, 183, - 186, 10, 5, 2, 2, 184, 186, 5, 53, 27, 2, 185, 183, 3, 2, 2, 2, 185, 184, - 3, 2, 2, 2, 186, 187, 3, 2, 2, 2, 187, 185, 3, 2, 2, 2, 187, 188, 3, 2, - 2, 2, 188, 189, 3, 2, 2, 2, 189, 190, 7, 98, 2, 2, 190, 46, 3, 2, 2, 2, - 191, 195, 7, 60, 2, 2, 192, 194, 9, 6, 2, 2, 193, 192, 3, 2, 2, 2, 194, - 197, 3, 2, 2, 2, 195, 193, 3, 2, 2, 2, 195, 196, 3, 2, 2, 2, 196, 205, - 3, 2, 2, 2, 197, 195, 3, 2, 2, 2, 198, 206, 5, 43, 22, 2, 199, 201, 10, - 7, 2, 2, 200, 199, 3, 2, 2, 2, 201, 204, 3, 2, 2, 2, 202, 200, 3, 2, 2, - 2, 202, 203, 3, 2, 2, 2, 203, 206, 3, 2, 2, 2, 204, 202, 3, 2, 2, 2, 205, - 198, 3, 2, 2, 2, 205, 202, 3, 2, 2, 2, 206, 48, 3, 2, 2, 2, 207, 211, 5, - 63, 32, 2, 208, 210, 5, 61, 31, 2, 209, 208, 3, 2, 2, 2, 210, 213, 3, 2, - 2, 2, 211, 209, 3, 2, 2, 2, 211, 212, 3, 2, 2, 2, 212, 50, 3, 2, 2, 2, - 213, 211, 3, 2, 2, 2, 214, 216, 9, 8, 2, 2, 215, 217, 9, 9, 2, 2, 216, - 215, 3, 2, 2, 2, 216, 217, 3, 2, 2, 2, 217, 218, 3, 2, 2, 2, 218, 219, - 5, 59, 30, 2, 219, 52, 3, 2, 2, 2, 220, 221, 7, 94, 2, 2, 221, 242, 9, - 10, 2, 2, 222, 227, 7, 94, 2, 2, 223, 225, 9, 11, 2, 2, 224, 223, 3, 2, - 2, 2, 224, 225, 3, 2, 2, 2, 225, 226, 3, 2, 2, 2, 226, 228, 9, 12, 2, 2, - 227, 224, 3, 2, 2, 2, 227, 228, 3, 2, 2, 2, 228, 229, 3, 2, 2, 2, 229, - 242, 9, 12, 2, 2, 230, 232, 7, 94, 2, 2, 231, 233, 7, 119, 2, 2, 232, 231, - 3, 2, 2, 2, 233, 234, 3, 2, 2, 2, 234, 232, 3, 2, 2, 2, 234, 235, 3, 2, - 2, 2, 235, 236, 3, 2, 2, 2, 236, 237, 5, 57, 29, 2, 237, 238, 5, 57, 29, - 2, 238, 239, 5, 57, 29, 2, 239, 240, 5, 57, 29, 2, 240, 242, 3, 2, 2, 2, - 241, 220, 3, 2, 2, 2, 241, 222, 3, 2, 2, 2, 241, 230, 3, 2, 2, 2, 242, - 54, 3, 2, 2, 2, 243, 252, 5, 57, 29, 2, 244, 247, 5, 57, 29, 2, 245, 247, - 7, 97, 2, 2, 246, 244, 3, 2, 2, 2, 246, 245, 3, 2, 2, 2, 247, 250, 3, 2, - 2, 2, 248, 246, 3, 2, 2, 2, 248, 249, 3, 2, 2, 2, 249, 251, 3, 2, 2, 2, - 250, 248, 3, 2, 2, 2, 251, 253, 5, 57, 29, 2, 252, 248, 3, 2, 2, 2, 252, - 253, 3, 2, 2, 2, 253, 56, 3, 2, 2, 2, 254, 255, 9, 13, 2, 2, 255, 58, 3, - 2, 2, 2, 256, 264, 9, 14, 2, 2, 257, 259, 9, 15, 2, 2, 258, 257, 3, 2, - 2, 2, 259, 262, 3, 2, 2, 2, 260, 258, 3, 2, 2, 2, 260, 261, 3, 2, 2, 2, - 261, 263, 3, 2, 2, 2, 262, 260, 3, 2, 2, 2, 263, 265, 9, 14, 2, 2, 264, - 260, 3, 2, 2, 2, 264, 265, 3, 2, 2, 2, 265, 60, 3, 2, 2, 2, 266, 269, 5, - 63, 32, 2, 267, 269, 9, 14, 2, 2, 268, 266, 3, 2, 2, 2, 268, 267, 3, 2, - 2, 2, 269, 62, 3, 2, 2, 2, 270, 275, 9, 16, 2, 2, 271, 275, 10, 17, 2, - 2, 272, 273, 9, 18, 2, 2, 273, 275, 9, 19, 2, 2, 274, 270, 3, 2, 2, 2, - 274, 271, 3, 2, 2, 2, 274, 272, 3, 2, 2, 2, 275, 64, 3, 2, 2, 2, 26, 2, - 143, 153, 167, 175, 177, 185, 187, 195, 202, 205, 211, 216, 224, 227, 234, - 241, 246, 248, 252, 260, 264, 268, 274, 4, 2, 3, 2, 2, 90, 2, + 25, 12, 25, 14, 25, 213, 11, 25, 3, 26, 3, 26, 5, 26, 217, 10, 26, 3, 27, + 3, 27, 5, 27, 221, 10, 27, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 28, 5, + 28, 229, 10, 28, 3, 28, 5, 28, 232, 10, 28, 3, 28, 3, 28, 3, 28, 6, 28, + 237, 10, 28, 13, 28, 14, 28, 238, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 5, + 28, 246, 10, 28, 3, 29, 3, 29, 3, 29, 7, 29, 251, 10, 29, 12, 29, 14, 29, + 254, 11, 29, 3, 29, 5, 29, 257, 10, 29, 3, 30, 3, 30, 3, 31, 3, 31, 7, + 31, 263, 10, 31, 12, 31, 14, 31, 266, 11, 31, 3, 31, 5, 31, 269, 10, 31, + 3, 32, 3, 32, 3, 32, 3, 32, 5, 32, 275, 10, 32, 3, 153, 2, 33, 3, 3, 5, + 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, + 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, + 23, 45, 24, 47, 25, 49, 26, 51, 27, 53, 2, 55, 2, 57, 2, 59, 2, 61, 2, + 63, 2, 3, 2, 20, 5, 2, 11, 12, 14, 15, 34, 34, 4, 2, 12, 12, 15, 15, 4, + 2, 36, 36, 94, 94, 6, 2, 12, 12, 15, 15, 94, 94, 98, 98, 4, 2, 11, 11, + 34, 34, 6, 2, 12, 12, 15, 15, 36, 36, 98, 98, 3, 2, 50, 59, 4, 2, 71, 71, + 103, 103, 4, 2, 45, 45, 47, 47, 10, 2, 36, 36, 41, 41, 94, 94, 100, 100, + 104, 104, 112, 112, 116, 116, 118, 118, 3, 2, 50, 53, 3, 2, 50, 57, 5, + 2, 50, 59, 67, 72, 99, 104, 4, 2, 50, 59, 97, 97, 6, 2, 38, 38, 67, 92, + 97, 97, 99, 124, 4, 2, 2, 129, 55298, 56321, 3, 2, 55298, 56321, 3, 2, + 56322, 57345, 2, 294, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, + 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, + 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, + 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, + 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, + 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, + 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 3, 65, 3, 2, 2, + 2, 5, 67, 3, 2, 2, 2, 7, 69, 3, 2, 2, 2, 9, 71, 3, 2, 2, 2, 11, 73, 3, + 2, 2, 2, 13, 75, 3, 2, 2, 2, 15, 77, 3, 2, 2, 2, 17, 87, 3, 2, 2, 2, 19, + 89, 3, 2, 2, 2, 21, 91, 3, 2, 2, 2, 23, 99, 3, 2, 2, 2, 25, 101, 3, 2, + 2, 2, 27, 103, 3, 2, 2, 2, 29, 106, 3, 2, 2, 2, 31, 111, 3, 2, 2, 2, 33, + 120, 3, 2, 2, 2, 35, 132, 3, 2, 2, 2, 37, 141, 3, 2, 2, 2, 39, 147, 3, + 2, 2, 2, 41, 161, 3, 2, 2, 2, 43, 172, 3, 2, 2, 2, 45, 182, 3, 2, 2, 2, + 47, 191, 3, 2, 2, 2, 49, 207, 3, 2, 2, 2, 51, 216, 3, 2, 2, 2, 53, 218, + 3, 2, 2, 2, 55, 245, 3, 2, 2, 2, 57, 247, 3, 2, 2, 2, 59, 258, 3, 2, 2, + 2, 61, 260, 3, 2, 2, 2, 63, 274, 3, 2, 2, 2, 65, 66, 7, 63, 2, 2, 66, 4, + 3, 2, 2, 2, 67, 68, 7, 42, 2, 2, 68, 6, 3, 2, 2, 2, 69, 70, 7, 43, 2, 2, + 70, 8, 3, 2, 2, 2, 71, 72, 7, 125, 2, 2, 72, 10, 3, 2, 2, 2, 73, 74, 7, + 127, 2, 2, 74, 12, 3, 2, 2, 2, 75, 76, 7, 44, 2, 2, 76, 14, 3, 2, 2, 2, + 77, 78, 7, 118, 2, 2, 78, 79, 7, 107, 2, 2, 79, 80, 7, 111, 2, 2, 80, 81, + 7, 103, 2, 2, 81, 82, 7, 48, 2, 2, 82, 83, 7, 86, 2, 2, 83, 84, 7, 107, + 2, 2, 84, 85, 7, 111, 2, 2, 85, 86, 7, 103, 2, 2, 86, 16, 3, 2, 2, 2, 87, + 88, 7, 93, 2, 2, 88, 18, 3, 2, 2, 2, 89, 90, 7, 95, 2, 2, 90, 20, 3, 2, + 2, 2, 91, 92, 7, 116, 2, 2, 92, 93, 7, 103, 2, 2, 93, 94, 7, 118, 2, 2, + 94, 95, 7, 119, 2, 2, 95, 96, 7, 116, 2, 2, 96, 97, 7, 112, 2, 2, 97, 98, + 7, 117, 2, 2, 98, 22, 3, 2, 2, 2, 99, 100, 7, 47, 2, 2, 100, 24, 3, 2, + 2, 2, 101, 102, 7, 49, 2, 2, 102, 26, 3, 2, 2, 2, 103, 104, 7, 49, 2, 2, + 104, 105, 7, 60, 2, 2, 105, 28, 3, 2, 2, 2, 106, 107, 7, 66, 2, 2, 107, + 108, 7, 102, 2, 2, 108, 109, 7, 113, 2, 2, 109, 110, 7, 101, 2, 2, 110, + 30, 3, 2, 2, 2, 111, 112, 7, 66, 2, 2, 112, 113, 7, 106, 2, 2, 113, 114, + 7, 99, 2, 2, 114, 115, 7, 112, 2, 2, 115, 116, 7, 102, 2, 2, 116, 117, + 7, 110, 2, 2, 117, 118, 7, 103, 2, 2, 118, 119, 7, 116, 2, 2, 119, 32, + 3, 2, 2, 2, 120, 121, 7, 107, 2, 2, 121, 122, 7, 112, 2, 2, 122, 123, 7, + 118, 2, 2, 123, 124, 7, 103, 2, 2, 124, 125, 7, 116, 2, 2, 125, 126, 7, + 104, 2, 2, 126, 127, 7, 99, 2, 2, 127, 128, 7, 101, 2, 2, 128, 129, 7, + 103, 2, 2, 129, 130, 7, 125, 2, 2, 130, 131, 7, 127, 2, 2, 131, 34, 3, + 2, 2, 2, 132, 133, 7, 66, 2, 2, 133, 134, 7, 117, 2, 2, 134, 135, 7, 103, + 2, 2, 135, 136, 7, 116, 2, 2, 136, 137, 7, 120, 2, 2, 137, 138, 7, 103, + 2, 2, 138, 139, 7, 116, 2, 2, 139, 36, 3, 2, 2, 2, 140, 142, 9, 2, 2, 2, + 141, 140, 3, 2, 2, 2, 142, 143, 3, 2, 2, 2, 143, 141, 3, 2, 2, 2, 143, + 144, 3, 2, 2, 2, 144, 145, 3, 2, 2, 2, 145, 146, 8, 19, 2, 2, 146, 38, + 3, 2, 2, 2, 147, 148, 7, 49, 2, 2, 148, 149, 7, 44, 2, 2, 149, 153, 3, + 2, 2, 2, 150, 152, 11, 2, 2, 2, 151, 150, 3, 2, 2, 2, 152, 155, 3, 2, 2, + 2, 153, 154, 3, 2, 2, 2, 153, 151, 3, 2, 2, 2, 154, 156, 3, 2, 2, 2, 155, + 153, 3, 2, 2, 2, 156, 157, 7, 44, 2, 2, 157, 158, 7, 49, 2, 2, 158, 159, + 3, 2, 2, 2, 159, 160, 8, 20, 3, 2, 160, 40, 3, 2, 2, 2, 161, 162, 7, 49, + 2, 2, 162, 163, 7, 49, 2, 2, 163, 167, 3, 2, 2, 2, 164, 166, 10, 3, 2, + 2, 165, 164, 3, 2, 2, 2, 166, 169, 3, 2, 2, 2, 167, 165, 3, 2, 2, 2, 167, + 168, 3, 2, 2, 2, 168, 170, 3, 2, 2, 2, 169, 167, 3, 2, 2, 2, 170, 171, + 8, 21, 3, 2, 171, 42, 3, 2, 2, 2, 172, 177, 7, 36, 2, 2, 173, 176, 10, + 4, 2, 2, 174, 176, 5, 55, 28, 2, 175, 173, 3, 2, 2, 2, 175, 174, 3, 2, + 2, 2, 176, 179, 3, 2, 2, 2, 177, 175, 3, 2, 2, 2, 177, 178, 3, 2, 2, 2, + 178, 180, 3, 2, 2, 2, 179, 177, 3, 2, 2, 2, 180, 181, 7, 36, 2, 2, 181, + 44, 3, 2, 2, 2, 182, 185, 7, 98, 2, 2, 183, 186, 10, 5, 2, 2, 184, 186, + 5, 55, 28, 2, 185, 183, 3, 2, 2, 2, 185, 184, 3, 2, 2, 2, 186, 187, 3, + 2, 2, 2, 187, 185, 3, 2, 2, 2, 187, 188, 3, 2, 2, 2, 188, 189, 3, 2, 2, + 2, 189, 190, 7, 98, 2, 2, 190, 46, 3, 2, 2, 2, 191, 195, 7, 60, 2, 2, 192, + 194, 9, 6, 2, 2, 193, 192, 3, 2, 2, 2, 194, 197, 3, 2, 2, 2, 195, 193, + 3, 2, 2, 2, 195, 196, 3, 2, 2, 2, 196, 205, 3, 2, 2, 2, 197, 195, 3, 2, + 2, 2, 198, 206, 5, 43, 22, 2, 199, 201, 10, 7, 2, 2, 200, 199, 3, 2, 2, + 2, 201, 204, 3, 2, 2, 2, 202, 200, 3, 2, 2, 2, 202, 203, 3, 2, 2, 2, 203, + 206, 3, 2, 2, 2, 204, 202, 3, 2, 2, 2, 205, 198, 3, 2, 2, 2, 205, 202, + 3, 2, 2, 2, 206, 48, 3, 2, 2, 2, 207, 211, 5, 63, 32, 2, 208, 210, 5, 51, + 26, 2, 209, 208, 3, 2, 2, 2, 210, 213, 3, 2, 2, 2, 211, 209, 3, 2, 2, 2, + 211, 212, 3, 2, 2, 2, 212, 50, 3, 2, 2, 2, 213, 211, 3, 2, 2, 2, 214, 217, + 5, 63, 32, 2, 215, 217, 9, 8, 2, 2, 216, 214, 3, 2, 2, 2, 216, 215, 3, + 2, 2, 2, 217, 52, 3, 2, 2, 2, 218, 220, 9, 9, 2, 2, 219, 221, 9, 10, 2, + 2, 220, 219, 3, 2, 2, 2, 220, 221, 3, 2, 2, 2, 221, 222, 3, 2, 2, 2, 222, + 223, 5, 61, 31, 2, 223, 54, 3, 2, 2, 2, 224, 225, 7, 94, 2, 2, 225, 246, + 9, 11, 2, 2, 226, 231, 7, 94, 2, 2, 227, 229, 9, 12, 2, 2, 228, 227, 3, + 2, 2, 2, 228, 229, 3, 2, 2, 2, 229, 230, 3, 2, 2, 2, 230, 232, 9, 13, 2, + 2, 231, 228, 3, 2, 2, 2, 231, 232, 3, 2, 2, 2, 232, 233, 3, 2, 2, 2, 233, + 246, 9, 13, 2, 2, 234, 236, 7, 94, 2, 2, 235, 237, 7, 119, 2, 2, 236, 235, + 3, 2, 2, 2, 237, 238, 3, 2, 2, 2, 238, 236, 3, 2, 2, 2, 238, 239, 3, 2, + 2, 2, 239, 240, 3, 2, 2, 2, 240, 241, 5, 59, 30, 2, 241, 242, 5, 59, 30, + 2, 242, 243, 5, 59, 30, 2, 243, 244, 5, 59, 30, 2, 244, 246, 3, 2, 2, 2, + 245, 224, 3, 2, 2, 2, 245, 226, 3, 2, 2, 2, 245, 234, 3, 2, 2, 2, 246, + 56, 3, 2, 2, 2, 247, 256, 5, 59, 30, 2, 248, 251, 5, 59, 30, 2, 249, 251, + 7, 97, 2, 2, 250, 248, 3, 2, 2, 2, 250, 249, 3, 2, 2, 2, 251, 254, 3, 2, + 2, 2, 252, 250, 3, 2, 2, 2, 252, 253, 3, 2, 2, 2, 253, 255, 3, 2, 2, 2, + 254, 252, 3, 2, 2, 2, 255, 257, 5, 59, 30, 2, 256, 252, 3, 2, 2, 2, 256, + 257, 3, 2, 2, 2, 257, 58, 3, 2, 2, 2, 258, 259, 9, 14, 2, 2, 259, 60, 3, + 2, 2, 2, 260, 268, 9, 8, 2, 2, 261, 263, 9, 15, 2, 2, 262, 261, 3, 2, 2, + 2, 263, 266, 3, 2, 2, 2, 264, 262, 3, 2, 2, 2, 264, 265, 3, 2, 2, 2, 265, + 267, 3, 2, 2, 2, 266, 264, 3, 2, 2, 2, 267, 269, 9, 8, 2, 2, 268, 264, + 3, 2, 2, 2, 268, 269, 3, 2, 2, 2, 269, 62, 3, 2, 2, 2, 270, 275, 9, 16, + 2, 2, 271, 275, 10, 17, 2, 2, 272, 273, 9, 18, 2, 2, 273, 275, 9, 19, 2, + 2, 274, 270, 3, 2, 2, 2, 274, 271, 3, 2, 2, 2, 274, 272, 3, 2, 2, 2, 275, + 64, 3, 2, 2, 2, 26, 2, 143, 153, 167, 175, 177, 185, 187, 195, 202, 205, + 211, 216, 220, 228, 231, 238, 245, 250, 252, 256, 264, 268, 274, 4, 2, + 3, 2, 2, 90, 2, } var lexerChannelNames = []string{ @@ -163,15 +162,15 @@ var lexerLiteralNames = []string{ var lexerSymbolicNames = []string{ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "ATDOC", "ATHANDLER", "INTERFACE", "ATSERVER", "WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING", - "LINE_VALUE", "ID", + "LINE_VALUE", "ID", "LetterOrDigit", } var lexerRuleNames = []string{ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "ATDOC", "ATHANDLER", "INTERFACE", "ATSERVER", "WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING", "LINE_VALUE", - "ID", "ExponentPart", "EscapeSequence", "HexDigits", "HexDigit", "Digits", - "LetterOrDigit", "Letter", + "ID", "LetterOrDigit", "ExponentPart", "EscapeSequence", "HexDigits", "HexDigit", + "Digits", "Letter", } type ApiParserLexer struct { @@ -211,30 +210,31 @@ func NewApiParserLexer(input antlr.CharStream) *ApiParserLexer { // ApiParserLexer tokens. const ( - ApiParserLexerT__0 = 1 - ApiParserLexerT__1 = 2 - ApiParserLexerT__2 = 3 - ApiParserLexerT__3 = 4 - ApiParserLexerT__4 = 5 - ApiParserLexerT__5 = 6 - ApiParserLexerT__6 = 7 - ApiParserLexerT__7 = 8 - ApiParserLexerT__8 = 9 - ApiParserLexerT__9 = 10 - ApiParserLexerT__10 = 11 - ApiParserLexerT__11 = 12 - ApiParserLexerT__12 = 13 - ApiParserLexerATDOC = 14 - ApiParserLexerATHANDLER = 15 - ApiParserLexerINTERFACE = 16 - ApiParserLexerATSERVER = 17 - ApiParserLexerWS = 18 - ApiParserLexerCOMMENT = 19 - ApiParserLexerLINE_COMMENT = 20 - ApiParserLexerSTRING = 21 - ApiParserLexerRAW_STRING = 22 - ApiParserLexerLINE_VALUE = 23 - ApiParserLexerID = 24 + ApiParserLexerT__0 = 1 + ApiParserLexerT__1 = 2 + ApiParserLexerT__2 = 3 + ApiParserLexerT__3 = 4 + ApiParserLexerT__4 = 5 + ApiParserLexerT__5 = 6 + ApiParserLexerT__6 = 7 + ApiParserLexerT__7 = 8 + ApiParserLexerT__8 = 9 + ApiParserLexerT__9 = 10 + ApiParserLexerT__10 = 11 + ApiParserLexerT__11 = 12 + ApiParserLexerT__12 = 13 + ApiParserLexerATDOC = 14 + ApiParserLexerATHANDLER = 15 + ApiParserLexerINTERFACE = 16 + ApiParserLexerATSERVER = 17 + ApiParserLexerWS = 18 + ApiParserLexerCOMMENT = 19 + ApiParserLexerLINE_COMMENT = 20 + ApiParserLexerSTRING = 21 + ApiParserLexerRAW_STRING = 22 + ApiParserLexerLINE_VALUE = 23 + ApiParserLexerID = 24 + ApiParserLexerLetterOrDigit = 25 ) const COMEMNTS = 88 diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_parser.go b/tools/goctl/api/parser/g4/gen/api/apiparser_parser.go index 8599337c6169..0275334226e9 100755 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser.go @@ -1,5 +1,4 @@ -package api - +package api // ApiParser import ( "fmt" "reflect" @@ -9,177 +8,176 @@ import ( ) // Suppress unused import errors -var ( - _ = fmt.Printf - _ = reflect.Copy - _ = strconv.Itoa -) +var _ = fmt.Printf +var _ = reflect.Copy +var _ = strconv.Itoa var parserATN = []uint16{ - 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 26, 349, + 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 27, 356, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, - 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 3, 2, 7, - 2, 78, 10, 2, 12, 2, 14, 2, 81, 11, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, - 3, 88, 10, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 5, 5, 98, - 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 6, 7, 108, 10, 7, - 13, 7, 14, 7, 109, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 10, 3, - 10, 3, 10, 3, 10, 6, 10, 123, 10, 10, 13, 10, 14, 10, 124, 3, 10, 3, 10, - 3, 11, 3, 11, 5, 11, 131, 10, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 13, 3, - 13, 3, 13, 3, 13, 7, 13, 141, 10, 13, 12, 13, 14, 13, 144, 11, 13, 3, 13, - 3, 13, 3, 14, 3, 14, 5, 14, 150, 10, 14, 3, 15, 3, 15, 5, 15, 154, 10, - 15, 3, 16, 3, 16, 3, 16, 5, 16, 159, 10, 16, 3, 16, 3, 16, 7, 16, 163, - 10, 16, 12, 16, 14, 16, 166, 11, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, - 5, 17, 173, 10, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 5, 18, 180, 10, - 18, 3, 18, 3, 18, 7, 18, 184, 10, 18, 12, 18, 14, 18, 187, 11, 18, 3, 18, - 3, 18, 3, 19, 3, 19, 3, 19, 5, 19, 194, 10, 19, 3, 19, 3, 19, 3, 20, 3, - 20, 3, 20, 5, 20, 201, 10, 20, 3, 21, 3, 21, 3, 21, 3, 21, 5, 21, 207, - 10, 21, 3, 22, 5, 22, 210, 10, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, - 23, 3, 23, 3, 23, 3, 23, 3, 23, 5, 23, 222, 10, 23, 3, 24, 3, 24, 3, 24, - 3, 24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 26, 3, - 26, 3, 26, 3, 26, 3, 27, 5, 27, 241, 10, 27, 3, 27, 3, 27, 3, 28, 3, 28, - 3, 28, 6, 28, 248, 10, 28, 13, 28, 14, 28, 249, 3, 28, 3, 28, 3, 29, 3, - 29, 3, 29, 3, 29, 3, 29, 7, 29, 259, 10, 29, 12, 29, 14, 29, 262, 11, 29, - 3, 29, 3, 29, 3, 30, 5, 30, 267, 10, 30, 3, 30, 3, 30, 5, 30, 271, 10, - 30, 3, 30, 3, 30, 3, 31, 3, 31, 5, 31, 277, 10, 31, 3, 31, 6, 31, 280, - 10, 31, 13, 31, 14, 31, 281, 3, 31, 5, 31, 285, 10, 31, 3, 31, 5, 31, 288, - 10, 31, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 5, 33, 297, 10, - 33, 3, 33, 5, 33, 300, 10, 33, 3, 34, 3, 34, 5, 34, 304, 10, 34, 3, 34, - 3, 34, 3, 35, 3, 35, 3, 35, 5, 35, 311, 10, 35, 3, 35, 3, 35, 3, 36, 3, - 36, 3, 36, 3, 36, 3, 37, 3, 37, 5, 37, 321, 10, 37, 6, 37, 323, 10, 37, - 13, 37, 14, 37, 324, 3, 38, 3, 38, 3, 38, 3, 38, 7, 38, 331, 10, 38, 12, - 38, 14, 38, 334, 11, 38, 3, 38, 3, 38, 3, 38, 3, 38, 5, 38, 340, 10, 38, - 6, 38, 342, 10, 38, 13, 38, 14, 38, 343, 3, 38, 5, 38, 347, 10, 38, 3, - 38, 2, 2, 39, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, - 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, - 70, 72, 74, 2, 2, 2, 358, 2, 79, 3, 2, 2, 2, 4, 87, 3, 2, 2, 2, 6, 89, - 3, 2, 2, 2, 8, 97, 3, 2, 2, 2, 10, 99, 3, 2, 2, 2, 12, 103, 3, 2, 2, 2, - 14, 113, 3, 2, 2, 2, 16, 115, 3, 2, 2, 2, 18, 118, 3, 2, 2, 2, 20, 130, - 3, 2, 2, 2, 22, 132, 3, 2, 2, 2, 24, 136, 3, 2, 2, 2, 26, 149, 3, 2, 2, - 2, 28, 153, 3, 2, 2, 2, 30, 155, 3, 2, 2, 2, 32, 169, 3, 2, 2, 2, 34, 176, - 3, 2, 2, 2, 36, 190, 3, 2, 2, 2, 38, 200, 3, 2, 2, 2, 40, 202, 3, 2, 2, - 2, 42, 209, 3, 2, 2, 2, 44, 221, 3, 2, 2, 2, 46, 223, 3, 2, 2, 2, 48, 227, - 3, 2, 2, 2, 50, 235, 3, 2, 2, 2, 52, 240, 3, 2, 2, 2, 54, 244, 3, 2, 2, - 2, 56, 253, 3, 2, 2, 2, 58, 266, 3, 2, 2, 2, 60, 274, 3, 2, 2, 2, 62, 289, - 3, 2, 2, 2, 64, 292, 3, 2, 2, 2, 66, 301, 3, 2, 2, 2, 68, 307, 3, 2, 2, - 2, 70, 314, 3, 2, 2, 2, 72, 322, 3, 2, 2, 2, 74, 346, 3, 2, 2, 2, 76, 78, - 5, 4, 3, 2, 77, 76, 3, 2, 2, 2, 78, 81, 3, 2, 2, 2, 79, 77, 3, 2, 2, 2, - 79, 80, 3, 2, 2, 2, 80, 3, 3, 2, 2, 2, 81, 79, 3, 2, 2, 2, 82, 88, 5, 6, - 4, 2, 83, 88, 5, 8, 5, 2, 84, 88, 5, 18, 10, 2, 85, 88, 5, 20, 11, 2, 86, - 88, 5, 52, 27, 2, 87, 82, 3, 2, 2, 2, 87, 83, 3, 2, 2, 2, 87, 84, 3, 2, - 2, 2, 87, 85, 3, 2, 2, 2, 87, 86, 3, 2, 2, 2, 88, 5, 3, 2, 2, 2, 89, 90, - 8, 4, 1, 2, 90, 91, 7, 26, 2, 2, 91, 92, 7, 3, 2, 2, 92, 93, 8, 4, 1, 2, - 93, 94, 7, 23, 2, 2, 94, 7, 3, 2, 2, 2, 95, 98, 5, 10, 6, 2, 96, 98, 5, - 12, 7, 2, 97, 95, 3, 2, 2, 2, 97, 96, 3, 2, 2, 2, 98, 9, 3, 2, 2, 2, 99, - 100, 8, 6, 1, 2, 100, 101, 7, 26, 2, 2, 101, 102, 5, 16, 9, 2, 102, 11, - 3, 2, 2, 2, 103, 104, 8, 7, 1, 2, 104, 105, 7, 26, 2, 2, 105, 107, 7, 4, - 2, 2, 106, 108, 5, 14, 8, 2, 107, 106, 3, 2, 2, 2, 108, 109, 3, 2, 2, 2, - 109, 107, 3, 2, 2, 2, 109, 110, 3, 2, 2, 2, 110, 111, 3, 2, 2, 2, 111, - 112, 7, 5, 2, 2, 112, 13, 3, 2, 2, 2, 113, 114, 5, 16, 9, 2, 114, 15, 3, - 2, 2, 2, 115, 116, 8, 9, 1, 2, 116, 117, 7, 23, 2, 2, 117, 17, 3, 2, 2, - 2, 118, 119, 8, 10, 1, 2, 119, 120, 7, 26, 2, 2, 120, 122, 7, 4, 2, 2, - 121, 123, 5, 70, 36, 2, 122, 121, 3, 2, 2, 2, 123, 124, 3, 2, 2, 2, 124, - 122, 3, 2, 2, 2, 124, 125, 3, 2, 2, 2, 125, 126, 3, 2, 2, 2, 126, 127, - 7, 5, 2, 2, 127, 19, 3, 2, 2, 2, 128, 131, 5, 22, 12, 2, 129, 131, 5, 24, - 13, 2, 130, 128, 3, 2, 2, 2, 130, 129, 3, 2, 2, 2, 131, 21, 3, 2, 2, 2, - 132, 133, 8, 12, 1, 2, 133, 134, 7, 26, 2, 2, 134, 135, 5, 26, 14, 2, 135, - 23, 3, 2, 2, 2, 136, 137, 8, 13, 1, 2, 137, 138, 7, 26, 2, 2, 138, 142, - 7, 4, 2, 2, 139, 141, 5, 28, 15, 2, 140, 139, 3, 2, 2, 2, 141, 144, 3, - 2, 2, 2, 142, 140, 3, 2, 2, 2, 142, 143, 3, 2, 2, 2, 143, 145, 3, 2, 2, - 2, 144, 142, 3, 2, 2, 2, 145, 146, 7, 5, 2, 2, 146, 25, 3, 2, 2, 2, 147, - 150, 5, 30, 16, 2, 148, 150, 5, 32, 17, 2, 149, 147, 3, 2, 2, 2, 149, 148, - 3, 2, 2, 2, 150, 27, 3, 2, 2, 2, 151, 154, 5, 34, 18, 2, 152, 154, 5, 36, - 19, 2, 153, 151, 3, 2, 2, 2, 153, 152, 3, 2, 2, 2, 154, 29, 3, 2, 2, 2, - 155, 156, 8, 16, 1, 2, 156, 158, 7, 26, 2, 2, 157, 159, 7, 26, 2, 2, 158, - 157, 3, 2, 2, 2, 158, 159, 3, 2, 2, 2, 159, 160, 3, 2, 2, 2, 160, 164, - 7, 6, 2, 2, 161, 163, 5, 38, 20, 2, 162, 161, 3, 2, 2, 2, 163, 166, 3, - 2, 2, 2, 164, 162, 3, 2, 2, 2, 164, 165, 3, 2, 2, 2, 165, 167, 3, 2, 2, - 2, 166, 164, 3, 2, 2, 2, 167, 168, 7, 7, 2, 2, 168, 31, 3, 2, 2, 2, 169, - 170, 8, 17, 1, 2, 170, 172, 7, 26, 2, 2, 171, 173, 7, 3, 2, 2, 172, 171, - 3, 2, 2, 2, 172, 173, 3, 2, 2, 2, 173, 174, 3, 2, 2, 2, 174, 175, 5, 44, - 23, 2, 175, 33, 3, 2, 2, 2, 176, 177, 8, 18, 1, 2, 177, 179, 7, 26, 2, - 2, 178, 180, 7, 26, 2, 2, 179, 178, 3, 2, 2, 2, 179, 180, 3, 2, 2, 2, 180, - 181, 3, 2, 2, 2, 181, 185, 7, 6, 2, 2, 182, 184, 5, 38, 20, 2, 183, 182, - 3, 2, 2, 2, 184, 187, 3, 2, 2, 2, 185, 183, 3, 2, 2, 2, 185, 186, 3, 2, - 2, 2, 186, 188, 3, 2, 2, 2, 187, 185, 3, 2, 2, 2, 188, 189, 7, 7, 2, 2, - 189, 35, 3, 2, 2, 2, 190, 191, 8, 19, 1, 2, 191, 193, 7, 26, 2, 2, 192, - 194, 7, 3, 2, 2, 193, 192, 3, 2, 2, 2, 193, 194, 3, 2, 2, 2, 194, 195, - 3, 2, 2, 2, 195, 196, 5, 44, 23, 2, 196, 37, 3, 2, 2, 2, 197, 198, 6, 20, - 2, 2, 198, 201, 5, 40, 21, 2, 199, 201, 5, 42, 22, 2, 200, 197, 3, 2, 2, - 2, 200, 199, 3, 2, 2, 2, 201, 39, 3, 2, 2, 2, 202, 203, 8, 21, 1, 2, 203, - 204, 7, 26, 2, 2, 204, 206, 5, 44, 23, 2, 205, 207, 7, 24, 2, 2, 206, 205, - 3, 2, 2, 2, 206, 207, 3, 2, 2, 2, 207, 41, 3, 2, 2, 2, 208, 210, 7, 8, - 2, 2, 209, 208, 3, 2, 2, 2, 209, 210, 3, 2, 2, 2, 210, 211, 3, 2, 2, 2, - 211, 212, 7, 26, 2, 2, 212, 43, 3, 2, 2, 2, 213, 214, 8, 23, 1, 2, 214, - 222, 7, 26, 2, 2, 215, 222, 5, 48, 25, 2, 216, 222, 5, 50, 26, 2, 217, - 222, 7, 18, 2, 2, 218, 222, 7, 9, 2, 2, 219, 222, 5, 46, 24, 2, 220, 222, - 5, 30, 16, 2, 221, 213, 3, 2, 2, 2, 221, 215, 3, 2, 2, 2, 221, 216, 3, - 2, 2, 2, 221, 217, 3, 2, 2, 2, 221, 218, 3, 2, 2, 2, 221, 219, 3, 2, 2, - 2, 221, 220, 3, 2, 2, 2, 222, 45, 3, 2, 2, 2, 223, 224, 7, 8, 2, 2, 224, - 225, 8, 24, 1, 2, 225, 226, 7, 26, 2, 2, 226, 47, 3, 2, 2, 2, 227, 228, - 8, 25, 1, 2, 228, 229, 7, 26, 2, 2, 229, 230, 7, 10, 2, 2, 230, 231, 8, - 25, 1, 2, 231, 232, 7, 26, 2, 2, 232, 233, 7, 11, 2, 2, 233, 234, 5, 44, - 23, 2, 234, 49, 3, 2, 2, 2, 235, 236, 7, 10, 2, 2, 236, 237, 7, 11, 2, - 2, 237, 238, 5, 44, 23, 2, 238, 51, 3, 2, 2, 2, 239, 241, 5, 54, 28, 2, - 240, 239, 3, 2, 2, 2, 240, 241, 3, 2, 2, 2, 241, 242, 3, 2, 2, 2, 242, - 243, 5, 56, 29, 2, 243, 53, 3, 2, 2, 2, 244, 245, 7, 19, 2, 2, 245, 247, - 7, 4, 2, 2, 246, 248, 5, 70, 36, 2, 247, 246, 3, 2, 2, 2, 248, 249, 3, - 2, 2, 2, 249, 247, 3, 2, 2, 2, 249, 250, 3, 2, 2, 2, 250, 251, 3, 2, 2, - 2, 251, 252, 7, 5, 2, 2, 252, 55, 3, 2, 2, 2, 253, 254, 8, 29, 1, 2, 254, - 255, 7, 26, 2, 2, 255, 256, 5, 72, 37, 2, 256, 260, 7, 6, 2, 2, 257, 259, - 5, 58, 30, 2, 258, 257, 3, 2, 2, 2, 259, 262, 3, 2, 2, 2, 260, 258, 3, - 2, 2, 2, 260, 261, 3, 2, 2, 2, 261, 263, 3, 2, 2, 2, 262, 260, 3, 2, 2, - 2, 263, 264, 7, 7, 2, 2, 264, 57, 3, 2, 2, 2, 265, 267, 5, 60, 31, 2, 266, - 265, 3, 2, 2, 2, 266, 267, 3, 2, 2, 2, 267, 270, 3, 2, 2, 2, 268, 271, - 5, 54, 28, 2, 269, 271, 5, 62, 32, 2, 270, 268, 3, 2, 2, 2, 270, 269, 3, - 2, 2, 2, 271, 272, 3, 2, 2, 2, 272, 273, 5, 64, 33, 2, 273, 59, 3, 2, 2, - 2, 274, 276, 7, 16, 2, 2, 275, 277, 7, 4, 2, 2, 276, 275, 3, 2, 2, 2, 276, - 277, 3, 2, 2, 2, 277, 284, 3, 2, 2, 2, 278, 280, 5, 70, 36, 2, 279, 278, - 3, 2, 2, 2, 280, 281, 3, 2, 2, 2, 281, 279, 3, 2, 2, 2, 281, 282, 3, 2, - 2, 2, 282, 285, 3, 2, 2, 2, 283, 285, 7, 23, 2, 2, 284, 279, 3, 2, 2, 2, - 284, 283, 3, 2, 2, 2, 285, 287, 3, 2, 2, 2, 286, 288, 7, 5, 2, 2, 287, - 286, 3, 2, 2, 2, 287, 288, 3, 2, 2, 2, 288, 61, 3, 2, 2, 2, 289, 290, 7, - 17, 2, 2, 290, 291, 7, 26, 2, 2, 291, 63, 3, 2, 2, 2, 292, 293, 8, 33, - 1, 2, 293, 294, 7, 26, 2, 2, 294, 296, 5, 74, 38, 2, 295, 297, 5, 66, 34, - 2, 296, 295, 3, 2, 2, 2, 296, 297, 3, 2, 2, 2, 297, 299, 3, 2, 2, 2, 298, - 300, 5, 68, 35, 2, 299, 298, 3, 2, 2, 2, 299, 300, 3, 2, 2, 2, 300, 65, - 3, 2, 2, 2, 301, 303, 7, 4, 2, 2, 302, 304, 7, 26, 2, 2, 303, 302, 3, 2, - 2, 2, 303, 304, 3, 2, 2, 2, 304, 305, 3, 2, 2, 2, 305, 306, 7, 5, 2, 2, - 306, 67, 3, 2, 2, 2, 307, 308, 7, 12, 2, 2, 308, 310, 7, 4, 2, 2, 309, - 311, 5, 44, 23, 2, 310, 309, 3, 2, 2, 2, 310, 311, 3, 2, 2, 2, 311, 312, - 3, 2, 2, 2, 312, 313, 7, 5, 2, 2, 313, 69, 3, 2, 2, 2, 314, 315, 7, 26, - 2, 2, 315, 316, 8, 36, 1, 2, 316, 317, 7, 25, 2, 2, 317, 71, 3, 2, 2, 2, - 318, 320, 7, 26, 2, 2, 319, 321, 7, 13, 2, 2, 320, 319, 3, 2, 2, 2, 320, - 321, 3, 2, 2, 2, 321, 323, 3, 2, 2, 2, 322, 318, 3, 2, 2, 2, 323, 324, - 3, 2, 2, 2, 324, 322, 3, 2, 2, 2, 324, 325, 3, 2, 2, 2, 325, 73, 3, 2, - 2, 2, 326, 327, 7, 14, 2, 2, 327, 332, 7, 26, 2, 2, 328, 329, 7, 13, 2, - 2, 329, 331, 7, 26, 2, 2, 330, 328, 3, 2, 2, 2, 331, 334, 3, 2, 2, 2, 332, - 330, 3, 2, 2, 2, 332, 333, 3, 2, 2, 2, 333, 342, 3, 2, 2, 2, 334, 332, - 3, 2, 2, 2, 335, 336, 7, 15, 2, 2, 336, 339, 7, 26, 2, 2, 337, 338, 7, - 13, 2, 2, 338, 340, 7, 26, 2, 2, 339, 337, 3, 2, 2, 2, 339, 340, 3, 2, - 2, 2, 340, 342, 3, 2, 2, 2, 341, 326, 3, 2, 2, 2, 341, 335, 3, 2, 2, 2, - 342, 343, 3, 2, 2, 2, 343, 341, 3, 2, 2, 2, 343, 344, 3, 2, 2, 2, 344, - 347, 3, 2, 2, 2, 345, 347, 7, 14, 2, 2, 346, 341, 3, 2, 2, 2, 346, 345, - 3, 2, 2, 2, 347, 75, 3, 2, 2, 2, 41, 79, 87, 97, 109, 124, 130, 142, 149, - 153, 158, 164, 172, 179, 185, 193, 200, 206, 209, 221, 240, 249, 260, 266, - 270, 276, 281, 284, 287, 296, 299, 303, 310, 320, 324, 332, 339, 341, 343, - 346, + 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, + 39, 3, 2, 7, 2, 80, 10, 2, 12, 2, 14, 2, 83, 11, 2, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 5, 3, 90, 10, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, + 5, 5, 5, 100, 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 6, + 7, 110, 10, 7, 13, 7, 14, 7, 111, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, + 9, 3, 10, 3, 10, 3, 10, 3, 10, 6, 10, 125, 10, 10, 13, 10, 14, 10, 126, + 3, 10, 3, 10, 3, 11, 3, 11, 5, 11, 133, 10, 11, 3, 12, 3, 12, 3, 12, 3, + 12, 3, 13, 3, 13, 3, 13, 3, 13, 7, 13, 143, 10, 13, 12, 13, 14, 13, 146, + 11, 13, 3, 13, 3, 13, 3, 14, 3, 14, 5, 14, 152, 10, 14, 3, 15, 3, 15, 5, + 15, 156, 10, 15, 3, 16, 3, 16, 3, 16, 5, 16, 161, 10, 16, 3, 16, 3, 16, + 7, 16, 165, 10, 16, 12, 16, 14, 16, 168, 11, 16, 3, 16, 3, 16, 3, 17, 3, + 17, 3, 17, 5, 17, 175, 10, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 5, 18, + 182, 10, 18, 3, 18, 3, 18, 7, 18, 186, 10, 18, 12, 18, 14, 18, 189, 11, + 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 5, 19, 196, 10, 19, 3, 19, 3, 19, + 3, 20, 3, 20, 3, 20, 5, 20, 203, 10, 20, 3, 21, 3, 21, 3, 21, 3, 21, 5, + 21, 209, 10, 21, 3, 22, 5, 22, 212, 10, 22, 3, 22, 3, 22, 3, 23, 3, 23, + 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 5, 23, 224, 10, 23, 3, 24, 3, + 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, + 3, 26, 3, 26, 3, 26, 3, 26, 3, 27, 5, 27, 243, 10, 27, 3, 27, 3, 27, 3, + 28, 3, 28, 3, 28, 6, 28, 250, 10, 28, 13, 28, 14, 28, 251, 3, 28, 3, 28, + 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 7, 29, 261, 10, 29, 12, 29, 14, 29, + 264, 11, 29, 3, 29, 3, 29, 3, 30, 5, 30, 269, 10, 30, 3, 30, 3, 30, 5, + 30, 273, 10, 30, 3, 30, 3, 30, 3, 31, 3, 31, 5, 31, 279, 10, 31, 3, 31, + 6, 31, 282, 10, 31, 13, 31, 14, 31, 283, 3, 31, 5, 31, 287, 10, 31, 3, + 31, 5, 31, 290, 10, 31, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, + 5, 33, 299, 10, 33, 3, 33, 5, 33, 302, 10, 33, 3, 34, 3, 34, 5, 34, 306, + 10, 34, 3, 34, 3, 34, 3, 35, 3, 35, 3, 35, 5, 35, 313, 10, 35, 3, 35, 3, + 35, 3, 36, 3, 36, 3, 36, 3, 36, 3, 37, 3, 37, 5, 37, 323, 10, 37, 6, 37, + 325, 10, 37, 13, 37, 14, 37, 326, 3, 38, 3, 38, 3, 38, 3, 38, 7, 38, 333, + 10, 38, 12, 38, 14, 38, 336, 11, 38, 3, 38, 3, 38, 3, 38, 3, 38, 5, 38, + 342, 10, 38, 6, 38, 344, 10, 38, 13, 38, 14, 38, 345, 3, 38, 5, 38, 349, + 10, 38, 3, 39, 6, 39, 352, 10, 39, 13, 39, 14, 39, 353, 3, 39, 2, 2, 40, + 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, + 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, + 76, 2, 3, 3, 2, 26, 27, 2, 365, 2, 81, 3, 2, 2, 2, 4, 89, 3, 2, 2, 2, 6, + 91, 3, 2, 2, 2, 8, 99, 3, 2, 2, 2, 10, 101, 3, 2, 2, 2, 12, 105, 3, 2, + 2, 2, 14, 115, 3, 2, 2, 2, 16, 117, 3, 2, 2, 2, 18, 120, 3, 2, 2, 2, 20, + 132, 3, 2, 2, 2, 22, 134, 3, 2, 2, 2, 24, 138, 3, 2, 2, 2, 26, 151, 3, + 2, 2, 2, 28, 155, 3, 2, 2, 2, 30, 157, 3, 2, 2, 2, 32, 171, 3, 2, 2, 2, + 34, 178, 3, 2, 2, 2, 36, 192, 3, 2, 2, 2, 38, 202, 3, 2, 2, 2, 40, 204, + 3, 2, 2, 2, 42, 211, 3, 2, 2, 2, 44, 223, 3, 2, 2, 2, 46, 225, 3, 2, 2, + 2, 48, 229, 3, 2, 2, 2, 50, 237, 3, 2, 2, 2, 52, 242, 3, 2, 2, 2, 54, 246, + 3, 2, 2, 2, 56, 255, 3, 2, 2, 2, 58, 268, 3, 2, 2, 2, 60, 276, 3, 2, 2, + 2, 62, 291, 3, 2, 2, 2, 64, 294, 3, 2, 2, 2, 66, 303, 3, 2, 2, 2, 68, 309, + 3, 2, 2, 2, 70, 316, 3, 2, 2, 2, 72, 324, 3, 2, 2, 2, 74, 348, 3, 2, 2, + 2, 76, 351, 3, 2, 2, 2, 78, 80, 5, 4, 3, 2, 79, 78, 3, 2, 2, 2, 80, 83, + 3, 2, 2, 2, 81, 79, 3, 2, 2, 2, 81, 82, 3, 2, 2, 2, 82, 3, 3, 2, 2, 2, + 83, 81, 3, 2, 2, 2, 84, 90, 5, 6, 4, 2, 85, 90, 5, 8, 5, 2, 86, 90, 5, + 18, 10, 2, 87, 90, 5, 20, 11, 2, 88, 90, 5, 52, 27, 2, 89, 84, 3, 2, 2, + 2, 89, 85, 3, 2, 2, 2, 89, 86, 3, 2, 2, 2, 89, 87, 3, 2, 2, 2, 89, 88, + 3, 2, 2, 2, 90, 5, 3, 2, 2, 2, 91, 92, 8, 4, 1, 2, 92, 93, 7, 26, 2, 2, + 93, 94, 7, 3, 2, 2, 94, 95, 8, 4, 1, 2, 95, 96, 7, 23, 2, 2, 96, 7, 3, + 2, 2, 2, 97, 100, 5, 10, 6, 2, 98, 100, 5, 12, 7, 2, 99, 97, 3, 2, 2, 2, + 99, 98, 3, 2, 2, 2, 100, 9, 3, 2, 2, 2, 101, 102, 8, 6, 1, 2, 102, 103, + 7, 26, 2, 2, 103, 104, 5, 16, 9, 2, 104, 11, 3, 2, 2, 2, 105, 106, 8, 7, + 1, 2, 106, 107, 7, 26, 2, 2, 107, 109, 7, 4, 2, 2, 108, 110, 5, 14, 8, + 2, 109, 108, 3, 2, 2, 2, 110, 111, 3, 2, 2, 2, 111, 109, 3, 2, 2, 2, 111, + 112, 3, 2, 2, 2, 112, 113, 3, 2, 2, 2, 113, 114, 7, 5, 2, 2, 114, 13, 3, + 2, 2, 2, 115, 116, 5, 16, 9, 2, 116, 15, 3, 2, 2, 2, 117, 118, 8, 9, 1, + 2, 118, 119, 7, 23, 2, 2, 119, 17, 3, 2, 2, 2, 120, 121, 8, 10, 1, 2, 121, + 122, 7, 26, 2, 2, 122, 124, 7, 4, 2, 2, 123, 125, 5, 70, 36, 2, 124, 123, + 3, 2, 2, 2, 125, 126, 3, 2, 2, 2, 126, 124, 3, 2, 2, 2, 126, 127, 3, 2, + 2, 2, 127, 128, 3, 2, 2, 2, 128, 129, 7, 5, 2, 2, 129, 19, 3, 2, 2, 2, + 130, 133, 5, 22, 12, 2, 131, 133, 5, 24, 13, 2, 132, 130, 3, 2, 2, 2, 132, + 131, 3, 2, 2, 2, 133, 21, 3, 2, 2, 2, 134, 135, 8, 12, 1, 2, 135, 136, + 7, 26, 2, 2, 136, 137, 5, 26, 14, 2, 137, 23, 3, 2, 2, 2, 138, 139, 8, + 13, 1, 2, 139, 140, 7, 26, 2, 2, 140, 144, 7, 4, 2, 2, 141, 143, 5, 28, + 15, 2, 142, 141, 3, 2, 2, 2, 143, 146, 3, 2, 2, 2, 144, 142, 3, 2, 2, 2, + 144, 145, 3, 2, 2, 2, 145, 147, 3, 2, 2, 2, 146, 144, 3, 2, 2, 2, 147, + 148, 7, 5, 2, 2, 148, 25, 3, 2, 2, 2, 149, 152, 5, 30, 16, 2, 150, 152, + 5, 32, 17, 2, 151, 149, 3, 2, 2, 2, 151, 150, 3, 2, 2, 2, 152, 27, 3, 2, + 2, 2, 153, 156, 5, 34, 18, 2, 154, 156, 5, 36, 19, 2, 155, 153, 3, 2, 2, + 2, 155, 154, 3, 2, 2, 2, 156, 29, 3, 2, 2, 2, 157, 158, 8, 16, 1, 2, 158, + 160, 7, 26, 2, 2, 159, 161, 7, 26, 2, 2, 160, 159, 3, 2, 2, 2, 160, 161, + 3, 2, 2, 2, 161, 162, 3, 2, 2, 2, 162, 166, 7, 6, 2, 2, 163, 165, 5, 38, + 20, 2, 164, 163, 3, 2, 2, 2, 165, 168, 3, 2, 2, 2, 166, 164, 3, 2, 2, 2, + 166, 167, 3, 2, 2, 2, 167, 169, 3, 2, 2, 2, 168, 166, 3, 2, 2, 2, 169, + 170, 7, 7, 2, 2, 170, 31, 3, 2, 2, 2, 171, 172, 8, 17, 1, 2, 172, 174, + 7, 26, 2, 2, 173, 175, 7, 3, 2, 2, 174, 173, 3, 2, 2, 2, 174, 175, 3, 2, + 2, 2, 175, 176, 3, 2, 2, 2, 176, 177, 5, 44, 23, 2, 177, 33, 3, 2, 2, 2, + 178, 179, 8, 18, 1, 2, 179, 181, 7, 26, 2, 2, 180, 182, 7, 26, 2, 2, 181, + 180, 3, 2, 2, 2, 181, 182, 3, 2, 2, 2, 182, 183, 3, 2, 2, 2, 183, 187, + 7, 6, 2, 2, 184, 186, 5, 38, 20, 2, 185, 184, 3, 2, 2, 2, 186, 189, 3, + 2, 2, 2, 187, 185, 3, 2, 2, 2, 187, 188, 3, 2, 2, 2, 188, 190, 3, 2, 2, + 2, 189, 187, 3, 2, 2, 2, 190, 191, 7, 7, 2, 2, 191, 35, 3, 2, 2, 2, 192, + 193, 8, 19, 1, 2, 193, 195, 7, 26, 2, 2, 194, 196, 7, 3, 2, 2, 195, 194, + 3, 2, 2, 2, 195, 196, 3, 2, 2, 2, 196, 197, 3, 2, 2, 2, 197, 198, 5, 44, + 23, 2, 198, 37, 3, 2, 2, 2, 199, 200, 6, 20, 2, 2, 200, 203, 5, 40, 21, + 2, 201, 203, 5, 42, 22, 2, 202, 199, 3, 2, 2, 2, 202, 201, 3, 2, 2, 2, + 203, 39, 3, 2, 2, 2, 204, 205, 8, 21, 1, 2, 205, 206, 7, 26, 2, 2, 206, + 208, 5, 44, 23, 2, 207, 209, 7, 24, 2, 2, 208, 207, 3, 2, 2, 2, 208, 209, + 3, 2, 2, 2, 209, 41, 3, 2, 2, 2, 210, 212, 7, 8, 2, 2, 211, 210, 3, 2, + 2, 2, 211, 212, 3, 2, 2, 2, 212, 213, 3, 2, 2, 2, 213, 214, 7, 26, 2, 2, + 214, 43, 3, 2, 2, 2, 215, 216, 8, 23, 1, 2, 216, 224, 7, 26, 2, 2, 217, + 224, 5, 48, 25, 2, 218, 224, 5, 50, 26, 2, 219, 224, 7, 18, 2, 2, 220, + 224, 7, 9, 2, 2, 221, 224, 5, 46, 24, 2, 222, 224, 5, 30, 16, 2, 223, 215, + 3, 2, 2, 2, 223, 217, 3, 2, 2, 2, 223, 218, 3, 2, 2, 2, 223, 219, 3, 2, + 2, 2, 223, 220, 3, 2, 2, 2, 223, 221, 3, 2, 2, 2, 223, 222, 3, 2, 2, 2, + 224, 45, 3, 2, 2, 2, 225, 226, 7, 8, 2, 2, 226, 227, 8, 24, 1, 2, 227, + 228, 7, 26, 2, 2, 228, 47, 3, 2, 2, 2, 229, 230, 8, 25, 1, 2, 230, 231, + 7, 26, 2, 2, 231, 232, 7, 10, 2, 2, 232, 233, 8, 25, 1, 2, 233, 234, 7, + 26, 2, 2, 234, 235, 7, 11, 2, 2, 235, 236, 5, 44, 23, 2, 236, 49, 3, 2, + 2, 2, 237, 238, 7, 10, 2, 2, 238, 239, 7, 11, 2, 2, 239, 240, 5, 44, 23, + 2, 240, 51, 3, 2, 2, 2, 241, 243, 5, 54, 28, 2, 242, 241, 3, 2, 2, 2, 242, + 243, 3, 2, 2, 2, 243, 244, 3, 2, 2, 2, 244, 245, 5, 56, 29, 2, 245, 53, + 3, 2, 2, 2, 246, 247, 7, 19, 2, 2, 247, 249, 7, 4, 2, 2, 248, 250, 5, 70, + 36, 2, 249, 248, 3, 2, 2, 2, 250, 251, 3, 2, 2, 2, 251, 249, 3, 2, 2, 2, + 251, 252, 3, 2, 2, 2, 252, 253, 3, 2, 2, 2, 253, 254, 7, 5, 2, 2, 254, + 55, 3, 2, 2, 2, 255, 256, 8, 29, 1, 2, 256, 257, 7, 26, 2, 2, 257, 258, + 5, 72, 37, 2, 258, 262, 7, 6, 2, 2, 259, 261, 5, 58, 30, 2, 260, 259, 3, + 2, 2, 2, 261, 264, 3, 2, 2, 2, 262, 260, 3, 2, 2, 2, 262, 263, 3, 2, 2, + 2, 263, 265, 3, 2, 2, 2, 264, 262, 3, 2, 2, 2, 265, 266, 7, 7, 2, 2, 266, + 57, 3, 2, 2, 2, 267, 269, 5, 60, 31, 2, 268, 267, 3, 2, 2, 2, 268, 269, + 3, 2, 2, 2, 269, 272, 3, 2, 2, 2, 270, 273, 5, 54, 28, 2, 271, 273, 5, + 62, 32, 2, 272, 270, 3, 2, 2, 2, 272, 271, 3, 2, 2, 2, 273, 274, 3, 2, + 2, 2, 274, 275, 5, 64, 33, 2, 275, 59, 3, 2, 2, 2, 276, 278, 7, 16, 2, + 2, 277, 279, 7, 4, 2, 2, 278, 277, 3, 2, 2, 2, 278, 279, 3, 2, 2, 2, 279, + 286, 3, 2, 2, 2, 280, 282, 5, 70, 36, 2, 281, 280, 3, 2, 2, 2, 282, 283, + 3, 2, 2, 2, 283, 281, 3, 2, 2, 2, 283, 284, 3, 2, 2, 2, 284, 287, 3, 2, + 2, 2, 285, 287, 7, 23, 2, 2, 286, 281, 3, 2, 2, 2, 286, 285, 3, 2, 2, 2, + 287, 289, 3, 2, 2, 2, 288, 290, 7, 5, 2, 2, 289, 288, 3, 2, 2, 2, 289, + 290, 3, 2, 2, 2, 290, 61, 3, 2, 2, 2, 291, 292, 7, 17, 2, 2, 292, 293, + 7, 26, 2, 2, 293, 63, 3, 2, 2, 2, 294, 295, 8, 33, 1, 2, 295, 296, 7, 26, + 2, 2, 296, 298, 5, 74, 38, 2, 297, 299, 5, 66, 34, 2, 298, 297, 3, 2, 2, + 2, 298, 299, 3, 2, 2, 2, 299, 301, 3, 2, 2, 2, 300, 302, 5, 68, 35, 2, + 301, 300, 3, 2, 2, 2, 301, 302, 3, 2, 2, 2, 302, 65, 3, 2, 2, 2, 303, 305, + 7, 4, 2, 2, 304, 306, 7, 26, 2, 2, 305, 304, 3, 2, 2, 2, 305, 306, 3, 2, + 2, 2, 306, 307, 3, 2, 2, 2, 307, 308, 7, 5, 2, 2, 308, 67, 3, 2, 2, 2, + 309, 310, 7, 12, 2, 2, 310, 312, 7, 4, 2, 2, 311, 313, 5, 44, 23, 2, 312, + 311, 3, 2, 2, 2, 312, 313, 3, 2, 2, 2, 313, 314, 3, 2, 2, 2, 314, 315, + 7, 5, 2, 2, 315, 69, 3, 2, 2, 2, 316, 317, 7, 26, 2, 2, 317, 318, 8, 36, + 1, 2, 318, 319, 7, 25, 2, 2, 319, 71, 3, 2, 2, 2, 320, 322, 7, 26, 2, 2, + 321, 323, 7, 13, 2, 2, 322, 321, 3, 2, 2, 2, 322, 323, 3, 2, 2, 2, 323, + 325, 3, 2, 2, 2, 324, 320, 3, 2, 2, 2, 325, 326, 3, 2, 2, 2, 326, 324, + 3, 2, 2, 2, 326, 327, 3, 2, 2, 2, 327, 73, 3, 2, 2, 2, 328, 329, 7, 14, + 2, 2, 329, 334, 5, 76, 39, 2, 330, 331, 7, 13, 2, 2, 331, 333, 5, 76, 39, + 2, 332, 330, 3, 2, 2, 2, 333, 336, 3, 2, 2, 2, 334, 332, 3, 2, 2, 2, 334, + 335, 3, 2, 2, 2, 335, 344, 3, 2, 2, 2, 336, 334, 3, 2, 2, 2, 337, 338, + 7, 15, 2, 2, 338, 341, 5, 76, 39, 2, 339, 340, 7, 13, 2, 2, 340, 342, 5, + 76, 39, 2, 341, 339, 3, 2, 2, 2, 341, 342, 3, 2, 2, 2, 342, 344, 3, 2, + 2, 2, 343, 328, 3, 2, 2, 2, 343, 337, 3, 2, 2, 2, 344, 345, 3, 2, 2, 2, + 345, 343, 3, 2, 2, 2, 345, 346, 3, 2, 2, 2, 346, 349, 3, 2, 2, 2, 347, + 349, 7, 14, 2, 2, 348, 343, 3, 2, 2, 2, 348, 347, 3, 2, 2, 2, 349, 75, + 3, 2, 2, 2, 350, 352, 9, 2, 2, 2, 351, 350, 3, 2, 2, 2, 352, 353, 3, 2, + 2, 2, 353, 351, 3, 2, 2, 2, 353, 354, 3, 2, 2, 2, 354, 77, 3, 2, 2, 2, + 42, 81, 89, 99, 111, 126, 132, 144, 151, 155, 160, 166, 174, 181, 187, + 195, 202, 208, 211, 223, 242, 251, 262, 268, 272, 278, 283, 286, 289, 298, + 301, 305, 312, 322, 326, 334, 341, 343, 345, 348, 353, } - var literalNames = []string{ "", "'='", "'('", "')'", "'{'", "'}'", "'*'", "'time.Time'", "'['", "']'", "'returns'", "'-'", "'/'", "'/:'", "'@doc'", "'@handler'", "'interface{}'", "'@server'", } - var symbolicNames = []string{ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "ATDOC", "ATHANDLER", "INTERFACE", "ATSERVER", "WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING", - "LINE_VALUE", "ID", + "LINE_VALUE", "ID", "LetterOrDigit", } var ruleNames = []string{ @@ -189,6 +187,7 @@ var ruleNames = []string{ "field", "normalField", "anonymousFiled", "dataType", "pointerType", "mapType", "arrayType", "serviceSpec", "atServer", "serviceApi", "serviceRoute", "atDoc", "atHandler", "route", "body", "replybody", "kvLit", "serviceName", "path", + "pathItem", } type ApiParserParser struct { @@ -222,31 +221,32 @@ func NewApiParserParser(input antlr.TokenStream) *ApiParserParser { // ApiParserParser tokens. const ( - ApiParserParserEOF = antlr.TokenEOF - ApiParserParserT__0 = 1 - ApiParserParserT__1 = 2 - ApiParserParserT__2 = 3 - ApiParserParserT__3 = 4 - ApiParserParserT__4 = 5 - ApiParserParserT__5 = 6 - ApiParserParserT__6 = 7 - ApiParserParserT__7 = 8 - ApiParserParserT__8 = 9 - ApiParserParserT__9 = 10 - ApiParserParserT__10 = 11 - ApiParserParserT__11 = 12 - ApiParserParserT__12 = 13 - ApiParserParserATDOC = 14 - ApiParserParserATHANDLER = 15 - ApiParserParserINTERFACE = 16 - ApiParserParserATSERVER = 17 - ApiParserParserWS = 18 - ApiParserParserCOMMENT = 19 - ApiParserParserLINE_COMMENT = 20 - ApiParserParserSTRING = 21 - ApiParserParserRAW_STRING = 22 - ApiParserParserLINE_VALUE = 23 - ApiParserParserID = 24 + ApiParserParserEOF = antlr.TokenEOF + ApiParserParserT__0 = 1 + ApiParserParserT__1 = 2 + ApiParserParserT__2 = 3 + ApiParserParserT__3 = 4 + ApiParserParserT__4 = 5 + ApiParserParserT__5 = 6 + ApiParserParserT__6 = 7 + ApiParserParserT__7 = 8 + ApiParserParserT__8 = 9 + ApiParserParserT__9 = 10 + ApiParserParserT__10 = 11 + ApiParserParserT__11 = 12 + ApiParserParserT__12 = 13 + ApiParserParserATDOC = 14 + ApiParserParserATHANDLER = 15 + ApiParserParserINTERFACE = 16 + ApiParserParserATSERVER = 17 + ApiParserParserWS = 18 + ApiParserParserCOMMENT = 19 + ApiParserParserLINE_COMMENT = 20 + ApiParserParserSTRING = 21 + ApiParserParserRAW_STRING = 22 + ApiParserParserLINE_VALUE = 23 + ApiParserParserID = 24 + ApiParserParserLetterOrDigit = 25 ) // ApiParserParser rules. @@ -288,6 +288,7 @@ const ( ApiParserParserRULE_kvLit = 34 ApiParserParserRULE_serviceName = 35 ApiParserParserRULE_path = 36 + ApiParserParserRULE_pathItem = 37 ) // IApiContext is an interface to support dynamic dispatch. @@ -307,7 +308,7 @@ type ApiContext struct { } func NewEmptyApiContext() *ApiContext { - p := new(ApiContext) + var p = new(ApiContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_api return p @@ -316,7 +317,7 @@ func NewEmptyApiContext() *ApiContext { func (*ApiContext) IsApiContext() {} func NewApiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ApiContext { - p := new(ApiContext) + var p = new(ApiContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -329,8 +330,8 @@ func NewApiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invoking func (s *ApiContext) GetParser() antlr.Parser { return s.parser } func (s *ApiContext) AllSpec() []ISpecContext { - ts := s.GetTypedRuleContexts(reflect.TypeOf((*ISpecContext)(nil)).Elem()) - tst := make([]ISpecContext, len(ts)) + var ts = s.GetTypedRuleContexts(reflect.TypeOf((*ISpecContext)(nil)).Elem()) + var tst = make([]ISpecContext, len(ts)) for i, t := range ts { if t != nil { @@ -342,7 +343,7 @@ func (s *ApiContext) AllSpec() []ISpecContext { } func (s *ApiContext) Spec(i int) ISpecContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*ISpecContext)(nil)).Elem(), i) + var t = s.GetTypedRuleContext(reflect.TypeOf((*ISpecContext)(nil)).Elem(), i) if t == nil { return nil @@ -391,17 +392,17 @@ func (p *ApiParserParser) Api() (localctx IApiContext) { }() p.EnterOuterAlt(localctx, 1) - p.SetState(77) + p.SetState(79) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) for _la == ApiParserParserATSERVER || _la == ApiParserParserID { { - p.SetState(74) + p.SetState(76) p.Spec() } - p.SetState(79) + p.SetState(81) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) } @@ -426,7 +427,7 @@ type SpecContext struct { } func NewEmptySpecContext() *SpecContext { - p := new(SpecContext) + var p = new(SpecContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_spec return p @@ -435,7 +436,7 @@ func NewEmptySpecContext() *SpecContext { func (*SpecContext) IsSpecContext() {} func NewSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SpecContext { - p := new(SpecContext) + var p = new(SpecContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -448,7 +449,7 @@ func NewSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokin func (s *SpecContext) GetParser() antlr.Parser { return s.parser } func (s *SpecContext) SyntaxLit() ISyntaxLitContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*ISyntaxLitContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*ISyntaxLitContext)(nil)).Elem(), 0) if t == nil { return nil @@ -458,7 +459,7 @@ func (s *SpecContext) SyntaxLit() ISyntaxLitContext { } func (s *SpecContext) ImportSpec() IImportSpecContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IImportSpecContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportSpecContext)(nil)).Elem(), 0) if t == nil { return nil @@ -468,7 +469,7 @@ func (s *SpecContext) ImportSpec() IImportSpecContext { } func (s *SpecContext) InfoSpec() IInfoSpecContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IInfoSpecContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IInfoSpecContext)(nil)).Elem(), 0) if t == nil { return nil @@ -478,7 +479,7 @@ func (s *SpecContext) InfoSpec() IInfoSpecContext { } func (s *SpecContext) TypeSpec() ITypeSpecContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeSpecContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeSpecContext)(nil)).Elem(), 0) if t == nil { return nil @@ -488,7 +489,7 @@ func (s *SpecContext) TypeSpec() ITypeSpecContext { } func (s *SpecContext) ServiceSpec() IServiceSpecContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IServiceSpecContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceSpecContext)(nil)).Elem(), 0) if t == nil { return nil @@ -535,41 +536,41 @@ func (p *ApiParserParser) Spec() (localctx ISpecContext) { } }() - p.SetState(85) + p.SetState(87) p.GetErrorHandler().Sync(p) switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 1, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(80) + p.SetState(82) p.SyntaxLit() } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(81) + p.SetState(83) p.ImportSpec() } case 3: p.EnterOuterAlt(localctx, 3) { - p.SetState(82) + p.SetState(84) p.InfoSpec() } case 4: p.EnterOuterAlt(localctx, 4) { - p.SetState(83) + p.SetState(85) p.TypeSpec() } case 5: p.EnterOuterAlt(localctx, 5) { - p.SetState(84) + p.SetState(86) p.ServiceSpec() } @@ -616,7 +617,7 @@ type SyntaxLitContext struct { } func NewEmptySyntaxLitContext() *SyntaxLitContext { - p := new(SyntaxLitContext) + var p = new(SyntaxLitContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_syntaxLit return p @@ -625,7 +626,7 @@ func NewEmptySyntaxLitContext() *SyntaxLitContext { func (*SyntaxLitContext) IsSyntaxLitContext() {} func NewSyntaxLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SyntaxLitContext { - p := new(SyntaxLitContext) + var p = new(SyntaxLitContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -634,3 +635,21 @@ func NewSyntaxLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, in return p } + +func (s *SyntaxLitContext) GetParser() antlr.Parser { return s.parser } + +func (s *SyntaxLitContext) GetSyntaxToken() antlr.Token { return s.syntaxToken } + +func (s *SyntaxLitContext) GetAssign() antlr.Token { return s.assign } + +func (s *SyntaxLitContext) GetVersion() antlr.Token { return s.version } + +func (s *SyntaxLitContext) SetSyntaxToken(v antlr.Token) { s.syntaxToken = v } + +func (s *SyntaxLitContext) SetAssign(v antlr.Token) { s.assign = v } + +func (s *SyntaxLitContext) SetVersion(v antlr.Token) { s.version = v } + +func (s *SyntaxLitContext) ID() antlr.TerminalNode { + return s.GetToken(ApiParserParserID, 0) +} diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_parser1.go b/tools/goctl/api/parser/g4/gen/api/apiparser_parser1.go index 1e82ac8c8cbe..3f2c17e01dd0 100755 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser1.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser1.go @@ -10,24 +10,6 @@ import ( // The apiparser_parser.go file was split into multiple files because it // was too large and caused a possible memory overflow during goctl installation. -func (s *SyntaxLitContext) GetParser() antlr.Parser { return s.parser } - -func (s *SyntaxLitContext) GetSyntaxToken() antlr.Token { return s.syntaxToken } - -func (s *SyntaxLitContext) GetAssign() antlr.Token { return s.assign } - -func (s *SyntaxLitContext) GetVersion() antlr.Token { return s.version } - -func (s *SyntaxLitContext) SetSyntaxToken(v antlr.Token) { s.syntaxToken = v } - -func (s *SyntaxLitContext) SetAssign(v antlr.Token) { s.assign = v } - -func (s *SyntaxLitContext) SetVersion(v antlr.Token) { s.version = v } - -func (s *SyntaxLitContext) ID() antlr.TerminalNode { - return s.GetToken(ApiParserParserID, 0) -} - func (s *SyntaxLitContext) STRING() antlr.TerminalNode { return s.GetToken(ApiParserParserSTRING, 0) } @@ -73,24 +55,24 @@ func (p *ApiParserParser) SyntaxLit() (localctx ISyntaxLitContext) { p.EnterOuterAlt(localctx, 1) match(p, "syntax") { - p.SetState(88) + p.SetState(90) - _m := p.Match(ApiParserParserID) + var _m = p.Match(ApiParserParserID) localctx.(*SyntaxLitContext).syntaxToken = _m } { - p.SetState(89) + p.SetState(91) - _m := p.Match(ApiParserParserT__0) + var _m = p.Match(ApiParserParserT__0) localctx.(*SyntaxLitContext).assign = _m } checkVersion(p) { - p.SetState(91) + p.SetState(93) - _m := p.Match(ApiParserParserSTRING) + var _m = p.Match(ApiParserParserSTRING) localctx.(*SyntaxLitContext).version = _m } @@ -115,7 +97,7 @@ type ImportSpecContext struct { } func NewEmptyImportSpecContext() *ImportSpecContext { - p := new(ImportSpecContext) + var p = new(ImportSpecContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_importSpec return p @@ -124,7 +106,7 @@ func NewEmptyImportSpecContext() *ImportSpecContext { func (*ImportSpecContext) IsImportSpecContext() {} func NewImportSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportSpecContext { - p := new(ImportSpecContext) + var p = new(ImportSpecContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -137,7 +119,7 @@ func NewImportSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, i func (s *ImportSpecContext) GetParser() antlr.Parser { return s.parser } func (s *ImportSpecContext) ImportLit() IImportLitContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IImportLitContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportLitContext)(nil)).Elem(), 0) if t == nil { return nil @@ -147,7 +129,7 @@ func (s *ImportSpecContext) ImportLit() IImportLitContext { } func (s *ImportSpecContext) ImportBlock() IImportBlockContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IImportBlockContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportBlockContext)(nil)).Elem(), 0) if t == nil { return nil @@ -194,20 +176,20 @@ func (p *ApiParserParser) ImportSpec() (localctx IImportSpecContext) { } }() - p.SetState(95) + p.SetState(97) p.GetErrorHandler().Sync(p) switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 2, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(93) + p.SetState(95) p.ImportLit() } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(94) + p.SetState(96) p.ImportBlock() } @@ -240,7 +222,7 @@ type ImportLitContext struct { } func NewEmptyImportLitContext() *ImportLitContext { - p := new(ImportLitContext) + var p = new(ImportLitContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_importLit return p @@ -249,7 +231,7 @@ func NewEmptyImportLitContext() *ImportLitContext { func (*ImportLitContext) IsImportLitContext() {} func NewImportLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportLitContext { - p := new(ImportLitContext) + var p = new(ImportLitContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -266,7 +248,7 @@ func (s *ImportLitContext) GetImportToken() antlr.Token { return s.importToken } func (s *ImportLitContext) SetImportToken(v antlr.Token) { s.importToken = v } func (s *ImportLitContext) ImportValue() IImportValueContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IImportValueContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportValueContext)(nil)).Elem(), 0) if t == nil { return nil @@ -320,14 +302,14 @@ func (p *ApiParserParser) ImportLit() (localctx IImportLitContext) { p.EnterOuterAlt(localctx, 1) match(p, "import") { - p.SetState(98) + p.SetState(100) - _m := p.Match(ApiParserParserID) + var _m = p.Match(ApiParserParserID) localctx.(*ImportLitContext).importToken = _m } { - p.SetState(99) + p.SetState(101) p.ImportValue() } @@ -358,7 +340,7 @@ type ImportBlockContext struct { } func NewEmptyImportBlockContext() *ImportBlockContext { - p := new(ImportBlockContext) + var p = new(ImportBlockContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_importBlock return p @@ -367,7 +349,7 @@ func NewEmptyImportBlockContext() *ImportBlockContext { func (*ImportBlockContext) IsImportBlockContext() {} func NewImportBlockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportBlockContext { - p := new(ImportBlockContext) + var p = new(ImportBlockContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -388,8 +370,8 @@ func (s *ImportBlockContext) ID() antlr.TerminalNode { } func (s *ImportBlockContext) AllImportBlockValue() []IImportBlockValueContext { - ts := s.GetTypedRuleContexts(reflect.TypeOf((*IImportBlockValueContext)(nil)).Elem()) - tst := make([]IImportBlockValueContext, len(ts)) + var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IImportBlockValueContext)(nil)).Elem()) + var tst = make([]IImportBlockValueContext, len(ts)) for i, t := range ts { if t != nil { @@ -401,7 +383,7 @@ func (s *ImportBlockContext) AllImportBlockValue() []IImportBlockValueContext { } func (s *ImportBlockContext) ImportBlockValue(i int) IImportBlockValueContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IImportBlockValueContext)(nil)).Elem(), i) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportBlockValueContext)(nil)).Elem(), i) if t == nil { return nil @@ -452,31 +434,32 @@ func (p *ApiParserParser) ImportBlock() (localctx IImportBlockContext) { p.EnterOuterAlt(localctx, 1) match(p, "import") { - p.SetState(102) + p.SetState(104) - _m := p.Match(ApiParserParserID) + var _m = p.Match(ApiParserParserID) localctx.(*ImportBlockContext).importToken = _m } { - p.SetState(103) + p.SetState(105) p.Match(ApiParserParserT__1) } - p.SetState(105) + p.SetState(107) p.GetErrorHandler().Sync(p) + _la = p.GetTokenStream().LA(1) for ok := true; ok; ok = _la == ApiParserParserSTRING { { - p.SetState(104) + p.SetState(106) p.ImportBlockValue() } - p.SetState(107) + p.SetState(109) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) } { - p.SetState(109) + p.SetState(111) p.Match(ApiParserParserT__2) } @@ -500,7 +483,7 @@ type ImportBlockValueContext struct { } func NewEmptyImportBlockValueContext() *ImportBlockValueContext { - p := new(ImportBlockValueContext) + var p = new(ImportBlockValueContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_importBlockValue return p @@ -509,7 +492,7 @@ func NewEmptyImportBlockValueContext() *ImportBlockValueContext { func (*ImportBlockValueContext) IsImportBlockValueContext() {} func NewImportBlockValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportBlockValueContext { - p := new(ImportBlockValueContext) + var p = new(ImportBlockValueContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -522,7 +505,7 @@ func NewImportBlockValueContext(parser antlr.Parser, parent antlr.ParserRuleCont func (s *ImportBlockValueContext) GetParser() antlr.Parser { return s.parser } func (s *ImportBlockValueContext) ImportValue() IImportValueContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IImportValueContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportValueContext)(nil)).Elem(), 0) if t == nil { return nil @@ -571,7 +554,7 @@ func (p *ApiParserParser) ImportBlockValue() (localctx IImportBlockValueContext) p.EnterOuterAlt(localctx, 1) { - p.SetState(111) + p.SetState(113) p.ImportValue() } @@ -595,7 +578,7 @@ type ImportValueContext struct { } func NewEmptyImportValueContext() *ImportValueContext { - p := new(ImportValueContext) + var p = new(ImportValueContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_importValue return p @@ -604,7 +587,7 @@ func NewEmptyImportValueContext() *ImportValueContext { func (*ImportValueContext) IsImportValueContext() {} func NewImportValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportValueContext { - p := new(ImportValueContext) + var p = new(ImportValueContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -613,3 +596,86 @@ func NewImportValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, return p } + +func (s *ImportValueContext) GetParser() antlr.Parser { return s.parser } + +func (s *ImportValueContext) STRING() antlr.TerminalNode { + return s.GetToken(ApiParserParserSTRING, 0) +} + +func (s *ImportValueContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ImportValueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ImportValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ApiParserVisitor: + return t.VisitImportValue(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ApiParserParser) ImportValue() (localctx IImportValueContext) { + localctx = NewImportValueContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 14, ApiParserParserRULE_importValue) + + defer func() { + p.ExitRule() + }() + + defer func() { + if err := recover(); err != nil { + if v, ok := err.(antlr.RecognitionException); ok { + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + } else { + panic(err) + } + } + }() + + p.EnterOuterAlt(localctx, 1) + checkImportValue(p) + { + p.SetState(116) + p.Match(ApiParserParserSTRING) + } + + return localctx +} + +// IInfoSpecContext is an interface to support dynamic dispatch. +type IInfoSpecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // GetInfoToken returns the infoToken token. + GetInfoToken() antlr.Token + + // GetLp returns the lp token. + GetLp() antlr.Token + + // GetRp returns the rp token. + GetRp() antlr.Token + + // SetInfoToken sets the infoToken token. + SetInfoToken(antlr.Token) + + // SetLp sets the lp token. + SetLp(antlr.Token) + + // SetRp sets the rp token. + SetRp(antlr.Token) + + // IsInfoSpecContext differentiates from other interfaces. + IsInfoSpecContext() +} diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_parser2.go b/tools/goctl/api/parser/g4/gen/api/apiparser_parser2.go index d2d49a8ef7c8..395d414184b0 100755 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser2.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser2.go @@ -10,89 +10,6 @@ import ( // The apiparser_parser.go file was split into multiple files because it // was too large and caused a possible memory overflow during goctl installation. -func (s *ImportValueContext) GetParser() antlr.Parser { return s.parser } - -func (s *ImportValueContext) STRING() antlr.TerminalNode { - return s.GetToken(ApiParserParserSTRING, 0) -} - -func (s *ImportValueContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *ImportValueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *ImportValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { - switch t := visitor.(type) { - case ApiParserVisitor: - return t.VisitImportValue(s) - - default: - return t.VisitChildren(s) - } -} - -func (p *ApiParserParser) ImportValue() (localctx IImportValueContext) { - localctx = NewImportValueContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 14, ApiParserParserRULE_importValue) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - checkImportValue(p) - { - p.SetState(114) - p.Match(ApiParserParserSTRING) - } - - return localctx -} - -// IInfoSpecContext is an interface to support dynamic dispatch. -type IInfoSpecContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // GetInfoToken returns the infoToken token. - GetInfoToken() antlr.Token - - // GetLp returns the lp token. - GetLp() antlr.Token - - // GetRp returns the rp token. - GetRp() antlr.Token - - // SetInfoToken sets the infoToken token. - SetInfoToken(antlr.Token) - - // SetLp sets the lp token. - SetLp(antlr.Token) - - // SetRp sets the rp token. - SetRp(antlr.Token) - - // IsInfoSpecContext differentiates from other interfaces. - IsInfoSpecContext() -} - type InfoSpecContext struct { *antlr.BaseParserRuleContext parser antlr.Parser @@ -102,7 +19,7 @@ type InfoSpecContext struct { } func NewEmptyInfoSpecContext() *InfoSpecContext { - p := new(InfoSpecContext) + var p = new(InfoSpecContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_infoSpec return p @@ -111,7 +28,7 @@ func NewEmptyInfoSpecContext() *InfoSpecContext { func (*InfoSpecContext) IsInfoSpecContext() {} func NewInfoSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *InfoSpecContext { - p := new(InfoSpecContext) + var p = new(InfoSpecContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -140,8 +57,8 @@ func (s *InfoSpecContext) ID() antlr.TerminalNode { } func (s *InfoSpecContext) AllKvLit() []IKvLitContext { - ts := s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem()) - tst := make([]IKvLitContext, len(ts)) + var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem()) + var tst = make([]IKvLitContext, len(ts)) for i, t := range ts { if t != nil { @@ -153,7 +70,7 @@ func (s *InfoSpecContext) AllKvLit() []IKvLitContext { } func (s *InfoSpecContext) KvLit(i int) IKvLitContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i) if t == nil { return nil @@ -204,36 +121,37 @@ func (p *ApiParserParser) InfoSpec() (localctx IInfoSpecContext) { p.EnterOuterAlt(localctx, 1) match(p, "info") { - p.SetState(117) + p.SetState(119) - _m := p.Match(ApiParserParserID) + var _m = p.Match(ApiParserParserID) localctx.(*InfoSpecContext).infoToken = _m } { - p.SetState(118) + p.SetState(120) - _m := p.Match(ApiParserParserT__1) + var _m = p.Match(ApiParserParserT__1) localctx.(*InfoSpecContext).lp = _m } - p.SetState(120) + p.SetState(122) p.GetErrorHandler().Sync(p) + _la = p.GetTokenStream().LA(1) for ok := true; ok; ok = _la == ApiParserParserID { { - p.SetState(119) + p.SetState(121) p.KvLit() } - p.SetState(122) + p.SetState(124) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) } { - p.SetState(124) + p.SetState(126) - _m := p.Match(ApiParserParserT__2) + var _m = p.Match(ApiParserParserT__2) localctx.(*InfoSpecContext).rp = _m } @@ -258,7 +176,7 @@ type TypeSpecContext struct { } func NewEmptyTypeSpecContext() *TypeSpecContext { - p := new(TypeSpecContext) + var p = new(TypeSpecContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_typeSpec return p @@ -267,7 +185,7 @@ func NewEmptyTypeSpecContext() *TypeSpecContext { func (*TypeSpecContext) IsTypeSpecContext() {} func NewTypeSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeSpecContext { - p := new(TypeSpecContext) + var p = new(TypeSpecContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -280,7 +198,7 @@ func NewTypeSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, inv func (s *TypeSpecContext) GetParser() antlr.Parser { return s.parser } func (s *TypeSpecContext) TypeLit() ITypeLitContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeLitContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeLitContext)(nil)).Elem(), 0) if t == nil { return nil @@ -290,7 +208,7 @@ func (s *TypeSpecContext) TypeLit() ITypeLitContext { } func (s *TypeSpecContext) TypeBlock() ITypeBlockContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockContext)(nil)).Elem(), 0) if t == nil { return nil @@ -337,20 +255,20 @@ func (p *ApiParserParser) TypeSpec() (localctx ITypeSpecContext) { } }() - p.SetState(128) + p.SetState(130) p.GetErrorHandler().Sync(p) switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 5, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(126) + p.SetState(128) p.TypeLit() } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(127) + p.SetState(129) p.TypeBlock() } @@ -383,7 +301,7 @@ type TypeLitContext struct { } func NewEmptyTypeLitContext() *TypeLitContext { - p := new(TypeLitContext) + var p = new(TypeLitContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_typeLit return p @@ -392,7 +310,7 @@ func NewEmptyTypeLitContext() *TypeLitContext { func (*TypeLitContext) IsTypeLitContext() {} func NewTypeLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeLitContext { - p := new(TypeLitContext) + var p = new(TypeLitContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -409,7 +327,7 @@ func (s *TypeLitContext) GetTypeToken() antlr.Token { return s.typeToken } func (s *TypeLitContext) SetTypeToken(v antlr.Token) { s.typeToken = v } func (s *TypeLitContext) TypeLitBody() ITypeLitBodyContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeLitBodyContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeLitBodyContext)(nil)).Elem(), 0) if t == nil { return nil @@ -463,14 +381,14 @@ func (p *ApiParserParser) TypeLit() (localctx ITypeLitContext) { p.EnterOuterAlt(localctx, 1) match(p, "type") { - p.SetState(131) + p.SetState(133) - _m := p.Match(ApiParserParserID) + var _m = p.Match(ApiParserParserID) localctx.(*TypeLitContext).typeToken = _m } { - p.SetState(132) + p.SetState(134) p.TypeLitBody() } @@ -515,7 +433,7 @@ type TypeBlockContext struct { } func NewEmptyTypeBlockContext() *TypeBlockContext { - p := new(TypeBlockContext) + var p = new(TypeBlockContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_typeBlock return p @@ -524,7 +442,7 @@ func NewEmptyTypeBlockContext() *TypeBlockContext { func (*TypeBlockContext) IsTypeBlockContext() {} func NewTypeBlockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockContext { - p := new(TypeBlockContext) + var p = new(TypeBlockContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -553,8 +471,8 @@ func (s *TypeBlockContext) ID() antlr.TerminalNode { } func (s *TypeBlockContext) AllTypeBlockBody() []ITypeBlockBodyContext { - ts := s.GetTypedRuleContexts(reflect.TypeOf((*ITypeBlockBodyContext)(nil)).Elem()) - tst := make([]ITypeBlockBodyContext, len(ts)) + var ts = s.GetTypedRuleContexts(reflect.TypeOf((*ITypeBlockBodyContext)(nil)).Elem()) + var tst = make([]ITypeBlockBodyContext, len(ts)) for i, t := range ts { if t != nil { @@ -566,7 +484,7 @@ func (s *TypeBlockContext) AllTypeBlockBody() []ITypeBlockBodyContext { } func (s *TypeBlockContext) TypeBlockBody(i int) ITypeBlockBodyContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockBodyContext)(nil)).Elem(), i) + var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockBodyContext)(nil)).Elem(), i) if t == nil { return nil @@ -617,40 +535,158 @@ func (p *ApiParserParser) TypeBlock() (localctx ITypeBlockContext) { p.EnterOuterAlt(localctx, 1) match(p, "type") { - p.SetState(135) + p.SetState(137) - _m := p.Match(ApiParserParserID) + var _m = p.Match(ApiParserParserID) localctx.(*TypeBlockContext).typeToken = _m } { - p.SetState(136) + p.SetState(138) - _m := p.Match(ApiParserParserT__1) + var _m = p.Match(ApiParserParserT__1) localctx.(*TypeBlockContext).lp = _m } - p.SetState(140) + p.SetState(142) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) for _la == ApiParserParserID { { - p.SetState(137) + p.SetState(139) p.TypeBlockBody() } - p.SetState(142) + p.SetState(144) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) } { - p.SetState(143) + p.SetState(145) - _m := p.Match(ApiParserParserT__2) + var _m = p.Match(ApiParserParserT__2) localctx.(*TypeBlockContext).rp = _m } return localctx } + +// ITypeLitBodyContext is an interface to support dynamic dispatch. +type ITypeLitBodyContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // IsTypeLitBodyContext differentiates from other interfaces. + IsTypeLitBodyContext() +} + +type TypeLitBodyContext struct { + *antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTypeLitBodyContext() *TypeLitBodyContext { + var p = new(TypeLitBodyContext) + p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + p.RuleIndex = ApiParserParserRULE_typeLitBody + return p +} + +func (*TypeLitBodyContext) IsTypeLitBodyContext() {} + +func NewTypeLitBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeLitBodyContext { + var p = new(TypeLitBodyContext) + + p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + + p.parser = parser + p.RuleIndex = ApiParserParserRULE_typeLitBody + + return p +} + +func (s *TypeLitBodyContext) GetParser() antlr.Parser { return s.parser } + +func (s *TypeLitBodyContext) TypeStruct() ITypeStructContext { + var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeStructContext)(nil)).Elem(), 0) + + if t == nil { + return nil + } + + return t.(ITypeStructContext) +} + +func (s *TypeLitBodyContext) TypeAlias() ITypeAliasContext { + var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeAliasContext)(nil)).Elem(), 0) + + if t == nil { + return nil + } + + return t.(ITypeAliasContext) +} + +func (s *TypeLitBodyContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TypeLitBodyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TypeLitBodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ApiParserVisitor: + return t.VisitTypeLitBody(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ApiParserParser) TypeLitBody() (localctx ITypeLitBodyContext) { + localctx = NewTypeLitBodyContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 24, ApiParserParserRULE_typeLitBody) + + defer func() { + p.ExitRule() + }() + + defer func() { + if err := recover(); err != nil { + if v, ok := err.(antlr.RecognitionException); ok { + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + } else { + panic(err) + } + } + }() + + p.SetState(149) + p.GetErrorHandler().Sync(p) + switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 7, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(147) + p.TypeStruct() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(148) + p.TypeAlias() + } + + } + + return localctx +} diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_parser3.go b/tools/goctl/api/parser/g4/gen/api/apiparser_parser3.go index acde7db53abd..bd9dc8162188 100755 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser3.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser3.go @@ -10,124 +10,6 @@ import ( // The apiparser_parser.go file was split into multiple files because it // was too large and caused a possible memory overflow during goctl installation. -// ITypeLitBodyContext is an interface to support dynamic dispatch. -type ITypeLitBodyContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // IsTypeLitBodyContext differentiates from other interfaces. - IsTypeLitBodyContext() -} - -type TypeLitBodyContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyTypeLitBodyContext() *TypeLitBodyContext { - p := new(TypeLitBodyContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = ApiParserParserRULE_typeLitBody - return p -} - -func (*TypeLitBodyContext) IsTypeLitBodyContext() {} - -func NewTypeLitBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeLitBodyContext { - p := new(TypeLitBodyContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = ApiParserParserRULE_typeLitBody - - return p -} - -func (s *TypeLitBodyContext) GetParser() antlr.Parser { return s.parser } - -func (s *TypeLitBodyContext) TypeStruct() ITypeStructContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeStructContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(ITypeStructContext) -} - -func (s *TypeLitBodyContext) TypeAlias() ITypeAliasContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeAliasContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(ITypeAliasContext) -} - -func (s *TypeLitBodyContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *TypeLitBodyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *TypeLitBodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { - switch t := visitor.(type) { - case ApiParserVisitor: - return t.VisitTypeLitBody(s) - - default: - return t.VisitChildren(s) - } -} - -func (p *ApiParserParser) TypeLitBody() (localctx ITypeLitBodyContext) { - localctx = NewTypeLitBodyContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 24, ApiParserParserRULE_typeLitBody) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(147) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 7, p.GetParserRuleContext()) { - case 1: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(145) - p.TypeStruct() - } - - case 2: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(146) - p.TypeAlias() - } - - } - - return localctx -} - // ITypeBlockBodyContext is an interface to support dynamic dispatch. type ITypeBlockBodyContext interface { antlr.ParserRuleContext @@ -145,7 +27,7 @@ type TypeBlockBodyContext struct { } func NewEmptyTypeBlockBodyContext() *TypeBlockBodyContext { - p := new(TypeBlockBodyContext) + var p = new(TypeBlockBodyContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_typeBlockBody return p @@ -154,7 +36,7 @@ func NewEmptyTypeBlockBodyContext() *TypeBlockBodyContext { func (*TypeBlockBodyContext) IsTypeBlockBodyContext() {} func NewTypeBlockBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockBodyContext { - p := new(TypeBlockBodyContext) + var p = new(TypeBlockBodyContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -167,7 +49,7 @@ func NewTypeBlockBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext func (s *TypeBlockBodyContext) GetParser() antlr.Parser { return s.parser } func (s *TypeBlockBodyContext) TypeBlockStruct() ITypeBlockStructContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockStructContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockStructContext)(nil)).Elem(), 0) if t == nil { return nil @@ -177,7 +59,7 @@ func (s *TypeBlockBodyContext) TypeBlockStruct() ITypeBlockStructContext { } func (s *TypeBlockBodyContext) TypeBlockAlias() ITypeBlockAliasContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockAliasContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockAliasContext)(nil)).Elem(), 0) if t == nil { return nil @@ -224,20 +106,20 @@ func (p *ApiParserParser) TypeBlockBody() (localctx ITypeBlockBodyContext) { } }() - p.SetState(151) + p.SetState(153) p.GetErrorHandler().Sync(p) switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 8, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(149) + p.SetState(151) p.TypeBlockStruct() } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(150) + p.SetState(152) p.TypeBlockAlias() } @@ -291,7 +173,7 @@ type TypeStructContext struct { } func NewEmptyTypeStructContext() *TypeStructContext { - p := new(TypeStructContext) + var p = new(TypeStructContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_typeStruct return p @@ -300,7 +182,7 @@ func NewEmptyTypeStructContext() *TypeStructContext { func (*TypeStructContext) IsTypeStructContext() {} func NewTypeStructContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeStructContext { - p := new(TypeStructContext) + var p = new(TypeStructContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -337,8 +219,8 @@ func (s *TypeStructContext) ID(i int) antlr.TerminalNode { } func (s *TypeStructContext) AllField() []IFieldContext { - ts := s.GetTypedRuleContexts(reflect.TypeOf((*IFieldContext)(nil)).Elem()) - tst := make([]IFieldContext, len(ts)) + var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IFieldContext)(nil)).Elem()) + var tst = make([]IFieldContext, len(ts)) for i, t := range ts { if t != nil { @@ -350,7 +232,7 @@ func (s *TypeStructContext) AllField() []IFieldContext { } func (s *TypeStructContext) Field(i int) IFieldContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IFieldContext)(nil)).Elem(), i) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IFieldContext)(nil)).Elem(), i) if t == nil { return nil @@ -403,51 +285,53 @@ func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) { p.EnterOuterAlt(localctx, 1) checkKeyword(p) { - p.SetState(154) + p.SetState(156) - _m := p.Match(ApiParserParserID) + var _m = p.Match(ApiParserParserID) localctx.(*TypeStructContext).structName = _m } - p.SetState(156) + p.SetState(158) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) if _la == ApiParserParserID { { - p.SetState(155) + p.SetState(157) - _m := p.Match(ApiParserParserID) + var _m = p.Match(ApiParserParserID) localctx.(*TypeStructContext).structToken = _m } + } { - p.SetState(158) + p.SetState(160) - _m := p.Match(ApiParserParserT__3) + var _m = p.Match(ApiParserParserT__3) localctx.(*TypeStructContext).lbrace = _m } - p.SetState(162) + p.SetState(164) p.GetErrorHandler().Sync(p) _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 10, p.GetParserRuleContext()) for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(159) + p.SetState(161) p.Field() } + } - p.SetState(164) + p.SetState(166) p.GetErrorHandler().Sync(p) _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 10, p.GetParserRuleContext()) } { - p.SetState(165) + p.SetState(167) - _m := p.Match(ApiParserParserT__4) + var _m = p.Match(ApiParserParserT__4) localctx.(*TypeStructContext).rbrace = _m } @@ -486,7 +370,7 @@ type TypeAliasContext struct { } func NewEmptyTypeAliasContext() *TypeAliasContext { - p := new(TypeAliasContext) + var p = new(TypeAliasContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_typeAlias return p @@ -495,7 +379,7 @@ func NewEmptyTypeAliasContext() *TypeAliasContext { func (*TypeAliasContext) IsTypeAliasContext() {} func NewTypeAliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeAliasContext { - p := new(TypeAliasContext) + var p = new(TypeAliasContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -516,7 +400,7 @@ func (s *TypeAliasContext) SetAlias(v antlr.Token) { s.alias = v } func (s *TypeAliasContext) SetAssign(v antlr.Token) { s.assign = v } func (s *TypeAliasContext) DataType() IDataTypeContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0) if t == nil { return nil @@ -571,27 +455,28 @@ func (p *ApiParserParser) TypeAlias() (localctx ITypeAliasContext) { p.EnterOuterAlt(localctx, 1) checkKeyword(p) { - p.SetState(168) + p.SetState(170) - _m := p.Match(ApiParserParserID) + var _m = p.Match(ApiParserParserID) localctx.(*TypeAliasContext).alias = _m } - p.SetState(170) + p.SetState(172) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) if _la == ApiParserParserT__0 { { - p.SetState(169) + p.SetState(171) - _m := p.Match(ApiParserParserT__0) + var _m = p.Match(ApiParserParserT__0) localctx.(*TypeAliasContext).assign = _m } + } { - p.SetState(172) + p.SetState(174) p.DataType() } @@ -632,3 +517,179 @@ type ITypeBlockStructContext interface { // IsTypeBlockStructContext differentiates from other interfaces. IsTypeBlockStructContext() } + +type TypeBlockStructContext struct { + *antlr.BaseParserRuleContext + parser antlr.Parser + structName antlr.Token + structToken antlr.Token + lbrace antlr.Token + rbrace antlr.Token +} + +func NewEmptyTypeBlockStructContext() *TypeBlockStructContext { + var p = new(TypeBlockStructContext) + p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + p.RuleIndex = ApiParserParserRULE_typeBlockStruct + return p +} + +func (*TypeBlockStructContext) IsTypeBlockStructContext() {} + +func NewTypeBlockStructContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockStructContext { + var p = new(TypeBlockStructContext) + + p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + + p.parser = parser + p.RuleIndex = ApiParserParserRULE_typeBlockStruct + + return p +} + +func (s *TypeBlockStructContext) GetParser() antlr.Parser { return s.parser } + +func (s *TypeBlockStructContext) GetStructName() antlr.Token { return s.structName } + +func (s *TypeBlockStructContext) GetStructToken() antlr.Token { return s.structToken } + +func (s *TypeBlockStructContext) GetLbrace() antlr.Token { return s.lbrace } + +func (s *TypeBlockStructContext) GetRbrace() antlr.Token { return s.rbrace } + +func (s *TypeBlockStructContext) SetStructName(v antlr.Token) { s.structName = v } + +func (s *TypeBlockStructContext) SetStructToken(v antlr.Token) { s.structToken = v } + +func (s *TypeBlockStructContext) SetLbrace(v antlr.Token) { s.lbrace = v } + +func (s *TypeBlockStructContext) SetRbrace(v antlr.Token) { s.rbrace = v } + +func (s *TypeBlockStructContext) AllID() []antlr.TerminalNode { + return s.GetTokens(ApiParserParserID) +} + +func (s *TypeBlockStructContext) ID(i int) antlr.TerminalNode { + return s.GetToken(ApiParserParserID, i) +} + +func (s *TypeBlockStructContext) AllField() []IFieldContext { + var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IFieldContext)(nil)).Elem()) + var tst = make([]IFieldContext, len(ts)) + + for i, t := range ts { + if t != nil { + tst[i] = t.(IFieldContext) + } + } + + return tst +} + +func (s *TypeBlockStructContext) Field(i int) IFieldContext { + var t = s.GetTypedRuleContext(reflect.TypeOf((*IFieldContext)(nil)).Elem(), i) + + if t == nil { + return nil + } + + return t.(IFieldContext) +} + +func (s *TypeBlockStructContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TypeBlockStructContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TypeBlockStructContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ApiParserVisitor: + return t.VisitTypeBlockStruct(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ApiParserParser) TypeBlockStruct() (localctx ITypeBlockStructContext) { + localctx = NewTypeBlockStructContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 32, ApiParserParserRULE_typeBlockStruct) + var _la int + + defer func() { + p.ExitRule() + }() + + defer func() { + if err := recover(); err != nil { + if v, ok := err.(antlr.RecognitionException); ok { + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + } else { + panic(err) + } + } + }() + + var _alt int + + p.EnterOuterAlt(localctx, 1) + checkKeyword(p) + { + p.SetState(177) + + var _m = p.Match(ApiParserParserID) + + localctx.(*TypeBlockStructContext).structName = _m + } + p.SetState(179) + p.GetErrorHandler().Sync(p) + _la = p.GetTokenStream().LA(1) + + if _la == ApiParserParserID { + { + p.SetState(178) + + var _m = p.Match(ApiParserParserID) + + localctx.(*TypeBlockStructContext).structToken = _m + } + + } + { + p.SetState(181) + + var _m = p.Match(ApiParserParserT__3) + + localctx.(*TypeBlockStructContext).lbrace = _m + } + p.SetState(185) + p.GetErrorHandler().Sync(p) + _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 13, p.GetParserRuleContext()) + + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(182) + p.Field() + } + + } + p.SetState(187) + p.GetErrorHandler().Sync(p) + _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 13, p.GetParserRuleContext()) + } + { + p.SetState(188) + + var _m = p.Match(ApiParserParserT__4) + + localctx.(*TypeBlockStructContext).rbrace = _m + } + + return localctx +} diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_parser4.go b/tools/goctl/api/parser/g4/gen/api/apiparser_parser4.go index f430ea837535..dca80711d6e9 100755 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser4.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser4.go @@ -10,180 +10,6 @@ import ( // The apiparser_parser.go file was split into multiple files because it // was too large and caused a possible memory overflow during goctl installation. -type TypeBlockStructContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser - structName antlr.Token - structToken antlr.Token - lbrace antlr.Token - rbrace antlr.Token -} - -func NewEmptyTypeBlockStructContext() *TypeBlockStructContext { - p := new(TypeBlockStructContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = ApiParserParserRULE_typeBlockStruct - return p -} - -func (*TypeBlockStructContext) IsTypeBlockStructContext() {} - -func NewTypeBlockStructContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockStructContext { - p := new(TypeBlockStructContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = ApiParserParserRULE_typeBlockStruct - - return p -} - -func (s *TypeBlockStructContext) GetParser() antlr.Parser { return s.parser } - -func (s *TypeBlockStructContext) GetStructName() antlr.Token { return s.structName } - -func (s *TypeBlockStructContext) GetStructToken() antlr.Token { return s.structToken } - -func (s *TypeBlockStructContext) GetLbrace() antlr.Token { return s.lbrace } - -func (s *TypeBlockStructContext) GetRbrace() antlr.Token { return s.rbrace } - -func (s *TypeBlockStructContext) SetStructName(v antlr.Token) { s.structName = v } - -func (s *TypeBlockStructContext) SetStructToken(v antlr.Token) { s.structToken = v } - -func (s *TypeBlockStructContext) SetLbrace(v antlr.Token) { s.lbrace = v } - -func (s *TypeBlockStructContext) SetRbrace(v antlr.Token) { s.rbrace = v } - -func (s *TypeBlockStructContext) AllID() []antlr.TerminalNode { - return s.GetTokens(ApiParserParserID) -} - -func (s *TypeBlockStructContext) ID(i int) antlr.TerminalNode { - return s.GetToken(ApiParserParserID, i) -} - -func (s *TypeBlockStructContext) AllField() []IFieldContext { - ts := s.GetTypedRuleContexts(reflect.TypeOf((*IFieldContext)(nil)).Elem()) - tst := make([]IFieldContext, len(ts)) - - for i, t := range ts { - if t != nil { - tst[i] = t.(IFieldContext) - } - } - - return tst -} - -func (s *TypeBlockStructContext) Field(i int) IFieldContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IFieldContext)(nil)).Elem(), i) - - if t == nil { - return nil - } - - return t.(IFieldContext) -} - -func (s *TypeBlockStructContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *TypeBlockStructContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *TypeBlockStructContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { - switch t := visitor.(type) { - case ApiParserVisitor: - return t.VisitTypeBlockStruct(s) - - default: - return t.VisitChildren(s) - } -} - -func (p *ApiParserParser) TypeBlockStruct() (localctx ITypeBlockStructContext) { - localctx = NewTypeBlockStructContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 32, ApiParserParserRULE_typeBlockStruct) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - var _alt int - - p.EnterOuterAlt(localctx, 1) - checkKeyword(p) - { - p.SetState(175) - - _m := p.Match(ApiParserParserID) - - localctx.(*TypeBlockStructContext).structName = _m - } - p.SetState(177) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == ApiParserParserID { - { - p.SetState(176) - - _m := p.Match(ApiParserParserID) - - localctx.(*TypeBlockStructContext).structToken = _m - } - } - { - p.SetState(179) - - _m := p.Match(ApiParserParserT__3) - - localctx.(*TypeBlockStructContext).lbrace = _m - } - p.SetState(183) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 13, p.GetParserRuleContext()) - - for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { - if _alt == 1 { - { - p.SetState(180) - p.Field() - } - } - p.SetState(185) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 13, p.GetParserRuleContext()) - } - { - p.SetState(186) - - _m := p.Match(ApiParserParserT__4) - - localctx.(*TypeBlockStructContext).rbrace = _m - } - - return localctx -} - // ITypeBlockAliasContext is an interface to support dynamic dispatch. type ITypeBlockAliasContext interface { antlr.ParserRuleContext @@ -215,7 +41,7 @@ type TypeBlockAliasContext struct { } func NewEmptyTypeBlockAliasContext() *TypeBlockAliasContext { - p := new(TypeBlockAliasContext) + var p = new(TypeBlockAliasContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_typeBlockAlias return p @@ -224,7 +50,7 @@ func NewEmptyTypeBlockAliasContext() *TypeBlockAliasContext { func (*TypeBlockAliasContext) IsTypeBlockAliasContext() {} func NewTypeBlockAliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockAliasContext { - p := new(TypeBlockAliasContext) + var p = new(TypeBlockAliasContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -245,7 +71,7 @@ func (s *TypeBlockAliasContext) SetAlias(v antlr.Token) { s.alias = v } func (s *TypeBlockAliasContext) SetAssign(v antlr.Token) { s.assign = v } func (s *TypeBlockAliasContext) DataType() IDataTypeContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0) if t == nil { return nil @@ -300,27 +126,28 @@ func (p *ApiParserParser) TypeBlockAlias() (localctx ITypeBlockAliasContext) { p.EnterOuterAlt(localctx, 1) checkKeyword(p) { - p.SetState(189) + p.SetState(191) - _m := p.Match(ApiParserParserID) + var _m = p.Match(ApiParserParserID) localctx.(*TypeBlockAliasContext).alias = _m } - p.SetState(191) + p.SetState(193) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) if _la == ApiParserParserT__0 { { - p.SetState(190) + p.SetState(192) - _m := p.Match(ApiParserParserT__0) + var _m = p.Match(ApiParserParserT__0) localctx.(*TypeBlockAliasContext).assign = _m } + } { - p.SetState(193) + p.SetState(195) p.DataType() } @@ -344,7 +171,7 @@ type FieldContext struct { } func NewEmptyFieldContext() *FieldContext { - p := new(FieldContext) + var p = new(FieldContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_field return p @@ -353,7 +180,7 @@ func NewEmptyFieldContext() *FieldContext { func (*FieldContext) IsFieldContext() {} func NewFieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FieldContext { - p := new(FieldContext) + var p = new(FieldContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -366,7 +193,7 @@ func NewFieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invoki func (s *FieldContext) GetParser() antlr.Parser { return s.parser } func (s *FieldContext) NormalField() INormalFieldContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*INormalFieldContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*INormalFieldContext)(nil)).Elem(), 0) if t == nil { return nil @@ -376,7 +203,7 @@ func (s *FieldContext) NormalField() INormalFieldContext { } func (s *FieldContext) AnonymousFiled() IAnonymousFiledContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IAnonymousFiledContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IAnonymousFiledContext)(nil)).Elem(), 0) if t == nil { return nil @@ -423,25 +250,25 @@ func (p *ApiParserParser) Field() (localctx IFieldContext) { } }() - p.SetState(198) + p.SetState(200) p.GetErrorHandler().Sync(p) switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 15, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) - p.SetState(195) + p.SetState(197) if !(isNormal(p)) { panic(antlr.NewFailedPredicateException(p, "isNormal(p)", "")) } { - p.SetState(196) + p.SetState(198) p.NormalField() } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(197) + p.SetState(199) p.AnonymousFiled() } @@ -481,7 +308,7 @@ type NormalFieldContext struct { } func NewEmptyNormalFieldContext() *NormalFieldContext { - p := new(NormalFieldContext) + var p = new(NormalFieldContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_normalField return p @@ -490,7 +317,7 @@ func NewEmptyNormalFieldContext() *NormalFieldContext { func (*NormalFieldContext) IsNormalFieldContext() {} func NewNormalFieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NormalFieldContext { - p := new(NormalFieldContext) + var p = new(NormalFieldContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -511,7 +338,7 @@ func (s *NormalFieldContext) SetFieldName(v antlr.Token) { s.fieldName = v } func (s *NormalFieldContext) SetTag(v antlr.Token) { s.tag = v } func (s *NormalFieldContext) DataType() IDataTypeContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0) if t == nil { return nil @@ -569,27 +396,28 @@ func (p *ApiParserParser) NormalField() (localctx INormalFieldContext) { p.EnterOuterAlt(localctx, 1) checkKeyword(p) { - p.SetState(201) + p.SetState(203) - _m := p.Match(ApiParserParserID) + var _m = p.Match(ApiParserParserID) localctx.(*NormalFieldContext).fieldName = _m } { - p.SetState(202) + p.SetState(204) p.DataType() } - p.SetState(204) + p.SetState(206) p.GetErrorHandler().Sync(p) if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 16, p.GetParserRuleContext()) == 1 { { - p.SetState(203) + p.SetState(205) - _m := p.Match(ApiParserParserRAW_STRING) + var _m = p.Match(ApiParserParserRAW_STRING) localctx.(*NormalFieldContext).tag = _m } + } return localctx @@ -611,3 +439,227 @@ type IAnonymousFiledContext interface { // IsAnonymousFiledContext differentiates from other interfaces. IsAnonymousFiledContext() } + +type AnonymousFiledContext struct { + *antlr.BaseParserRuleContext + parser antlr.Parser + star antlr.Token +} + +func NewEmptyAnonymousFiledContext() *AnonymousFiledContext { + var p = new(AnonymousFiledContext) + p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + p.RuleIndex = ApiParserParserRULE_anonymousFiled + return p +} + +func (*AnonymousFiledContext) IsAnonymousFiledContext() {} + +func NewAnonymousFiledContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AnonymousFiledContext { + var p = new(AnonymousFiledContext) + + p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + + p.parser = parser + p.RuleIndex = ApiParserParserRULE_anonymousFiled + + return p +} + +func (s *AnonymousFiledContext) GetParser() antlr.Parser { return s.parser } + +func (s *AnonymousFiledContext) GetStar() antlr.Token { return s.star } + +func (s *AnonymousFiledContext) SetStar(v antlr.Token) { s.star = v } + +func (s *AnonymousFiledContext) ID() antlr.TerminalNode { + return s.GetToken(ApiParserParserID, 0) +} + +func (s *AnonymousFiledContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AnonymousFiledContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AnonymousFiledContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ApiParserVisitor: + return t.VisitAnonymousFiled(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ApiParserParser) AnonymousFiled() (localctx IAnonymousFiledContext) { + localctx = NewAnonymousFiledContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 40, ApiParserParserRULE_anonymousFiled) + var _la int + + defer func() { + p.ExitRule() + }() + + defer func() { + if err := recover(); err != nil { + if v, ok := err.(antlr.RecognitionException); ok { + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + } else { + panic(err) + } + } + }() + + p.EnterOuterAlt(localctx, 1) + p.SetState(209) + p.GetErrorHandler().Sync(p) + _la = p.GetTokenStream().LA(1) + + if _la == ApiParserParserT__5 { + { + p.SetState(208) + + var _m = p.Match(ApiParserParserT__5) + + localctx.(*AnonymousFiledContext).star = _m + } + + } + { + p.SetState(211) + p.Match(ApiParserParserID) + } + + return localctx +} + +// IDataTypeContext is an interface to support dynamic dispatch. +type IDataTypeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // GetInter returns the inter token. + GetInter() antlr.Token + + // GetTime returns the time token. + GetTime() antlr.Token + + // SetInter sets the inter token. + SetInter(antlr.Token) + + // SetTime sets the time token. + SetTime(antlr.Token) + + // IsDataTypeContext differentiates from other interfaces. + IsDataTypeContext() +} + +type DataTypeContext struct { + *antlr.BaseParserRuleContext + parser antlr.Parser + inter antlr.Token + time antlr.Token +} + +func NewEmptyDataTypeContext() *DataTypeContext { + var p = new(DataTypeContext) + p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + p.RuleIndex = ApiParserParserRULE_dataType + return p +} + +func (*DataTypeContext) IsDataTypeContext() {} + +func NewDataTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DataTypeContext { + var p = new(DataTypeContext) + + p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + + p.parser = parser + p.RuleIndex = ApiParserParserRULE_dataType + + return p +} + +func (s *DataTypeContext) GetParser() antlr.Parser { return s.parser } + +func (s *DataTypeContext) GetInter() antlr.Token { return s.inter } + +func (s *DataTypeContext) GetTime() antlr.Token { return s.time } + +func (s *DataTypeContext) SetInter(v antlr.Token) { s.inter = v } + +func (s *DataTypeContext) SetTime(v antlr.Token) { s.time = v } + +func (s *DataTypeContext) ID() antlr.TerminalNode { + return s.GetToken(ApiParserParserID, 0) +} + +func (s *DataTypeContext) MapType() IMapTypeContext { + var t = s.GetTypedRuleContext(reflect.TypeOf((*IMapTypeContext)(nil)).Elem(), 0) + + if t == nil { + return nil + } + + return t.(IMapTypeContext) +} + +func (s *DataTypeContext) ArrayType() IArrayTypeContext { + var t = s.GetTypedRuleContext(reflect.TypeOf((*IArrayTypeContext)(nil)).Elem(), 0) + + if t == nil { + return nil + } + + return t.(IArrayTypeContext) +} + +func (s *DataTypeContext) INTERFACE() antlr.TerminalNode { + return s.GetToken(ApiParserParserINTERFACE, 0) +} + +func (s *DataTypeContext) PointerType() IPointerTypeContext { + var t = s.GetTypedRuleContext(reflect.TypeOf((*IPointerTypeContext)(nil)).Elem(), 0) + + if t == nil { + return nil + } + + return t.(IPointerTypeContext) +} + +func (s *DataTypeContext) TypeStruct() ITypeStructContext { + var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeStructContext)(nil)).Elem(), 0) + + if t == nil { + return nil + } + + return t.(ITypeStructContext) +} + +func (s *DataTypeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DataTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DataTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ApiParserVisitor: + return t.VisitDataType(s) + + default: + return t.VisitChildren(s) + } +} diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_parser5.go b/tools/goctl/api/parser/g4/gen/api/apiparser_parser5.go index 102f94e93275..8611011183c7 100755 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser5.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser5.go @@ -10,229 +10,6 @@ import ( // The apiparser_parser.go file was split into multiple files because it // was too large and caused a possible memory overflow during goctl installation. -type AnonymousFiledContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser - star antlr.Token -} - -func NewEmptyAnonymousFiledContext() *AnonymousFiledContext { - p := new(AnonymousFiledContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = ApiParserParserRULE_anonymousFiled - return p -} - -func (*AnonymousFiledContext) IsAnonymousFiledContext() {} - -func NewAnonymousFiledContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AnonymousFiledContext { - p := new(AnonymousFiledContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = ApiParserParserRULE_anonymousFiled - - return p -} - -func (s *AnonymousFiledContext) GetParser() antlr.Parser { return s.parser } - -func (s *AnonymousFiledContext) GetStar() antlr.Token { return s.star } - -func (s *AnonymousFiledContext) SetStar(v antlr.Token) { s.star = v } - -func (s *AnonymousFiledContext) ID() antlr.TerminalNode { - return s.GetToken(ApiParserParserID, 0) -} - -func (s *AnonymousFiledContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *AnonymousFiledContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *AnonymousFiledContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { - switch t := visitor.(type) { - case ApiParserVisitor: - return t.VisitAnonymousFiled(s) - - default: - return t.VisitChildren(s) - } -} - -func (p *ApiParserParser) AnonymousFiled() (localctx IAnonymousFiledContext) { - localctx = NewAnonymousFiledContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 40, ApiParserParserRULE_anonymousFiled) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(207) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == ApiParserParserT__5 { - { - p.SetState(206) - - _m := p.Match(ApiParserParserT__5) - - localctx.(*AnonymousFiledContext).star = _m - } - } - { - p.SetState(209) - p.Match(ApiParserParserID) - } - - return localctx -} - -// IDataTypeContext is an interface to support dynamic dispatch. -type IDataTypeContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // GetInter returns the inter token. - GetInter() antlr.Token - - // GetTime returns the time token. - GetTime() antlr.Token - - // SetInter sets the inter token. - SetInter(antlr.Token) - - // SetTime sets the time token. - SetTime(antlr.Token) - - // IsDataTypeContext differentiates from other interfaces. - IsDataTypeContext() -} - -type DataTypeContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser - inter antlr.Token - time antlr.Token -} - -func NewEmptyDataTypeContext() *DataTypeContext { - p := new(DataTypeContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = ApiParserParserRULE_dataType - return p -} - -func (*DataTypeContext) IsDataTypeContext() {} - -func NewDataTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DataTypeContext { - p := new(DataTypeContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = ApiParserParserRULE_dataType - - return p -} - -func (s *DataTypeContext) GetParser() antlr.Parser { return s.parser } - -func (s *DataTypeContext) GetInter() antlr.Token { return s.inter } - -func (s *DataTypeContext) GetTime() antlr.Token { return s.time } - -func (s *DataTypeContext) SetInter(v antlr.Token) { s.inter = v } - -func (s *DataTypeContext) SetTime(v antlr.Token) { s.time = v } - -func (s *DataTypeContext) ID() antlr.TerminalNode { - return s.GetToken(ApiParserParserID, 0) -} - -func (s *DataTypeContext) MapType() IMapTypeContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IMapTypeContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(IMapTypeContext) -} - -func (s *DataTypeContext) ArrayType() IArrayTypeContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IArrayTypeContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(IArrayTypeContext) -} - -func (s *DataTypeContext) INTERFACE() antlr.TerminalNode { - return s.GetToken(ApiParserParserINTERFACE, 0) -} - -func (s *DataTypeContext) PointerType() IPointerTypeContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IPointerTypeContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(IPointerTypeContext) -} - -func (s *DataTypeContext) TypeStruct() ITypeStructContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeStructContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(ITypeStructContext) -} - -func (s *DataTypeContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *DataTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *DataTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { - switch t := visitor.(type) { - case ApiParserVisitor: - return t.VisitDataType(s) - - default: - return t.VisitChildren(s) - } -} - func (p *ApiParserParser) DataType() (localctx IDataTypeContext) { localctx = NewDataTypeContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 42, ApiParserParserRULE_dataType) @@ -253,37 +30,37 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) { } }() - p.SetState(219) + p.SetState(221) p.GetErrorHandler().Sync(p) switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 18, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) isInterface(p) { - p.SetState(212) + p.SetState(214) p.Match(ApiParserParserID) } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(213) + p.SetState(215) p.MapType() } case 3: p.EnterOuterAlt(localctx, 3) { - p.SetState(214) + p.SetState(216) p.ArrayType() } case 4: p.EnterOuterAlt(localctx, 4) { - p.SetState(215) + p.SetState(217) - _m := p.Match(ApiParserParserINTERFACE) + var _m = p.Match(ApiParserParserINTERFACE) localctx.(*DataTypeContext).inter = _m } @@ -291,9 +68,9 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) { case 5: p.EnterOuterAlt(localctx, 5) { - p.SetState(216) + p.SetState(218) - _m := p.Match(ApiParserParserT__6) + var _m = p.Match(ApiParserParserT__6) localctx.(*DataTypeContext).time = _m } @@ -301,14 +78,14 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) { case 6: p.EnterOuterAlt(localctx, 6) { - p.SetState(217) + p.SetState(219) p.PointerType() } case 7: p.EnterOuterAlt(localctx, 7) { - p.SetState(218) + p.SetState(220) p.TypeStruct() } @@ -341,7 +118,7 @@ type PointerTypeContext struct { } func NewEmptyPointerTypeContext() *PointerTypeContext { - p := new(PointerTypeContext) + var p = new(PointerTypeContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_pointerType return p @@ -350,7 +127,7 @@ func NewEmptyPointerTypeContext() *PointerTypeContext { func (*PointerTypeContext) IsPointerTypeContext() {} func NewPointerTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PointerTypeContext { - p := new(PointerTypeContext) + var p = new(PointerTypeContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -410,15 +187,15 @@ func (p *ApiParserParser) PointerType() (localctx IPointerTypeContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(221) + p.SetState(223) - _m := p.Match(ApiParserParserT__5) + var _m = p.Match(ApiParserParserT__5) localctx.(*PointerTypeContext).star = _m } checkKeyword(p) { - p.SetState(223) + p.SetState(225) p.Match(ApiParserParserID) } @@ -477,7 +254,7 @@ type MapTypeContext struct { } func NewEmptyMapTypeContext() *MapTypeContext { - p := new(MapTypeContext) + var p = new(MapTypeContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_mapType return p @@ -486,7 +263,7 @@ func NewEmptyMapTypeContext() *MapTypeContext { func (*MapTypeContext) IsMapTypeContext() {} func NewMapTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *MapTypeContext { - p := new(MapTypeContext) + var p = new(MapTypeContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) @@ -527,7 +304,7 @@ func (s *MapTypeContext) ID(i int) antlr.TerminalNode { } func (s *MapTypeContext) DataType() IDataTypeContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0) + var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0) if t == nil { return nil @@ -577,41 +354,312 @@ func (p *ApiParserParser) MapType() (localctx IMapTypeContext) { p.EnterOuterAlt(localctx, 1) match(p, "map") { - p.SetState(226) + p.SetState(228) - _m := p.Match(ApiParserParserID) + var _m = p.Match(ApiParserParserID) localctx.(*MapTypeContext).mapToken = _m } { - p.SetState(227) + p.SetState(229) - _m := p.Match(ApiParserParserT__7) + var _m = p.Match(ApiParserParserT__7) localctx.(*MapTypeContext).lbrack = _m } checkKey(p) { - p.SetState(229) + p.SetState(231) - _m := p.Match(ApiParserParserID) + var _m = p.Match(ApiParserParserID) localctx.(*MapTypeContext).key = _m } { - p.SetState(230) + p.SetState(232) - _m := p.Match(ApiParserParserT__8) + var _m = p.Match(ApiParserParserT__8) localctx.(*MapTypeContext).rbrack = _m } { - p.SetState(231) + p.SetState(233) - _x := p.DataType() + var _x = p.DataType() localctx.(*MapTypeContext).value = _x } return localctx } + +// IArrayTypeContext is an interface to support dynamic dispatch. +type IArrayTypeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // GetLbrack returns the lbrack token. + GetLbrack() antlr.Token + + // GetRbrack returns the rbrack token. + GetRbrack() antlr.Token + + // SetLbrack sets the lbrack token. + SetLbrack(antlr.Token) + + // SetRbrack sets the rbrack token. + SetRbrack(antlr.Token) + + // IsArrayTypeContext differentiates from other interfaces. + IsArrayTypeContext() +} + +type ArrayTypeContext struct { + *antlr.BaseParserRuleContext + parser antlr.Parser + lbrack antlr.Token + rbrack antlr.Token +} + +func NewEmptyArrayTypeContext() *ArrayTypeContext { + var p = new(ArrayTypeContext) + p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + p.RuleIndex = ApiParserParserRULE_arrayType + return p +} + +func (*ArrayTypeContext) IsArrayTypeContext() {} + +func NewArrayTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ArrayTypeContext { + var p = new(ArrayTypeContext) + + p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + + p.parser = parser + p.RuleIndex = ApiParserParserRULE_arrayType + + return p +} + +func (s *ArrayTypeContext) GetParser() antlr.Parser { return s.parser } + +func (s *ArrayTypeContext) GetLbrack() antlr.Token { return s.lbrack } + +func (s *ArrayTypeContext) GetRbrack() antlr.Token { return s.rbrack } + +func (s *ArrayTypeContext) SetLbrack(v antlr.Token) { s.lbrack = v } + +func (s *ArrayTypeContext) SetRbrack(v antlr.Token) { s.rbrack = v } + +func (s *ArrayTypeContext) DataType() IDataTypeContext { + var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0) + + if t == nil { + return nil + } + + return t.(IDataTypeContext) +} + +func (s *ArrayTypeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ArrayTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ArrayTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ApiParserVisitor: + return t.VisitArrayType(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ApiParserParser) ArrayType() (localctx IArrayTypeContext) { + localctx = NewArrayTypeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 48, ApiParserParserRULE_arrayType) + + defer func() { + p.ExitRule() + }() + + defer func() { + if err := recover(); err != nil { + if v, ok := err.(antlr.RecognitionException); ok { + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + } else { + panic(err) + } + } + }() + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(235) + + var _m = p.Match(ApiParserParserT__7) + + localctx.(*ArrayTypeContext).lbrack = _m + } + { + p.SetState(236) + + var _m = p.Match(ApiParserParserT__8) + + localctx.(*ArrayTypeContext).rbrack = _m + } + { + p.SetState(237) + p.DataType() + } + + return localctx +} + +// IServiceSpecContext is an interface to support dynamic dispatch. +type IServiceSpecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // IsServiceSpecContext differentiates from other interfaces. + IsServiceSpecContext() +} + +type ServiceSpecContext struct { + *antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyServiceSpecContext() *ServiceSpecContext { + var p = new(ServiceSpecContext) + p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + p.RuleIndex = ApiParserParserRULE_serviceSpec + return p +} + +func (*ServiceSpecContext) IsServiceSpecContext() {} + +func NewServiceSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceSpecContext { + var p = new(ServiceSpecContext) + + p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + + p.parser = parser + p.RuleIndex = ApiParserParserRULE_serviceSpec + + return p +} + +func (s *ServiceSpecContext) GetParser() antlr.Parser { return s.parser } + +func (s *ServiceSpecContext) ServiceApi() IServiceApiContext { + var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceApiContext)(nil)).Elem(), 0) + + if t == nil { + return nil + } + + return t.(IServiceApiContext) +} + +func (s *ServiceSpecContext) AtServer() IAtServerContext { + var t = s.GetTypedRuleContext(reflect.TypeOf((*IAtServerContext)(nil)).Elem(), 0) + + if t == nil { + return nil + } + + return t.(IAtServerContext) +} + +func (s *ServiceSpecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ServiceSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ServiceSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ApiParserVisitor: + return t.VisitServiceSpec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ApiParserParser) ServiceSpec() (localctx IServiceSpecContext) { + localctx = NewServiceSpecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 50, ApiParserParserRULE_serviceSpec) + var _la int + + defer func() { + p.ExitRule() + }() + + defer func() { + if err := recover(); err != nil { + if v, ok := err.(antlr.RecognitionException); ok { + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + } else { + panic(err) + } + } + }() + + p.EnterOuterAlt(localctx, 1) + p.SetState(240) + p.GetErrorHandler().Sync(p) + _la = p.GetTokenStream().LA(1) + + if _la == ApiParserParserATSERVER { + { + p.SetState(239) + p.AtServer() + } + + } + { + p.SetState(242) + p.ServiceApi() + } + + return localctx +} + +// IAtServerContext is an interface to support dynamic dispatch. +type IAtServerContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // GetLp returns the lp token. + GetLp() antlr.Token + + // GetRp returns the rp token. + GetRp() antlr.Token + + // SetLp sets the lp token. + SetLp(antlr.Token) + + // SetRp sets the rp token. + SetRp(antlr.Token) + + // IsAtServerContext differentiates from other interfaces. + IsAtServerContext() +} diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_parser6.go b/tools/goctl/api/parser/g4/gen/api/apiparser_parser6.go index 7e872f6f4fdd..fa8657d43bc9 100755 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser6.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser6.go @@ -10,97 +10,92 @@ import ( // The apiparser_parser.go file was split into multiple files because it // was too large and caused a possible memory overflow during goctl installation. -// IArrayTypeContext is an interface to support dynamic dispatch. -type IArrayTypeContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // GetLbrack returns the lbrack token. - GetLbrack() antlr.Token - - // GetRbrack returns the rbrack token. - GetRbrack() antlr.Token - - // SetLbrack sets the lbrack token. - SetLbrack(antlr.Token) - - // SetRbrack sets the rbrack token. - SetRbrack(antlr.Token) - - // IsArrayTypeContext differentiates from other interfaces. - IsArrayTypeContext() -} - -type ArrayTypeContext struct { +type AtServerContext struct { *antlr.BaseParserRuleContext parser antlr.Parser - lbrack antlr.Token - rbrack antlr.Token + lp antlr.Token + rp antlr.Token } -func NewEmptyArrayTypeContext() *ArrayTypeContext { - p := new(ArrayTypeContext) +func NewEmptyAtServerContext() *AtServerContext { + var p = new(AtServerContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = ApiParserParserRULE_arrayType + p.RuleIndex = ApiParserParserRULE_atServer return p } -func (*ArrayTypeContext) IsArrayTypeContext() {} +func (*AtServerContext) IsAtServerContext() {} -func NewArrayTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ArrayTypeContext { - p := new(ArrayTypeContext) +func NewAtServerContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtServerContext { + var p = new(AtServerContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) p.parser = parser - p.RuleIndex = ApiParserParserRULE_arrayType + p.RuleIndex = ApiParserParserRULE_atServer return p } -func (s *ArrayTypeContext) GetParser() antlr.Parser { return s.parser } +func (s *AtServerContext) GetParser() antlr.Parser { return s.parser } -func (s *ArrayTypeContext) GetLbrack() antlr.Token { return s.lbrack } +func (s *AtServerContext) GetLp() antlr.Token { return s.lp } -func (s *ArrayTypeContext) GetRbrack() antlr.Token { return s.rbrack } +func (s *AtServerContext) GetRp() antlr.Token { return s.rp } -func (s *ArrayTypeContext) SetLbrack(v antlr.Token) { s.lbrack = v } +func (s *AtServerContext) SetLp(v antlr.Token) { s.lp = v } -func (s *ArrayTypeContext) SetRbrack(v antlr.Token) { s.rbrack = v } +func (s *AtServerContext) SetRp(v antlr.Token) { s.rp = v } -func (s *ArrayTypeContext) DataType() IDataTypeContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0) +func (s *AtServerContext) ATSERVER() antlr.TerminalNode { + return s.GetToken(ApiParserParserATSERVER, 0) +} + +func (s *AtServerContext) AllKvLit() []IKvLitContext { + var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem()) + var tst = make([]IKvLitContext, len(ts)) + + for i, t := range ts { + if t != nil { + tst[i] = t.(IKvLitContext) + } + } + + return tst +} + +func (s *AtServerContext) KvLit(i int) IKvLitContext { + var t = s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i) if t == nil { return nil } - return t.(IDataTypeContext) + return t.(IKvLitContext) } -func (s *ArrayTypeContext) GetRuleContext() antlr.RuleContext { +func (s *AtServerContext) GetRuleContext() antlr.RuleContext { return s } -func (s *ArrayTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { +func (s *AtServerContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *ArrayTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { +func (s *AtServerContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: - return t.VisitArrayType(s) + return t.VisitAtServer(s) default: return t.VisitChildren(s) } } -func (p *ApiParserParser) ArrayType() (localctx IArrayTypeContext) { - localctx = NewArrayTypeContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 48, ApiParserParserRULE_arrayType) +func (p *ApiParserParser) AtServer() (localctx IAtServerContext) { + localctx = NewAtServerContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 52, ApiParserParserRULE_atServer) + var _la int defer func() { p.ExitRule() @@ -120,106 +115,170 @@ func (p *ApiParserParser) ArrayType() (localctx IArrayTypeContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(233) + p.SetState(244) + p.Match(ApiParserParserATSERVER) + } + { + p.SetState(245) - _m := p.Match(ApiParserParserT__7) + var _m = p.Match(ApiParserParserT__1) - localctx.(*ArrayTypeContext).lbrack = _m + localctx.(*AtServerContext).lp = _m } - { - p.SetState(234) + p.SetState(247) + p.GetErrorHandler().Sync(p) + _la = p.GetTokenStream().LA(1) - _m := p.Match(ApiParserParserT__8) + for ok := true; ok; ok = _la == ApiParserParserID { + { + p.SetState(246) + p.KvLit() + } - localctx.(*ArrayTypeContext).rbrack = _m + p.SetState(249) + p.GetErrorHandler().Sync(p) + _la = p.GetTokenStream().LA(1) } { - p.SetState(235) - p.DataType() + p.SetState(251) + + var _m = p.Match(ApiParserParserT__2) + + localctx.(*AtServerContext).rp = _m } return localctx } -// IServiceSpecContext is an interface to support dynamic dispatch. -type IServiceSpecContext interface { +// IServiceApiContext is an interface to support dynamic dispatch. +type IServiceApiContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser - // IsServiceSpecContext differentiates from other interfaces. - IsServiceSpecContext() + // GetServiceToken returns the serviceToken token. + GetServiceToken() antlr.Token + + // GetLbrace returns the lbrace token. + GetLbrace() antlr.Token + + // GetRbrace returns the rbrace token. + GetRbrace() antlr.Token + + // SetServiceToken sets the serviceToken token. + SetServiceToken(antlr.Token) + + // SetLbrace sets the lbrace token. + SetLbrace(antlr.Token) + + // SetRbrace sets the rbrace token. + SetRbrace(antlr.Token) + + // IsServiceApiContext differentiates from other interfaces. + IsServiceApiContext() } -type ServiceSpecContext struct { +type ServiceApiContext struct { *antlr.BaseParserRuleContext - parser antlr.Parser + parser antlr.Parser + serviceToken antlr.Token + lbrace antlr.Token + rbrace antlr.Token } -func NewEmptyServiceSpecContext() *ServiceSpecContext { - p := new(ServiceSpecContext) +func NewEmptyServiceApiContext() *ServiceApiContext { + var p = new(ServiceApiContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = ApiParserParserRULE_serviceSpec + p.RuleIndex = ApiParserParserRULE_serviceApi return p } -func (*ServiceSpecContext) IsServiceSpecContext() {} +func (*ServiceApiContext) IsServiceApiContext() {} -func NewServiceSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceSpecContext { - p := new(ServiceSpecContext) +func NewServiceApiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceApiContext { + var p = new(ServiceApiContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) p.parser = parser - p.RuleIndex = ApiParserParserRULE_serviceSpec + p.RuleIndex = ApiParserParserRULE_serviceApi return p } -func (s *ServiceSpecContext) GetParser() antlr.Parser { return s.parser } +func (s *ServiceApiContext) GetParser() antlr.Parser { return s.parser } + +func (s *ServiceApiContext) GetServiceToken() antlr.Token { return s.serviceToken } -func (s *ServiceSpecContext) ServiceApi() IServiceApiContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IServiceApiContext)(nil)).Elem(), 0) +func (s *ServiceApiContext) GetLbrace() antlr.Token { return s.lbrace } + +func (s *ServiceApiContext) GetRbrace() antlr.Token { return s.rbrace } + +func (s *ServiceApiContext) SetServiceToken(v antlr.Token) { s.serviceToken = v } + +func (s *ServiceApiContext) SetLbrace(v antlr.Token) { s.lbrace = v } + +func (s *ServiceApiContext) SetRbrace(v antlr.Token) { s.rbrace = v } + +func (s *ServiceApiContext) ServiceName() IServiceNameContext { + var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceNameContext)(nil)).Elem(), 0) if t == nil { return nil } - return t.(IServiceApiContext) + return t.(IServiceNameContext) +} + +func (s *ServiceApiContext) ID() antlr.TerminalNode { + return s.GetToken(ApiParserParserID, 0) +} + +func (s *ServiceApiContext) AllServiceRoute() []IServiceRouteContext { + var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IServiceRouteContext)(nil)).Elem()) + var tst = make([]IServiceRouteContext, len(ts)) + + for i, t := range ts { + if t != nil { + tst[i] = t.(IServiceRouteContext) + } + } + + return tst } -func (s *ServiceSpecContext) AtServer() IAtServerContext { - t := s.GetTypedRuleContext(reflect.TypeOf((*IAtServerContext)(nil)).Elem(), 0) +func (s *ServiceApiContext) ServiceRoute(i int) IServiceRouteContext { + var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceRouteContext)(nil)).Elem(), i) if t == nil { return nil } - return t.(IAtServerContext) + return t.(IServiceRouteContext) } -func (s *ServiceSpecContext) GetRuleContext() antlr.RuleContext { +func (s *ServiceApiContext) GetRuleContext() antlr.RuleContext { return s } -func (s *ServiceSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { +func (s *ServiceApiContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *ServiceSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { +func (s *ServiceApiContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: - return t.VisitServiceSpec(s) + return t.VisitServiceApi(s) default: return t.VisitChildren(s) } } -func (p *ApiParserParser) ServiceSpec() (localctx IServiceSpecContext) { - localctx = NewServiceSpecContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 50, ApiParserParserRULE_serviceSpec) +func (p *ApiParserParser) ServiceApi() (localctx IServiceApiContext) { + localctx = NewServiceApiContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 54, ApiParserParserRULE_serviceApi) var _la int defer func() { @@ -239,132 +298,149 @@ func (p *ApiParserParser) ServiceSpec() (localctx IServiceSpecContext) { }() p.EnterOuterAlt(localctx, 1) - p.SetState(238) + match(p, "service") + { + p.SetState(254) + + var _m = p.Match(ApiParserParserID) + + localctx.(*ServiceApiContext).serviceToken = _m + } + { + p.SetState(255) + p.ServiceName() + } + { + p.SetState(256) + + var _m = p.Match(ApiParserParserT__3) + + localctx.(*ServiceApiContext).lbrace = _m + } + p.SetState(260) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) - if _la == ApiParserParserATSERVER { + for ((_la)&-(0x1f+1)) == 0 && ((1<