From 4254e0a8fe550c3782fbaa523fd9e32285c61abe Mon Sep 17 00:00:00 2001 From: Myzel394 <50424412+Myzel394@users.noreply.github.com> Date: Sun, 1 Sep 2024 23:47:42 +0200 Subject: [PATCH] feat(aliases): Add error code value --- handlers/aliases/Aliases.g4 | 20 +- handlers/aliases/analyzer/value_valid.go | 26 + handlers/aliases/ast/listener.go | 77 ++- handlers/aliases/ast/values.go | 15 + handlers/aliases/handlers/completions.go | 15 + handlers/aliases/parser/Aliases.interp | 7 +- handlers/aliases/parser/Aliases.tokens | 32 +- handlers/aliases/parser/AliasesLexer.interp | 8 +- handlers/aliases/parser/AliasesLexer.tokens | 32 +- .../aliases/parser/aliases_base_listener.go | 6 - handlers/aliases/parser/aliases_lexer.go | 80 +-- handlers/aliases/parser/aliases_listener.go | 6 - handlers/aliases/parser/aliases_parser.go | 594 ++++++++---------- 13 files changed, 477 insertions(+), 441 deletions(-) diff --git a/handlers/aliases/Aliases.g4 b/handlers/aliases/Aliases.g4 index 31c54fd..4c598eb 100644 --- a/handlers/aliases/Aliases.g4 +++ b/handlers/aliases/Aliases.g4 @@ -1,7 +1,7 @@ grammar Aliases; lineStatement - : entry SEPARATOR? comment? EOF + : entry EOF ; entry @@ -22,7 +22,7 @@ values ; value - : (user | file | command | include | email) + : (user | file | command | include | email | error) ; user @@ -50,21 +50,25 @@ email ; error - : errorStatus COLON errorCode SEPARATOR errorMessage - ; - -errorStatus - : STRING + : ERROR COLON errorCode? SEPARATOR? errorMessage? ; errorCode - : STRING + : DIGITS ; errorMessage : STRING ; +DIGITS + : [0-9]+ + ; + +ERROR + : 'e' 'r' 'r' 'o' 'r' + ; + SEPARATOR : [ \t]+ ; diff --git a/handlers/aliases/analyzer/value_valid.go b/handlers/aliases/analyzer/value_valid.go index bc19351..1e640bb 100644 --- a/handlers/aliases/analyzer/value_valid.go +++ b/handlers/aliases/analyzer/value_valid.go @@ -9,6 +9,7 @@ import ( "fmt" "net/mail" "path" + "strconv" ers "errors" ) @@ -98,6 +99,31 @@ func checkValue( Err: ers.New("This path must be absolute"), }} } + case ast.AliasValueError: + errorValue := value.(ast.AliasValueError) + + if errorValue.Code == nil { + return []common.LSPError{{ + Range: errorValue.Location, + Err: ers.New("An error code in the form of 4XX or 5XX is required"), + }} + } + + errorCode, err := strconv.Atoi(errorValue.Code.Value) + + if err != nil || (errorCode < 400 || errorCode > 599) { + return []common.LSPError{{ + Range: errorValue.Code.Location, + Err: ers.New("This error code is invalid. It must be in the form of 4XX or 5XX"), + }} + } + + if errorValue.Message == nil || errorValue.Message.Value == "" { + return []common.LSPError{{ + Range: errorValue.Location, + Err: ers.New("An error message is required"), + }} + } } return nil } diff --git a/handlers/aliases/ast/listener.go b/handlers/aliases/ast/listener.go index aee0c7d..74d5835 100644 --- a/handlers/aliases/ast/listener.go +++ b/handlers/aliases/ast/listener.go @@ -8,8 +8,9 @@ import ( ) type aliasesListenerContext struct { - line uint32 - currentIncludeIndex *uint32 + line uint32 + currentIncludeIndex *uint32 + currentErrorValueIndex *uint32 } type aliasesParserListener struct { @@ -176,7 +177,77 @@ func (s *aliasesParserListener) EnterEmail(ctx *parser.EmailContext) { rawEntry, _ := s.Parser.Aliases.Get(location.Start.Line) entry := rawEntry.(*AliasEntry) - entry.Values.Values = append(entry.Values.Values, email) + entry.Values.Values = append(entry.Values.Values, &email) +} + +func (s *aliasesParserListener) EnterError(ctx *parser.ErrorContext) { + location := common.CharacterRangeFromCtx(ctx.BaseParserRuleContext) + location.ChangeBothLines(s.aliasContext.line) + + errorValue := AliasValueError{ + AliasValue: AliasValue{ + Location: location, + Value: ctx.GetText(), + }, + } + + rawEntry, _ := s.Parser.Aliases.Get(location.Start.Line) + entry := rawEntry.(*AliasEntry) + + entry.Values.Values = append(entry.Values.Values, errorValue) + + index := uint32(len(entry.Values.Values) - 1) + s.aliasContext.currentErrorValueIndex = &index +} + +func (s *aliasesParserListener) ExitError(ctx *parser.ErrorContext) { + s.aliasContext.currentErrorValueIndex = nil +} + +// EnterErrorCode is called when production errorCode is entered. +func (s *aliasesParserListener) EnterErrorCode(ctx *parser.ErrorCodeContext) { + location := common.CharacterRangeFromCtx(ctx.BaseParserRuleContext) + location.ChangeBothLines(s.aliasContext.line) + + rawEntry, _ := s.Parser.Aliases.Get(location.Start.Line) + entry := rawEntry.(*AliasEntry) + + values := entry.Values.Values + + rawValue := values[*s.aliasContext.currentErrorValueIndex] + value := rawValue.(AliasValueError) + + value.Code = &AliasValueErrorCode{ + AliasValue: AliasValue{ + Location: location, + Value: ctx.GetText(), + }, + } + + values[*s.aliasContext.currentErrorValueIndex] = value +} + +// EnterErrorMessage is called when production errorMessage is entered. +func (s *aliasesParserListener) EnterErrorMessage(ctx *parser.ErrorMessageContext) { + location := common.CharacterRangeFromCtx(ctx.BaseParserRuleContext) + location.ChangeBothLines(s.aliasContext.line) + + rawEntry, _ := s.Parser.Aliases.Get(location.Start.Line) + entry := rawEntry.(*AliasEntry) + + values := entry.Values.Values + + rawValue := values[*s.aliasContext.currentErrorValueIndex] + value := rawValue.(AliasValueError) + + value.Message = &AliasValueErrorMessage{ + AliasValue: AliasValue{ + Location: location, + Value: ctx.GetText(), + }, + } + + values[*s.aliasContext.currentErrorValueIndex] = value } func createListener( diff --git a/handlers/aliases/ast/values.go b/handlers/aliases/ast/values.go index 3764755..bae4526 100644 --- a/handlers/aliases/ast/values.go +++ b/handlers/aliases/ast/values.go @@ -90,3 +90,18 @@ func (a AliasValueEmail) CheckIsValid() []common.LSPError { }, ) } + +type AliasValueError struct { + AliasValue + + Code *AliasValueErrorCode + Message *AliasValueErrorMessage +} + +type AliasValueErrorCode struct { + AliasValue +} + +type AliasValueErrorMessage struct { + AliasValue +} diff --git a/handlers/aliases/handlers/completions.go b/handlers/aliases/handlers/completions.go index 2cb9e07..8df8d3f 100644 --- a/handlers/aliases/handlers/completions.go +++ b/handlers/aliases/handlers/completions.go @@ -54,6 +54,7 @@ func GetCompletionsForEntry( if value == nil { completions = append(completions, getCommandCompletion()) completions = append(completions, getIncludeCompletion()) + completions = append(completions, getErrorCompletion()) completions = append(completions, getUserCompletions( i, @@ -109,6 +110,20 @@ func getIncludeCompletion() protocol.CompletionItem { } } +func getErrorCompletion() protocol.CompletionItem { + kind := protocol.CompletionItemKindKeyword + textFormat := protocol.InsertTextFormatSnippet + insertText := "error:" + + return protocol.CompletionItem{ + Label: "error:", + Documentation: "A status code and message to return. The code must be 3 digits, starting 4XX (TempFail) or 5XX (PermFail). The message must be present and can be freely chosen.", + Kind: &kind, + InsertTextFormat: &textFormat, + InsertText: &insertText, + } +} + func getUserCompletions( i *indexes.AliasesIndexes, excludeKey string, diff --git a/handlers/aliases/parser/Aliases.interp b/handlers/aliases/parser/Aliases.interp index 4431f32..3fd0e3e 100644 --- a/handlers/aliases/parser/Aliases.interp +++ b/handlers/aliases/parser/Aliases.interp @@ -1,6 +1,8 @@ token literal names: null null +null +null '@' null '|' @@ -12,6 +14,8 @@ null token symbolic names: null +DIGITS +ERROR SEPARATOR AT INCLUDE @@ -36,10 +40,9 @@ include comment email error -errorStatus errorCode errorMessage atn: -[4, 1, 9, 128, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 1, 0, 1, 0, 3, 0, 35, 8, 0, 1, 0, 3, 0, 38, 8, 0, 1, 0, 1, 0, 1, 1, 3, 1, 43, 8, 1, 1, 1, 1, 1, 3, 1, 47, 8, 1, 1, 1, 1, 1, 3, 1, 51, 8, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 5, 4, 63, 8, 4, 10, 4, 12, 4, 66, 9, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 75, 8, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 5, 7, 82, 8, 7, 10, 7, 12, 7, 85, 9, 7, 1, 7, 3, 7, 88, 8, 7, 1, 8, 1, 8, 3, 8, 92, 8, 8, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 98, 8, 9, 1, 10, 1, 10, 3, 10, 102, 8, 10, 1, 10, 4, 10, 105, 8, 10, 11, 10, 12, 10, 106, 1, 10, 3, 10, 110, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 0, 0, 16, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 0, 0, 128, 0, 32, 1, 0, 0, 0, 2, 42, 1, 0, 0, 0, 4, 54, 1, 0, 0, 0, 6, 56, 1, 0, 0, 0, 8, 64, 1, 0, 0, 0, 10, 74, 1, 0, 0, 0, 12, 76, 1, 0, 0, 0, 14, 78, 1, 0, 0, 0, 16, 89, 1, 0, 0, 0, 18, 93, 1, 0, 0, 0, 20, 99, 1, 0, 0, 0, 22, 111, 1, 0, 0, 0, 24, 115, 1, 0, 0, 0, 26, 121, 1, 0, 0, 0, 28, 123, 1, 0, 0, 0, 30, 125, 1, 0, 0, 0, 32, 34, 3, 2, 1, 0, 33, 35, 5, 1, 0, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 37, 1, 0, 0, 0, 36, 38, 3, 20, 10, 0, 37, 36, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, 40, 5, 0, 0, 1, 40, 1, 1, 0, 0, 0, 41, 43, 5, 1, 0, 0, 42, 41, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, 46, 3, 6, 3, 0, 45, 47, 5, 1, 0, 0, 46, 45, 1, 0, 0, 0, 46, 47, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 50, 3, 4, 2, 0, 49, 51, 5, 1, 0, 0, 50, 49, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, 53, 3, 8, 4, 0, 53, 3, 1, 0, 0, 0, 54, 55, 5, 5, 0, 0, 55, 5, 1, 0, 0, 0, 56, 57, 5, 9, 0, 0, 57, 7, 1, 0, 0, 0, 58, 59, 3, 10, 5, 0, 59, 60, 5, 6, 0, 0, 60, 61, 5, 1, 0, 0, 61, 63, 1, 0, 0, 0, 62, 58, 1, 0, 0, 0, 63, 66, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 1, 0, 0, 0, 66, 64, 1, 0, 0, 0, 67, 68, 3, 10, 5, 0, 68, 9, 1, 0, 0, 0, 69, 75, 3, 12, 6, 0, 70, 75, 3, 14, 7, 0, 71, 75, 3, 16, 8, 0, 72, 75, 3, 18, 9, 0, 73, 75, 3, 22, 11, 0, 74, 69, 1, 0, 0, 0, 74, 70, 1, 0, 0, 0, 74, 71, 1, 0, 0, 0, 74, 72, 1, 0, 0, 0, 74, 73, 1, 0, 0, 0, 75, 11, 1, 0, 0, 0, 76, 77, 5, 9, 0, 0, 77, 13, 1, 0, 0, 0, 78, 83, 5, 8, 0, 0, 79, 80, 5, 9, 0, 0, 80, 82, 5, 8, 0, 0, 81, 79, 1, 0, 0, 0, 82, 85, 1, 0, 0, 0, 83, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 87, 1, 0, 0, 0, 85, 83, 1, 0, 0, 0, 86, 88, 5, 9, 0, 0, 87, 86, 1, 0, 0, 0, 87, 88, 1, 0, 0, 0, 88, 15, 1, 0, 0, 0, 89, 91, 5, 4, 0, 0, 90, 92, 5, 9, 0, 0, 91, 90, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 17, 1, 0, 0, 0, 93, 94, 5, 5, 0, 0, 94, 95, 5, 3, 0, 0, 95, 97, 5, 5, 0, 0, 96, 98, 3, 14, 7, 0, 97, 96, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 19, 1, 0, 0, 0, 99, 104, 5, 7, 0, 0, 100, 102, 5, 1, 0, 0, 101, 100, 1, 0, 0, 0, 101, 102, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 105, 5, 9, 0, 0, 104, 101, 1, 0, 0, 0, 105, 106, 1, 0, 0, 0, 106, 104, 1, 0, 0, 0, 106, 107, 1, 0, 0, 0, 107, 109, 1, 0, 0, 0, 108, 110, 5, 1, 0, 0, 109, 108, 1, 0, 0, 0, 109, 110, 1, 0, 0, 0, 110, 21, 1, 0, 0, 0, 111, 112, 5, 9, 0, 0, 112, 113, 5, 2, 0, 0, 113, 114, 5, 9, 0, 0, 114, 23, 1, 0, 0, 0, 115, 116, 3, 26, 13, 0, 116, 117, 5, 5, 0, 0, 117, 118, 3, 28, 14, 0, 118, 119, 5, 1, 0, 0, 119, 120, 3, 30, 15, 0, 120, 25, 1, 0, 0, 0, 121, 122, 5, 9, 0, 0, 122, 27, 1, 0, 0, 0, 123, 124, 5, 9, 0, 0, 124, 29, 1, 0, 0, 0, 125, 126, 5, 9, 0, 0, 126, 31, 1, 0, 0, 0, 14, 34, 37, 42, 46, 50, 64, 74, 83, 87, 91, 97, 101, 106, 109] \ No newline at end of file +[4, 1, 11, 124, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 1, 0, 1, 0, 1, 0, 1, 1, 3, 1, 35, 8, 1, 1, 1, 1, 1, 3, 1, 39, 8, 1, 1, 1, 1, 1, 3, 1, 43, 8, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 5, 4, 55, 8, 4, 10, 4, 12, 4, 58, 9, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 68, 8, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 5, 7, 75, 8, 7, 10, 7, 12, 7, 78, 9, 7, 1, 7, 3, 7, 81, 8, 7, 1, 8, 1, 8, 3, 8, 85, 8, 8, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 91, 8, 9, 1, 10, 1, 10, 3, 10, 95, 8, 10, 1, 10, 4, 10, 98, 8, 10, 11, 10, 12, 10, 99, 1, 10, 3, 10, 103, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 3, 12, 112, 8, 12, 1, 12, 3, 12, 115, 8, 12, 1, 12, 3, 12, 118, 8, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 0, 0, 15, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 0, 0, 127, 0, 30, 1, 0, 0, 0, 2, 34, 1, 0, 0, 0, 4, 46, 1, 0, 0, 0, 6, 48, 1, 0, 0, 0, 8, 56, 1, 0, 0, 0, 10, 67, 1, 0, 0, 0, 12, 69, 1, 0, 0, 0, 14, 71, 1, 0, 0, 0, 16, 82, 1, 0, 0, 0, 18, 86, 1, 0, 0, 0, 20, 92, 1, 0, 0, 0, 22, 104, 1, 0, 0, 0, 24, 108, 1, 0, 0, 0, 26, 119, 1, 0, 0, 0, 28, 121, 1, 0, 0, 0, 30, 31, 3, 2, 1, 0, 31, 32, 5, 0, 0, 1, 32, 1, 1, 0, 0, 0, 33, 35, 5, 3, 0, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 36, 1, 0, 0, 0, 36, 38, 3, 6, 3, 0, 37, 39, 5, 3, 0, 0, 38, 37, 1, 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 42, 3, 4, 2, 0, 41, 43, 5, 3, 0, 0, 42, 41, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, 45, 3, 8, 4, 0, 45, 3, 1, 0, 0, 0, 46, 47, 5, 7, 0, 0, 47, 5, 1, 0, 0, 0, 48, 49, 5, 11, 0, 0, 49, 7, 1, 0, 0, 0, 50, 51, 3, 10, 5, 0, 51, 52, 5, 8, 0, 0, 52, 53, 5, 3, 0, 0, 53, 55, 1, 0, 0, 0, 54, 50, 1, 0, 0, 0, 55, 58, 1, 0, 0, 0, 56, 54, 1, 0, 0, 0, 56, 57, 1, 0, 0, 0, 57, 59, 1, 0, 0, 0, 58, 56, 1, 0, 0, 0, 59, 60, 3, 10, 5, 0, 60, 9, 1, 0, 0, 0, 61, 68, 3, 12, 6, 0, 62, 68, 3, 14, 7, 0, 63, 68, 3, 16, 8, 0, 64, 68, 3, 18, 9, 0, 65, 68, 3, 22, 11, 0, 66, 68, 3, 24, 12, 0, 67, 61, 1, 0, 0, 0, 67, 62, 1, 0, 0, 0, 67, 63, 1, 0, 0, 0, 67, 64, 1, 0, 0, 0, 67, 65, 1, 0, 0, 0, 67, 66, 1, 0, 0, 0, 68, 11, 1, 0, 0, 0, 69, 70, 5, 11, 0, 0, 70, 13, 1, 0, 0, 0, 71, 76, 5, 10, 0, 0, 72, 73, 5, 11, 0, 0, 73, 75, 5, 10, 0, 0, 74, 72, 1, 0, 0, 0, 75, 78, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 76, 77, 1, 0, 0, 0, 77, 80, 1, 0, 0, 0, 78, 76, 1, 0, 0, 0, 79, 81, 5, 11, 0, 0, 80, 79, 1, 0, 0, 0, 80, 81, 1, 0, 0, 0, 81, 15, 1, 0, 0, 0, 82, 84, 5, 6, 0, 0, 83, 85, 5, 11, 0, 0, 84, 83, 1, 0, 0, 0, 84, 85, 1, 0, 0, 0, 85, 17, 1, 0, 0, 0, 86, 87, 5, 7, 0, 0, 87, 88, 5, 5, 0, 0, 88, 90, 5, 7, 0, 0, 89, 91, 3, 14, 7, 0, 90, 89, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 19, 1, 0, 0, 0, 92, 97, 5, 9, 0, 0, 93, 95, 5, 3, 0, 0, 94, 93, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 96, 1, 0, 0, 0, 96, 98, 5, 11, 0, 0, 97, 94, 1, 0, 0, 0, 98, 99, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 99, 100, 1, 0, 0, 0, 100, 102, 1, 0, 0, 0, 101, 103, 5, 3, 0, 0, 102, 101, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 21, 1, 0, 0, 0, 104, 105, 5, 11, 0, 0, 105, 106, 5, 4, 0, 0, 106, 107, 5, 11, 0, 0, 107, 23, 1, 0, 0, 0, 108, 109, 5, 2, 0, 0, 109, 111, 5, 7, 0, 0, 110, 112, 3, 26, 13, 0, 111, 110, 1, 0, 0, 0, 111, 112, 1, 0, 0, 0, 112, 114, 1, 0, 0, 0, 113, 115, 5, 3, 0, 0, 114, 113, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115, 117, 1, 0, 0, 0, 116, 118, 3, 28, 14, 0, 117, 116, 1, 0, 0, 0, 117, 118, 1, 0, 0, 0, 118, 25, 1, 0, 0, 0, 119, 120, 5, 1, 0, 0, 120, 27, 1, 0, 0, 0, 121, 122, 5, 11, 0, 0, 122, 29, 1, 0, 0, 0, 15, 34, 38, 42, 56, 67, 76, 80, 84, 90, 94, 99, 102, 111, 114, 117] \ No newline at end of file diff --git a/handlers/aliases/parser/Aliases.tokens b/handlers/aliases/parser/Aliases.tokens index 9efc836..e6a860a 100644 --- a/handlers/aliases/parser/Aliases.tokens +++ b/handlers/aliases/parser/Aliases.tokens @@ -1,15 +1,17 @@ -SEPARATOR=1 -AT=2 -INCLUDE=3 -VERTLINE=4 -COLON=5 -COMMA=6 -NUMBER_SIGN=7 -SLASH=8 -STRING=9 -'@'=2 -'|'=4 -':'=5 -','=6 -'#'=7 -'/'=8 +DIGITS=1 +ERROR=2 +SEPARATOR=3 +AT=4 +INCLUDE=5 +VERTLINE=6 +COLON=7 +COMMA=8 +NUMBER_SIGN=9 +SLASH=10 +STRING=11 +'@'=4 +'|'=6 +':'=7 +','=8 +'#'=9 +'/'=10 diff --git a/handlers/aliases/parser/AliasesLexer.interp b/handlers/aliases/parser/AliasesLexer.interp index d626d2b..d426830 100644 --- a/handlers/aliases/parser/AliasesLexer.interp +++ b/handlers/aliases/parser/AliasesLexer.interp @@ -1,6 +1,8 @@ token literal names: null null +null +null '@' null '|' @@ -12,6 +14,8 @@ null token symbolic names: null +DIGITS +ERROR SEPARATOR AT INCLUDE @@ -23,6 +27,8 @@ SLASH STRING rule names: +DIGITS +ERROR SEPARATOR AT INCLUDE @@ -41,4 +47,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 9, 49, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 1, 0, 4, 0, 21, 8, 0, 11, 0, 12, 0, 22, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 4, 8, 46, 8, 8, 11, 8, 12, 8, 47, 0, 0, 9, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 1, 0, 2, 2, 0, 9, 9, 32, 32, 9, 0, 9, 10, 13, 13, 32, 32, 35, 35, 44, 44, 47, 47, 58, 58, 64, 64, 124, 124, 50, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 1, 20, 1, 0, 0, 0, 3, 24, 1, 0, 0, 0, 5, 26, 1, 0, 0, 0, 7, 34, 1, 0, 0, 0, 9, 36, 1, 0, 0, 0, 11, 38, 1, 0, 0, 0, 13, 40, 1, 0, 0, 0, 15, 42, 1, 0, 0, 0, 17, 45, 1, 0, 0, 0, 19, 21, 7, 0, 0, 0, 20, 19, 1, 0, 0, 0, 21, 22, 1, 0, 0, 0, 22, 20, 1, 0, 0, 0, 22, 23, 1, 0, 0, 0, 23, 2, 1, 0, 0, 0, 24, 25, 5, 64, 0, 0, 25, 4, 1, 0, 0, 0, 26, 27, 5, 105, 0, 0, 27, 28, 5, 110, 0, 0, 28, 29, 5, 99, 0, 0, 29, 30, 5, 108, 0, 0, 30, 31, 5, 117, 0, 0, 31, 32, 5, 100, 0, 0, 32, 33, 5, 101, 0, 0, 33, 6, 1, 0, 0, 0, 34, 35, 5, 124, 0, 0, 35, 8, 1, 0, 0, 0, 36, 37, 5, 58, 0, 0, 37, 10, 1, 0, 0, 0, 38, 39, 5, 44, 0, 0, 39, 12, 1, 0, 0, 0, 40, 41, 5, 35, 0, 0, 41, 14, 1, 0, 0, 0, 42, 43, 5, 47, 0, 0, 43, 16, 1, 0, 0, 0, 44, 46, 8, 1, 0, 0, 45, 44, 1, 0, 0, 0, 46, 47, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 18, 1, 0, 0, 0, 3, 0, 22, 47, 0] \ No newline at end of file +[4, 0, 11, 64, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 1, 0, 4, 0, 25, 8, 0, 11, 0, 12, 0, 26, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 36, 8, 2, 11, 2, 12, 2, 37, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 4, 10, 61, 8, 10, 11, 10, 12, 10, 62, 0, 0, 11, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 1, 0, 3, 1, 0, 48, 57, 2, 0, 9, 9, 32, 32, 9, 0, 9, 10, 13, 13, 32, 32, 35, 35, 44, 44, 47, 47, 58, 58, 64, 64, 124, 124, 66, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 1, 24, 1, 0, 0, 0, 3, 28, 1, 0, 0, 0, 5, 35, 1, 0, 0, 0, 7, 39, 1, 0, 0, 0, 9, 41, 1, 0, 0, 0, 11, 49, 1, 0, 0, 0, 13, 51, 1, 0, 0, 0, 15, 53, 1, 0, 0, 0, 17, 55, 1, 0, 0, 0, 19, 57, 1, 0, 0, 0, 21, 60, 1, 0, 0, 0, 23, 25, 7, 0, 0, 0, 24, 23, 1, 0, 0, 0, 25, 26, 1, 0, 0, 0, 26, 24, 1, 0, 0, 0, 26, 27, 1, 0, 0, 0, 27, 2, 1, 0, 0, 0, 28, 29, 5, 101, 0, 0, 29, 30, 5, 114, 0, 0, 30, 31, 5, 114, 0, 0, 31, 32, 5, 111, 0, 0, 32, 33, 5, 114, 0, 0, 33, 4, 1, 0, 0, 0, 34, 36, 7, 1, 0, 0, 35, 34, 1, 0, 0, 0, 36, 37, 1, 0, 0, 0, 37, 35, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 6, 1, 0, 0, 0, 39, 40, 5, 64, 0, 0, 40, 8, 1, 0, 0, 0, 41, 42, 5, 105, 0, 0, 42, 43, 5, 110, 0, 0, 43, 44, 5, 99, 0, 0, 44, 45, 5, 108, 0, 0, 45, 46, 5, 117, 0, 0, 46, 47, 5, 100, 0, 0, 47, 48, 5, 101, 0, 0, 48, 10, 1, 0, 0, 0, 49, 50, 5, 124, 0, 0, 50, 12, 1, 0, 0, 0, 51, 52, 5, 58, 0, 0, 52, 14, 1, 0, 0, 0, 53, 54, 5, 44, 0, 0, 54, 16, 1, 0, 0, 0, 55, 56, 5, 35, 0, 0, 56, 18, 1, 0, 0, 0, 57, 58, 5, 47, 0, 0, 58, 20, 1, 0, 0, 0, 59, 61, 8, 2, 0, 0, 60, 59, 1, 0, 0, 0, 61, 62, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 22, 1, 0, 0, 0, 4, 0, 26, 37, 62, 0] \ No newline at end of file diff --git a/handlers/aliases/parser/AliasesLexer.tokens b/handlers/aliases/parser/AliasesLexer.tokens index 9efc836..e6a860a 100644 --- a/handlers/aliases/parser/AliasesLexer.tokens +++ b/handlers/aliases/parser/AliasesLexer.tokens @@ -1,15 +1,17 @@ -SEPARATOR=1 -AT=2 -INCLUDE=3 -VERTLINE=4 -COLON=5 -COMMA=6 -NUMBER_SIGN=7 -SLASH=8 -STRING=9 -'@'=2 -'|'=4 -':'=5 -','=6 -'#'=7 -'/'=8 +DIGITS=1 +ERROR=2 +SEPARATOR=3 +AT=4 +INCLUDE=5 +VERTLINE=6 +COLON=7 +COMMA=8 +NUMBER_SIGN=9 +SLASH=10 +STRING=11 +'@'=4 +'|'=6 +':'=7 +','=8 +'#'=9 +'/'=10 diff --git a/handlers/aliases/parser/aliases_base_listener.go b/handlers/aliases/parser/aliases_base_listener.go index c93be05..6818fb1 100644 --- a/handlers/aliases/parser/aliases_base_listener.go +++ b/handlers/aliases/parser/aliases_base_listener.go @@ -99,12 +99,6 @@ func (s *BaseAliasesListener) EnterError(ctx *ErrorContext) {} // ExitError is called when production error is exited. func (s *BaseAliasesListener) ExitError(ctx *ErrorContext) {} -// EnterErrorStatus is called when production errorStatus is entered. -func (s *BaseAliasesListener) EnterErrorStatus(ctx *ErrorStatusContext) {} - -// ExitErrorStatus is called when production errorStatus is exited. -func (s *BaseAliasesListener) ExitErrorStatus(ctx *ErrorStatusContext) {} - // EnterErrorCode is called when production errorCode is entered. func (s *BaseAliasesListener) EnterErrorCode(ctx *ErrorCodeContext) {} diff --git a/handlers/aliases/parser/aliases_lexer.go b/handlers/aliases/parser/aliases_lexer.go index dd72d4b..3c0522b 100644 --- a/handlers/aliases/parser/aliases_lexer.go +++ b/handlers/aliases/parser/aliases_lexer.go @@ -43,40 +43,46 @@ func aliaseslexerLexerInit() { "DEFAULT_MODE", } staticData.LiteralNames = []string{ - "", "", "'@'", "", "'|'", "':'", "','", "'#'", "'/'", + "", "", "", "", "'@'", "", "'|'", "':'", "','", "'#'", "'/'", } staticData.SymbolicNames = []string{ - "", "SEPARATOR", "AT", "INCLUDE", "VERTLINE", "COLON", "COMMA", "NUMBER_SIGN", - "SLASH", "STRING", + "", "DIGITS", "ERROR", "SEPARATOR", "AT", "INCLUDE", "VERTLINE", "COLON", + "COMMA", "NUMBER_SIGN", "SLASH", "STRING", } staticData.RuleNames = []string{ - "SEPARATOR", "AT", "INCLUDE", "VERTLINE", "COLON", "COMMA", "NUMBER_SIGN", - "SLASH", "STRING", + "DIGITS", "ERROR", "SEPARATOR", "AT", "INCLUDE", "VERTLINE", "COLON", + "COMMA", "NUMBER_SIGN", "SLASH", "STRING", } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 0, 9, 49, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, - 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 1, 0, 4, 0, 21, - 8, 0, 11, 0, 12, 0, 22, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, - 1, 8, 4, 8, 46, 8, 8, 11, 8, 12, 8, 47, 0, 0, 9, 1, 1, 3, 2, 5, 3, 7, 4, - 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 1, 0, 2, 2, 0, 9, 9, 32, 32, 9, 0, 9, - 10, 13, 13, 32, 32, 35, 35, 44, 44, 47, 47, 58, 58, 64, 64, 124, 124, 50, - 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, - 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, - 0, 0, 17, 1, 0, 0, 0, 1, 20, 1, 0, 0, 0, 3, 24, 1, 0, 0, 0, 5, 26, 1, 0, - 0, 0, 7, 34, 1, 0, 0, 0, 9, 36, 1, 0, 0, 0, 11, 38, 1, 0, 0, 0, 13, 40, - 1, 0, 0, 0, 15, 42, 1, 0, 0, 0, 17, 45, 1, 0, 0, 0, 19, 21, 7, 0, 0, 0, - 20, 19, 1, 0, 0, 0, 21, 22, 1, 0, 0, 0, 22, 20, 1, 0, 0, 0, 22, 23, 1, - 0, 0, 0, 23, 2, 1, 0, 0, 0, 24, 25, 5, 64, 0, 0, 25, 4, 1, 0, 0, 0, 26, - 27, 5, 105, 0, 0, 27, 28, 5, 110, 0, 0, 28, 29, 5, 99, 0, 0, 29, 30, 5, - 108, 0, 0, 30, 31, 5, 117, 0, 0, 31, 32, 5, 100, 0, 0, 32, 33, 5, 101, - 0, 0, 33, 6, 1, 0, 0, 0, 34, 35, 5, 124, 0, 0, 35, 8, 1, 0, 0, 0, 36, 37, - 5, 58, 0, 0, 37, 10, 1, 0, 0, 0, 38, 39, 5, 44, 0, 0, 39, 12, 1, 0, 0, - 0, 40, 41, 5, 35, 0, 0, 41, 14, 1, 0, 0, 0, 42, 43, 5, 47, 0, 0, 43, 16, - 1, 0, 0, 0, 44, 46, 8, 1, 0, 0, 45, 44, 1, 0, 0, 0, 46, 47, 1, 0, 0, 0, - 47, 45, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 18, 1, 0, 0, 0, 3, 0, 22, 47, - 0, + 4, 0, 11, 64, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, + 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, + 10, 7, 10, 1, 0, 4, 0, 25, 8, 0, 11, 0, 12, 0, 26, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 2, 4, 2, 36, 8, 2, 11, 2, 12, 2, 37, 1, 3, 1, 3, 1, 4, + 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, + 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 4, 10, 61, 8, 10, 11, 10, 12, 10, + 62, 0, 0, 11, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, + 19, 10, 21, 11, 1, 0, 3, 1, 0, 48, 57, 2, 0, 9, 9, 32, 32, 9, 0, 9, 10, + 13, 13, 32, 32, 35, 35, 44, 44, 47, 47, 58, 58, 64, 64, 124, 124, 66, 0, + 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, + 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, + 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 1, 24, 1, 0, 0, + 0, 3, 28, 1, 0, 0, 0, 5, 35, 1, 0, 0, 0, 7, 39, 1, 0, 0, 0, 9, 41, 1, 0, + 0, 0, 11, 49, 1, 0, 0, 0, 13, 51, 1, 0, 0, 0, 15, 53, 1, 0, 0, 0, 17, 55, + 1, 0, 0, 0, 19, 57, 1, 0, 0, 0, 21, 60, 1, 0, 0, 0, 23, 25, 7, 0, 0, 0, + 24, 23, 1, 0, 0, 0, 25, 26, 1, 0, 0, 0, 26, 24, 1, 0, 0, 0, 26, 27, 1, + 0, 0, 0, 27, 2, 1, 0, 0, 0, 28, 29, 5, 101, 0, 0, 29, 30, 5, 114, 0, 0, + 30, 31, 5, 114, 0, 0, 31, 32, 5, 111, 0, 0, 32, 33, 5, 114, 0, 0, 33, 4, + 1, 0, 0, 0, 34, 36, 7, 1, 0, 0, 35, 34, 1, 0, 0, 0, 36, 37, 1, 0, 0, 0, + 37, 35, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 6, 1, 0, 0, 0, 39, 40, 5, 64, + 0, 0, 40, 8, 1, 0, 0, 0, 41, 42, 5, 105, 0, 0, 42, 43, 5, 110, 0, 0, 43, + 44, 5, 99, 0, 0, 44, 45, 5, 108, 0, 0, 45, 46, 5, 117, 0, 0, 46, 47, 5, + 100, 0, 0, 47, 48, 5, 101, 0, 0, 48, 10, 1, 0, 0, 0, 49, 50, 5, 124, 0, + 0, 50, 12, 1, 0, 0, 0, 51, 52, 5, 58, 0, 0, 52, 14, 1, 0, 0, 0, 53, 54, + 5, 44, 0, 0, 54, 16, 1, 0, 0, 0, 55, 56, 5, 35, 0, 0, 56, 18, 1, 0, 0, + 0, 57, 58, 5, 47, 0, 0, 58, 20, 1, 0, 0, 0, 59, 61, 8, 2, 0, 0, 60, 59, + 1, 0, 0, 0, 61, 62, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, + 63, 22, 1, 0, 0, 0, 4, 0, 26, 37, 62, 0, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -117,13 +123,15 @@ func NewAliasesLexer(input antlr.CharStream) *AliasesLexer { // AliasesLexer tokens. const ( - AliasesLexerSEPARATOR = 1 - AliasesLexerAT = 2 - AliasesLexerINCLUDE = 3 - AliasesLexerVERTLINE = 4 - AliasesLexerCOLON = 5 - AliasesLexerCOMMA = 6 - AliasesLexerNUMBER_SIGN = 7 - AliasesLexerSLASH = 8 - AliasesLexerSTRING = 9 + AliasesLexerDIGITS = 1 + AliasesLexerERROR = 2 + AliasesLexerSEPARATOR = 3 + AliasesLexerAT = 4 + AliasesLexerINCLUDE = 5 + AliasesLexerVERTLINE = 6 + AliasesLexerCOLON = 7 + AliasesLexerCOMMA = 8 + AliasesLexerNUMBER_SIGN = 9 + AliasesLexerSLASH = 10 + AliasesLexerSTRING = 11 ) diff --git a/handlers/aliases/parser/aliases_listener.go b/handlers/aliases/parser/aliases_listener.go index db833c1..69e142a 100644 --- a/handlers/aliases/parser/aliases_listener.go +++ b/handlers/aliases/parser/aliases_listener.go @@ -47,9 +47,6 @@ type AliasesListener interface { // EnterError is called when entering the error production. EnterError(c *ErrorContext) - // EnterErrorStatus is called when entering the errorStatus production. - EnterErrorStatus(c *ErrorStatusContext) - // EnterErrorCode is called when entering the errorCode production. EnterErrorCode(c *ErrorCodeContext) @@ -95,9 +92,6 @@ type AliasesListener interface { // ExitError is called when exiting the error production. ExitError(c *ErrorContext) - // ExitErrorStatus is called when exiting the errorStatus production. - ExitErrorStatus(c *ErrorStatusContext) - // ExitErrorCode is called when exiting the errorCode production. ExitErrorCode(c *ErrorCodeContext) diff --git a/handlers/aliases/parser/aliases_parser.go b/handlers/aliases/parser/aliases_parser.go index 3708a9b..d5030d8 100644 --- a/handlers/aliases/parser/aliases_parser.go +++ b/handlers/aliases/parser/aliases_parser.go @@ -33,70 +33,70 @@ var AliasesParserStaticData struct { func aliasesParserInit() { staticData := &AliasesParserStaticData staticData.LiteralNames = []string{ - "", "", "'@'", "", "'|'", "':'", "','", "'#'", "'/'", + "", "", "", "", "'@'", "", "'|'", "':'", "','", "'#'", "'/'", } staticData.SymbolicNames = []string{ - "", "SEPARATOR", "AT", "INCLUDE", "VERTLINE", "COLON", "COMMA", "NUMBER_SIGN", - "SLASH", "STRING", + "", "DIGITS", "ERROR", "SEPARATOR", "AT", "INCLUDE", "VERTLINE", "COLON", + "COMMA", "NUMBER_SIGN", "SLASH", "STRING", } staticData.RuleNames = []string{ "lineStatement", "entry", "separator", "key", "values", "value", "user", - "file", "command", "include", "comment", "email", "error", "errorStatus", - "errorCode", "errorMessage", + "file", "command", "include", "comment", "email", "error", "errorCode", + "errorMessage", } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 1, 9, 128, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, + 4, 1, 11, 124, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, - 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, - 1, 0, 1, 0, 3, 0, 35, 8, 0, 1, 0, 3, 0, 38, 8, 0, 1, 0, 1, 0, 1, 1, 3, - 1, 43, 8, 1, 1, 1, 1, 1, 3, 1, 47, 8, 1, 1, 1, 1, 1, 3, 1, 51, 8, 1, 1, - 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 5, 4, 63, 8, 4, - 10, 4, 12, 4, 66, 9, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, - 75, 8, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 5, 7, 82, 8, 7, 10, 7, 12, 7, 85, - 9, 7, 1, 7, 3, 7, 88, 8, 7, 1, 8, 1, 8, 3, 8, 92, 8, 8, 1, 9, 1, 9, 1, - 9, 1, 9, 3, 9, 98, 8, 9, 1, 10, 1, 10, 3, 10, 102, 8, 10, 1, 10, 4, 10, - 105, 8, 10, 11, 10, 12, 10, 106, 1, 10, 3, 10, 110, 8, 10, 1, 11, 1, 11, - 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, - 14, 1, 14, 1, 15, 1, 15, 1, 15, 0, 0, 16, 0, 2, 4, 6, 8, 10, 12, 14, 16, - 18, 20, 22, 24, 26, 28, 30, 0, 0, 128, 0, 32, 1, 0, 0, 0, 2, 42, 1, 0, - 0, 0, 4, 54, 1, 0, 0, 0, 6, 56, 1, 0, 0, 0, 8, 64, 1, 0, 0, 0, 10, 74, - 1, 0, 0, 0, 12, 76, 1, 0, 0, 0, 14, 78, 1, 0, 0, 0, 16, 89, 1, 0, 0, 0, - 18, 93, 1, 0, 0, 0, 20, 99, 1, 0, 0, 0, 22, 111, 1, 0, 0, 0, 24, 115, 1, - 0, 0, 0, 26, 121, 1, 0, 0, 0, 28, 123, 1, 0, 0, 0, 30, 125, 1, 0, 0, 0, - 32, 34, 3, 2, 1, 0, 33, 35, 5, 1, 0, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, - 0, 0, 0, 35, 37, 1, 0, 0, 0, 36, 38, 3, 20, 10, 0, 37, 36, 1, 0, 0, 0, - 37, 38, 1, 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, 40, 5, 0, 0, 1, 40, 1, 1, 0, - 0, 0, 41, 43, 5, 1, 0, 0, 42, 41, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 44, - 1, 0, 0, 0, 44, 46, 3, 6, 3, 0, 45, 47, 5, 1, 0, 0, 46, 45, 1, 0, 0, 0, - 46, 47, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 50, 3, 4, 2, 0, 49, 51, 5, - 1, 0, 0, 50, 49, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, - 53, 3, 8, 4, 0, 53, 3, 1, 0, 0, 0, 54, 55, 5, 5, 0, 0, 55, 5, 1, 0, 0, - 0, 56, 57, 5, 9, 0, 0, 57, 7, 1, 0, 0, 0, 58, 59, 3, 10, 5, 0, 59, 60, - 5, 6, 0, 0, 60, 61, 5, 1, 0, 0, 61, 63, 1, 0, 0, 0, 62, 58, 1, 0, 0, 0, - 63, 66, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 1, - 0, 0, 0, 66, 64, 1, 0, 0, 0, 67, 68, 3, 10, 5, 0, 68, 9, 1, 0, 0, 0, 69, - 75, 3, 12, 6, 0, 70, 75, 3, 14, 7, 0, 71, 75, 3, 16, 8, 0, 72, 75, 3, 18, - 9, 0, 73, 75, 3, 22, 11, 0, 74, 69, 1, 0, 0, 0, 74, 70, 1, 0, 0, 0, 74, - 71, 1, 0, 0, 0, 74, 72, 1, 0, 0, 0, 74, 73, 1, 0, 0, 0, 75, 11, 1, 0, 0, - 0, 76, 77, 5, 9, 0, 0, 77, 13, 1, 0, 0, 0, 78, 83, 5, 8, 0, 0, 79, 80, - 5, 9, 0, 0, 80, 82, 5, 8, 0, 0, 81, 79, 1, 0, 0, 0, 82, 85, 1, 0, 0, 0, - 83, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 87, 1, 0, 0, 0, 85, 83, 1, - 0, 0, 0, 86, 88, 5, 9, 0, 0, 87, 86, 1, 0, 0, 0, 87, 88, 1, 0, 0, 0, 88, - 15, 1, 0, 0, 0, 89, 91, 5, 4, 0, 0, 90, 92, 5, 9, 0, 0, 91, 90, 1, 0, 0, - 0, 91, 92, 1, 0, 0, 0, 92, 17, 1, 0, 0, 0, 93, 94, 5, 5, 0, 0, 94, 95, - 5, 3, 0, 0, 95, 97, 5, 5, 0, 0, 96, 98, 3, 14, 7, 0, 97, 96, 1, 0, 0, 0, - 97, 98, 1, 0, 0, 0, 98, 19, 1, 0, 0, 0, 99, 104, 5, 7, 0, 0, 100, 102, - 5, 1, 0, 0, 101, 100, 1, 0, 0, 0, 101, 102, 1, 0, 0, 0, 102, 103, 1, 0, - 0, 0, 103, 105, 5, 9, 0, 0, 104, 101, 1, 0, 0, 0, 105, 106, 1, 0, 0, 0, - 106, 104, 1, 0, 0, 0, 106, 107, 1, 0, 0, 0, 107, 109, 1, 0, 0, 0, 108, - 110, 5, 1, 0, 0, 109, 108, 1, 0, 0, 0, 109, 110, 1, 0, 0, 0, 110, 21, 1, - 0, 0, 0, 111, 112, 5, 9, 0, 0, 112, 113, 5, 2, 0, 0, 113, 114, 5, 9, 0, - 0, 114, 23, 1, 0, 0, 0, 115, 116, 3, 26, 13, 0, 116, 117, 5, 5, 0, 0, 117, - 118, 3, 28, 14, 0, 118, 119, 5, 1, 0, 0, 119, 120, 3, 30, 15, 0, 120, 25, - 1, 0, 0, 0, 121, 122, 5, 9, 0, 0, 122, 27, 1, 0, 0, 0, 123, 124, 5, 9, - 0, 0, 124, 29, 1, 0, 0, 0, 125, 126, 5, 9, 0, 0, 126, 31, 1, 0, 0, 0, 14, - 34, 37, 42, 46, 50, 64, 74, 83, 87, 91, 97, 101, 106, 109, + 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 1, 0, 1, 0, + 1, 0, 1, 1, 3, 1, 35, 8, 1, 1, 1, 1, 1, 3, 1, 39, 8, 1, 1, 1, 1, 1, 3, + 1, 43, 8, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, + 5, 4, 55, 8, 4, 10, 4, 12, 4, 58, 9, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, + 5, 1, 5, 1, 5, 3, 5, 68, 8, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 5, 7, 75, + 8, 7, 10, 7, 12, 7, 78, 9, 7, 1, 7, 3, 7, 81, 8, 7, 1, 8, 1, 8, 3, 8, 85, + 8, 8, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 91, 8, 9, 1, 10, 1, 10, 3, 10, 95, + 8, 10, 1, 10, 4, 10, 98, 8, 10, 11, 10, 12, 10, 99, 1, 10, 3, 10, 103, + 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 3, 12, 112, 8, + 12, 1, 12, 3, 12, 115, 8, 12, 1, 12, 3, 12, 118, 8, 12, 1, 13, 1, 13, 1, + 14, 1, 14, 1, 14, 0, 0, 15, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, + 24, 26, 28, 0, 0, 127, 0, 30, 1, 0, 0, 0, 2, 34, 1, 0, 0, 0, 4, 46, 1, + 0, 0, 0, 6, 48, 1, 0, 0, 0, 8, 56, 1, 0, 0, 0, 10, 67, 1, 0, 0, 0, 12, + 69, 1, 0, 0, 0, 14, 71, 1, 0, 0, 0, 16, 82, 1, 0, 0, 0, 18, 86, 1, 0, 0, + 0, 20, 92, 1, 0, 0, 0, 22, 104, 1, 0, 0, 0, 24, 108, 1, 0, 0, 0, 26, 119, + 1, 0, 0, 0, 28, 121, 1, 0, 0, 0, 30, 31, 3, 2, 1, 0, 31, 32, 5, 0, 0, 1, + 32, 1, 1, 0, 0, 0, 33, 35, 5, 3, 0, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, + 0, 0, 35, 36, 1, 0, 0, 0, 36, 38, 3, 6, 3, 0, 37, 39, 5, 3, 0, 0, 38, 37, + 1, 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 42, 3, 4, 2, 0, + 41, 43, 5, 3, 0, 0, 42, 41, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 44, 1, + 0, 0, 0, 44, 45, 3, 8, 4, 0, 45, 3, 1, 0, 0, 0, 46, 47, 5, 7, 0, 0, 47, + 5, 1, 0, 0, 0, 48, 49, 5, 11, 0, 0, 49, 7, 1, 0, 0, 0, 50, 51, 3, 10, 5, + 0, 51, 52, 5, 8, 0, 0, 52, 53, 5, 3, 0, 0, 53, 55, 1, 0, 0, 0, 54, 50, + 1, 0, 0, 0, 55, 58, 1, 0, 0, 0, 56, 54, 1, 0, 0, 0, 56, 57, 1, 0, 0, 0, + 57, 59, 1, 0, 0, 0, 58, 56, 1, 0, 0, 0, 59, 60, 3, 10, 5, 0, 60, 9, 1, + 0, 0, 0, 61, 68, 3, 12, 6, 0, 62, 68, 3, 14, 7, 0, 63, 68, 3, 16, 8, 0, + 64, 68, 3, 18, 9, 0, 65, 68, 3, 22, 11, 0, 66, 68, 3, 24, 12, 0, 67, 61, + 1, 0, 0, 0, 67, 62, 1, 0, 0, 0, 67, 63, 1, 0, 0, 0, 67, 64, 1, 0, 0, 0, + 67, 65, 1, 0, 0, 0, 67, 66, 1, 0, 0, 0, 68, 11, 1, 0, 0, 0, 69, 70, 5, + 11, 0, 0, 70, 13, 1, 0, 0, 0, 71, 76, 5, 10, 0, 0, 72, 73, 5, 11, 0, 0, + 73, 75, 5, 10, 0, 0, 74, 72, 1, 0, 0, 0, 75, 78, 1, 0, 0, 0, 76, 74, 1, + 0, 0, 0, 76, 77, 1, 0, 0, 0, 77, 80, 1, 0, 0, 0, 78, 76, 1, 0, 0, 0, 79, + 81, 5, 11, 0, 0, 80, 79, 1, 0, 0, 0, 80, 81, 1, 0, 0, 0, 81, 15, 1, 0, + 0, 0, 82, 84, 5, 6, 0, 0, 83, 85, 5, 11, 0, 0, 84, 83, 1, 0, 0, 0, 84, + 85, 1, 0, 0, 0, 85, 17, 1, 0, 0, 0, 86, 87, 5, 7, 0, 0, 87, 88, 5, 5, 0, + 0, 88, 90, 5, 7, 0, 0, 89, 91, 3, 14, 7, 0, 90, 89, 1, 0, 0, 0, 90, 91, + 1, 0, 0, 0, 91, 19, 1, 0, 0, 0, 92, 97, 5, 9, 0, 0, 93, 95, 5, 3, 0, 0, + 94, 93, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 96, 1, 0, 0, 0, 96, 98, 5, + 11, 0, 0, 97, 94, 1, 0, 0, 0, 98, 99, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 99, + 100, 1, 0, 0, 0, 100, 102, 1, 0, 0, 0, 101, 103, 5, 3, 0, 0, 102, 101, + 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 21, 1, 0, 0, 0, 104, 105, 5, 11, + 0, 0, 105, 106, 5, 4, 0, 0, 106, 107, 5, 11, 0, 0, 107, 23, 1, 0, 0, 0, + 108, 109, 5, 2, 0, 0, 109, 111, 5, 7, 0, 0, 110, 112, 3, 26, 13, 0, 111, + 110, 1, 0, 0, 0, 111, 112, 1, 0, 0, 0, 112, 114, 1, 0, 0, 0, 113, 115, + 5, 3, 0, 0, 114, 113, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115, 117, 1, 0, + 0, 0, 116, 118, 3, 28, 14, 0, 117, 116, 1, 0, 0, 0, 117, 118, 1, 0, 0, + 0, 118, 25, 1, 0, 0, 0, 119, 120, 5, 1, 0, 0, 120, 27, 1, 0, 0, 0, 121, + 122, 5, 11, 0, 0, 122, 29, 1, 0, 0, 0, 15, 34, 38, 42, 56, 67, 76, 80, + 84, 90, 94, 99, 102, 111, 114, 117, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -135,15 +135,17 @@ func NewAliasesParser(input antlr.TokenStream) *AliasesParser { // AliasesParser tokens. const ( AliasesParserEOF = antlr.TokenEOF - AliasesParserSEPARATOR = 1 - AliasesParserAT = 2 - AliasesParserINCLUDE = 3 - AliasesParserVERTLINE = 4 - AliasesParserCOLON = 5 - AliasesParserCOMMA = 6 - AliasesParserNUMBER_SIGN = 7 - AliasesParserSLASH = 8 - AliasesParserSTRING = 9 + AliasesParserDIGITS = 1 + AliasesParserERROR = 2 + AliasesParserSEPARATOR = 3 + AliasesParserAT = 4 + AliasesParserINCLUDE = 5 + AliasesParserVERTLINE = 6 + AliasesParserCOLON = 7 + AliasesParserCOMMA = 8 + AliasesParserNUMBER_SIGN = 9 + AliasesParserSLASH = 10 + AliasesParserSTRING = 11 ) // AliasesParser rules. @@ -161,9 +163,8 @@ const ( AliasesParserRULE_comment = 10 AliasesParserRULE_email = 11 AliasesParserRULE_error = 12 - AliasesParserRULE_errorStatus = 13 - AliasesParserRULE_errorCode = 14 - AliasesParserRULE_errorMessage = 15 + AliasesParserRULE_errorCode = 13 + AliasesParserRULE_errorMessage = 14 ) // ILineStatementContext is an interface to support dynamic dispatch. @@ -176,8 +177,6 @@ type ILineStatementContext interface { // Getter signatures Entry() IEntryContext EOF() antlr.TerminalNode - SEPARATOR() antlr.TerminalNode - Comment() ICommentContext // IsLineStatementContext differentiates from other interfaces. IsLineStatementContext() @@ -235,26 +234,6 @@ func (s *LineStatementContext) EOF() antlr.TerminalNode { return s.GetToken(AliasesParserEOF, 0) } -func (s *LineStatementContext) SEPARATOR() antlr.TerminalNode { - return s.GetToken(AliasesParserSEPARATOR, 0) -} - -func (s *LineStatementContext) Comment() ICommentContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICommentContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICommentContext) -} - func (s *LineStatementContext) GetRuleContext() antlr.RuleContext { return s } @@ -278,47 +257,13 @@ func (s *LineStatementContext) ExitRule(listener antlr.ParseTreeListener) { func (p *AliasesParser) LineStatement() (localctx ILineStatementContext) { localctx = NewLineStatementContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 0, AliasesParserRULE_lineStatement) - var _la int - p.EnterOuterAlt(localctx, 1) { - p.SetState(32) + p.SetState(30) p.Entry() } - p.SetState(34) - p.GetErrorHandler().Sync(p) - if p.HasError() { - goto errorExit - } - _la = p.GetTokenStream().LA(1) - - if _la == AliasesParserSEPARATOR { - { - p.SetState(33) - p.Match(AliasesParserSEPARATOR) - if p.HasError() { - // Recognition error - abort rule - goto errorExit - } - } - - } - p.SetState(37) - p.GetErrorHandler().Sync(p) - if p.HasError() { - goto errorExit - } - _la = p.GetTokenStream().LA(1) - - if _la == AliasesParserNUMBER_SIGN { - { - p.SetState(36) - p.Comment() - } - - } { - p.SetState(39) + p.SetState(31) p.Match(AliasesParserEOF) if p.HasError() { // Recognition error - abort rule @@ -471,6 +416,50 @@ func (p *AliasesParser) Entry() (localctx IEntryContext) { var _la int p.EnterOuterAlt(localctx, 1) + p.SetState(34) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == AliasesParserSEPARATOR { + { + p.SetState(33) + p.Match(AliasesParserSEPARATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(36) + p.Key() + } + p.SetState(38) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == AliasesParserSEPARATOR { + { + p.SetState(37) + p.Match(AliasesParserSEPARATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(40) + p.Separator() + } p.SetState(42) p.GetErrorHandler().Sync(p) if p.HasError() { @@ -491,50 +480,6 @@ func (p *AliasesParser) Entry() (localctx IEntryContext) { } { p.SetState(44) - p.Key() - } - p.SetState(46) - p.GetErrorHandler().Sync(p) - if p.HasError() { - goto errorExit - } - _la = p.GetTokenStream().LA(1) - - if _la == AliasesParserSEPARATOR { - { - p.SetState(45) - p.Match(AliasesParserSEPARATOR) - if p.HasError() { - // Recognition error - abort rule - goto errorExit - } - } - - } - { - p.SetState(48) - p.Separator() - } - p.SetState(50) - p.GetErrorHandler().Sync(p) - if p.HasError() { - goto errorExit - } - _la = p.GetTokenStream().LA(1) - - if _la == AliasesParserSEPARATOR { - { - p.SetState(49) - p.Match(AliasesParserSEPARATOR) - if p.HasError() { - // Recognition error - abort rule - goto errorExit - } - } - - } - { - p.SetState(52) p.Values() } @@ -626,7 +571,7 @@ func (p *AliasesParser) Separator() (localctx ISeparatorContext) { p.EnterRule(localctx, 4, AliasesParserRULE_separator) p.EnterOuterAlt(localctx, 1) { - p.SetState(54) + p.SetState(46) p.Match(AliasesParserCOLON) if p.HasError() { // Recognition error - abort rule @@ -722,7 +667,7 @@ func (p *AliasesParser) Key() (localctx IKeyContext) { p.EnterRule(localctx, 6, AliasesParserRULE_key) p.EnterOuterAlt(localctx, 1) { - p.SetState(56) + p.SetState(48) p.Match(AliasesParserSTRING) if p.HasError() { // Recognition error - abort rule @@ -877,23 +822,23 @@ func (p *AliasesParser) Values() (localctx IValuesContext) { var _alt int p.EnterOuterAlt(localctx, 1) - p.SetState(64) + p.SetState(56) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 5, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 3, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(58) + p.SetState(50) p.Value() } { - p.SetState(59) + p.SetState(51) p.Match(AliasesParserCOMMA) if p.HasError() { // Recognition error - abort rule @@ -901,7 +846,7 @@ func (p *AliasesParser) Values() (localctx IValuesContext) { } } { - p.SetState(60) + p.SetState(52) p.Match(AliasesParserSEPARATOR) if p.HasError() { // Recognition error - abort rule @@ -910,18 +855,18 @@ func (p *AliasesParser) Values() (localctx IValuesContext) { } } - p.SetState(66) + p.SetState(58) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 5, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 3, p.GetParserRuleContext()) if p.HasError() { goto errorExit } } { - p.SetState(67) + p.SetState(59) p.Value() } @@ -951,6 +896,7 @@ type IValueContext interface { Command() ICommandContext Include() IIncludeContext Email() IEmailContext + Error_() IErrorContext // IsValueContext differentiates from other interfaces. IsValueContext() @@ -1068,6 +1014,22 @@ func (s *ValueContext) Email() IEmailContext { return t.(IEmailContext) } +func (s *ValueContext) Error_() IErrorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IErrorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IErrorContext) +} + func (s *ValueContext) GetRuleContext() antlr.RuleContext { return s } @@ -1092,43 +1054,49 @@ func (p *AliasesParser) Value() (localctx IValueContext) { localctx = NewValueContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 10, AliasesParserRULE_value) p.EnterOuterAlt(localctx, 1) - p.SetState(74) + p.SetState(67) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 6, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 4, p.GetParserRuleContext()) { case 1: { - p.SetState(69) + p.SetState(61) p.User() } case 2: { - p.SetState(70) + p.SetState(62) p.File() } case 3: { - p.SetState(71) + p.SetState(63) p.Command() } case 4: { - p.SetState(72) + p.SetState(64) p.Include() } case 5: { - p.SetState(73) + p.SetState(65) p.Email() } + case 6: + { + p.SetState(66) + p.Error_() + } + case antlr.ATNInvalidAltNumber: goto errorExit } @@ -1221,7 +1189,7 @@ func (p *AliasesParser) User() (localctx IUserContext) { p.EnterRule(localctx, 12, AliasesParserRULE_user) p.EnterOuterAlt(localctx, 1) { - p.SetState(76) + p.SetState(69) p.Match(AliasesParserSTRING) if p.HasError() { // Recognition error - abort rule @@ -1336,26 +1304,26 @@ func (p *AliasesParser) File() (localctx IFileContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(78) + p.SetState(71) p.Match(AliasesParserSLASH) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(83) + p.SetState(76) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 7, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 5, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(79) + p.SetState(72) p.Match(AliasesParserSTRING) if p.HasError() { // Recognition error - abort rule @@ -1363,7 +1331,7 @@ func (p *AliasesParser) File() (localctx IFileContext) { } } { - p.SetState(80) + p.SetState(73) p.Match(AliasesParserSLASH) if p.HasError() { // Recognition error - abort rule @@ -1372,17 +1340,17 @@ func (p *AliasesParser) File() (localctx IFileContext) { } } - p.SetState(85) + p.SetState(78) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 7, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 5, p.GetParserRuleContext()) if p.HasError() { goto errorExit } } - p.SetState(87) + p.SetState(80) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1391,7 +1359,7 @@ func (p *AliasesParser) File() (localctx IFileContext) { if _la == AliasesParserSTRING { { - p.SetState(86) + p.SetState(79) p.Match(AliasesParserSTRING) if p.HasError() { // Recognition error - abort rule @@ -1496,14 +1464,14 @@ func (p *AliasesParser) Command() (localctx ICommandContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(89) + p.SetState(82) p.Match(AliasesParserVERTLINE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(91) + p.SetState(84) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1512,7 +1480,7 @@ func (p *AliasesParser) Command() (localctx ICommandContext) { if _la == AliasesParserSTRING { { - p.SetState(90) + p.SetState(83) p.Match(AliasesParserSTRING) if p.HasError() { // Recognition error - abort rule @@ -1639,7 +1607,7 @@ func (p *AliasesParser) Include() (localctx IIncludeContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(93) + p.SetState(86) p.Match(AliasesParserCOLON) if p.HasError() { // Recognition error - abort rule @@ -1647,7 +1615,7 @@ func (p *AliasesParser) Include() (localctx IIncludeContext) { } } { - p.SetState(94) + p.SetState(87) p.Match(AliasesParserINCLUDE) if p.HasError() { // Recognition error - abort rule @@ -1655,14 +1623,14 @@ func (p *AliasesParser) Include() (localctx IIncludeContext) { } } { - p.SetState(95) + p.SetState(88) p.Match(AliasesParserCOLON) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(97) + p.SetState(90) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1671,7 +1639,7 @@ func (p *AliasesParser) Include() (localctx IIncludeContext) { if _la == AliasesParserSLASH { { - p.SetState(96) + p.SetState(89) p.File() } @@ -1789,14 +1757,14 @@ func (p *AliasesParser) Comment() (localctx ICommentContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(99) + p.SetState(92) p.Match(AliasesParserNUMBER_SIGN) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(104) + p.SetState(97) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1805,7 +1773,7 @@ func (p *AliasesParser) Comment() (localctx ICommentContext) { for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { switch _alt { case 1: - p.SetState(101) + p.SetState(94) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1814,7 +1782,7 @@ func (p *AliasesParser) Comment() (localctx ICommentContext) { if _la == AliasesParserSEPARATOR { { - p.SetState(100) + p.SetState(93) p.Match(AliasesParserSEPARATOR) if p.HasError() { // Recognition error - abort rule @@ -1824,7 +1792,7 @@ func (p *AliasesParser) Comment() (localctx ICommentContext) { } { - p.SetState(103) + p.SetState(96) p.Match(AliasesParserSTRING) if p.HasError() { // Recognition error - abort rule @@ -1837,14 +1805,14 @@ func (p *AliasesParser) Comment() (localctx ICommentContext) { goto errorExit } - p.SetState(106) + p.SetState(99) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 12, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 10, p.GetParserRuleContext()) if p.HasError() { goto errorExit } } - p.SetState(109) + p.SetState(102) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1853,7 +1821,7 @@ func (p *AliasesParser) Comment() (localctx ICommentContext) { if _la == AliasesParserSEPARATOR { { - p.SetState(108) + p.SetState(101) p.Match(AliasesParserSEPARATOR) if p.HasError() { // Recognition error - abort rule @@ -1961,7 +1929,7 @@ func (p *AliasesParser) Email() (localctx IEmailContext) { p.EnterRule(localctx, 22, AliasesParserRULE_email) p.EnterOuterAlt(localctx, 1) { - p.SetState(111) + p.SetState(104) p.Match(AliasesParserSTRING) if p.HasError() { // Recognition error - abort rule @@ -1969,7 +1937,7 @@ func (p *AliasesParser) Email() (localctx IEmailContext) { } } { - p.SetState(112) + p.SetState(105) p.Match(AliasesParserAT) if p.HasError() { // Recognition error - abort rule @@ -1977,7 +1945,7 @@ func (p *AliasesParser) Email() (localctx IEmailContext) { } } { - p.SetState(113) + p.SetState(106) p.Match(AliasesParserSTRING) if p.HasError() { // Recognition error - abort rule @@ -2006,7 +1974,7 @@ type IErrorContext interface { GetParser() antlr.Parser // Getter signatures - ErrorStatus() IErrorStatusContext + ERROR() antlr.TerminalNode COLON() antlr.TerminalNode ErrorCode() IErrorCodeContext SEPARATOR() antlr.TerminalNode @@ -2048,20 +2016,8 @@ func NewErrorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invoki func (s *ErrorContext) GetParser() antlr.Parser { return s.parser } -func (s *ErrorContext) ErrorStatus() IErrorStatusContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IErrorStatusContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IErrorStatusContext) +func (s *ErrorContext) ERROR() antlr.TerminalNode { + return s.GetToken(AliasesParserERROR, 0) } func (s *ErrorContext) COLON() antlr.TerminalNode { @@ -2127,130 +2083,70 @@ func (s *ErrorContext) ExitRule(listener antlr.ParseTreeListener) { func (p *AliasesParser) Error_() (localctx IErrorContext) { localctx = NewErrorContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 24, AliasesParserRULE_error) + var _la int + p.EnterOuterAlt(localctx, 1) { - p.SetState(115) - p.ErrorStatus() + p.SetState(108) + p.Match(AliasesParserERROR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(116) + p.SetState(109) p.Match(AliasesParserCOLON) if p.HasError() { // Recognition error - abort rule goto errorExit } } - { - p.SetState(117) - p.ErrorCode() - } - { - p.SetState(118) - p.Match(AliasesParserSEPARATOR) - if p.HasError() { - // Recognition error - abort rule - goto errorExit - } - } - { - p.SetState(119) - p.ErrorMessage() - } - -errorExit: + p.SetState(111) + p.GetErrorHandler().Sync(p) if p.HasError() { - v := p.GetError() - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - p.SetError(nil) + goto errorExit } - p.ExitRule() - return localctx - goto errorExit // Trick to prevent compiler error if the label is not used -} + _la = p.GetTokenStream().LA(1) -// IErrorStatusContext is an interface to support dynamic dispatch. -type IErrorStatusContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - STRING() antlr.TerminalNode - - // IsErrorStatusContext differentiates from other interfaces. - IsErrorStatusContext() -} - -type ErrorStatusContext struct { - antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyErrorStatusContext() *ErrorStatusContext { - var p = new(ErrorStatusContext) - antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) - p.RuleIndex = AliasesParserRULE_errorStatus - return p -} - -func InitEmptyErrorStatusContext(p *ErrorStatusContext) { - antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) - p.RuleIndex = AliasesParserRULE_errorStatus -} - -func (*ErrorStatusContext) IsErrorStatusContext() {} - -func NewErrorStatusContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ErrorStatusContext { - var p = new(ErrorStatusContext) - - antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) - - p.parser = parser - p.RuleIndex = AliasesParserRULE_errorStatus - - return p -} - -func (s *ErrorStatusContext) GetParser() antlr.Parser { return s.parser } - -func (s *ErrorStatusContext) STRING() antlr.TerminalNode { - return s.GetToken(AliasesParserSTRING, 0) -} - -func (s *ErrorStatusContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *ErrorStatusContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *ErrorStatusContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(AliasesListener); ok { - listenerT.EnterErrorStatus(s) - } -} - -func (s *ErrorStatusContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(AliasesListener); ok { - listenerT.ExitErrorStatus(s) - } -} - -func (p *AliasesParser) ErrorStatus() (localctx IErrorStatusContext) { - localctx = NewErrorStatusContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 26, AliasesParserRULE_errorStatus) - p.EnterOuterAlt(localctx, 1) - { - p.SetState(121) - p.Match(AliasesParserSTRING) - if p.HasError() { - // Recognition error - abort rule - goto errorExit + if _la == AliasesParserDIGITS { + { + p.SetState(110) + p.ErrorCode() } + + } + p.SetState(114) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == AliasesParserSEPARATOR { + { + p.SetState(113) + p.Match(AliasesParserSEPARATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + p.SetState(117) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == AliasesParserSTRING { + { + p.SetState(116) + p.ErrorMessage() + } + } errorExit: @@ -2274,7 +2170,7 @@ type IErrorCodeContext interface { GetParser() antlr.Parser // Getter signatures - STRING() antlr.TerminalNode + DIGITS() antlr.TerminalNode // IsErrorCodeContext differentiates from other interfaces. IsErrorCodeContext() @@ -2312,8 +2208,8 @@ func NewErrorCodeContext(parser antlr.Parser, parent antlr.ParserRuleContext, in func (s *ErrorCodeContext) GetParser() antlr.Parser { return s.parser } -func (s *ErrorCodeContext) STRING() antlr.TerminalNode { - return s.GetToken(AliasesParserSTRING, 0) +func (s *ErrorCodeContext) DIGITS() antlr.TerminalNode { + return s.GetToken(AliasesParserDIGITS, 0) } func (s *ErrorCodeContext) GetRuleContext() antlr.RuleContext { @@ -2338,11 +2234,11 @@ func (s *ErrorCodeContext) ExitRule(listener antlr.ParseTreeListener) { func (p *AliasesParser) ErrorCode() (localctx IErrorCodeContext) { localctx = NewErrorCodeContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 28, AliasesParserRULE_errorCode) + p.EnterRule(localctx, 26, AliasesParserRULE_errorCode) p.EnterOuterAlt(localctx, 1) { - p.SetState(123) - p.Match(AliasesParserSTRING) + p.SetState(119) + p.Match(AliasesParserDIGITS) if p.HasError() { // Recognition error - abort rule goto errorExit @@ -2434,10 +2330,10 @@ func (s *ErrorMessageContext) ExitRule(listener antlr.ParseTreeListener) { func (p *AliasesParser) ErrorMessage() (localctx IErrorMessageContext) { localctx = NewErrorMessageContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 30, AliasesParserRULE_errorMessage) + p.EnterRule(localctx, 28, AliasesParserRULE_errorMessage) p.EnterOuterAlt(localctx, 1) { - p.SetState(125) + p.SetState(121) p.Match(AliasesParserSTRING) if p.HasError() { // Recognition error - abort rule