diff --git a/tools/goctl/api/gogen/gen_test.go b/tools/goctl/api/gogen/gen_test.go index 434de035..68139428 100644 --- a/tools/goctl/api/gogen/gen_test.go +++ b/tools/goctl/api/gogen/gen_test.go @@ -78,7 +78,7 @@ service A-api { @server( handler: NoResponseHandler ) - get /greet/get(Request) returns + get /greet/get(Request) } ` diff --git a/tools/goctl/api/parser/g4/ApiParser.g4 b/tools/goctl/api/parser/g4/ApiParser.g4 index 1cce30d0..2f31447d 100644 --- a/tools/goctl/api/parser/g4/ApiParser.g4 +++ b/tools/goctl/api/parser/g4/ApiParser.g4 @@ -63,9 +63,9 @@ serviceApi: {match(p,"service")}serviceToken=ID serviceName lbrace='{' servi serviceRoute: atDoc? (atServer|atHandler) route; atDoc: ATDOC lp='('? ((kvLit+)|STRING) rp=')'?; atHandler: ATHANDLER ID; -route: {checkHTTPMethod(p)}httpMethod=ID path request=body? returnToken=ID? response=replybody?; +route: {checkHTTPMethod(p)}httpMethod=ID path request=body? response=replybody?; body: lp='(' (ID)? rp=')'; -replybody: lp='(' dataType? rp=')'; +replybody: returnToken='returns' lp='(' dataType? rp=')'; // kv kvLit: key=ID {checkKeyValue(p)}value=LINE_VALUE; diff --git a/tools/goctl/api/parser/g4/ast/ast.go b/tools/goctl/api/parser/g4/ast/ast.go index b166d2e7..2f708801 100644 --- a/tools/goctl/api/parser/g4/ast/ast.go +++ b/tools/goctl/api/parser/g4/ast/ast.go @@ -21,7 +21,7 @@ type ( // ApiVisitor wraps api.BaseApiParserVisitor to call methods which has prefix Visit to // visit node from the api syntax ApiVisitor struct { - api.BaseApiParserVisitor + *api.BaseApiParserVisitor debug bool log console.Console prefix string diff --git a/tools/goctl/api/parser/g4/ast/service.go b/tools/goctl/api/parser/g4/ast/service.go index e3eb8855..4c39509f 100644 --- a/tools/goctl/api/parser/g4/ast/service.go +++ b/tools/goctl/api/parser/g4/ast/service.go @@ -71,9 +71,10 @@ type Route struct { // Body describes request,response body ast for api syntax type Body struct { - Lp Expr - Rp Expr - Name DataType + ReturnExpr Expr + Lp Expr + Rp Expr + Name DataType } // VisitServiceSpec implements from api.BaseApiParserVisitor @@ -175,7 +176,7 @@ func (v *ApiVisitor) VisitAtHandler(ctx *api.AtHandlerContext) interface{} { return &atHandler } -// VisitRoute implements from api.BaseApiParserVisitor +// serVisitRoute implements from api.BaseApiParserVisitor func (v *ApiVisitor) VisitRoute(ctx *api.RouteContext) interface{} { var route Route path := ctx.Path() @@ -193,16 +194,12 @@ func (v *ApiVisitor) VisitRoute(ctx *api.RouteContext) interface{} { if ctx.GetResponse() != nil { reply := ctx.GetResponse().Accept(v) if reply != nil { - route.Reply = reply.(*Body) + resp := reply.(*Body) + route.ReturnToken = resp.ReturnExpr + resp.ReturnExpr = nil + route.Reply = resp } } - if ctx.GetReturnToken() != nil { - returnExpr := v.newExprWithToken(ctx.GetReturnToken()) - if ctx.GetReturnToken().GetText() != "returns" { - v.panic(returnExpr, fmt.Sprintf("expecting returns, found input '%s'", ctx.GetReturnToken().GetText())) - } - route.ReturnToken = returnExpr - } route.DocExpr = v.getDoc(ctx) route.CommentExpr = v.getComment(ctx) @@ -249,6 +246,14 @@ func (v *ApiVisitor) VisitReplybody(ctx *api.ReplybodyContext) interface{} { return nil } + var returnExpr Expr + if ctx.GetReturnToken() != nil { + returnExpr = v.newExprWithToken(ctx.GetReturnToken()) + if ctx.GetReturnToken().GetText() != "returns" { + v.panic(returnExpr, fmt.Sprintf("expecting returns, found input '%s'", ctx.GetReturnToken().GetText())) + } + } + dt := ctx.DataType().Accept(v).(DataType) if dt == nil { return nil @@ -275,9 +280,10 @@ func (v *ApiVisitor) VisitReplybody(ctx *api.ReplybodyContext) interface{} { } return &Body{ - Lp: v.newExprWithToken(ctx.GetLp()), - Rp: v.newExprWithToken(ctx.GetRp()), - Name: dt, + ReturnExpr: returnExpr, + Lp: v.newExprWithToken(ctx.GetLp()), + Rp: v.newExprWithToken(ctx.GetRp()), + Name: dt, } } 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 1651d432..14de43f8 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 @@ -1,3 +1,4 @@ + package api // ApiParser import "github.com/zeromicro/antlr" 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 b790bc53..2e0413f0 100644 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go @@ -1,143 +1,146 @@ package api - import ( "fmt" "unicode" "github.com/zeromicro/antlr" ) - // Suppress unused import error var _ = fmt.Printf var _ = unicode.IsLetter + var serializedLexerAtn = []uint16{ - 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 25, 266, - 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, - 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, 3, 2, 3, 2, 3, 3, 3, 3, 3, - 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, - 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, - 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, - 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, - 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, - 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, 6, 18, 132, - 10, 18, 13, 18, 14, 18, 133, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 19, - 7, 19, 142, 10, 19, 12, 19, 14, 19, 145, 11, 19, 3, 19, 3, 19, 3, 19, 3, - 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 7, 20, 156, 10, 20, 12, 20, 14, - 20, 159, 11, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 7, 21, 166, 10, 21, - 12, 21, 14, 21, 169, 11, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 6, 22, - 176, 10, 22, 13, 22, 14, 22, 177, 3, 22, 3, 22, 3, 23, 3, 23, 7, 23, 184, - 10, 23, 12, 23, 14, 23, 187, 11, 23, 3, 23, 3, 23, 7, 23, 191, 10, 23, - 12, 23, 14, 23, 194, 11, 23, 5, 23, 196, 10, 23, 3, 24, 3, 24, 7, 24, 200, - 10, 24, 12, 24, 14, 24, 203, 11, 24, 3, 25, 3, 25, 5, 25, 207, 10, 25, - 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 5, 26, 215, 10, 26, 3, 26, 5, - 26, 218, 10, 26, 3, 26, 3, 26, 3, 26, 6, 26, 223, 10, 26, 13, 26, 14, 26, - 224, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 5, 26, 232, 10, 26, 3, 27, 3, 27, - 3, 27, 7, 27, 237, 10, 27, 12, 27, 14, 27, 240, 11, 27, 3, 27, 5, 27, 243, - 10, 27, 3, 28, 3, 28, 3, 29, 3, 29, 7, 29, 249, 10, 29, 12, 29, 14, 29, - 252, 11, 29, 3, 29, 5, 29, 255, 10, 29, 3, 30, 3, 30, 5, 30, 259, 10, 30, - 3, 31, 3, 31, 3, 31, 3, 31, 5, 31, 265, 10, 31, 3, 143, 2, 32, 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, 2, 51, 2, 53, 2, 55, 2, 57, 2, 59, 2, 61, 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, - 283, 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, 3, 63, 3, 2, 2, 2, 5, 65, 3, 2, 2, 2, 7, 67, 3, 2, 2, 2, 9, 69, 3, 2, - 2, 2, 11, 71, 3, 2, 2, 2, 13, 73, 3, 2, 2, 2, 15, 75, 3, 2, 2, 2, 17, 85, - 3, 2, 2, 2, 19, 87, 3, 2, 2, 2, 21, 89, 3, 2, 2, 2, 23, 91, 3, 2, 2, 2, - 25, 93, 3, 2, 2, 2, 27, 96, 3, 2, 2, 2, 29, 101, 3, 2, 2, 2, 31, 110, 3, - 2, 2, 2, 33, 122, 3, 2, 2, 2, 35, 131, 3, 2, 2, 2, 37, 137, 3, 2, 2, 2, - 39, 151, 3, 2, 2, 2, 41, 162, 3, 2, 2, 2, 43, 172, 3, 2, 2, 2, 45, 181, - 3, 2, 2, 2, 47, 197, 3, 2, 2, 2, 49, 204, 3, 2, 2, 2, 51, 231, 3, 2, 2, - 2, 53, 233, 3, 2, 2, 2, 55, 244, 3, 2, 2, 2, 57, 246, 3, 2, 2, 2, 59, 258, - 3, 2, 2, 2, 61, 264, 3, 2, 2, 2, 63, 64, 7, 63, 2, 2, 64, 4, 3, 2, 2, 2, - 65, 66, 7, 42, 2, 2, 66, 6, 3, 2, 2, 2, 67, 68, 7, 43, 2, 2, 68, 8, 3, - 2, 2, 2, 69, 70, 7, 125, 2, 2, 70, 10, 3, 2, 2, 2, 71, 72, 7, 127, 2, 2, - 72, 12, 3, 2, 2, 2, 73, 74, 7, 44, 2, 2, 74, 14, 3, 2, 2, 2, 75, 76, 7, - 118, 2, 2, 76, 77, 7, 107, 2, 2, 77, 78, 7, 111, 2, 2, 78, 79, 7, 103, - 2, 2, 79, 80, 7, 48, 2, 2, 80, 81, 7, 86, 2, 2, 81, 82, 7, 107, 2, 2, 82, - 83, 7, 111, 2, 2, 83, 84, 7, 103, 2, 2, 84, 16, 3, 2, 2, 2, 85, 86, 7, - 93, 2, 2, 86, 18, 3, 2, 2, 2, 87, 88, 7, 95, 2, 2, 88, 20, 3, 2, 2, 2, - 89, 90, 7, 47, 2, 2, 90, 22, 3, 2, 2, 2, 91, 92, 7, 49, 2, 2, 92, 24, 3, - 2, 2, 2, 93, 94, 7, 49, 2, 2, 94, 95, 7, 60, 2, 2, 95, 26, 3, 2, 2, 2, - 96, 97, 7, 66, 2, 2, 97, 98, 7, 102, 2, 2, 98, 99, 7, 113, 2, 2, 99, 100, - 7, 101, 2, 2, 100, 28, 3, 2, 2, 2, 101, 102, 7, 66, 2, 2, 102, 103, 7, - 106, 2, 2, 103, 104, 7, 99, 2, 2, 104, 105, 7, 112, 2, 2, 105, 106, 7, - 102, 2, 2, 106, 107, 7, 110, 2, 2, 107, 108, 7, 103, 2, 2, 108, 109, 7, - 116, 2, 2, 109, 30, 3, 2, 2, 2, 110, 111, 7, 107, 2, 2, 111, 112, 7, 112, - 2, 2, 112, 113, 7, 118, 2, 2, 113, 114, 7, 103, 2, 2, 114, 115, 7, 116, - 2, 2, 115, 116, 7, 104, 2, 2, 116, 117, 7, 99, 2, 2, 117, 118, 7, 101, - 2, 2, 118, 119, 7, 103, 2, 2, 119, 120, 7, 125, 2, 2, 120, 121, 7, 127, - 2, 2, 121, 32, 3, 2, 2, 2, 122, 123, 7, 66, 2, 2, 123, 124, 7, 117, 2, - 2, 124, 125, 7, 103, 2, 2, 125, 126, 7, 116, 2, 2, 126, 127, 7, 120, 2, - 2, 127, 128, 7, 103, 2, 2, 128, 129, 7, 116, 2, 2, 129, 34, 3, 2, 2, 2, - 130, 132, 9, 2, 2, 2, 131, 130, 3, 2, 2, 2, 132, 133, 3, 2, 2, 2, 133, - 131, 3, 2, 2, 2, 133, 134, 3, 2, 2, 2, 134, 135, 3, 2, 2, 2, 135, 136, - 8, 18, 2, 2, 136, 36, 3, 2, 2, 2, 137, 138, 7, 49, 2, 2, 138, 139, 7, 44, - 2, 2, 139, 143, 3, 2, 2, 2, 140, 142, 11, 2, 2, 2, 141, 140, 3, 2, 2, 2, - 142, 145, 3, 2, 2, 2, 143, 144, 3, 2, 2, 2, 143, 141, 3, 2, 2, 2, 144, - 146, 3, 2, 2, 2, 145, 143, 3, 2, 2, 2, 146, 147, 7, 44, 2, 2, 147, 148, - 7, 49, 2, 2, 148, 149, 3, 2, 2, 2, 149, 150, 8, 19, 3, 2, 150, 38, 3, 2, - 2, 2, 151, 152, 7, 49, 2, 2, 152, 153, 7, 49, 2, 2, 153, 157, 3, 2, 2, - 2, 154, 156, 10, 3, 2, 2, 155, 154, 3, 2, 2, 2, 156, 159, 3, 2, 2, 2, 157, - 155, 3, 2, 2, 2, 157, 158, 3, 2, 2, 2, 158, 160, 3, 2, 2, 2, 159, 157, - 3, 2, 2, 2, 160, 161, 8, 20, 3, 2, 161, 40, 3, 2, 2, 2, 162, 167, 7, 36, - 2, 2, 163, 166, 10, 4, 2, 2, 164, 166, 5, 51, 26, 2, 165, 163, 3, 2, 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, - 7, 36, 2, 2, 171, 42, 3, 2, 2, 2, 172, 175, 7, 98, 2, 2, 173, 176, 10, - 5, 2, 2, 174, 176, 5, 51, 26, 2, 175, 173, 3, 2, 2, 2, 175, 174, 3, 2, - 2, 2, 176, 177, 3, 2, 2, 2, 177, 175, 3, 2, 2, 2, 177, 178, 3, 2, 2, 2, - 178, 179, 3, 2, 2, 2, 179, 180, 7, 98, 2, 2, 180, 44, 3, 2, 2, 2, 181, - 185, 7, 60, 2, 2, 182, 184, 9, 6, 2, 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, 195, 3, 2, - 2, 2, 187, 185, 3, 2, 2, 2, 188, 196, 5, 41, 21, 2, 189, 191, 10, 7, 2, - 2, 190, 189, 3, 2, 2, 2, 191, 194, 3, 2, 2, 2, 192, 190, 3, 2, 2, 2, 192, - 193, 3, 2, 2, 2, 193, 196, 3, 2, 2, 2, 194, 192, 3, 2, 2, 2, 195, 188, - 3, 2, 2, 2, 195, 192, 3, 2, 2, 2, 196, 46, 3, 2, 2, 2, 197, 201, 5, 61, - 31, 2, 198, 200, 5, 59, 30, 2, 199, 198, 3, 2, 2, 2, 200, 203, 3, 2, 2, - 2, 201, 199, 3, 2, 2, 2, 201, 202, 3, 2, 2, 2, 202, 48, 3, 2, 2, 2, 203, - 201, 3, 2, 2, 2, 204, 206, 9, 8, 2, 2, 205, 207, 9, 9, 2, 2, 206, 205, - 3, 2, 2, 2, 206, 207, 3, 2, 2, 2, 207, 208, 3, 2, 2, 2, 208, 209, 5, 57, - 29, 2, 209, 50, 3, 2, 2, 2, 210, 211, 7, 94, 2, 2, 211, 232, 9, 10, 2, - 2, 212, 217, 7, 94, 2, 2, 213, 215, 9, 11, 2, 2, 214, 213, 3, 2, 2, 2, - 214, 215, 3, 2, 2, 2, 215, 216, 3, 2, 2, 2, 216, 218, 9, 12, 2, 2, 217, - 214, 3, 2, 2, 2, 217, 218, 3, 2, 2, 2, 218, 219, 3, 2, 2, 2, 219, 232, - 9, 12, 2, 2, 220, 222, 7, 94, 2, 2, 221, 223, 7, 119, 2, 2, 222, 221, 3, - 2, 2, 2, 223, 224, 3, 2, 2, 2, 224, 222, 3, 2, 2, 2, 224, 225, 3, 2, 2, - 2, 225, 226, 3, 2, 2, 2, 226, 227, 5, 55, 28, 2, 227, 228, 5, 55, 28, 2, - 228, 229, 5, 55, 28, 2, 229, 230, 5, 55, 28, 2, 230, 232, 3, 2, 2, 2, 231, - 210, 3, 2, 2, 2, 231, 212, 3, 2, 2, 2, 231, 220, 3, 2, 2, 2, 232, 52, 3, - 2, 2, 2, 233, 242, 5, 55, 28, 2, 234, 237, 5, 55, 28, 2, 235, 237, 7, 97, - 2, 2, 236, 234, 3, 2, 2, 2, 236, 235, 3, 2, 2, 2, 237, 240, 3, 2, 2, 2, - 238, 236, 3, 2, 2, 2, 238, 239, 3, 2, 2, 2, 239, 241, 3, 2, 2, 2, 240, - 238, 3, 2, 2, 2, 241, 243, 5, 55, 28, 2, 242, 238, 3, 2, 2, 2, 242, 243, - 3, 2, 2, 2, 243, 54, 3, 2, 2, 2, 244, 245, 9, 13, 2, 2, 245, 56, 3, 2, - 2, 2, 246, 254, 9, 14, 2, 2, 247, 249, 9, 15, 2, 2, 248, 247, 3, 2, 2, - 2, 249, 252, 3, 2, 2, 2, 250, 248, 3, 2, 2, 2, 250, 251, 3, 2, 2, 2, 251, - 253, 3, 2, 2, 2, 252, 250, 3, 2, 2, 2, 253, 255, 9, 14, 2, 2, 254, 250, - 3, 2, 2, 2, 254, 255, 3, 2, 2, 2, 255, 58, 3, 2, 2, 2, 256, 259, 5, 61, - 31, 2, 257, 259, 9, 14, 2, 2, 258, 256, 3, 2, 2, 2, 258, 257, 3, 2, 2, - 2, 259, 60, 3, 2, 2, 2, 260, 265, 9, 16, 2, 2, 261, 265, 10, 17, 2, 2, - 262, 263, 9, 18, 2, 2, 263, 265, 9, 19, 2, 2, 264, 260, 3, 2, 2, 2, 264, - 261, 3, 2, 2, 2, 264, 262, 3, 2, 2, 2, 265, 62, 3, 2, 2, 2, 26, 2, 133, - 143, 157, 165, 167, 175, 177, 185, 192, 195, 201, 206, 214, 217, 224, 231, - 236, 238, 242, 250, 254, 258, 264, 4, 2, 3, 2, 2, 90, 2, + 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 26, 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, + 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, 3, 2, 3, 2, + 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, + 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, + 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, + 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16, + 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, + 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, + 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 19, 6, 19, 142, 10, + 19, 13, 19, 14, 19, 143, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 7, 20, + 152, 10, 20, 12, 20, 14, 20, 155, 11, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, + 20, 3, 21, 3, 21, 3, 21, 3, 21, 7, 21, 166, 10, 21, 12, 21, 14, 21, 169, + 11, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 7, 22, 176, 10, 22, 12, 22, + 14, 22, 179, 11, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 6, 23, 186, 10, + 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, } var lexerChannelNames = []string{ @@ -149,28 +152,28 @@ var lexerModeNames = []string{ } var lexerLiteralNames = []string{ - "", "'='", "'('", "')'", "'{'", "'}'", "'*'", "'time.Time'", "'['", "']'", - "'-'", "'/'", "'/:'", "'@doc'", "'@handler'", "'interface{}'", "'@server'", + "", "'='", "'('", "')'", "'{'", "'}'", "'*'", "'time.Time'", "'['", "']'", + "'returns'", "'-'", "'/'", "'/:'", "'@doc'", "'@handler'", "'interface{}'", + "'@server'", } var lexerSymbolicNames = []string{ - "", "", "", "", "", "", "", "", "", "", "", "", "", "ATDOC", "ATHANDLER", - "INTERFACE", "ATSERVER", "WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "ATDOC", "ATHANDLER", + "INTERFACE", "ATSERVER", "WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING", "LINE_VALUE", "ID", } 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", "ATDOC", "ATHANDLER", "INTERFACE", "ATSERVER", - "WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING", "LINE_VALUE", - "ID", "ExponentPart", "EscapeSequence", "HexDigits", "HexDigit", "Digits", + "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", } - type ApiParserLexer struct { *antlr.BaseLexer channelNames []string - modeNames []string + modeNames []string // TODO: EOF string } @@ -204,29 +207,34 @@ 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 - ApiParserLexerATDOC = 13 - ApiParserLexerATHANDLER = 14 - ApiParserLexerINTERFACE = 15 - ApiParserLexerATSERVER = 16 - ApiParserLexerWS = 17 - ApiParserLexerCOMMENT = 18 - ApiParserLexerLINE_COMMENT = 19 - ApiParserLexerSTRING = 20 - ApiParserLexerRAW_STRING = 21 - ApiParserLexerLINE_VALUE = 22 - ApiParserLexerID = 23 + 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 ) -const COMEMNTS = 88 + + 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 ac37580a..f82f965d 100755 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser.go @@ -12,180 +12,180 @@ var _ = fmt.Printf var _ = reflect.Copy var _ = strconv.Itoa + var parserATN = []uint16{ - 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 25, 351, - 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, 33, 5, 33, 303, 10, 33, 3, 34, 3, 34, - 5, 34, 307, 10, 34, 3, 34, 3, 34, 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, 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, 361, 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, 304, 3, 2, 2, - 2, 68, 310, 3, 2, 2, 2, 70, 316, 3, 2, 2, 2, 72, 324, 3, 2, 2, 2, 74, 348, - 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, 25, 2, 2, 91, 92, 7, 3, 2, - 2, 92, 93, 8, 4, 1, 2, 93, 94, 7, 22, 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, 25, 2, 2, 101, - 102, 5, 16, 9, 2, 102, 11, 3, 2, 2, 2, 103, 104, 8, 7, 1, 2, 104, 105, - 7, 25, 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, 22, 2, 2, 117, 17, 3, 2, 2, 2, 118, 119, 8, 10, 1, 2, 119, 120, 7, 25, - 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, 25, 2, 2, - 134, 135, 5, 26, 14, 2, 135, 23, 3, 2, 2, 2, 136, 137, 8, 13, 1, 2, 137, - 138, 7, 25, 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, 25, 2, 2, - 157, 159, 7, 25, 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, 25, 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, 25, 2, 2, 178, 180, 7, 25, 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, 25, 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, 25, 2, 2, 204, 206, 5, 44, 23, 2, - 205, 207, 7, 23, 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, 25, 2, 2, 212, 43, 3, 2, 2, - 2, 213, 214, 8, 23, 1, 2, 214, 222, 7, 25, 2, 2, 215, 222, 5, 48, 25, 2, - 216, 222, 5, 50, 26, 2, 217, 222, 7, 17, 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, 25, 2, 2, 226, - 47, 3, 2, 2, 2, 227, 228, 8, 25, 1, 2, 228, 229, 7, 25, 2, 2, 229, 230, - 7, 10, 2, 2, 230, 231, 8, 25, 1, 2, 231, 232, 7, 25, 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, 18, 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, 25, 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, 15, 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, 22, - 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, 16, 2, 2, 290, 291, 7, 25, 2, 2, 291, 63, - 3, 2, 2, 2, 292, 293, 8, 33, 1, 2, 293, 294, 7, 25, 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, 7, 25, 2, 2, 299, 298, 3, 2, 2, 2, - 299, 300, 3, 2, 2, 2, 300, 302, 3, 2, 2, 2, 301, 303, 5, 68, 35, 2, 302, - 301, 3, 2, 2, 2, 302, 303, 3, 2, 2, 2, 303, 65, 3, 2, 2, 2, 304, 306, 7, - 4, 2, 2, 305, 307, 7, 25, 2, 2, 306, 305, 3, 2, 2, 2, 306, 307, 3, 2, 2, - 2, 307, 308, 3, 2, 2, 2, 308, 309, 7, 5, 2, 2, 309, 67, 3, 2, 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, 25, 2, 2, 317, 318, 8, 36, 1, 2, 318, 319, 7, 24, 2, - 2, 319, 71, 3, 2, 2, 2, 320, 322, 7, 25, 2, 2, 321, 323, 7, 12, 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, 13, 2, 2, 329, 334, 7, 25, 2, 2, - 330, 331, 7, 12, 2, 2, 331, 333, 7, 25, 2, 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, 14, 2, 2, 338, 341, 7, 25, - 2, 2, 339, 340, 7, 12, 2, 2, 340, 342, 7, 25, 2, 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, 13, 2, 2, 348, 343, 3, 2, - 2, 2, 348, 347, 3, 2, 2, 2, 349, 75, 3, 2, 2, 2, 42, 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, 302, 306, 312, 322, 326, - 334, 341, 343, 345, 348, + 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 26, 349, + 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, } var literalNames = []string{ - "", "'='", "'('", "')'", "'{'", "'}'", "'*'", "'time.Time'", "'['", "']'", - "'-'", "'/'", "'/:'", "'@doc'", "'@handler'", "'interface{}'", "'@server'", + "", "'='", "'('", "')'", "'{'", "'}'", "'*'", "'time.Time'", "'['", "']'", + "'returns'", "'-'", "'/'", "'/:'", "'@doc'", "'@handler'", "'interface{}'", + "'@server'", } var symbolicNames = []string{ - "", "", "", "", "", "", "", "", "", "", "", "", "", "ATDOC", "ATHANDLER", - "INTERFACE", "ATSERVER", "WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "ATDOC", "ATHANDLER", + "INTERFACE", "ATSERVER", "WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING", "LINE_VALUE", "ID", } var ruleNames = []string{ - "api", "spec", "syntaxLit", "importSpec", "importLit", "importBlock", "importBlockValue", - "importValue", "infoSpec", "typeSpec", "typeLit", "typeBlock", "typeLitBody", - "typeBlockBody", "typeStruct", "typeAlias", "typeBlockStruct", "typeBlockAlias", - "field", "normalField", "anonymousFiled", "dataType", "pointerType", "mapType", - "arrayType", "serviceSpec", "atServer", "serviceApi", "serviceRoute", "atDoc", + "api", "spec", "syntaxLit", "importSpec", "importLit", "importBlock", "importBlockValue", + "importValue", "infoSpec", "typeSpec", "typeLit", "typeBlock", "typeLitBody", + "typeBlockBody", "typeStruct", "typeAlias", "typeBlockStruct", "typeBlockAlias", + "field", "normalField", "anonymousFiled", "dataType", "pointerType", "mapType", + "arrayType", "serviceSpec", "atServer", "serviceApi", "serviceRoute", "atDoc", "atHandler", "route", "body", "replybody", "kvLit", "serviceName", "path", } - type ApiParserParser struct { *antlr.BaseParser } @@ -215,73 +215,75 @@ func NewApiParserParser(input antlr.TokenStream) *ApiParserParser { return this } + // 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 - ApiParserParserATDOC = 13 - ApiParserParserATHANDLER = 14 - ApiParserParserINTERFACE = 15 - ApiParserParserATSERVER = 16 - ApiParserParserWS = 17 - ApiParserParserCOMMENT = 18 - ApiParserParserLINE_COMMENT = 19 - ApiParserParserSTRING = 20 - ApiParserParserRAW_STRING = 21 - ApiParserParserLINE_VALUE = 22 - ApiParserParserID = 23 + 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 ) // ApiParserParser rules. const ( - ApiParserParserRULE_api = 0 - ApiParserParserRULE_spec = 1 - ApiParserParserRULE_syntaxLit = 2 - ApiParserParserRULE_importSpec = 3 - ApiParserParserRULE_importLit = 4 - ApiParserParserRULE_importBlock = 5 + ApiParserParserRULE_api = 0 + ApiParserParserRULE_spec = 1 + ApiParserParserRULE_syntaxLit = 2 + ApiParserParserRULE_importSpec = 3 + ApiParserParserRULE_importLit = 4 + ApiParserParserRULE_importBlock = 5 ApiParserParserRULE_importBlockValue = 6 - ApiParserParserRULE_importValue = 7 - ApiParserParserRULE_infoSpec = 8 - ApiParserParserRULE_typeSpec = 9 - ApiParserParserRULE_typeLit = 10 - ApiParserParserRULE_typeBlock = 11 - ApiParserParserRULE_typeLitBody = 12 - ApiParserParserRULE_typeBlockBody = 13 - ApiParserParserRULE_typeStruct = 14 - ApiParserParserRULE_typeAlias = 15 - ApiParserParserRULE_typeBlockStruct = 16 - ApiParserParserRULE_typeBlockAlias = 17 - ApiParserParserRULE_field = 18 - ApiParserParserRULE_normalField = 19 - ApiParserParserRULE_anonymousFiled = 20 - ApiParserParserRULE_dataType = 21 - ApiParserParserRULE_pointerType = 22 - ApiParserParserRULE_mapType = 23 - ApiParserParserRULE_arrayType = 24 - ApiParserParserRULE_serviceSpec = 25 - ApiParserParserRULE_atServer = 26 - ApiParserParserRULE_serviceApi = 27 - ApiParserParserRULE_serviceRoute = 28 - ApiParserParserRULE_atDoc = 29 - ApiParserParserRULE_atHandler = 30 - ApiParserParserRULE_route = 31 - ApiParserParserRULE_body = 32 - ApiParserParserRULE_replybody = 33 - ApiParserParserRULE_kvLit = 34 - ApiParserParserRULE_serviceName = 35 - ApiParserParserRULE_path = 36 + ApiParserParserRULE_importValue = 7 + ApiParserParserRULE_infoSpec = 8 + ApiParserParserRULE_typeSpec = 9 + ApiParserParserRULE_typeLit = 10 + ApiParserParserRULE_typeBlock = 11 + ApiParserParserRULE_typeLitBody = 12 + ApiParserParserRULE_typeBlockBody = 13 + ApiParserParserRULE_typeStruct = 14 + ApiParserParserRULE_typeAlias = 15 + ApiParserParserRULE_typeBlockStruct = 16 + ApiParserParserRULE_typeBlockAlias = 17 + ApiParserParserRULE_field = 18 + ApiParserParserRULE_normalField = 19 + ApiParserParserRULE_anonymousFiled = 20 + ApiParserParserRULE_dataType = 21 + ApiParserParserRULE_pointerType = 22 + ApiParserParserRULE_mapType = 23 + ApiParserParserRULE_arrayType = 24 + ApiParserParserRULE_serviceSpec = 25 + ApiParserParserRULE_atServer = 26 + ApiParserParserRULE_serviceApi = 27 + ApiParserParserRULE_serviceRoute = 28 + ApiParserParserRULE_atDoc = 29 + ApiParserParserRULE_atHandler = 30 + ApiParserParserRULE_route = 31 + ApiParserParserRULE_body = 32 + ApiParserParserRULE_replybody = 33 + ApiParserParserRULE_kvLit = 34 + ApiParserParserRULE_serviceName = 35 + ApiParserParserRULE_path = 36 ) // IApiContext is an interface to support dynamic dispatch. @@ -353,6 +355,7 @@ func (s *ApiContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) st return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *ApiContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -363,11 +366,15 @@ func (s *ApiContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) Api() (localctx IApiContext) { localctx = NewApiContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 0, ApiParserParserRULE_api) var _la int + defer func() { p.ExitRule() }() @@ -389,20 +396,25 @@ func (p *ApiParserParser) Api() (localctx IApiContext) { p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) + for _la == ApiParserParserATSERVER || _la == ApiParserParserID { { p.SetState(74) p.Spec() } + p.SetState(79) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) } + + return localctx } + // ISpecContext is an interface to support dynamic dispatch. type ISpecContext interface { antlr.ParserRuleContext @@ -499,6 +511,7 @@ func (s *SpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) s return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *SpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -509,6 +522,9 @@ func (s *SpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) Spec() (localctx ISpecContext) { localctx = NewSpecContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 2, ApiParserParserRULE_spec) @@ -539,6 +555,7 @@ func (p *ApiParserParser) Spec() (localctx ISpecContext) { p.SyntaxLit() } + case 2: p.EnterOuterAlt(localctx, 2) { @@ -546,6 +563,7 @@ func (p *ApiParserParser) Spec() (localctx ISpecContext) { p.ImportSpec() } + case 3: p.EnterOuterAlt(localctx, 3) { @@ -553,6 +571,7 @@ func (p *ApiParserParser) Spec() (localctx ISpecContext) { p.InfoSpec() } + case 4: p.EnterOuterAlt(localctx, 4) { @@ -560,6 +579,7 @@ func (p *ApiParserParser) Spec() (localctx ISpecContext) { p.TypeSpec() } + case 5: p.EnterOuterAlt(localctx, 5) { @@ -569,9 +589,11 @@ func (p *ApiParserParser) Spec() (localctx ISpecContext) { } + return localctx } + // ISyntaxLitContext is an interface to support dynamic dispatch. type ISyntaxLitContext interface { antlr.ParserRuleContext @@ -580,22 +602,24 @@ type ISyntaxLitContext interface { GetParser() antlr.Parser // GetSyntaxToken returns the syntaxToken token. - GetSyntaxToken() antlr.Token + GetSyntaxToken() antlr.Token // GetAssign returns the assign token. - GetAssign() antlr.Token + GetAssign() antlr.Token // GetVersion returns the version token. - GetVersion() antlr.Token + GetVersion() antlr.Token + // SetSyntaxToken sets the syntaxToken token. - SetSyntaxToken(antlr.Token) + SetSyntaxToken(antlr.Token) // SetAssign sets the assign token. - SetAssign(antlr.Token) + SetAssign(antlr.Token) // SetVersion sets the version token. - SetVersion(antlr.Token) + SetVersion(antlr.Token) + // IsSyntaxLitContext differentiates from other interfaces. IsSyntaxLitContext() @@ -603,10 +627,10 @@ type ISyntaxLitContext interface { type SyntaxLitContext struct { *antlr.BaseParserRuleContext - parser antlr.Parser + parser antlr.Parser syntaxToken antlr.Token - assign antlr.Token - version antlr.Token + assign antlr.Token + version antlr.Token } func NewEmptySyntaxLitContext() *SyntaxLitContext { 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 33795b86..d17a5984 100755 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser1.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser1.go @@ -18,12 +18,14 @@ 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) } @@ -40,6 +42,7 @@ func (s *SyntaxLitContext) ToStringTree(ruleNames []string, recog antlr.Recogniz return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *SyntaxLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -50,6 +53,9 @@ func (s *SyntaxLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) SyntaxLit() (localctx ISyntaxLitContext) { localctx = NewSyntaxLitContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 4, ApiParserParserRULE_syntaxLit) @@ -71,7 +77,7 @@ func (p *ApiParserParser) SyntaxLit() (localctx ISyntaxLitContext) { }() p.EnterOuterAlt(localctx, 1) - match(p, "syntax") + match(p,"syntax") { p.SetState(88) @@ -95,9 +101,12 @@ func (p *ApiParserParser) SyntaxLit() (localctx ISyntaxLitContext) { localctx.(*SyntaxLitContext).version = _m } + + return localctx } + // IImportSpecContext is an interface to support dynamic dispatch. type IImportSpecContext interface { antlr.ParserRuleContext @@ -164,6 +173,7 @@ func (s *ImportSpecContext) ToStringTree(ruleNames []string, recog antlr.Recogni return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *ImportSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -174,6 +184,9 @@ func (s *ImportSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) ImportSpec() (localctx IImportSpecContext) { localctx = NewImportSpecContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 6, ApiParserParserRULE_importSpec) @@ -204,6 +217,7 @@ func (p *ApiParserParser) ImportSpec() (localctx IImportSpecContext) { p.ImportLit() } + case 2: p.EnterOuterAlt(localctx, 2) { @@ -213,9 +227,11 @@ func (p *ApiParserParser) ImportSpec() (localctx IImportSpecContext) { } + return localctx } + // IImportLitContext is an interface to support dynamic dispatch. type IImportLitContext interface { antlr.ParserRuleContext @@ -226,16 +242,18 @@ type IImportLitContext interface { // GetImportToken returns the importToken token. GetImportToken() antlr.Token + // SetImportToken sets the importToken token. SetImportToken(antlr.Token) + // IsImportLitContext differentiates from other interfaces. IsImportLitContext() } type ImportLitContext struct { *antlr.BaseParserRuleContext - parser antlr.Parser + parser antlr.Parser importToken antlr.Token } @@ -263,8 +281,10 @@ func (s *ImportLitContext) GetParser() antlr.Parser { return s.parser } func (s *ImportLitContext) GetImportToken() antlr.Token { return s.importToken } + func (s *ImportLitContext) SetImportToken(v antlr.Token) { s.importToken = v } + func (s *ImportLitContext) ImportValue() IImportValueContext { var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportValueContext)(nil)).Elem(), 0) @@ -287,6 +307,7 @@ func (s *ImportLitContext) ToStringTree(ruleNames []string, recog antlr.Recogniz return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *ImportLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -297,6 +318,9 @@ func (s *ImportLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) ImportLit() (localctx IImportLitContext) { localctx = NewImportLitContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 8, ApiParserParserRULE_importLit) @@ -318,7 +342,7 @@ func (p *ApiParserParser) ImportLit() (localctx IImportLitContext) { }() p.EnterOuterAlt(localctx, 1) - match(p, "import") + match(p,"import") { p.SetState(98) @@ -331,9 +355,12 @@ func (p *ApiParserParser) ImportLit() (localctx IImportLitContext) { p.ImportValue() } + + return localctx } + // IImportBlockContext is an interface to support dynamic dispatch. type IImportBlockContext interface { antlr.ParserRuleContext @@ -344,16 +371,18 @@ type IImportBlockContext interface { // GetImportToken returns the importToken token. GetImportToken() antlr.Token + // SetImportToken sets the importToken token. SetImportToken(antlr.Token) + // IsImportBlockContext differentiates from other interfaces. IsImportBlockContext() } type ImportBlockContext struct { *antlr.BaseParserRuleContext - parser antlr.Parser + parser antlr.Parser importToken antlr.Token } @@ -381,8 +410,10 @@ func (s *ImportBlockContext) GetParser() antlr.Parser { return s.parser } func (s *ImportBlockContext) GetImportToken() antlr.Token { return s.importToken } + func (s *ImportBlockContext) SetImportToken(v antlr.Token) { s.importToken = v } + func (s *ImportBlockContext) ID() antlr.TerminalNode { return s.GetToken(ApiParserParserID, 0) } @@ -418,6 +449,7 @@ func (s *ImportBlockContext) ToStringTree(ruleNames []string, recog antlr.Recogn return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *ImportBlockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -428,11 +460,15 @@ func (s *ImportBlockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} } } + + + func (p *ApiParserParser) ImportBlock() (localctx IImportBlockContext) { localctx = NewImportBlockContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 10, ApiParserParserRULE_importBlock) var _la int + defer func() { p.ExitRule() }() @@ -450,7 +486,7 @@ func (p *ApiParserParser) ImportBlock() (localctx IImportBlockContext) { }() p.EnterOuterAlt(localctx, 1) - match(p, "import") + match(p,"import") { p.SetState(102) @@ -471,6 +507,7 @@ func (p *ApiParserParser) ImportBlock() (localctx IImportBlockContext) { p.ImportBlockValue() } + p.SetState(107) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) @@ -480,9 +517,12 @@ func (p *ApiParserParser) ImportBlock() (localctx IImportBlockContext) { p.Match(ApiParserParserT__2) } + + return localctx } + // IImportBlockValueContext is an interface to support dynamic dispatch. type IImportBlockValueContext interface { antlr.ParserRuleContext @@ -539,6 +579,7 @@ func (s *ImportBlockValueContext) ToStringTree(ruleNames []string, recog antlr.R return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *ImportBlockValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -549,6 +590,9 @@ func (s *ImportBlockValueContext) Accept(visitor antlr.ParseTreeVisitor) interfa } } + + + func (p *ApiParserParser) ImportBlockValue() (localctx IImportBlockValueContext) { localctx = NewImportBlockValueContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 12, ApiParserParserRULE_importBlockValue) @@ -575,9 +619,12 @@ func (p *ApiParserParser) ImportBlockValue() (localctx IImportBlockValueContext) p.ImportValue() } + + return localctx } + // IImportValueContext is an interface to support dynamic dispatch. type IImportValueContext interface { antlr.ParserRuleContext 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 b7325b2b..fc067f30 100755 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser2.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser2.go @@ -24,6 +24,7 @@ func (s *ImportValueContext) ToStringTree(ruleNames []string, recog antlr.Recogn return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *ImportValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -34,6 +35,9 @@ func (s *ImportValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} } } + + + func (p *ApiParserParser) ImportValue() (localctx IImportValueContext) { localctx = NewImportValueContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 14, ApiParserParserRULE_importValue) @@ -61,9 +65,12 @@ func (p *ApiParserParser) ImportValue() (localctx IImportValueContext) { p.Match(ApiParserParserSTRING) } + + return localctx } + // IInfoSpecContext is an interface to support dynamic dispatch. type IInfoSpecContext interface { antlr.ParserRuleContext @@ -72,22 +79,24 @@ type IInfoSpecContext interface { GetParser() antlr.Parser // GetInfoToken returns the infoToken token. - GetInfoToken() antlr.Token + GetInfoToken() antlr.Token // GetLp returns the lp token. - GetLp() antlr.Token + GetLp() antlr.Token // GetRp returns the rp token. - GetRp() antlr.Token + GetRp() antlr.Token + // SetInfoToken sets the infoToken token. - SetInfoToken(antlr.Token) + SetInfoToken(antlr.Token) // SetLp sets the lp token. - SetLp(antlr.Token) + SetLp(antlr.Token) // SetRp sets the rp token. - SetRp(antlr.Token) + SetRp(antlr.Token) + // IsInfoSpecContext differentiates from other interfaces. IsInfoSpecContext() @@ -95,10 +104,10 @@ type IInfoSpecContext interface { type InfoSpecContext struct { *antlr.BaseParserRuleContext - parser antlr.Parser + parser antlr.Parser infoToken antlr.Token - lp antlr.Token - rp antlr.Token + lp antlr.Token + rp antlr.Token } func NewEmptyInfoSpecContext() *InfoSpecContext { @@ -129,12 +138,14 @@ func (s *InfoSpecContext) GetLp() antlr.Token { return s.lp } func (s *InfoSpecContext) GetRp() antlr.Token { return s.rp } + func (s *InfoSpecContext) SetInfoToken(v antlr.Token) { s.infoToken = v } func (s *InfoSpecContext) SetLp(v antlr.Token) { s.lp = v } func (s *InfoSpecContext) SetRp(v antlr.Token) { s.rp = v } + func (s *InfoSpecContext) ID() antlr.TerminalNode { return s.GetToken(ApiParserParserID, 0) } @@ -170,6 +181,7 @@ func (s *InfoSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognize return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *InfoSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -180,11 +192,15 @@ func (s *InfoSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) InfoSpec() (localctx IInfoSpecContext) { localctx = NewInfoSpecContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 16, ApiParserParserRULE_infoSpec) var _la int + defer func() { p.ExitRule() }() @@ -202,7 +218,7 @@ func (p *ApiParserParser) InfoSpec() (localctx IInfoSpecContext) { }() p.EnterOuterAlt(localctx, 1) - match(p, "info") + match(p,"info") { p.SetState(117) @@ -226,6 +242,7 @@ func (p *ApiParserParser) InfoSpec() (localctx IInfoSpecContext) { p.KvLit() } + p.SetState(122) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) @@ -238,9 +255,12 @@ func (p *ApiParserParser) InfoSpec() (localctx IInfoSpecContext) { localctx.(*InfoSpecContext).rp = _m } + + return localctx } + // ITypeSpecContext is an interface to support dynamic dispatch. type ITypeSpecContext interface { antlr.ParserRuleContext @@ -307,6 +327,7 @@ func (s *TypeSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognize return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *TypeSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -317,6 +338,9 @@ func (s *TypeSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) TypeSpec() (localctx ITypeSpecContext) { localctx = NewTypeSpecContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 18, ApiParserParserRULE_typeSpec) @@ -347,6 +371,7 @@ func (p *ApiParserParser) TypeSpec() (localctx ITypeSpecContext) { p.TypeLit() } + case 2: p.EnterOuterAlt(localctx, 2) { @@ -356,9 +381,11 @@ func (p *ApiParserParser) TypeSpec() (localctx ITypeSpecContext) { } + return localctx } + // ITypeLitContext is an interface to support dynamic dispatch. type ITypeLitContext interface { antlr.ParserRuleContext @@ -367,10 +394,12 @@ type ITypeLitContext interface { GetParser() antlr.Parser // GetTypeToken returns the typeToken token. - GetTypeToken() antlr.Token + GetTypeToken() antlr.Token + // SetTypeToken sets the typeToken token. - SetTypeToken(antlr.Token) + SetTypeToken(antlr.Token) + // IsTypeLitContext differentiates from other interfaces. IsTypeLitContext() @@ -378,7 +407,7 @@ type ITypeLitContext interface { type TypeLitContext struct { *antlr.BaseParserRuleContext - parser antlr.Parser + parser antlr.Parser typeToken antlr.Token } @@ -406,8 +435,10 @@ func (s *TypeLitContext) GetParser() antlr.Parser { return s.parser } func (s *TypeLitContext) GetTypeToken() antlr.Token { return s.typeToken } + func (s *TypeLitContext) SetTypeToken(v antlr.Token) { s.typeToken = v } + func (s *TypeLitContext) TypeLitBody() ITypeLitBodyContext { var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeLitBodyContext)(nil)).Elem(), 0) @@ -430,6 +461,7 @@ func (s *TypeLitContext) ToStringTree(ruleNames []string, recog antlr.Recognizer return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *TypeLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -440,6 +472,9 @@ func (s *TypeLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) TypeLit() (localctx ITypeLitContext) { localctx = NewTypeLitContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 20, ApiParserParserRULE_typeLit) @@ -461,7 +496,7 @@ func (p *ApiParserParser) TypeLit() (localctx ITypeLitContext) { }() p.EnterOuterAlt(localctx, 1) - match(p, "type") + match(p,"type") { p.SetState(131) @@ -474,9 +509,12 @@ func (p *ApiParserParser) TypeLit() (localctx ITypeLitContext) { p.TypeLitBody() } + + return localctx } + // ITypeBlockContext is an interface to support dynamic dispatch. type ITypeBlockContext interface { antlr.ParserRuleContext @@ -485,22 +523,24 @@ type ITypeBlockContext interface { GetParser() antlr.Parser // GetTypeToken returns the typeToken token. - GetTypeToken() antlr.Token + GetTypeToken() antlr.Token // GetLp returns the lp token. - GetLp() antlr.Token + GetLp() antlr.Token // GetRp returns the rp token. - GetRp() antlr.Token + GetRp() antlr.Token + // SetTypeToken sets the typeToken token. - SetTypeToken(antlr.Token) + SetTypeToken(antlr.Token) // SetLp sets the lp token. - SetLp(antlr.Token) + SetLp(antlr.Token) // SetRp sets the rp token. - SetRp(antlr.Token) + SetRp(antlr.Token) + // IsTypeBlockContext differentiates from other interfaces. IsTypeBlockContext() @@ -508,10 +548,10 @@ type ITypeBlockContext interface { type TypeBlockContext struct { *antlr.BaseParserRuleContext - parser antlr.Parser + parser antlr.Parser typeToken antlr.Token - lp antlr.Token - rp antlr.Token + lp antlr.Token + rp antlr.Token } func NewEmptyTypeBlockContext() *TypeBlockContext { @@ -542,12 +582,14 @@ func (s *TypeBlockContext) GetLp() antlr.Token { return s.lp } func (s *TypeBlockContext) GetRp() antlr.Token { return s.rp } + func (s *TypeBlockContext) SetTypeToken(v antlr.Token) { s.typeToken = v } func (s *TypeBlockContext) SetLp(v antlr.Token) { s.lp = v } func (s *TypeBlockContext) SetRp(v antlr.Token) { s.rp = v } + func (s *TypeBlockContext) ID() antlr.TerminalNode { return s.GetToken(ApiParserParserID, 0) } @@ -583,6 +625,7 @@ func (s *TypeBlockContext) ToStringTree(ruleNames []string, recog antlr.Recogniz return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *TypeBlockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -593,11 +636,15 @@ func (s *TypeBlockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) TypeBlock() (localctx ITypeBlockContext) { localctx = NewTypeBlockContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 22, ApiParserParserRULE_typeBlock) var _la int + defer func() { p.ExitRule() }() @@ -615,7 +662,7 @@ func (p *ApiParserParser) TypeBlock() (localctx ITypeBlockContext) { }() p.EnterOuterAlt(localctx, 1) - match(p, "type") + match(p,"type") { p.SetState(135) @@ -634,12 +681,14 @@ func (p *ApiParserParser) TypeBlock() (localctx ITypeBlockContext) { p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) + for _la == ApiParserParserID { { p.SetState(137) p.TypeBlockBody() } + p.SetState(142) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) @@ -652,5 +701,7 @@ func (p *ApiParserParser) TypeBlock() (localctx ITypeBlockContext) { localctx.(*TypeBlockContext).rp = _m } + + 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 fa7ff8fb..ac658528 100755 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser3.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser3.go @@ -10,6 +10,7 @@ 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 @@ -76,6 +77,7 @@ func (s *TypeLitBodyContext) ToStringTree(ruleNames []string, recog antlr.Recogn return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *TypeLitBodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -86,6 +88,9 @@ func (s *TypeLitBodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} } } + + + func (p *ApiParserParser) TypeLitBody() (localctx ITypeLitBodyContext) { localctx = NewTypeLitBodyContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 24, ApiParserParserRULE_typeLitBody) @@ -116,6 +121,7 @@ func (p *ApiParserParser) TypeLitBody() (localctx ITypeLitBodyContext) { p.TypeStruct() } + case 2: p.EnterOuterAlt(localctx, 2) { @@ -125,9 +131,11 @@ func (p *ApiParserParser) TypeLitBody() (localctx ITypeLitBodyContext) { } + return localctx } + // ITypeBlockBodyContext is an interface to support dynamic dispatch. type ITypeBlockBodyContext interface { antlr.ParserRuleContext @@ -194,6 +202,7 @@ func (s *TypeBlockBodyContext) ToStringTree(ruleNames []string, recog antlr.Reco return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *TypeBlockBodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -204,6 +213,9 @@ func (s *TypeBlockBodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{ } } + + + func (p *ApiParserParser) TypeBlockBody() (localctx ITypeBlockBodyContext) { localctx = NewTypeBlockBodyContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 26, ApiParserParserRULE_typeBlockBody) @@ -234,6 +246,7 @@ func (p *ApiParserParser) TypeBlockBody() (localctx ITypeBlockBodyContext) { p.TypeBlockStruct() } + case 2: p.EnterOuterAlt(localctx, 2) { @@ -243,9 +256,11 @@ func (p *ApiParserParser) TypeBlockBody() (localctx ITypeBlockBodyContext) { } + return localctx } + // ITypeStructContext is an interface to support dynamic dispatch. type ITypeStructContext interface { antlr.ParserRuleContext @@ -254,28 +269,30 @@ type ITypeStructContext interface { GetParser() antlr.Parser // GetStructName returns the structName token. - GetStructName() antlr.Token + GetStructName() antlr.Token // GetStructToken returns the structToken token. - GetStructToken() antlr.Token + GetStructToken() antlr.Token // GetLbrace returns the lbrace token. - GetLbrace() antlr.Token + GetLbrace() antlr.Token // GetRbrace returns the rbrace token. - GetRbrace() antlr.Token + GetRbrace() antlr.Token + // SetStructName sets the structName token. - SetStructName(antlr.Token) + SetStructName(antlr.Token) // SetStructToken sets the structToken token. - SetStructToken(antlr.Token) + SetStructToken(antlr.Token) // SetLbrace sets the lbrace token. - SetLbrace(antlr.Token) + SetLbrace(antlr.Token) // SetRbrace sets the rbrace token. - SetRbrace(antlr.Token) + SetRbrace(antlr.Token) + // IsTypeStructContext differentiates from other interfaces. IsTypeStructContext() @@ -283,11 +300,11 @@ type ITypeStructContext interface { type TypeStructContext struct { *antlr.BaseParserRuleContext - parser antlr.Parser - structName antlr.Token + parser antlr.Parser + structName antlr.Token structToken antlr.Token - lbrace antlr.Token - rbrace antlr.Token + lbrace antlr.Token + rbrace antlr.Token } func NewEmptyTypeStructContext() *TypeStructContext { @@ -320,6 +337,7 @@ func (s *TypeStructContext) GetLbrace() antlr.Token { return s.lbrace } func (s *TypeStructContext) GetRbrace() antlr.Token { return s.rbrace } + func (s *TypeStructContext) SetStructName(v antlr.Token) { s.structName = v } func (s *TypeStructContext) SetStructToken(v antlr.Token) { s.structToken = v } @@ -328,6 +346,7 @@ func (s *TypeStructContext) SetLbrace(v antlr.Token) { s.lbrace = v } func (s *TypeStructContext) SetRbrace(v antlr.Token) { s.rbrace = v } + func (s *TypeStructContext) AllID() []antlr.TerminalNode { return s.GetTokens(ApiParserParserID) } @@ -367,6 +386,7 @@ func (s *TypeStructContext) ToStringTree(ruleNames []string, recog antlr.Recogni return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *TypeStructContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -377,11 +397,15 @@ func (s *TypeStructContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) { localctx = NewTypeStructContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 28, ApiParserParserRULE_typeStruct) var _la int + defer func() { p.ExitRule() }() @@ -413,6 +437,7 @@ func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) { p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) + if _la == ApiParserParserID { { p.SetState(155) @@ -441,6 +466,7 @@ func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) { p.Field() } + } p.SetState(164) p.GetErrorHandler().Sync(p) @@ -454,9 +480,12 @@ func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) { localctx.(*TypeStructContext).rbrace = _m } + + return localctx } + // ITypeAliasContext is an interface to support dynamic dispatch. type ITypeAliasContext interface { antlr.ParserRuleContext @@ -465,16 +494,18 @@ type ITypeAliasContext interface { GetParser() antlr.Parser // GetAlias returns the alias token. - GetAlias() antlr.Token + GetAlias() antlr.Token // GetAssign returns the assign token. - GetAssign() antlr.Token + GetAssign() antlr.Token + // SetAlias sets the alias token. - SetAlias(antlr.Token) + SetAlias(antlr.Token) // SetAssign sets the assign token. - SetAssign(antlr.Token) + SetAssign(antlr.Token) + // IsTypeAliasContext differentiates from other interfaces. IsTypeAliasContext() @@ -483,7 +514,7 @@ type ITypeAliasContext interface { type TypeAliasContext struct { *antlr.BaseParserRuleContext parser antlr.Parser - alias antlr.Token + alias antlr.Token assign antlr.Token } @@ -513,10 +544,12 @@ func (s *TypeAliasContext) GetAlias() antlr.Token { return s.alias } func (s *TypeAliasContext) GetAssign() antlr.Token { return s.assign } + 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 { var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0) @@ -539,6 +572,7 @@ func (s *TypeAliasContext) ToStringTree(ruleNames []string, recog antlr.Recogniz return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *TypeAliasContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -549,11 +583,15 @@ func (s *TypeAliasContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) TypeAlias() (localctx ITypeAliasContext) { localctx = NewTypeAliasContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 30, ApiParserParserRULE_typeAlias) var _la int + defer func() { p.ExitRule() }() @@ -583,6 +621,7 @@ func (p *ApiParserParser) TypeAlias() (localctx ITypeAliasContext) { p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) + if _la == ApiParserParserT__0 { { p.SetState(169) @@ -598,9 +637,12 @@ func (p *ApiParserParser) TypeAlias() (localctx ITypeAliasContext) { p.DataType() } + + return localctx } + // ITypeBlockStructContext is an interface to support dynamic dispatch. type ITypeBlockStructContext interface { antlr.ParserRuleContext @@ -609,28 +651,30 @@ type ITypeBlockStructContext interface { GetParser() antlr.Parser // GetStructName returns the structName token. - GetStructName() antlr.Token + GetStructName() antlr.Token // GetStructToken returns the structToken token. - GetStructToken() antlr.Token + GetStructToken() antlr.Token // GetLbrace returns the lbrace token. - GetLbrace() antlr.Token + GetLbrace() antlr.Token // GetRbrace returns the rbrace token. - GetRbrace() antlr.Token + GetRbrace() antlr.Token + // SetStructName sets the structName token. - SetStructName(antlr.Token) + SetStructName(antlr.Token) // SetStructToken sets the structToken token. - SetStructToken(antlr.Token) + SetStructToken(antlr.Token) // SetLbrace sets the lbrace token. - SetLbrace(antlr.Token) + SetLbrace(antlr.Token) // SetRbrace sets the rbrace token. - SetRbrace(antlr.Token) + SetRbrace(antlr.Token) + // IsTypeBlockStructContext differentiates from other interfaces. IsTypeBlockStructContext() 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 5c7fcede..6f4487b7 100755 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser4.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser4.go @@ -12,11 +12,11 @@ import ( type TypeBlockStructContext struct { *antlr.BaseParserRuleContext - parser antlr.Parser - structName antlr.Token + parser antlr.Parser + structName antlr.Token structToken antlr.Token - lbrace antlr.Token - rbrace antlr.Token + lbrace antlr.Token + rbrace antlr.Token } func NewEmptyTypeBlockStructContext() *TypeBlockStructContext { @@ -49,6 +49,7 @@ 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 } @@ -57,6 +58,7 @@ 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) } @@ -96,6 +98,7 @@ func (s *TypeBlockStructContext) ToStringTree(ruleNames []string, recog antlr.Re return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *TypeBlockStructContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -106,11 +109,15 @@ func (s *TypeBlockStructContext) Accept(visitor antlr.ParseTreeVisitor) interfac } } + + + 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() }() @@ -142,6 +149,7 @@ func (p *ApiParserParser) TypeBlockStruct() (localctx ITypeBlockStructContext) { p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) + if _la == ApiParserParserID { { p.SetState(176) @@ -170,6 +178,7 @@ func (p *ApiParserParser) TypeBlockStruct() (localctx ITypeBlockStructContext) { p.Field() } + } p.SetState(185) p.GetErrorHandler().Sync(p) @@ -183,9 +192,12 @@ func (p *ApiParserParser) TypeBlockStruct() (localctx ITypeBlockStructContext) { localctx.(*TypeBlockStructContext).rbrace = _m } + + return localctx } + // ITypeBlockAliasContext is an interface to support dynamic dispatch. type ITypeBlockAliasContext interface { antlr.ParserRuleContext @@ -194,16 +206,18 @@ type ITypeBlockAliasContext interface { GetParser() antlr.Parser // GetAlias returns the alias token. - GetAlias() antlr.Token + GetAlias() antlr.Token // GetAssign returns the assign token. - GetAssign() antlr.Token + GetAssign() antlr.Token + // SetAlias sets the alias token. - SetAlias(antlr.Token) + SetAlias(antlr.Token) // SetAssign sets the assign token. - SetAssign(antlr.Token) + SetAssign(antlr.Token) + // IsTypeBlockAliasContext differentiates from other interfaces. IsTypeBlockAliasContext() @@ -212,7 +226,7 @@ type ITypeBlockAliasContext interface { type TypeBlockAliasContext struct { *antlr.BaseParserRuleContext parser antlr.Parser - alias antlr.Token + alias antlr.Token assign antlr.Token } @@ -242,10 +256,12 @@ func (s *TypeBlockAliasContext) GetAlias() antlr.Token { return s.alias } func (s *TypeBlockAliasContext) GetAssign() antlr.Token { return s.assign } + 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 { var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0) @@ -268,6 +284,7 @@ func (s *TypeBlockAliasContext) ToStringTree(ruleNames []string, recog antlr.Rec return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *TypeBlockAliasContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -278,11 +295,15 @@ func (s *TypeBlockAliasContext) Accept(visitor antlr.ParseTreeVisitor) interface } } + + + func (p *ApiParserParser) TypeBlockAlias() (localctx ITypeBlockAliasContext) { localctx = NewTypeBlockAliasContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 34, ApiParserParserRULE_typeBlockAlias) var _la int + defer func() { p.ExitRule() }() @@ -312,6 +333,7 @@ func (p *ApiParserParser) TypeBlockAlias() (localctx ITypeBlockAliasContext) { p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) + if _la == ApiParserParserT__0 { { p.SetState(190) @@ -327,9 +349,12 @@ func (p *ApiParserParser) TypeBlockAlias() (localctx ITypeBlockAliasContext) { p.DataType() } + + return localctx } + // IFieldContext is an interface to support dynamic dispatch. type IFieldContext interface { antlr.ParserRuleContext @@ -396,6 +421,7 @@ func (s *FieldContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *FieldContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -406,6 +432,9 @@ func (s *FieldContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) Field() (localctx IFieldContext) { localctx = NewFieldContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 36, ApiParserParserRULE_field) @@ -441,6 +470,7 @@ func (p *ApiParserParser) Field() (localctx IFieldContext) { p.NormalField() } + case 2: p.EnterOuterAlt(localctx, 2) { @@ -450,9 +480,11 @@ func (p *ApiParserParser) Field() (localctx IFieldContext) { } + return localctx } + // INormalFieldContext is an interface to support dynamic dispatch. type INormalFieldContext interface { antlr.ParserRuleContext @@ -461,16 +493,18 @@ type INormalFieldContext interface { GetParser() antlr.Parser // GetFieldName returns the fieldName token. - GetFieldName() antlr.Token + GetFieldName() antlr.Token // GetTag returns the tag token. - GetTag() antlr.Token + GetTag() antlr.Token + // SetFieldName sets the fieldName token. - SetFieldName(antlr.Token) + SetFieldName(antlr.Token) // SetTag sets the tag token. - SetTag(antlr.Token) + SetTag(antlr.Token) + // IsNormalFieldContext differentiates from other interfaces. IsNormalFieldContext() @@ -478,9 +512,9 @@ type INormalFieldContext interface { type NormalFieldContext struct { *antlr.BaseParserRuleContext - parser antlr.Parser + parser antlr.Parser fieldName antlr.Token - tag antlr.Token + tag antlr.Token } func NewEmptyNormalFieldContext() *NormalFieldContext { @@ -509,10 +543,12 @@ func (s *NormalFieldContext) GetFieldName() antlr.Token { return s.fieldName } func (s *NormalFieldContext) GetTag() antlr.Token { return s.tag } + 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 { var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0) @@ -539,6 +575,7 @@ func (s *NormalFieldContext) ToStringTree(ruleNames []string, recog antlr.Recogn return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *NormalFieldContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -549,6 +586,9 @@ func (s *NormalFieldContext) Accept(visitor antlr.ParseTreeVisitor) interface{} } } + + + func (p *ApiParserParser) NormalField() (localctx INormalFieldContext) { localctx = NewNormalFieldContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 38, ApiParserParserRULE_normalField) @@ -585,6 +625,7 @@ func (p *ApiParserParser) NormalField() (localctx INormalFieldContext) { p.SetState(204) p.GetErrorHandler().Sync(p) + if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 16, p.GetParserRuleContext()) == 1 { { p.SetState(203) @@ -594,11 +635,15 @@ func (p *ApiParserParser) NormalField() (localctx INormalFieldContext) { localctx.(*NormalFieldContext).tag = _m } + } + + return localctx } + // IAnonymousFiledContext is an interface to support dynamic dispatch. type IAnonymousFiledContext interface { antlr.ParserRuleContext @@ -607,10 +652,12 @@ type IAnonymousFiledContext interface { GetParser() antlr.Parser // GetStar returns the star token. - GetStar() antlr.Token + GetStar() antlr.Token + // SetStar sets the star token. - SetStar(antlr.Token) + SetStar(antlr.Token) + // IsAnonymousFiledContext differentiates from other interfaces. IsAnonymousFiledContext() 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 ffba26d3..e4350446 100755 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser5.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser5.go @@ -13,7 +13,7 @@ import ( type AnonymousFiledContext struct { *antlr.BaseParserRuleContext parser antlr.Parser - star antlr.Token + star antlr.Token } func NewEmptyAnonymousFiledContext() *AnonymousFiledContext { @@ -40,8 +40,10 @@ 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) } @@ -54,6 +56,7 @@ func (s *AnonymousFiledContext) ToStringTree(ruleNames []string, recog antlr.Rec return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *AnonymousFiledContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -64,11 +67,15 @@ func (s *AnonymousFiledContext) Accept(visitor antlr.ParseTreeVisitor) interface } } + + + 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() }() @@ -90,6 +97,7 @@ func (p *ApiParserParser) AnonymousFiled() (localctx IAnonymousFiledContext) { p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) + if _la == ApiParserParserT__5 { { p.SetState(206) @@ -105,9 +113,12 @@ func (p *ApiParserParser) AnonymousFiled() (localctx IAnonymousFiledContext) { p.Match(ApiParserParserID) } + + return localctx } + // IDataTypeContext is an interface to support dynamic dispatch. type IDataTypeContext interface { antlr.ParserRuleContext @@ -116,16 +127,18 @@ type IDataTypeContext interface { GetParser() antlr.Parser // GetInter returns the inter token. - GetInter() antlr.Token + GetInter() antlr.Token // GetTime returns the time token. - GetTime() antlr.Token + GetTime() antlr.Token + // SetInter sets the inter token. - SetInter(antlr.Token) + SetInter(antlr.Token) // SetTime sets the time token. - SetTime(antlr.Token) + SetTime(antlr.Token) + // IsDataTypeContext differentiates from other interfaces. IsDataTypeContext() @@ -134,8 +147,8 @@ type IDataTypeContext interface { type DataTypeContext struct { *antlr.BaseParserRuleContext parser antlr.Parser - inter antlr.Token - time antlr.Token + inter antlr.Token + time antlr.Token } func NewEmptyDataTypeContext() *DataTypeContext { @@ -164,10 +177,12 @@ 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) } @@ -224,6 +239,7 @@ func (s *DataTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognize return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *DataTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -234,6 +250,9 @@ func (s *DataTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) DataType() (localctx IDataTypeContext) { localctx = NewDataTypeContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 42, ApiParserParserRULE_dataType) @@ -265,6 +284,7 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) { p.Match(ApiParserParserID) } + case 2: p.EnterOuterAlt(localctx, 2) { @@ -272,6 +292,7 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) { p.MapType() } + case 3: p.EnterOuterAlt(localctx, 3) { @@ -279,6 +300,7 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) { p.ArrayType() } + case 4: p.EnterOuterAlt(localctx, 4) { @@ -289,6 +311,7 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) { localctx.(*DataTypeContext).inter = _m } + case 5: p.EnterOuterAlt(localctx, 5) { @@ -299,6 +322,7 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) { localctx.(*DataTypeContext).time = _m } + case 6: p.EnterOuterAlt(localctx, 6) { @@ -306,6 +330,7 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) { p.PointerType() } + case 7: p.EnterOuterAlt(localctx, 7) { @@ -315,9 +340,11 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) { } + return localctx } + // IPointerTypeContext is an interface to support dynamic dispatch. type IPointerTypeContext interface { antlr.ParserRuleContext @@ -326,10 +353,12 @@ type IPointerTypeContext interface { GetParser() antlr.Parser // GetStar returns the star token. - GetStar() antlr.Token + GetStar() antlr.Token + // SetStar sets the star token. - SetStar(antlr.Token) + SetStar(antlr.Token) + // IsPointerTypeContext differentiates from other interfaces. IsPointerTypeContext() @@ -338,7 +367,7 @@ type IPointerTypeContext interface { type PointerTypeContext struct { *antlr.BaseParserRuleContext parser antlr.Parser - star antlr.Token + star antlr.Token } func NewEmptyPointerTypeContext() *PointerTypeContext { @@ -365,8 +394,10 @@ func (s *PointerTypeContext) GetParser() antlr.Parser { return s.parser } func (s *PointerTypeContext) GetStar() antlr.Token { return s.star } + func (s *PointerTypeContext) SetStar(v antlr.Token) { s.star = v } + func (s *PointerTypeContext) ID() antlr.TerminalNode { return s.GetToken(ApiParserParserID, 0) } @@ -379,6 +410,7 @@ func (s *PointerTypeContext) ToStringTree(ruleNames []string, recog antlr.Recogn return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *PointerTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -389,6 +421,9 @@ func (s *PointerTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} } } + + + func (p *ApiParserParser) PointerType() (localctx IPointerTypeContext) { localctx = NewPointerTypeContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 44, ApiParserParserRULE_pointerType) @@ -423,9 +458,12 @@ func (p *ApiParserParser) PointerType() (localctx IPointerTypeContext) { p.Match(ApiParserParserID) } + + return localctx } + // IMapTypeContext is an interface to support dynamic dispatch. type IMapTypeContext interface { antlr.ParserRuleContext @@ -434,47 +472,51 @@ type IMapTypeContext interface { GetParser() antlr.Parser // GetMapToken returns the mapToken token. - GetMapToken() antlr.Token + GetMapToken() antlr.Token // GetLbrack returns the lbrack token. - GetLbrack() antlr.Token + GetLbrack() antlr.Token // GetKey returns the key token. - GetKey() antlr.Token + GetKey() antlr.Token // GetRbrack returns the rbrack token. - GetRbrack() antlr.Token + GetRbrack() antlr.Token + // SetMapToken sets the mapToken token. - SetMapToken(antlr.Token) + SetMapToken(antlr.Token) // SetLbrack sets the lbrack token. - SetLbrack(antlr.Token) + SetLbrack(antlr.Token) // SetKey sets the key token. - SetKey(antlr.Token) + SetKey(antlr.Token) // SetRbrack sets the rbrack token. - SetRbrack(antlr.Token) + SetRbrack(antlr.Token) + // GetValue returns the value rule contexts. GetValue() IDataTypeContext + // SetValue sets the value rule contexts. SetValue(IDataTypeContext) + // IsMapTypeContext differentiates from other interfaces. IsMapTypeContext() } type MapTypeContext struct { *antlr.BaseParserRuleContext - parser antlr.Parser + parser antlr.Parser mapToken antlr.Token - lbrack antlr.Token - key antlr.Token - rbrack antlr.Token - value IDataTypeContext + lbrack antlr.Token + key antlr.Token + rbrack antlr.Token + value IDataTypeContext } func NewEmptyMapTypeContext() *MapTypeContext { @@ -507,6 +549,7 @@ func (s *MapTypeContext) GetKey() antlr.Token { return s.key } func (s *MapTypeContext) GetRbrack() antlr.Token { return s.rbrack } + func (s *MapTypeContext) SetMapToken(v antlr.Token) { s.mapToken = v } func (s *MapTypeContext) SetLbrack(v antlr.Token) { s.lbrack = v } @@ -515,10 +558,13 @@ func (s *MapTypeContext) SetKey(v antlr.Token) { s.key = v } func (s *MapTypeContext) SetRbrack(v antlr.Token) { s.rbrack = v } + func (s *MapTypeContext) GetValue() IDataTypeContext { return s.value } + func (s *MapTypeContext) SetValue(v IDataTypeContext) { s.value = v } + func (s *MapTypeContext) AllID() []antlr.TerminalNode { return s.GetTokens(ApiParserParserID) } @@ -545,6 +591,7 @@ func (s *MapTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *MapTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -555,6 +602,9 @@ func (s *MapTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) MapType() (localctx IMapTypeContext) { localctx = NewMapTypeContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 46, ApiParserParserRULE_mapType) @@ -576,7 +626,7 @@ func (p *ApiParserParser) MapType() (localctx IMapTypeContext) { }() p.EnterOuterAlt(localctx, 1) - match(p, "map") + match(p,"map") { p.SetState(226) @@ -611,8 +661,11 @@ func (p *ApiParserParser) MapType() (localctx IMapTypeContext) { var _x = p.DataType() + localctx.(*MapTypeContext).value = _x } + + return localctx } 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 3003df94..2c365555 100755 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser6.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser6.go @@ -10,6 +10,7 @@ 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 @@ -18,16 +19,18 @@ type IArrayTypeContext interface { GetParser() antlr.Parser // GetLbrack returns the lbrack token. - GetLbrack() antlr.Token + GetLbrack() antlr.Token // GetRbrack returns the rbrack token. - GetRbrack() antlr.Token + GetRbrack() antlr.Token + // SetLbrack sets the lbrack token. - SetLbrack(antlr.Token) + SetLbrack(antlr.Token) // SetRbrack sets the rbrack token. - SetRbrack(antlr.Token) + SetRbrack(antlr.Token) + // IsArrayTypeContext differentiates from other interfaces. IsArrayTypeContext() @@ -66,10 +69,12 @@ 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) @@ -88,6 +93,7 @@ func (s *ArrayTypeContext) ToStringTree(ruleNames []string, recog antlr.Recogniz return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *ArrayTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -98,6 +104,9 @@ func (s *ArrayTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) ArrayType() (localctx IArrayTypeContext) { localctx = NewArrayTypeContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 48, ApiParserParserRULE_arrayType) @@ -138,9 +147,12 @@ func (p *ApiParserParser) ArrayType() (localctx IArrayTypeContext) { p.DataType() } + + return localctx } + // IServiceSpecContext is an interface to support dynamic dispatch. type IServiceSpecContext interface { antlr.ParserRuleContext @@ -207,6 +219,7 @@ func (s *ServiceSpecContext) ToStringTree(ruleNames []string, recog antlr.Recogn return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *ServiceSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -217,11 +230,15 @@ func (s *ServiceSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} } } + + + 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() }() @@ -243,6 +260,7 @@ func (p *ApiParserParser) ServiceSpec() (localctx IServiceSpecContext) { p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) + if _la == ApiParserParserATSERVER { { p.SetState(237) @@ -255,9 +273,12 @@ func (p *ApiParserParser) ServiceSpec() (localctx IServiceSpecContext) { p.ServiceApi() } + + return localctx } + // IAtServerContext is an interface to support dynamic dispatch. type IAtServerContext interface { antlr.ParserRuleContext @@ -266,16 +287,18 @@ type IAtServerContext interface { GetParser() antlr.Parser // GetLp returns the lp token. - GetLp() antlr.Token + GetLp() antlr.Token // GetRp returns the rp token. - GetRp() antlr.Token + GetRp() antlr.Token + // SetLp sets the lp token. - SetLp(antlr.Token) + SetLp(antlr.Token) // SetRp sets the rp token. - SetRp(antlr.Token) + SetRp(antlr.Token) + // IsAtServerContext differentiates from other interfaces. IsAtServerContext() @@ -284,8 +307,8 @@ type IAtServerContext interface { type AtServerContext struct { *antlr.BaseParserRuleContext parser antlr.Parser - lp antlr.Token - rp antlr.Token + lp antlr.Token + rp antlr.Token } func NewEmptyAtServerContext() *AtServerContext { @@ -314,10 +337,12 @@ func (s *AtServerContext) GetLp() antlr.Token { return s.lp } func (s *AtServerContext) GetRp() antlr.Token { return s.rp } + func (s *AtServerContext) SetLp(v antlr.Token) { s.lp = v } func (s *AtServerContext) SetRp(v antlr.Token) { s.rp = v } + func (s *AtServerContext) ATSERVER() antlr.TerminalNode { return s.GetToken(ApiParserParserATSERVER, 0) } @@ -353,6 +378,7 @@ func (s *AtServerContext) ToStringTree(ruleNames []string, recog antlr.Recognize return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *AtServerContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -363,11 +389,15 @@ func (s *AtServerContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + 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() }() @@ -405,6 +435,7 @@ func (p *ApiParserParser) AtServer() (localctx IAtServerContext) { p.KvLit() } + p.SetState(247) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) @@ -417,9 +448,12 @@ func (p *ApiParserParser) AtServer() (localctx IAtServerContext) { localctx.(*AtServerContext).rp = _m } + + return localctx } + // IServiceApiContext is an interface to support dynamic dispatch. type IServiceApiContext interface { antlr.ParserRuleContext @@ -428,22 +462,24 @@ type IServiceApiContext interface { GetParser() antlr.Parser // GetServiceToken returns the serviceToken token. - GetServiceToken() antlr.Token + GetServiceToken() antlr.Token // GetLbrace returns the lbrace token. - GetLbrace() antlr.Token + GetLbrace() antlr.Token // GetRbrace returns the rbrace token. - GetRbrace() antlr.Token + GetRbrace() antlr.Token + // SetServiceToken sets the serviceToken token. - SetServiceToken(antlr.Token) + SetServiceToken(antlr.Token) // SetLbrace sets the lbrace token. - SetLbrace(antlr.Token) + SetLbrace(antlr.Token) // SetRbrace sets the rbrace token. - SetRbrace(antlr.Token) + SetRbrace(antlr.Token) + // IsServiceApiContext differentiates from other interfaces. IsServiceApiContext() @@ -451,10 +487,10 @@ type IServiceApiContext interface { type ServiceApiContext struct { *antlr.BaseParserRuleContext - parser antlr.Parser + parser antlr.Parser serviceToken antlr.Token - lbrace antlr.Token - rbrace antlr.Token + lbrace antlr.Token + rbrace antlr.Token } func NewEmptyServiceApiContext() *ServiceApiContext { @@ -485,12 +521,14 @@ 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) @@ -536,6 +574,7 @@ func (s *ServiceApiContext) ToStringTree(ruleNames []string, recog antlr.Recogni return antlr.TreesStringTree(s, ruleNames, recog) } + func (s *ServiceApiContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: @@ -546,11 +585,15 @@ func (s *ServiceApiContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } + + + func (p *ApiParserParser) ServiceApi() (localctx IServiceApiContext) { localctx = NewServiceApiContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 54, ApiParserParserRULE_serviceApi) var _la int + defer func() { p.ExitRule() }() @@ -568,7 +611,7 @@ func (p *ApiParserParser) ServiceApi() (localctx IServiceApiContext) { }() p.EnterOuterAlt(localctx, 1) - match(p, "service") + match(p,"service") { p.SetState(252) @@ -591,12 +634,14 @@ func (p *ApiParserParser) ServiceApi() (localctx IServiceApiContext) { p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) - for ((_la)&-(0x1f+1)) == 0 && ((1<