diff --git a/Lexer.g4 b/Lexer.g4 new file mode 100644 index 00000000..a7c4816d --- /dev/null +++ b/Lexer.g4 @@ -0,0 +1,52 @@ +lexer grammar Lexer; +WS: [ \t\r\n]+ -> skip; +NEWLINE: [\r\n]+; +MULTILINE_COMMENT: '/*' (MULTILINE_COMMENT | .)*? '*/' -> skip; +LINE_COMMENT: '//' .*? NEWLINE -> skip; + +VARS: 'vars'; +MAX: 'max'; +SOURCE: 'source'; +DESTINATION: 'destination'; +SEND: 'send'; +FROM: 'from'; +UP: 'up'; +TO: 'to'; +REMAINING: 'remaining'; +ALLOWING: 'allowing'; +UNBOUNDED: 'unbounded'; +OVERDRAFT: 'overdraft'; +ONEOF: 'oneof'; +KEPT: 'kept'; +SAVE: 'save'; +LPARENS: '('; +RPARENS: ')'; +LBRACKET: '['; +RBRACKET: ']'; +LBRACE: '{'; +RBRACE: '}'; +COMMA: ','; +EQ: '='; +STAR: '*'; +PLUS: '+'; +MINUS: '-'; +DIV: '/'; + +PERCENTAGE_PORTION_LITERAL: [0-9]+ ('.' [0-9]+)? '%'; + +STRING: '"' ('\\"' | ~[\r\n"])* '"'; + +IDENTIFIER: [a-z]+ [a-z_]*; +NUMBER: MINUS? [0-9]+ ('_' [0-9]+)*; +ASSET: [A-Z][A-Z0-9]* ('/' [0-9]+)?; + +ACCOUNT_START: '@' -> pushMode(ACCOUNT_MODE); +COLON: ':' -> pushMode(ACCOUNT_MODE); +fragment VARIABLE_NAME_FRAGMENT: '$' [a-z_]+ [a-z0-9_]*; + +mode ACCOUNT_MODE; +ACCOUNT_TEXT: [a-zA-Z0-9_-]+ -> popMode; +VARIABLE_NAME_ACC: VARIABLE_NAME_FRAGMENT -> popMode; + +mode DEFAULT_MODE; +VARIABLE_NAME: VARIABLE_NAME_FRAGMENT; \ No newline at end of file diff --git a/Numscript.g4 b/Numscript.g4 index fda9cf8f..ec857163 100644 --- a/Numscript.g4 +++ b/Numscript.g4 @@ -1,60 +1,27 @@ grammar Numscript; -// Tokens -WS: [ \t\r\n]+ -> skip; -NEWLINE: [\r\n]+; -MULTILINE_COMMENT: '/*' (MULTILINE_COMMENT | .)*? '*/' -> skip; -LINE_COMMENT: '//' .*? NEWLINE -> skip; - -VARS: 'vars'; -MAX: 'max'; -SOURCE: 'source'; -DESTINATION: 'destination'; -SEND: 'send'; -FROM: 'from'; -UP: 'up'; -TO: 'to'; -REMAINING: 'remaining'; -ALLOWING: 'allowing'; -UNBOUNDED: 'unbounded'; -OVERDRAFT: 'overdraft'; -KEPT: 'kept'; -SAVE: 'save'; -LPARENS: '('; -RPARENS: ')'; -LBRACKET: '['; -RBRACKET: ']'; -LBRACE: '{'; -RBRACE: '}'; -COMMA: ','; -EQ: '='; -STAR: '*'; -MINUS: '-'; - -PERCENTAGE_PORTION_LITERAL: [0-9]+ ('.' [0-9]+)? '%'; - -STRING: '"' ('\\"' | ~[\r\n"])* '"'; - -IDENTIFIER: [a-z]+ [a-z_]*; -NUMBER: MINUS? [0-9]+ ('_' [0-9]+)*; -VARIABLE_NAME: '$' [a-z_]+ [a-z0-9_]*; -ACCOUNT: '@' [a-zA-Z0-9_-]+ (':' [a-zA-Z0-9_-]+)*; -ASSET: [A-Z][A-Z0-9]* ('/' [0-9]+)?; +options { + tokenVocab = 'Lexer'; +} monetaryLit: LBRACKET (asset = valueExpr) (amt = valueExpr) RBRACKET; +accountLiteralPart: + ACCOUNT_TEXT # accountTextPart + | VARIABLE_NAME_ACC # accountVarPart; + valueExpr: - VARIABLE_NAME # variableExpr - | ASSET # assetLiteral - | STRING # stringLiteral - | ACCOUNT # accountLiteral - | NUMBER # numberLiteral - | PERCENTAGE_PORTION_LITERAL # percentagePortionLiteral - | monetaryLit # monetaryLiteral - | left = valueExpr op = '/' right = valueExpr # infixExpr - | left = valueExpr op = ('+' | '-') right = valueExpr # infixExpr - | '(' valueExpr ')' # parenthesizedExpr; + VARIABLE_NAME # variableExpr + | ASSET # assetLiteral + | STRING # stringLiteral + | ACCOUNT_START accountLiteralPart (COLON accountLiteralPart)* # accountLiteral + | NUMBER # numberLiteral + | PERCENTAGE_PORTION_LITERAL # percentagePortionLiteral + | monetaryLit # monetaryLiteral + | left = valueExpr op = DIV right = valueExpr # infixExpr + | left = valueExpr op = (PLUS | MINUS) right = valueExpr # infixExpr + | LPARENS valueExpr RPARENS # parenthesizedExpr; functionCallArgs: valueExpr ( COMMA valueExpr)*; functionCall: @@ -80,7 +47,7 @@ source: | valueExpr # srcAccount | LBRACE allotmentClauseSrc+ RBRACE # srcAllotment | LBRACE source* RBRACE # srcInorder - | 'oneof' LBRACE source+ RBRACE # srcOneof + | ONEOF LBRACE source+ RBRACE # srcOneof | MAX cap = valueExpr FROM source # srcCapped; allotmentClauseSrc: allotment FROM source; @@ -90,10 +57,10 @@ keptOrDestination: destinationInOrderClause: MAX valueExpr keptOrDestination; destination: - valueExpr # destAccount - | LBRACE allotmentClauseDest+ RBRACE # destAllotment - | LBRACE destinationInOrderClause* REMAINING keptOrDestination RBRACE # destInorder - | 'oneof' LBRACE destinationInOrderClause* REMAINING keptOrDestination RBRACE # destOneof; + valueExpr # destAccount + | LBRACE allotmentClauseDest+ RBRACE # destAllotment + | LBRACE destinationInOrderClause* REMAINING keptOrDestination RBRACE # destInorder + | ONEOF LBRACE destinationInOrderClause* REMAINING keptOrDestination RBRACE # destOneof; allotmentClauseDest: allotment keptOrDestination; sentValue: valueExpr # sentLiteral | sentAllLit # sentAll; diff --git a/generate-parser.sh b/generate-parser.sh index c2869e49..9ec96fac 100644 --- a/generate-parser.sh +++ b/generate-parser.sh @@ -1 +1,2 @@ -antlr4 -Dlanguage=Go Numscript.g4 -o internal/parser/antlr +antlr4 -Dlanguage=Go Lexer.g4 Numscript.g4 -o internal/parser/antlrParser -package antlrParser +mv internal/parser/antlrParser/_lexer.go internal/parser/antlrParser/lexer.go \ No newline at end of file diff --git a/internal/analysis/check.go b/internal/analysis/check.go index 8f58752c..277a1ba1 100644 --- a/internal/analysis/check.go +++ b/internal/analysis/check.go @@ -386,7 +386,12 @@ func (res *CheckResult) checkTypeOf(lit parser.ValueExpr) string { return TypeAny } - case *parser.AccountLiteral: + case *parser.AccountInterpLiteral: + for _, part := range lit.Parts { + if v, ok := part.(*parser.Variable); ok { + res.checkExpression(v, TypeAny) + } + } return TypeAccount case *parser.PercentageLiteral: return TypePortion @@ -459,7 +464,7 @@ func (res *CheckResult) checkSource(source parser.Source) { switch source := source.(type) { case *parser.SourceAccount: res.checkExpression(source.ValueExpr, TypeAccount) - if account, ok := source.ValueExpr.(*parser.AccountLiteral); ok { + if account, ok := source.ValueExpr.(*parser.AccountInterpLiteral); ok { if account.IsWorld() && res.unboundedSend { res.Diagnostics = append(res.Diagnostics, Diagnostic{ Range: source.GetRange(), @@ -469,18 +474,18 @@ func (res *CheckResult) checkSource(source parser.Source) { res.unboundedAccountInSend = account } - if _, emptied := res.emptiedAccount[account.Name]; emptied && !account.IsWorld() { + if _, emptied := res.emptiedAccount[account.String()]; emptied && !account.IsWorld() { res.Diagnostics = append(res.Diagnostics, Diagnostic{ - Kind: &EmptiedAccount{Name: account.Name}, + Kind: &EmptiedAccount{Name: account.String()}, Range: account.Range, }) } - res.emptiedAccount[account.Name] = struct{}{} + res.emptiedAccount[account.String()] = struct{}{} } case *parser.SourceOverdraft: - if accountLiteral, ok := source.Address.(*parser.AccountLiteral); ok && accountLiteral.IsWorld() { + if accountLiteral, ok := source.Address.(*parser.AccountInterpLiteral); ok && accountLiteral.IsWorld() { res.Diagnostics = append(res.Diagnostics, Diagnostic{ Range: accountLiteral.Range, Kind: &InvalidWorldOverdraft{}, diff --git a/internal/analysis/check_test.go b/internal/analysis/check_test.go index d63fdbfd..61e2edbb 100644 --- a/internal/analysis/check_test.go +++ b/internal/analysis/check_test.go @@ -1790,3 +1790,51 @@ func TestCheckMinus(t *testing.T) { }, diagnostics) }) } + +func TestNoUnusedOnStringInterp(t *testing.T) { + t.Parallel() + + input := `vars { number $id } +send [EUR/2 *] ( + source = @user:$id:pending + destination = @dest +)` + + program := parser.Parse(input).Value + + diagnostics := analysis.CheckProgram(program).Diagnostics + require.Empty(t, diagnostics) + +} + +func TestWrongTypeInsideAccountInterp(t *testing.T) { + t.Skip("TODO formalize a better type system to model this easy") + + t.Parallel() + + input := `vars { monetary $m } +send [EUR/2 *] ( + source = @user:$m + destination = @dest +)` + + program := parser.Parse(input).Value + + diagnostics := analysis.CheckProgram(program).Diagnostics + + require.Len(t, diagnostics, 1, "diagnostics=%#v\n", diagnostics) + + d1 := diagnostics[0] + assert.Equal(t, + &analysis.TypeMismatch{ + Expected: "number|account|string", + Got: "monetary", + }, + d1.Kind, + ) + + assert.Equal(t, + parser.RangeOfIndexed(input, "$m", 1), + d1.Range, + ) +} diff --git a/internal/analysis/hover.go b/internal/analysis/hover.go index 5b79e08f..e50b6aa7 100644 --- a/internal/analysis/hover.go +++ b/internal/analysis/hover.go @@ -150,6 +150,16 @@ func hoverOnExpression(lit parser.ValueExpr, position parser.Position) Hover { Range: lit.Range, Node: lit, } + case *parser.AccountInterpLiteral: + for _, part := range lit.Parts { + if v, ok := part.(*parser.Variable); ok { + + hover := hoverOnExpression(v, position) + if hover != nil { + return hover + } + } + } case *parser.MonetaryLiteral: hover := hoverOnExpression(lit.Amount, position) if hover != nil { diff --git a/internal/analysis/hover_test.go b/internal/analysis/hover_test.go index 21535fd7..a785ba54 100644 --- a/internal/analysis/hover_test.go +++ b/internal/analysis/hover_test.go @@ -496,3 +496,30 @@ func TestHoverFaultTolerance(t *testing.T) { require.Nil(t, hover) }) } + +func TestHoverOnStringInterp(t *testing.T) { + + input := `vars { number $id } +send [ASSET *] ( + source = @world + destination = @user:$id +) +` + + rng := parser.RangeOfIndexed(input, "$id", 1) + + program := parser.Parse(input).Value + hover := analysis.HoverOn(program, rng.Start) + require.NotNil(t, hover) + + variableHover, ok := hover.(*analysis.VariableHover) + require.True(t, ok, "Expected VariableHover") + + require.Equal(t, rng, variableHover.Range) + + checkResult := analysis.CheckProgram(program) + require.NotNil(t, variableHover.Node) + + resolved := checkResult.ResolveVar(variableHover.Node) + require.NotNil(t, resolved) +} diff --git a/internal/interpreter/evaluate_expr.go b/internal/interpreter/evaluate_expr.go index 76c72eea..b742b3c1 100644 --- a/internal/interpreter/evaluate_expr.go +++ b/internal/interpreter/evaluate_expr.go @@ -2,6 +2,7 @@ package interpreter import ( "math/big" + "strings" "github.com/formancehq/numscript/internal/parser" "github.com/formancehq/numscript/internal/utils" @@ -11,8 +12,32 @@ func (st *programState) evaluateExpr(expr parser.ValueExpr) (Value, InterpreterE switch expr := expr.(type) { case *parser.AssetLiteral: return Asset(expr.Asset), nil - case *parser.AccountLiteral: - return AccountAddress(expr.Name), nil + case *parser.AccountInterpLiteral: + var parts []string + for _, part := range expr.Parts { + switch part := part.(type) { + case parser.AccountTextPart: + parts = append(parts, part.Name) + case *parser.Variable: + err := st.checkFeatureFlag(ExperimentalAccountInterpolationFlag) + if err != nil { + return nil, err + } + + value, err := st.evaluateExpr(part) + if err != nil { + return nil, err + } + strValue, err := castToString(value, expr.Range) + if err != nil { + return nil, err + } + parts = append(parts, strValue) + } + } + name := strings.Join(parts, ":") + return NewAccountAddress(name) + case *parser.StringLiteral: return String(expr.String), nil case *parser.PercentageLiteral: @@ -149,3 +174,18 @@ func (st *programState) divOp(rng parser.Range, left parser.ValueExpr, right par return Portion(*rat), nil } + +func castToString(v Value, rng parser.Range) (string, InterpreterError) { + switch v := v.(type) { + case AccountAddress: + return v.String(), nil + case String: + return v.String(), nil + case MonetaryInt: + return v.String(), nil + + default: + // No asset nor ratio can be implicitly cast to string + return "", CannotCastToString{Value: v, Range: rng} + } +} diff --git a/internal/interpreter/interpreter.go b/internal/interpreter/interpreter.go index d0855856..e73fa802 100644 --- a/internal/interpreter/interpreter.go +++ b/internal/interpreter/interpreter.go @@ -89,7 +89,7 @@ func parseVar(type_ string, rawValue string, r parser.Range) (Value, Interpreter case analysis.TypeMonetary: return parseMonetary(rawValue) case analysis.TypeAccount: - return AccountAddress(rawValue), nil + return NewAccountAddress(rawValue) case analysis.TypePortion: bi, err := ParsePortionSpecific(rawValue) if err != nil { @@ -182,6 +182,7 @@ type FeatureFlag = string const ( ExperimentalOverdraftFunctionFeatureFlag FeatureFlag = "experimental-overdraft-function" ExperimentalOneofFeatureFlag FeatureFlag = "experimental-oneof" + ExperimentalAccountInterpolationFlag FeatureFlag = "experimental-account-interpolation" ) func RunProgram( diff --git a/internal/interpreter/interpreter_error.go b/internal/interpreter/interpreter_error.go index e3566c1f..9883d742 100644 --- a/internal/interpreter/interpreter_error.go +++ b/internal/interpreter/interpreter_error.go @@ -202,3 +202,21 @@ type ExperimentalFeature struct { func (e ExperimentalFeature) Error() string { return fmt.Sprintf("this feature is experimental. You need the '%s' feature flag to enable it", e.FlagName) } + +type CannotCastToString struct { + parser.Range + Value Value +} + +func (e CannotCastToString) Error() string { + return fmt.Sprintf("Cannot cast this value to string: %s", e.Value) +} + +type InvalidAccountName struct { + parser.Range + Name string +} + +func (e InvalidAccountName) Error() string { + return fmt.Sprintf("Invalid account name: @%s", e.Name) +} diff --git a/internal/interpreter/interpreter_test.go b/internal/interpreter/interpreter_test.go index 8d5a7651..1a0ea08e 100644 --- a/internal/interpreter/interpreter_test.go +++ b/internal/interpreter/interpreter_test.go @@ -3835,3 +3835,115 @@ func TestOneofDestinationRemainingClause(t *testing.T) { } testWithFeatureFlag(t, tc, machine.ExperimentalOneofFeatureFlag) } + +func TestInvalidAccount(t *testing.T) { + script := ` + vars { + account $acc + } + set_tx_meta("k", $acc) + ` + + tc := NewTestCase() + tc.setVarsFromJSON(t, ` + { + "acc": "!invalid acc.." + } + `) + + tc.compile(t, script) + + tc.expected = CaseResult{ + Postings: []Posting{}, + Error: machine.InvalidAccountName{ + Name: "!invalid acc..", + }, + } + test(t, tc) +} + +func TestInvalidInterpAccount(t *testing.T) { + script := ` + vars { + string $status + } + set_tx_meta("k", @user:$status) + ` + + tc := NewTestCase() + tc.setVarsFromJSON(t, ` + { + "status": "!invalid acc.." + } + `) + + tc.compile(t, script) + + tc.expected = CaseResult{ + Postings: []Posting{}, + Error: machine.InvalidAccountName{ + Name: "user:!invalid acc..", + }, + } + testWithFeatureFlag(t, tc, machine.ExperimentalAccountInterpolationFlag) +} + +func TestAccountInterp(t *testing.T) { + script := ` + vars { + number $id + string $status + account $acc + } + set_tx_meta("k", @acc:$id:$status:$acc) + ` + + tc := NewTestCase() + tc.setVarsFromJSON(t, ` + { + "id": "42", + "status": "pending", + "acc": "user:001" + } + `) + + tc.compile(t, script) + + tc.expected = CaseResult{ + Postings: []Posting{}, + TxMetadata: map[string]machine.Value{ + "k": machine.AccountAddress("acc:42:pending:user:001"), + }, + } + testWithFeatureFlag(t, tc, machine.ExperimentalAccountInterpolationFlag) +} + +func TestAccountInvalidString(t *testing.T) { + script := ` + vars { + monetary $m + } + set_tx_meta("k", @acc:$m) + ` + + tc := NewTestCase() + tc.setVarsFromJSON(t, ` + { + "m": "USD/2 10" + } + `) + + tc.compile(t, script) + + tc.expected = CaseResult{ + Postings: []Posting{}, + Error: machine.CannotCastToString{ + Range: parser.RangeOfIndexed(script, "@acc:$m", 0), + Value: machine.Monetary{ + Amount: machine.NewMonetaryInt(10), + Asset: machine.Asset("USD/2"), + }, + }, + } + testWithFeatureFlag(t, tc, machine.ExperimentalAccountInterpolationFlag) +} diff --git a/internal/interpreter/value.go b/internal/interpreter/value.go index 20733368..45431415 100644 --- a/internal/interpreter/value.go +++ b/internal/interpreter/value.go @@ -3,6 +3,7 @@ package interpreter import ( "fmt" "math/big" + "regexp" "github.com/formancehq/numscript/internal/analysis" "github.com/formancehq/numscript/internal/parser" @@ -30,6 +31,13 @@ func (Monetary) value() {} func (Portion) value() {} func (Asset) value() {} +func NewAccountAddress(src string) (AccountAddress, InterpreterError) { + if !validateAddress(src) { + return AccountAddress(""), InvalidAccountName{Name: src} + } + return AccountAddress(src), nil +} + func (v MonetaryInt) MarshalJSON() ([]byte, error) { bigInt := big.Int(v) s := fmt.Sprintf(`"%s"`, bigInt.String()) @@ -227,3 +235,12 @@ func (m MonetaryInt) Sub(other MonetaryInt) MonetaryInt { sum := new(big.Int).Sub(&bi, &otherBi) return MonetaryInt(*sum) } + +const segmentRegex = "[a-zA-Z0-9_-]+" +const accountPattern = "^" + segmentRegex + "(:" + segmentRegex + ")*$" + +var Regexp = regexp.MustCompile(accountPattern) + +func validateAddress(addr string) bool { + return Regexp.Match([]byte(addr)) +} diff --git a/internal/parser/__snapshots__/parser_fault_tolerance_test.snap b/internal/parser/__snapshots__/parser_fault_tolerance_test.snap index 37298d6c..3302b777 100755 --- a/internal/parser/__snapshots__/parser_fault_tolerance_test.snap +++ b/internal/parser/__snapshots__/parser_fault_tolerance_test.snap @@ -63,12 +63,12 @@ parser.Program{ &parser.SendStatement{ Range: parser.Range{ Start: parser.Position{}, - End: parser.Position{Character:1, Line:5}, + End: parser.Position{Character:17, Line:4}, }, SentValue: &parser.SentValueLiteral{ Range: parser.Range{ Start: parser.Position{Character:6, Line:0}, - End: parser.Position{Character:1, Line:5}, + End: parser.Position{Character:17, Line:4}, }, Monetary: nil, }, @@ -115,12 +115,14 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:13, Line:1}, End: parser.Position{Character:15, Line:1}, }, - Name: "a", + Parts: { + parser.AccountTextPart{Name:"a"}, + }, }, }, Destination: nil, @@ -173,12 +175,14 @@ parser.Program{ Cap: nil, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:18, Line:2}, End: parser.Position{Character:20, Line:2}, }, - Name: "d", + Parts: { + parser.AccountTextPart{Name:"d"}, + }, }, }, }, @@ -253,12 +257,14 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, End: parser.Position{Character:13, Line:1}, }, - Name: "a", + Parts: { + parser.AccountTextPart{Name:"a"}, + }, }, }, Destination: &parser.DestinationInorder{ diff --git a/internal/parser/__snapshots__/parser_test.snap b/internal/parser/__snapshots__/parser_test.snap index e430d5c6..81b55bdd 100755 --- a/internal/parser/__snapshots__/parser_test.snap +++ b/internal/parser/__snapshots__/parser_test.snap @@ -34,21 +34,25 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, End: parser.Position{Character:15, Line:1}, }, - Name: "src", + Parts: { + parser.AccountTextPart{Name:"src"}, + }, }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:16, Line:2}, End: parser.Position{Character:21, Line:2}, }, - Name: "dest", + Parts: { + parser.AccountTextPart{Name:"dest"}, + }, }, }, }, @@ -184,24 +188,28 @@ parser.Program{ }, }, From: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:22, Line:1}, End: parser.Position{Character:25, Line:1}, }, - Name: "s1", + Parts: { + parser.AccountTextPart{Name:"s1"}, + }, }, }, }, }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:16, Line:2}, End: parser.Position{Character:18, Line:2}, }, - Name: "d", + Parts: { + parser.AccountTextPart{Name:"d"}, + }, }, }, }, @@ -269,12 +277,14 @@ parser.Program{ }, }, From: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:13, Line:2}, End: parser.Position{Character:16, Line:2}, }, - Name: "s1", + Parts: { + parser.AccountTextPart{Name:"s1"}, + }, }, }, }, @@ -307,12 +317,14 @@ parser.Program{ }, }, From: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:10, Line:3}, End: parser.Position{Character:13, Line:3}, }, - Name: "s2", + Parts: { + parser.AccountTextPart{Name:"s2"}, + }, }, }, }, @@ -328,24 +340,28 @@ parser.Program{ }, }, From: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:16, Line:4}, End: parser.Position{Character:19, Line:4}, }, - Name: "s3", + Parts: { + parser.AccountTextPart{Name:"s3"}, + }, }, }, }, }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:16, Line:6}, End: parser.Position{Character:18, Line:6}, }, - Name: "d", + Parts: { + parser.AccountTextPart{Name:"d"}, + }, }, }, }, @@ -413,24 +429,28 @@ parser.Program{ }, }, From: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:24, Line:1}, End: parser.Position{Character:26, Line:1}, }, - Name: "s", + Parts: { + parser.AccountTextPart{Name:"s"}, + }, }, }, }, }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:16, Line:2}, End: parser.Position{Character:18, Line:2}, }, - Name: "d", + Parts: { + parser.AccountTextPart{Name:"d"}, + }, }, }, }, @@ -474,12 +494,14 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, End: parser.Position{Character:13, Line:1}, }, - Name: "s", + Parts: { + parser.AccountTextPart{Name:"s"}, + }, }, }, Destination: &parser.DestinationAllotment{ @@ -518,12 +540,14 @@ parser.Program{ }, To: &parser.DestinationTo{ Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:25, Line:2}, End: parser.Position{Character:27, Line:2}, }, - Name: "d", + Parts: { + parser.AccountTextPart{Name:"d"}, + }, }, }, }, @@ -576,12 +600,14 @@ parser.Program{ End: parser.Position{Character:35, Line:1}, }, From: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:31, Line:1}, End: parser.Position{Character:35, Line:1}, }, - Name: "src", + Parts: { + parser.AccountTextPart{Name:"src"}, + }, }, }, Cap: &parser.MonetaryLiteral{ @@ -606,12 +632,14 @@ parser.Program{ }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:16, Line:2}, End: parser.Position{Character:21, Line:2}, }, - Name: "dest", + Parts: { + parser.AccountTextPart{Name:"dest"}, + }, }, }, }, @@ -660,12 +688,14 @@ parser.Program{ End: parser.Position{Character:32, Line:1}, }, From: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:28, Line:1}, End: parser.Position{Character:32, Line:1}, }, - Name: "src", + Parts: { + parser.AccountTextPart{Name:"src"}, + }, }, }, Cap: &parser.Variable{ @@ -677,12 +707,14 @@ parser.Program{ }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:16, Line:2}, End: parser.Position{Character:21, Line:2}, }, - Name: "dest", + Parts: { + parser.AccountTextPart{Name:"dest"}, + }, }, }, }, @@ -737,12 +769,14 @@ parser.Program{ End: parser.Position{Character:27, Line:2}, }, From: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:23, Line:2}, End: parser.Position{Character:27, Line:2}, }, - Name: "src", + Parts: { + parser.AccountTextPart{Name:"src"}, + }, }, }, Cap: &parser.MonetaryLiteral{ @@ -767,32 +801,38 @@ parser.Program{ }, }, &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:1, Line:3}, End: parser.Position{Character:3, Line:3}, }, - Name: "a", + Parts: { + parser.AccountTextPart{Name:"a"}, + }, }, }, &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:1, Line:4}, End: parser.Position{Character:3, Line:4}, }, - Name: "b", + Parts: { + parser.AccountTextPart{Name:"b"}, + }, }, }, }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:16, Line:6}, End: parser.Position{Character:21, Line:6}, }, - Name: "dest", + Parts: { + parser.AccountTextPart{Name:"dest"}, + }, }, }, }, @@ -836,21 +876,25 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:27, Line:1}, End: parser.Position{Character:31, Line:1}, }, - Name: "src", + Parts: { + parser.AccountTextPart{Name:"src"}, + }, }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:46, Line:1}, End: parser.Position{Character:51, Line:1}, }, - Name: "dest", + Parts: { + parser.AccountTextPart{Name:"dest"}, + }, }, }, }, @@ -886,21 +930,25 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:27, Line:2}, End: parser.Position{Character:31, Line:2}, }, - Name: "src", + Parts: { + parser.AccountTextPart{Name:"src"}, + }, }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:46, Line:2}, End: parser.Position{Character:51, Line:2}, }, - Name: "dest", + Parts: { + parser.AccountTextPart{Name:"dest"}, + }, }, }, }, @@ -963,21 +1011,25 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, End: parser.Position{Character:13, Line:1}, }, - Name: "a", + Parts: { + parser.AccountTextPart{Name:"a"}, + }, }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:16, Line:2}, End: parser.Position{Character:18, Line:2}, }, - Name: "b", + Parts: { + parser.AccountTextPart{Name:"b"}, + }, }, }, }, @@ -1021,12 +1073,14 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, End: parser.Position{Character:13, Line:1}, }, - Name: "s", + Parts: { + parser.AccountTextPart{Name:"s"}, + }, }, }, Destination: &parser.DestinationAllotment{ @@ -1065,12 +1119,14 @@ parser.Program{ }, To: &parser.DestinationTo{ Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:10, Line:3}, End: parser.Position{Character:12, Line:3}, }, - Name: "d", + Parts: { + parser.AccountTextPart{Name:"d"}, + }, }, }, }, @@ -1088,12 +1144,14 @@ parser.Program{ }, To: &parser.DestinationTo{ Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:14, Line:4}, End: parser.Position{Character:17, Line:4}, }, - Name: "d2", + Parts: { + parser.AccountTextPart{Name:"d2"}, + }, }, }, }, @@ -1161,24 +1219,28 @@ parser.Program{ }, }, From: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:9, Line:2}, End: parser.Position{Character:11, Line:2}, }, - Name: "a", + Parts: { + parser.AccountTextPart{Name:"a"}, + }, }, }, }, }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:16, Line:4}, End: parser.Position{Character:18, Line:4}, }, - Name: "d", + Parts: { + parser.AccountTextPart{Name:"d"}, + }, }, }, }, @@ -1213,22 +1275,26 @@ parser.Program{ Start: parser.Position{Character:10, Line:1}, End: parser.Position{Character:43, Line:1}, }, - Address: &parser.AccountLiteral{ + Address: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:10, Line:1}, End: parser.Position{Character:14, Line:1}, }, - Name: "src", + Parts: { + parser.AccountTextPart{Name:"src"}, + }, }, Bounded: (*parser.ValueExpr)(nil), }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:15, Line:2}, End: parser.Position{Character:20, Line:2}, }, - Name: "dest", + Parts: { + parser.AccountTextPart{Name:"dest"}, + }, }, }, }, @@ -1273,12 +1339,14 @@ parser.Program{ Bounded: (*parser.ValueExpr)(nil), }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:15, Line:2}, End: parser.Position{Character:20, Line:2}, }, - Name: "dest", + Parts: { + parser.AccountTextPart{Name:"dest"}, + }, }, }, }, @@ -1342,12 +1410,14 @@ parser.Program{ }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:15, Line:2}, End: parser.Position{Character:20, Line:2}, }, - Name: "dest", + Parts: { + parser.AccountTextPart{Name:"dest"}, + }, }, }, }, @@ -1394,12 +1464,14 @@ parser.Program{ Name: "example_fn", }, Args: { - &parser.AccountLiteral{ + &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:0}, End: parser.Position{Character:19, Line:0}, }, - Name: "example", + Parts: { + parser.AccountTextPart{Name:"example"}, + }, }, }, }, @@ -1527,12 +1599,14 @@ parser.Program{ Name: "origin_fn", }, Args: { - &parser.AccountLiteral{ + &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:30, Line:2}, End: parser.Position{Character:41, Line:2}, }, - Name: "my_account", + Parts: { + parser.AccountTextPart{Name:"my_account"}, + }, }, &parser.StringLiteral{ Range: parser.Range{ @@ -1591,32 +1665,38 @@ parser.Program{ }, Sources: { &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:13, Line:1}, End: parser.Position{Character:16, Line:1}, }, - Name: "s1", + Parts: { + parser.AccountTextPart{Name:"s1"}, + }, }, }, &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:17, Line:1}, End: parser.Position{Character:20, Line:1}, }, - Name: "s2", + Parts: { + parser.AccountTextPart{Name:"s2"}, + }, }, }, }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:16, Line:2}, End: parser.Position{Character:18, Line:2}, }, - Name: "d", + Parts: { + parser.AccountTextPart{Name:"d"}, + }, }, }, }, @@ -1647,12 +1727,14 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, End: parser.Position{Character:13, Line:1}, }, - Name: "s", + Parts: { + parser.AccountTextPart{Name:"s"}, + }, }, }, Destination: &parser.DestinationInorder{ @@ -1675,12 +1757,14 @@ parser.Program{ }, To: &parser.DestinationTo{ Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:12, Line:3}, End: parser.Position{Character:15, Line:3}, }, - Name: "d1", + Parts: { + parser.AccountTextPart{Name:"d1"}, + }, }, }, }, @@ -1720,12 +1804,14 @@ parser.Program{ }, Remaining: &parser.DestinationTo{ Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:14, Line:5}, End: parser.Position{Character:17, Line:5}, }, - Name: "d3", + Parts: { + parser.AccountTextPart{Name:"d3"}, + }, }, }, }, @@ -1758,21 +1844,25 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:10, Line:1}, End: parser.Position{Character:12, Line:1}, }, - Name: "a", + Parts: { + parser.AccountTextPart{Name:"a"}, + }, }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:15, Line:2}, End: parser.Position{Character:17, Line:2}, }, - Name: "b", + Parts: { + parser.AccountTextPart{Name:"b"}, + }, }, }, }, @@ -1816,12 +1906,14 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, End: parser.Position{Character:13, Line:1}, }, - Name: "s", + Parts: { + parser.AccountTextPart{Name:"s"}, + }, }, }, Destination: &parser.DestinationAllotment{ @@ -1895,12 +1987,14 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:2}, End: parser.Position{Character:17, Line:2}, }, - Name: "world", + Parts: { + parser.AccountTextPart{Name:"world"}, + }, }, }, Destination: &parser.DestinationAllotment{ @@ -1939,12 +2033,15 @@ parser.Program{ }, To: &parser.DestinationTo{ Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:13, Line:4}, End: parser.Position{Character:22, Line:4}, }, - Name: "player:1", + Parts: { + parser.AccountTextPart{Name:"player"}, + parser.AccountTextPart{Name:"1"}, + }, }, }, }, @@ -1958,13 +2055,13 @@ parser.Program{ [TestShowErrorLines - 1] Got errors while parsing: -mismatched input 'err' expecting {'oneof', 'max', '(', '[', '{', PERCENTAGE_PORTION_LITERAL, STRING, NUMBER, VARIABLE_NAME, ACCOUNT, ASSET} +mismatched input 'err' expecting {'max', 'oneof', '(', '[', '{', PERCENTAGE_PORTION_LITERAL, STRING, NUMBER, ASSET, '@', VARIABLE_NAME} 0 | send [EUR/2 100] ( 1 | source = err | ~~ 2 | destination = ee -mismatched input 'ee' expecting {'oneof', '(', '[', '{', PERCENTAGE_PORTION_LITERAL, STRING, NUMBER, VARIABLE_NAME, ACCOUNT, ASSET} +mismatched input 'ee' expecting {'oneof', '(', '[', '{', PERCENTAGE_PORTION_LITERAL, STRING, NUMBER, ASSET, '@', VARIABLE_NAME} 1 | source = err 2 | destination = ee | ~ @@ -2009,21 +2106,25 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, End: parser.Position{Character:15, Line:1}, }, - Name: "src", + Parts: { + parser.AccountTextPart{Name:"src"}, + }, }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:16, Line:2}, End: parser.Position{Character:21, Line:2}, }, - Name: "dest", + Parts: { + parser.AccountTextPart{Name:"dest"}, + }, }, }, }, @@ -2066,12 +2167,14 @@ parser.Program{ }, }, }, - Amount: &parser.AccountLiteral{ + Amount: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:22, Line:1}, End: parser.Position{Character:28, Line:1}, }, - Name: "alice", + Parts: { + parser.AccountTextPart{Name:"alice"}, + }, }, }, }, @@ -2100,12 +2203,14 @@ parser.Program{ Asset: "EUR/2", }, }, - Amount: &parser.AccountLiteral{ + Amount: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:20, Line:1}, End: parser.Position{Character:26, Line:1}, }, - Name: "alice", + Parts: { + parser.AccountTextPart{Name:"alice"}, + }, }, }, }, @@ -2464,32 +2569,38 @@ parser.Program{ }, Sources: { &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:19, Line:1}, End: parser.Position{Character:22, Line:1}, }, - Name: "s1", + Parts: { + parser.AccountTextPart{Name:"s1"}, + }, }, }, &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:23, Line:1}, End: parser.Position{Character:26, Line:1}, }, - Name: "s2", + Parts: { + parser.AccountTextPart{Name:"s2"}, + }, }, }, }, }, Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:16, Line:2}, End: parser.Position{Character:18, Line:2}, }, - Name: "d", + Parts: { + parser.AccountTextPart{Name:"d"}, + }, }, }, }, @@ -2520,12 +2631,14 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:10, Line:1}, End: parser.Position{Character:12, Line:1}, }, - Name: "s", + Parts: { + parser.AccountTextPart{Name:"s"}, + }, }, }, Destination: &parser.DestinationOneof{ @@ -2548,12 +2661,14 @@ parser.Program{ }, To: &parser.DestinationTo{ Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:13, Line:3}, End: parser.Position{Character:16, Line:3}, }, - Name: "d1", + Parts: { + parser.AccountTextPart{Name:"d1"}, + }, }, }, }, @@ -2580,12 +2695,14 @@ parser.Program{ }, Remaining: &parser.DestinationTo{ Destination: &parser.DestinationAccount{ - ValueExpr: &parser.AccountLiteral{ + ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:15, Line:5}, End: parser.Position{Character:18, Line:5}, }, - Name: "d3", + Parts: { + parser.AccountTextPart{Name:"d3"}, + }, }, }, }, @@ -2761,3 +2878,87 @@ parser.Program{ }, } --- + +[TestStringTemplate - 1] +parser.Program{ + Vars: nil, + Statements: { + &parser.FnCall{ + Range: parser.Range{ + Start: parser.Position{}, + End: parser.Position{Character:18, Line:0}, + }, + Caller: &parser.FnCallIdentifier{ + Range: parser.Range{ + Start: parser.Position{}, + End: parser.Position{Character:11, Line:0}, + }, + Name: "set_tx_meta", + }, + Args: { + &parser.NumberLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:12, Line:0}, + End: parser.Position{Character:13, Line:0}, + }, + Number: 0, + }, + &parser.NumberLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:15, Line:0}, + End: parser.Position{Character:17, Line:0}, + }, + Number: 42, + }, + }, + }, + }, +} +--- + +[TestInterpAccount - 1] +parser.Program{ + Vars: nil, + Statements: { + &parser.FnCall{ + Range: parser.Range{ + Start: parser.Position{}, + End: parser.Position{Character:29, Line:0}, + }, + Caller: &parser.FnCallIdentifier{ + Range: parser.Range{ + Start: parser.Position{}, + End: parser.Position{Character:11, Line:0}, + }, + Name: "set_tx_meta", + }, + Args: { + &parser.AccountInterpLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:12, Line:0}, + End: parser.Position{Character:24, Line:0}, + }, + Parts: { + parser.AccountTextPart{Name:"abc"}, + parser.AccountTextPart{Name:"cde"}, + &parser.Variable{ + Range: parser.Range{ + Start: parser.Position{Character:21, Line:0}, + End: parser.Position{Character:24, Line:0}, + }, + Name: "id", + }, + }, + }, + &parser.NumberLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:26, Line:0}, + End: parser.Position{Character:28, Line:0}, + }, + Number: 42, + }, + }, + }, + }, +} +--- diff --git a/internal/parser/antlr/Numscript.interp b/internal/parser/antlr/Numscript.interp deleted file mode 100644 index fbdba71d..00000000 --- a/internal/parser/antlr/Numscript.interp +++ /dev/null @@ -1,105 +0,0 @@ -token literal names: -null -'/' -'+' -'oneof' -null -null -null -null -'vars' -'max' -'source' -'destination' -'send' -'from' -'up' -'to' -'remaining' -'allowing' -'unbounded' -'overdraft' -'kept' -'save' -'(' -')' -'[' -']' -'{' -'}' -',' -'=' -'*' -'-' -null -null -null -null -null -null -null - -token symbolic names: -null -null -null -null -WS -NEWLINE -MULTILINE_COMMENT -LINE_COMMENT -VARS -MAX -SOURCE -DESTINATION -SEND -FROM -UP -TO -REMAINING -ALLOWING -UNBOUNDED -OVERDRAFT -KEPT -SAVE -LPARENS -RPARENS -LBRACKET -RBRACKET -LBRACE -RBRACE -COMMA -EQ -STAR -MINUS -PERCENTAGE_PORTION_LITERAL -STRING -IDENTIFIER -NUMBER -VARIABLE_NAME -ACCOUNT -ASSET - -rule names: -monetaryLit -valueExpr -functionCallArgs -functionCall -varOrigin -varDeclaration -varsDeclaration -program -sentAllLit -allotment -source -allotmentClauseSrc -keptOrDestination -destinationInOrderClause -destination -allotmentClauseDest -sentValue -statement - - -atn: -[4, 1, 38, 238, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 54, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 62, 8, 1, 10, 1, 12, 1, 65, 9, 1, 1, 2, 1, 2, 1, 2, 5, 2, 70, 8, 2, 10, 2, 12, 2, 73, 9, 2, 1, 3, 1, 3, 1, 3, 3, 3, 78, 8, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 3, 5, 88, 8, 5, 1, 6, 1, 6, 1, 6, 5, 6, 93, 8, 6, 10, 6, 12, 6, 96, 9, 6, 1, 6, 1, 6, 1, 7, 3, 7, 101, 8, 7, 1, 7, 5, 7, 104, 8, 7, 10, 7, 12, 7, 107, 9, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 3, 9, 118, 8, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 4, 10, 135, 8, 10, 11, 10, 12, 10, 136, 1, 10, 1, 10, 1, 10, 1, 10, 5, 10, 143, 8, 10, 10, 10, 12, 10, 146, 9, 10, 1, 10, 1, 10, 1, 10, 1, 10, 4, 10, 152, 8, 10, 11, 10, 12, 10, 153, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 163, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 3, 12, 172, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 4, 14, 181, 8, 14, 11, 14, 12, 14, 182, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 189, 8, 14, 10, 14, 12, 14, 192, 9, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 201, 8, 14, 10, 14, 12, 14, 204, 9, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 210, 8, 14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 3, 16, 217, 8, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 236, 8, 17, 1, 17, 0, 1, 2, 18, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 0, 2, 2, 0, 2, 2, 31, 31, 2, 0, 19, 19, 34, 34, 254, 0, 36, 1, 0, 0, 0, 2, 53, 1, 0, 0, 0, 4, 66, 1, 0, 0, 0, 6, 74, 1, 0, 0, 0, 8, 81, 1, 0, 0, 0, 10, 84, 1, 0, 0, 0, 12, 89, 1, 0, 0, 0, 14, 100, 1, 0, 0, 0, 16, 110, 1, 0, 0, 0, 18, 117, 1, 0, 0, 0, 20, 162, 1, 0, 0, 0, 22, 164, 1, 0, 0, 0, 24, 171, 1, 0, 0, 0, 26, 173, 1, 0, 0, 0, 28, 209, 1, 0, 0, 0, 30, 211, 1, 0, 0, 0, 32, 216, 1, 0, 0, 0, 34, 235, 1, 0, 0, 0, 36, 37, 5, 24, 0, 0, 37, 38, 3, 2, 1, 0, 38, 39, 3, 2, 1, 0, 39, 40, 5, 25, 0, 0, 40, 1, 1, 0, 0, 0, 41, 42, 6, 1, -1, 0, 42, 54, 5, 36, 0, 0, 43, 54, 5, 38, 0, 0, 44, 54, 5, 33, 0, 0, 45, 54, 5, 37, 0, 0, 46, 54, 5, 35, 0, 0, 47, 54, 5, 32, 0, 0, 48, 54, 3, 0, 0, 0, 49, 50, 5, 22, 0, 0, 50, 51, 3, 2, 1, 0, 51, 52, 5, 23, 0, 0, 52, 54, 1, 0, 0, 0, 53, 41, 1, 0, 0, 0, 53, 43, 1, 0, 0, 0, 53, 44, 1, 0, 0, 0, 53, 45, 1, 0, 0, 0, 53, 46, 1, 0, 0, 0, 53, 47, 1, 0, 0, 0, 53, 48, 1, 0, 0, 0, 53, 49, 1, 0, 0, 0, 54, 63, 1, 0, 0, 0, 55, 56, 10, 3, 0, 0, 56, 57, 5, 1, 0, 0, 57, 62, 3, 2, 1, 4, 58, 59, 10, 2, 0, 0, 59, 60, 7, 0, 0, 0, 60, 62, 3, 2, 1, 3, 61, 55, 1, 0, 0, 0, 61, 58, 1, 0, 0, 0, 62, 65, 1, 0, 0, 0, 63, 61, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 3, 1, 0, 0, 0, 65, 63, 1, 0, 0, 0, 66, 71, 3, 2, 1, 0, 67, 68, 5, 28, 0, 0, 68, 70, 3, 2, 1, 0, 69, 67, 1, 0, 0, 0, 70, 73, 1, 0, 0, 0, 71, 69, 1, 0, 0, 0, 71, 72, 1, 0, 0, 0, 72, 5, 1, 0, 0, 0, 73, 71, 1, 0, 0, 0, 74, 75, 7, 1, 0, 0, 75, 77, 5, 22, 0, 0, 76, 78, 3, 4, 2, 0, 77, 76, 1, 0, 0, 0, 77, 78, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 80, 5, 23, 0, 0, 80, 7, 1, 0, 0, 0, 81, 82, 5, 29, 0, 0, 82, 83, 3, 6, 3, 0, 83, 9, 1, 0, 0, 0, 84, 85, 5, 34, 0, 0, 85, 87, 5, 36, 0, 0, 86, 88, 3, 8, 4, 0, 87, 86, 1, 0, 0, 0, 87, 88, 1, 0, 0, 0, 88, 11, 1, 0, 0, 0, 89, 90, 5, 8, 0, 0, 90, 94, 5, 26, 0, 0, 91, 93, 3, 10, 5, 0, 92, 91, 1, 0, 0, 0, 93, 96, 1, 0, 0, 0, 94, 92, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 97, 1, 0, 0, 0, 96, 94, 1, 0, 0, 0, 97, 98, 5, 27, 0, 0, 98, 13, 1, 0, 0, 0, 99, 101, 3, 12, 6, 0, 100, 99, 1, 0, 0, 0, 100, 101, 1, 0, 0, 0, 101, 105, 1, 0, 0, 0, 102, 104, 3, 34, 17, 0, 103, 102, 1, 0, 0, 0, 104, 107, 1, 0, 0, 0, 105, 103, 1, 0, 0, 0, 105, 106, 1, 0, 0, 0, 106, 108, 1, 0, 0, 0, 107, 105, 1, 0, 0, 0, 108, 109, 5, 0, 0, 1, 109, 15, 1, 0, 0, 0, 110, 111, 5, 24, 0, 0, 111, 112, 3, 2, 1, 0, 112, 113, 5, 30, 0, 0, 113, 114, 5, 25, 0, 0, 114, 17, 1, 0, 0, 0, 115, 118, 3, 2, 1, 0, 116, 118, 5, 16, 0, 0, 117, 115, 1, 0, 0, 0, 117, 116, 1, 0, 0, 0, 118, 19, 1, 0, 0, 0, 119, 120, 3, 2, 1, 0, 120, 121, 5, 17, 0, 0, 121, 122, 5, 18, 0, 0, 122, 123, 5, 19, 0, 0, 123, 163, 1, 0, 0, 0, 124, 125, 3, 2, 1, 0, 125, 126, 5, 17, 0, 0, 126, 127, 5, 19, 0, 0, 127, 128, 5, 14, 0, 0, 128, 129, 5, 15, 0, 0, 129, 130, 3, 2, 1, 0, 130, 163, 1, 0, 0, 0, 131, 163, 3, 2, 1, 0, 132, 134, 5, 26, 0, 0, 133, 135, 3, 22, 11, 0, 134, 133, 1, 0, 0, 0, 135, 136, 1, 0, 0, 0, 136, 134, 1, 0, 0, 0, 136, 137, 1, 0, 0, 0, 137, 138, 1, 0, 0, 0, 138, 139, 5, 27, 0, 0, 139, 163, 1, 0, 0, 0, 140, 144, 5, 26, 0, 0, 141, 143, 3, 20, 10, 0, 142, 141, 1, 0, 0, 0, 143, 146, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0, 144, 145, 1, 0, 0, 0, 145, 147, 1, 0, 0, 0, 146, 144, 1, 0, 0, 0, 147, 163, 5, 27, 0, 0, 148, 149, 5, 3, 0, 0, 149, 151, 5, 26, 0, 0, 150, 152, 3, 20, 10, 0, 151, 150, 1, 0, 0, 0, 152, 153, 1, 0, 0, 0, 153, 151, 1, 0, 0, 0, 153, 154, 1, 0, 0, 0, 154, 155, 1, 0, 0, 0, 155, 156, 5, 27, 0, 0, 156, 163, 1, 0, 0, 0, 157, 158, 5, 9, 0, 0, 158, 159, 3, 2, 1, 0, 159, 160, 5, 13, 0, 0, 160, 161, 3, 20, 10, 0, 161, 163, 1, 0, 0, 0, 162, 119, 1, 0, 0, 0, 162, 124, 1, 0, 0, 0, 162, 131, 1, 0, 0, 0, 162, 132, 1, 0, 0, 0, 162, 140, 1, 0, 0, 0, 162, 148, 1, 0, 0, 0, 162, 157, 1, 0, 0, 0, 163, 21, 1, 0, 0, 0, 164, 165, 3, 18, 9, 0, 165, 166, 5, 13, 0, 0, 166, 167, 3, 20, 10, 0, 167, 23, 1, 0, 0, 0, 168, 169, 5, 15, 0, 0, 169, 172, 3, 28, 14, 0, 170, 172, 5, 20, 0, 0, 171, 168, 1, 0, 0, 0, 171, 170, 1, 0, 0, 0, 172, 25, 1, 0, 0, 0, 173, 174, 5, 9, 0, 0, 174, 175, 3, 2, 1, 0, 175, 176, 3, 24, 12, 0, 176, 27, 1, 0, 0, 0, 177, 210, 3, 2, 1, 0, 178, 180, 5, 26, 0, 0, 179, 181, 3, 30, 15, 0, 180, 179, 1, 0, 0, 0, 181, 182, 1, 0, 0, 0, 182, 180, 1, 0, 0, 0, 182, 183, 1, 0, 0, 0, 183, 184, 1, 0, 0, 0, 184, 185, 5, 27, 0, 0, 185, 210, 1, 0, 0, 0, 186, 190, 5, 26, 0, 0, 187, 189, 3, 26, 13, 0, 188, 187, 1, 0, 0, 0, 189, 192, 1, 0, 0, 0, 190, 188, 1, 0, 0, 0, 190, 191, 1, 0, 0, 0, 191, 193, 1, 0, 0, 0, 192, 190, 1, 0, 0, 0, 193, 194, 5, 16, 0, 0, 194, 195, 3, 24, 12, 0, 195, 196, 5, 27, 0, 0, 196, 210, 1, 0, 0, 0, 197, 198, 5, 3, 0, 0, 198, 202, 5, 26, 0, 0, 199, 201, 3, 26, 13, 0, 200, 199, 1, 0, 0, 0, 201, 204, 1, 0, 0, 0, 202, 200, 1, 0, 0, 0, 202, 203, 1, 0, 0, 0, 203, 205, 1, 0, 0, 0, 204, 202, 1, 0, 0, 0, 205, 206, 5, 16, 0, 0, 206, 207, 3, 24, 12, 0, 207, 208, 5, 27, 0, 0, 208, 210, 1, 0, 0, 0, 209, 177, 1, 0, 0, 0, 209, 178, 1, 0, 0, 0, 209, 186, 1, 0, 0, 0, 209, 197, 1, 0, 0, 0, 210, 29, 1, 0, 0, 0, 211, 212, 3, 18, 9, 0, 212, 213, 3, 24, 12, 0, 213, 31, 1, 0, 0, 0, 214, 217, 3, 2, 1, 0, 215, 217, 3, 16, 8, 0, 216, 214, 1, 0, 0, 0, 216, 215, 1, 0, 0, 0, 217, 33, 1, 0, 0, 0, 218, 219, 5, 12, 0, 0, 219, 220, 3, 32, 16, 0, 220, 221, 5, 22, 0, 0, 221, 222, 5, 10, 0, 0, 222, 223, 5, 29, 0, 0, 223, 224, 3, 20, 10, 0, 224, 225, 5, 11, 0, 0, 225, 226, 5, 29, 0, 0, 226, 227, 3, 28, 14, 0, 227, 228, 5, 23, 0, 0, 228, 236, 1, 0, 0, 0, 229, 230, 5, 21, 0, 0, 230, 231, 3, 32, 16, 0, 231, 232, 5, 13, 0, 0, 232, 233, 3, 2, 1, 0, 233, 236, 1, 0, 0, 0, 234, 236, 3, 6, 3, 0, 235, 218, 1, 0, 0, 0, 235, 229, 1, 0, 0, 0, 235, 234, 1, 0, 0, 0, 236, 35, 1, 0, 0, 0, 21, 53, 61, 63, 71, 77, 87, 94, 100, 105, 117, 136, 144, 153, 162, 171, 182, 190, 202, 209, 216, 235] \ No newline at end of file diff --git a/internal/parser/antlr/Numscript.tokens b/internal/parser/antlr/Numscript.tokens deleted file mode 100644 index cfd2d3fe..00000000 --- a/internal/parser/antlr/Numscript.tokens +++ /dev/null @@ -1,65 +0,0 @@ -T__0=1 -T__1=2 -T__2=3 -WS=4 -NEWLINE=5 -MULTILINE_COMMENT=6 -LINE_COMMENT=7 -VARS=8 -MAX=9 -SOURCE=10 -DESTINATION=11 -SEND=12 -FROM=13 -UP=14 -TO=15 -REMAINING=16 -ALLOWING=17 -UNBOUNDED=18 -OVERDRAFT=19 -KEPT=20 -SAVE=21 -LPARENS=22 -RPARENS=23 -LBRACKET=24 -RBRACKET=25 -LBRACE=26 -RBRACE=27 -COMMA=28 -EQ=29 -STAR=30 -MINUS=31 -PERCENTAGE_PORTION_LITERAL=32 -STRING=33 -IDENTIFIER=34 -NUMBER=35 -VARIABLE_NAME=36 -ACCOUNT=37 -ASSET=38 -'/'=1 -'+'=2 -'oneof'=3 -'vars'=8 -'max'=9 -'source'=10 -'destination'=11 -'send'=12 -'from'=13 -'up'=14 -'to'=15 -'remaining'=16 -'allowing'=17 -'unbounded'=18 -'overdraft'=19 -'kept'=20 -'save'=21 -'('=22 -')'=23 -'['=24 -']'=25 -'{'=26 -'}'=27 -','=28 -'='=29 -'*'=30 -'-'=31 diff --git a/internal/parser/antlr/NumscriptLexer.interp b/internal/parser/antlr/NumscriptLexer.interp deleted file mode 100644 index 4dedc315..00000000 --- a/internal/parser/antlr/NumscriptLexer.interp +++ /dev/null @@ -1,131 +0,0 @@ -token literal names: -null -'/' -'+' -'oneof' -null -null -null -null -'vars' -'max' -'source' -'destination' -'send' -'from' -'up' -'to' -'remaining' -'allowing' -'unbounded' -'overdraft' -'kept' -'save' -'(' -')' -'[' -']' -'{' -'}' -',' -'=' -'*' -'-' -null -null -null -null -null -null -null - -token symbolic names: -null -null -null -null -WS -NEWLINE -MULTILINE_COMMENT -LINE_COMMENT -VARS -MAX -SOURCE -DESTINATION -SEND -FROM -UP -TO -REMAINING -ALLOWING -UNBOUNDED -OVERDRAFT -KEPT -SAVE -LPARENS -RPARENS -LBRACKET -RBRACKET -LBRACE -RBRACE -COMMA -EQ -STAR -MINUS -PERCENTAGE_PORTION_LITERAL -STRING -IDENTIFIER -NUMBER -VARIABLE_NAME -ACCOUNT -ASSET - -rule names: -T__0 -T__1 -T__2 -WS -NEWLINE -MULTILINE_COMMENT -LINE_COMMENT -VARS -MAX -SOURCE -DESTINATION -SEND -FROM -UP -TO -REMAINING -ALLOWING -UNBOUNDED -OVERDRAFT -KEPT -SAVE -LPARENS -RPARENS -LBRACKET -RBRACKET -LBRACE -RBRACE -COMMA -EQ -STAR -MINUS -PERCENTAGE_PORTION_LITERAL -STRING -IDENTIFIER -NUMBER -VARIABLE_NAME -ACCOUNT -ASSET - -channel names: -DEFAULT_TOKEN_CHANNEL -HIDDEN - -mode names: -DEFAULT_MODE - -atn: -[4, 0, 38, 340, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 4, 3, 89, 8, 3, 11, 3, 12, 3, 90, 1, 3, 1, 3, 1, 4, 4, 4, 96, 8, 4, 11, 4, 12, 4, 97, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 105, 8, 5, 10, 5, 12, 5, 108, 9, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 119, 8, 6, 10, 6, 12, 6, 122, 9, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 4, 31, 242, 8, 31, 11, 31, 12, 31, 243, 1, 31, 1, 31, 4, 31, 248, 8, 31, 11, 31, 12, 31, 249, 3, 31, 252, 8, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 5, 32, 260, 8, 32, 10, 32, 12, 32, 263, 9, 32, 1, 32, 1, 32, 1, 33, 4, 33, 268, 8, 33, 11, 33, 12, 33, 269, 1, 33, 5, 33, 273, 8, 33, 10, 33, 12, 33, 276, 9, 33, 1, 34, 3, 34, 279, 8, 34, 1, 34, 4, 34, 282, 8, 34, 11, 34, 12, 34, 283, 1, 34, 1, 34, 4, 34, 288, 8, 34, 11, 34, 12, 34, 289, 5, 34, 292, 8, 34, 10, 34, 12, 34, 295, 9, 34, 1, 35, 1, 35, 4, 35, 299, 8, 35, 11, 35, 12, 35, 300, 1, 35, 5, 35, 304, 8, 35, 10, 35, 12, 35, 307, 9, 35, 1, 36, 1, 36, 4, 36, 311, 8, 36, 11, 36, 12, 36, 312, 1, 36, 1, 36, 4, 36, 317, 8, 36, 11, 36, 12, 36, 318, 5, 36, 321, 8, 36, 10, 36, 12, 36, 324, 9, 36, 1, 37, 1, 37, 5, 37, 328, 8, 37, 10, 37, 12, 37, 331, 9, 37, 1, 37, 1, 37, 4, 37, 335, 8, 37, 11, 37, 12, 37, 336, 3, 37, 339, 8, 37, 2, 106, 120, 0, 38, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 38, 1, 0, 10, 3, 0, 9, 10, 13, 13, 32, 32, 2, 0, 10, 10, 13, 13, 1, 0, 48, 57, 3, 0, 10, 10, 13, 13, 34, 34, 1, 0, 97, 122, 2, 0, 95, 95, 97, 122, 3, 0, 48, 57, 95, 95, 97, 122, 5, 0, 45, 45, 48, 57, 65, 90, 95, 95, 97, 122, 1, 0, 65, 90, 2, 0, 48, 57, 65, 90, 363, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 1, 77, 1, 0, 0, 0, 3, 79, 1, 0, 0, 0, 5, 81, 1, 0, 0, 0, 7, 88, 1, 0, 0, 0, 9, 95, 1, 0, 0, 0, 11, 99, 1, 0, 0, 0, 13, 114, 1, 0, 0, 0, 15, 127, 1, 0, 0, 0, 17, 132, 1, 0, 0, 0, 19, 136, 1, 0, 0, 0, 21, 143, 1, 0, 0, 0, 23, 155, 1, 0, 0, 0, 25, 160, 1, 0, 0, 0, 27, 165, 1, 0, 0, 0, 29, 168, 1, 0, 0, 0, 31, 171, 1, 0, 0, 0, 33, 181, 1, 0, 0, 0, 35, 190, 1, 0, 0, 0, 37, 200, 1, 0, 0, 0, 39, 210, 1, 0, 0, 0, 41, 215, 1, 0, 0, 0, 43, 220, 1, 0, 0, 0, 45, 222, 1, 0, 0, 0, 47, 224, 1, 0, 0, 0, 49, 226, 1, 0, 0, 0, 51, 228, 1, 0, 0, 0, 53, 230, 1, 0, 0, 0, 55, 232, 1, 0, 0, 0, 57, 234, 1, 0, 0, 0, 59, 236, 1, 0, 0, 0, 61, 238, 1, 0, 0, 0, 63, 241, 1, 0, 0, 0, 65, 255, 1, 0, 0, 0, 67, 267, 1, 0, 0, 0, 69, 278, 1, 0, 0, 0, 71, 296, 1, 0, 0, 0, 73, 308, 1, 0, 0, 0, 75, 325, 1, 0, 0, 0, 77, 78, 5, 47, 0, 0, 78, 2, 1, 0, 0, 0, 79, 80, 5, 43, 0, 0, 80, 4, 1, 0, 0, 0, 81, 82, 5, 111, 0, 0, 82, 83, 5, 110, 0, 0, 83, 84, 5, 101, 0, 0, 84, 85, 5, 111, 0, 0, 85, 86, 5, 102, 0, 0, 86, 6, 1, 0, 0, 0, 87, 89, 7, 0, 0, 0, 88, 87, 1, 0, 0, 0, 89, 90, 1, 0, 0, 0, 90, 88, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 93, 6, 3, 0, 0, 93, 8, 1, 0, 0, 0, 94, 96, 7, 1, 0, 0, 95, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 10, 1, 0, 0, 0, 99, 100, 5, 47, 0, 0, 100, 101, 5, 42, 0, 0, 101, 106, 1, 0, 0, 0, 102, 105, 3, 11, 5, 0, 103, 105, 9, 0, 0, 0, 104, 102, 1, 0, 0, 0, 104, 103, 1, 0, 0, 0, 105, 108, 1, 0, 0, 0, 106, 107, 1, 0, 0, 0, 106, 104, 1, 0, 0, 0, 107, 109, 1, 0, 0, 0, 108, 106, 1, 0, 0, 0, 109, 110, 5, 42, 0, 0, 110, 111, 5, 47, 0, 0, 111, 112, 1, 0, 0, 0, 112, 113, 6, 5, 0, 0, 113, 12, 1, 0, 0, 0, 114, 115, 5, 47, 0, 0, 115, 116, 5, 47, 0, 0, 116, 120, 1, 0, 0, 0, 117, 119, 9, 0, 0, 0, 118, 117, 1, 0, 0, 0, 119, 122, 1, 0, 0, 0, 120, 121, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 121, 123, 1, 0, 0, 0, 122, 120, 1, 0, 0, 0, 123, 124, 3, 9, 4, 0, 124, 125, 1, 0, 0, 0, 125, 126, 6, 6, 0, 0, 126, 14, 1, 0, 0, 0, 127, 128, 5, 118, 0, 0, 128, 129, 5, 97, 0, 0, 129, 130, 5, 114, 0, 0, 130, 131, 5, 115, 0, 0, 131, 16, 1, 0, 0, 0, 132, 133, 5, 109, 0, 0, 133, 134, 5, 97, 0, 0, 134, 135, 5, 120, 0, 0, 135, 18, 1, 0, 0, 0, 136, 137, 5, 115, 0, 0, 137, 138, 5, 111, 0, 0, 138, 139, 5, 117, 0, 0, 139, 140, 5, 114, 0, 0, 140, 141, 5, 99, 0, 0, 141, 142, 5, 101, 0, 0, 142, 20, 1, 0, 0, 0, 143, 144, 5, 100, 0, 0, 144, 145, 5, 101, 0, 0, 145, 146, 5, 115, 0, 0, 146, 147, 5, 116, 0, 0, 147, 148, 5, 105, 0, 0, 148, 149, 5, 110, 0, 0, 149, 150, 5, 97, 0, 0, 150, 151, 5, 116, 0, 0, 151, 152, 5, 105, 0, 0, 152, 153, 5, 111, 0, 0, 153, 154, 5, 110, 0, 0, 154, 22, 1, 0, 0, 0, 155, 156, 5, 115, 0, 0, 156, 157, 5, 101, 0, 0, 157, 158, 5, 110, 0, 0, 158, 159, 5, 100, 0, 0, 159, 24, 1, 0, 0, 0, 160, 161, 5, 102, 0, 0, 161, 162, 5, 114, 0, 0, 162, 163, 5, 111, 0, 0, 163, 164, 5, 109, 0, 0, 164, 26, 1, 0, 0, 0, 165, 166, 5, 117, 0, 0, 166, 167, 5, 112, 0, 0, 167, 28, 1, 0, 0, 0, 168, 169, 5, 116, 0, 0, 169, 170, 5, 111, 0, 0, 170, 30, 1, 0, 0, 0, 171, 172, 5, 114, 0, 0, 172, 173, 5, 101, 0, 0, 173, 174, 5, 109, 0, 0, 174, 175, 5, 97, 0, 0, 175, 176, 5, 105, 0, 0, 176, 177, 5, 110, 0, 0, 177, 178, 5, 105, 0, 0, 178, 179, 5, 110, 0, 0, 179, 180, 5, 103, 0, 0, 180, 32, 1, 0, 0, 0, 181, 182, 5, 97, 0, 0, 182, 183, 5, 108, 0, 0, 183, 184, 5, 108, 0, 0, 184, 185, 5, 111, 0, 0, 185, 186, 5, 119, 0, 0, 186, 187, 5, 105, 0, 0, 187, 188, 5, 110, 0, 0, 188, 189, 5, 103, 0, 0, 189, 34, 1, 0, 0, 0, 190, 191, 5, 117, 0, 0, 191, 192, 5, 110, 0, 0, 192, 193, 5, 98, 0, 0, 193, 194, 5, 111, 0, 0, 194, 195, 5, 117, 0, 0, 195, 196, 5, 110, 0, 0, 196, 197, 5, 100, 0, 0, 197, 198, 5, 101, 0, 0, 198, 199, 5, 100, 0, 0, 199, 36, 1, 0, 0, 0, 200, 201, 5, 111, 0, 0, 201, 202, 5, 118, 0, 0, 202, 203, 5, 101, 0, 0, 203, 204, 5, 114, 0, 0, 204, 205, 5, 100, 0, 0, 205, 206, 5, 114, 0, 0, 206, 207, 5, 97, 0, 0, 207, 208, 5, 102, 0, 0, 208, 209, 5, 116, 0, 0, 209, 38, 1, 0, 0, 0, 210, 211, 5, 107, 0, 0, 211, 212, 5, 101, 0, 0, 212, 213, 5, 112, 0, 0, 213, 214, 5, 116, 0, 0, 214, 40, 1, 0, 0, 0, 215, 216, 5, 115, 0, 0, 216, 217, 5, 97, 0, 0, 217, 218, 5, 118, 0, 0, 218, 219, 5, 101, 0, 0, 219, 42, 1, 0, 0, 0, 220, 221, 5, 40, 0, 0, 221, 44, 1, 0, 0, 0, 222, 223, 5, 41, 0, 0, 223, 46, 1, 0, 0, 0, 224, 225, 5, 91, 0, 0, 225, 48, 1, 0, 0, 0, 226, 227, 5, 93, 0, 0, 227, 50, 1, 0, 0, 0, 228, 229, 5, 123, 0, 0, 229, 52, 1, 0, 0, 0, 230, 231, 5, 125, 0, 0, 231, 54, 1, 0, 0, 0, 232, 233, 5, 44, 0, 0, 233, 56, 1, 0, 0, 0, 234, 235, 5, 61, 0, 0, 235, 58, 1, 0, 0, 0, 236, 237, 5, 42, 0, 0, 237, 60, 1, 0, 0, 0, 238, 239, 5, 45, 0, 0, 239, 62, 1, 0, 0, 0, 240, 242, 7, 2, 0, 0, 241, 240, 1, 0, 0, 0, 242, 243, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 243, 244, 1, 0, 0, 0, 244, 251, 1, 0, 0, 0, 245, 247, 5, 46, 0, 0, 246, 248, 7, 2, 0, 0, 247, 246, 1, 0, 0, 0, 248, 249, 1, 0, 0, 0, 249, 247, 1, 0, 0, 0, 249, 250, 1, 0, 0, 0, 250, 252, 1, 0, 0, 0, 251, 245, 1, 0, 0, 0, 251, 252, 1, 0, 0, 0, 252, 253, 1, 0, 0, 0, 253, 254, 5, 37, 0, 0, 254, 64, 1, 0, 0, 0, 255, 261, 5, 34, 0, 0, 256, 257, 5, 92, 0, 0, 257, 260, 5, 34, 0, 0, 258, 260, 8, 3, 0, 0, 259, 256, 1, 0, 0, 0, 259, 258, 1, 0, 0, 0, 260, 263, 1, 0, 0, 0, 261, 259, 1, 0, 0, 0, 261, 262, 1, 0, 0, 0, 262, 264, 1, 0, 0, 0, 263, 261, 1, 0, 0, 0, 264, 265, 5, 34, 0, 0, 265, 66, 1, 0, 0, 0, 266, 268, 7, 4, 0, 0, 267, 266, 1, 0, 0, 0, 268, 269, 1, 0, 0, 0, 269, 267, 1, 0, 0, 0, 269, 270, 1, 0, 0, 0, 270, 274, 1, 0, 0, 0, 271, 273, 7, 5, 0, 0, 272, 271, 1, 0, 0, 0, 273, 276, 1, 0, 0, 0, 274, 272, 1, 0, 0, 0, 274, 275, 1, 0, 0, 0, 275, 68, 1, 0, 0, 0, 276, 274, 1, 0, 0, 0, 277, 279, 3, 61, 30, 0, 278, 277, 1, 0, 0, 0, 278, 279, 1, 0, 0, 0, 279, 281, 1, 0, 0, 0, 280, 282, 7, 2, 0, 0, 281, 280, 1, 0, 0, 0, 282, 283, 1, 0, 0, 0, 283, 281, 1, 0, 0, 0, 283, 284, 1, 0, 0, 0, 284, 293, 1, 0, 0, 0, 285, 287, 5, 95, 0, 0, 286, 288, 7, 2, 0, 0, 287, 286, 1, 0, 0, 0, 288, 289, 1, 0, 0, 0, 289, 287, 1, 0, 0, 0, 289, 290, 1, 0, 0, 0, 290, 292, 1, 0, 0, 0, 291, 285, 1, 0, 0, 0, 292, 295, 1, 0, 0, 0, 293, 291, 1, 0, 0, 0, 293, 294, 1, 0, 0, 0, 294, 70, 1, 0, 0, 0, 295, 293, 1, 0, 0, 0, 296, 298, 5, 36, 0, 0, 297, 299, 7, 5, 0, 0, 298, 297, 1, 0, 0, 0, 299, 300, 1, 0, 0, 0, 300, 298, 1, 0, 0, 0, 300, 301, 1, 0, 0, 0, 301, 305, 1, 0, 0, 0, 302, 304, 7, 6, 0, 0, 303, 302, 1, 0, 0, 0, 304, 307, 1, 0, 0, 0, 305, 303, 1, 0, 0, 0, 305, 306, 1, 0, 0, 0, 306, 72, 1, 0, 0, 0, 307, 305, 1, 0, 0, 0, 308, 310, 5, 64, 0, 0, 309, 311, 7, 7, 0, 0, 310, 309, 1, 0, 0, 0, 311, 312, 1, 0, 0, 0, 312, 310, 1, 0, 0, 0, 312, 313, 1, 0, 0, 0, 313, 322, 1, 0, 0, 0, 314, 316, 5, 58, 0, 0, 315, 317, 7, 7, 0, 0, 316, 315, 1, 0, 0, 0, 317, 318, 1, 0, 0, 0, 318, 316, 1, 0, 0, 0, 318, 319, 1, 0, 0, 0, 319, 321, 1, 0, 0, 0, 320, 314, 1, 0, 0, 0, 321, 324, 1, 0, 0, 0, 322, 320, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 74, 1, 0, 0, 0, 324, 322, 1, 0, 0, 0, 325, 329, 7, 8, 0, 0, 326, 328, 7, 9, 0, 0, 327, 326, 1, 0, 0, 0, 328, 331, 1, 0, 0, 0, 329, 327, 1, 0, 0, 0, 329, 330, 1, 0, 0, 0, 330, 338, 1, 0, 0, 0, 331, 329, 1, 0, 0, 0, 332, 334, 5, 47, 0, 0, 333, 335, 7, 2, 0, 0, 334, 333, 1, 0, 0, 0, 335, 336, 1, 0, 0, 0, 336, 334, 1, 0, 0, 0, 336, 337, 1, 0, 0, 0, 337, 339, 1, 0, 0, 0, 338, 332, 1, 0, 0, 0, 338, 339, 1, 0, 0, 0, 339, 76, 1, 0, 0, 0, 25, 0, 90, 97, 104, 106, 120, 243, 249, 251, 259, 261, 269, 274, 278, 283, 289, 293, 300, 305, 312, 318, 322, 329, 336, 338, 1, 6, 0, 0] \ No newline at end of file diff --git a/internal/parser/antlr/NumscriptLexer.tokens b/internal/parser/antlr/NumscriptLexer.tokens deleted file mode 100644 index cfd2d3fe..00000000 --- a/internal/parser/antlr/NumscriptLexer.tokens +++ /dev/null @@ -1,65 +0,0 @@ -T__0=1 -T__1=2 -T__2=3 -WS=4 -NEWLINE=5 -MULTILINE_COMMENT=6 -LINE_COMMENT=7 -VARS=8 -MAX=9 -SOURCE=10 -DESTINATION=11 -SEND=12 -FROM=13 -UP=14 -TO=15 -REMAINING=16 -ALLOWING=17 -UNBOUNDED=18 -OVERDRAFT=19 -KEPT=20 -SAVE=21 -LPARENS=22 -RPARENS=23 -LBRACKET=24 -RBRACKET=25 -LBRACE=26 -RBRACE=27 -COMMA=28 -EQ=29 -STAR=30 -MINUS=31 -PERCENTAGE_PORTION_LITERAL=32 -STRING=33 -IDENTIFIER=34 -NUMBER=35 -VARIABLE_NAME=36 -ACCOUNT=37 -ASSET=38 -'/'=1 -'+'=2 -'oneof'=3 -'vars'=8 -'max'=9 -'source'=10 -'destination'=11 -'send'=12 -'from'=13 -'up'=14 -'to'=15 -'remaining'=16 -'allowing'=17 -'unbounded'=18 -'overdraft'=19 -'kept'=20 -'save'=21 -'('=22 -')'=23 -'['=24 -']'=25 -'{'=26 -'}'=27 -','=28 -'='=29 -'*'=30 -'-'=31 diff --git a/internal/parser/antlr/numscript_lexer.go b/internal/parser/antlr/numscript_lexer.go deleted file mode 100644 index d86d58bf..00000000 --- a/internal/parser/antlr/numscript_lexer.go +++ /dev/null @@ -1,302 +0,0 @@ -// Code generated from Numscript.g4 by ANTLR 4.13.1. DO NOT EDIT. - -package parser - -import ( - "fmt" - "github.com/antlr4-go/antlr/v4" - "sync" - "unicode" -) - -// Suppress unused import error -var _ = fmt.Printf -var _ = sync.Once{} -var _ = unicode.IsLetter - -type NumscriptLexer struct { - *antlr.BaseLexer - channelNames []string - modeNames []string - // TODO: EOF string -} - -var NumscriptLexerLexerStaticData struct { - once sync.Once - serializedATN []int32 - ChannelNames []string - ModeNames []string - LiteralNames []string - SymbolicNames []string - RuleNames []string - PredictionContextCache *antlr.PredictionContextCache - atn *antlr.ATN - decisionToDFA []*antlr.DFA -} - -func numscriptlexerLexerInit() { - staticData := &NumscriptLexerLexerStaticData - staticData.ChannelNames = []string{ - "DEFAULT_TOKEN_CHANNEL", "HIDDEN", - } - staticData.ModeNames = []string{ - "DEFAULT_MODE", - } - staticData.LiteralNames = []string{ - "", "'/'", "'+'", "'oneof'", "", "", "", "", "'vars'", "'max'", "'source'", - "'destination'", "'send'", "'from'", "'up'", "'to'", "'remaining'", - "'allowing'", "'unbounded'", "'overdraft'", "'kept'", "'save'", "'('", - "')'", "'['", "']'", "'{'", "'}'", "','", "'='", "'*'", "'-'", - } - staticData.SymbolicNames = []string{ - "", "", "", "", "WS", "NEWLINE", "MULTILINE_COMMENT", "LINE_COMMENT", - "VARS", "MAX", "SOURCE", "DESTINATION", "SEND", "FROM", "UP", "TO", - "REMAINING", "ALLOWING", "UNBOUNDED", "OVERDRAFT", "KEPT", "SAVE", "LPARENS", - "RPARENS", "LBRACKET", "RBRACKET", "LBRACE", "RBRACE", "COMMA", "EQ", - "STAR", "MINUS", "PERCENTAGE_PORTION_LITERAL", "STRING", "IDENTIFIER", - "NUMBER", "VARIABLE_NAME", "ACCOUNT", "ASSET", - } - staticData.RuleNames = []string{ - "T__0", "T__1", "T__2", "WS", "NEWLINE", "MULTILINE_COMMENT", "LINE_COMMENT", - "VARS", "MAX", "SOURCE", "DESTINATION", "SEND", "FROM", "UP", "TO", - "REMAINING", "ALLOWING", "UNBOUNDED", "OVERDRAFT", "KEPT", "SAVE", "LPARENS", - "RPARENS", "LBRACKET", "RBRACKET", "LBRACE", "RBRACE", "COMMA", "EQ", - "STAR", "MINUS", "PERCENTAGE_PORTION_LITERAL", "STRING", "IDENTIFIER", - "NUMBER", "VARIABLE_NAME", "ACCOUNT", "ASSET", - } - staticData.PredictionContextCache = antlr.NewPredictionContextCache() - staticData.serializedATN = []int32{ - 4, 0, 38, 340, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, - 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, - 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, - 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, - 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, - 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, - 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, - 7, 36, 2, 37, 7, 37, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, - 2, 1, 2, 1, 3, 4, 3, 89, 8, 3, 11, 3, 12, 3, 90, 1, 3, 1, 3, 1, 4, 4, 4, - 96, 8, 4, 11, 4, 12, 4, 97, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 105, 8, - 5, 10, 5, 12, 5, 108, 9, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, - 6, 1, 6, 5, 6, 119, 8, 6, 10, 6, 12, 6, 122, 9, 6, 1, 6, 1, 6, 1, 6, 1, - 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, - 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, - 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, - 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, - 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, - 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, - 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, - 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, - 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, - 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, - 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 4, 31, 242, 8, 31, - 11, 31, 12, 31, 243, 1, 31, 1, 31, 4, 31, 248, 8, 31, 11, 31, 12, 31, 249, - 3, 31, 252, 8, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 5, 32, 260, - 8, 32, 10, 32, 12, 32, 263, 9, 32, 1, 32, 1, 32, 1, 33, 4, 33, 268, 8, - 33, 11, 33, 12, 33, 269, 1, 33, 5, 33, 273, 8, 33, 10, 33, 12, 33, 276, - 9, 33, 1, 34, 3, 34, 279, 8, 34, 1, 34, 4, 34, 282, 8, 34, 11, 34, 12, - 34, 283, 1, 34, 1, 34, 4, 34, 288, 8, 34, 11, 34, 12, 34, 289, 5, 34, 292, - 8, 34, 10, 34, 12, 34, 295, 9, 34, 1, 35, 1, 35, 4, 35, 299, 8, 35, 11, - 35, 12, 35, 300, 1, 35, 5, 35, 304, 8, 35, 10, 35, 12, 35, 307, 9, 35, - 1, 36, 1, 36, 4, 36, 311, 8, 36, 11, 36, 12, 36, 312, 1, 36, 1, 36, 4, - 36, 317, 8, 36, 11, 36, 12, 36, 318, 5, 36, 321, 8, 36, 10, 36, 12, 36, - 324, 9, 36, 1, 37, 1, 37, 5, 37, 328, 8, 37, 10, 37, 12, 37, 331, 9, 37, - 1, 37, 1, 37, 4, 37, 335, 8, 37, 11, 37, 12, 37, 336, 3, 37, 339, 8, 37, - 2, 106, 120, 0, 38, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, - 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, - 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, - 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, - 71, 36, 73, 37, 75, 38, 1, 0, 10, 3, 0, 9, 10, 13, 13, 32, 32, 2, 0, 10, - 10, 13, 13, 1, 0, 48, 57, 3, 0, 10, 10, 13, 13, 34, 34, 1, 0, 97, 122, - 2, 0, 95, 95, 97, 122, 3, 0, 48, 57, 95, 95, 97, 122, 5, 0, 45, 45, 48, - 57, 65, 90, 95, 95, 97, 122, 1, 0, 65, 90, 2, 0, 48, 57, 65, 90, 363, 0, - 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, - 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, - 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, - 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, - 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, - 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, - 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, - 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, - 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, - 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 1, 77, 1, 0, - 0, 0, 3, 79, 1, 0, 0, 0, 5, 81, 1, 0, 0, 0, 7, 88, 1, 0, 0, 0, 9, 95, 1, - 0, 0, 0, 11, 99, 1, 0, 0, 0, 13, 114, 1, 0, 0, 0, 15, 127, 1, 0, 0, 0, - 17, 132, 1, 0, 0, 0, 19, 136, 1, 0, 0, 0, 21, 143, 1, 0, 0, 0, 23, 155, - 1, 0, 0, 0, 25, 160, 1, 0, 0, 0, 27, 165, 1, 0, 0, 0, 29, 168, 1, 0, 0, - 0, 31, 171, 1, 0, 0, 0, 33, 181, 1, 0, 0, 0, 35, 190, 1, 0, 0, 0, 37, 200, - 1, 0, 0, 0, 39, 210, 1, 0, 0, 0, 41, 215, 1, 0, 0, 0, 43, 220, 1, 0, 0, - 0, 45, 222, 1, 0, 0, 0, 47, 224, 1, 0, 0, 0, 49, 226, 1, 0, 0, 0, 51, 228, - 1, 0, 0, 0, 53, 230, 1, 0, 0, 0, 55, 232, 1, 0, 0, 0, 57, 234, 1, 0, 0, - 0, 59, 236, 1, 0, 0, 0, 61, 238, 1, 0, 0, 0, 63, 241, 1, 0, 0, 0, 65, 255, - 1, 0, 0, 0, 67, 267, 1, 0, 0, 0, 69, 278, 1, 0, 0, 0, 71, 296, 1, 0, 0, - 0, 73, 308, 1, 0, 0, 0, 75, 325, 1, 0, 0, 0, 77, 78, 5, 47, 0, 0, 78, 2, - 1, 0, 0, 0, 79, 80, 5, 43, 0, 0, 80, 4, 1, 0, 0, 0, 81, 82, 5, 111, 0, - 0, 82, 83, 5, 110, 0, 0, 83, 84, 5, 101, 0, 0, 84, 85, 5, 111, 0, 0, 85, - 86, 5, 102, 0, 0, 86, 6, 1, 0, 0, 0, 87, 89, 7, 0, 0, 0, 88, 87, 1, 0, - 0, 0, 89, 90, 1, 0, 0, 0, 90, 88, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 92, - 1, 0, 0, 0, 92, 93, 6, 3, 0, 0, 93, 8, 1, 0, 0, 0, 94, 96, 7, 1, 0, 0, - 95, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, - 0, 0, 0, 98, 10, 1, 0, 0, 0, 99, 100, 5, 47, 0, 0, 100, 101, 5, 42, 0, - 0, 101, 106, 1, 0, 0, 0, 102, 105, 3, 11, 5, 0, 103, 105, 9, 0, 0, 0, 104, - 102, 1, 0, 0, 0, 104, 103, 1, 0, 0, 0, 105, 108, 1, 0, 0, 0, 106, 107, - 1, 0, 0, 0, 106, 104, 1, 0, 0, 0, 107, 109, 1, 0, 0, 0, 108, 106, 1, 0, - 0, 0, 109, 110, 5, 42, 0, 0, 110, 111, 5, 47, 0, 0, 111, 112, 1, 0, 0, - 0, 112, 113, 6, 5, 0, 0, 113, 12, 1, 0, 0, 0, 114, 115, 5, 47, 0, 0, 115, - 116, 5, 47, 0, 0, 116, 120, 1, 0, 0, 0, 117, 119, 9, 0, 0, 0, 118, 117, - 1, 0, 0, 0, 119, 122, 1, 0, 0, 0, 120, 121, 1, 0, 0, 0, 120, 118, 1, 0, - 0, 0, 121, 123, 1, 0, 0, 0, 122, 120, 1, 0, 0, 0, 123, 124, 3, 9, 4, 0, - 124, 125, 1, 0, 0, 0, 125, 126, 6, 6, 0, 0, 126, 14, 1, 0, 0, 0, 127, 128, - 5, 118, 0, 0, 128, 129, 5, 97, 0, 0, 129, 130, 5, 114, 0, 0, 130, 131, - 5, 115, 0, 0, 131, 16, 1, 0, 0, 0, 132, 133, 5, 109, 0, 0, 133, 134, 5, - 97, 0, 0, 134, 135, 5, 120, 0, 0, 135, 18, 1, 0, 0, 0, 136, 137, 5, 115, - 0, 0, 137, 138, 5, 111, 0, 0, 138, 139, 5, 117, 0, 0, 139, 140, 5, 114, - 0, 0, 140, 141, 5, 99, 0, 0, 141, 142, 5, 101, 0, 0, 142, 20, 1, 0, 0, - 0, 143, 144, 5, 100, 0, 0, 144, 145, 5, 101, 0, 0, 145, 146, 5, 115, 0, - 0, 146, 147, 5, 116, 0, 0, 147, 148, 5, 105, 0, 0, 148, 149, 5, 110, 0, - 0, 149, 150, 5, 97, 0, 0, 150, 151, 5, 116, 0, 0, 151, 152, 5, 105, 0, - 0, 152, 153, 5, 111, 0, 0, 153, 154, 5, 110, 0, 0, 154, 22, 1, 0, 0, 0, - 155, 156, 5, 115, 0, 0, 156, 157, 5, 101, 0, 0, 157, 158, 5, 110, 0, 0, - 158, 159, 5, 100, 0, 0, 159, 24, 1, 0, 0, 0, 160, 161, 5, 102, 0, 0, 161, - 162, 5, 114, 0, 0, 162, 163, 5, 111, 0, 0, 163, 164, 5, 109, 0, 0, 164, - 26, 1, 0, 0, 0, 165, 166, 5, 117, 0, 0, 166, 167, 5, 112, 0, 0, 167, 28, - 1, 0, 0, 0, 168, 169, 5, 116, 0, 0, 169, 170, 5, 111, 0, 0, 170, 30, 1, - 0, 0, 0, 171, 172, 5, 114, 0, 0, 172, 173, 5, 101, 0, 0, 173, 174, 5, 109, - 0, 0, 174, 175, 5, 97, 0, 0, 175, 176, 5, 105, 0, 0, 176, 177, 5, 110, - 0, 0, 177, 178, 5, 105, 0, 0, 178, 179, 5, 110, 0, 0, 179, 180, 5, 103, - 0, 0, 180, 32, 1, 0, 0, 0, 181, 182, 5, 97, 0, 0, 182, 183, 5, 108, 0, - 0, 183, 184, 5, 108, 0, 0, 184, 185, 5, 111, 0, 0, 185, 186, 5, 119, 0, - 0, 186, 187, 5, 105, 0, 0, 187, 188, 5, 110, 0, 0, 188, 189, 5, 103, 0, - 0, 189, 34, 1, 0, 0, 0, 190, 191, 5, 117, 0, 0, 191, 192, 5, 110, 0, 0, - 192, 193, 5, 98, 0, 0, 193, 194, 5, 111, 0, 0, 194, 195, 5, 117, 0, 0, - 195, 196, 5, 110, 0, 0, 196, 197, 5, 100, 0, 0, 197, 198, 5, 101, 0, 0, - 198, 199, 5, 100, 0, 0, 199, 36, 1, 0, 0, 0, 200, 201, 5, 111, 0, 0, 201, - 202, 5, 118, 0, 0, 202, 203, 5, 101, 0, 0, 203, 204, 5, 114, 0, 0, 204, - 205, 5, 100, 0, 0, 205, 206, 5, 114, 0, 0, 206, 207, 5, 97, 0, 0, 207, - 208, 5, 102, 0, 0, 208, 209, 5, 116, 0, 0, 209, 38, 1, 0, 0, 0, 210, 211, - 5, 107, 0, 0, 211, 212, 5, 101, 0, 0, 212, 213, 5, 112, 0, 0, 213, 214, - 5, 116, 0, 0, 214, 40, 1, 0, 0, 0, 215, 216, 5, 115, 0, 0, 216, 217, 5, - 97, 0, 0, 217, 218, 5, 118, 0, 0, 218, 219, 5, 101, 0, 0, 219, 42, 1, 0, - 0, 0, 220, 221, 5, 40, 0, 0, 221, 44, 1, 0, 0, 0, 222, 223, 5, 41, 0, 0, - 223, 46, 1, 0, 0, 0, 224, 225, 5, 91, 0, 0, 225, 48, 1, 0, 0, 0, 226, 227, - 5, 93, 0, 0, 227, 50, 1, 0, 0, 0, 228, 229, 5, 123, 0, 0, 229, 52, 1, 0, - 0, 0, 230, 231, 5, 125, 0, 0, 231, 54, 1, 0, 0, 0, 232, 233, 5, 44, 0, - 0, 233, 56, 1, 0, 0, 0, 234, 235, 5, 61, 0, 0, 235, 58, 1, 0, 0, 0, 236, - 237, 5, 42, 0, 0, 237, 60, 1, 0, 0, 0, 238, 239, 5, 45, 0, 0, 239, 62, - 1, 0, 0, 0, 240, 242, 7, 2, 0, 0, 241, 240, 1, 0, 0, 0, 242, 243, 1, 0, - 0, 0, 243, 241, 1, 0, 0, 0, 243, 244, 1, 0, 0, 0, 244, 251, 1, 0, 0, 0, - 245, 247, 5, 46, 0, 0, 246, 248, 7, 2, 0, 0, 247, 246, 1, 0, 0, 0, 248, - 249, 1, 0, 0, 0, 249, 247, 1, 0, 0, 0, 249, 250, 1, 0, 0, 0, 250, 252, - 1, 0, 0, 0, 251, 245, 1, 0, 0, 0, 251, 252, 1, 0, 0, 0, 252, 253, 1, 0, - 0, 0, 253, 254, 5, 37, 0, 0, 254, 64, 1, 0, 0, 0, 255, 261, 5, 34, 0, 0, - 256, 257, 5, 92, 0, 0, 257, 260, 5, 34, 0, 0, 258, 260, 8, 3, 0, 0, 259, - 256, 1, 0, 0, 0, 259, 258, 1, 0, 0, 0, 260, 263, 1, 0, 0, 0, 261, 259, - 1, 0, 0, 0, 261, 262, 1, 0, 0, 0, 262, 264, 1, 0, 0, 0, 263, 261, 1, 0, - 0, 0, 264, 265, 5, 34, 0, 0, 265, 66, 1, 0, 0, 0, 266, 268, 7, 4, 0, 0, - 267, 266, 1, 0, 0, 0, 268, 269, 1, 0, 0, 0, 269, 267, 1, 0, 0, 0, 269, - 270, 1, 0, 0, 0, 270, 274, 1, 0, 0, 0, 271, 273, 7, 5, 0, 0, 272, 271, - 1, 0, 0, 0, 273, 276, 1, 0, 0, 0, 274, 272, 1, 0, 0, 0, 274, 275, 1, 0, - 0, 0, 275, 68, 1, 0, 0, 0, 276, 274, 1, 0, 0, 0, 277, 279, 3, 61, 30, 0, - 278, 277, 1, 0, 0, 0, 278, 279, 1, 0, 0, 0, 279, 281, 1, 0, 0, 0, 280, - 282, 7, 2, 0, 0, 281, 280, 1, 0, 0, 0, 282, 283, 1, 0, 0, 0, 283, 281, - 1, 0, 0, 0, 283, 284, 1, 0, 0, 0, 284, 293, 1, 0, 0, 0, 285, 287, 5, 95, - 0, 0, 286, 288, 7, 2, 0, 0, 287, 286, 1, 0, 0, 0, 288, 289, 1, 0, 0, 0, - 289, 287, 1, 0, 0, 0, 289, 290, 1, 0, 0, 0, 290, 292, 1, 0, 0, 0, 291, - 285, 1, 0, 0, 0, 292, 295, 1, 0, 0, 0, 293, 291, 1, 0, 0, 0, 293, 294, - 1, 0, 0, 0, 294, 70, 1, 0, 0, 0, 295, 293, 1, 0, 0, 0, 296, 298, 5, 36, - 0, 0, 297, 299, 7, 5, 0, 0, 298, 297, 1, 0, 0, 0, 299, 300, 1, 0, 0, 0, - 300, 298, 1, 0, 0, 0, 300, 301, 1, 0, 0, 0, 301, 305, 1, 0, 0, 0, 302, - 304, 7, 6, 0, 0, 303, 302, 1, 0, 0, 0, 304, 307, 1, 0, 0, 0, 305, 303, - 1, 0, 0, 0, 305, 306, 1, 0, 0, 0, 306, 72, 1, 0, 0, 0, 307, 305, 1, 0, - 0, 0, 308, 310, 5, 64, 0, 0, 309, 311, 7, 7, 0, 0, 310, 309, 1, 0, 0, 0, - 311, 312, 1, 0, 0, 0, 312, 310, 1, 0, 0, 0, 312, 313, 1, 0, 0, 0, 313, - 322, 1, 0, 0, 0, 314, 316, 5, 58, 0, 0, 315, 317, 7, 7, 0, 0, 316, 315, - 1, 0, 0, 0, 317, 318, 1, 0, 0, 0, 318, 316, 1, 0, 0, 0, 318, 319, 1, 0, - 0, 0, 319, 321, 1, 0, 0, 0, 320, 314, 1, 0, 0, 0, 321, 324, 1, 0, 0, 0, - 322, 320, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 74, 1, 0, 0, 0, 324, 322, - 1, 0, 0, 0, 325, 329, 7, 8, 0, 0, 326, 328, 7, 9, 0, 0, 327, 326, 1, 0, - 0, 0, 328, 331, 1, 0, 0, 0, 329, 327, 1, 0, 0, 0, 329, 330, 1, 0, 0, 0, - 330, 338, 1, 0, 0, 0, 331, 329, 1, 0, 0, 0, 332, 334, 5, 47, 0, 0, 333, - 335, 7, 2, 0, 0, 334, 333, 1, 0, 0, 0, 335, 336, 1, 0, 0, 0, 336, 334, - 1, 0, 0, 0, 336, 337, 1, 0, 0, 0, 337, 339, 1, 0, 0, 0, 338, 332, 1, 0, - 0, 0, 338, 339, 1, 0, 0, 0, 339, 76, 1, 0, 0, 0, 25, 0, 90, 97, 104, 106, - 120, 243, 249, 251, 259, 261, 269, 274, 278, 283, 289, 293, 300, 305, 312, - 318, 322, 329, 336, 338, 1, 6, 0, 0, - } - deserializer := antlr.NewATNDeserializer(nil) - staticData.atn = deserializer.Deserialize(staticData.serializedATN) - atn := staticData.atn - staticData.decisionToDFA = make([]*antlr.DFA, len(atn.DecisionToState)) - decisionToDFA := staticData.decisionToDFA - for index, state := range atn.DecisionToState { - decisionToDFA[index] = antlr.NewDFA(state, index) - } -} - -// NumscriptLexerInit initializes any static state used to implement NumscriptLexer. By default the -// static state used to implement the lexer is lazily initialized during the first call to -// NewNumscriptLexer(). You can call this function if you wish to initialize the static state ahead -// of time. -func NumscriptLexerInit() { - staticData := &NumscriptLexerLexerStaticData - staticData.once.Do(numscriptlexerLexerInit) -} - -// NewNumscriptLexer produces a new lexer instance for the optional input antlr.CharStream. -func NewNumscriptLexer(input antlr.CharStream) *NumscriptLexer { - NumscriptLexerInit() - l := new(NumscriptLexer) - l.BaseLexer = antlr.NewBaseLexer(input) - staticData := &NumscriptLexerLexerStaticData - l.Interpreter = antlr.NewLexerATNSimulator(l, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache) - l.channelNames = staticData.ChannelNames - l.modeNames = staticData.ModeNames - l.RuleNames = staticData.RuleNames - l.LiteralNames = staticData.LiteralNames - l.SymbolicNames = staticData.SymbolicNames - l.GrammarFileName = "Numscript.g4" - // TODO: l.EOF = antlr.TokenEOF - - return l -} - -// NumscriptLexer tokens. -const ( - NumscriptLexerT__0 = 1 - NumscriptLexerT__1 = 2 - NumscriptLexerT__2 = 3 - NumscriptLexerWS = 4 - NumscriptLexerNEWLINE = 5 - NumscriptLexerMULTILINE_COMMENT = 6 - NumscriptLexerLINE_COMMENT = 7 - NumscriptLexerVARS = 8 - NumscriptLexerMAX = 9 - NumscriptLexerSOURCE = 10 - NumscriptLexerDESTINATION = 11 - NumscriptLexerSEND = 12 - NumscriptLexerFROM = 13 - NumscriptLexerUP = 14 - NumscriptLexerTO = 15 - NumscriptLexerREMAINING = 16 - NumscriptLexerALLOWING = 17 - NumscriptLexerUNBOUNDED = 18 - NumscriptLexerOVERDRAFT = 19 - NumscriptLexerKEPT = 20 - NumscriptLexerSAVE = 21 - NumscriptLexerLPARENS = 22 - NumscriptLexerRPARENS = 23 - NumscriptLexerLBRACKET = 24 - NumscriptLexerRBRACKET = 25 - NumscriptLexerLBRACE = 26 - NumscriptLexerRBRACE = 27 - NumscriptLexerCOMMA = 28 - NumscriptLexerEQ = 29 - NumscriptLexerSTAR = 30 - NumscriptLexerMINUS = 31 - NumscriptLexerPERCENTAGE_PORTION_LITERAL = 32 - NumscriptLexerSTRING = 33 - NumscriptLexerIDENTIFIER = 34 - NumscriptLexerNUMBER = 35 - NumscriptLexerVARIABLE_NAME = 36 - NumscriptLexerACCOUNT = 37 - NumscriptLexerASSET = 38 -) diff --git a/internal/parser/antlrParser/Lexer.interp b/internal/parser/antlrParser/Lexer.interp new file mode 100644 index 00000000..4014dafc --- /dev/null +++ b/internal/parser/antlrParser/Lexer.interp @@ -0,0 +1,142 @@ +token literal names: +null +null +null +null +null +'vars' +'max' +'source' +'destination' +'send' +'from' +'up' +'to' +'remaining' +'allowing' +'unbounded' +'overdraft' +'oneof' +'kept' +'save' +'(' +')' +'[' +']' +'{' +'}' +',' +'=' +'*' +'+' +'-' +'/' +null +null +null +null +null +'@' +':' +null +null +null + +token symbolic names: +null +WS +NEWLINE +MULTILINE_COMMENT +LINE_COMMENT +VARS +MAX +SOURCE +DESTINATION +SEND +FROM +UP +TO +REMAINING +ALLOWING +UNBOUNDED +OVERDRAFT +ONEOF +KEPT +SAVE +LPARENS +RPARENS +LBRACKET +RBRACKET +LBRACE +RBRACE +COMMA +EQ +STAR +PLUS +MINUS +DIV +PERCENTAGE_PORTION_LITERAL +STRING +IDENTIFIER +NUMBER +ASSET +ACCOUNT_START +COLON +ACCOUNT_TEXT +VARIABLE_NAME_ACC +VARIABLE_NAME + +rule names: +WS +NEWLINE +MULTILINE_COMMENT +LINE_COMMENT +VARS +MAX +SOURCE +DESTINATION +SEND +FROM +UP +TO +REMAINING +ALLOWING +UNBOUNDED +OVERDRAFT +ONEOF +KEPT +SAVE +LPARENS +RPARENS +LBRACKET +RBRACKET +LBRACE +RBRACE +COMMA +EQ +STAR +PLUS +MINUS +DIV +PERCENTAGE_PORTION_LITERAL +STRING +IDENTIFIER +NUMBER +ASSET +ACCOUNT_START +COLON +VARIABLE_NAME_FRAGMENT +ACCOUNT_TEXT +VARIABLE_NAME_ACC +VARIABLE_NAME + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE +ACCOUNT_MODE + +atn: +[4, 0, 41, 353, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 1, 0, 4, 0, 88, 8, 0, 11, 0, 12, 0, 89, 1, 0, 1, 0, 1, 1, 4, 1, 95, 8, 1, 11, 1, 12, 1, 96, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 104, 8, 2, 10, 2, 12, 2, 107, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 5, 3, 118, 8, 3, 10, 3, 12, 3, 121, 9, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 4, 31, 251, 8, 31, 11, 31, 12, 31, 252, 1, 31, 1, 31, 4, 31, 257, 8, 31, 11, 31, 12, 31, 258, 3, 31, 261, 8, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 5, 32, 269, 8, 32, 10, 32, 12, 32, 272, 9, 32, 1, 32, 1, 32, 1, 33, 4, 33, 277, 8, 33, 11, 33, 12, 33, 278, 1, 33, 5, 33, 282, 8, 33, 10, 33, 12, 33, 285, 9, 33, 1, 34, 3, 34, 288, 8, 34, 1, 34, 4, 34, 291, 8, 34, 11, 34, 12, 34, 292, 1, 34, 1, 34, 4, 34, 297, 8, 34, 11, 34, 12, 34, 298, 5, 34, 301, 8, 34, 10, 34, 12, 34, 304, 9, 34, 1, 35, 1, 35, 5, 35, 308, 8, 35, 10, 35, 12, 35, 311, 9, 35, 1, 35, 1, 35, 4, 35, 315, 8, 35, 11, 35, 12, 35, 316, 3, 35, 319, 8, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 4, 38, 331, 8, 38, 11, 38, 12, 38, 332, 1, 38, 5, 38, 336, 8, 38, 10, 38, 12, 38, 339, 9, 38, 1, 39, 4, 39, 342, 8, 39, 11, 39, 12, 39, 343, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 2, 105, 119, 0, 42, 2, 1, 4, 2, 6, 3, 8, 4, 10, 5, 12, 6, 14, 7, 16, 8, 18, 9, 20, 10, 22, 11, 24, 12, 26, 13, 28, 14, 30, 15, 32, 16, 34, 17, 36, 18, 38, 19, 40, 20, 42, 21, 44, 22, 46, 23, 48, 24, 50, 25, 52, 26, 54, 27, 56, 28, 58, 29, 60, 30, 62, 31, 64, 32, 66, 33, 68, 34, 70, 35, 72, 36, 74, 37, 76, 38, 78, 0, 80, 39, 82, 40, 84, 41, 2, 0, 1, 10, 3, 0, 9, 10, 13, 13, 32, 32, 2, 0, 10, 10, 13, 13, 1, 0, 48, 57, 3, 0, 10, 10, 13, 13, 34, 34, 1, 0, 97, 122, 2, 0, 95, 95, 97, 122, 1, 0, 65, 90, 2, 0, 48, 57, 65, 90, 3, 0, 48, 57, 95, 95, 97, 122, 5, 0, 45, 45, 48, 57, 65, 90, 95, 95, 97, 122, 372, 0, 2, 1, 0, 0, 0, 0, 4, 1, 0, 0, 0, 0, 6, 1, 0, 0, 0, 0, 8, 1, 0, 0, 0, 0, 10, 1, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 14, 1, 0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 18, 1, 0, 0, 0, 0, 20, 1, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 24, 1, 0, 0, 0, 0, 26, 1, 0, 0, 0, 0, 28, 1, 0, 0, 0, 0, 30, 1, 0, 0, 0, 0, 32, 1, 0, 0, 0, 0, 34, 1, 0, 0, 0, 0, 36, 1, 0, 0, 0, 0, 38, 1, 0, 0, 0, 0, 40, 1, 0, 0, 0, 0, 42, 1, 0, 0, 0, 0, 44, 1, 0, 0, 0, 0, 46, 1, 0, 0, 0, 0, 48, 1, 0, 0, 0, 0, 50, 1, 0, 0, 0, 0, 52, 1, 0, 0, 0, 0, 54, 1, 0, 0, 0, 0, 56, 1, 0, 0, 0, 0, 58, 1, 0, 0, 0, 0, 60, 1, 0, 0, 0, 0, 62, 1, 0, 0, 0, 0, 64, 1, 0, 0, 0, 0, 66, 1, 0, 0, 0, 0, 68, 1, 0, 0, 0, 0, 70, 1, 0, 0, 0, 0, 72, 1, 0, 0, 0, 0, 74, 1, 0, 0, 0, 0, 76, 1, 0, 0, 0, 0, 84, 1, 0, 0, 0, 1, 80, 1, 0, 0, 0, 1, 82, 1, 0, 0, 0, 2, 87, 1, 0, 0, 0, 4, 94, 1, 0, 0, 0, 6, 98, 1, 0, 0, 0, 8, 113, 1, 0, 0, 0, 10, 126, 1, 0, 0, 0, 12, 131, 1, 0, 0, 0, 14, 135, 1, 0, 0, 0, 16, 142, 1, 0, 0, 0, 18, 154, 1, 0, 0, 0, 20, 159, 1, 0, 0, 0, 22, 164, 1, 0, 0, 0, 24, 167, 1, 0, 0, 0, 26, 170, 1, 0, 0, 0, 28, 180, 1, 0, 0, 0, 30, 189, 1, 0, 0, 0, 32, 199, 1, 0, 0, 0, 34, 209, 1, 0, 0, 0, 36, 215, 1, 0, 0, 0, 38, 220, 1, 0, 0, 0, 40, 225, 1, 0, 0, 0, 42, 227, 1, 0, 0, 0, 44, 229, 1, 0, 0, 0, 46, 231, 1, 0, 0, 0, 48, 233, 1, 0, 0, 0, 50, 235, 1, 0, 0, 0, 52, 237, 1, 0, 0, 0, 54, 239, 1, 0, 0, 0, 56, 241, 1, 0, 0, 0, 58, 243, 1, 0, 0, 0, 60, 245, 1, 0, 0, 0, 62, 247, 1, 0, 0, 0, 64, 250, 1, 0, 0, 0, 66, 264, 1, 0, 0, 0, 68, 276, 1, 0, 0, 0, 70, 287, 1, 0, 0, 0, 72, 305, 1, 0, 0, 0, 74, 320, 1, 0, 0, 0, 76, 324, 1, 0, 0, 0, 78, 328, 1, 0, 0, 0, 80, 341, 1, 0, 0, 0, 82, 347, 1, 0, 0, 0, 84, 351, 1, 0, 0, 0, 86, 88, 7, 0, 0, 0, 87, 86, 1, 0, 0, 0, 88, 89, 1, 0, 0, 0, 89, 87, 1, 0, 0, 0, 89, 90, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 92, 6, 0, 0, 0, 92, 3, 1, 0, 0, 0, 93, 95, 7, 1, 0, 0, 94, 93, 1, 0, 0, 0, 95, 96, 1, 0, 0, 0, 96, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 5, 1, 0, 0, 0, 98, 99, 5, 47, 0, 0, 99, 100, 5, 42, 0, 0, 100, 105, 1, 0, 0, 0, 101, 104, 3, 6, 2, 0, 102, 104, 9, 0, 0, 0, 103, 101, 1, 0, 0, 0, 103, 102, 1, 0, 0, 0, 104, 107, 1, 0, 0, 0, 105, 106, 1, 0, 0, 0, 105, 103, 1, 0, 0, 0, 106, 108, 1, 0, 0, 0, 107, 105, 1, 0, 0, 0, 108, 109, 5, 42, 0, 0, 109, 110, 5, 47, 0, 0, 110, 111, 1, 0, 0, 0, 111, 112, 6, 2, 0, 0, 112, 7, 1, 0, 0, 0, 113, 114, 5, 47, 0, 0, 114, 115, 5, 47, 0, 0, 115, 119, 1, 0, 0, 0, 116, 118, 9, 0, 0, 0, 117, 116, 1, 0, 0, 0, 118, 121, 1, 0, 0, 0, 119, 120, 1, 0, 0, 0, 119, 117, 1, 0, 0, 0, 120, 122, 1, 0, 0, 0, 121, 119, 1, 0, 0, 0, 122, 123, 3, 4, 1, 0, 123, 124, 1, 0, 0, 0, 124, 125, 6, 3, 0, 0, 125, 9, 1, 0, 0, 0, 126, 127, 5, 118, 0, 0, 127, 128, 5, 97, 0, 0, 128, 129, 5, 114, 0, 0, 129, 130, 5, 115, 0, 0, 130, 11, 1, 0, 0, 0, 131, 132, 5, 109, 0, 0, 132, 133, 5, 97, 0, 0, 133, 134, 5, 120, 0, 0, 134, 13, 1, 0, 0, 0, 135, 136, 5, 115, 0, 0, 136, 137, 5, 111, 0, 0, 137, 138, 5, 117, 0, 0, 138, 139, 5, 114, 0, 0, 139, 140, 5, 99, 0, 0, 140, 141, 5, 101, 0, 0, 141, 15, 1, 0, 0, 0, 142, 143, 5, 100, 0, 0, 143, 144, 5, 101, 0, 0, 144, 145, 5, 115, 0, 0, 145, 146, 5, 116, 0, 0, 146, 147, 5, 105, 0, 0, 147, 148, 5, 110, 0, 0, 148, 149, 5, 97, 0, 0, 149, 150, 5, 116, 0, 0, 150, 151, 5, 105, 0, 0, 151, 152, 5, 111, 0, 0, 152, 153, 5, 110, 0, 0, 153, 17, 1, 0, 0, 0, 154, 155, 5, 115, 0, 0, 155, 156, 5, 101, 0, 0, 156, 157, 5, 110, 0, 0, 157, 158, 5, 100, 0, 0, 158, 19, 1, 0, 0, 0, 159, 160, 5, 102, 0, 0, 160, 161, 5, 114, 0, 0, 161, 162, 5, 111, 0, 0, 162, 163, 5, 109, 0, 0, 163, 21, 1, 0, 0, 0, 164, 165, 5, 117, 0, 0, 165, 166, 5, 112, 0, 0, 166, 23, 1, 0, 0, 0, 167, 168, 5, 116, 0, 0, 168, 169, 5, 111, 0, 0, 169, 25, 1, 0, 0, 0, 170, 171, 5, 114, 0, 0, 171, 172, 5, 101, 0, 0, 172, 173, 5, 109, 0, 0, 173, 174, 5, 97, 0, 0, 174, 175, 5, 105, 0, 0, 175, 176, 5, 110, 0, 0, 176, 177, 5, 105, 0, 0, 177, 178, 5, 110, 0, 0, 178, 179, 5, 103, 0, 0, 179, 27, 1, 0, 0, 0, 180, 181, 5, 97, 0, 0, 181, 182, 5, 108, 0, 0, 182, 183, 5, 108, 0, 0, 183, 184, 5, 111, 0, 0, 184, 185, 5, 119, 0, 0, 185, 186, 5, 105, 0, 0, 186, 187, 5, 110, 0, 0, 187, 188, 5, 103, 0, 0, 188, 29, 1, 0, 0, 0, 189, 190, 5, 117, 0, 0, 190, 191, 5, 110, 0, 0, 191, 192, 5, 98, 0, 0, 192, 193, 5, 111, 0, 0, 193, 194, 5, 117, 0, 0, 194, 195, 5, 110, 0, 0, 195, 196, 5, 100, 0, 0, 196, 197, 5, 101, 0, 0, 197, 198, 5, 100, 0, 0, 198, 31, 1, 0, 0, 0, 199, 200, 5, 111, 0, 0, 200, 201, 5, 118, 0, 0, 201, 202, 5, 101, 0, 0, 202, 203, 5, 114, 0, 0, 203, 204, 5, 100, 0, 0, 204, 205, 5, 114, 0, 0, 205, 206, 5, 97, 0, 0, 206, 207, 5, 102, 0, 0, 207, 208, 5, 116, 0, 0, 208, 33, 1, 0, 0, 0, 209, 210, 5, 111, 0, 0, 210, 211, 5, 110, 0, 0, 211, 212, 5, 101, 0, 0, 212, 213, 5, 111, 0, 0, 213, 214, 5, 102, 0, 0, 214, 35, 1, 0, 0, 0, 215, 216, 5, 107, 0, 0, 216, 217, 5, 101, 0, 0, 217, 218, 5, 112, 0, 0, 218, 219, 5, 116, 0, 0, 219, 37, 1, 0, 0, 0, 220, 221, 5, 115, 0, 0, 221, 222, 5, 97, 0, 0, 222, 223, 5, 118, 0, 0, 223, 224, 5, 101, 0, 0, 224, 39, 1, 0, 0, 0, 225, 226, 5, 40, 0, 0, 226, 41, 1, 0, 0, 0, 227, 228, 5, 41, 0, 0, 228, 43, 1, 0, 0, 0, 229, 230, 5, 91, 0, 0, 230, 45, 1, 0, 0, 0, 231, 232, 5, 93, 0, 0, 232, 47, 1, 0, 0, 0, 233, 234, 5, 123, 0, 0, 234, 49, 1, 0, 0, 0, 235, 236, 5, 125, 0, 0, 236, 51, 1, 0, 0, 0, 237, 238, 5, 44, 0, 0, 238, 53, 1, 0, 0, 0, 239, 240, 5, 61, 0, 0, 240, 55, 1, 0, 0, 0, 241, 242, 5, 42, 0, 0, 242, 57, 1, 0, 0, 0, 243, 244, 5, 43, 0, 0, 244, 59, 1, 0, 0, 0, 245, 246, 5, 45, 0, 0, 246, 61, 1, 0, 0, 0, 247, 248, 5, 47, 0, 0, 248, 63, 1, 0, 0, 0, 249, 251, 7, 2, 0, 0, 250, 249, 1, 0, 0, 0, 251, 252, 1, 0, 0, 0, 252, 250, 1, 0, 0, 0, 252, 253, 1, 0, 0, 0, 253, 260, 1, 0, 0, 0, 254, 256, 5, 46, 0, 0, 255, 257, 7, 2, 0, 0, 256, 255, 1, 0, 0, 0, 257, 258, 1, 0, 0, 0, 258, 256, 1, 0, 0, 0, 258, 259, 1, 0, 0, 0, 259, 261, 1, 0, 0, 0, 260, 254, 1, 0, 0, 0, 260, 261, 1, 0, 0, 0, 261, 262, 1, 0, 0, 0, 262, 263, 5, 37, 0, 0, 263, 65, 1, 0, 0, 0, 264, 270, 5, 34, 0, 0, 265, 266, 5, 92, 0, 0, 266, 269, 5, 34, 0, 0, 267, 269, 8, 3, 0, 0, 268, 265, 1, 0, 0, 0, 268, 267, 1, 0, 0, 0, 269, 272, 1, 0, 0, 0, 270, 268, 1, 0, 0, 0, 270, 271, 1, 0, 0, 0, 271, 273, 1, 0, 0, 0, 272, 270, 1, 0, 0, 0, 273, 274, 5, 34, 0, 0, 274, 67, 1, 0, 0, 0, 275, 277, 7, 4, 0, 0, 276, 275, 1, 0, 0, 0, 277, 278, 1, 0, 0, 0, 278, 276, 1, 0, 0, 0, 278, 279, 1, 0, 0, 0, 279, 283, 1, 0, 0, 0, 280, 282, 7, 5, 0, 0, 281, 280, 1, 0, 0, 0, 282, 285, 1, 0, 0, 0, 283, 281, 1, 0, 0, 0, 283, 284, 1, 0, 0, 0, 284, 69, 1, 0, 0, 0, 285, 283, 1, 0, 0, 0, 286, 288, 3, 60, 29, 0, 287, 286, 1, 0, 0, 0, 287, 288, 1, 0, 0, 0, 288, 290, 1, 0, 0, 0, 289, 291, 7, 2, 0, 0, 290, 289, 1, 0, 0, 0, 291, 292, 1, 0, 0, 0, 292, 290, 1, 0, 0, 0, 292, 293, 1, 0, 0, 0, 293, 302, 1, 0, 0, 0, 294, 296, 5, 95, 0, 0, 295, 297, 7, 2, 0, 0, 296, 295, 1, 0, 0, 0, 297, 298, 1, 0, 0, 0, 298, 296, 1, 0, 0, 0, 298, 299, 1, 0, 0, 0, 299, 301, 1, 0, 0, 0, 300, 294, 1, 0, 0, 0, 301, 304, 1, 0, 0, 0, 302, 300, 1, 0, 0, 0, 302, 303, 1, 0, 0, 0, 303, 71, 1, 0, 0, 0, 304, 302, 1, 0, 0, 0, 305, 309, 7, 6, 0, 0, 306, 308, 7, 7, 0, 0, 307, 306, 1, 0, 0, 0, 308, 311, 1, 0, 0, 0, 309, 307, 1, 0, 0, 0, 309, 310, 1, 0, 0, 0, 310, 318, 1, 0, 0, 0, 311, 309, 1, 0, 0, 0, 312, 314, 5, 47, 0, 0, 313, 315, 7, 2, 0, 0, 314, 313, 1, 0, 0, 0, 315, 316, 1, 0, 0, 0, 316, 314, 1, 0, 0, 0, 316, 317, 1, 0, 0, 0, 317, 319, 1, 0, 0, 0, 318, 312, 1, 0, 0, 0, 318, 319, 1, 0, 0, 0, 319, 73, 1, 0, 0, 0, 320, 321, 5, 64, 0, 0, 321, 322, 1, 0, 0, 0, 322, 323, 6, 36, 1, 0, 323, 75, 1, 0, 0, 0, 324, 325, 5, 58, 0, 0, 325, 326, 1, 0, 0, 0, 326, 327, 6, 37, 1, 0, 327, 77, 1, 0, 0, 0, 328, 330, 5, 36, 0, 0, 329, 331, 7, 5, 0, 0, 330, 329, 1, 0, 0, 0, 331, 332, 1, 0, 0, 0, 332, 330, 1, 0, 0, 0, 332, 333, 1, 0, 0, 0, 333, 337, 1, 0, 0, 0, 334, 336, 7, 8, 0, 0, 335, 334, 1, 0, 0, 0, 336, 339, 1, 0, 0, 0, 337, 335, 1, 0, 0, 0, 337, 338, 1, 0, 0, 0, 338, 79, 1, 0, 0, 0, 339, 337, 1, 0, 0, 0, 340, 342, 7, 9, 0, 0, 341, 340, 1, 0, 0, 0, 342, 343, 1, 0, 0, 0, 343, 341, 1, 0, 0, 0, 343, 344, 1, 0, 0, 0, 344, 345, 1, 0, 0, 0, 345, 346, 6, 39, 2, 0, 346, 81, 1, 0, 0, 0, 347, 348, 3, 78, 38, 0, 348, 349, 1, 0, 0, 0, 349, 350, 6, 40, 2, 0, 350, 83, 1, 0, 0, 0, 351, 352, 3, 78, 38, 0, 352, 85, 1, 0, 0, 0, 24, 0, 1, 89, 96, 103, 105, 119, 252, 258, 260, 268, 270, 278, 283, 287, 292, 298, 302, 309, 316, 318, 332, 337, 343, 3, 6, 0, 0, 5, 1, 0, 4, 0, 0] \ No newline at end of file diff --git a/internal/parser/antlrParser/Lexer.tokens b/internal/parser/antlrParser/Lexer.tokens new file mode 100644 index 00000000..88700404 --- /dev/null +++ b/internal/parser/antlrParser/Lexer.tokens @@ -0,0 +1,70 @@ +WS=1 +NEWLINE=2 +MULTILINE_COMMENT=3 +LINE_COMMENT=4 +VARS=5 +MAX=6 +SOURCE=7 +DESTINATION=8 +SEND=9 +FROM=10 +UP=11 +TO=12 +REMAINING=13 +ALLOWING=14 +UNBOUNDED=15 +OVERDRAFT=16 +ONEOF=17 +KEPT=18 +SAVE=19 +LPARENS=20 +RPARENS=21 +LBRACKET=22 +RBRACKET=23 +LBRACE=24 +RBRACE=25 +COMMA=26 +EQ=27 +STAR=28 +PLUS=29 +MINUS=30 +DIV=31 +PERCENTAGE_PORTION_LITERAL=32 +STRING=33 +IDENTIFIER=34 +NUMBER=35 +ASSET=36 +ACCOUNT_START=37 +COLON=38 +ACCOUNT_TEXT=39 +VARIABLE_NAME_ACC=40 +VARIABLE_NAME=41 +'vars'=5 +'max'=6 +'source'=7 +'destination'=8 +'send'=9 +'from'=10 +'up'=11 +'to'=12 +'remaining'=13 +'allowing'=14 +'unbounded'=15 +'overdraft'=16 +'oneof'=17 +'kept'=18 +'save'=19 +'('=20 +')'=21 +'['=22 +']'=23 +'{'=24 +'}'=25 +','=26 +'='=27 +'*'=28 +'+'=29 +'-'=30 +'/'=31 +'@'=37 +':'=38 diff --git a/internal/parser/antlrParser/Numscript.interp b/internal/parser/antlrParser/Numscript.interp new file mode 100644 index 00000000..d9a2a0d6 --- /dev/null +++ b/internal/parser/antlrParser/Numscript.interp @@ -0,0 +1,112 @@ +token literal names: +null +null +null +null +null +'vars' +'max' +'source' +'destination' +'send' +'from' +'up' +'to' +'remaining' +'allowing' +'unbounded' +'overdraft' +'oneof' +'kept' +'save' +'(' +')' +'[' +']' +'{' +'}' +',' +'=' +'*' +'+' +'-' +'/' +null +null +null +null +null +'@' +':' +null +null +null + +token symbolic names: +null +WS +NEWLINE +MULTILINE_COMMENT +LINE_COMMENT +VARS +MAX +SOURCE +DESTINATION +SEND +FROM +UP +TO +REMAINING +ALLOWING +UNBOUNDED +OVERDRAFT +ONEOF +KEPT +SAVE +LPARENS +RPARENS +LBRACKET +RBRACKET +LBRACE +RBRACE +COMMA +EQ +STAR +PLUS +MINUS +DIV +PERCENTAGE_PORTION_LITERAL +STRING +IDENTIFIER +NUMBER +ASSET +ACCOUNT_START +COLON +ACCOUNT_TEXT +VARIABLE_NAME_ACC +VARIABLE_NAME + +rule names: +monetaryLit +accountLiteralPart +valueExpr +functionCallArgs +functionCall +varOrigin +varDeclaration +varsDeclaration +program +sentAllLit +allotment +source +allotmentClauseSrc +keptOrDestination +destinationInOrderClause +destination +allotmentClauseDest +sentValue +statement + + +atn: +[4, 1, 41, 252, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 3, 1, 46, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 56, 8, 2, 10, 2, 12, 2, 59, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 68, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 76, 8, 2, 10, 2, 12, 2, 79, 9, 2, 1, 3, 1, 3, 1, 3, 5, 3, 84, 8, 3, 10, 3, 12, 3, 87, 9, 3, 1, 4, 1, 4, 1, 4, 3, 4, 92, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 3, 6, 102, 8, 6, 1, 7, 1, 7, 1, 7, 5, 7, 107, 8, 7, 10, 7, 12, 7, 110, 9, 7, 1, 7, 1, 7, 1, 8, 3, 8, 115, 8, 8, 1, 8, 5, 8, 118, 8, 8, 10, 8, 12, 8, 121, 9, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 3, 10, 132, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 4, 11, 149, 8, 11, 11, 11, 12, 11, 150, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 157, 8, 11, 10, 11, 12, 11, 160, 9, 11, 1, 11, 1, 11, 1, 11, 1, 11, 4, 11, 166, 8, 11, 11, 11, 12, 11, 167, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 177, 8, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 3, 13, 186, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 4, 15, 195, 8, 15, 11, 15, 12, 15, 196, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 203, 8, 15, 10, 15, 12, 15, 206, 9, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 215, 8, 15, 10, 15, 12, 15, 218, 9, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 224, 8, 15, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 3, 17, 231, 8, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 250, 8, 18, 1, 18, 0, 1, 4, 19, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 0, 2, 1, 0, 29, 30, 2, 0, 16, 16, 34, 34, 269, 0, 38, 1, 0, 0, 0, 2, 45, 1, 0, 0, 0, 4, 67, 1, 0, 0, 0, 6, 80, 1, 0, 0, 0, 8, 88, 1, 0, 0, 0, 10, 95, 1, 0, 0, 0, 12, 98, 1, 0, 0, 0, 14, 103, 1, 0, 0, 0, 16, 114, 1, 0, 0, 0, 18, 124, 1, 0, 0, 0, 20, 131, 1, 0, 0, 0, 22, 176, 1, 0, 0, 0, 24, 178, 1, 0, 0, 0, 26, 185, 1, 0, 0, 0, 28, 187, 1, 0, 0, 0, 30, 223, 1, 0, 0, 0, 32, 225, 1, 0, 0, 0, 34, 230, 1, 0, 0, 0, 36, 249, 1, 0, 0, 0, 38, 39, 5, 22, 0, 0, 39, 40, 3, 4, 2, 0, 40, 41, 3, 4, 2, 0, 41, 42, 5, 23, 0, 0, 42, 1, 1, 0, 0, 0, 43, 46, 5, 39, 0, 0, 44, 46, 5, 40, 0, 0, 45, 43, 1, 0, 0, 0, 45, 44, 1, 0, 0, 0, 46, 3, 1, 0, 0, 0, 47, 48, 6, 2, -1, 0, 48, 68, 5, 41, 0, 0, 49, 68, 5, 36, 0, 0, 50, 68, 5, 33, 0, 0, 51, 52, 5, 37, 0, 0, 52, 57, 3, 2, 1, 0, 53, 54, 5, 38, 0, 0, 54, 56, 3, 2, 1, 0, 55, 53, 1, 0, 0, 0, 56, 59, 1, 0, 0, 0, 57, 55, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 68, 1, 0, 0, 0, 59, 57, 1, 0, 0, 0, 60, 68, 5, 35, 0, 0, 61, 68, 5, 32, 0, 0, 62, 68, 3, 0, 0, 0, 63, 64, 5, 20, 0, 0, 64, 65, 3, 4, 2, 0, 65, 66, 5, 21, 0, 0, 66, 68, 1, 0, 0, 0, 67, 47, 1, 0, 0, 0, 67, 49, 1, 0, 0, 0, 67, 50, 1, 0, 0, 0, 67, 51, 1, 0, 0, 0, 67, 60, 1, 0, 0, 0, 67, 61, 1, 0, 0, 0, 67, 62, 1, 0, 0, 0, 67, 63, 1, 0, 0, 0, 68, 77, 1, 0, 0, 0, 69, 70, 10, 3, 0, 0, 70, 71, 5, 31, 0, 0, 71, 76, 3, 4, 2, 4, 72, 73, 10, 2, 0, 0, 73, 74, 7, 0, 0, 0, 74, 76, 3, 4, 2, 3, 75, 69, 1, 0, 0, 0, 75, 72, 1, 0, 0, 0, 76, 79, 1, 0, 0, 0, 77, 75, 1, 0, 0, 0, 77, 78, 1, 0, 0, 0, 78, 5, 1, 0, 0, 0, 79, 77, 1, 0, 0, 0, 80, 85, 3, 4, 2, 0, 81, 82, 5, 26, 0, 0, 82, 84, 3, 4, 2, 0, 83, 81, 1, 0, 0, 0, 84, 87, 1, 0, 0, 0, 85, 83, 1, 0, 0, 0, 85, 86, 1, 0, 0, 0, 86, 7, 1, 0, 0, 0, 87, 85, 1, 0, 0, 0, 88, 89, 7, 1, 0, 0, 89, 91, 5, 20, 0, 0, 90, 92, 3, 6, 3, 0, 91, 90, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 94, 5, 21, 0, 0, 94, 9, 1, 0, 0, 0, 95, 96, 5, 27, 0, 0, 96, 97, 3, 8, 4, 0, 97, 11, 1, 0, 0, 0, 98, 99, 5, 34, 0, 0, 99, 101, 5, 41, 0, 0, 100, 102, 3, 10, 5, 0, 101, 100, 1, 0, 0, 0, 101, 102, 1, 0, 0, 0, 102, 13, 1, 0, 0, 0, 103, 104, 5, 5, 0, 0, 104, 108, 5, 24, 0, 0, 105, 107, 3, 12, 6, 0, 106, 105, 1, 0, 0, 0, 107, 110, 1, 0, 0, 0, 108, 106, 1, 0, 0, 0, 108, 109, 1, 0, 0, 0, 109, 111, 1, 0, 0, 0, 110, 108, 1, 0, 0, 0, 111, 112, 5, 25, 0, 0, 112, 15, 1, 0, 0, 0, 113, 115, 3, 14, 7, 0, 114, 113, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115, 119, 1, 0, 0, 0, 116, 118, 3, 36, 18, 0, 117, 116, 1, 0, 0, 0, 118, 121, 1, 0, 0, 0, 119, 117, 1, 0, 0, 0, 119, 120, 1, 0, 0, 0, 120, 122, 1, 0, 0, 0, 121, 119, 1, 0, 0, 0, 122, 123, 5, 0, 0, 1, 123, 17, 1, 0, 0, 0, 124, 125, 5, 22, 0, 0, 125, 126, 3, 4, 2, 0, 126, 127, 5, 28, 0, 0, 127, 128, 5, 23, 0, 0, 128, 19, 1, 0, 0, 0, 129, 132, 3, 4, 2, 0, 130, 132, 5, 13, 0, 0, 131, 129, 1, 0, 0, 0, 131, 130, 1, 0, 0, 0, 132, 21, 1, 0, 0, 0, 133, 134, 3, 4, 2, 0, 134, 135, 5, 14, 0, 0, 135, 136, 5, 15, 0, 0, 136, 137, 5, 16, 0, 0, 137, 177, 1, 0, 0, 0, 138, 139, 3, 4, 2, 0, 139, 140, 5, 14, 0, 0, 140, 141, 5, 16, 0, 0, 141, 142, 5, 11, 0, 0, 142, 143, 5, 12, 0, 0, 143, 144, 3, 4, 2, 0, 144, 177, 1, 0, 0, 0, 145, 177, 3, 4, 2, 0, 146, 148, 5, 24, 0, 0, 147, 149, 3, 24, 12, 0, 148, 147, 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 148, 1, 0, 0, 0, 150, 151, 1, 0, 0, 0, 151, 152, 1, 0, 0, 0, 152, 153, 5, 25, 0, 0, 153, 177, 1, 0, 0, 0, 154, 158, 5, 24, 0, 0, 155, 157, 3, 22, 11, 0, 156, 155, 1, 0, 0, 0, 157, 160, 1, 0, 0, 0, 158, 156, 1, 0, 0, 0, 158, 159, 1, 0, 0, 0, 159, 161, 1, 0, 0, 0, 160, 158, 1, 0, 0, 0, 161, 177, 5, 25, 0, 0, 162, 163, 5, 17, 0, 0, 163, 165, 5, 24, 0, 0, 164, 166, 3, 22, 11, 0, 165, 164, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 165, 1, 0, 0, 0, 167, 168, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 170, 5, 25, 0, 0, 170, 177, 1, 0, 0, 0, 171, 172, 5, 6, 0, 0, 172, 173, 3, 4, 2, 0, 173, 174, 5, 10, 0, 0, 174, 175, 3, 22, 11, 0, 175, 177, 1, 0, 0, 0, 176, 133, 1, 0, 0, 0, 176, 138, 1, 0, 0, 0, 176, 145, 1, 0, 0, 0, 176, 146, 1, 0, 0, 0, 176, 154, 1, 0, 0, 0, 176, 162, 1, 0, 0, 0, 176, 171, 1, 0, 0, 0, 177, 23, 1, 0, 0, 0, 178, 179, 3, 20, 10, 0, 179, 180, 5, 10, 0, 0, 180, 181, 3, 22, 11, 0, 181, 25, 1, 0, 0, 0, 182, 183, 5, 12, 0, 0, 183, 186, 3, 30, 15, 0, 184, 186, 5, 18, 0, 0, 185, 182, 1, 0, 0, 0, 185, 184, 1, 0, 0, 0, 186, 27, 1, 0, 0, 0, 187, 188, 5, 6, 0, 0, 188, 189, 3, 4, 2, 0, 189, 190, 3, 26, 13, 0, 190, 29, 1, 0, 0, 0, 191, 224, 3, 4, 2, 0, 192, 194, 5, 24, 0, 0, 193, 195, 3, 32, 16, 0, 194, 193, 1, 0, 0, 0, 195, 196, 1, 0, 0, 0, 196, 194, 1, 0, 0, 0, 196, 197, 1, 0, 0, 0, 197, 198, 1, 0, 0, 0, 198, 199, 5, 25, 0, 0, 199, 224, 1, 0, 0, 0, 200, 204, 5, 24, 0, 0, 201, 203, 3, 28, 14, 0, 202, 201, 1, 0, 0, 0, 203, 206, 1, 0, 0, 0, 204, 202, 1, 0, 0, 0, 204, 205, 1, 0, 0, 0, 205, 207, 1, 0, 0, 0, 206, 204, 1, 0, 0, 0, 207, 208, 5, 13, 0, 0, 208, 209, 3, 26, 13, 0, 209, 210, 5, 25, 0, 0, 210, 224, 1, 0, 0, 0, 211, 212, 5, 17, 0, 0, 212, 216, 5, 24, 0, 0, 213, 215, 3, 28, 14, 0, 214, 213, 1, 0, 0, 0, 215, 218, 1, 0, 0, 0, 216, 214, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 219, 1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 219, 220, 5, 13, 0, 0, 220, 221, 3, 26, 13, 0, 221, 222, 5, 25, 0, 0, 222, 224, 1, 0, 0, 0, 223, 191, 1, 0, 0, 0, 223, 192, 1, 0, 0, 0, 223, 200, 1, 0, 0, 0, 223, 211, 1, 0, 0, 0, 224, 31, 1, 0, 0, 0, 225, 226, 3, 20, 10, 0, 226, 227, 3, 26, 13, 0, 227, 33, 1, 0, 0, 0, 228, 231, 3, 4, 2, 0, 229, 231, 3, 18, 9, 0, 230, 228, 1, 0, 0, 0, 230, 229, 1, 0, 0, 0, 231, 35, 1, 0, 0, 0, 232, 233, 5, 9, 0, 0, 233, 234, 3, 34, 17, 0, 234, 235, 5, 20, 0, 0, 235, 236, 5, 7, 0, 0, 236, 237, 5, 27, 0, 0, 237, 238, 3, 22, 11, 0, 238, 239, 5, 8, 0, 0, 239, 240, 5, 27, 0, 0, 240, 241, 3, 30, 15, 0, 241, 242, 5, 21, 0, 0, 242, 250, 1, 0, 0, 0, 243, 244, 5, 19, 0, 0, 244, 245, 3, 34, 17, 0, 245, 246, 5, 10, 0, 0, 246, 247, 3, 4, 2, 0, 247, 250, 1, 0, 0, 0, 248, 250, 3, 8, 4, 0, 249, 232, 1, 0, 0, 0, 249, 243, 1, 0, 0, 0, 249, 248, 1, 0, 0, 0, 250, 37, 1, 0, 0, 0, 23, 45, 57, 67, 75, 77, 85, 91, 101, 108, 114, 119, 131, 150, 158, 167, 176, 185, 196, 204, 216, 223, 230, 249] \ No newline at end of file diff --git a/internal/parser/antlrParser/Numscript.tokens b/internal/parser/antlrParser/Numscript.tokens new file mode 100644 index 00000000..88700404 --- /dev/null +++ b/internal/parser/antlrParser/Numscript.tokens @@ -0,0 +1,70 @@ +WS=1 +NEWLINE=2 +MULTILINE_COMMENT=3 +LINE_COMMENT=4 +VARS=5 +MAX=6 +SOURCE=7 +DESTINATION=8 +SEND=9 +FROM=10 +UP=11 +TO=12 +REMAINING=13 +ALLOWING=14 +UNBOUNDED=15 +OVERDRAFT=16 +ONEOF=17 +KEPT=18 +SAVE=19 +LPARENS=20 +RPARENS=21 +LBRACKET=22 +RBRACKET=23 +LBRACE=24 +RBRACE=25 +COMMA=26 +EQ=27 +STAR=28 +PLUS=29 +MINUS=30 +DIV=31 +PERCENTAGE_PORTION_LITERAL=32 +STRING=33 +IDENTIFIER=34 +NUMBER=35 +ASSET=36 +ACCOUNT_START=37 +COLON=38 +ACCOUNT_TEXT=39 +VARIABLE_NAME_ACC=40 +VARIABLE_NAME=41 +'vars'=5 +'max'=6 +'source'=7 +'destination'=8 +'send'=9 +'from'=10 +'up'=11 +'to'=12 +'remaining'=13 +'allowing'=14 +'unbounded'=15 +'overdraft'=16 +'oneof'=17 +'kept'=18 +'save'=19 +'('=20 +')'=21 +'['=22 +']'=23 +'{'=24 +'}'=25 +','=26 +'='=27 +'*'=28 +'+'=29 +'-'=30 +'/'=31 +'@'=37 +':'=38 diff --git a/internal/parser/antlrParser/lexer.go b/internal/parser/antlrParser/lexer.go new file mode 100644 index 00000000..11013bcd --- /dev/null +++ b/internal/parser/antlrParser/lexer.go @@ -0,0 +1,315 @@ +// Code generated from Lexer.g4 by ANTLR 4.13.1. DO NOT EDIT. + +package antlrParser + +import ( + "fmt" + "github.com/antlr4-go/antlr/v4" + "sync" + "unicode" +) + +// Suppress unused import error +var _ = fmt.Printf +var _ = sync.Once{} +var _ = unicode.IsLetter + +type Lexer struct { + *antlr.BaseLexer + channelNames []string + modeNames []string + // TODO: EOF string +} + +var LexerLexerStaticData struct { + once sync.Once + serializedATN []int32 + ChannelNames []string + ModeNames []string + LiteralNames []string + SymbolicNames []string + RuleNames []string + PredictionContextCache *antlr.PredictionContextCache + atn *antlr.ATN + decisionToDFA []*antlr.DFA +} + +func lexerLexerInit() { + staticData := &LexerLexerStaticData + staticData.ChannelNames = []string{ + "DEFAULT_TOKEN_CHANNEL", "HIDDEN", + } + staticData.ModeNames = []string{ + "DEFAULT_MODE", "ACCOUNT_MODE", + } + staticData.LiteralNames = []string{ + "", "", "", "", "", "'vars'", "'max'", "'source'", "'destination'", + "'send'", "'from'", "'up'", "'to'", "'remaining'", "'allowing'", "'unbounded'", + "'overdraft'", "'oneof'", "'kept'", "'save'", "'('", "')'", "'['", "']'", + "'{'", "'}'", "','", "'='", "'*'", "'+'", "'-'", "'/'", "", "", "", + "", "", "'@'", "':'", + } + staticData.SymbolicNames = []string{ + "", "WS", "NEWLINE", "MULTILINE_COMMENT", "LINE_COMMENT", "VARS", "MAX", + "SOURCE", "DESTINATION", "SEND", "FROM", "UP", "TO", "REMAINING", "ALLOWING", + "UNBOUNDED", "OVERDRAFT", "ONEOF", "KEPT", "SAVE", "LPARENS", "RPARENS", + "LBRACKET", "RBRACKET", "LBRACE", "RBRACE", "COMMA", "EQ", "STAR", "PLUS", + "MINUS", "DIV", "PERCENTAGE_PORTION_LITERAL", "STRING", "IDENTIFIER", + "NUMBER", "ASSET", "ACCOUNT_START", "COLON", "ACCOUNT_TEXT", "VARIABLE_NAME_ACC", + "VARIABLE_NAME", + } + staticData.RuleNames = []string{ + "WS", "NEWLINE", "MULTILINE_COMMENT", "LINE_COMMENT", "VARS", "MAX", + "SOURCE", "DESTINATION", "SEND", "FROM", "UP", "TO", "REMAINING", "ALLOWING", + "UNBOUNDED", "OVERDRAFT", "ONEOF", "KEPT", "SAVE", "LPARENS", "RPARENS", + "LBRACKET", "RBRACKET", "LBRACE", "RBRACE", "COMMA", "EQ", "STAR", "PLUS", + "MINUS", "DIV", "PERCENTAGE_PORTION_LITERAL", "STRING", "IDENTIFIER", + "NUMBER", "ASSET", "ACCOUNT_START", "COLON", "VARIABLE_NAME_FRAGMENT", + "ACCOUNT_TEXT", "VARIABLE_NAME_ACC", "VARIABLE_NAME", + } + staticData.PredictionContextCache = antlr.NewPredictionContextCache() + staticData.serializedATN = []int32{ + 4, 0, 41, 353, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, + 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, + 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, + 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, + 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, + 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, + 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, + 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, + 2, 41, 7, 41, 1, 0, 4, 0, 88, 8, 0, 11, 0, 12, 0, 89, 1, 0, 1, 0, 1, 1, + 4, 1, 95, 8, 1, 11, 1, 12, 1, 96, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 104, + 8, 2, 10, 2, 12, 2, 107, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, + 1, 3, 1, 3, 5, 3, 118, 8, 3, 10, 3, 12, 3, 121, 9, 3, 1, 3, 1, 3, 1, 3, + 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, + 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, + 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, + 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, + 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, + 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, + 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, + 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, + 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, + 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 1, 23, + 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, + 29, 1, 29, 1, 30, 1, 30, 1, 31, 4, 31, 251, 8, 31, 11, 31, 12, 31, 252, + 1, 31, 1, 31, 4, 31, 257, 8, 31, 11, 31, 12, 31, 258, 3, 31, 261, 8, 31, + 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 5, 32, 269, 8, 32, 10, 32, 12, + 32, 272, 9, 32, 1, 32, 1, 32, 1, 33, 4, 33, 277, 8, 33, 11, 33, 12, 33, + 278, 1, 33, 5, 33, 282, 8, 33, 10, 33, 12, 33, 285, 9, 33, 1, 34, 3, 34, + 288, 8, 34, 1, 34, 4, 34, 291, 8, 34, 11, 34, 12, 34, 292, 1, 34, 1, 34, + 4, 34, 297, 8, 34, 11, 34, 12, 34, 298, 5, 34, 301, 8, 34, 10, 34, 12, + 34, 304, 9, 34, 1, 35, 1, 35, 5, 35, 308, 8, 35, 10, 35, 12, 35, 311, 9, + 35, 1, 35, 1, 35, 4, 35, 315, 8, 35, 11, 35, 12, 35, 316, 3, 35, 319, 8, + 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, + 4, 38, 331, 8, 38, 11, 38, 12, 38, 332, 1, 38, 5, 38, 336, 8, 38, 10, 38, + 12, 38, 339, 9, 38, 1, 39, 4, 39, 342, 8, 39, 11, 39, 12, 39, 343, 1, 39, + 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 2, 105, 119, 0, 42, 2, + 1, 4, 2, 6, 3, 8, 4, 10, 5, 12, 6, 14, 7, 16, 8, 18, 9, 20, 10, 22, 11, + 24, 12, 26, 13, 28, 14, 30, 15, 32, 16, 34, 17, 36, 18, 38, 19, 40, 20, + 42, 21, 44, 22, 46, 23, 48, 24, 50, 25, 52, 26, 54, 27, 56, 28, 58, 29, + 60, 30, 62, 31, 64, 32, 66, 33, 68, 34, 70, 35, 72, 36, 74, 37, 76, 38, + 78, 0, 80, 39, 82, 40, 84, 41, 2, 0, 1, 10, 3, 0, 9, 10, 13, 13, 32, 32, + 2, 0, 10, 10, 13, 13, 1, 0, 48, 57, 3, 0, 10, 10, 13, 13, 34, 34, 1, 0, + 97, 122, 2, 0, 95, 95, 97, 122, 1, 0, 65, 90, 2, 0, 48, 57, 65, 90, 3, + 0, 48, 57, 95, 95, 97, 122, 5, 0, 45, 45, 48, 57, 65, 90, 95, 95, 97, 122, + 372, 0, 2, 1, 0, 0, 0, 0, 4, 1, 0, 0, 0, 0, 6, 1, 0, 0, 0, 0, 8, 1, 0, + 0, 0, 0, 10, 1, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 14, 1, 0, 0, 0, 0, 16, 1, + 0, 0, 0, 0, 18, 1, 0, 0, 0, 0, 20, 1, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 24, + 1, 0, 0, 0, 0, 26, 1, 0, 0, 0, 0, 28, 1, 0, 0, 0, 0, 30, 1, 0, 0, 0, 0, + 32, 1, 0, 0, 0, 0, 34, 1, 0, 0, 0, 0, 36, 1, 0, 0, 0, 0, 38, 1, 0, 0, 0, + 0, 40, 1, 0, 0, 0, 0, 42, 1, 0, 0, 0, 0, 44, 1, 0, 0, 0, 0, 46, 1, 0, 0, + 0, 0, 48, 1, 0, 0, 0, 0, 50, 1, 0, 0, 0, 0, 52, 1, 0, 0, 0, 0, 54, 1, 0, + 0, 0, 0, 56, 1, 0, 0, 0, 0, 58, 1, 0, 0, 0, 0, 60, 1, 0, 0, 0, 0, 62, 1, + 0, 0, 0, 0, 64, 1, 0, 0, 0, 0, 66, 1, 0, 0, 0, 0, 68, 1, 0, 0, 0, 0, 70, + 1, 0, 0, 0, 0, 72, 1, 0, 0, 0, 0, 74, 1, 0, 0, 0, 0, 76, 1, 0, 0, 0, 0, + 84, 1, 0, 0, 0, 1, 80, 1, 0, 0, 0, 1, 82, 1, 0, 0, 0, 2, 87, 1, 0, 0, 0, + 4, 94, 1, 0, 0, 0, 6, 98, 1, 0, 0, 0, 8, 113, 1, 0, 0, 0, 10, 126, 1, 0, + 0, 0, 12, 131, 1, 0, 0, 0, 14, 135, 1, 0, 0, 0, 16, 142, 1, 0, 0, 0, 18, + 154, 1, 0, 0, 0, 20, 159, 1, 0, 0, 0, 22, 164, 1, 0, 0, 0, 24, 167, 1, + 0, 0, 0, 26, 170, 1, 0, 0, 0, 28, 180, 1, 0, 0, 0, 30, 189, 1, 0, 0, 0, + 32, 199, 1, 0, 0, 0, 34, 209, 1, 0, 0, 0, 36, 215, 1, 0, 0, 0, 38, 220, + 1, 0, 0, 0, 40, 225, 1, 0, 0, 0, 42, 227, 1, 0, 0, 0, 44, 229, 1, 0, 0, + 0, 46, 231, 1, 0, 0, 0, 48, 233, 1, 0, 0, 0, 50, 235, 1, 0, 0, 0, 52, 237, + 1, 0, 0, 0, 54, 239, 1, 0, 0, 0, 56, 241, 1, 0, 0, 0, 58, 243, 1, 0, 0, + 0, 60, 245, 1, 0, 0, 0, 62, 247, 1, 0, 0, 0, 64, 250, 1, 0, 0, 0, 66, 264, + 1, 0, 0, 0, 68, 276, 1, 0, 0, 0, 70, 287, 1, 0, 0, 0, 72, 305, 1, 0, 0, + 0, 74, 320, 1, 0, 0, 0, 76, 324, 1, 0, 0, 0, 78, 328, 1, 0, 0, 0, 80, 341, + 1, 0, 0, 0, 82, 347, 1, 0, 0, 0, 84, 351, 1, 0, 0, 0, 86, 88, 7, 0, 0, + 0, 87, 86, 1, 0, 0, 0, 88, 89, 1, 0, 0, 0, 89, 87, 1, 0, 0, 0, 89, 90, + 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 92, 6, 0, 0, 0, 92, 3, 1, 0, 0, 0, + 93, 95, 7, 1, 0, 0, 94, 93, 1, 0, 0, 0, 95, 96, 1, 0, 0, 0, 96, 94, 1, + 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 5, 1, 0, 0, 0, 98, 99, 5, 47, 0, 0, 99, + 100, 5, 42, 0, 0, 100, 105, 1, 0, 0, 0, 101, 104, 3, 6, 2, 0, 102, 104, + 9, 0, 0, 0, 103, 101, 1, 0, 0, 0, 103, 102, 1, 0, 0, 0, 104, 107, 1, 0, + 0, 0, 105, 106, 1, 0, 0, 0, 105, 103, 1, 0, 0, 0, 106, 108, 1, 0, 0, 0, + 107, 105, 1, 0, 0, 0, 108, 109, 5, 42, 0, 0, 109, 110, 5, 47, 0, 0, 110, + 111, 1, 0, 0, 0, 111, 112, 6, 2, 0, 0, 112, 7, 1, 0, 0, 0, 113, 114, 5, + 47, 0, 0, 114, 115, 5, 47, 0, 0, 115, 119, 1, 0, 0, 0, 116, 118, 9, 0, + 0, 0, 117, 116, 1, 0, 0, 0, 118, 121, 1, 0, 0, 0, 119, 120, 1, 0, 0, 0, + 119, 117, 1, 0, 0, 0, 120, 122, 1, 0, 0, 0, 121, 119, 1, 0, 0, 0, 122, + 123, 3, 4, 1, 0, 123, 124, 1, 0, 0, 0, 124, 125, 6, 3, 0, 0, 125, 9, 1, + 0, 0, 0, 126, 127, 5, 118, 0, 0, 127, 128, 5, 97, 0, 0, 128, 129, 5, 114, + 0, 0, 129, 130, 5, 115, 0, 0, 130, 11, 1, 0, 0, 0, 131, 132, 5, 109, 0, + 0, 132, 133, 5, 97, 0, 0, 133, 134, 5, 120, 0, 0, 134, 13, 1, 0, 0, 0, + 135, 136, 5, 115, 0, 0, 136, 137, 5, 111, 0, 0, 137, 138, 5, 117, 0, 0, + 138, 139, 5, 114, 0, 0, 139, 140, 5, 99, 0, 0, 140, 141, 5, 101, 0, 0, + 141, 15, 1, 0, 0, 0, 142, 143, 5, 100, 0, 0, 143, 144, 5, 101, 0, 0, 144, + 145, 5, 115, 0, 0, 145, 146, 5, 116, 0, 0, 146, 147, 5, 105, 0, 0, 147, + 148, 5, 110, 0, 0, 148, 149, 5, 97, 0, 0, 149, 150, 5, 116, 0, 0, 150, + 151, 5, 105, 0, 0, 151, 152, 5, 111, 0, 0, 152, 153, 5, 110, 0, 0, 153, + 17, 1, 0, 0, 0, 154, 155, 5, 115, 0, 0, 155, 156, 5, 101, 0, 0, 156, 157, + 5, 110, 0, 0, 157, 158, 5, 100, 0, 0, 158, 19, 1, 0, 0, 0, 159, 160, 5, + 102, 0, 0, 160, 161, 5, 114, 0, 0, 161, 162, 5, 111, 0, 0, 162, 163, 5, + 109, 0, 0, 163, 21, 1, 0, 0, 0, 164, 165, 5, 117, 0, 0, 165, 166, 5, 112, + 0, 0, 166, 23, 1, 0, 0, 0, 167, 168, 5, 116, 0, 0, 168, 169, 5, 111, 0, + 0, 169, 25, 1, 0, 0, 0, 170, 171, 5, 114, 0, 0, 171, 172, 5, 101, 0, 0, + 172, 173, 5, 109, 0, 0, 173, 174, 5, 97, 0, 0, 174, 175, 5, 105, 0, 0, + 175, 176, 5, 110, 0, 0, 176, 177, 5, 105, 0, 0, 177, 178, 5, 110, 0, 0, + 178, 179, 5, 103, 0, 0, 179, 27, 1, 0, 0, 0, 180, 181, 5, 97, 0, 0, 181, + 182, 5, 108, 0, 0, 182, 183, 5, 108, 0, 0, 183, 184, 5, 111, 0, 0, 184, + 185, 5, 119, 0, 0, 185, 186, 5, 105, 0, 0, 186, 187, 5, 110, 0, 0, 187, + 188, 5, 103, 0, 0, 188, 29, 1, 0, 0, 0, 189, 190, 5, 117, 0, 0, 190, 191, + 5, 110, 0, 0, 191, 192, 5, 98, 0, 0, 192, 193, 5, 111, 0, 0, 193, 194, + 5, 117, 0, 0, 194, 195, 5, 110, 0, 0, 195, 196, 5, 100, 0, 0, 196, 197, + 5, 101, 0, 0, 197, 198, 5, 100, 0, 0, 198, 31, 1, 0, 0, 0, 199, 200, 5, + 111, 0, 0, 200, 201, 5, 118, 0, 0, 201, 202, 5, 101, 0, 0, 202, 203, 5, + 114, 0, 0, 203, 204, 5, 100, 0, 0, 204, 205, 5, 114, 0, 0, 205, 206, 5, + 97, 0, 0, 206, 207, 5, 102, 0, 0, 207, 208, 5, 116, 0, 0, 208, 33, 1, 0, + 0, 0, 209, 210, 5, 111, 0, 0, 210, 211, 5, 110, 0, 0, 211, 212, 5, 101, + 0, 0, 212, 213, 5, 111, 0, 0, 213, 214, 5, 102, 0, 0, 214, 35, 1, 0, 0, + 0, 215, 216, 5, 107, 0, 0, 216, 217, 5, 101, 0, 0, 217, 218, 5, 112, 0, + 0, 218, 219, 5, 116, 0, 0, 219, 37, 1, 0, 0, 0, 220, 221, 5, 115, 0, 0, + 221, 222, 5, 97, 0, 0, 222, 223, 5, 118, 0, 0, 223, 224, 5, 101, 0, 0, + 224, 39, 1, 0, 0, 0, 225, 226, 5, 40, 0, 0, 226, 41, 1, 0, 0, 0, 227, 228, + 5, 41, 0, 0, 228, 43, 1, 0, 0, 0, 229, 230, 5, 91, 0, 0, 230, 45, 1, 0, + 0, 0, 231, 232, 5, 93, 0, 0, 232, 47, 1, 0, 0, 0, 233, 234, 5, 123, 0, + 0, 234, 49, 1, 0, 0, 0, 235, 236, 5, 125, 0, 0, 236, 51, 1, 0, 0, 0, 237, + 238, 5, 44, 0, 0, 238, 53, 1, 0, 0, 0, 239, 240, 5, 61, 0, 0, 240, 55, + 1, 0, 0, 0, 241, 242, 5, 42, 0, 0, 242, 57, 1, 0, 0, 0, 243, 244, 5, 43, + 0, 0, 244, 59, 1, 0, 0, 0, 245, 246, 5, 45, 0, 0, 246, 61, 1, 0, 0, 0, + 247, 248, 5, 47, 0, 0, 248, 63, 1, 0, 0, 0, 249, 251, 7, 2, 0, 0, 250, + 249, 1, 0, 0, 0, 251, 252, 1, 0, 0, 0, 252, 250, 1, 0, 0, 0, 252, 253, + 1, 0, 0, 0, 253, 260, 1, 0, 0, 0, 254, 256, 5, 46, 0, 0, 255, 257, 7, 2, + 0, 0, 256, 255, 1, 0, 0, 0, 257, 258, 1, 0, 0, 0, 258, 256, 1, 0, 0, 0, + 258, 259, 1, 0, 0, 0, 259, 261, 1, 0, 0, 0, 260, 254, 1, 0, 0, 0, 260, + 261, 1, 0, 0, 0, 261, 262, 1, 0, 0, 0, 262, 263, 5, 37, 0, 0, 263, 65, + 1, 0, 0, 0, 264, 270, 5, 34, 0, 0, 265, 266, 5, 92, 0, 0, 266, 269, 5, + 34, 0, 0, 267, 269, 8, 3, 0, 0, 268, 265, 1, 0, 0, 0, 268, 267, 1, 0, 0, + 0, 269, 272, 1, 0, 0, 0, 270, 268, 1, 0, 0, 0, 270, 271, 1, 0, 0, 0, 271, + 273, 1, 0, 0, 0, 272, 270, 1, 0, 0, 0, 273, 274, 5, 34, 0, 0, 274, 67, + 1, 0, 0, 0, 275, 277, 7, 4, 0, 0, 276, 275, 1, 0, 0, 0, 277, 278, 1, 0, + 0, 0, 278, 276, 1, 0, 0, 0, 278, 279, 1, 0, 0, 0, 279, 283, 1, 0, 0, 0, + 280, 282, 7, 5, 0, 0, 281, 280, 1, 0, 0, 0, 282, 285, 1, 0, 0, 0, 283, + 281, 1, 0, 0, 0, 283, 284, 1, 0, 0, 0, 284, 69, 1, 0, 0, 0, 285, 283, 1, + 0, 0, 0, 286, 288, 3, 60, 29, 0, 287, 286, 1, 0, 0, 0, 287, 288, 1, 0, + 0, 0, 288, 290, 1, 0, 0, 0, 289, 291, 7, 2, 0, 0, 290, 289, 1, 0, 0, 0, + 291, 292, 1, 0, 0, 0, 292, 290, 1, 0, 0, 0, 292, 293, 1, 0, 0, 0, 293, + 302, 1, 0, 0, 0, 294, 296, 5, 95, 0, 0, 295, 297, 7, 2, 0, 0, 296, 295, + 1, 0, 0, 0, 297, 298, 1, 0, 0, 0, 298, 296, 1, 0, 0, 0, 298, 299, 1, 0, + 0, 0, 299, 301, 1, 0, 0, 0, 300, 294, 1, 0, 0, 0, 301, 304, 1, 0, 0, 0, + 302, 300, 1, 0, 0, 0, 302, 303, 1, 0, 0, 0, 303, 71, 1, 0, 0, 0, 304, 302, + 1, 0, 0, 0, 305, 309, 7, 6, 0, 0, 306, 308, 7, 7, 0, 0, 307, 306, 1, 0, + 0, 0, 308, 311, 1, 0, 0, 0, 309, 307, 1, 0, 0, 0, 309, 310, 1, 0, 0, 0, + 310, 318, 1, 0, 0, 0, 311, 309, 1, 0, 0, 0, 312, 314, 5, 47, 0, 0, 313, + 315, 7, 2, 0, 0, 314, 313, 1, 0, 0, 0, 315, 316, 1, 0, 0, 0, 316, 314, + 1, 0, 0, 0, 316, 317, 1, 0, 0, 0, 317, 319, 1, 0, 0, 0, 318, 312, 1, 0, + 0, 0, 318, 319, 1, 0, 0, 0, 319, 73, 1, 0, 0, 0, 320, 321, 5, 64, 0, 0, + 321, 322, 1, 0, 0, 0, 322, 323, 6, 36, 1, 0, 323, 75, 1, 0, 0, 0, 324, + 325, 5, 58, 0, 0, 325, 326, 1, 0, 0, 0, 326, 327, 6, 37, 1, 0, 327, 77, + 1, 0, 0, 0, 328, 330, 5, 36, 0, 0, 329, 331, 7, 5, 0, 0, 330, 329, 1, 0, + 0, 0, 331, 332, 1, 0, 0, 0, 332, 330, 1, 0, 0, 0, 332, 333, 1, 0, 0, 0, + 333, 337, 1, 0, 0, 0, 334, 336, 7, 8, 0, 0, 335, 334, 1, 0, 0, 0, 336, + 339, 1, 0, 0, 0, 337, 335, 1, 0, 0, 0, 337, 338, 1, 0, 0, 0, 338, 79, 1, + 0, 0, 0, 339, 337, 1, 0, 0, 0, 340, 342, 7, 9, 0, 0, 341, 340, 1, 0, 0, + 0, 342, 343, 1, 0, 0, 0, 343, 341, 1, 0, 0, 0, 343, 344, 1, 0, 0, 0, 344, + 345, 1, 0, 0, 0, 345, 346, 6, 39, 2, 0, 346, 81, 1, 0, 0, 0, 347, 348, + 3, 78, 38, 0, 348, 349, 1, 0, 0, 0, 349, 350, 6, 40, 2, 0, 350, 83, 1, + 0, 0, 0, 351, 352, 3, 78, 38, 0, 352, 85, 1, 0, 0, 0, 24, 0, 1, 89, 96, + 103, 105, 119, 252, 258, 260, 268, 270, 278, 283, 287, 292, 298, 302, 309, + 316, 318, 332, 337, 343, 3, 6, 0, 0, 5, 1, 0, 4, 0, 0, + } + deserializer := antlr.NewATNDeserializer(nil) + staticData.atn = deserializer.Deserialize(staticData.serializedATN) + atn := staticData.atn + staticData.decisionToDFA = make([]*antlr.DFA, len(atn.DecisionToState)) + decisionToDFA := staticData.decisionToDFA + for index, state := range atn.DecisionToState { + decisionToDFA[index] = antlr.NewDFA(state, index) + } +} + +// LexerInit initializes any static state used to implement Lexer. By default the +// static state used to implement the lexer is lazily initialized during the first call to +// NewLexer(). You can call this function if you wish to initialize the static state ahead +// of time. +func LexerInit() { + staticData := &LexerLexerStaticData + staticData.once.Do(lexerLexerInit) +} + +// NewLexer produces a new lexer instance for the optional input antlr.CharStream. +func NewLexer(input antlr.CharStream) *Lexer { + LexerInit() + l := new(Lexer) + l.BaseLexer = antlr.NewBaseLexer(input) + staticData := &LexerLexerStaticData + l.Interpreter = antlr.NewLexerATNSimulator(l, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache) + l.channelNames = staticData.ChannelNames + l.modeNames = staticData.ModeNames + l.RuleNames = staticData.RuleNames + l.LiteralNames = staticData.LiteralNames + l.SymbolicNames = staticData.SymbolicNames + l.GrammarFileName = "Lexer.g4" + // TODO: l.EOF = antlr.TokenEOF + + return l +} + +// Lexer tokens. +const ( + LexerWS = 1 + LexerNEWLINE = 2 + LexerMULTILINE_COMMENT = 3 + LexerLINE_COMMENT = 4 + LexerVARS = 5 + LexerMAX = 6 + LexerSOURCE = 7 + LexerDESTINATION = 8 + LexerSEND = 9 + LexerFROM = 10 + LexerUP = 11 + LexerTO = 12 + LexerREMAINING = 13 + LexerALLOWING = 14 + LexerUNBOUNDED = 15 + LexerOVERDRAFT = 16 + LexerONEOF = 17 + LexerKEPT = 18 + LexerSAVE = 19 + LexerLPARENS = 20 + LexerRPARENS = 21 + LexerLBRACKET = 22 + LexerRBRACKET = 23 + LexerLBRACE = 24 + LexerRBRACE = 25 + LexerCOMMA = 26 + LexerEQ = 27 + LexerSTAR = 28 + LexerPLUS = 29 + LexerMINUS = 30 + LexerDIV = 31 + LexerPERCENTAGE_PORTION_LITERAL = 32 + LexerSTRING = 33 + LexerIDENTIFIER = 34 + LexerNUMBER = 35 + LexerASSET = 36 + LexerACCOUNT_START = 37 + LexerCOLON = 38 + LexerACCOUNT_TEXT = 39 + LexerVARIABLE_NAME_ACC = 40 + LexerVARIABLE_NAME = 41 +) + +// LexerACCOUNT_MODE is the Lexer mode. +const LexerACCOUNT_MODE = 1 diff --git a/internal/parser/antlr/numscript_base_listener.go b/internal/parser/antlrParser/numscript_base_listener.go similarity index 95% rename from internal/parser/antlr/numscript_base_listener.go rename to internal/parser/antlrParser/numscript_base_listener.go index f5d9c0ac..7788f4a3 100644 --- a/internal/parser/antlr/numscript_base_listener.go +++ b/internal/parser/antlrParser/numscript_base_listener.go @@ -1,7 +1,6 @@ // Code generated from Numscript.g4 by ANTLR 4.13.1. DO NOT EDIT. -package parser // Numscript - +package antlrParser // Numscript import "github.com/antlr4-go/antlr/v4" // BaseNumscriptListener is a complete listener for a parse tree produced by NumscriptParser. @@ -27,6 +26,18 @@ func (s *BaseNumscriptListener) EnterMonetaryLit(ctx *MonetaryLitContext) {} // ExitMonetaryLit is called when production monetaryLit is exited. func (s *BaseNumscriptListener) ExitMonetaryLit(ctx *MonetaryLitContext) {} +// EnterAccountTextPart is called when production accountTextPart is entered. +func (s *BaseNumscriptListener) EnterAccountTextPart(ctx *AccountTextPartContext) {} + +// ExitAccountTextPart is called when production accountTextPart is exited. +func (s *BaseNumscriptListener) ExitAccountTextPart(ctx *AccountTextPartContext) {} + +// EnterAccountVarPart is called when production accountVarPart is entered. +func (s *BaseNumscriptListener) EnterAccountVarPart(ctx *AccountVarPartContext) {} + +// ExitAccountVarPart is called when production accountVarPart is exited. +func (s *BaseNumscriptListener) ExitAccountVarPart(ctx *AccountVarPartContext) {} + // EnterVariableExpr is called when production variableExpr is entered. func (s *BaseNumscriptListener) EnterVariableExpr(ctx *VariableExprContext) {} diff --git a/internal/parser/antlr/numscript_listener.go b/internal/parser/antlrParser/numscript_listener.go similarity index 94% rename from internal/parser/antlr/numscript_listener.go rename to internal/parser/antlrParser/numscript_listener.go index d50b5425..e82b62e8 100644 --- a/internal/parser/antlr/numscript_listener.go +++ b/internal/parser/antlrParser/numscript_listener.go @@ -1,7 +1,6 @@ // Code generated from Numscript.g4 by ANTLR 4.13.1. DO NOT EDIT. -package parser // Numscript - +package antlrParser // Numscript import "github.com/antlr4-go/antlr/v4" // NumscriptListener is a complete listener for a parse tree produced by NumscriptParser. @@ -11,6 +10,12 @@ type NumscriptListener interface { // EnterMonetaryLit is called when entering the monetaryLit production. EnterMonetaryLit(c *MonetaryLitContext) + // EnterAccountTextPart is called when entering the accountTextPart production. + EnterAccountTextPart(c *AccountTextPartContext) + + // EnterAccountVarPart is called when entering the accountVarPart production. + EnterAccountVarPart(c *AccountVarPartContext) + // EnterVariableExpr is called when entering the variableExpr production. EnterVariableExpr(c *VariableExprContext) @@ -131,6 +136,12 @@ type NumscriptListener interface { // ExitMonetaryLit is called when exiting the monetaryLit production. ExitMonetaryLit(c *MonetaryLitContext) + // ExitAccountTextPart is called when exiting the accountTextPart production. + ExitAccountTextPart(c *AccountTextPartContext) + + // ExitAccountVarPart is called when exiting the accountVarPart production. + ExitAccountVarPart(c *AccountVarPartContext) + // ExitVariableExpr is called when exiting the variableExpr production. ExitVariableExpr(c *VariableExprContext) diff --git a/internal/parser/antlr/numscript_parser.go b/internal/parser/antlrParser/numscript_parser.go similarity index 83% rename from internal/parser/antlr/numscript_parser.go rename to internal/parser/antlrParser/numscript_parser.go index a89963e0..6a130991 100644 --- a/internal/parser/antlr/numscript_parser.go +++ b/internal/parser/antlrParser/numscript_parser.go @@ -1,7 +1,6 @@ // Code generated from Numscript.g4 by ANTLR 4.13.1. DO NOT EDIT. -package parser // Numscript - +package antlrParser // Numscript import ( "fmt" "strconv" @@ -33,131 +32,140 @@ var NumscriptParserStaticData struct { func numscriptParserInit() { staticData := &NumscriptParserStaticData staticData.LiteralNames = []string{ - "", "'/'", "'+'", "'oneof'", "", "", "", "", "'vars'", "'max'", "'source'", - "'destination'", "'send'", "'from'", "'up'", "'to'", "'remaining'", - "'allowing'", "'unbounded'", "'overdraft'", "'kept'", "'save'", "'('", - "')'", "'['", "']'", "'{'", "'}'", "','", "'='", "'*'", "'-'", + "", "", "", "", "", "'vars'", "'max'", "'source'", "'destination'", + "'send'", "'from'", "'up'", "'to'", "'remaining'", "'allowing'", "'unbounded'", + "'overdraft'", "'oneof'", "'kept'", "'save'", "'('", "')'", "'['", "']'", + "'{'", "'}'", "','", "'='", "'*'", "'+'", "'-'", "'/'", "", "", "", + "", "", "'@'", "':'", } staticData.SymbolicNames = []string{ - "", "", "", "", "WS", "NEWLINE", "MULTILINE_COMMENT", "LINE_COMMENT", - "VARS", "MAX", "SOURCE", "DESTINATION", "SEND", "FROM", "UP", "TO", - "REMAINING", "ALLOWING", "UNBOUNDED", "OVERDRAFT", "KEPT", "SAVE", "LPARENS", - "RPARENS", "LBRACKET", "RBRACKET", "LBRACE", "RBRACE", "COMMA", "EQ", - "STAR", "MINUS", "PERCENTAGE_PORTION_LITERAL", "STRING", "IDENTIFIER", - "NUMBER", "VARIABLE_NAME", "ACCOUNT", "ASSET", + "", "WS", "NEWLINE", "MULTILINE_COMMENT", "LINE_COMMENT", "VARS", "MAX", + "SOURCE", "DESTINATION", "SEND", "FROM", "UP", "TO", "REMAINING", "ALLOWING", + "UNBOUNDED", "OVERDRAFT", "ONEOF", "KEPT", "SAVE", "LPARENS", "RPARENS", + "LBRACKET", "RBRACKET", "LBRACE", "RBRACE", "COMMA", "EQ", "STAR", "PLUS", + "MINUS", "DIV", "PERCENTAGE_PORTION_LITERAL", "STRING", "IDENTIFIER", + "NUMBER", "ASSET", "ACCOUNT_START", "COLON", "ACCOUNT_TEXT", "VARIABLE_NAME_ACC", + "VARIABLE_NAME", } staticData.RuleNames = []string{ - "monetaryLit", "valueExpr", "functionCallArgs", "functionCall", "varOrigin", - "varDeclaration", "varsDeclaration", "program", "sentAllLit", "allotment", - "source", "allotmentClauseSrc", "keptOrDestination", "destinationInOrderClause", - "destination", "allotmentClauseDest", "sentValue", "statement", + "monetaryLit", "accountLiteralPart", "valueExpr", "functionCallArgs", + "functionCall", "varOrigin", "varDeclaration", "varsDeclaration", "program", + "sentAllLit", "allotment", "source", "allotmentClauseSrc", "keptOrDestination", + "destinationInOrderClause", "destination", "allotmentClauseDest", "sentValue", + "statement", } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 1, 38, 238, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, + 4, 1, 41, 252, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, - 2, 16, 7, 16, 2, 17, 7, 17, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 54, 8, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 62, 8, 1, 10, 1, 12, 1, 65, 9, - 1, 1, 2, 1, 2, 1, 2, 5, 2, 70, 8, 2, 10, 2, 12, 2, 73, 9, 2, 1, 3, 1, 3, - 1, 3, 3, 3, 78, 8, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 3, - 5, 88, 8, 5, 1, 6, 1, 6, 1, 6, 5, 6, 93, 8, 6, 10, 6, 12, 6, 96, 9, 6, - 1, 6, 1, 6, 1, 7, 3, 7, 101, 8, 7, 1, 7, 5, 7, 104, 8, 7, 10, 7, 12, 7, - 107, 9, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 3, 9, - 118, 8, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, - 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 4, 10, 135, 8, 10, 11, 10, 12, - 10, 136, 1, 10, 1, 10, 1, 10, 1, 10, 5, 10, 143, 8, 10, 10, 10, 12, 10, - 146, 9, 10, 1, 10, 1, 10, 1, 10, 1, 10, 4, 10, 152, 8, 10, 11, 10, 12, - 10, 153, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 163, 8, - 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 3, 12, 172, 8, 12, - 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 4, 14, 181, 8, 14, 11, - 14, 12, 14, 182, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 189, 8, 14, 10, 14, - 12, 14, 192, 9, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, - 14, 201, 8, 14, 10, 14, 12, 14, 204, 9, 14, 1, 14, 1, 14, 1, 14, 1, 14, - 3, 14, 210, 8, 14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 3, 16, 217, 8, 16, - 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, - 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 236, 8, 17, 1, 17, - 0, 1, 2, 18, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, - 32, 34, 0, 2, 2, 0, 2, 2, 31, 31, 2, 0, 19, 19, 34, 34, 254, 0, 36, 1, - 0, 0, 0, 2, 53, 1, 0, 0, 0, 4, 66, 1, 0, 0, 0, 6, 74, 1, 0, 0, 0, 8, 81, - 1, 0, 0, 0, 10, 84, 1, 0, 0, 0, 12, 89, 1, 0, 0, 0, 14, 100, 1, 0, 0, 0, - 16, 110, 1, 0, 0, 0, 18, 117, 1, 0, 0, 0, 20, 162, 1, 0, 0, 0, 22, 164, - 1, 0, 0, 0, 24, 171, 1, 0, 0, 0, 26, 173, 1, 0, 0, 0, 28, 209, 1, 0, 0, - 0, 30, 211, 1, 0, 0, 0, 32, 216, 1, 0, 0, 0, 34, 235, 1, 0, 0, 0, 36, 37, - 5, 24, 0, 0, 37, 38, 3, 2, 1, 0, 38, 39, 3, 2, 1, 0, 39, 40, 5, 25, 0, - 0, 40, 1, 1, 0, 0, 0, 41, 42, 6, 1, -1, 0, 42, 54, 5, 36, 0, 0, 43, 54, - 5, 38, 0, 0, 44, 54, 5, 33, 0, 0, 45, 54, 5, 37, 0, 0, 46, 54, 5, 35, 0, - 0, 47, 54, 5, 32, 0, 0, 48, 54, 3, 0, 0, 0, 49, 50, 5, 22, 0, 0, 50, 51, - 3, 2, 1, 0, 51, 52, 5, 23, 0, 0, 52, 54, 1, 0, 0, 0, 53, 41, 1, 0, 0, 0, - 53, 43, 1, 0, 0, 0, 53, 44, 1, 0, 0, 0, 53, 45, 1, 0, 0, 0, 53, 46, 1, - 0, 0, 0, 53, 47, 1, 0, 0, 0, 53, 48, 1, 0, 0, 0, 53, 49, 1, 0, 0, 0, 54, - 63, 1, 0, 0, 0, 55, 56, 10, 3, 0, 0, 56, 57, 5, 1, 0, 0, 57, 62, 3, 2, - 1, 4, 58, 59, 10, 2, 0, 0, 59, 60, 7, 0, 0, 0, 60, 62, 3, 2, 1, 3, 61, - 55, 1, 0, 0, 0, 61, 58, 1, 0, 0, 0, 62, 65, 1, 0, 0, 0, 63, 61, 1, 0, 0, - 0, 63, 64, 1, 0, 0, 0, 64, 3, 1, 0, 0, 0, 65, 63, 1, 0, 0, 0, 66, 71, 3, - 2, 1, 0, 67, 68, 5, 28, 0, 0, 68, 70, 3, 2, 1, 0, 69, 67, 1, 0, 0, 0, 70, - 73, 1, 0, 0, 0, 71, 69, 1, 0, 0, 0, 71, 72, 1, 0, 0, 0, 72, 5, 1, 0, 0, - 0, 73, 71, 1, 0, 0, 0, 74, 75, 7, 1, 0, 0, 75, 77, 5, 22, 0, 0, 76, 78, - 3, 4, 2, 0, 77, 76, 1, 0, 0, 0, 77, 78, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, - 79, 80, 5, 23, 0, 0, 80, 7, 1, 0, 0, 0, 81, 82, 5, 29, 0, 0, 82, 83, 3, - 6, 3, 0, 83, 9, 1, 0, 0, 0, 84, 85, 5, 34, 0, 0, 85, 87, 5, 36, 0, 0, 86, - 88, 3, 8, 4, 0, 87, 86, 1, 0, 0, 0, 87, 88, 1, 0, 0, 0, 88, 11, 1, 0, 0, - 0, 89, 90, 5, 8, 0, 0, 90, 94, 5, 26, 0, 0, 91, 93, 3, 10, 5, 0, 92, 91, - 1, 0, 0, 0, 93, 96, 1, 0, 0, 0, 94, 92, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, - 95, 97, 1, 0, 0, 0, 96, 94, 1, 0, 0, 0, 97, 98, 5, 27, 0, 0, 98, 13, 1, - 0, 0, 0, 99, 101, 3, 12, 6, 0, 100, 99, 1, 0, 0, 0, 100, 101, 1, 0, 0, - 0, 101, 105, 1, 0, 0, 0, 102, 104, 3, 34, 17, 0, 103, 102, 1, 0, 0, 0, - 104, 107, 1, 0, 0, 0, 105, 103, 1, 0, 0, 0, 105, 106, 1, 0, 0, 0, 106, - 108, 1, 0, 0, 0, 107, 105, 1, 0, 0, 0, 108, 109, 5, 0, 0, 1, 109, 15, 1, - 0, 0, 0, 110, 111, 5, 24, 0, 0, 111, 112, 3, 2, 1, 0, 112, 113, 5, 30, - 0, 0, 113, 114, 5, 25, 0, 0, 114, 17, 1, 0, 0, 0, 115, 118, 3, 2, 1, 0, - 116, 118, 5, 16, 0, 0, 117, 115, 1, 0, 0, 0, 117, 116, 1, 0, 0, 0, 118, - 19, 1, 0, 0, 0, 119, 120, 3, 2, 1, 0, 120, 121, 5, 17, 0, 0, 121, 122, - 5, 18, 0, 0, 122, 123, 5, 19, 0, 0, 123, 163, 1, 0, 0, 0, 124, 125, 3, - 2, 1, 0, 125, 126, 5, 17, 0, 0, 126, 127, 5, 19, 0, 0, 127, 128, 5, 14, - 0, 0, 128, 129, 5, 15, 0, 0, 129, 130, 3, 2, 1, 0, 130, 163, 1, 0, 0, 0, - 131, 163, 3, 2, 1, 0, 132, 134, 5, 26, 0, 0, 133, 135, 3, 22, 11, 0, 134, - 133, 1, 0, 0, 0, 135, 136, 1, 0, 0, 0, 136, 134, 1, 0, 0, 0, 136, 137, - 1, 0, 0, 0, 137, 138, 1, 0, 0, 0, 138, 139, 5, 27, 0, 0, 139, 163, 1, 0, - 0, 0, 140, 144, 5, 26, 0, 0, 141, 143, 3, 20, 10, 0, 142, 141, 1, 0, 0, - 0, 143, 146, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0, 144, 145, 1, 0, 0, 0, 145, - 147, 1, 0, 0, 0, 146, 144, 1, 0, 0, 0, 147, 163, 5, 27, 0, 0, 148, 149, - 5, 3, 0, 0, 149, 151, 5, 26, 0, 0, 150, 152, 3, 20, 10, 0, 151, 150, 1, - 0, 0, 0, 152, 153, 1, 0, 0, 0, 153, 151, 1, 0, 0, 0, 153, 154, 1, 0, 0, - 0, 154, 155, 1, 0, 0, 0, 155, 156, 5, 27, 0, 0, 156, 163, 1, 0, 0, 0, 157, - 158, 5, 9, 0, 0, 158, 159, 3, 2, 1, 0, 159, 160, 5, 13, 0, 0, 160, 161, - 3, 20, 10, 0, 161, 163, 1, 0, 0, 0, 162, 119, 1, 0, 0, 0, 162, 124, 1, - 0, 0, 0, 162, 131, 1, 0, 0, 0, 162, 132, 1, 0, 0, 0, 162, 140, 1, 0, 0, - 0, 162, 148, 1, 0, 0, 0, 162, 157, 1, 0, 0, 0, 163, 21, 1, 0, 0, 0, 164, - 165, 3, 18, 9, 0, 165, 166, 5, 13, 0, 0, 166, 167, 3, 20, 10, 0, 167, 23, - 1, 0, 0, 0, 168, 169, 5, 15, 0, 0, 169, 172, 3, 28, 14, 0, 170, 172, 5, - 20, 0, 0, 171, 168, 1, 0, 0, 0, 171, 170, 1, 0, 0, 0, 172, 25, 1, 0, 0, - 0, 173, 174, 5, 9, 0, 0, 174, 175, 3, 2, 1, 0, 175, 176, 3, 24, 12, 0, - 176, 27, 1, 0, 0, 0, 177, 210, 3, 2, 1, 0, 178, 180, 5, 26, 0, 0, 179, - 181, 3, 30, 15, 0, 180, 179, 1, 0, 0, 0, 181, 182, 1, 0, 0, 0, 182, 180, - 1, 0, 0, 0, 182, 183, 1, 0, 0, 0, 183, 184, 1, 0, 0, 0, 184, 185, 5, 27, - 0, 0, 185, 210, 1, 0, 0, 0, 186, 190, 5, 26, 0, 0, 187, 189, 3, 26, 13, - 0, 188, 187, 1, 0, 0, 0, 189, 192, 1, 0, 0, 0, 190, 188, 1, 0, 0, 0, 190, - 191, 1, 0, 0, 0, 191, 193, 1, 0, 0, 0, 192, 190, 1, 0, 0, 0, 193, 194, - 5, 16, 0, 0, 194, 195, 3, 24, 12, 0, 195, 196, 5, 27, 0, 0, 196, 210, 1, - 0, 0, 0, 197, 198, 5, 3, 0, 0, 198, 202, 5, 26, 0, 0, 199, 201, 3, 26, - 13, 0, 200, 199, 1, 0, 0, 0, 201, 204, 1, 0, 0, 0, 202, 200, 1, 0, 0, 0, - 202, 203, 1, 0, 0, 0, 203, 205, 1, 0, 0, 0, 204, 202, 1, 0, 0, 0, 205, - 206, 5, 16, 0, 0, 206, 207, 3, 24, 12, 0, 207, 208, 5, 27, 0, 0, 208, 210, - 1, 0, 0, 0, 209, 177, 1, 0, 0, 0, 209, 178, 1, 0, 0, 0, 209, 186, 1, 0, - 0, 0, 209, 197, 1, 0, 0, 0, 210, 29, 1, 0, 0, 0, 211, 212, 3, 18, 9, 0, - 212, 213, 3, 24, 12, 0, 213, 31, 1, 0, 0, 0, 214, 217, 3, 2, 1, 0, 215, - 217, 3, 16, 8, 0, 216, 214, 1, 0, 0, 0, 216, 215, 1, 0, 0, 0, 217, 33, - 1, 0, 0, 0, 218, 219, 5, 12, 0, 0, 219, 220, 3, 32, 16, 0, 220, 221, 5, - 22, 0, 0, 221, 222, 5, 10, 0, 0, 222, 223, 5, 29, 0, 0, 223, 224, 3, 20, - 10, 0, 224, 225, 5, 11, 0, 0, 225, 226, 5, 29, 0, 0, 226, 227, 3, 28, 14, - 0, 227, 228, 5, 23, 0, 0, 228, 236, 1, 0, 0, 0, 229, 230, 5, 21, 0, 0, - 230, 231, 3, 32, 16, 0, 231, 232, 5, 13, 0, 0, 232, 233, 3, 2, 1, 0, 233, - 236, 1, 0, 0, 0, 234, 236, 3, 6, 3, 0, 235, 218, 1, 0, 0, 0, 235, 229, - 1, 0, 0, 0, 235, 234, 1, 0, 0, 0, 236, 35, 1, 0, 0, 0, 21, 53, 61, 63, - 71, 77, 87, 94, 100, 105, 117, 136, 144, 153, 162, 171, 182, 190, 202, - 209, 216, 235, + 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, + 1, 1, 1, 1, 3, 1, 46, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, + 2, 5, 2, 56, 8, 2, 10, 2, 12, 2, 59, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 3, 2, 68, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 76, + 8, 2, 10, 2, 12, 2, 79, 9, 2, 1, 3, 1, 3, 1, 3, 5, 3, 84, 8, 3, 10, 3, + 12, 3, 87, 9, 3, 1, 4, 1, 4, 1, 4, 3, 4, 92, 8, 4, 1, 4, 1, 4, 1, 5, 1, + 5, 1, 5, 1, 6, 1, 6, 1, 6, 3, 6, 102, 8, 6, 1, 7, 1, 7, 1, 7, 5, 7, 107, + 8, 7, 10, 7, 12, 7, 110, 9, 7, 1, 7, 1, 7, 1, 8, 3, 8, 115, 8, 8, 1, 8, + 5, 8, 118, 8, 8, 10, 8, 12, 8, 121, 9, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, + 1, 9, 1, 9, 1, 10, 1, 10, 3, 10, 132, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, + 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, + 11, 4, 11, 149, 8, 11, 11, 11, 12, 11, 150, 1, 11, 1, 11, 1, 11, 1, 11, + 5, 11, 157, 8, 11, 10, 11, 12, 11, 160, 9, 11, 1, 11, 1, 11, 1, 11, 1, + 11, 4, 11, 166, 8, 11, 11, 11, 12, 11, 167, 1, 11, 1, 11, 1, 11, 1, 11, + 1, 11, 1, 11, 1, 11, 3, 11, 177, 8, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, + 13, 1, 13, 1, 13, 3, 13, 186, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, + 1, 15, 1, 15, 4, 15, 195, 8, 15, 11, 15, 12, 15, 196, 1, 15, 1, 15, 1, + 15, 1, 15, 5, 15, 203, 8, 15, 10, 15, 12, 15, 206, 9, 15, 1, 15, 1, 15, + 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 215, 8, 15, 10, 15, 12, 15, 218, + 9, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 224, 8, 15, 1, 16, 1, 16, 1, + 16, 1, 17, 1, 17, 3, 17, 231, 8, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, + 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, + 18, 1, 18, 3, 18, 250, 8, 18, 1, 18, 0, 1, 4, 19, 0, 2, 4, 6, 8, 10, 12, + 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 0, 2, 1, 0, 29, 30, 2, + 0, 16, 16, 34, 34, 269, 0, 38, 1, 0, 0, 0, 2, 45, 1, 0, 0, 0, 4, 67, 1, + 0, 0, 0, 6, 80, 1, 0, 0, 0, 8, 88, 1, 0, 0, 0, 10, 95, 1, 0, 0, 0, 12, + 98, 1, 0, 0, 0, 14, 103, 1, 0, 0, 0, 16, 114, 1, 0, 0, 0, 18, 124, 1, 0, + 0, 0, 20, 131, 1, 0, 0, 0, 22, 176, 1, 0, 0, 0, 24, 178, 1, 0, 0, 0, 26, + 185, 1, 0, 0, 0, 28, 187, 1, 0, 0, 0, 30, 223, 1, 0, 0, 0, 32, 225, 1, + 0, 0, 0, 34, 230, 1, 0, 0, 0, 36, 249, 1, 0, 0, 0, 38, 39, 5, 22, 0, 0, + 39, 40, 3, 4, 2, 0, 40, 41, 3, 4, 2, 0, 41, 42, 5, 23, 0, 0, 42, 1, 1, + 0, 0, 0, 43, 46, 5, 39, 0, 0, 44, 46, 5, 40, 0, 0, 45, 43, 1, 0, 0, 0, + 45, 44, 1, 0, 0, 0, 46, 3, 1, 0, 0, 0, 47, 48, 6, 2, -1, 0, 48, 68, 5, + 41, 0, 0, 49, 68, 5, 36, 0, 0, 50, 68, 5, 33, 0, 0, 51, 52, 5, 37, 0, 0, + 52, 57, 3, 2, 1, 0, 53, 54, 5, 38, 0, 0, 54, 56, 3, 2, 1, 0, 55, 53, 1, + 0, 0, 0, 56, 59, 1, 0, 0, 0, 57, 55, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, + 68, 1, 0, 0, 0, 59, 57, 1, 0, 0, 0, 60, 68, 5, 35, 0, 0, 61, 68, 5, 32, + 0, 0, 62, 68, 3, 0, 0, 0, 63, 64, 5, 20, 0, 0, 64, 65, 3, 4, 2, 0, 65, + 66, 5, 21, 0, 0, 66, 68, 1, 0, 0, 0, 67, 47, 1, 0, 0, 0, 67, 49, 1, 0, + 0, 0, 67, 50, 1, 0, 0, 0, 67, 51, 1, 0, 0, 0, 67, 60, 1, 0, 0, 0, 67, 61, + 1, 0, 0, 0, 67, 62, 1, 0, 0, 0, 67, 63, 1, 0, 0, 0, 68, 77, 1, 0, 0, 0, + 69, 70, 10, 3, 0, 0, 70, 71, 5, 31, 0, 0, 71, 76, 3, 4, 2, 4, 72, 73, 10, + 2, 0, 0, 73, 74, 7, 0, 0, 0, 74, 76, 3, 4, 2, 3, 75, 69, 1, 0, 0, 0, 75, + 72, 1, 0, 0, 0, 76, 79, 1, 0, 0, 0, 77, 75, 1, 0, 0, 0, 77, 78, 1, 0, 0, + 0, 78, 5, 1, 0, 0, 0, 79, 77, 1, 0, 0, 0, 80, 85, 3, 4, 2, 0, 81, 82, 5, + 26, 0, 0, 82, 84, 3, 4, 2, 0, 83, 81, 1, 0, 0, 0, 84, 87, 1, 0, 0, 0, 85, + 83, 1, 0, 0, 0, 85, 86, 1, 0, 0, 0, 86, 7, 1, 0, 0, 0, 87, 85, 1, 0, 0, + 0, 88, 89, 7, 1, 0, 0, 89, 91, 5, 20, 0, 0, 90, 92, 3, 6, 3, 0, 91, 90, + 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 94, 5, 21, 0, 0, + 94, 9, 1, 0, 0, 0, 95, 96, 5, 27, 0, 0, 96, 97, 3, 8, 4, 0, 97, 11, 1, + 0, 0, 0, 98, 99, 5, 34, 0, 0, 99, 101, 5, 41, 0, 0, 100, 102, 3, 10, 5, + 0, 101, 100, 1, 0, 0, 0, 101, 102, 1, 0, 0, 0, 102, 13, 1, 0, 0, 0, 103, + 104, 5, 5, 0, 0, 104, 108, 5, 24, 0, 0, 105, 107, 3, 12, 6, 0, 106, 105, + 1, 0, 0, 0, 107, 110, 1, 0, 0, 0, 108, 106, 1, 0, 0, 0, 108, 109, 1, 0, + 0, 0, 109, 111, 1, 0, 0, 0, 110, 108, 1, 0, 0, 0, 111, 112, 5, 25, 0, 0, + 112, 15, 1, 0, 0, 0, 113, 115, 3, 14, 7, 0, 114, 113, 1, 0, 0, 0, 114, + 115, 1, 0, 0, 0, 115, 119, 1, 0, 0, 0, 116, 118, 3, 36, 18, 0, 117, 116, + 1, 0, 0, 0, 118, 121, 1, 0, 0, 0, 119, 117, 1, 0, 0, 0, 119, 120, 1, 0, + 0, 0, 120, 122, 1, 0, 0, 0, 121, 119, 1, 0, 0, 0, 122, 123, 5, 0, 0, 1, + 123, 17, 1, 0, 0, 0, 124, 125, 5, 22, 0, 0, 125, 126, 3, 4, 2, 0, 126, + 127, 5, 28, 0, 0, 127, 128, 5, 23, 0, 0, 128, 19, 1, 0, 0, 0, 129, 132, + 3, 4, 2, 0, 130, 132, 5, 13, 0, 0, 131, 129, 1, 0, 0, 0, 131, 130, 1, 0, + 0, 0, 132, 21, 1, 0, 0, 0, 133, 134, 3, 4, 2, 0, 134, 135, 5, 14, 0, 0, + 135, 136, 5, 15, 0, 0, 136, 137, 5, 16, 0, 0, 137, 177, 1, 0, 0, 0, 138, + 139, 3, 4, 2, 0, 139, 140, 5, 14, 0, 0, 140, 141, 5, 16, 0, 0, 141, 142, + 5, 11, 0, 0, 142, 143, 5, 12, 0, 0, 143, 144, 3, 4, 2, 0, 144, 177, 1, + 0, 0, 0, 145, 177, 3, 4, 2, 0, 146, 148, 5, 24, 0, 0, 147, 149, 3, 24, + 12, 0, 148, 147, 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 148, 1, 0, 0, 0, + 150, 151, 1, 0, 0, 0, 151, 152, 1, 0, 0, 0, 152, 153, 5, 25, 0, 0, 153, + 177, 1, 0, 0, 0, 154, 158, 5, 24, 0, 0, 155, 157, 3, 22, 11, 0, 156, 155, + 1, 0, 0, 0, 157, 160, 1, 0, 0, 0, 158, 156, 1, 0, 0, 0, 158, 159, 1, 0, + 0, 0, 159, 161, 1, 0, 0, 0, 160, 158, 1, 0, 0, 0, 161, 177, 5, 25, 0, 0, + 162, 163, 5, 17, 0, 0, 163, 165, 5, 24, 0, 0, 164, 166, 3, 22, 11, 0, 165, + 164, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 165, 1, 0, 0, 0, 167, 168, + 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 170, 5, 25, 0, 0, 170, 177, 1, 0, + 0, 0, 171, 172, 5, 6, 0, 0, 172, 173, 3, 4, 2, 0, 173, 174, 5, 10, 0, 0, + 174, 175, 3, 22, 11, 0, 175, 177, 1, 0, 0, 0, 176, 133, 1, 0, 0, 0, 176, + 138, 1, 0, 0, 0, 176, 145, 1, 0, 0, 0, 176, 146, 1, 0, 0, 0, 176, 154, + 1, 0, 0, 0, 176, 162, 1, 0, 0, 0, 176, 171, 1, 0, 0, 0, 177, 23, 1, 0, + 0, 0, 178, 179, 3, 20, 10, 0, 179, 180, 5, 10, 0, 0, 180, 181, 3, 22, 11, + 0, 181, 25, 1, 0, 0, 0, 182, 183, 5, 12, 0, 0, 183, 186, 3, 30, 15, 0, + 184, 186, 5, 18, 0, 0, 185, 182, 1, 0, 0, 0, 185, 184, 1, 0, 0, 0, 186, + 27, 1, 0, 0, 0, 187, 188, 5, 6, 0, 0, 188, 189, 3, 4, 2, 0, 189, 190, 3, + 26, 13, 0, 190, 29, 1, 0, 0, 0, 191, 224, 3, 4, 2, 0, 192, 194, 5, 24, + 0, 0, 193, 195, 3, 32, 16, 0, 194, 193, 1, 0, 0, 0, 195, 196, 1, 0, 0, + 0, 196, 194, 1, 0, 0, 0, 196, 197, 1, 0, 0, 0, 197, 198, 1, 0, 0, 0, 198, + 199, 5, 25, 0, 0, 199, 224, 1, 0, 0, 0, 200, 204, 5, 24, 0, 0, 201, 203, + 3, 28, 14, 0, 202, 201, 1, 0, 0, 0, 203, 206, 1, 0, 0, 0, 204, 202, 1, + 0, 0, 0, 204, 205, 1, 0, 0, 0, 205, 207, 1, 0, 0, 0, 206, 204, 1, 0, 0, + 0, 207, 208, 5, 13, 0, 0, 208, 209, 3, 26, 13, 0, 209, 210, 5, 25, 0, 0, + 210, 224, 1, 0, 0, 0, 211, 212, 5, 17, 0, 0, 212, 216, 5, 24, 0, 0, 213, + 215, 3, 28, 14, 0, 214, 213, 1, 0, 0, 0, 215, 218, 1, 0, 0, 0, 216, 214, + 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 219, 1, 0, 0, 0, 218, 216, 1, 0, + 0, 0, 219, 220, 5, 13, 0, 0, 220, 221, 3, 26, 13, 0, 221, 222, 5, 25, 0, + 0, 222, 224, 1, 0, 0, 0, 223, 191, 1, 0, 0, 0, 223, 192, 1, 0, 0, 0, 223, + 200, 1, 0, 0, 0, 223, 211, 1, 0, 0, 0, 224, 31, 1, 0, 0, 0, 225, 226, 3, + 20, 10, 0, 226, 227, 3, 26, 13, 0, 227, 33, 1, 0, 0, 0, 228, 231, 3, 4, + 2, 0, 229, 231, 3, 18, 9, 0, 230, 228, 1, 0, 0, 0, 230, 229, 1, 0, 0, 0, + 231, 35, 1, 0, 0, 0, 232, 233, 5, 9, 0, 0, 233, 234, 3, 34, 17, 0, 234, + 235, 5, 20, 0, 0, 235, 236, 5, 7, 0, 0, 236, 237, 5, 27, 0, 0, 237, 238, + 3, 22, 11, 0, 238, 239, 5, 8, 0, 0, 239, 240, 5, 27, 0, 0, 240, 241, 3, + 30, 15, 0, 241, 242, 5, 21, 0, 0, 242, 250, 1, 0, 0, 0, 243, 244, 5, 19, + 0, 0, 244, 245, 3, 34, 17, 0, 245, 246, 5, 10, 0, 0, 246, 247, 3, 4, 2, + 0, 247, 250, 1, 0, 0, 0, 248, 250, 3, 8, 4, 0, 249, 232, 1, 0, 0, 0, 249, + 243, 1, 0, 0, 0, 249, 248, 1, 0, 0, 0, 250, 37, 1, 0, 0, 0, 23, 45, 57, + 67, 75, 77, 85, 91, 101, 108, 114, 119, 131, 150, 158, 167, 176, 185, 196, + 204, 216, 223, 230, 249, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -196,66 +204,70 @@ func NewNumscriptParser(input antlr.TokenStream) *NumscriptParser { // NumscriptParser tokens. const ( NumscriptParserEOF = antlr.TokenEOF - NumscriptParserT__0 = 1 - NumscriptParserT__1 = 2 - NumscriptParserT__2 = 3 - NumscriptParserWS = 4 - NumscriptParserNEWLINE = 5 - NumscriptParserMULTILINE_COMMENT = 6 - NumscriptParserLINE_COMMENT = 7 - NumscriptParserVARS = 8 - NumscriptParserMAX = 9 - NumscriptParserSOURCE = 10 - NumscriptParserDESTINATION = 11 - NumscriptParserSEND = 12 - NumscriptParserFROM = 13 - NumscriptParserUP = 14 - NumscriptParserTO = 15 - NumscriptParserREMAINING = 16 - NumscriptParserALLOWING = 17 - NumscriptParserUNBOUNDED = 18 - NumscriptParserOVERDRAFT = 19 - NumscriptParserKEPT = 20 - NumscriptParserSAVE = 21 - NumscriptParserLPARENS = 22 - NumscriptParserRPARENS = 23 - NumscriptParserLBRACKET = 24 - NumscriptParserRBRACKET = 25 - NumscriptParserLBRACE = 26 - NumscriptParserRBRACE = 27 - NumscriptParserCOMMA = 28 - NumscriptParserEQ = 29 - NumscriptParserSTAR = 30 - NumscriptParserMINUS = 31 + NumscriptParserWS = 1 + NumscriptParserNEWLINE = 2 + NumscriptParserMULTILINE_COMMENT = 3 + NumscriptParserLINE_COMMENT = 4 + NumscriptParserVARS = 5 + NumscriptParserMAX = 6 + NumscriptParserSOURCE = 7 + NumscriptParserDESTINATION = 8 + NumscriptParserSEND = 9 + NumscriptParserFROM = 10 + NumscriptParserUP = 11 + NumscriptParserTO = 12 + NumscriptParserREMAINING = 13 + NumscriptParserALLOWING = 14 + NumscriptParserUNBOUNDED = 15 + NumscriptParserOVERDRAFT = 16 + NumscriptParserONEOF = 17 + NumscriptParserKEPT = 18 + NumscriptParserSAVE = 19 + NumscriptParserLPARENS = 20 + NumscriptParserRPARENS = 21 + NumscriptParserLBRACKET = 22 + NumscriptParserRBRACKET = 23 + NumscriptParserLBRACE = 24 + NumscriptParserRBRACE = 25 + NumscriptParserCOMMA = 26 + NumscriptParserEQ = 27 + NumscriptParserSTAR = 28 + NumscriptParserPLUS = 29 + NumscriptParserMINUS = 30 + NumscriptParserDIV = 31 NumscriptParserPERCENTAGE_PORTION_LITERAL = 32 NumscriptParserSTRING = 33 NumscriptParserIDENTIFIER = 34 NumscriptParserNUMBER = 35 - NumscriptParserVARIABLE_NAME = 36 - NumscriptParserACCOUNT = 37 - NumscriptParserASSET = 38 + NumscriptParserASSET = 36 + NumscriptParserACCOUNT_START = 37 + NumscriptParserCOLON = 38 + NumscriptParserACCOUNT_TEXT = 39 + NumscriptParserVARIABLE_NAME_ACC = 40 + NumscriptParserVARIABLE_NAME = 41 ) // NumscriptParser rules. const ( NumscriptParserRULE_monetaryLit = 0 - NumscriptParserRULE_valueExpr = 1 - NumscriptParserRULE_functionCallArgs = 2 - NumscriptParserRULE_functionCall = 3 - NumscriptParserRULE_varOrigin = 4 - NumscriptParserRULE_varDeclaration = 5 - NumscriptParserRULE_varsDeclaration = 6 - NumscriptParserRULE_program = 7 - NumscriptParserRULE_sentAllLit = 8 - NumscriptParserRULE_allotment = 9 - NumscriptParserRULE_source = 10 - NumscriptParserRULE_allotmentClauseSrc = 11 - NumscriptParserRULE_keptOrDestination = 12 - NumscriptParserRULE_destinationInOrderClause = 13 - NumscriptParserRULE_destination = 14 - NumscriptParserRULE_allotmentClauseDest = 15 - NumscriptParserRULE_sentValue = 16 - NumscriptParserRULE_statement = 17 + NumscriptParserRULE_accountLiteralPart = 1 + NumscriptParserRULE_valueExpr = 2 + NumscriptParserRULE_functionCallArgs = 3 + NumscriptParserRULE_functionCall = 4 + NumscriptParserRULE_varOrigin = 5 + NumscriptParserRULE_varDeclaration = 6 + NumscriptParserRULE_varsDeclaration = 7 + NumscriptParserRULE_program = 8 + NumscriptParserRULE_sentAllLit = 9 + NumscriptParserRULE_allotment = 10 + NumscriptParserRULE_source = 11 + NumscriptParserRULE_allotmentClauseSrc = 12 + NumscriptParserRULE_keptOrDestination = 13 + NumscriptParserRULE_destinationInOrderClause = 14 + NumscriptParserRULE_destination = 15 + NumscriptParserRULE_allotmentClauseDest = 16 + NumscriptParserRULE_sentValue = 17 + NumscriptParserRULE_statement = 18 ) // IMonetaryLitContext is an interface to support dynamic dispatch. @@ -403,7 +415,7 @@ func (p *NumscriptParser) MonetaryLit() (localctx IMonetaryLitContext) { p.EnterRule(localctx, 0, NumscriptParserRULE_monetaryLit) p.EnterOuterAlt(localctx, 1) { - p.SetState(36) + p.SetState(38) p.Match(NumscriptParserLBRACKET) if p.HasError() { // Recognition error - abort rule @@ -412,7 +424,7 @@ func (p *NumscriptParser) MonetaryLit() (localctx IMonetaryLitContext) { } { - p.SetState(37) + p.SetState(39) var _x = p.valueExpr(0) @@ -420,7 +432,7 @@ func (p *NumscriptParser) MonetaryLit() (localctx IMonetaryLitContext) { } { - p.SetState(38) + p.SetState(40) var _x = p.valueExpr(0) @@ -428,7 +440,7 @@ func (p *NumscriptParser) MonetaryLit() (localctx IMonetaryLitContext) { } { - p.SetState(39) + p.SetState(41) p.Match(NumscriptParserRBRACKET) if p.HasError() { // Recognition error - abort rule @@ -449,6 +461,180 @@ errorExit: goto errorExit // Trick to prevent compiler error if the label is not used } +// IAccountLiteralPartContext is an interface to support dynamic dispatch. +type IAccountLiteralPartContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + // IsAccountLiteralPartContext differentiates from other interfaces. + IsAccountLiteralPartContext() +} + +type AccountLiteralPartContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAccountLiteralPartContext() *AccountLiteralPartContext { + var p = new(AccountLiteralPartContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = NumscriptParserRULE_accountLiteralPart + return p +} + +func InitEmptyAccountLiteralPartContext(p *AccountLiteralPartContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = NumscriptParserRULE_accountLiteralPart +} + +func (*AccountLiteralPartContext) IsAccountLiteralPartContext() {} + +func NewAccountLiteralPartContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AccountLiteralPartContext { + var p = new(AccountLiteralPartContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = NumscriptParserRULE_accountLiteralPart + + return p +} + +func (s *AccountLiteralPartContext) GetParser() antlr.Parser { return s.parser } + +func (s *AccountLiteralPartContext) CopyAll(ctx *AccountLiteralPartContext) { + s.CopyFrom(&ctx.BaseParserRuleContext) +} + +func (s *AccountLiteralPartContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AccountLiteralPartContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +type AccountVarPartContext struct { + AccountLiteralPartContext +} + +func NewAccountVarPartContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *AccountVarPartContext { + var p = new(AccountVarPartContext) + + InitEmptyAccountLiteralPartContext(&p.AccountLiteralPartContext) + p.parser = parser + p.CopyAll(ctx.(*AccountLiteralPartContext)) + + return p +} + +func (s *AccountVarPartContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AccountVarPartContext) VARIABLE_NAME_ACC() antlr.TerminalNode { + return s.GetToken(NumscriptParserVARIABLE_NAME_ACC, 0) +} + +func (s *AccountVarPartContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(NumscriptListener); ok { + listenerT.EnterAccountVarPart(s) + } +} + +func (s *AccountVarPartContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(NumscriptListener); ok { + listenerT.ExitAccountVarPart(s) + } +} + +type AccountTextPartContext struct { + AccountLiteralPartContext +} + +func NewAccountTextPartContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *AccountTextPartContext { + var p = new(AccountTextPartContext) + + InitEmptyAccountLiteralPartContext(&p.AccountLiteralPartContext) + p.parser = parser + p.CopyAll(ctx.(*AccountLiteralPartContext)) + + return p +} + +func (s *AccountTextPartContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AccountTextPartContext) ACCOUNT_TEXT() antlr.TerminalNode { + return s.GetToken(NumscriptParserACCOUNT_TEXT, 0) +} + +func (s *AccountTextPartContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(NumscriptListener); ok { + listenerT.EnterAccountTextPart(s) + } +} + +func (s *AccountTextPartContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(NumscriptListener); ok { + listenerT.ExitAccountTextPart(s) + } +} + +func (p *NumscriptParser) AccountLiteralPart() (localctx IAccountLiteralPartContext) { + localctx = NewAccountLiteralPartContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 2, NumscriptParserRULE_accountLiteralPart) + p.SetState(45) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case NumscriptParserACCOUNT_TEXT: + localctx = NewAccountTextPartContext(p, localctx) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(43) + p.Match(NumscriptParserACCOUNT_TEXT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case NumscriptParserVARIABLE_NAME_ACC: + localctx = NewAccountVarPartContext(p, localctx) + p.EnterOuterAlt(localctx, 2) + { + p.SetState(44) + p.Match(NumscriptParserVARIABLE_NAME_ACC) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + // IValueExprContext is an interface to support dynamic dispatch. type IValueExprContext interface { antlr.ParserRuleContext @@ -611,6 +797,14 @@ func (s *InfixExprContext) ValueExpr(i int) IValueExprContext { return t.(IValueExprContext) } +func (s *InfixExprContext) DIV() antlr.TerminalNode { + return s.GetToken(NumscriptParserDIV, 0) +} + +func (s *InfixExprContext) PLUS() antlr.TerminalNode { + return s.GetToken(NumscriptParserPLUS, 0) +} + func (s *InfixExprContext) MINUS() antlr.TerminalNode { return s.GetToken(NumscriptParserMINUS, 0) } @@ -767,8 +961,57 @@ func (s *AccountLiteralContext) GetRuleContext() antlr.RuleContext { return s } -func (s *AccountLiteralContext) ACCOUNT() antlr.TerminalNode { - return s.GetToken(NumscriptParserACCOUNT, 0) +func (s *AccountLiteralContext) ACCOUNT_START() antlr.TerminalNode { + return s.GetToken(NumscriptParserACCOUNT_START, 0) +} + +func (s *AccountLiteralContext) AllAccountLiteralPart() []IAccountLiteralPartContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAccountLiteralPartContext); ok { + len++ + } + } + + tst := make([]IAccountLiteralPartContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAccountLiteralPartContext); ok { + tst[i] = t.(IAccountLiteralPartContext) + i++ + } + } + + return tst +} + +func (s *AccountLiteralContext) AccountLiteralPart(i int) IAccountLiteralPartContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAccountLiteralPartContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAccountLiteralPartContext) +} + +func (s *AccountLiteralContext) AllCOLON() []antlr.TerminalNode { + return s.GetTokens(NumscriptParserCOLON) +} + +func (s *AccountLiteralContext) COLON(i int) antlr.TerminalNode { + return s.GetToken(NumscriptParserCOLON, i) } func (s *AccountLiteralContext) EnterRule(listener antlr.ParseTreeListener) { @@ -908,14 +1151,14 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { localctx = NewValueExprContext(p, p.GetParserRuleContext(), _parentState) var _prevctx IValueExprContext = localctx var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning. - _startState := 2 - p.EnterRecursionRule(localctx, 2, NumscriptParserRULE_valueExpr, _p) + _startState := 4 + p.EnterRecursionRule(localctx, 4, NumscriptParserRULE_valueExpr, _p) var _la int var _alt int p.EnterOuterAlt(localctx, 1) - p.SetState(53) + p.SetState(67) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -928,7 +1171,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { _prevctx = localctx { - p.SetState(42) + p.SetState(48) p.Match(NumscriptParserVARIABLE_NAME) if p.HasError() { // Recognition error - abort rule @@ -941,7 +1184,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(43) + p.SetState(49) p.Match(NumscriptParserASSET) if p.HasError() { // Recognition error - abort rule @@ -954,7 +1197,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(44) + p.SetState(50) p.Match(NumscriptParserSTRING) if p.HasError() { // Recognition error - abort rule @@ -962,25 +1205,64 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { } } - case NumscriptParserACCOUNT: + case NumscriptParserACCOUNT_START: localctx = NewAccountLiteralContext(p, localctx) p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(45) - p.Match(NumscriptParserACCOUNT) + p.SetState(51) + p.Match(NumscriptParserACCOUNT_START) if p.HasError() { // Recognition error - abort rule goto errorExit } } + { + p.SetState(52) + p.AccountLiteralPart() + } + p.SetState(57) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(53) + p.Match(NumscriptParserCOLON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(54) + p.AccountLiteralPart() + } + + } + p.SetState(59) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } case NumscriptParserNUMBER: localctx = NewNumberLiteralContext(p, localctx) p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(46) + p.SetState(60) p.Match(NumscriptParserNUMBER) if p.HasError() { // Recognition error - abort rule @@ -993,7 +1275,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(47) + p.SetState(61) p.Match(NumscriptParserPERCENTAGE_PORTION_LITERAL) if p.HasError() { // Recognition error - abort rule @@ -1006,7 +1288,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(48) + p.SetState(62) p.MonetaryLit() } @@ -1015,7 +1297,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(49) + p.SetState(63) p.Match(NumscriptParserLPARENS) if p.HasError() { // Recognition error - abort rule @@ -1023,11 +1305,11 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { } } { - p.SetState(50) + p.SetState(64) p.valueExpr(0) } { - p.SetState(51) + p.SetState(65) p.Match(NumscriptParserRPARENS) if p.HasError() { // Recognition error - abort rule @@ -1040,12 +1322,12 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { goto errorExit } p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) - p.SetState(63) + p.SetState(77) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 2, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 4, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -1055,28 +1337,28 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.TriggerExitRuleEvent() } _prevctx = localctx - p.SetState(61) + p.SetState(75) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 3, p.GetParserRuleContext()) { case 1: localctx = NewInfixExprContext(p, NewValueExprContext(p, _parentctx, _parentState)) localctx.(*InfixExprContext).left = _prevctx p.PushNewRecursionContext(localctx, _startState, NumscriptParserRULE_valueExpr) - p.SetState(55) + p.SetState(69) if !(p.Precpred(p.GetParserRuleContext(), 3)) { p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", "")) goto errorExit } { - p.SetState(56) + p.SetState(70) - var _m = p.Match(NumscriptParserT__0) + var _m = p.Match(NumscriptParserDIV) localctx.(*InfixExprContext).op = _m if p.HasError() { @@ -1085,7 +1367,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { } } { - p.SetState(57) + p.SetState(71) var _x = p.valueExpr(4) @@ -1097,14 +1379,14 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { localctx.(*InfixExprContext).left = _prevctx p.PushNewRecursionContext(localctx, _startState, NumscriptParserRULE_valueExpr) - p.SetState(58) + p.SetState(72) if !(p.Precpred(p.GetParserRuleContext(), 2)) { p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 2)", "")) goto errorExit } { - p.SetState(59) + p.SetState(73) var _lt = p.GetTokenStream().LT(1) @@ -1112,7 +1394,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { _la = p.GetTokenStream().LA(1) - if !(_la == NumscriptParserT__1 || _la == NumscriptParserMINUS) { + if !(_la == NumscriptParserPLUS || _la == NumscriptParserMINUS) { var _ri = p.GetErrorHandler().RecoverInline(p) localctx.(*InfixExprContext).op = _ri @@ -1122,7 +1404,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { } } { - p.SetState(60) + p.SetState(74) var _x = p.valueExpr(3) @@ -1134,12 +1416,12 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { } } - p.SetState(65) + p.SetState(79) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 2, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 4, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -1278,15 +1560,15 @@ func (s *FunctionCallArgsContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) FunctionCallArgs() (localctx IFunctionCallArgsContext) { localctx = NewFunctionCallArgsContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 4, NumscriptParserRULE_functionCallArgs) + p.EnterRule(localctx, 6, NumscriptParserRULE_functionCallArgs) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(66) + p.SetState(80) p.valueExpr(0) } - p.SetState(71) + p.SetState(85) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1295,7 +1577,7 @@ func (p *NumscriptParser) FunctionCallArgs() (localctx IFunctionCallArgsContext) for _la == NumscriptParserCOMMA { { - p.SetState(67) + p.SetState(81) p.Match(NumscriptParserCOMMA) if p.HasError() { // Recognition error - abort rule @@ -1303,11 +1585,11 @@ func (p *NumscriptParser) FunctionCallArgs() (localctx IFunctionCallArgsContext) } } { - p.SetState(68) + p.SetState(82) p.valueExpr(0) } - p.SetState(73) + p.SetState(87) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1443,12 +1725,12 @@ func (s *FunctionCallContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) FunctionCall() (localctx IFunctionCallContext) { localctx = NewFunctionCallContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 6, NumscriptParserRULE_functionCall) + p.EnterRule(localctx, 8, NumscriptParserRULE_functionCall) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(74) + p.SetState(88) var _lt = p.GetTokenStream().LT(1) @@ -1466,29 +1748,29 @@ func (p *NumscriptParser) FunctionCall() (localctx IFunctionCallContext) { } } { - p.SetState(75) + p.SetState(89) p.Match(NumscriptParserLPARENS) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(77) + p.SetState(91) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&528301948928) != 0 { + if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2452431568896) != 0 { { - p.SetState(76) + p.SetState(90) p.FunctionCallArgs() } } { - p.SetState(79) + p.SetState(93) p.Match(NumscriptParserRPARENS) if p.HasError() { // Recognition error - abort rule @@ -1598,10 +1880,10 @@ func (s *VarOriginContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) VarOrigin() (localctx IVarOriginContext) { localctx = NewVarOriginContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 8, NumscriptParserRULE_varOrigin) + p.EnterRule(localctx, 10, NumscriptParserRULE_varOrigin) p.EnterOuterAlt(localctx, 1) { - p.SetState(81) + p.SetState(95) p.Match(NumscriptParserEQ) if p.HasError() { // Recognition error - abort rule @@ -1609,7 +1891,7 @@ func (p *NumscriptParser) VarOrigin() (localctx IVarOriginContext) { } } { - p.SetState(82) + p.SetState(96) p.FunctionCall() } @@ -1742,12 +2024,12 @@ func (s *VarDeclarationContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) VarDeclaration() (localctx IVarDeclarationContext) { localctx = NewVarDeclarationContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 10, NumscriptParserRULE_varDeclaration) + p.EnterRule(localctx, 12, NumscriptParserRULE_varDeclaration) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(84) + p.SetState(98) var _m = p.Match(NumscriptParserIDENTIFIER) @@ -1758,7 +2040,7 @@ func (p *NumscriptParser) VarDeclaration() (localctx IVarDeclarationContext) { } } { - p.SetState(85) + p.SetState(99) var _m = p.Match(NumscriptParserVARIABLE_NAME) @@ -1768,7 +2050,7 @@ func (p *NumscriptParser) VarDeclaration() (localctx IVarDeclarationContext) { goto errorExit } } - p.SetState(87) + p.SetState(101) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1777,7 +2059,7 @@ func (p *NumscriptParser) VarDeclaration() (localctx IVarDeclarationContext) { if _la == NumscriptParserEQ { { - p.SetState(86) + p.SetState(100) p.VarOrigin() } @@ -1921,12 +2203,12 @@ func (s *VarsDeclarationContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) VarsDeclaration() (localctx IVarsDeclarationContext) { localctx = NewVarsDeclarationContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 12, NumscriptParserRULE_varsDeclaration) + p.EnterRule(localctx, 14, NumscriptParserRULE_varsDeclaration) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(89) + p.SetState(103) p.Match(NumscriptParserVARS) if p.HasError() { // Recognition error - abort rule @@ -1934,14 +2216,14 @@ func (p *NumscriptParser) VarsDeclaration() (localctx IVarsDeclarationContext) { } } { - p.SetState(90) + p.SetState(104) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(94) + p.SetState(108) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1950,11 +2232,11 @@ func (p *NumscriptParser) VarsDeclaration() (localctx IVarsDeclarationContext) { for _la == NumscriptParserIDENTIFIER { { - p.SetState(91) + p.SetState(105) p.VarDeclaration() } - p.SetState(96) + p.SetState(110) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1962,7 +2244,7 @@ func (p *NumscriptParser) VarsDeclaration() (localctx IVarsDeclarationContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(97) + p.SetState(111) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -2115,11 +2397,11 @@ func (s *ProgramContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) Program() (localctx IProgramContext) { localctx = NewProgramContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 14, NumscriptParserRULE_program) + p.EnterRule(localctx, 16, NumscriptParserRULE_program) var _la int p.EnterOuterAlt(localctx, 1) - p.SetState(100) + p.SetState(114) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2128,25 +2410,25 @@ func (p *NumscriptParser) Program() (localctx IProgramContext) { if _la == NumscriptParserVARS { { - p.SetState(99) + p.SetState(113) p.VarsDeclaration() } } - p.SetState(105) + p.SetState(119) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&17182494720) != 0 { + for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&17180459520) != 0 { { - p.SetState(102) + p.SetState(116) p.Statement() } - p.SetState(107) + p.SetState(121) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2154,7 +2436,7 @@ func (p *NumscriptParser) Program() (localctx IProgramContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(108) + p.SetState(122) p.Match(NumscriptParserEOF) if p.HasError() { // Recognition error - abort rule @@ -2285,10 +2567,10 @@ func (s *SentAllLitContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) SentAllLit() (localctx ISentAllLitContext) { localctx = NewSentAllLitContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 16, NumscriptParserRULE_sentAllLit) + p.EnterRule(localctx, 18, NumscriptParserRULE_sentAllLit) p.EnterOuterAlt(localctx, 1) { - p.SetState(110) + p.SetState(124) p.Match(NumscriptParserLBRACKET) if p.HasError() { // Recognition error - abort rule @@ -2297,7 +2579,7 @@ func (p *NumscriptParser) SentAllLit() (localctx ISentAllLitContext) { } { - p.SetState(111) + p.SetState(125) var _x = p.valueExpr(0) @@ -2305,7 +2587,7 @@ func (p *NumscriptParser) SentAllLit() (localctx ISentAllLitContext) { } { - p.SetState(112) + p.SetState(126) p.Match(NumscriptParserSTAR) if p.HasError() { // Recognition error - abort rule @@ -2313,7 +2595,7 @@ func (p *NumscriptParser) SentAllLit() (localctx ISentAllLitContext) { } } { - p.SetState(113) + p.SetState(127) p.Match(NumscriptParserRBRACKET) if p.HasError() { // Recognition error - abort rule @@ -2470,19 +2752,19 @@ func (s *PortionedAllotmentContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) Allotment() (localctx IAllotmentContext) { localctx = NewAllotmentContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 18, NumscriptParserRULE_allotment) - p.SetState(117) + p.EnterRule(localctx, 20, NumscriptParserRULE_allotment) + p.SetState(131) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } switch p.GetTokenStream().LA(1) { - case NumscriptParserLPARENS, NumscriptParserLBRACKET, NumscriptParserPERCENTAGE_PORTION_LITERAL, NumscriptParserSTRING, NumscriptParserNUMBER, NumscriptParserVARIABLE_NAME, NumscriptParserACCOUNT, NumscriptParserASSET: + case NumscriptParserLPARENS, NumscriptParserLBRACKET, NumscriptParserPERCENTAGE_PORTION_LITERAL, NumscriptParserSTRING, NumscriptParserNUMBER, NumscriptParserASSET, NumscriptParserACCOUNT_START, NumscriptParserVARIABLE_NAME: localctx = NewPortionedAllotmentContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(115) + p.SetState(129) p.valueExpr(0) } @@ -2490,7 +2772,7 @@ func (p *NumscriptParser) Allotment() (localctx IAllotmentContext) { localctx = NewRemainingAllotmentContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(116) + p.SetState(130) p.Match(NumscriptParserREMAINING) if p.HasError() { // Recognition error - abort rule @@ -2685,6 +2967,10 @@ func (s *SrcOneofContext) GetRuleContext() antlr.RuleContext { return s } +func (s *SrcOneofContext) ONEOF() antlr.TerminalNode { + return s.GetToken(NumscriptParserONEOF, 0) +} + func (s *SrcOneofContext) LBRACE() antlr.TerminalNode { return s.GetToken(NumscriptParserLBRACE, 0) } @@ -3090,28 +3376,28 @@ func (s *SrcAccountContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) Source() (localctx ISourceContext) { localctx = NewSourceContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 20, NumscriptParserRULE_source) + p.EnterRule(localctx, 22, NumscriptParserRULE_source) var _la int - p.SetState(162) + p.SetState(176) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 13, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 15, p.GetParserRuleContext()) { case 1: localctx = NewSrcAccountUnboundedOverdraftContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(119) + p.SetState(133) var _x = p.valueExpr(0) localctx.(*SrcAccountUnboundedOverdraftContext).address = _x } { - p.SetState(120) + p.SetState(134) p.Match(NumscriptParserALLOWING) if p.HasError() { // Recognition error - abort rule @@ -3119,7 +3405,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(121) + p.SetState(135) p.Match(NumscriptParserUNBOUNDED) if p.HasError() { // Recognition error - abort rule @@ -3127,7 +3413,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(122) + p.SetState(136) p.Match(NumscriptParserOVERDRAFT) if p.HasError() { // Recognition error - abort rule @@ -3139,14 +3425,14 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { localctx = NewSrcAccountBoundedOverdraftContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(124) + p.SetState(138) var _x = p.valueExpr(0) localctx.(*SrcAccountBoundedOverdraftContext).address = _x } { - p.SetState(125) + p.SetState(139) p.Match(NumscriptParserALLOWING) if p.HasError() { // Recognition error - abort rule @@ -3154,7 +3440,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(126) + p.SetState(140) p.Match(NumscriptParserOVERDRAFT) if p.HasError() { // Recognition error - abort rule @@ -3162,7 +3448,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(127) + p.SetState(141) p.Match(NumscriptParserUP) if p.HasError() { // Recognition error - abort rule @@ -3170,7 +3456,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(128) + p.SetState(142) p.Match(NumscriptParserTO) if p.HasError() { // Recognition error - abort rule @@ -3178,7 +3464,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(129) + p.SetState(143) var _x = p.valueExpr(0) @@ -3189,7 +3475,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { localctx = NewSrcAccountContext(p, localctx) p.EnterOuterAlt(localctx, 3) { - p.SetState(131) + p.SetState(145) p.valueExpr(0) } @@ -3197,27 +3483,27 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { localctx = NewSrcAllotmentContext(p, localctx) p.EnterOuterAlt(localctx, 4) { - p.SetState(132) + p.SetState(146) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(134) + p.SetState(148) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&528302014464) != 0) { + for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2452431577088) != 0) { { - p.SetState(133) + p.SetState(147) p.AllotmentClauseSrc() } - p.SetState(136) + p.SetState(150) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3225,7 +3511,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(138) + p.SetState(152) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -3237,27 +3523,27 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { localctx = NewSrcInorderContext(p, localctx) p.EnterOuterAlt(localctx, 5) { - p.SetState(140) + p.SetState(154) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(144) + p.SetState(158) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&528369058312) != 0 { + for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2452448477248) != 0 { { - p.SetState(141) + p.SetState(155) p.Source() } - p.SetState(146) + p.SetState(160) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3265,7 +3551,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(147) + p.SetState(161) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -3277,35 +3563,35 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { localctx = NewSrcOneofContext(p, localctx) p.EnterOuterAlt(localctx, 6) { - p.SetState(148) - p.Match(NumscriptParserT__2) + p.SetState(162) + p.Match(NumscriptParserONEOF) if p.HasError() { // Recognition error - abort rule goto errorExit } } { - p.SetState(149) + p.SetState(163) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(151) + p.SetState(165) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&528369058312) != 0) { + for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2452448477248) != 0) { { - p.SetState(150) + p.SetState(164) p.Source() } - p.SetState(153) + p.SetState(167) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3313,7 +3599,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(155) + p.SetState(169) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -3325,7 +3611,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { localctx = NewSrcCappedContext(p, localctx) p.EnterOuterAlt(localctx, 7) { - p.SetState(157) + p.SetState(171) p.Match(NumscriptParserMAX) if p.HasError() { // Recognition error - abort rule @@ -3333,14 +3619,14 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(158) + p.SetState(172) var _x = p.valueExpr(0) localctx.(*SrcCappedContext).cap_ = _x } { - p.SetState(159) + p.SetState(173) p.Match(NumscriptParserFROM) if p.HasError() { // Recognition error - abort rule @@ -3348,7 +3634,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(160) + p.SetState(174) p.Source() } @@ -3475,14 +3761,14 @@ func (s *AllotmentClauseSrcContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) AllotmentClauseSrc() (localctx IAllotmentClauseSrcContext) { localctx = NewAllotmentClauseSrcContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 22, NumscriptParserRULE_allotmentClauseSrc) + p.EnterRule(localctx, 24, NumscriptParserRULE_allotmentClauseSrc) p.EnterOuterAlt(localctx, 1) { - p.SetState(164) + p.SetState(178) p.Allotment() } { - p.SetState(165) + p.SetState(179) p.Match(NumscriptParserFROM) if p.HasError() { // Recognition error - abort rule @@ -3490,7 +3776,7 @@ func (p *NumscriptParser) AllotmentClauseSrc() (localctx IAllotmentClauseSrcCont } } { - p.SetState(166) + p.SetState(180) p.Source() } @@ -3647,8 +3933,8 @@ func (s *DestinationToContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) KeptOrDestination() (localctx IKeptOrDestinationContext) { localctx = NewKeptOrDestinationContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 24, NumscriptParserRULE_keptOrDestination) - p.SetState(171) + p.EnterRule(localctx, 26, NumscriptParserRULE_keptOrDestination) + p.SetState(185) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3659,7 +3945,7 @@ func (p *NumscriptParser) KeptOrDestination() (localctx IKeptOrDestinationContex localctx = NewDestinationToContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(168) + p.SetState(182) p.Match(NumscriptParserTO) if p.HasError() { // Recognition error - abort rule @@ -3667,7 +3953,7 @@ func (p *NumscriptParser) KeptOrDestination() (localctx IKeptOrDestinationContex } } { - p.SetState(169) + p.SetState(183) p.Destination() } @@ -3675,7 +3961,7 @@ func (p *NumscriptParser) KeptOrDestination() (localctx IKeptOrDestinationContex localctx = NewDestinationKeptContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(170) + p.SetState(184) p.Match(NumscriptParserKEPT) if p.HasError() { // Recognition error - abort rule @@ -3807,10 +4093,10 @@ func (s *DestinationInOrderClauseContext) ExitRule(listener antlr.ParseTreeListe func (p *NumscriptParser) DestinationInOrderClause() (localctx IDestinationInOrderClauseContext) { localctx = NewDestinationInOrderClauseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 26, NumscriptParserRULE_destinationInOrderClause) + p.EnterRule(localctx, 28, NumscriptParserRULE_destinationInOrderClause) p.EnterOuterAlt(localctx, 1) { - p.SetState(173) + p.SetState(187) p.Match(NumscriptParserMAX) if p.HasError() { // Recognition error - abort rule @@ -3818,11 +4104,11 @@ func (p *NumscriptParser) DestinationInOrderClause() (localctx IDestinationInOrd } } { - p.SetState(174) + p.SetState(188) p.valueExpr(0) } { - p.SetState(175) + p.SetState(189) p.KeptOrDestination() } @@ -4010,6 +4296,10 @@ func (s *DestOneofContext) GetRuleContext() antlr.RuleContext { return s } +func (s *DestOneofContext) ONEOF() antlr.TerminalNode { + return s.GetToken(NumscriptParserONEOF, 0) +} + func (s *DestOneofContext) LBRACE() antlr.TerminalNode { return s.GetToken(NumscriptParserLBRACE, 0) } @@ -4218,21 +4508,21 @@ func (s *DestAllotmentContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) Destination() (localctx IDestinationContext) { localctx = NewDestinationContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 28, NumscriptParserRULE_destination) + p.EnterRule(localctx, 30, NumscriptParserRULE_destination) var _la int - p.SetState(209) + p.SetState(223) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 18, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 20, p.GetParserRuleContext()) { case 1: localctx = NewDestAccountContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(177) + p.SetState(191) p.valueExpr(0) } @@ -4240,27 +4530,27 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { localctx = NewDestAllotmentContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(178) + p.SetState(192) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(180) + p.SetState(194) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&528302014464) != 0) { + for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2452431577088) != 0) { { - p.SetState(179) + p.SetState(193) p.AllotmentClauseDest() } - p.SetState(182) + p.SetState(196) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4268,7 +4558,7 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(184) + p.SetState(198) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -4280,14 +4570,14 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { localctx = NewDestInorderContext(p, localctx) p.EnterOuterAlt(localctx, 3) { - p.SetState(186) + p.SetState(200) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(190) + p.SetState(204) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4296,11 +4586,11 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { for _la == NumscriptParserMAX { { - p.SetState(187) + p.SetState(201) p.DestinationInOrderClause() } - p.SetState(192) + p.SetState(206) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4308,7 +4598,7 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(193) + p.SetState(207) p.Match(NumscriptParserREMAINING) if p.HasError() { // Recognition error - abort rule @@ -4316,11 +4606,11 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { } } { - p.SetState(194) + p.SetState(208) p.KeptOrDestination() } { - p.SetState(195) + p.SetState(209) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -4332,22 +4622,22 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { localctx = NewDestOneofContext(p, localctx) p.EnterOuterAlt(localctx, 4) { - p.SetState(197) - p.Match(NumscriptParserT__2) + p.SetState(211) + p.Match(NumscriptParserONEOF) if p.HasError() { // Recognition error - abort rule goto errorExit } } { - p.SetState(198) + p.SetState(212) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(202) + p.SetState(216) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4356,11 +4646,11 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { for _la == NumscriptParserMAX { { - p.SetState(199) + p.SetState(213) p.DestinationInOrderClause() } - p.SetState(204) + p.SetState(218) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4368,7 +4658,7 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(205) + p.SetState(219) p.Match(NumscriptParserREMAINING) if p.HasError() { // Recognition error - abort rule @@ -4376,11 +4666,11 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { } } { - p.SetState(206) + p.SetState(220) p.KeptOrDestination() } { - p.SetState(207) + p.SetState(221) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -4506,14 +4796,14 @@ func (s *AllotmentClauseDestContext) ExitRule(listener antlr.ParseTreeListener) func (p *NumscriptParser) AllotmentClauseDest() (localctx IAllotmentClauseDestContext) { localctx = NewAllotmentClauseDestContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 30, NumscriptParserRULE_allotmentClauseDest) + p.EnterRule(localctx, 32, NumscriptParserRULE_allotmentClauseDest) p.EnterOuterAlt(localctx, 1) { - p.SetState(211) + p.SetState(225) p.Allotment() } { - p.SetState(212) + p.SetState(226) p.KeptOrDestination() } @@ -4678,19 +4968,19 @@ func (s *SentLiteralContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) SentValue() (localctx ISentValueContext) { localctx = NewSentValueContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 32, NumscriptParserRULE_sentValue) - p.SetState(216) + p.EnterRule(localctx, 34, NumscriptParserRULE_sentValue) + p.SetState(230) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 19, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 21, p.GetParserRuleContext()) { case 1: localctx = NewSentLiteralContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(214) + p.SetState(228) p.valueExpr(0) } @@ -4698,7 +4988,7 @@ func (p *NumscriptParser) SentValue() (localctx ISentValueContext) { localctx = NewSentAllContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(215) + p.SetState(229) p.SentAllLit() } @@ -4997,8 +5287,8 @@ func (s *FnCallStatementContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) Statement() (localctx IStatementContext) { localctx = NewStatementContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 34, NumscriptParserRULE_statement) - p.SetState(235) + p.EnterRule(localctx, 36, NumscriptParserRULE_statement) + p.SetState(249) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -5009,7 +5299,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { localctx = NewSendStatementContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(218) + p.SetState(232) p.Match(NumscriptParserSEND) if p.HasError() { // Recognition error - abort rule @@ -5017,11 +5307,11 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(219) + p.SetState(233) p.SentValue() } { - p.SetState(220) + p.SetState(234) p.Match(NumscriptParserLPARENS) if p.HasError() { // Recognition error - abort rule @@ -5029,7 +5319,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(221) + p.SetState(235) p.Match(NumscriptParserSOURCE) if p.HasError() { // Recognition error - abort rule @@ -5037,7 +5327,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(222) + p.SetState(236) p.Match(NumscriptParserEQ) if p.HasError() { // Recognition error - abort rule @@ -5045,11 +5335,11 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(223) + p.SetState(237) p.Source() } { - p.SetState(224) + p.SetState(238) p.Match(NumscriptParserDESTINATION) if p.HasError() { // Recognition error - abort rule @@ -5057,7 +5347,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(225) + p.SetState(239) p.Match(NumscriptParserEQ) if p.HasError() { // Recognition error - abort rule @@ -5065,11 +5355,11 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(226) + p.SetState(240) p.Destination() } { - p.SetState(227) + p.SetState(241) p.Match(NumscriptParserRPARENS) if p.HasError() { // Recognition error - abort rule @@ -5081,7 +5371,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { localctx = NewSaveStatementContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(229) + p.SetState(243) p.Match(NumscriptParserSAVE) if p.HasError() { // Recognition error - abort rule @@ -5089,11 +5379,11 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(230) + p.SetState(244) p.SentValue() } { - p.SetState(231) + p.SetState(245) p.Match(NumscriptParserFROM) if p.HasError() { // Recognition error - abort rule @@ -5101,7 +5391,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(232) + p.SetState(246) p.valueExpr(0) } @@ -5109,7 +5399,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { localctx = NewFnCallStatementContext(p, localctx) p.EnterOuterAlt(localctx, 3) { - p.SetState(234) + p.SetState(248) p.FunctionCall() } @@ -5133,7 +5423,7 @@ errorExit: func (p *NumscriptParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool { switch ruleIndex { - case 1: + case 2: var t *ValueExprContext = nil if localctx != nil { t = localctx.(*ValueExprContext) diff --git a/internal/parser/ast.go b/internal/parser/ast.go index dd0dfc7e..45de0fed 100644 --- a/internal/parser/ast.go +++ b/internal/parser/ast.go @@ -2,6 +2,7 @@ package parser import ( "math/big" + "strings" ) type ValueExpr interface { @@ -9,14 +10,14 @@ type ValueExpr interface { valueExpr() } -func (*Variable) valueExpr() {} -func (*AssetLiteral) valueExpr() {} -func (*MonetaryLiteral) valueExpr() {} -func (*AccountLiteral) valueExpr() {} -func (*PercentageLiteral) valueExpr() {} -func (*NumberLiteral) valueExpr() {} -func (*StringLiteral) valueExpr() {} -func (*BinaryInfix) valueExpr() {} +func (*Variable) valueExpr() {} +func (*AssetLiteral) valueExpr() {} +func (*MonetaryLiteral) valueExpr() {} +func (*AccountInterpLiteral) valueExpr() {} +func (*PercentageLiteral) valueExpr() {} +func (*NumberLiteral) valueExpr() {} +func (*StringLiteral) valueExpr() {} +func (*BinaryInfix) valueExpr() {} type InfixOperator string @@ -48,9 +49,9 @@ type ( Amount ValueExpr } - AccountLiteral struct { + AccountInterpLiteral struct { Range - Name string + Parts []AccountNamePart } PercentageLiteral struct { @@ -72,6 +73,12 @@ type ( } ) +type AccountNamePart interface{ accountNamePart() } +type AccountTextPart struct{ Name string } + +func (AccountTextPart) accountNamePart() {} +func (*Variable) accountNamePart() {} + func (r PercentageLiteral) ToRatio() *big.Rat { denom := new(big.Int).Exp( big.NewInt(10), @@ -82,8 +89,31 @@ func (r PercentageLiteral) ToRatio() *big.Rat { return new(big.Rat).SetFrac(r.Amount, denom) } -func (a *AccountLiteral) IsWorld() bool { - return a.Name == "world" +func (a AccountInterpLiteral) IsWorld() bool { + if len(a.Parts) != 1 { + return false + } + switch part := a.Parts[0].(type) { + case AccountTextPart: + return part.Name == "world" + + default: + return false + } +} + +func (expr AccountInterpLiteral) String() string { + // TODO we might want to parse this instead of computing it + var parts []string + for _, part := range expr.Parts { + switch part := part.(type) { + case AccountTextPart: + parts = append(parts, part.Name) + case *Variable: + parts = append(parts, "$"+part.Name) + } + } + return strings.Join(parts, ":") } // Source exprs diff --git a/internal/parser/parser.go b/internal/parser/parser.go index 14681c4f..1a4ad25a 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - parser "github.com/formancehq/numscript/internal/parser/antlr" + antlrParser "github.com/formancehq/numscript/internal/parser/antlrParser" "github.com/formancehq/numscript/internal/utils" "github.com/antlr4-go/antlr/v4" @@ -48,17 +48,17 @@ func Parse(input string) ParseResult { listener := &ErrorListener{} is := antlr.NewInputStream(input) - lexer := parser.NewNumscriptLexer(is) + lexer := antlrParser.NewLexer(is) lexer.RemoveErrorListeners() lexer.AddErrorListener(listener) stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel) - parser := parser.NewNumscriptParser(stream) - parser.RemoveErrorListeners() - parser.AddErrorListener(listener) + p := antlrParser.NewNumscriptParser(stream) + p.RemoveErrorListeners() + p.AddErrorListener(listener) - parsed := parseProgram(parser.Program()) + parsed := parseProgram(p.Program()) return ParseResult{ Source: input, @@ -75,7 +75,7 @@ func ParseErrorsToString(errors []ParserError, source string) string { return buf } -func parseVarsDeclaration(varsCtx parser.IVarsDeclarationContext) []VarDeclaration { +func parseVarsDeclaration(varsCtx antlrParser.IVarsDeclarationContext) []VarDeclaration { if varsCtx == nil { return nil } @@ -90,7 +90,7 @@ func parseVarsDeclaration(varsCtx parser.IVarsDeclarationContext) []VarDeclarati return vars } -func parseProgram(programCtx parser.IProgramContext) Program { +func parseProgram(programCtx antlrParser.IProgramContext) Program { vars := parseVarsDeclaration(programCtx.VarsDeclaration()) var statements []Statement @@ -104,7 +104,7 @@ func parseProgram(programCtx parser.IProgramContext) Program { } } -func parseVarDeclaration(varDecl parser.IVarDeclarationContext) *VarDeclaration { +func parseVarDeclaration(varDecl antlrParser.IVarDeclarationContext) *VarDeclaration { if varDecl == nil { return nil } @@ -146,7 +146,7 @@ func parseVarType(tk antlr.Token) *TypeDecl { } } -func parseSource(sourceCtx parser.ISourceContext) Source { +func parseSource(sourceCtx antlrParser.ISourceContext) Source { if sourceCtx == nil { return nil } @@ -154,12 +154,12 @@ func parseSource(sourceCtx parser.ISourceContext) Source { range_ := ctxToRange(sourceCtx) switch sourceCtx := sourceCtx.(type) { - case *parser.SrcAccountContext: + case *antlrParser.SrcAccountContext: return &SourceAccount{ ValueExpr: parseValueExpr(sourceCtx.ValueExpr()), } - case *parser.SrcInorderContext: + case *antlrParser.SrcInorderContext: var sources []Source for _, sourceCtx := range sourceCtx.AllSource() { sources = append(sources, parseSource(sourceCtx)) @@ -169,7 +169,7 @@ func parseSource(sourceCtx parser.ISourceContext) Source { Sources: sources, } - case *parser.SrcOneofContext: + case *antlrParser.SrcOneofContext: var sources []Source for _, sourceCtx := range sourceCtx.AllSource() { sources = append(sources, parseSource(sourceCtx)) @@ -179,7 +179,7 @@ func parseSource(sourceCtx parser.ISourceContext) Source { Sources: sources, } - case *parser.SrcAllotmentContext: + case *antlrParser.SrcAllotmentContext: var items []SourceAllotmentItem for _, itemCtx := range sourceCtx.AllAllotmentClauseSrc() { item := SourceAllotmentItem{ @@ -194,20 +194,20 @@ func parseSource(sourceCtx parser.ISourceContext) Source { Items: items, } - case *parser.SrcCappedContext: + case *antlrParser.SrcCappedContext: return &SourceCapped{ Range: range_, From: parseSource(sourceCtx.Source()), Cap: parseValueExpr(sourceCtx.GetCap_()), } - case *parser.SrcAccountUnboundedOverdraftContext: + case *antlrParser.SrcAccountUnboundedOverdraftContext: return &SourceOverdraft{ Range: ctxToRange(sourceCtx), Address: parseValueExpr(sourceCtx.GetAddress()), } - case *parser.SrcAccountBoundedOverdraftContext: + case *antlrParser.SrcAccountBoundedOverdraftContext: varMon := parseValueExpr(sourceCtx.GetMaxOvedraft()) return &SourceOverdraft{ @@ -216,7 +216,7 @@ func parseSource(sourceCtx parser.ISourceContext) Source { Bounded: &varMon, } - case *parser.SourceContext: + case *antlrParser.SourceContext: return nil default: @@ -256,18 +256,18 @@ func parsePercentageRatio(source string, range_ Range) *PercentageLiteral { } } -func parseAllotment(allotmentCtx parser.IAllotmentContext) AllotmentValue { +func parseAllotment(allotmentCtx antlrParser.IAllotmentContext) AllotmentValue { switch allotmentCtx := allotmentCtx.(type) { - case *parser.PortionedAllotmentContext: + case *antlrParser.PortionedAllotmentContext: expr := parseValueExpr(allotmentCtx.ValueExpr()) return &ValueExprAllotment{expr} - case *parser.RemainingAllotmentContext: + case *antlrParser.RemainingAllotmentContext: return &RemainingAllotment{ Range: ctxToRange(allotmentCtx), } - case *parser.AllotmentContext: + case *antlrParser.AllotmentContext: return nil default: @@ -275,7 +275,7 @@ func parseAllotment(allotmentCtx parser.IAllotmentContext) AllotmentValue { } } -func parseStringLiteralCtx(stringCtx *parser.StringLiteralContext) *StringLiteral { +func parseStringLiteralCtx(stringCtx *antlrParser.StringLiteralContext) *StringLiteral { rawStr := stringCtx.GetText() // Remove leading and trailing '"' innerStr := rawStr[1 : len(rawStr)-1] @@ -285,40 +285,53 @@ func parseStringLiteralCtx(stringCtx *parser.StringLiteralContext) *StringLitera } } -func parseValueExpr(valueExprCtx parser.IValueExprContext) ValueExpr { +func parseValueExpr(valueExprCtx antlrParser.IValueExprContext) ValueExpr { switch valueExprCtx := valueExprCtx.(type) { - case *parser.ParenthesizedExprContext: + case *antlrParser.ParenthesizedExprContext: return parseValueExpr(valueExprCtx.ValueExpr()) - case *parser.AccountLiteralContext: - return &AccountLiteral{ - Range: ctxToRange(valueExprCtx), - // Discard the '@' - Name: valueExprCtx.GetText()[1:], + case *antlrParser.AccountLiteralContext: + litRng := ctxToRange(valueExprCtx) + + var parts []AccountNamePart + for _, accLit := range valueExprCtx.AllAccountLiteralPart() { + varPartText := accLit.GetText() + switch accLit := accLit.(type) { + case *antlrParser.AccountTextPartContext: + parts = append(parts, AccountTextPart{Name: varPartText}) + case *antlrParser.AccountVarPartContext: + v := parseVarLiteral(accLit.VARIABLE_NAME_ACC().GetSymbol()) + parts = append(parts, v) + } + } + + return &AccountInterpLiteral{ + Range: litRng, + Parts: parts, } - case *parser.MonetaryLiteralContext: + case *antlrParser.MonetaryLiteralContext: return parseMonetaryLit(valueExprCtx.MonetaryLit()) - case *parser.AssetLiteralContext: + case *antlrParser.AssetLiteralContext: return &AssetLiteral{ Range: ctxToRange(valueExprCtx), Asset: valueExprCtx.GetText(), } - case *parser.NumberLiteralContext: + case *antlrParser.NumberLiteralContext: return parseNumberLiteral(valueExprCtx.NUMBER()) - case *parser.PercentagePortionLiteralContext: + case *antlrParser.PercentagePortionLiteralContext: return parsePercentageRatio(valueExprCtx.GetText(), ctxToRange(valueExprCtx)) - case *parser.VariableExprContext: + case *antlrParser.VariableExprContext: return variableLiteralFromCtx(valueExprCtx) - case *parser.StringLiteralContext: + case *antlrParser.StringLiteralContext: return parseStringLiteralCtx(valueExprCtx) - case *parser.InfixExprContext: + case *antlrParser.InfixExprContext: return &BinaryInfix{ Range: ctxToRange(valueExprCtx), Operator: InfixOperator(valueExprCtx.GetOp().GetText()), @@ -326,7 +339,7 @@ func parseValueExpr(valueExprCtx parser.IValueExprContext) ValueExpr { Right: parseValueExpr(valueExprCtx.GetRight()), } - case nil, *parser.ValueExprContext: + case nil, *antlrParser.ValueExprContext: return nil default: @@ -344,7 +357,7 @@ func variableLiteralFromCtx(ctx antlr.ParserRuleContext) *Variable { } } -func parseDestination(destCtx parser.IDestinationContext) Destination { +func parseDestination(destCtx antlrParser.IDestinationContext) Destination { if destCtx == nil { return nil } @@ -352,12 +365,12 @@ func parseDestination(destCtx parser.IDestinationContext) Destination { range_ := ctxToRange(destCtx) switch destCtx := destCtx.(type) { - case *parser.DestAccountContext: + case *antlrParser.DestAccountContext: return &DestinationAccount{ ValueExpr: parseValueExpr(destCtx.ValueExpr()), } - case *parser.DestInorderContext: + case *antlrParser.DestInorderContext: var inorderClauses []CappedKeptOrDestination for _, destInorderClause := range destCtx.AllDestinationInOrderClause() { inorderClauses = append(inorderClauses, parseDestinationInorderClause(destInorderClause)) @@ -369,7 +382,7 @@ func parseDestination(destCtx parser.IDestinationContext) Destination { Remaining: parseKeptOrDestination(destCtx.KeptOrDestination()), } - case *parser.DestOneofContext: + case *antlrParser.DestOneofContext: var inorderClauses []CappedKeptOrDestination for _, destInorderClause := range destCtx.AllDestinationInOrderClause() { inorderClauses = append(inorderClauses, parseDestinationInorderClause(destInorderClause)) @@ -381,7 +394,7 @@ func parseDestination(destCtx parser.IDestinationContext) Destination { Remaining: parseKeptOrDestination(destCtx.KeptOrDestination()), } - case *parser.DestAllotmentContext: + case *antlrParser.DestAllotmentContext: var items []DestinationAllotmentItem for _, itemCtx := range destCtx.AllAllotmentClauseDest() { item := DestinationAllotmentItem{ @@ -396,7 +409,7 @@ func parseDestination(destCtx parser.IDestinationContext) Destination { Items: items, } - case *parser.DestinationContext: + case *antlrParser.DestinationContext: return nil default: @@ -405,7 +418,7 @@ func parseDestination(destCtx parser.IDestinationContext) Destination { } -func parseDestinationInorderClause(clauseCtx parser.IDestinationInOrderClauseContext) CappedKeptOrDestination { +func parseDestinationInorderClause(clauseCtx antlrParser.IDestinationInOrderClauseContext) CappedKeptOrDestination { return CappedKeptOrDestination{ Range: ctxToRange(clauseCtx), Cap: parseValueExpr(clauseCtx.ValueExpr()), @@ -413,21 +426,21 @@ func parseDestinationInorderClause(clauseCtx parser.IDestinationInOrderClauseCon } } -func parseKeptOrDestination(clauseCtx parser.IKeptOrDestinationContext) KeptOrDestination { +func parseKeptOrDestination(clauseCtx antlrParser.IKeptOrDestinationContext) KeptOrDestination { if clauseCtx == nil { return nil } switch clauseCtx := clauseCtx.(type) { - case *parser.DestinationToContext: + case *antlrParser.DestinationToContext: return &DestinationTo{ Destination: parseDestination(clauseCtx.Destination()), } - case *parser.DestinationKeptContext: + case *antlrParser.DestinationKeptContext: return &DestinationKept{ Range: ctxToRange(clauseCtx), } - case *parser.KeptOrDestinationContext: + case *antlrParser.KeptOrDestinationContext: return nil default: @@ -436,18 +449,18 @@ func parseKeptOrDestination(clauseCtx parser.IKeptOrDestinationContext) KeptOrDe } -func parseDestinationAllotment(allotmentCtx parser.IAllotmentContext) AllotmentValue { +func parseDestinationAllotment(allotmentCtx antlrParser.IAllotmentContext) AllotmentValue { switch allotmentCtx := allotmentCtx.(type) { - case *parser.RemainingAllotmentContext: + case *antlrParser.RemainingAllotmentContext: return &RemainingAllotment{ Range: ctxToRange(allotmentCtx), } - case *parser.PortionedAllotmentContext: + case *antlrParser.PortionedAllotmentContext: expr := parseValueExpr(allotmentCtx.ValueExpr()) return &ValueExprAllotment{Value: expr} - case *parser.AllotmentContext: + case *antlrParser.AllotmentContext: return nil default: @@ -455,7 +468,7 @@ func parseDestinationAllotment(allotmentCtx parser.IAllotmentContext) AllotmentV } } -func parseFnArgs(fnCallArgCtx parser.IFunctionCallArgsContext) []ValueExpr { +func parseFnArgs(fnCallArgCtx antlrParser.IFunctionCallArgsContext) []ValueExpr { if fnCallArgCtx == nil { return nil } @@ -467,7 +480,7 @@ func parseFnArgs(fnCallArgCtx parser.IFunctionCallArgsContext) []ValueExpr { return args } -func parseFnCall(fnCallCtx parser.IFunctionCallContext) *FnCall { +func parseFnCall(fnCallCtx antlrParser.IFunctionCallContext) *FnCall { if fnCallCtx == nil { return nil } @@ -489,7 +502,7 @@ func parseFnCall(fnCallCtx parser.IFunctionCallContext) *FnCall { } } -func parseSaveStatement(saveCtx *parser.SaveStatementContext) *SaveStatement { +func parseSaveStatement(saveCtx *antlrParser.SaveStatementContext) *SaveStatement { return &SaveStatement{ Range: ctxToRange(saveCtx), SentValue: parseSentValue(saveCtx.SentValue()), @@ -497,18 +510,18 @@ func parseSaveStatement(saveCtx *parser.SaveStatementContext) *SaveStatement { } } -func parseStatement(statementCtx parser.IStatementContext) Statement { +func parseStatement(statementCtx antlrParser.IStatementContext) Statement { switch statementCtx := statementCtx.(type) { - case *parser.SendStatementContext: + case *antlrParser.SendStatementContext: return parseSendStatement(statementCtx) - case *parser.SaveStatementContext: + case *antlrParser.SaveStatementContext: return parseSaveStatement(statementCtx) - case *parser.FnCallStatementContext: + case *antlrParser.FnCallStatementContext: return parseFnCall(statementCtx.FunctionCall()) - case *parser.StatementContext: + case *antlrParser.StatementContext: return nil default: @@ -516,20 +529,20 @@ func parseStatement(statementCtx parser.IStatementContext) Statement { } } -func parseSentValue(statementCtx parser.ISentValueContext) SentValue { +func parseSentValue(statementCtx antlrParser.ISentValueContext) SentValue { switch statementCtx := statementCtx.(type) { - case *parser.SentLiteralContext: + case *antlrParser.SentLiteralContext: return &SentValueLiteral{ Range: ctxToRange(statementCtx), Monetary: parseValueExpr(statementCtx.ValueExpr()), } - case *parser.SentAllContext: + case *antlrParser.SentAllContext: return &SentValueAll{ Range: ctxToRange(statementCtx), Asset: parseValueExpr(statementCtx.SentAllLit().GetAsset()), } - case *parser.SentValueContext: + case *antlrParser.SentValueContext: return nil default: @@ -538,7 +551,7 @@ func parseSentValue(statementCtx parser.ISentValueContext) SentValue { } -func parseSendStatement(statementCtx *parser.SendStatementContext) *SendStatement { +func parseSendStatement(statementCtx *antlrParser.SendStatementContext) *SendStatement { return &SendStatement{ Source: parseSource(statementCtx.Source()), Destination: parseDestination(statementCtx.Destination()), @@ -562,7 +575,7 @@ func parseNumberLiteral(numNode antlr.TerminalNode) *NumberLiteral { } } -func parseMonetaryLit(monetaryLitCtx parser.IMonetaryLitContext) *MonetaryLiteral { +func parseMonetaryLit(monetaryLitCtx antlrParser.IMonetaryLitContext) *MonetaryLiteral { if monetaryLitCtx.GetAmt() == nil { return nil } diff --git a/internal/parser/parser_test.go b/internal/parser/parser_test.go index ff1d644f..a67afa75 100644 --- a/internal/parser/parser_test.go +++ b/internal/parser/parser_test.go @@ -25,6 +25,7 @@ func TestPlainAddress(t *testing.T) { source = @src destination = @dest )`) + require.Empty(t, p.Errors) snaps.MatchSnapshot(t, p.Value) } @@ -418,3 +419,21 @@ set_tx_meta("k1", 10/$y) require.Len(t, p.Errors, 0) snaps.MatchSnapshot(t, p.Value) } + +func TestStringTemplate(t *testing.T) { + p := parser.Parse( + "set_tx_meta(0, 42)", + ) + + require.Len(t, p.Errors, 0) + snaps.MatchSnapshot(t, p.Value) +} + +func TestInterpAccount(t *testing.T) { + p := parser.Parse( + "set_tx_meta(@abc:cde:$id, 42)", + ) + + require.Len(t, p.Errors, 0) + snaps.MatchSnapshot(t, p.Value) +}