diff --git a/Lexer.g4 b/Lexer.g4 index f1b46b11..59d39b13 100644 --- a/Lexer.g4 +++ b/Lexer.g4 @@ -31,6 +31,7 @@ STAR: '*'; PLUS: '+'; MINUS: '-'; DIV: '/'; +RESTRICT: '\\'; PERCENTAGE_PORTION_LITERAL: [0-9]+ ('.' [0-9]+)? '%'; diff --git a/Numscript.g4 b/Numscript.g4 index a088711d..7aa15d61 100644 --- a/Numscript.g4 +++ b/Numscript.g4 @@ -41,11 +41,13 @@ allotment: valueExpr # portionedAllotment | REMAINING # remainingAllotment; +colorConstraint: RESTRICT valueExpr; + source: - address = valueExpr ALLOWING UNBOUNDED OVERDRAFT # srcAccountUnboundedOverdraft - | address = valueExpr ALLOWING OVERDRAFT UP TO maxOvedraft = valueExpr # + address = valueExpr colorConstraint? ALLOWING UNBOUNDED OVERDRAFT # srcAccountUnboundedOverdraft + | address = valueExpr colorConstraint? ALLOWING OVERDRAFT UP TO maxOvedraft = valueExpr # srcAccountBoundedOverdraft - | valueExpr # srcAccount + | valueExpr colorConstraint? # srcAccount | LBRACE allotmentClauseSrc+ RBRACE # srcAllotment | LBRACE source* RBRACE # srcInorder | ONEOF LBRACE source+ RBRACE # srcOneof diff --git a/internal/analysis/check.go b/internal/analysis/check.go index 2b387597..46994ddc 100644 --- a/internal/analysis/check.go +++ b/internal/analysis/check.go @@ -476,6 +476,7 @@ func (res *CheckResult) checkSource(source parser.Source) { switch source := source.(type) { case *parser.SourceAccount: res.checkExpression(source.ValueExpr, TypeAccount) + res.checkExpression(source.Color, TypeString) if account, ok := source.ValueExpr.(*parser.AccountInterpLiteral); ok { if account.IsWorld() && res.unboundedSend { res.pushDiagnostic(source.GetRange(), InvalidUnboundedAccount{}) @@ -483,11 +484,21 @@ func (res *CheckResult) checkSource(source parser.Source) { res.unboundedAccountInSend = account } - if _, emptied := res.emptiedAccount[account.String()]; emptied && !account.IsWorld() { + coloredAccountName := account.String() + switch col := source.Color.(type) { + case *parser.Variable: + coloredAccountName += "\\$" + col.Name + case *parser.StringLiteral: + if col.String != "" { + coloredAccountName += "\\\"" + col.String + "\"" + } + } + + if _, emptied := res.emptiedAccount[coloredAccountName]; emptied && !account.IsWorld() { res.pushDiagnostic(account.Range, EmptiedAccount{Name: account.String()}) } - res.emptiedAccount[account.String()] = struct{}{} + res.emptiedAccount[coloredAccountName] = struct{}{} } case *parser.SourceOverdraft: @@ -507,6 +518,7 @@ func (res *CheckResult) checkSource(source parser.Source) { } res.checkExpression(source.Address, TypeAccount) + res.checkExpression(source.Color, TypeString) if source.Bounded != nil { res.checkExpression(*source.Bounded, TypeMonetary) } diff --git a/internal/analysis/check_test.go b/internal/analysis/check_test.go index 221de9fd..33cb3d4e 100644 --- a/internal/analysis/check_test.go +++ b/internal/analysis/check_test.go @@ -861,3 +861,69 @@ send $m ( source = @world destination = @dest) checkSource(input), ) } + +func TestCheckColorVar(t *testing.T) { + t.Parallel() + + input := ` + send [COIN 100] ( + source = { + @a \ $col1 + @b \ $col2 allowing unbounded overdraft + } + destination = @dest +)` + + require.Equal(t, + []analysis.Diagnostic{ + { + Range: parser.RangeOfIndexed(input, "$col1", 0), + Kind: analysis.UnboundVariable{Name: "col1", Type: "string"}, + }, + { + Range: parser.RangeOfIndexed(input, "$col2", 0), + Kind: analysis.UnboundVariable{Name: "col2", Type: "string"}, + }, + }, + checkSource(input), + ) +} + +func TestInorderRedundantWhenColored(t *testing.T) { + t.Parallel() + + input := `send [COIN 100] ( + source = { + @a + @a \ "x" + } + destination = @dest +)` + + require.Equal(t, + []analysis.Diagnostic(nil), + checkSource(input), + ) +} + +func TestInorderRedundantWhenEmptyColored(t *testing.T) { + t.Parallel() + + input := `send [COIN 100] ( + source = { + @a + @a \ "" // <- empty color behaves as no color + } + destination = @dest +)` + + require.Equal(t, + []analysis.Diagnostic{ + { + Range: parser.RangeOfIndexed(input, "@a", 1), + Kind: analysis.EmptiedAccount{Name: "a"}, + }, + }, + checkSource(input), + ) +} diff --git a/internal/flags/flags.go b/internal/flags/flags.go index e17bb826..0cc593d4 100644 --- a/internal/flags/flags.go +++ b/internal/flags/flags.go @@ -9,6 +9,7 @@ const ( ExperimentalOneofFeatureFlag FeatureFlag = "experimental-oneof" ExperimentalAccountInterpolationFlag FeatureFlag = "experimental-account-interpolation" ExperimentalMidScriptFunctionCall FeatureFlag = "experimental-mid-script-function-call" + ExperimentalAssetColors FeatureFlag = "experimental-asset-colors" ) var AllFlags []string = []string{ @@ -18,4 +19,5 @@ var AllFlags []string = []string{ ExperimentalOneofFeatureFlag, ExperimentalAccountInterpolationFlag, ExperimentalMidScriptFunctionCall, + ExperimentalAssetColors, } diff --git a/internal/interpreter/balances.go b/internal/interpreter/balances.go index 1c952d9f..312ab3fb 100644 --- a/internal/interpreter/balances.go +++ b/internal/interpreter/balances.go @@ -2,6 +2,7 @@ package interpreter import ( "math/big" + "strings" "github.com/formancehq/numscript/internal/utils" ) @@ -12,6 +13,21 @@ func (b Balances) fetchAccountBalances(account string) AccountBalance { }) } +func coloredAsset(asset string, color *string) string { + if color == nil || *color == "" { + return asset + } + + // note: 1 <= len(parts) <= 2 + parts := strings.Split(asset, "/") + + coloredAsset := parts[0] + "_" + *color + if len(parts) > 1 { + coloredAsset += "/" + parts[1] + } + return coloredAsset +} + // Get the (account, asset) tuple from the Balances // if the tuple is not present, it will write a big.NewInt(0) in it and return it func (b Balances) fetchBalance(account string, asset string) *big.Int { diff --git a/internal/interpreter/batch_balances_query.go b/internal/interpreter/batch_balances_query.go index 68454241..af1c58f3 100644 --- a/internal/interpreter/batch_balances_query.go +++ b/internal/interpreter/batch_balances_query.go @@ -31,7 +31,7 @@ func (st *programState) findBalancesQueriesInStatement(statement parser.Statemen if err != nil { return err } - st.batchQuery(*account, *asset) + st.batchQuery(*account, *asset, nil) return nil case *parser.SendStatement: @@ -50,10 +50,11 @@ func (st *programState) findBalancesQueriesInStatement(statement parser.Statemen } } -func (st *programState) batchQuery(account string, asset string) { +func (st *programState) batchQuery(account string, asset string, color *string) { if account == "world" { return } + asset = coloredAsset(asset, color) previousValues := st.CurrentBalanceQuery[account] if !slices.Contains(previousValues, asset) { @@ -89,7 +90,12 @@ func (st *programState) findBalancesQueries(source parser.Source) InterpreterErr return err } - st.batchQuery(*account, st.CurrentAsset) + color, err := evaluateOptExprAs(st, source.Color, expectString) + if err != nil { + return err + } + + st.batchQuery(*account, st.CurrentAsset, color) return nil case *parser.SourceOverdraft: @@ -102,7 +108,12 @@ func (st *programState) findBalancesQueries(source parser.Source) InterpreterErr if err != nil { return err } - st.batchQuery(*account, st.CurrentAsset) + color, err := evaluateOptExprAs(st, source.Color, expectString) + if err != nil { + return err + } + + st.batchQuery(*account, st.CurrentAsset, color) return nil case *parser.SourceInorder: diff --git a/internal/interpreter/evaluate_expr.go b/internal/interpreter/evaluate_expr.go index 5e3031c2..2fb07289 100644 --- a/internal/interpreter/evaluate_expr.go +++ b/internal/interpreter/evaluate_expr.go @@ -101,6 +101,13 @@ func (st *programState) evaluateExpr(expr parser.ValueExpr) (Value, InterpreterE } } +func evaluateOptExprAs[T any](st *programState, expr parser.ValueExpr, expect func(Value, parser.Range) (*T, InterpreterError)) (*T, InterpreterError) { + if expr == nil { + return nil, nil + } + return evaluateExprAs(st, expr, expect) +} + func evaluateExprAs[T any](st *programState, expr parser.ValueExpr, expect func(Value, parser.Range) (*T, InterpreterError)) (*T, InterpreterError) { value, err := st.evaluateExpr(expr) if err != nil { @@ -127,6 +134,26 @@ func (st *programState) evaluateExpressions(literals []parser.ValueExpr) ([]Valu return values, nil } +func (s *programState) evaluateColor(colorExpr parser.ValueExpr) (*string, InterpreterError) { + color, err := evaluateOptExprAs(s, colorExpr, expectString) + if err != nil { + return nil, err + } + if color == nil { + return nil, nil + } + + isValidColor := colorRe.Match([]byte(*color)) + if !isValidColor { + return nil, InvalidColor{ + Range: colorExpr.GetRange(), + Color: *color, + } + } + + return color, nil +} + func (st *programState) plusOp(left parser.ValueExpr, right parser.ValueExpr) (Value, InterpreterError) { leftValue, err := evaluateExprAs(st, left, expectOneOf( expectMapped(expectMonetary, func(m Monetary) opAdd { diff --git a/internal/interpreter/interpreter.go b/internal/interpreter/interpreter.go index e5240ad6..e4607c3b 100644 --- a/internal/interpreter/interpreter.go +++ b/internal/interpreter/interpreter.go @@ -301,11 +301,11 @@ type programState struct { FeatureFlags map[string]struct{} } -func (st *programState) pushSender(name string, monetary *big.Int) { +func (st *programState) pushSender(name string, monetary *big.Int, color *string) { if monetary.Cmp(big.NewInt(0)) == 0 { return } - st.Senders = append(st.Senders, Sender{Name: name, Monetary: monetary}) + st.Senders = append(st.Senders, Sender{Name: name, Monetary: monetary, Color: color}) } func (st *programState) pushReceiver(name string, monetary *big.Int) { @@ -455,7 +455,14 @@ func (st *programState) runSendStatement(statement parser.SendStatement) ([]Post } -func (s *programState) sendAllToAccount(accountLiteral parser.ValueExpr, ovedraft *big.Int) (*big.Int, InterpreterError) { +func (s *programState) sendAllToAccount(accountLiteral parser.ValueExpr, ovedraft *big.Int, colorExpr parser.ValueExpr) (*big.Int, InterpreterError) { + if colorExpr != nil { + err := s.checkFeatureFlag(flags.ExperimentalAssetColors) + if err != nil { + return nil, err + } + } + account, err := evaluateExprAs(s, accountLiteral, expectAccount) if err != nil { return nil, err @@ -467,11 +474,16 @@ func (s *programState) sendAllToAccount(accountLiteral parser.ValueExpr, ovedraf } } - balance := s.CachedBalances.fetchBalance(*account, s.CurrentAsset) + color, err := s.evaluateColor(colorExpr) + if err != nil { + return nil, err + } + + balance := s.CachedBalances.fetchBalance(*account, coloredAsset(s.CurrentAsset, color)) // we sent balance+overdraft sentAmt := utils.MaxBigInt(new(big.Int).Add(balance, ovedraft), big.NewInt(0)) - s.pushSender(*account, sentAmt) + s.pushSender(*account, sentAmt, color) return sentAmt, nil } @@ -479,7 +491,7 @@ func (s *programState) sendAllToAccount(accountLiteral parser.ValueExpr, ovedraf func (s *programState) sendAll(source parser.Source) (*big.Int, InterpreterError) { switch source := source.(type) { case *parser.SourceAccount: - return s.sendAllToAccount(source.ValueExpr, big.NewInt(0)) + return s.sendAllToAccount(source.ValueExpr, big.NewInt(0), source.Color) case *parser.SourceOverdraft: var cap *big.Int @@ -490,7 +502,7 @@ func (s *programState) sendAll(source parser.Source) (*big.Int, InterpreterError } cap = bounded } - return s.sendAllToAccount(source.Address, cap) + return s.sendAllToAccount(source.Address, cap, source.Color) case *parser.SourceInorder: totalSent := big.NewInt(0) @@ -550,7 +562,16 @@ func (s *programState) trySendingExact(source parser.Source, amount *big.Int) In return nil } -func (s *programState) trySendingToAccount(accountLiteral parser.ValueExpr, amount *big.Int, overdraft *big.Int) (*big.Int, InterpreterError) { +var colorRe = regexp.MustCompile("^[A-Z]*$") + +func (s *programState) trySendingToAccount(accountLiteral parser.ValueExpr, amount *big.Int, overdraft *big.Int, colorExpr parser.ValueExpr) (*big.Int, InterpreterError) { + if colorExpr != nil { + err := s.checkFeatureFlag(flags.ExperimentalAssetColors) + if err != nil { + return nil, err + } + } + account, err := evaluateExprAs(s, accountLiteral, expectAccount) if err != nil { return nil, err @@ -559,19 +580,24 @@ func (s *programState) trySendingToAccount(accountLiteral parser.ValueExpr, amou overdraft = nil } + color, err := s.evaluateColor(colorExpr) + if err != nil { + return nil, err + } + var actuallySentAmt *big.Int if overdraft == nil { // unbounded overdraft: we send the required amount actuallySentAmt = new(big.Int).Set(amount) } else { - balance := s.CachedBalances.fetchBalance(*account, s.CurrentAsset) + balance := s.CachedBalances.fetchBalance(*account, coloredAsset(s.CurrentAsset, color)) // that's the amount we are allowed to send (balance + overdraft) safeSendAmt := new(big.Int).Add(balance, overdraft) actuallySentAmt = utils.MinBigInt(safeSendAmt, amount) } - s.pushSender(*account, actuallySentAmt) + s.pushSender(*account, actuallySentAmt, color) return actuallySentAmt, nil } @@ -580,7 +606,7 @@ func (s *programState) trySendingToAccount(accountLiteral parser.ValueExpr, amou func (s *programState) trySendingUpTo(source parser.Source, amount *big.Int) (*big.Int, InterpreterError) { switch source := source.(type) { case *parser.SourceAccount: - return s.trySendingToAccount(source.ValueExpr, amount, big.NewInt(0)) + return s.trySendingToAccount(source.ValueExpr, amount, big.NewInt(0), source.Color) case *parser.SourceOverdraft: var cap *big.Int @@ -591,7 +617,7 @@ func (s *programState) trySendingUpTo(source parser.Source, amount *big.Int) (*b } cap = upTo } - return s.trySendingToAccount(source.Address, amount, cap) + return s.trySendingToAccount(source.Address, amount, cap, source.Color) case *parser.SourceInorder: totalLeft := new(big.Int).Set(amount) @@ -851,7 +877,7 @@ func getBalance( account string, asset string, ) (*big.Int, InterpreterError) { - s.batchQuery(account, asset) + s.batchQuery(account, asset, nil) fetchBalanceErr := s.runBalancesQuery() if fetchBalanceErr != nil { return nil, QueryBalanceError{WrappedError: fetchBalanceErr} diff --git a/internal/interpreter/interpreter_error.go b/internal/interpreter/interpreter_error.go index c35f0643..3b791976 100644 --- a/internal/interpreter/interpreter_error.go +++ b/internal/interpreter/interpreter_error.go @@ -228,3 +228,12 @@ type InvalidNestedMeta struct { func (InvalidNestedMeta) Error() string { return "Invalid usage of meta() function: the meta function cannot be nested in a sub-expression." } + +type InvalidColor struct { + parser.Range + Color string +} + +func (e InvalidColor) Error() string { + return fmt.Sprintf("Invalid color name: '%s'. Only uppercase letters are allowed.", e.Color) +} diff --git a/internal/interpreter/interpreter_test.go b/internal/interpreter/interpreter_test.go index f283cb2d..e5c15368 100644 --- a/internal/interpreter/interpreter_test.go +++ b/internal/interpreter/interpreter_test.go @@ -4194,3 +4194,241 @@ func TestGetAmountFunction(t *testing.T) { } testWithFeatureFlag(t, tc, flags.ExperimentalGetAmountFunctionFeatureFlag) } + +func TestColorSend(t *testing.T) { + script := ` + send [COIN 100] ( + source = @world \ "RED" + destination = @dest + ) + ` + + tc := NewTestCase() + tc.compile(t, script) + tc.expected = CaseResult{ + Postings: []Posting{ + { + Asset: "COIN_RED", + Amount: big.NewInt(100), + Source: "world", + Destination: "dest", + }, + }, + Error: nil, + } + testWithFeatureFlag(t, tc, flags.ExperimentalAssetColors) +} + +func TestColorSendOverdrat(t *testing.T) { + script := ` + send [COIN 100] ( + source = @acc \ "RED" allowing unbounded overdraft + destination = @dest + ) + ` + + tc := NewTestCase() + tc.compile(t, script) + tc.expected = CaseResult{ + Postings: []Posting{ + { + Asset: "COIN_RED", + Amount: big.NewInt(100), + Source: "acc", + Destination: "dest", + }, + }, + Error: nil, + } + testWithFeatureFlag(t, tc, flags.ExperimentalAssetColors) +} + +func TestColorRestrictBalance(t *testing.T) { + script := ` + send [COIN 20] ( + source = @acc \ "RED" + destination = @dest + ) + ` + + tc := NewTestCase() + tc.setBalance("acc", "COIN", 1) + tc.setBalance("acc", "COIN_RED", 100) + tc.compile(t, script) + + tc.expected = CaseResult{ + Postings: []Posting{ + { + Asset: "COIN_RED", + Amount: big.NewInt(20), + Source: "acc", + Destination: "dest", + }, + }, + Error: nil, + } + testWithFeatureFlag(t, tc, flags.ExperimentalAssetColors) +} + +func TestColorRestrictBalanceWhenMissingFunds(t *testing.T) { + script := ` + send [COIN 20] ( + source = @acc \ "RED" + destination = @dest + ) + ` + + tc := NewTestCase() + tc.setBalance("acc", "COIN", 100) + tc.setBalance("acc", "COIN_RED", 1) + tc.compile(t, script) + + tc.expected = CaseResult{ + Postings: []Posting{}, + Error: machine.MissingFundsErr{ + Needed: *big.NewInt(20), + Available: *big.NewInt(1), + Asset: "COIN", + }, + } + testWithFeatureFlag(t, tc, flags.ExperimentalAssetColors) +} + +func TestColorRestrictionInSendAll(t *testing.T) { + script := ` + send [COIN *] ( + source = @src \ "RED" + destination = @dest + ) + ` + + tc := NewTestCase() + + tc.setBalance("src", "COIN_RED", 42) + tc.compile(t, script) + + tc.expected = CaseResult{ + Postings: []Posting{{ + Asset: "COIN_RED", + Amount: big.NewInt(42), + Source: "src", + Destination: "dest", + }}, + } + testWithFeatureFlag(t, tc, flags.ExperimentalAssetColors) +} + +func TestColorInorder(t *testing.T) { + + script := ` + send [COIN 100] ( + source = { + @src \ "RED" + @src \ "BLUE" + @src + } + destination = @dest + ) + ` + + tc := NewTestCase() + tc.setBalance("src", "COIN", 100) + tc.setBalance("src", "COIN_RED", 20) + tc.setBalance("src", "COIN_BLUE", 30) + tc.compile(t, script) + + tc.expected = CaseResult{ + Postings: []Posting{ + { + Asset: "COIN_RED", + Amount: big.NewInt(20), + Source: "src", + Destination: "dest", + }, + { + Asset: "COIN_BLUE", + Amount: big.NewInt(30), + Source: "src", + Destination: "dest", + }, + { + Asset: "COIN", + Amount: big.NewInt(50), + Source: "src", + Destination: "dest", + }, + }, + } + testWithFeatureFlag(t, tc, flags.ExperimentalAssetColors) +} + +func TestEmptyColor(t *testing.T) { + // empty string color behaves as no color + + script := ` + send [COIN *] ( + source = @src \ "" // <- same as just '@src' + destination = @dest + ) + ` + + tc := NewTestCase() + tc.setBalance("src", "COIN", 100) + tc.compile(t, script) + + tc.expected = CaseResult{ + Postings: []Posting{ + { + Asset: "COIN", + Amount: big.NewInt(100), + Source: "src", + Destination: "dest", + }, + }, + } + testWithFeatureFlag(t, tc, flags.ExperimentalAssetColors) +} + +func TestColorWithAssetPrecision(t *testing.T) { + script := ` + send [USD/4 10] ( + source = @src \ "COL" allowing unbounded overdraft + destination = @dest + ) + ` + + tc := NewTestCase() + tc.compile(t, script) + + tc.expected = CaseResult{ + Postings: []Posting{ + { + Asset: "USD_COL/4", + Amount: big.NewInt(10), + Source: "src", + Destination: "dest", + }, + }, + } + testWithFeatureFlag(t, tc, flags.ExperimentalAssetColors) +} + +func TestInvalidColor(t *testing.T) { + script := ` + send [USD 10] ( + source = @src \ "!!" allowing unbounded overdraft + destination = @dest + ) + ` + + tc := NewTestCase() + tc.compile(t, script) + + tc.expected = CaseResult{ + Error: machine.InvalidColor{ + Color: "!!", + Range: parser.RangeOfIndexed(script, `"!!"`, 0), + }, + } + testWithFeatureFlag(t, tc, flags.ExperimentalAssetColors) +} diff --git a/internal/interpreter/reconciler.go b/internal/interpreter/reconciler.go index 7f97f75a..bdd7567d 100644 --- a/internal/interpreter/reconciler.go +++ b/internal/interpreter/reconciler.go @@ -25,6 +25,7 @@ func (e ReconcileError) Error() string { type Sender struct { Name string Monetary *big.Int + Color *string } type Receiver struct { @@ -77,17 +78,16 @@ func Reconcile(asset string, senders []Sender, receivers []Receiver) ([]Posting, case 0: /* sender.Monetary == receiver.Monetary */ postingAmount = *sender.Monetary case -1: /* sender.Monetary < receiver.Monetary */ - var monetary big.Int receivers = append(receivers, Receiver{ Name: receiver.Name, - Monetary: monetary.Sub(receiver.Monetary, sender.Monetary), + Monetary: new(big.Int).Sub(receiver.Monetary, sender.Monetary), }) postingAmount = *sender.Monetary case 1: /* sender.Monetary > receiver.Monetary */ - var monetary big.Int senders = append(senders, Sender{ Name: sender.Name, - Monetary: monetary.Sub(sender.Monetary, receiver.Monetary), + Monetary: new(big.Int).Sub(sender.Monetary, receiver.Monetary), + Color: sender.Color, }) postingAmount = *receiver.Monetary } @@ -100,12 +100,12 @@ func Reconcile(asset string, senders []Sender, receivers []Receiver) ([]Posting, } } - if postingToMerge == nil { + if postingToMerge == nil || postingToMerge.Asset != coloredAsset(asset, sender.Color) { postings = append(postings, Posting{ Source: sender.Name, Destination: receiver.Name, Amount: &postingAmount, - Asset: asset, + Asset: coloredAsset(asset, sender.Color), }) } else { // postingToMerge.Amount += postingAmount diff --git a/internal/interpreter/reconciler_test.go b/internal/interpreter/reconciler_test.go index cb09227a..505b4b2e 100644 --- a/internal/interpreter/reconciler_test.go +++ b/internal/interpreter/reconciler_test.go @@ -36,7 +36,7 @@ func TestReconcileEmpty(t *testing.T) { func TestReconcileSingletonExactMatch(t *testing.T) { runReconcileTestCase(t, ReconcileTestCase{ Currency: "COIN", - Senders: []Sender{{"src", big.NewInt(10)}}, + Senders: []Sender{{"src", big.NewInt(10), nil}}, Receivers: []Receiver{{"dest", big.NewInt(10)}}, Expected: []Posting{{"src", "dest", big.NewInt(10), "COIN"}}, }) @@ -45,7 +45,7 @@ func TestReconcileSingletonExactMatch(t *testing.T) { func TestReconcileZero(t *testing.T) { runReconcileTestCase(t, ReconcileTestCase{ Currency: "COIN", - Senders: []Sender{{"src", big.NewInt(0)}}, + Senders: []Sender{{"src", big.NewInt(0), nil}}, Receivers: []Receiver{{"dest", big.NewInt(0)}}, Expected: []Posting{ {"src", "dest", big.NewInt(0), "COIN"}, @@ -59,6 +59,7 @@ func TestNoReceiversLeft(t *testing.T) { Senders: []Sender{{ "src", big.NewInt(10), + nil, }}, }) } @@ -66,7 +67,7 @@ func TestNoReceiversLeft(t *testing.T) { func TestReconcileSendersRemainder(t *testing.T) { runReconcileTestCase(t, ReconcileTestCase{ Currency: "EUR", - Senders: []Sender{{"src", big.NewInt(100)}}, + Senders: []Sender{{"src", big.NewInt(100), nil}}, Receivers: []Receiver{ { "d1", @@ -87,8 +88,8 @@ func TestReconcileWhenSendersAreSplit(t *testing.T) { runReconcileTestCase(t, ReconcileTestCase{ Currency: "EUR", Senders: []Sender{ - {"s1", big.NewInt(20)}, - {"s2", big.NewInt(30)}, + {"s1", big.NewInt(20), nil}, + {"s2", big.NewInt(30), nil}, }, Receivers: []Receiver{{"d", big.NewInt(50)}}, Expected: []Posting{ @@ -102,8 +103,8 @@ func TestMany(t *testing.T) { runReconcileTestCase(t, ReconcileTestCase{ Currency: "EUR", Senders: []Sender{ - {"s1", big.NewInt(80 + 20)}, - {"s2", big.NewInt(1000)}, + {"s1", big.NewInt(80 + 20), nil}, + {"s2", big.NewInt(1000), nil}, }, Receivers: []Receiver{ {"d1", big.NewInt(80)}, @@ -121,8 +122,8 @@ func TestReconcileManySendersManyReceivers(t *testing.T) { runReconcileTestCase(t, ReconcileTestCase{ Currency: "EUR", Senders: []Sender{ - {"s1", big.NewInt(80 + 20)}, - {"s2", big.NewInt(1000)}, + {"s1", big.NewInt(80 + 20), nil}, + {"s2", big.NewInt(1000), nil}, }, Receivers: []Receiver{ {"d1", big.NewInt(80)}, @@ -140,9 +141,9 @@ func TestReconcileOverlapping(t *testing.T) { runReconcileTestCase(t, ReconcileTestCase{ Currency: "EUR", Senders: []Sender{ - {"src1", big.NewInt(1)}, - {"src2", big.NewInt(10)}, - {"src2", big.NewInt(20)}, + {"src1", big.NewInt(1), nil}, + {"src2", big.NewInt(10), nil}, + {"src2", big.NewInt(20), nil}, }, Receivers: []Receiver{{"d", big.NewInt(31)}}, Expected: []Posting{ @@ -156,7 +157,7 @@ func TestReconcileKept(t *testing.T) { runReconcileTestCase(t, ReconcileTestCase{ Currency: "GEM", Senders: []Sender{ - {"src", big.NewInt(100)}, + {"src", big.NewInt(100), nil}, }, Receivers: []Receiver{ {"dest", big.NewInt(50)}, @@ -166,3 +167,52 @@ func TestReconcileKept(t *testing.T) { }, }) } + +func TestReconcileColoredAssetExactMatch(t *testing.T) { + runReconcileTestCase(t, ReconcileTestCase{ + Currency: "COIN", + Senders: []Sender{ + {"src", big.NewInt(10), pointer("x")}, + }, + Receivers: []Receiver{{"dest", big.NewInt(10)}}, + Expected: []Posting{{"src", "dest", big.NewInt(10), "COIN_x"}}, + }) +} + +func TestReconcileColoredManyDestPerSender(t *testing.T) { + runReconcileTestCase(t, ReconcileTestCase{ + Currency: "COIN", + Senders: []Sender{ + {"src", big.NewInt(10), pointer("x")}, + }, + Receivers: []Receiver{ + {"d1", big.NewInt(5)}, + {"d2", big.NewInt(5)}, + }, + Expected: []Posting{ + {"src", "d1", big.NewInt(5), "COIN_x"}, + {"src", "d2", big.NewInt(5), "COIN_x"}, + }, + }) +} + +func TestReconcileColoredManySenderColors(t *testing.T) { + runReconcileTestCase(t, ReconcileTestCase{ + Currency: "COIN", + Senders: []Sender{ + {"src", big.NewInt(1), pointer("c1")}, + {"src", big.NewInt(1), pointer("c2")}, + }, + Receivers: []Receiver{ + {"dest", big.NewInt(2)}, + }, + Expected: []Posting{ + {"src", "dest", big.NewInt(1), "COIN_c1"}, + {"src", "dest", big.NewInt(1), "COIN_c2"}, + }, + }) +} + +func pointer[T any](x T) *T { + return &x +} diff --git a/internal/parser/__snapshots__/parser_fault_tolerance_test.snap b/internal/parser/__snapshots__/parser_fault_tolerance_test.snap index 11842ffc..b527f1d5 100755 --- a/internal/parser/__snapshots__/parser_fault_tolerance_test.snap +++ b/internal/parser/__snapshots__/parser_fault_tolerance_test.snap @@ -125,6 +125,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:13, Line:1}, @@ -270,6 +271,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, diff --git a/internal/parser/__snapshots__/parser_test.snap b/internal/parser/__snapshots__/parser_test.snap index a445cae8..13841727 100755 --- a/internal/parser/__snapshots__/parser_test.snap +++ b/internal/parser/__snapshots__/parser_test.snap @@ -34,6 +34,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, @@ -97,6 +98,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.Variable{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, @@ -190,6 +192,7 @@ parser.Program{ }, }, From: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:22, Line:1}, @@ -280,6 +283,7 @@ parser.Program{ }, }, From: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:13, Line:2}, @@ -320,6 +324,7 @@ parser.Program{ }, }, From: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:10, Line:3}, @@ -343,6 +348,7 @@ parser.Program{ }, }, From: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:16, Line:4}, @@ -433,6 +439,7 @@ parser.Program{ }, }, From: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:24, Line:1}, @@ -499,6 +506,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, @@ -606,6 +614,7 @@ parser.Program{ End: parser.Position{Character:35, Line:1}, }, From: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:31, Line:1}, @@ -695,6 +704,7 @@ parser.Program{ End: parser.Position{Character:32, Line:1}, }, From: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:28, Line:1}, @@ -777,6 +787,7 @@ parser.Program{ End: parser.Position{Character:27, Line:2}, }, From: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:23, Line:2}, @@ -809,6 +820,7 @@ parser.Program{ }, }, &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:1, Line:3}, @@ -820,6 +832,7 @@ parser.Program{ }, }, &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:1, Line:4}, @@ -885,6 +898,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:27, Line:1}, @@ -939,6 +953,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:27, Line:2}, @@ -1038,6 +1053,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, @@ -1101,6 +1117,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, @@ -1248,6 +1265,7 @@ parser.Program{ }, }, From: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:9, Line:2}, @@ -1305,6 +1323,7 @@ parser.Program{ Start: parser.Position{Character:10, Line:1}, End: parser.Position{Character:43, Line:1}, }, + Color: nil, Address: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:10, Line:1}, @@ -1360,6 +1379,7 @@ parser.Program{ Start: parser.Position{Character:10, Line:1}, End: parser.Position{Character:50, Line:1}, }, + Color: nil, Address: &parser.Variable{ Range: parser.Range{ Start: parser.Position{Character:10, Line:1}, @@ -1413,6 +1433,7 @@ parser.Program{ Start: parser.Position{Character:10, Line:1}, End: parser.Position{Character:57, Line:1}, }, + Color: nil, Address: &parser.Variable{ Range: parser.Range{ Start: parser.Position{Character:10, Line:1}, @@ -1708,6 +1729,7 @@ parser.Program{ }, Sources: { &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:13, Line:1}, @@ -1719,6 +1741,7 @@ parser.Program{ }, }, &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:17, Line:1}, @@ -1771,6 +1794,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, @@ -1889,6 +1913,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:10, Line:1}, @@ -1952,6 +1977,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, @@ -2034,6 +2060,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:2}, @@ -2156,6 +2183,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:11, Line:1}, @@ -2627,6 +2655,7 @@ parser.Program{ }, Sources: { &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:19, Line:1}, @@ -2638,6 +2667,7 @@ parser.Program{ }, }, &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:23, Line:1}, @@ -2690,6 +2720,7 @@ parser.Program{ }, }, Source: &parser.SourceAccount{ + Color: nil, ValueExpr: &parser.AccountInterpLiteral{ Range: parser.Range{ Start: parser.Position{Character:10, Line:1}, @@ -3190,3 +3221,188 @@ parser.Program{ Comments: nil, } --- + +[TestColorRestriction - 1] +parser.Program{ + Vars: (*parser.VarDeclarations)(nil), + Statements: { + &parser.SendStatement{ + Range: parser.Range{ + Start: parser.Position{}, + End: parser.Position{Character:1, Line:3}, + }, + SentValue: &parser.SentValueLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:5, Line:0}, + End: parser.Position{Character:10, Line:0}, + }, + Monetary: &parser.Variable{ + Range: parser.Range{ + Start: parser.Position{Character:5, Line:0}, + End: parser.Position{Character:10, Line:0}, + }, + Name: "sent", + }, + }, + Source: &parser.SourceAccount{ + Color: &parser.StringLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:16, Line:1}, + End: parser.Position{Character:21, Line:1}, + }, + String: "red", + }, + ValueExpr: &parser.AccountInterpLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:11, Line:1}, + End: parser.Position{Character:13, Line:1}, + }, + Parts: { + parser.AccountTextPart{Name:"s"}, + }, + }, + }, + Destination: &parser.DestinationAccount{ + ValueExpr: &parser.AccountInterpLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:16, Line:2}, + End: parser.Position{Character:21, Line:2}, + }, + Parts: { + parser.AccountTextPart{Name:"dest"}, + }, + }, + }, + }, + }, + Comments: nil, +} +--- + +[TestColorRestrictionBoundedOverdraft - 1] +parser.Program{ + Vars: (*parser.VarDeclarations)(nil), + Statements: { + &parser.SendStatement{ + Range: parser.Range{ + Start: parser.Position{}, + End: parser.Position{Character:1, Line:3}, + }, + SentValue: &parser.SentValueLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:5, Line:0}, + End: parser.Position{Character:10, Line:0}, + }, + Monetary: &parser.Variable{ + Range: parser.Range{ + Start: parser.Position{Character:5, Line:0}, + End: parser.Position{Character:10, Line:0}, + }, + Name: "sent", + }, + }, + Source: &parser.SourceOverdraft{ + Range: parser.Range{ + Start: parser.Position{Character:11, Line:1}, + End: parser.Position{Character:49, Line:1}, + }, + Color: &parser.StringLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:16, Line:1}, + End: parser.Position{Character:20, Line:1}, + }, + String: "cl", + }, + Address: &parser.AccountInterpLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:11, Line:1}, + End: parser.Position{Character:13, Line:1}, + }, + Parts: { + parser.AccountTextPart{Name:"s"}, + }, + }, + Bounded: &&parser.Variable{ + Range: parser.Range{ + Start: parser.Position{Character:46, Line:1}, + End: parser.Position{Character:49, Line:1}, + }, + Name: "ov", + }, + }, + Destination: &parser.DestinationAccount{ + ValueExpr: &parser.AccountInterpLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:16, Line:2}, + End: parser.Position{Character:21, Line:2}, + }, + Parts: { + parser.AccountTextPart{Name:"dest"}, + }, + }, + }, + }, + }, + Comments: nil, +} +--- + +[TestColorRestrictionUnboundedOverdraft - 1] +parser.Program{ + Vars: (*parser.VarDeclarations)(nil), + Statements: { + &parser.SendStatement{ + Range: parser.Range{ + Start: parser.Position{}, + End: parser.Position{Character:1, Line:3}, + }, + SentValue: &parser.SentValueLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:5, Line:0}, + End: parser.Position{Character:10, Line:0}, + }, + Monetary: &parser.Variable{ + Range: parser.Range{ + Start: parser.Position{Character:5, Line:0}, + End: parser.Position{Character:10, Line:0}, + }, + Name: "sent", + }, + }, + Source: &parser.SourceOverdraft{ + Range: parser.Range{ + Start: parser.Position{Character:11, Line:1}, + End: parser.Position{Character:51, Line:1}, + }, + Color: &parser.Variable{ + Range: parser.Range{ + Start: parser.Position{Character:18, Line:1}, + End: parser.Position{Character:22, Line:1}, + }, + Name: "col", + }, + Address: &parser.Variable{ + Range: parser.Range{ + Start: parser.Position{Character:11, Line:1}, + End: parser.Position{Character:15, Line:1}, + }, + Name: "acc", + }, + Bounded: (*parser.ValueExpr)(nil), + }, + Destination: &parser.DestinationAccount{ + ValueExpr: &parser.AccountInterpLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:16, Line:2}, + End: parser.Position{Character:21, Line:2}, + }, + Parts: { + parser.AccountTextPart{Name:"dest"}, + }, + }, + }, + }, + }, + Comments: nil, +} +--- diff --git a/internal/parser/antlrParser/Lexer.interp b/internal/parser/antlrParser/Lexer.interp index 8ebd6c69..b56a2642 100644 --- a/internal/parser/antlrParser/Lexer.interp +++ b/internal/parser/antlrParser/Lexer.interp @@ -31,6 +31,7 @@ null '+' '-' '/' +'\\' null null null @@ -75,6 +76,7 @@ STAR PLUS MINUS DIV +RESTRICT PERCENTAGE_PORTION_LITERAL STRING IDENTIFIER @@ -118,6 +120,7 @@ STAR PLUS MINUS DIV +RESTRICT PERCENTAGE_PORTION_LITERAL STRING IDENTIFIER @@ -139,4 +142,4 @@ 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, 1, 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, 2, 0, 323, 75, 1, 0, 0, 0, 324, 325, 5, 58, 0, 0, 325, 326, 1, 0, 0, 0, 326, 327, 6, 37, 2, 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, 3, 0, 346, 81, 1, 0, 0, 0, 347, 348, 3, 78, 38, 0, 348, 349, 1, 0, 0, 0, 349, 350, 6, 40, 3, 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, 4, 6, 0, 0, 0, 1, 0, 5, 1, 0, 4, 0, 0] \ No newline at end of file +[4, 0, 42, 357, 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, 2, 42, 7, 42, 1, 0, 4, 0, 90, 8, 0, 11, 0, 12, 0, 91, 1, 0, 1, 0, 1, 1, 4, 1, 97, 8, 1, 11, 1, 12, 1, 98, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 106, 8, 2, 10, 2, 12, 2, 109, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 5, 3, 120, 8, 3, 10, 3, 12, 3, 123, 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, 1, 31, 1, 32, 4, 32, 255, 8, 32, 11, 32, 12, 32, 256, 1, 32, 1, 32, 4, 32, 261, 8, 32, 11, 32, 12, 32, 262, 3, 32, 265, 8, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 5, 33, 273, 8, 33, 10, 33, 12, 33, 276, 9, 33, 1, 33, 1, 33, 1, 34, 4, 34, 281, 8, 34, 11, 34, 12, 34, 282, 1, 34, 5, 34, 286, 8, 34, 10, 34, 12, 34, 289, 9, 34, 1, 35, 3, 35, 292, 8, 35, 1, 35, 4, 35, 295, 8, 35, 11, 35, 12, 35, 296, 1, 35, 1, 35, 4, 35, 301, 8, 35, 11, 35, 12, 35, 302, 5, 35, 305, 8, 35, 10, 35, 12, 35, 308, 9, 35, 1, 36, 1, 36, 5, 36, 312, 8, 36, 10, 36, 12, 36, 315, 9, 36, 1, 36, 1, 36, 4, 36, 319, 8, 36, 11, 36, 12, 36, 320, 3, 36, 323, 8, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 4, 39, 335, 8, 39, 11, 39, 12, 39, 336, 1, 39, 5, 39, 340, 8, 39, 10, 39, 12, 39, 343, 9, 39, 1, 40, 4, 40, 346, 8, 40, 11, 40, 12, 40, 347, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 2, 107, 121, 0, 43, 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, 39, 80, 0, 82, 40, 84, 41, 86, 42, 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, 376, 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, 78, 1, 0, 0, 0, 0, 86, 1, 0, 0, 0, 1, 82, 1, 0, 0, 0, 1, 84, 1, 0, 0, 0, 2, 89, 1, 0, 0, 0, 4, 96, 1, 0, 0, 0, 6, 100, 1, 0, 0, 0, 8, 115, 1, 0, 0, 0, 10, 128, 1, 0, 0, 0, 12, 133, 1, 0, 0, 0, 14, 137, 1, 0, 0, 0, 16, 144, 1, 0, 0, 0, 18, 156, 1, 0, 0, 0, 20, 161, 1, 0, 0, 0, 22, 166, 1, 0, 0, 0, 24, 169, 1, 0, 0, 0, 26, 172, 1, 0, 0, 0, 28, 182, 1, 0, 0, 0, 30, 191, 1, 0, 0, 0, 32, 201, 1, 0, 0, 0, 34, 211, 1, 0, 0, 0, 36, 217, 1, 0, 0, 0, 38, 222, 1, 0, 0, 0, 40, 227, 1, 0, 0, 0, 42, 229, 1, 0, 0, 0, 44, 231, 1, 0, 0, 0, 46, 233, 1, 0, 0, 0, 48, 235, 1, 0, 0, 0, 50, 237, 1, 0, 0, 0, 52, 239, 1, 0, 0, 0, 54, 241, 1, 0, 0, 0, 56, 243, 1, 0, 0, 0, 58, 245, 1, 0, 0, 0, 60, 247, 1, 0, 0, 0, 62, 249, 1, 0, 0, 0, 64, 251, 1, 0, 0, 0, 66, 254, 1, 0, 0, 0, 68, 268, 1, 0, 0, 0, 70, 280, 1, 0, 0, 0, 72, 291, 1, 0, 0, 0, 74, 309, 1, 0, 0, 0, 76, 324, 1, 0, 0, 0, 78, 328, 1, 0, 0, 0, 80, 332, 1, 0, 0, 0, 82, 345, 1, 0, 0, 0, 84, 351, 1, 0, 0, 0, 86, 355, 1, 0, 0, 0, 88, 90, 7, 0, 0, 0, 89, 88, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 89, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 94, 6, 0, 0, 0, 94, 3, 1, 0, 0, 0, 95, 97, 7, 1, 0, 0, 96, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 96, 1, 0, 0, 0, 98, 99, 1, 0, 0, 0, 99, 5, 1, 0, 0, 0, 100, 101, 5, 47, 0, 0, 101, 102, 5, 42, 0, 0, 102, 107, 1, 0, 0, 0, 103, 106, 3, 6, 2, 0, 104, 106, 9, 0, 0, 0, 105, 103, 1, 0, 0, 0, 105, 104, 1, 0, 0, 0, 106, 109, 1, 0, 0, 0, 107, 108, 1, 0, 0, 0, 107, 105, 1, 0, 0, 0, 108, 110, 1, 0, 0, 0, 109, 107, 1, 0, 0, 0, 110, 111, 5, 42, 0, 0, 111, 112, 5, 47, 0, 0, 112, 113, 1, 0, 0, 0, 113, 114, 6, 2, 0, 0, 114, 7, 1, 0, 0, 0, 115, 116, 5, 47, 0, 0, 116, 117, 5, 47, 0, 0, 117, 121, 1, 0, 0, 0, 118, 120, 9, 0, 0, 0, 119, 118, 1, 0, 0, 0, 120, 123, 1, 0, 0, 0, 121, 122, 1, 0, 0, 0, 121, 119, 1, 0, 0, 0, 122, 124, 1, 0, 0, 0, 123, 121, 1, 0, 0, 0, 124, 125, 3, 4, 1, 0, 125, 126, 1, 0, 0, 0, 126, 127, 6, 3, 1, 0, 127, 9, 1, 0, 0, 0, 128, 129, 5, 118, 0, 0, 129, 130, 5, 97, 0, 0, 130, 131, 5, 114, 0, 0, 131, 132, 5, 115, 0, 0, 132, 11, 1, 0, 0, 0, 133, 134, 5, 109, 0, 0, 134, 135, 5, 97, 0, 0, 135, 136, 5, 120, 0, 0, 136, 13, 1, 0, 0, 0, 137, 138, 5, 115, 0, 0, 138, 139, 5, 111, 0, 0, 139, 140, 5, 117, 0, 0, 140, 141, 5, 114, 0, 0, 141, 142, 5, 99, 0, 0, 142, 143, 5, 101, 0, 0, 143, 15, 1, 0, 0, 0, 144, 145, 5, 100, 0, 0, 145, 146, 5, 101, 0, 0, 146, 147, 5, 115, 0, 0, 147, 148, 5, 116, 0, 0, 148, 149, 5, 105, 0, 0, 149, 150, 5, 110, 0, 0, 150, 151, 5, 97, 0, 0, 151, 152, 5, 116, 0, 0, 152, 153, 5, 105, 0, 0, 153, 154, 5, 111, 0, 0, 154, 155, 5, 110, 0, 0, 155, 17, 1, 0, 0, 0, 156, 157, 5, 115, 0, 0, 157, 158, 5, 101, 0, 0, 158, 159, 5, 110, 0, 0, 159, 160, 5, 100, 0, 0, 160, 19, 1, 0, 0, 0, 161, 162, 5, 102, 0, 0, 162, 163, 5, 114, 0, 0, 163, 164, 5, 111, 0, 0, 164, 165, 5, 109, 0, 0, 165, 21, 1, 0, 0, 0, 166, 167, 5, 117, 0, 0, 167, 168, 5, 112, 0, 0, 168, 23, 1, 0, 0, 0, 169, 170, 5, 116, 0, 0, 170, 171, 5, 111, 0, 0, 171, 25, 1, 0, 0, 0, 172, 173, 5, 114, 0, 0, 173, 174, 5, 101, 0, 0, 174, 175, 5, 109, 0, 0, 175, 176, 5, 97, 0, 0, 176, 177, 5, 105, 0, 0, 177, 178, 5, 110, 0, 0, 178, 179, 5, 105, 0, 0, 179, 180, 5, 110, 0, 0, 180, 181, 5, 103, 0, 0, 181, 27, 1, 0, 0, 0, 182, 183, 5, 97, 0, 0, 183, 184, 5, 108, 0, 0, 184, 185, 5, 108, 0, 0, 185, 186, 5, 111, 0, 0, 186, 187, 5, 119, 0, 0, 187, 188, 5, 105, 0, 0, 188, 189, 5, 110, 0, 0, 189, 190, 5, 103, 0, 0, 190, 29, 1, 0, 0, 0, 191, 192, 5, 117, 0, 0, 192, 193, 5, 110, 0, 0, 193, 194, 5, 98, 0, 0, 194, 195, 5, 111, 0, 0, 195, 196, 5, 117, 0, 0, 196, 197, 5, 110, 0, 0, 197, 198, 5, 100, 0, 0, 198, 199, 5, 101, 0, 0, 199, 200, 5, 100, 0, 0, 200, 31, 1, 0, 0, 0, 201, 202, 5, 111, 0, 0, 202, 203, 5, 118, 0, 0, 203, 204, 5, 101, 0, 0, 204, 205, 5, 114, 0, 0, 205, 206, 5, 100, 0, 0, 206, 207, 5, 114, 0, 0, 207, 208, 5, 97, 0, 0, 208, 209, 5, 102, 0, 0, 209, 210, 5, 116, 0, 0, 210, 33, 1, 0, 0, 0, 211, 212, 5, 111, 0, 0, 212, 213, 5, 110, 0, 0, 213, 214, 5, 101, 0, 0, 214, 215, 5, 111, 0, 0, 215, 216, 5, 102, 0, 0, 216, 35, 1, 0, 0, 0, 217, 218, 5, 107, 0, 0, 218, 219, 5, 101, 0, 0, 219, 220, 5, 112, 0, 0, 220, 221, 5, 116, 0, 0, 221, 37, 1, 0, 0, 0, 222, 223, 5, 115, 0, 0, 223, 224, 5, 97, 0, 0, 224, 225, 5, 118, 0, 0, 225, 226, 5, 101, 0, 0, 226, 39, 1, 0, 0, 0, 227, 228, 5, 40, 0, 0, 228, 41, 1, 0, 0, 0, 229, 230, 5, 41, 0, 0, 230, 43, 1, 0, 0, 0, 231, 232, 5, 91, 0, 0, 232, 45, 1, 0, 0, 0, 233, 234, 5, 93, 0, 0, 234, 47, 1, 0, 0, 0, 235, 236, 5, 123, 0, 0, 236, 49, 1, 0, 0, 0, 237, 238, 5, 125, 0, 0, 238, 51, 1, 0, 0, 0, 239, 240, 5, 44, 0, 0, 240, 53, 1, 0, 0, 0, 241, 242, 5, 61, 0, 0, 242, 55, 1, 0, 0, 0, 243, 244, 5, 42, 0, 0, 244, 57, 1, 0, 0, 0, 245, 246, 5, 43, 0, 0, 246, 59, 1, 0, 0, 0, 247, 248, 5, 45, 0, 0, 248, 61, 1, 0, 0, 0, 249, 250, 5, 47, 0, 0, 250, 63, 1, 0, 0, 0, 251, 252, 5, 92, 0, 0, 252, 65, 1, 0, 0, 0, 253, 255, 7, 2, 0, 0, 254, 253, 1, 0, 0, 0, 255, 256, 1, 0, 0, 0, 256, 254, 1, 0, 0, 0, 256, 257, 1, 0, 0, 0, 257, 264, 1, 0, 0, 0, 258, 260, 5, 46, 0, 0, 259, 261, 7, 2, 0, 0, 260, 259, 1, 0, 0, 0, 261, 262, 1, 0, 0, 0, 262, 260, 1, 0, 0, 0, 262, 263, 1, 0, 0, 0, 263, 265, 1, 0, 0, 0, 264, 258, 1, 0, 0, 0, 264, 265, 1, 0, 0, 0, 265, 266, 1, 0, 0, 0, 266, 267, 5, 37, 0, 0, 267, 67, 1, 0, 0, 0, 268, 274, 5, 34, 0, 0, 269, 270, 5, 92, 0, 0, 270, 273, 5, 34, 0, 0, 271, 273, 8, 3, 0, 0, 272, 269, 1, 0, 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, 277, 1, 0, 0, 0, 276, 274, 1, 0, 0, 0, 277, 278, 5, 34, 0, 0, 278, 69, 1, 0, 0, 0, 279, 281, 7, 4, 0, 0, 280, 279, 1, 0, 0, 0, 281, 282, 1, 0, 0, 0, 282, 280, 1, 0, 0, 0, 282, 283, 1, 0, 0, 0, 283, 287, 1, 0, 0, 0, 284, 286, 7, 5, 0, 0, 285, 284, 1, 0, 0, 0, 286, 289, 1, 0, 0, 0, 287, 285, 1, 0, 0, 0, 287, 288, 1, 0, 0, 0, 288, 71, 1, 0, 0, 0, 289, 287, 1, 0, 0, 0, 290, 292, 3, 60, 29, 0, 291, 290, 1, 0, 0, 0, 291, 292, 1, 0, 0, 0, 292, 294, 1, 0, 0, 0, 293, 295, 7, 2, 0, 0, 294, 293, 1, 0, 0, 0, 295, 296, 1, 0, 0, 0, 296, 294, 1, 0, 0, 0, 296, 297, 1, 0, 0, 0, 297, 306, 1, 0, 0, 0, 298, 300, 5, 95, 0, 0, 299, 301, 7, 2, 0, 0, 300, 299, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 300, 1, 0, 0, 0, 302, 303, 1, 0, 0, 0, 303, 305, 1, 0, 0, 0, 304, 298, 1, 0, 0, 0, 305, 308, 1, 0, 0, 0, 306, 304, 1, 0, 0, 0, 306, 307, 1, 0, 0, 0, 307, 73, 1, 0, 0, 0, 308, 306, 1, 0, 0, 0, 309, 313, 7, 6, 0, 0, 310, 312, 7, 7, 0, 0, 311, 310, 1, 0, 0, 0, 312, 315, 1, 0, 0, 0, 313, 311, 1, 0, 0, 0, 313, 314, 1, 0, 0, 0, 314, 322, 1, 0, 0, 0, 315, 313, 1, 0, 0, 0, 316, 318, 5, 47, 0, 0, 317, 319, 7, 2, 0, 0, 318, 317, 1, 0, 0, 0, 319, 320, 1, 0, 0, 0, 320, 318, 1, 0, 0, 0, 320, 321, 1, 0, 0, 0, 321, 323, 1, 0, 0, 0, 322, 316, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 75, 1, 0, 0, 0, 324, 325, 5, 64, 0, 0, 325, 326, 1, 0, 0, 0, 326, 327, 6, 37, 2, 0, 327, 77, 1, 0, 0, 0, 328, 329, 5, 58, 0, 0, 329, 330, 1, 0, 0, 0, 330, 331, 6, 38, 2, 0, 331, 79, 1, 0, 0, 0, 332, 334, 5, 36, 0, 0, 333, 335, 7, 5, 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, 341, 1, 0, 0, 0, 338, 340, 7, 8, 0, 0, 339, 338, 1, 0, 0, 0, 340, 343, 1, 0, 0, 0, 341, 339, 1, 0, 0, 0, 341, 342, 1, 0, 0, 0, 342, 81, 1, 0, 0, 0, 343, 341, 1, 0, 0, 0, 344, 346, 7, 9, 0, 0, 345, 344, 1, 0, 0, 0, 346, 347, 1, 0, 0, 0, 347, 345, 1, 0, 0, 0, 347, 348, 1, 0, 0, 0, 348, 349, 1, 0, 0, 0, 349, 350, 6, 40, 3, 0, 350, 83, 1, 0, 0, 0, 351, 352, 3, 80, 39, 0, 352, 353, 1, 0, 0, 0, 353, 354, 6, 41, 3, 0, 354, 85, 1, 0, 0, 0, 355, 356, 3, 80, 39, 0, 356, 87, 1, 0, 0, 0, 24, 0, 1, 91, 98, 105, 107, 121, 256, 262, 264, 272, 274, 282, 287, 291, 296, 302, 306, 313, 320, 322, 336, 341, 347, 4, 6, 0, 0, 0, 1, 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 index 88700404..5fea9de1 100644 --- a/internal/parser/antlrParser/Lexer.tokens +++ b/internal/parser/antlrParser/Lexer.tokens @@ -29,16 +29,17 @@ 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 +RESTRICT=32 +PERCENTAGE_PORTION_LITERAL=33 +STRING=34 +IDENTIFIER=35 +NUMBER=36 +ASSET=37 +ACCOUNT_START=38 +COLON=39 +ACCOUNT_TEXT=40 +VARIABLE_NAME_ACC=41 +VARIABLE_NAME=42 'vars'=5 'max'=6 'source'=7 @@ -66,5 +67,6 @@ VARIABLE_NAME=41 '+'=29 '-'=30 '/'=31 -'@'=37 -':'=38 +'\\'=32 +'@'=38 +':'=39 diff --git a/internal/parser/antlrParser/Numscript.interp b/internal/parser/antlrParser/Numscript.interp index 19a29d5e..2d4b94b0 100644 --- a/internal/parser/antlrParser/Numscript.interp +++ b/internal/parser/antlrParser/Numscript.interp @@ -31,6 +31,7 @@ null '+' '-' '/' +'\\' null null null @@ -75,6 +76,7 @@ STAR PLUS MINUS DIV +RESTRICT PERCENTAGE_PORTION_LITERAL STRING IDENTIFIER @@ -98,6 +100,7 @@ varsDeclaration program sentAllLit allotment +colorConstraint source allotmentClauseSrc keptOrDestination @@ -109,4 +112,4 @@ statement atn: -[4, 1, 41, 253, 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, 1, 2, 3, 2, 69, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 77, 8, 2, 10, 2, 12, 2, 80, 9, 2, 1, 3, 1, 3, 1, 3, 5, 3, 85, 8, 3, 10, 3, 12, 3, 88, 9, 3, 1, 4, 1, 4, 1, 4, 3, 4, 93, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 3, 6, 103, 8, 6, 1, 7, 1, 7, 1, 7, 5, 7, 108, 8, 7, 10, 7, 12, 7, 111, 9, 7, 1, 7, 1, 7, 1, 8, 3, 8, 116, 8, 8, 1, 8, 5, 8, 119, 8, 8, 10, 8, 12, 8, 122, 9, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 3, 10, 133, 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, 150, 8, 11, 11, 11, 12, 11, 151, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 158, 8, 11, 10, 11, 12, 11, 161, 9, 11, 1, 11, 1, 11, 1, 11, 1, 11, 4, 11, 167, 8, 11, 11, 11, 12, 11, 168, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 178, 8, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 3, 13, 187, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 4, 15, 196, 8, 15, 11, 15, 12, 15, 197, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 204, 8, 15, 10, 15, 12, 15, 207, 9, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 216, 8, 15, 10, 15, 12, 15, 219, 9, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 225, 8, 15, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 3, 17, 232, 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, 251, 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, 271, 0, 38, 1, 0, 0, 0, 2, 45, 1, 0, 0, 0, 4, 68, 1, 0, 0, 0, 6, 81, 1, 0, 0, 0, 8, 89, 1, 0, 0, 0, 10, 96, 1, 0, 0, 0, 12, 99, 1, 0, 0, 0, 14, 104, 1, 0, 0, 0, 16, 115, 1, 0, 0, 0, 18, 125, 1, 0, 0, 0, 20, 132, 1, 0, 0, 0, 22, 177, 1, 0, 0, 0, 24, 179, 1, 0, 0, 0, 26, 186, 1, 0, 0, 0, 28, 188, 1, 0, 0, 0, 30, 224, 1, 0, 0, 0, 32, 226, 1, 0, 0, 0, 34, 231, 1, 0, 0, 0, 36, 250, 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, 69, 5, 41, 0, 0, 49, 69, 5, 36, 0, 0, 50, 69, 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, 69, 1, 0, 0, 0, 59, 57, 1, 0, 0, 0, 60, 69, 5, 35, 0, 0, 61, 69, 5, 32, 0, 0, 62, 69, 3, 0, 0, 0, 63, 64, 5, 20, 0, 0, 64, 65, 3, 4, 2, 0, 65, 66, 5, 21, 0, 0, 66, 69, 1, 0, 0, 0, 67, 69, 3, 8, 4, 0, 68, 47, 1, 0, 0, 0, 68, 49, 1, 0, 0, 0, 68, 50, 1, 0, 0, 0, 68, 51, 1, 0, 0, 0, 68, 60, 1, 0, 0, 0, 68, 61, 1, 0, 0, 0, 68, 62, 1, 0, 0, 0, 68, 63, 1, 0, 0, 0, 68, 67, 1, 0, 0, 0, 69, 78, 1, 0, 0, 0, 70, 71, 10, 4, 0, 0, 71, 72, 5, 31, 0, 0, 72, 77, 3, 4, 2, 5, 73, 74, 10, 3, 0, 0, 74, 75, 7, 0, 0, 0, 75, 77, 3, 4, 2, 4, 76, 70, 1, 0, 0, 0, 76, 73, 1, 0, 0, 0, 77, 80, 1, 0, 0, 0, 78, 76, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 5, 1, 0, 0, 0, 80, 78, 1, 0, 0, 0, 81, 86, 3, 4, 2, 0, 82, 83, 5, 26, 0, 0, 83, 85, 3, 4, 2, 0, 84, 82, 1, 0, 0, 0, 85, 88, 1, 0, 0, 0, 86, 84, 1, 0, 0, 0, 86, 87, 1, 0, 0, 0, 87, 7, 1, 0, 0, 0, 88, 86, 1, 0, 0, 0, 89, 90, 7, 1, 0, 0, 90, 92, 5, 20, 0, 0, 91, 93, 3, 6, 3, 0, 92, 91, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 94, 1, 0, 0, 0, 94, 95, 5, 21, 0, 0, 95, 9, 1, 0, 0, 0, 96, 97, 5, 27, 0, 0, 97, 98, 3, 4, 2, 0, 98, 11, 1, 0, 0, 0, 99, 100, 5, 34, 0, 0, 100, 102, 5, 41, 0, 0, 101, 103, 3, 10, 5, 0, 102, 101, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 13, 1, 0, 0, 0, 104, 105, 5, 5, 0, 0, 105, 109, 5, 24, 0, 0, 106, 108, 3, 12, 6, 0, 107, 106, 1, 0, 0, 0, 108, 111, 1, 0, 0, 0, 109, 107, 1, 0, 0, 0, 109, 110, 1, 0, 0, 0, 110, 112, 1, 0, 0, 0, 111, 109, 1, 0, 0, 0, 112, 113, 5, 25, 0, 0, 113, 15, 1, 0, 0, 0, 114, 116, 3, 14, 7, 0, 115, 114, 1, 0, 0, 0, 115, 116, 1, 0, 0, 0, 116, 120, 1, 0, 0, 0, 117, 119, 3, 36, 18, 0, 118, 117, 1, 0, 0, 0, 119, 122, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 120, 121, 1, 0, 0, 0, 121, 123, 1, 0, 0, 0, 122, 120, 1, 0, 0, 0, 123, 124, 5, 0, 0, 1, 124, 17, 1, 0, 0, 0, 125, 126, 5, 22, 0, 0, 126, 127, 3, 4, 2, 0, 127, 128, 5, 28, 0, 0, 128, 129, 5, 23, 0, 0, 129, 19, 1, 0, 0, 0, 130, 133, 3, 4, 2, 0, 131, 133, 5, 13, 0, 0, 132, 130, 1, 0, 0, 0, 132, 131, 1, 0, 0, 0, 133, 21, 1, 0, 0, 0, 134, 135, 3, 4, 2, 0, 135, 136, 5, 14, 0, 0, 136, 137, 5, 15, 0, 0, 137, 138, 5, 16, 0, 0, 138, 178, 1, 0, 0, 0, 139, 140, 3, 4, 2, 0, 140, 141, 5, 14, 0, 0, 141, 142, 5, 16, 0, 0, 142, 143, 5, 11, 0, 0, 143, 144, 5, 12, 0, 0, 144, 145, 3, 4, 2, 0, 145, 178, 1, 0, 0, 0, 146, 178, 3, 4, 2, 0, 147, 149, 5, 24, 0, 0, 148, 150, 3, 24, 12, 0, 149, 148, 1, 0, 0, 0, 150, 151, 1, 0, 0, 0, 151, 149, 1, 0, 0, 0, 151, 152, 1, 0, 0, 0, 152, 153, 1, 0, 0, 0, 153, 154, 5, 25, 0, 0, 154, 178, 1, 0, 0, 0, 155, 159, 5, 24, 0, 0, 156, 158, 3, 22, 11, 0, 157, 156, 1, 0, 0, 0, 158, 161, 1, 0, 0, 0, 159, 157, 1, 0, 0, 0, 159, 160, 1, 0, 0, 0, 160, 162, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 162, 178, 5, 25, 0, 0, 163, 164, 5, 17, 0, 0, 164, 166, 5, 24, 0, 0, 165, 167, 3, 22, 11, 0, 166, 165, 1, 0, 0, 0, 167, 168, 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 170, 1, 0, 0, 0, 170, 171, 5, 25, 0, 0, 171, 178, 1, 0, 0, 0, 172, 173, 5, 6, 0, 0, 173, 174, 3, 4, 2, 0, 174, 175, 5, 10, 0, 0, 175, 176, 3, 22, 11, 0, 176, 178, 1, 0, 0, 0, 177, 134, 1, 0, 0, 0, 177, 139, 1, 0, 0, 0, 177, 146, 1, 0, 0, 0, 177, 147, 1, 0, 0, 0, 177, 155, 1, 0, 0, 0, 177, 163, 1, 0, 0, 0, 177, 172, 1, 0, 0, 0, 178, 23, 1, 0, 0, 0, 179, 180, 3, 20, 10, 0, 180, 181, 5, 10, 0, 0, 181, 182, 3, 22, 11, 0, 182, 25, 1, 0, 0, 0, 183, 184, 5, 12, 0, 0, 184, 187, 3, 30, 15, 0, 185, 187, 5, 18, 0, 0, 186, 183, 1, 0, 0, 0, 186, 185, 1, 0, 0, 0, 187, 27, 1, 0, 0, 0, 188, 189, 5, 6, 0, 0, 189, 190, 3, 4, 2, 0, 190, 191, 3, 26, 13, 0, 191, 29, 1, 0, 0, 0, 192, 225, 3, 4, 2, 0, 193, 195, 5, 24, 0, 0, 194, 196, 3, 32, 16, 0, 195, 194, 1, 0, 0, 0, 196, 197, 1, 0, 0, 0, 197, 195, 1, 0, 0, 0, 197, 198, 1, 0, 0, 0, 198, 199, 1, 0, 0, 0, 199, 200, 5, 25, 0, 0, 200, 225, 1, 0, 0, 0, 201, 205, 5, 24, 0, 0, 202, 204, 3, 28, 14, 0, 203, 202, 1, 0, 0, 0, 204, 207, 1, 0, 0, 0, 205, 203, 1, 0, 0, 0, 205, 206, 1, 0, 0, 0, 206, 208, 1, 0, 0, 0, 207, 205, 1, 0, 0, 0, 208, 209, 5, 13, 0, 0, 209, 210, 3, 26, 13, 0, 210, 211, 5, 25, 0, 0, 211, 225, 1, 0, 0, 0, 212, 213, 5, 17, 0, 0, 213, 217, 5, 24, 0, 0, 214, 216, 3, 28, 14, 0, 215, 214, 1, 0, 0, 0, 216, 219, 1, 0, 0, 0, 217, 215, 1, 0, 0, 0, 217, 218, 1, 0, 0, 0, 218, 220, 1, 0, 0, 0, 219, 217, 1, 0, 0, 0, 220, 221, 5, 13, 0, 0, 221, 222, 3, 26, 13, 0, 222, 223, 5, 25, 0, 0, 223, 225, 1, 0, 0, 0, 224, 192, 1, 0, 0, 0, 224, 193, 1, 0, 0, 0, 224, 201, 1, 0, 0, 0, 224, 212, 1, 0, 0, 0, 225, 31, 1, 0, 0, 0, 226, 227, 3, 20, 10, 0, 227, 228, 3, 26, 13, 0, 228, 33, 1, 0, 0, 0, 229, 232, 3, 4, 2, 0, 230, 232, 3, 18, 9, 0, 231, 229, 1, 0, 0, 0, 231, 230, 1, 0, 0, 0, 232, 35, 1, 0, 0, 0, 233, 234, 5, 9, 0, 0, 234, 235, 3, 34, 17, 0, 235, 236, 5, 20, 0, 0, 236, 237, 5, 7, 0, 0, 237, 238, 5, 27, 0, 0, 238, 239, 3, 22, 11, 0, 239, 240, 5, 8, 0, 0, 240, 241, 5, 27, 0, 0, 241, 242, 3, 30, 15, 0, 242, 243, 5, 21, 0, 0, 243, 251, 1, 0, 0, 0, 244, 245, 5, 19, 0, 0, 245, 246, 3, 34, 17, 0, 246, 247, 5, 10, 0, 0, 247, 248, 3, 4, 2, 0, 248, 251, 1, 0, 0, 0, 249, 251, 3, 8, 4, 0, 250, 233, 1, 0, 0, 0, 250, 244, 1, 0, 0, 0, 250, 249, 1, 0, 0, 0, 251, 37, 1, 0, 0, 0, 23, 45, 57, 68, 76, 78, 86, 92, 102, 109, 115, 120, 132, 151, 159, 168, 177, 186, 197, 205, 217, 224, 231, 250] \ No newline at end of file +[4, 1, 42, 267, 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, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 3, 1, 48, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 58, 8, 2, 10, 2, 12, 2, 61, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 71, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 79, 8, 2, 10, 2, 12, 2, 82, 9, 2, 1, 3, 1, 3, 1, 3, 5, 3, 87, 8, 3, 10, 3, 12, 3, 90, 9, 3, 1, 4, 1, 4, 1, 4, 3, 4, 95, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 3, 6, 105, 8, 6, 1, 7, 1, 7, 1, 7, 5, 7, 110, 8, 7, 10, 7, 12, 7, 113, 9, 7, 1, 7, 1, 7, 1, 8, 3, 8, 118, 8, 8, 1, 8, 5, 8, 121, 8, 8, 10, 8, 12, 8, 124, 9, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 3, 10, 135, 8, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 142, 8, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 150, 8, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 160, 8, 12, 1, 12, 1, 12, 4, 12, 164, 8, 12, 11, 12, 12, 12, 165, 1, 12, 1, 12, 1, 12, 1, 12, 5, 12, 172, 8, 12, 10, 12, 12, 12, 175, 9, 12, 1, 12, 1, 12, 1, 12, 1, 12, 4, 12, 181, 8, 12, 11, 12, 12, 12, 182, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 192, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 3, 14, 201, 8, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 4, 16, 210, 8, 16, 11, 16, 12, 16, 211, 1, 16, 1, 16, 1, 16, 1, 16, 5, 16, 218, 8, 16, 10, 16, 12, 16, 221, 9, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 5, 16, 230, 8, 16, 10, 16, 12, 16, 233, 9, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 239, 8, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 3, 18, 246, 8, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 3, 19, 265, 8, 19, 1, 19, 0, 1, 4, 20, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 0, 2, 1, 0, 29, 30, 2, 0, 16, 16, 35, 35, 287, 0, 40, 1, 0, 0, 0, 2, 47, 1, 0, 0, 0, 4, 70, 1, 0, 0, 0, 6, 83, 1, 0, 0, 0, 8, 91, 1, 0, 0, 0, 10, 98, 1, 0, 0, 0, 12, 101, 1, 0, 0, 0, 14, 106, 1, 0, 0, 0, 16, 117, 1, 0, 0, 0, 18, 127, 1, 0, 0, 0, 20, 134, 1, 0, 0, 0, 22, 136, 1, 0, 0, 0, 24, 191, 1, 0, 0, 0, 26, 193, 1, 0, 0, 0, 28, 200, 1, 0, 0, 0, 30, 202, 1, 0, 0, 0, 32, 238, 1, 0, 0, 0, 34, 240, 1, 0, 0, 0, 36, 245, 1, 0, 0, 0, 38, 264, 1, 0, 0, 0, 40, 41, 5, 22, 0, 0, 41, 42, 3, 4, 2, 0, 42, 43, 3, 4, 2, 0, 43, 44, 5, 23, 0, 0, 44, 1, 1, 0, 0, 0, 45, 48, 5, 40, 0, 0, 46, 48, 5, 41, 0, 0, 47, 45, 1, 0, 0, 0, 47, 46, 1, 0, 0, 0, 48, 3, 1, 0, 0, 0, 49, 50, 6, 2, -1, 0, 50, 71, 5, 42, 0, 0, 51, 71, 5, 37, 0, 0, 52, 71, 5, 34, 0, 0, 53, 54, 5, 38, 0, 0, 54, 59, 3, 2, 1, 0, 55, 56, 5, 39, 0, 0, 56, 58, 3, 2, 1, 0, 57, 55, 1, 0, 0, 0, 58, 61, 1, 0, 0, 0, 59, 57, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 71, 1, 0, 0, 0, 61, 59, 1, 0, 0, 0, 62, 71, 5, 36, 0, 0, 63, 71, 5, 33, 0, 0, 64, 71, 3, 0, 0, 0, 65, 66, 5, 20, 0, 0, 66, 67, 3, 4, 2, 0, 67, 68, 5, 21, 0, 0, 68, 71, 1, 0, 0, 0, 69, 71, 3, 8, 4, 0, 70, 49, 1, 0, 0, 0, 70, 51, 1, 0, 0, 0, 70, 52, 1, 0, 0, 0, 70, 53, 1, 0, 0, 0, 70, 62, 1, 0, 0, 0, 70, 63, 1, 0, 0, 0, 70, 64, 1, 0, 0, 0, 70, 65, 1, 0, 0, 0, 70, 69, 1, 0, 0, 0, 71, 80, 1, 0, 0, 0, 72, 73, 10, 4, 0, 0, 73, 74, 5, 31, 0, 0, 74, 79, 3, 4, 2, 5, 75, 76, 10, 3, 0, 0, 76, 77, 7, 0, 0, 0, 77, 79, 3, 4, 2, 4, 78, 72, 1, 0, 0, 0, 78, 75, 1, 0, 0, 0, 79, 82, 1, 0, 0, 0, 80, 78, 1, 0, 0, 0, 80, 81, 1, 0, 0, 0, 81, 5, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 83, 88, 3, 4, 2, 0, 84, 85, 5, 26, 0, 0, 85, 87, 3, 4, 2, 0, 86, 84, 1, 0, 0, 0, 87, 90, 1, 0, 0, 0, 88, 86, 1, 0, 0, 0, 88, 89, 1, 0, 0, 0, 89, 7, 1, 0, 0, 0, 90, 88, 1, 0, 0, 0, 91, 92, 7, 1, 0, 0, 92, 94, 5, 20, 0, 0, 93, 95, 3, 6, 3, 0, 94, 93, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 96, 1, 0, 0, 0, 96, 97, 5, 21, 0, 0, 97, 9, 1, 0, 0, 0, 98, 99, 5, 27, 0, 0, 99, 100, 3, 4, 2, 0, 100, 11, 1, 0, 0, 0, 101, 102, 5, 35, 0, 0, 102, 104, 5, 42, 0, 0, 103, 105, 3, 10, 5, 0, 104, 103, 1, 0, 0, 0, 104, 105, 1, 0, 0, 0, 105, 13, 1, 0, 0, 0, 106, 107, 5, 5, 0, 0, 107, 111, 5, 24, 0, 0, 108, 110, 3, 12, 6, 0, 109, 108, 1, 0, 0, 0, 110, 113, 1, 0, 0, 0, 111, 109, 1, 0, 0, 0, 111, 112, 1, 0, 0, 0, 112, 114, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 114, 115, 5, 25, 0, 0, 115, 15, 1, 0, 0, 0, 116, 118, 3, 14, 7, 0, 117, 116, 1, 0, 0, 0, 117, 118, 1, 0, 0, 0, 118, 122, 1, 0, 0, 0, 119, 121, 3, 38, 19, 0, 120, 119, 1, 0, 0, 0, 121, 124, 1, 0, 0, 0, 122, 120, 1, 0, 0, 0, 122, 123, 1, 0, 0, 0, 123, 125, 1, 0, 0, 0, 124, 122, 1, 0, 0, 0, 125, 126, 5, 0, 0, 1, 126, 17, 1, 0, 0, 0, 127, 128, 5, 22, 0, 0, 128, 129, 3, 4, 2, 0, 129, 130, 5, 28, 0, 0, 130, 131, 5, 23, 0, 0, 131, 19, 1, 0, 0, 0, 132, 135, 3, 4, 2, 0, 133, 135, 5, 13, 0, 0, 134, 132, 1, 0, 0, 0, 134, 133, 1, 0, 0, 0, 135, 21, 1, 0, 0, 0, 136, 137, 5, 32, 0, 0, 137, 138, 3, 4, 2, 0, 138, 23, 1, 0, 0, 0, 139, 141, 3, 4, 2, 0, 140, 142, 3, 22, 11, 0, 141, 140, 1, 0, 0, 0, 141, 142, 1, 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 144, 5, 14, 0, 0, 144, 145, 5, 15, 0, 0, 145, 146, 5, 16, 0, 0, 146, 192, 1, 0, 0, 0, 147, 149, 3, 4, 2, 0, 148, 150, 3, 22, 11, 0, 149, 148, 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 151, 1, 0, 0, 0, 151, 152, 5, 14, 0, 0, 152, 153, 5, 16, 0, 0, 153, 154, 5, 11, 0, 0, 154, 155, 5, 12, 0, 0, 155, 156, 3, 4, 2, 0, 156, 192, 1, 0, 0, 0, 157, 159, 3, 4, 2, 0, 158, 160, 3, 22, 11, 0, 159, 158, 1, 0, 0, 0, 159, 160, 1, 0, 0, 0, 160, 192, 1, 0, 0, 0, 161, 163, 5, 24, 0, 0, 162, 164, 3, 26, 13, 0, 163, 162, 1, 0, 0, 0, 164, 165, 1, 0, 0, 0, 165, 163, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 168, 5, 25, 0, 0, 168, 192, 1, 0, 0, 0, 169, 173, 5, 24, 0, 0, 170, 172, 3, 24, 12, 0, 171, 170, 1, 0, 0, 0, 172, 175, 1, 0, 0, 0, 173, 171, 1, 0, 0, 0, 173, 174, 1, 0, 0, 0, 174, 176, 1, 0, 0, 0, 175, 173, 1, 0, 0, 0, 176, 192, 5, 25, 0, 0, 177, 178, 5, 17, 0, 0, 178, 180, 5, 24, 0, 0, 179, 181, 3, 24, 12, 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, 25, 0, 0, 185, 192, 1, 0, 0, 0, 186, 187, 5, 6, 0, 0, 187, 188, 3, 4, 2, 0, 188, 189, 5, 10, 0, 0, 189, 190, 3, 24, 12, 0, 190, 192, 1, 0, 0, 0, 191, 139, 1, 0, 0, 0, 191, 147, 1, 0, 0, 0, 191, 157, 1, 0, 0, 0, 191, 161, 1, 0, 0, 0, 191, 169, 1, 0, 0, 0, 191, 177, 1, 0, 0, 0, 191, 186, 1, 0, 0, 0, 192, 25, 1, 0, 0, 0, 193, 194, 3, 20, 10, 0, 194, 195, 5, 10, 0, 0, 195, 196, 3, 24, 12, 0, 196, 27, 1, 0, 0, 0, 197, 198, 5, 12, 0, 0, 198, 201, 3, 32, 16, 0, 199, 201, 5, 18, 0, 0, 200, 197, 1, 0, 0, 0, 200, 199, 1, 0, 0, 0, 201, 29, 1, 0, 0, 0, 202, 203, 5, 6, 0, 0, 203, 204, 3, 4, 2, 0, 204, 205, 3, 28, 14, 0, 205, 31, 1, 0, 0, 0, 206, 239, 3, 4, 2, 0, 207, 209, 5, 24, 0, 0, 208, 210, 3, 34, 17, 0, 209, 208, 1, 0, 0, 0, 210, 211, 1, 0, 0, 0, 211, 209, 1, 0, 0, 0, 211, 212, 1, 0, 0, 0, 212, 213, 1, 0, 0, 0, 213, 214, 5, 25, 0, 0, 214, 239, 1, 0, 0, 0, 215, 219, 5, 24, 0, 0, 216, 218, 3, 30, 15, 0, 217, 216, 1, 0, 0, 0, 218, 221, 1, 0, 0, 0, 219, 217, 1, 0, 0, 0, 219, 220, 1, 0, 0, 0, 220, 222, 1, 0, 0, 0, 221, 219, 1, 0, 0, 0, 222, 223, 5, 13, 0, 0, 223, 224, 3, 28, 14, 0, 224, 225, 5, 25, 0, 0, 225, 239, 1, 0, 0, 0, 226, 227, 5, 17, 0, 0, 227, 231, 5, 24, 0, 0, 228, 230, 3, 30, 15, 0, 229, 228, 1, 0, 0, 0, 230, 233, 1, 0, 0, 0, 231, 229, 1, 0, 0, 0, 231, 232, 1, 0, 0, 0, 232, 234, 1, 0, 0, 0, 233, 231, 1, 0, 0, 0, 234, 235, 5, 13, 0, 0, 235, 236, 3, 28, 14, 0, 236, 237, 5, 25, 0, 0, 237, 239, 1, 0, 0, 0, 238, 206, 1, 0, 0, 0, 238, 207, 1, 0, 0, 0, 238, 215, 1, 0, 0, 0, 238, 226, 1, 0, 0, 0, 239, 33, 1, 0, 0, 0, 240, 241, 3, 20, 10, 0, 241, 242, 3, 28, 14, 0, 242, 35, 1, 0, 0, 0, 243, 246, 3, 4, 2, 0, 244, 246, 3, 18, 9, 0, 245, 243, 1, 0, 0, 0, 245, 244, 1, 0, 0, 0, 246, 37, 1, 0, 0, 0, 247, 248, 5, 9, 0, 0, 248, 249, 3, 36, 18, 0, 249, 250, 5, 20, 0, 0, 250, 251, 5, 7, 0, 0, 251, 252, 5, 27, 0, 0, 252, 253, 3, 24, 12, 0, 253, 254, 5, 8, 0, 0, 254, 255, 5, 27, 0, 0, 255, 256, 3, 32, 16, 0, 256, 257, 5, 21, 0, 0, 257, 265, 1, 0, 0, 0, 258, 259, 5, 19, 0, 0, 259, 260, 3, 36, 18, 0, 260, 261, 5, 10, 0, 0, 261, 262, 3, 4, 2, 0, 262, 265, 1, 0, 0, 0, 263, 265, 3, 8, 4, 0, 264, 247, 1, 0, 0, 0, 264, 258, 1, 0, 0, 0, 264, 263, 1, 0, 0, 0, 265, 39, 1, 0, 0, 0, 26, 47, 59, 70, 78, 80, 88, 94, 104, 111, 117, 122, 134, 141, 149, 159, 165, 173, 182, 191, 200, 211, 219, 231, 238, 245, 264] \ No newline at end of file diff --git a/internal/parser/antlrParser/Numscript.tokens b/internal/parser/antlrParser/Numscript.tokens index 88700404..5fea9de1 100644 --- a/internal/parser/antlrParser/Numscript.tokens +++ b/internal/parser/antlrParser/Numscript.tokens @@ -29,16 +29,17 @@ 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 +RESTRICT=32 +PERCENTAGE_PORTION_LITERAL=33 +STRING=34 +IDENTIFIER=35 +NUMBER=36 +ASSET=37 +ACCOUNT_START=38 +COLON=39 +ACCOUNT_TEXT=40 +VARIABLE_NAME_ACC=41 +VARIABLE_NAME=42 'vars'=5 'max'=6 'source'=7 @@ -66,5 +67,6 @@ VARIABLE_NAME=41 '+'=29 '-'=30 '/'=31 -'@'=37 -':'=38 +'\\'=32 +'@'=38 +':'=39 diff --git a/internal/parser/antlrParser/lexer.go b/internal/parser/antlrParser/lexer.go index b700f165..9e7fd19a 100644 --- a/internal/parser/antlrParser/lexer.go +++ b/internal/parser/antlrParser/lexer.go @@ -46,30 +46,30 @@ func lexerLexerInit() { "", "", "", "", "", "'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", + "MINUS", "DIV", "RESTRICT", "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", + "MINUS", "DIV", "RESTRICT", "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, + 4, 0, 42, 357, 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, @@ -77,157 +77,159 @@ func lexerLexerInit() { 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, 1, 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, 2, 0, 323, 75, 1, 0, 0, 0, 324, - 325, 5, 58, 0, 0, 325, 326, 1, 0, 0, 0, 326, 327, 6, 37, 2, 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, 3, 0, 346, 81, 1, 0, 0, 0, 347, 348, - 3, 78, 38, 0, 348, 349, 1, 0, 0, 0, 349, 350, 6, 40, 3, 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, 4, 6, 0, 0, 0, 1, 0, 5, 1, 0, 4, 0, 0, + 2, 41, 7, 41, 2, 42, 7, 42, 1, 0, 4, 0, 90, 8, 0, 11, 0, 12, 0, 91, 1, + 0, 1, 0, 1, 1, 4, 1, 97, 8, 1, 11, 1, 12, 1, 98, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 5, 2, 106, 8, 2, 10, 2, 12, 2, 109, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 5, 3, 120, 8, 3, 10, 3, 12, 3, 123, 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, 1, 31, 1, 32, 4, 32, + 255, 8, 32, 11, 32, 12, 32, 256, 1, 32, 1, 32, 4, 32, 261, 8, 32, 11, 32, + 12, 32, 262, 3, 32, 265, 8, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, + 5, 33, 273, 8, 33, 10, 33, 12, 33, 276, 9, 33, 1, 33, 1, 33, 1, 34, 4, + 34, 281, 8, 34, 11, 34, 12, 34, 282, 1, 34, 5, 34, 286, 8, 34, 10, 34, + 12, 34, 289, 9, 34, 1, 35, 3, 35, 292, 8, 35, 1, 35, 4, 35, 295, 8, 35, + 11, 35, 12, 35, 296, 1, 35, 1, 35, 4, 35, 301, 8, 35, 11, 35, 12, 35, 302, + 5, 35, 305, 8, 35, 10, 35, 12, 35, 308, 9, 35, 1, 36, 1, 36, 5, 36, 312, + 8, 36, 10, 36, 12, 36, 315, 9, 36, 1, 36, 1, 36, 4, 36, 319, 8, 36, 11, + 36, 12, 36, 320, 3, 36, 323, 8, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, + 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 4, 39, 335, 8, 39, 11, 39, 12, 39, 336, + 1, 39, 5, 39, 340, 8, 39, 10, 39, 12, 39, 343, 9, 39, 1, 40, 4, 40, 346, + 8, 40, 11, 40, 12, 40, 347, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, + 42, 1, 42, 2, 107, 121, 0, 43, 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, 39, 80, 0, 82, 40, 84, 41, 86, 42, + 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, 376, 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, 78, 1, 0, 0, 0, 0, 86, 1, 0, 0, + 0, 1, 82, 1, 0, 0, 0, 1, 84, 1, 0, 0, 0, 2, 89, 1, 0, 0, 0, 4, 96, 1, 0, + 0, 0, 6, 100, 1, 0, 0, 0, 8, 115, 1, 0, 0, 0, 10, 128, 1, 0, 0, 0, 12, + 133, 1, 0, 0, 0, 14, 137, 1, 0, 0, 0, 16, 144, 1, 0, 0, 0, 18, 156, 1, + 0, 0, 0, 20, 161, 1, 0, 0, 0, 22, 166, 1, 0, 0, 0, 24, 169, 1, 0, 0, 0, + 26, 172, 1, 0, 0, 0, 28, 182, 1, 0, 0, 0, 30, 191, 1, 0, 0, 0, 32, 201, + 1, 0, 0, 0, 34, 211, 1, 0, 0, 0, 36, 217, 1, 0, 0, 0, 38, 222, 1, 0, 0, + 0, 40, 227, 1, 0, 0, 0, 42, 229, 1, 0, 0, 0, 44, 231, 1, 0, 0, 0, 46, 233, + 1, 0, 0, 0, 48, 235, 1, 0, 0, 0, 50, 237, 1, 0, 0, 0, 52, 239, 1, 0, 0, + 0, 54, 241, 1, 0, 0, 0, 56, 243, 1, 0, 0, 0, 58, 245, 1, 0, 0, 0, 60, 247, + 1, 0, 0, 0, 62, 249, 1, 0, 0, 0, 64, 251, 1, 0, 0, 0, 66, 254, 1, 0, 0, + 0, 68, 268, 1, 0, 0, 0, 70, 280, 1, 0, 0, 0, 72, 291, 1, 0, 0, 0, 74, 309, + 1, 0, 0, 0, 76, 324, 1, 0, 0, 0, 78, 328, 1, 0, 0, 0, 80, 332, 1, 0, 0, + 0, 82, 345, 1, 0, 0, 0, 84, 351, 1, 0, 0, 0, 86, 355, 1, 0, 0, 0, 88, 90, + 7, 0, 0, 0, 89, 88, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 89, 1, 0, 0, 0, + 91, 92, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 94, 6, 0, 0, 0, 94, 3, 1, 0, + 0, 0, 95, 97, 7, 1, 0, 0, 96, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 96, + 1, 0, 0, 0, 98, 99, 1, 0, 0, 0, 99, 5, 1, 0, 0, 0, 100, 101, 5, 47, 0, + 0, 101, 102, 5, 42, 0, 0, 102, 107, 1, 0, 0, 0, 103, 106, 3, 6, 2, 0, 104, + 106, 9, 0, 0, 0, 105, 103, 1, 0, 0, 0, 105, 104, 1, 0, 0, 0, 106, 109, + 1, 0, 0, 0, 107, 108, 1, 0, 0, 0, 107, 105, 1, 0, 0, 0, 108, 110, 1, 0, + 0, 0, 109, 107, 1, 0, 0, 0, 110, 111, 5, 42, 0, 0, 111, 112, 5, 47, 0, + 0, 112, 113, 1, 0, 0, 0, 113, 114, 6, 2, 0, 0, 114, 7, 1, 0, 0, 0, 115, + 116, 5, 47, 0, 0, 116, 117, 5, 47, 0, 0, 117, 121, 1, 0, 0, 0, 118, 120, + 9, 0, 0, 0, 119, 118, 1, 0, 0, 0, 120, 123, 1, 0, 0, 0, 121, 122, 1, 0, + 0, 0, 121, 119, 1, 0, 0, 0, 122, 124, 1, 0, 0, 0, 123, 121, 1, 0, 0, 0, + 124, 125, 3, 4, 1, 0, 125, 126, 1, 0, 0, 0, 126, 127, 6, 3, 1, 0, 127, + 9, 1, 0, 0, 0, 128, 129, 5, 118, 0, 0, 129, 130, 5, 97, 0, 0, 130, 131, + 5, 114, 0, 0, 131, 132, 5, 115, 0, 0, 132, 11, 1, 0, 0, 0, 133, 134, 5, + 109, 0, 0, 134, 135, 5, 97, 0, 0, 135, 136, 5, 120, 0, 0, 136, 13, 1, 0, + 0, 0, 137, 138, 5, 115, 0, 0, 138, 139, 5, 111, 0, 0, 139, 140, 5, 117, + 0, 0, 140, 141, 5, 114, 0, 0, 141, 142, 5, 99, 0, 0, 142, 143, 5, 101, + 0, 0, 143, 15, 1, 0, 0, 0, 144, 145, 5, 100, 0, 0, 145, 146, 5, 101, 0, + 0, 146, 147, 5, 115, 0, 0, 147, 148, 5, 116, 0, 0, 148, 149, 5, 105, 0, + 0, 149, 150, 5, 110, 0, 0, 150, 151, 5, 97, 0, 0, 151, 152, 5, 116, 0, + 0, 152, 153, 5, 105, 0, 0, 153, 154, 5, 111, 0, 0, 154, 155, 5, 110, 0, + 0, 155, 17, 1, 0, 0, 0, 156, 157, 5, 115, 0, 0, 157, 158, 5, 101, 0, 0, + 158, 159, 5, 110, 0, 0, 159, 160, 5, 100, 0, 0, 160, 19, 1, 0, 0, 0, 161, + 162, 5, 102, 0, 0, 162, 163, 5, 114, 0, 0, 163, 164, 5, 111, 0, 0, 164, + 165, 5, 109, 0, 0, 165, 21, 1, 0, 0, 0, 166, 167, 5, 117, 0, 0, 167, 168, + 5, 112, 0, 0, 168, 23, 1, 0, 0, 0, 169, 170, 5, 116, 0, 0, 170, 171, 5, + 111, 0, 0, 171, 25, 1, 0, 0, 0, 172, 173, 5, 114, 0, 0, 173, 174, 5, 101, + 0, 0, 174, 175, 5, 109, 0, 0, 175, 176, 5, 97, 0, 0, 176, 177, 5, 105, + 0, 0, 177, 178, 5, 110, 0, 0, 178, 179, 5, 105, 0, 0, 179, 180, 5, 110, + 0, 0, 180, 181, 5, 103, 0, 0, 181, 27, 1, 0, 0, 0, 182, 183, 5, 97, 0, + 0, 183, 184, 5, 108, 0, 0, 184, 185, 5, 108, 0, 0, 185, 186, 5, 111, 0, + 0, 186, 187, 5, 119, 0, 0, 187, 188, 5, 105, 0, 0, 188, 189, 5, 110, 0, + 0, 189, 190, 5, 103, 0, 0, 190, 29, 1, 0, 0, 0, 191, 192, 5, 117, 0, 0, + 192, 193, 5, 110, 0, 0, 193, 194, 5, 98, 0, 0, 194, 195, 5, 111, 0, 0, + 195, 196, 5, 117, 0, 0, 196, 197, 5, 110, 0, 0, 197, 198, 5, 100, 0, 0, + 198, 199, 5, 101, 0, 0, 199, 200, 5, 100, 0, 0, 200, 31, 1, 0, 0, 0, 201, + 202, 5, 111, 0, 0, 202, 203, 5, 118, 0, 0, 203, 204, 5, 101, 0, 0, 204, + 205, 5, 114, 0, 0, 205, 206, 5, 100, 0, 0, 206, 207, 5, 114, 0, 0, 207, + 208, 5, 97, 0, 0, 208, 209, 5, 102, 0, 0, 209, 210, 5, 116, 0, 0, 210, + 33, 1, 0, 0, 0, 211, 212, 5, 111, 0, 0, 212, 213, 5, 110, 0, 0, 213, 214, + 5, 101, 0, 0, 214, 215, 5, 111, 0, 0, 215, 216, 5, 102, 0, 0, 216, 35, + 1, 0, 0, 0, 217, 218, 5, 107, 0, 0, 218, 219, 5, 101, 0, 0, 219, 220, 5, + 112, 0, 0, 220, 221, 5, 116, 0, 0, 221, 37, 1, 0, 0, 0, 222, 223, 5, 115, + 0, 0, 223, 224, 5, 97, 0, 0, 224, 225, 5, 118, 0, 0, 225, 226, 5, 101, + 0, 0, 226, 39, 1, 0, 0, 0, 227, 228, 5, 40, 0, 0, 228, 41, 1, 0, 0, 0, + 229, 230, 5, 41, 0, 0, 230, 43, 1, 0, 0, 0, 231, 232, 5, 91, 0, 0, 232, + 45, 1, 0, 0, 0, 233, 234, 5, 93, 0, 0, 234, 47, 1, 0, 0, 0, 235, 236, 5, + 123, 0, 0, 236, 49, 1, 0, 0, 0, 237, 238, 5, 125, 0, 0, 238, 51, 1, 0, + 0, 0, 239, 240, 5, 44, 0, 0, 240, 53, 1, 0, 0, 0, 241, 242, 5, 61, 0, 0, + 242, 55, 1, 0, 0, 0, 243, 244, 5, 42, 0, 0, 244, 57, 1, 0, 0, 0, 245, 246, + 5, 43, 0, 0, 246, 59, 1, 0, 0, 0, 247, 248, 5, 45, 0, 0, 248, 61, 1, 0, + 0, 0, 249, 250, 5, 47, 0, 0, 250, 63, 1, 0, 0, 0, 251, 252, 5, 92, 0, 0, + 252, 65, 1, 0, 0, 0, 253, 255, 7, 2, 0, 0, 254, 253, 1, 0, 0, 0, 255, 256, + 1, 0, 0, 0, 256, 254, 1, 0, 0, 0, 256, 257, 1, 0, 0, 0, 257, 264, 1, 0, + 0, 0, 258, 260, 5, 46, 0, 0, 259, 261, 7, 2, 0, 0, 260, 259, 1, 0, 0, 0, + 261, 262, 1, 0, 0, 0, 262, 260, 1, 0, 0, 0, 262, 263, 1, 0, 0, 0, 263, + 265, 1, 0, 0, 0, 264, 258, 1, 0, 0, 0, 264, 265, 1, 0, 0, 0, 265, 266, + 1, 0, 0, 0, 266, 267, 5, 37, 0, 0, 267, 67, 1, 0, 0, 0, 268, 274, 5, 34, + 0, 0, 269, 270, 5, 92, 0, 0, 270, 273, 5, 34, 0, 0, 271, 273, 8, 3, 0, + 0, 272, 269, 1, 0, 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, 277, 1, 0, 0, 0, 276, 274, + 1, 0, 0, 0, 277, 278, 5, 34, 0, 0, 278, 69, 1, 0, 0, 0, 279, 281, 7, 4, + 0, 0, 280, 279, 1, 0, 0, 0, 281, 282, 1, 0, 0, 0, 282, 280, 1, 0, 0, 0, + 282, 283, 1, 0, 0, 0, 283, 287, 1, 0, 0, 0, 284, 286, 7, 5, 0, 0, 285, + 284, 1, 0, 0, 0, 286, 289, 1, 0, 0, 0, 287, 285, 1, 0, 0, 0, 287, 288, + 1, 0, 0, 0, 288, 71, 1, 0, 0, 0, 289, 287, 1, 0, 0, 0, 290, 292, 3, 60, + 29, 0, 291, 290, 1, 0, 0, 0, 291, 292, 1, 0, 0, 0, 292, 294, 1, 0, 0, 0, + 293, 295, 7, 2, 0, 0, 294, 293, 1, 0, 0, 0, 295, 296, 1, 0, 0, 0, 296, + 294, 1, 0, 0, 0, 296, 297, 1, 0, 0, 0, 297, 306, 1, 0, 0, 0, 298, 300, + 5, 95, 0, 0, 299, 301, 7, 2, 0, 0, 300, 299, 1, 0, 0, 0, 301, 302, 1, 0, + 0, 0, 302, 300, 1, 0, 0, 0, 302, 303, 1, 0, 0, 0, 303, 305, 1, 0, 0, 0, + 304, 298, 1, 0, 0, 0, 305, 308, 1, 0, 0, 0, 306, 304, 1, 0, 0, 0, 306, + 307, 1, 0, 0, 0, 307, 73, 1, 0, 0, 0, 308, 306, 1, 0, 0, 0, 309, 313, 7, + 6, 0, 0, 310, 312, 7, 7, 0, 0, 311, 310, 1, 0, 0, 0, 312, 315, 1, 0, 0, + 0, 313, 311, 1, 0, 0, 0, 313, 314, 1, 0, 0, 0, 314, 322, 1, 0, 0, 0, 315, + 313, 1, 0, 0, 0, 316, 318, 5, 47, 0, 0, 317, 319, 7, 2, 0, 0, 318, 317, + 1, 0, 0, 0, 319, 320, 1, 0, 0, 0, 320, 318, 1, 0, 0, 0, 320, 321, 1, 0, + 0, 0, 321, 323, 1, 0, 0, 0, 322, 316, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, + 323, 75, 1, 0, 0, 0, 324, 325, 5, 64, 0, 0, 325, 326, 1, 0, 0, 0, 326, + 327, 6, 37, 2, 0, 327, 77, 1, 0, 0, 0, 328, 329, 5, 58, 0, 0, 329, 330, + 1, 0, 0, 0, 330, 331, 6, 38, 2, 0, 331, 79, 1, 0, 0, 0, 332, 334, 5, 36, + 0, 0, 333, 335, 7, 5, 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, 341, 1, 0, 0, 0, 338, + 340, 7, 8, 0, 0, 339, 338, 1, 0, 0, 0, 340, 343, 1, 0, 0, 0, 341, 339, + 1, 0, 0, 0, 341, 342, 1, 0, 0, 0, 342, 81, 1, 0, 0, 0, 343, 341, 1, 0, + 0, 0, 344, 346, 7, 9, 0, 0, 345, 344, 1, 0, 0, 0, 346, 347, 1, 0, 0, 0, + 347, 345, 1, 0, 0, 0, 347, 348, 1, 0, 0, 0, 348, 349, 1, 0, 0, 0, 349, + 350, 6, 40, 3, 0, 350, 83, 1, 0, 0, 0, 351, 352, 3, 80, 39, 0, 352, 353, + 1, 0, 0, 0, 353, 354, 6, 41, 3, 0, 354, 85, 1, 0, 0, 0, 355, 356, 3, 80, + 39, 0, 356, 87, 1, 0, 0, 0, 24, 0, 1, 91, 98, 105, 107, 121, 256, 262, + 264, 272, 274, 282, 287, 291, 296, 302, 306, 313, 320, 322, 336, 341, 347, + 4, 6, 0, 0, 0, 1, 0, 5, 1, 0, 4, 0, 0, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -299,16 +301,17 @@ const ( 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 + LexerRESTRICT = 32 + LexerPERCENTAGE_PORTION_LITERAL = 33 + LexerSTRING = 34 + LexerIDENTIFIER = 35 + LexerNUMBER = 36 + LexerASSET = 37 + LexerACCOUNT_START = 38 + LexerCOLON = 39 + LexerACCOUNT_TEXT = 40 + LexerVARIABLE_NAME_ACC = 41 + LexerVARIABLE_NAME = 42 ) // LexerACCOUNT_MODE is the Lexer mode. diff --git a/internal/parser/antlrParser/numscript_base_listener.go b/internal/parser/antlrParser/numscript_base_listener.go index c912362e..5c4e1f6b 100644 --- a/internal/parser/antlrParser/numscript_base_listener.go +++ b/internal/parser/antlrParser/numscript_base_listener.go @@ -152,6 +152,12 @@ func (s *BaseNumscriptListener) EnterRemainingAllotment(ctx *RemainingAllotmentC // ExitRemainingAllotment is called when production remainingAllotment is exited. func (s *BaseNumscriptListener) ExitRemainingAllotment(ctx *RemainingAllotmentContext) {} +// EnterColorConstraint is called when production colorConstraint is entered. +func (s *BaseNumscriptListener) EnterColorConstraint(ctx *ColorConstraintContext) {} + +// ExitColorConstraint is called when production colorConstraint is exited. +func (s *BaseNumscriptListener) ExitColorConstraint(ctx *ColorConstraintContext) {} + // EnterSrcAccountUnboundedOverdraft is called when production srcAccountUnboundedOverdraft is entered. func (s *BaseNumscriptListener) EnterSrcAccountUnboundedOverdraft(ctx *SrcAccountUnboundedOverdraftContext) { } diff --git a/internal/parser/antlrParser/numscript_listener.go b/internal/parser/antlrParser/numscript_listener.go index afd2eb48..6dbcc8a0 100644 --- a/internal/parser/antlrParser/numscript_listener.go +++ b/internal/parser/antlrParser/numscript_listener.go @@ -73,6 +73,9 @@ type NumscriptListener interface { // EnterRemainingAllotment is called when entering the remainingAllotment production. EnterRemainingAllotment(c *RemainingAllotmentContext) + // EnterColorConstraint is called when entering the colorConstraint production. + EnterColorConstraint(c *ColorConstraintContext) + // EnterSrcAccountUnboundedOverdraft is called when entering the srcAccountUnboundedOverdraft production. EnterSrcAccountUnboundedOverdraft(c *SrcAccountUnboundedOverdraftContext) @@ -202,6 +205,9 @@ type NumscriptListener interface { // ExitRemainingAllotment is called when exiting the remainingAllotment production. ExitRemainingAllotment(c *RemainingAllotmentContext) + // ExitColorConstraint is called when exiting the colorConstraint production. + ExitColorConstraint(c *ColorConstraintContext) + // ExitSrcAccountUnboundedOverdraft is called when exiting the srcAccountUnboundedOverdraft production. ExitSrcAccountUnboundedOverdraft(c *SrcAccountUnboundedOverdraftContext) diff --git a/internal/parser/antlrParser/numscript_parser.go b/internal/parser/antlrParser/numscript_parser.go index 1a4ebba1..d26c0454 100644 --- a/internal/parser/antlrParser/numscript_parser.go +++ b/internal/parser/antlrParser/numscript_parser.go @@ -35,138 +35,144 @@ func numscriptParserInit() { "", "", "", "", "", "'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", + "MINUS", "DIV", "RESTRICT", "PERCENTAGE_PORTION_LITERAL", "STRING", + "IDENTIFIER", "NUMBER", "ASSET", "ACCOUNT_START", "COLON", "ACCOUNT_TEXT", + "VARIABLE_NAME_ACC", "VARIABLE_NAME", } staticData.RuleNames = []string{ "monetaryLit", "accountLiteralPart", "valueExpr", "functionCallArgs", "functionCall", "varOrigin", "varDeclaration", "varsDeclaration", "program", - "sentAllLit", "allotment", "source", "allotmentClauseSrc", "keptOrDestination", - "destinationInOrderClause", "destination", "allotmentClauseDest", "sentValue", - "statement", + "sentAllLit", "allotment", "colorConstraint", "source", "allotmentClauseSrc", + "keptOrDestination", "destinationInOrderClause", "destination", "allotmentClauseDest", + "sentValue", "statement", } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 1, 41, 253, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, + 4, 1, 42, 267, 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, 1, 2, 3, 2, 69, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, - 2, 77, 8, 2, 10, 2, 12, 2, 80, 9, 2, 1, 3, 1, 3, 1, 3, 5, 3, 85, 8, 3, - 10, 3, 12, 3, 88, 9, 3, 1, 4, 1, 4, 1, 4, 3, 4, 93, 8, 4, 1, 4, 1, 4, 1, - 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 3, 6, 103, 8, 6, 1, 7, 1, 7, 1, 7, 5, - 7, 108, 8, 7, 10, 7, 12, 7, 111, 9, 7, 1, 7, 1, 7, 1, 8, 3, 8, 116, 8, - 8, 1, 8, 5, 8, 119, 8, 8, 10, 8, 12, 8, 122, 9, 8, 1, 8, 1, 8, 1, 9, 1, - 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 3, 10, 133, 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, 150, 8, 11, 11, 11, 12, 11, 151, 1, 11, 1, 11, 1, - 11, 1, 11, 5, 11, 158, 8, 11, 10, 11, 12, 11, 161, 9, 11, 1, 11, 1, 11, - 1, 11, 1, 11, 4, 11, 167, 8, 11, 11, 11, 12, 11, 168, 1, 11, 1, 11, 1, - 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 178, 8, 11, 1, 12, 1, 12, 1, 12, - 1, 12, 1, 13, 1, 13, 1, 13, 3, 13, 187, 8, 13, 1, 14, 1, 14, 1, 14, 1, - 14, 1, 15, 1, 15, 1, 15, 4, 15, 196, 8, 15, 11, 15, 12, 15, 197, 1, 15, - 1, 15, 1, 15, 1, 15, 5, 15, 204, 8, 15, 10, 15, 12, 15, 207, 9, 15, 1, - 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 216, 8, 15, 10, 15, - 12, 15, 219, 9, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 225, 8, 15, 1, 16, - 1, 16, 1, 16, 1, 17, 1, 17, 3, 17, 232, 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, 251, 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, 271, 0, 38, 1, 0, 0, 0, 2, 45, 1, 0, 0, 0, - 4, 68, 1, 0, 0, 0, 6, 81, 1, 0, 0, 0, 8, 89, 1, 0, 0, 0, 10, 96, 1, 0, - 0, 0, 12, 99, 1, 0, 0, 0, 14, 104, 1, 0, 0, 0, 16, 115, 1, 0, 0, 0, 18, - 125, 1, 0, 0, 0, 20, 132, 1, 0, 0, 0, 22, 177, 1, 0, 0, 0, 24, 179, 1, - 0, 0, 0, 26, 186, 1, 0, 0, 0, 28, 188, 1, 0, 0, 0, 30, 224, 1, 0, 0, 0, - 32, 226, 1, 0, 0, 0, 34, 231, 1, 0, 0, 0, 36, 250, 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, 69, 5, 41, 0, 0, 49, 69, 5, 36, 0, 0, 50, 69, 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, 69, 1, 0, 0, 0, 59, 57, 1, 0, 0, 0, 60, 69, 5, 35, 0, 0, - 61, 69, 5, 32, 0, 0, 62, 69, 3, 0, 0, 0, 63, 64, 5, 20, 0, 0, 64, 65, 3, - 4, 2, 0, 65, 66, 5, 21, 0, 0, 66, 69, 1, 0, 0, 0, 67, 69, 3, 8, 4, 0, 68, - 47, 1, 0, 0, 0, 68, 49, 1, 0, 0, 0, 68, 50, 1, 0, 0, 0, 68, 51, 1, 0, 0, - 0, 68, 60, 1, 0, 0, 0, 68, 61, 1, 0, 0, 0, 68, 62, 1, 0, 0, 0, 68, 63, - 1, 0, 0, 0, 68, 67, 1, 0, 0, 0, 69, 78, 1, 0, 0, 0, 70, 71, 10, 4, 0, 0, - 71, 72, 5, 31, 0, 0, 72, 77, 3, 4, 2, 5, 73, 74, 10, 3, 0, 0, 74, 75, 7, - 0, 0, 0, 75, 77, 3, 4, 2, 4, 76, 70, 1, 0, 0, 0, 76, 73, 1, 0, 0, 0, 77, - 80, 1, 0, 0, 0, 78, 76, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 5, 1, 0, 0, - 0, 80, 78, 1, 0, 0, 0, 81, 86, 3, 4, 2, 0, 82, 83, 5, 26, 0, 0, 83, 85, - 3, 4, 2, 0, 84, 82, 1, 0, 0, 0, 85, 88, 1, 0, 0, 0, 86, 84, 1, 0, 0, 0, - 86, 87, 1, 0, 0, 0, 87, 7, 1, 0, 0, 0, 88, 86, 1, 0, 0, 0, 89, 90, 7, 1, - 0, 0, 90, 92, 5, 20, 0, 0, 91, 93, 3, 6, 3, 0, 92, 91, 1, 0, 0, 0, 92, - 93, 1, 0, 0, 0, 93, 94, 1, 0, 0, 0, 94, 95, 5, 21, 0, 0, 95, 9, 1, 0, 0, - 0, 96, 97, 5, 27, 0, 0, 97, 98, 3, 4, 2, 0, 98, 11, 1, 0, 0, 0, 99, 100, - 5, 34, 0, 0, 100, 102, 5, 41, 0, 0, 101, 103, 3, 10, 5, 0, 102, 101, 1, - 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 13, 1, 0, 0, 0, 104, 105, 5, 5, 0, - 0, 105, 109, 5, 24, 0, 0, 106, 108, 3, 12, 6, 0, 107, 106, 1, 0, 0, 0, - 108, 111, 1, 0, 0, 0, 109, 107, 1, 0, 0, 0, 109, 110, 1, 0, 0, 0, 110, - 112, 1, 0, 0, 0, 111, 109, 1, 0, 0, 0, 112, 113, 5, 25, 0, 0, 113, 15, - 1, 0, 0, 0, 114, 116, 3, 14, 7, 0, 115, 114, 1, 0, 0, 0, 115, 116, 1, 0, - 0, 0, 116, 120, 1, 0, 0, 0, 117, 119, 3, 36, 18, 0, 118, 117, 1, 0, 0, - 0, 119, 122, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 120, 121, 1, 0, 0, 0, 121, - 123, 1, 0, 0, 0, 122, 120, 1, 0, 0, 0, 123, 124, 5, 0, 0, 1, 124, 17, 1, - 0, 0, 0, 125, 126, 5, 22, 0, 0, 126, 127, 3, 4, 2, 0, 127, 128, 5, 28, - 0, 0, 128, 129, 5, 23, 0, 0, 129, 19, 1, 0, 0, 0, 130, 133, 3, 4, 2, 0, - 131, 133, 5, 13, 0, 0, 132, 130, 1, 0, 0, 0, 132, 131, 1, 0, 0, 0, 133, - 21, 1, 0, 0, 0, 134, 135, 3, 4, 2, 0, 135, 136, 5, 14, 0, 0, 136, 137, - 5, 15, 0, 0, 137, 138, 5, 16, 0, 0, 138, 178, 1, 0, 0, 0, 139, 140, 3, - 4, 2, 0, 140, 141, 5, 14, 0, 0, 141, 142, 5, 16, 0, 0, 142, 143, 5, 11, - 0, 0, 143, 144, 5, 12, 0, 0, 144, 145, 3, 4, 2, 0, 145, 178, 1, 0, 0, 0, - 146, 178, 3, 4, 2, 0, 147, 149, 5, 24, 0, 0, 148, 150, 3, 24, 12, 0, 149, - 148, 1, 0, 0, 0, 150, 151, 1, 0, 0, 0, 151, 149, 1, 0, 0, 0, 151, 152, - 1, 0, 0, 0, 152, 153, 1, 0, 0, 0, 153, 154, 5, 25, 0, 0, 154, 178, 1, 0, - 0, 0, 155, 159, 5, 24, 0, 0, 156, 158, 3, 22, 11, 0, 157, 156, 1, 0, 0, - 0, 158, 161, 1, 0, 0, 0, 159, 157, 1, 0, 0, 0, 159, 160, 1, 0, 0, 0, 160, - 162, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 162, 178, 5, 25, 0, 0, 163, 164, - 5, 17, 0, 0, 164, 166, 5, 24, 0, 0, 165, 167, 3, 22, 11, 0, 166, 165, 1, - 0, 0, 0, 167, 168, 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 168, 169, 1, 0, 0, - 0, 169, 170, 1, 0, 0, 0, 170, 171, 5, 25, 0, 0, 171, 178, 1, 0, 0, 0, 172, - 173, 5, 6, 0, 0, 173, 174, 3, 4, 2, 0, 174, 175, 5, 10, 0, 0, 175, 176, - 3, 22, 11, 0, 176, 178, 1, 0, 0, 0, 177, 134, 1, 0, 0, 0, 177, 139, 1, - 0, 0, 0, 177, 146, 1, 0, 0, 0, 177, 147, 1, 0, 0, 0, 177, 155, 1, 0, 0, - 0, 177, 163, 1, 0, 0, 0, 177, 172, 1, 0, 0, 0, 178, 23, 1, 0, 0, 0, 179, - 180, 3, 20, 10, 0, 180, 181, 5, 10, 0, 0, 181, 182, 3, 22, 11, 0, 182, - 25, 1, 0, 0, 0, 183, 184, 5, 12, 0, 0, 184, 187, 3, 30, 15, 0, 185, 187, - 5, 18, 0, 0, 186, 183, 1, 0, 0, 0, 186, 185, 1, 0, 0, 0, 187, 27, 1, 0, - 0, 0, 188, 189, 5, 6, 0, 0, 189, 190, 3, 4, 2, 0, 190, 191, 3, 26, 13, - 0, 191, 29, 1, 0, 0, 0, 192, 225, 3, 4, 2, 0, 193, 195, 5, 24, 0, 0, 194, - 196, 3, 32, 16, 0, 195, 194, 1, 0, 0, 0, 196, 197, 1, 0, 0, 0, 197, 195, - 1, 0, 0, 0, 197, 198, 1, 0, 0, 0, 198, 199, 1, 0, 0, 0, 199, 200, 5, 25, - 0, 0, 200, 225, 1, 0, 0, 0, 201, 205, 5, 24, 0, 0, 202, 204, 3, 28, 14, - 0, 203, 202, 1, 0, 0, 0, 204, 207, 1, 0, 0, 0, 205, 203, 1, 0, 0, 0, 205, - 206, 1, 0, 0, 0, 206, 208, 1, 0, 0, 0, 207, 205, 1, 0, 0, 0, 208, 209, - 5, 13, 0, 0, 209, 210, 3, 26, 13, 0, 210, 211, 5, 25, 0, 0, 211, 225, 1, - 0, 0, 0, 212, 213, 5, 17, 0, 0, 213, 217, 5, 24, 0, 0, 214, 216, 3, 28, - 14, 0, 215, 214, 1, 0, 0, 0, 216, 219, 1, 0, 0, 0, 217, 215, 1, 0, 0, 0, - 217, 218, 1, 0, 0, 0, 218, 220, 1, 0, 0, 0, 219, 217, 1, 0, 0, 0, 220, - 221, 5, 13, 0, 0, 221, 222, 3, 26, 13, 0, 222, 223, 5, 25, 0, 0, 223, 225, - 1, 0, 0, 0, 224, 192, 1, 0, 0, 0, 224, 193, 1, 0, 0, 0, 224, 201, 1, 0, - 0, 0, 224, 212, 1, 0, 0, 0, 225, 31, 1, 0, 0, 0, 226, 227, 3, 20, 10, 0, - 227, 228, 3, 26, 13, 0, 228, 33, 1, 0, 0, 0, 229, 232, 3, 4, 2, 0, 230, - 232, 3, 18, 9, 0, 231, 229, 1, 0, 0, 0, 231, 230, 1, 0, 0, 0, 232, 35, - 1, 0, 0, 0, 233, 234, 5, 9, 0, 0, 234, 235, 3, 34, 17, 0, 235, 236, 5, - 20, 0, 0, 236, 237, 5, 7, 0, 0, 237, 238, 5, 27, 0, 0, 238, 239, 3, 22, - 11, 0, 239, 240, 5, 8, 0, 0, 240, 241, 5, 27, 0, 0, 241, 242, 3, 30, 15, - 0, 242, 243, 5, 21, 0, 0, 243, 251, 1, 0, 0, 0, 244, 245, 5, 19, 0, 0, - 245, 246, 3, 34, 17, 0, 246, 247, 5, 10, 0, 0, 247, 248, 3, 4, 2, 0, 248, - 251, 1, 0, 0, 0, 249, 251, 3, 8, 4, 0, 250, 233, 1, 0, 0, 0, 250, 244, - 1, 0, 0, 0, 250, 249, 1, 0, 0, 0, 251, 37, 1, 0, 0, 0, 23, 45, 57, 68, - 76, 78, 86, 92, 102, 109, 115, 120, 132, 151, 159, 168, 177, 186, 197, - 205, 217, 224, 231, 250, + 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 1, 1, 1, 3, 1, 48, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 5, 2, 58, 8, 2, 10, 2, 12, 2, 61, 9, 2, 1, 2, 1, 2, 1, + 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 71, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 5, 2, 79, 8, 2, 10, 2, 12, 2, 82, 9, 2, 1, 3, 1, 3, 1, 3, 5, + 3, 87, 8, 3, 10, 3, 12, 3, 90, 9, 3, 1, 4, 1, 4, 1, 4, 3, 4, 95, 8, 4, + 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 3, 6, 105, 8, 6, 1, 7, + 1, 7, 1, 7, 5, 7, 110, 8, 7, 10, 7, 12, 7, 113, 9, 7, 1, 7, 1, 7, 1, 8, + 3, 8, 118, 8, 8, 1, 8, 5, 8, 121, 8, 8, 10, 8, 12, 8, 124, 9, 8, 1, 8, + 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 3, 10, 135, 8, 10, 1, + 11, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 142, 8, 12, 1, 12, 1, 12, 1, 12, + 1, 12, 1, 12, 1, 12, 3, 12, 150, 8, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, + 12, 1, 12, 1, 12, 1, 12, 3, 12, 160, 8, 12, 1, 12, 1, 12, 4, 12, 164, 8, + 12, 11, 12, 12, 12, 165, 1, 12, 1, 12, 1, 12, 1, 12, 5, 12, 172, 8, 12, + 10, 12, 12, 12, 175, 9, 12, 1, 12, 1, 12, 1, 12, 1, 12, 4, 12, 181, 8, + 12, 11, 12, 12, 12, 182, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, + 3, 12, 192, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 3, + 14, 201, 8, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 4, 16, + 210, 8, 16, 11, 16, 12, 16, 211, 1, 16, 1, 16, 1, 16, 1, 16, 5, 16, 218, + 8, 16, 10, 16, 12, 16, 221, 9, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, + 16, 1, 16, 5, 16, 230, 8, 16, 10, 16, 12, 16, 233, 9, 16, 1, 16, 1, 16, + 1, 16, 1, 16, 3, 16, 239, 8, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 3, + 18, 246, 8, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, + 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 3, 19, 265, + 8, 19, 1, 19, 0, 1, 4, 20, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, + 26, 28, 30, 32, 34, 36, 38, 0, 2, 1, 0, 29, 30, 2, 0, 16, 16, 35, 35, 287, + 0, 40, 1, 0, 0, 0, 2, 47, 1, 0, 0, 0, 4, 70, 1, 0, 0, 0, 6, 83, 1, 0, 0, + 0, 8, 91, 1, 0, 0, 0, 10, 98, 1, 0, 0, 0, 12, 101, 1, 0, 0, 0, 14, 106, + 1, 0, 0, 0, 16, 117, 1, 0, 0, 0, 18, 127, 1, 0, 0, 0, 20, 134, 1, 0, 0, + 0, 22, 136, 1, 0, 0, 0, 24, 191, 1, 0, 0, 0, 26, 193, 1, 0, 0, 0, 28, 200, + 1, 0, 0, 0, 30, 202, 1, 0, 0, 0, 32, 238, 1, 0, 0, 0, 34, 240, 1, 0, 0, + 0, 36, 245, 1, 0, 0, 0, 38, 264, 1, 0, 0, 0, 40, 41, 5, 22, 0, 0, 41, 42, + 3, 4, 2, 0, 42, 43, 3, 4, 2, 0, 43, 44, 5, 23, 0, 0, 44, 1, 1, 0, 0, 0, + 45, 48, 5, 40, 0, 0, 46, 48, 5, 41, 0, 0, 47, 45, 1, 0, 0, 0, 47, 46, 1, + 0, 0, 0, 48, 3, 1, 0, 0, 0, 49, 50, 6, 2, -1, 0, 50, 71, 5, 42, 0, 0, 51, + 71, 5, 37, 0, 0, 52, 71, 5, 34, 0, 0, 53, 54, 5, 38, 0, 0, 54, 59, 3, 2, + 1, 0, 55, 56, 5, 39, 0, 0, 56, 58, 3, 2, 1, 0, 57, 55, 1, 0, 0, 0, 58, + 61, 1, 0, 0, 0, 59, 57, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 71, 1, 0, 0, + 0, 61, 59, 1, 0, 0, 0, 62, 71, 5, 36, 0, 0, 63, 71, 5, 33, 0, 0, 64, 71, + 3, 0, 0, 0, 65, 66, 5, 20, 0, 0, 66, 67, 3, 4, 2, 0, 67, 68, 5, 21, 0, + 0, 68, 71, 1, 0, 0, 0, 69, 71, 3, 8, 4, 0, 70, 49, 1, 0, 0, 0, 70, 51, + 1, 0, 0, 0, 70, 52, 1, 0, 0, 0, 70, 53, 1, 0, 0, 0, 70, 62, 1, 0, 0, 0, + 70, 63, 1, 0, 0, 0, 70, 64, 1, 0, 0, 0, 70, 65, 1, 0, 0, 0, 70, 69, 1, + 0, 0, 0, 71, 80, 1, 0, 0, 0, 72, 73, 10, 4, 0, 0, 73, 74, 5, 31, 0, 0, + 74, 79, 3, 4, 2, 5, 75, 76, 10, 3, 0, 0, 76, 77, 7, 0, 0, 0, 77, 79, 3, + 4, 2, 4, 78, 72, 1, 0, 0, 0, 78, 75, 1, 0, 0, 0, 79, 82, 1, 0, 0, 0, 80, + 78, 1, 0, 0, 0, 80, 81, 1, 0, 0, 0, 81, 5, 1, 0, 0, 0, 82, 80, 1, 0, 0, + 0, 83, 88, 3, 4, 2, 0, 84, 85, 5, 26, 0, 0, 85, 87, 3, 4, 2, 0, 86, 84, + 1, 0, 0, 0, 87, 90, 1, 0, 0, 0, 88, 86, 1, 0, 0, 0, 88, 89, 1, 0, 0, 0, + 89, 7, 1, 0, 0, 0, 90, 88, 1, 0, 0, 0, 91, 92, 7, 1, 0, 0, 92, 94, 5, 20, + 0, 0, 93, 95, 3, 6, 3, 0, 94, 93, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 96, + 1, 0, 0, 0, 96, 97, 5, 21, 0, 0, 97, 9, 1, 0, 0, 0, 98, 99, 5, 27, 0, 0, + 99, 100, 3, 4, 2, 0, 100, 11, 1, 0, 0, 0, 101, 102, 5, 35, 0, 0, 102, 104, + 5, 42, 0, 0, 103, 105, 3, 10, 5, 0, 104, 103, 1, 0, 0, 0, 104, 105, 1, + 0, 0, 0, 105, 13, 1, 0, 0, 0, 106, 107, 5, 5, 0, 0, 107, 111, 5, 24, 0, + 0, 108, 110, 3, 12, 6, 0, 109, 108, 1, 0, 0, 0, 110, 113, 1, 0, 0, 0, 111, + 109, 1, 0, 0, 0, 111, 112, 1, 0, 0, 0, 112, 114, 1, 0, 0, 0, 113, 111, + 1, 0, 0, 0, 114, 115, 5, 25, 0, 0, 115, 15, 1, 0, 0, 0, 116, 118, 3, 14, + 7, 0, 117, 116, 1, 0, 0, 0, 117, 118, 1, 0, 0, 0, 118, 122, 1, 0, 0, 0, + 119, 121, 3, 38, 19, 0, 120, 119, 1, 0, 0, 0, 121, 124, 1, 0, 0, 0, 122, + 120, 1, 0, 0, 0, 122, 123, 1, 0, 0, 0, 123, 125, 1, 0, 0, 0, 124, 122, + 1, 0, 0, 0, 125, 126, 5, 0, 0, 1, 126, 17, 1, 0, 0, 0, 127, 128, 5, 22, + 0, 0, 128, 129, 3, 4, 2, 0, 129, 130, 5, 28, 0, 0, 130, 131, 5, 23, 0, + 0, 131, 19, 1, 0, 0, 0, 132, 135, 3, 4, 2, 0, 133, 135, 5, 13, 0, 0, 134, + 132, 1, 0, 0, 0, 134, 133, 1, 0, 0, 0, 135, 21, 1, 0, 0, 0, 136, 137, 5, + 32, 0, 0, 137, 138, 3, 4, 2, 0, 138, 23, 1, 0, 0, 0, 139, 141, 3, 4, 2, + 0, 140, 142, 3, 22, 11, 0, 141, 140, 1, 0, 0, 0, 141, 142, 1, 0, 0, 0, + 142, 143, 1, 0, 0, 0, 143, 144, 5, 14, 0, 0, 144, 145, 5, 15, 0, 0, 145, + 146, 5, 16, 0, 0, 146, 192, 1, 0, 0, 0, 147, 149, 3, 4, 2, 0, 148, 150, + 3, 22, 11, 0, 149, 148, 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 151, 1, + 0, 0, 0, 151, 152, 5, 14, 0, 0, 152, 153, 5, 16, 0, 0, 153, 154, 5, 11, + 0, 0, 154, 155, 5, 12, 0, 0, 155, 156, 3, 4, 2, 0, 156, 192, 1, 0, 0, 0, + 157, 159, 3, 4, 2, 0, 158, 160, 3, 22, 11, 0, 159, 158, 1, 0, 0, 0, 159, + 160, 1, 0, 0, 0, 160, 192, 1, 0, 0, 0, 161, 163, 5, 24, 0, 0, 162, 164, + 3, 26, 13, 0, 163, 162, 1, 0, 0, 0, 164, 165, 1, 0, 0, 0, 165, 163, 1, + 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 168, 5, 25, 0, + 0, 168, 192, 1, 0, 0, 0, 169, 173, 5, 24, 0, 0, 170, 172, 3, 24, 12, 0, + 171, 170, 1, 0, 0, 0, 172, 175, 1, 0, 0, 0, 173, 171, 1, 0, 0, 0, 173, + 174, 1, 0, 0, 0, 174, 176, 1, 0, 0, 0, 175, 173, 1, 0, 0, 0, 176, 192, + 5, 25, 0, 0, 177, 178, 5, 17, 0, 0, 178, 180, 5, 24, 0, 0, 179, 181, 3, + 24, 12, 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, 25, 0, 0, + 185, 192, 1, 0, 0, 0, 186, 187, 5, 6, 0, 0, 187, 188, 3, 4, 2, 0, 188, + 189, 5, 10, 0, 0, 189, 190, 3, 24, 12, 0, 190, 192, 1, 0, 0, 0, 191, 139, + 1, 0, 0, 0, 191, 147, 1, 0, 0, 0, 191, 157, 1, 0, 0, 0, 191, 161, 1, 0, + 0, 0, 191, 169, 1, 0, 0, 0, 191, 177, 1, 0, 0, 0, 191, 186, 1, 0, 0, 0, + 192, 25, 1, 0, 0, 0, 193, 194, 3, 20, 10, 0, 194, 195, 5, 10, 0, 0, 195, + 196, 3, 24, 12, 0, 196, 27, 1, 0, 0, 0, 197, 198, 5, 12, 0, 0, 198, 201, + 3, 32, 16, 0, 199, 201, 5, 18, 0, 0, 200, 197, 1, 0, 0, 0, 200, 199, 1, + 0, 0, 0, 201, 29, 1, 0, 0, 0, 202, 203, 5, 6, 0, 0, 203, 204, 3, 4, 2, + 0, 204, 205, 3, 28, 14, 0, 205, 31, 1, 0, 0, 0, 206, 239, 3, 4, 2, 0, 207, + 209, 5, 24, 0, 0, 208, 210, 3, 34, 17, 0, 209, 208, 1, 0, 0, 0, 210, 211, + 1, 0, 0, 0, 211, 209, 1, 0, 0, 0, 211, 212, 1, 0, 0, 0, 212, 213, 1, 0, + 0, 0, 213, 214, 5, 25, 0, 0, 214, 239, 1, 0, 0, 0, 215, 219, 5, 24, 0, + 0, 216, 218, 3, 30, 15, 0, 217, 216, 1, 0, 0, 0, 218, 221, 1, 0, 0, 0, + 219, 217, 1, 0, 0, 0, 219, 220, 1, 0, 0, 0, 220, 222, 1, 0, 0, 0, 221, + 219, 1, 0, 0, 0, 222, 223, 5, 13, 0, 0, 223, 224, 3, 28, 14, 0, 224, 225, + 5, 25, 0, 0, 225, 239, 1, 0, 0, 0, 226, 227, 5, 17, 0, 0, 227, 231, 5, + 24, 0, 0, 228, 230, 3, 30, 15, 0, 229, 228, 1, 0, 0, 0, 230, 233, 1, 0, + 0, 0, 231, 229, 1, 0, 0, 0, 231, 232, 1, 0, 0, 0, 232, 234, 1, 0, 0, 0, + 233, 231, 1, 0, 0, 0, 234, 235, 5, 13, 0, 0, 235, 236, 3, 28, 14, 0, 236, + 237, 5, 25, 0, 0, 237, 239, 1, 0, 0, 0, 238, 206, 1, 0, 0, 0, 238, 207, + 1, 0, 0, 0, 238, 215, 1, 0, 0, 0, 238, 226, 1, 0, 0, 0, 239, 33, 1, 0, + 0, 0, 240, 241, 3, 20, 10, 0, 241, 242, 3, 28, 14, 0, 242, 35, 1, 0, 0, + 0, 243, 246, 3, 4, 2, 0, 244, 246, 3, 18, 9, 0, 245, 243, 1, 0, 0, 0, 245, + 244, 1, 0, 0, 0, 246, 37, 1, 0, 0, 0, 247, 248, 5, 9, 0, 0, 248, 249, 3, + 36, 18, 0, 249, 250, 5, 20, 0, 0, 250, 251, 5, 7, 0, 0, 251, 252, 5, 27, + 0, 0, 252, 253, 3, 24, 12, 0, 253, 254, 5, 8, 0, 0, 254, 255, 5, 27, 0, + 0, 255, 256, 3, 32, 16, 0, 256, 257, 5, 21, 0, 0, 257, 265, 1, 0, 0, 0, + 258, 259, 5, 19, 0, 0, 259, 260, 3, 36, 18, 0, 260, 261, 5, 10, 0, 0, 261, + 262, 3, 4, 2, 0, 262, 265, 1, 0, 0, 0, 263, 265, 3, 8, 4, 0, 264, 247, + 1, 0, 0, 0, 264, 258, 1, 0, 0, 0, 264, 263, 1, 0, 0, 0, 265, 39, 1, 0, + 0, 0, 26, 47, 59, 70, 78, 80, 88, 94, 104, 111, 117, 122, 134, 141, 149, + 159, 165, 173, 182, 191, 200, 211, 219, 231, 238, 245, 264, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -236,16 +242,17 @@ const ( NumscriptParserPLUS = 29 NumscriptParserMINUS = 30 NumscriptParserDIV = 31 - NumscriptParserPERCENTAGE_PORTION_LITERAL = 32 - NumscriptParserSTRING = 33 - NumscriptParserIDENTIFIER = 34 - NumscriptParserNUMBER = 35 - NumscriptParserASSET = 36 - NumscriptParserACCOUNT_START = 37 - NumscriptParserCOLON = 38 - NumscriptParserACCOUNT_TEXT = 39 - NumscriptParserVARIABLE_NAME_ACC = 40 - NumscriptParserVARIABLE_NAME = 41 + NumscriptParserRESTRICT = 32 + NumscriptParserPERCENTAGE_PORTION_LITERAL = 33 + NumscriptParserSTRING = 34 + NumscriptParserIDENTIFIER = 35 + NumscriptParserNUMBER = 36 + NumscriptParserASSET = 37 + NumscriptParserACCOUNT_START = 38 + NumscriptParserCOLON = 39 + NumscriptParserACCOUNT_TEXT = 40 + NumscriptParserVARIABLE_NAME_ACC = 41 + NumscriptParserVARIABLE_NAME = 42 ) // NumscriptParser rules. @@ -261,14 +268,15 @@ const ( 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 + NumscriptParserRULE_colorConstraint = 11 + NumscriptParserRULE_source = 12 + NumscriptParserRULE_allotmentClauseSrc = 13 + NumscriptParserRULE_keptOrDestination = 14 + NumscriptParserRULE_destinationInOrderClause = 15 + NumscriptParserRULE_destination = 16 + NumscriptParserRULE_allotmentClauseDest = 17 + NumscriptParserRULE_sentValue = 18 + NumscriptParserRULE_statement = 19 ) // IMonetaryLitContext is an interface to support dynamic dispatch. @@ -416,7 +424,7 @@ func (p *NumscriptParser) MonetaryLit() (localctx IMonetaryLitContext) { p.EnterRule(localctx, 0, NumscriptParserRULE_monetaryLit) p.EnterOuterAlt(localctx, 1) { - p.SetState(38) + p.SetState(40) p.Match(NumscriptParserLBRACKET) if p.HasError() { // Recognition error - abort rule @@ -425,7 +433,7 @@ func (p *NumscriptParser) MonetaryLit() (localctx IMonetaryLitContext) { } { - p.SetState(39) + p.SetState(41) var _x = p.valueExpr(0) @@ -433,7 +441,7 @@ func (p *NumscriptParser) MonetaryLit() (localctx IMonetaryLitContext) { } { - p.SetState(40) + p.SetState(42) var _x = p.valueExpr(0) @@ -441,7 +449,7 @@ func (p *NumscriptParser) MonetaryLit() (localctx IMonetaryLitContext) { } { - p.SetState(41) + p.SetState(43) p.Match(NumscriptParserRBRACKET) if p.HasError() { // Recognition error - abort rule @@ -587,7 +595,7 @@ func (s *AccountTextPartContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) AccountLiteralPart() (localctx IAccountLiteralPartContext) { localctx = NewAccountLiteralPartContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 2, NumscriptParserRULE_accountLiteralPart) - p.SetState(45) + p.SetState(47) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -598,7 +606,7 @@ func (p *NumscriptParser) AccountLiteralPart() (localctx IAccountLiteralPartCont localctx = NewAccountTextPartContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(43) + p.SetState(45) p.Match(NumscriptParserACCOUNT_TEXT) if p.HasError() { // Recognition error - abort rule @@ -610,7 +618,7 @@ func (p *NumscriptParser) AccountLiteralPart() (localctx IAccountLiteralPartCont localctx = NewAccountVarPartContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(44) + p.SetState(46) p.Match(NumscriptParserVARIABLE_NAME_ACC) if p.HasError() { // Recognition error - abort rule @@ -1205,7 +1213,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { var _alt int p.EnterOuterAlt(localctx, 1) - p.SetState(68) + p.SetState(70) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1218,7 +1226,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { _prevctx = localctx { - p.SetState(48) + p.SetState(50) p.Match(NumscriptParserVARIABLE_NAME) if p.HasError() { // Recognition error - abort rule @@ -1231,7 +1239,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(49) + p.SetState(51) p.Match(NumscriptParserASSET) if p.HasError() { // Recognition error - abort rule @@ -1244,7 +1252,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(50) + p.SetState(52) p.Match(NumscriptParserSTRING) if p.HasError() { // Recognition error - abort rule @@ -1257,7 +1265,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(51) + p.SetState(53) p.Match(NumscriptParserACCOUNT_START) if p.HasError() { // Recognition error - abort rule @@ -1265,10 +1273,10 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { } } { - p.SetState(52) + p.SetState(54) p.AccountLiteralPart() } - p.SetState(57) + p.SetState(59) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1280,7 +1288,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(53) + p.SetState(55) p.Match(NumscriptParserCOLON) if p.HasError() { // Recognition error - abort rule @@ -1288,12 +1296,12 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { } } { - p.SetState(54) + p.SetState(56) p.AccountLiteralPart() } } - p.SetState(59) + p.SetState(61) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1309,7 +1317,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(60) + p.SetState(62) p.Match(NumscriptParserNUMBER) if p.HasError() { // Recognition error - abort rule @@ -1322,7 +1330,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(61) + p.SetState(63) p.Match(NumscriptParserPERCENTAGE_PORTION_LITERAL) if p.HasError() { // Recognition error - abort rule @@ -1335,7 +1343,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(62) + p.SetState(64) p.MonetaryLit() } @@ -1344,7 +1352,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(63) + p.SetState(65) p.Match(NumscriptParserLPARENS) if p.HasError() { // Recognition error - abort rule @@ -1352,11 +1360,11 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { } } { - p.SetState(64) + p.SetState(66) p.valueExpr(0) } { - p.SetState(65) + p.SetState(67) p.Match(NumscriptParserRPARENS) if p.HasError() { // Recognition error - abort rule @@ -1369,7 +1377,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(67) + p.SetState(69) p.FunctionCall() } @@ -1378,7 +1386,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { goto errorExit } p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) - p.SetState(78) + p.SetState(80) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1393,7 +1401,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { p.TriggerExitRuleEvent() } _prevctx = localctx - p.SetState(76) + p.SetState(78) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1405,14 +1413,14 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { localctx.(*InfixExprContext).left = _prevctx p.PushNewRecursionContext(localctx, _startState, NumscriptParserRULE_valueExpr) - p.SetState(70) + p.SetState(72) if !(p.Precpred(p.GetParserRuleContext(), 4)) { p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", "")) goto errorExit } { - p.SetState(71) + p.SetState(73) var _m = p.Match(NumscriptParserDIV) @@ -1423,7 +1431,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { } } { - p.SetState(72) + p.SetState(74) var _x = p.valueExpr(5) @@ -1435,14 +1443,14 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { localctx.(*InfixExprContext).left = _prevctx p.PushNewRecursionContext(localctx, _startState, NumscriptParserRULE_valueExpr) - p.SetState(73) + p.SetState(75) if !(p.Precpred(p.GetParserRuleContext(), 3)) { p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", "")) goto errorExit } { - p.SetState(74) + p.SetState(76) var _lt = p.GetTokenStream().LT(1) @@ -1460,7 +1468,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { } } { - p.SetState(75) + p.SetState(77) var _x = p.valueExpr(4) @@ -1472,7 +1480,7 @@ func (p *NumscriptParser) valueExpr(_p int) (localctx IValueExprContext) { } } - p.SetState(80) + p.SetState(82) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1621,10 +1629,10 @@ func (p *NumscriptParser) FunctionCallArgs() (localctx IFunctionCallArgsContext) p.EnterOuterAlt(localctx, 1) { - p.SetState(81) + p.SetState(83) p.valueExpr(0) } - p.SetState(86) + p.SetState(88) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1633,7 +1641,7 @@ func (p *NumscriptParser) FunctionCallArgs() (localctx IFunctionCallArgsContext) for _la == NumscriptParserCOMMA { { - p.SetState(82) + p.SetState(84) p.Match(NumscriptParserCOMMA) if p.HasError() { // Recognition error - abort rule @@ -1641,11 +1649,11 @@ func (p *NumscriptParser) FunctionCallArgs() (localctx IFunctionCallArgsContext) } } { - p.SetState(83) + p.SetState(85) p.valueExpr(0) } - p.SetState(88) + p.SetState(90) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1786,7 +1794,7 @@ func (p *NumscriptParser) FunctionCall() (localctx IFunctionCallContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(89) + p.SetState(91) var _lt = p.GetTokenStream().LT(1) @@ -1804,29 +1812,29 @@ func (p *NumscriptParser) FunctionCall() (localctx IFunctionCallContext) { } } { - p.SetState(90) + p.SetState(92) p.Match(NumscriptParserLPARENS) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(92) + p.SetState(94) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2469611503616) != 0 { + if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&4939217698816) != 0 { { - p.SetState(91) + p.SetState(93) p.FunctionCallArgs() } } { - p.SetState(94) + p.SetState(96) p.Match(NumscriptParserRPARENS) if p.HasError() { // Recognition error - abort rule @@ -1939,7 +1947,7 @@ func (p *NumscriptParser) VarOrigin() (localctx IVarOriginContext) { p.EnterRule(localctx, 10, NumscriptParserRULE_varOrigin) p.EnterOuterAlt(localctx, 1) { - p.SetState(96) + p.SetState(98) p.Match(NumscriptParserEQ) if p.HasError() { // Recognition error - abort rule @@ -1947,7 +1955,7 @@ func (p *NumscriptParser) VarOrigin() (localctx IVarOriginContext) { } } { - p.SetState(97) + p.SetState(99) p.valueExpr(0) } @@ -2085,7 +2093,7 @@ func (p *NumscriptParser) VarDeclaration() (localctx IVarDeclarationContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(99) + p.SetState(101) var _m = p.Match(NumscriptParserIDENTIFIER) @@ -2096,7 +2104,7 @@ func (p *NumscriptParser) VarDeclaration() (localctx IVarDeclarationContext) { } } { - p.SetState(100) + p.SetState(102) var _m = p.Match(NumscriptParserVARIABLE_NAME) @@ -2106,7 +2114,7 @@ func (p *NumscriptParser) VarDeclaration() (localctx IVarDeclarationContext) { goto errorExit } } - p.SetState(102) + p.SetState(104) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2115,7 +2123,7 @@ func (p *NumscriptParser) VarDeclaration() (localctx IVarDeclarationContext) { if _la == NumscriptParserEQ { { - p.SetState(101) + p.SetState(103) p.VarOrigin() } @@ -2264,7 +2272,7 @@ func (p *NumscriptParser) VarsDeclaration() (localctx IVarsDeclarationContext) { p.EnterOuterAlt(localctx, 1) { - p.SetState(104) + p.SetState(106) p.Match(NumscriptParserVARS) if p.HasError() { // Recognition error - abort rule @@ -2272,14 +2280,14 @@ func (p *NumscriptParser) VarsDeclaration() (localctx IVarsDeclarationContext) { } } { - p.SetState(105) + p.SetState(107) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(109) + p.SetState(111) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2288,11 +2296,11 @@ func (p *NumscriptParser) VarsDeclaration() (localctx IVarsDeclarationContext) { for _la == NumscriptParserIDENTIFIER { { - p.SetState(106) + p.SetState(108) p.VarDeclaration() } - p.SetState(111) + p.SetState(113) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2300,7 +2308,7 @@ func (p *NumscriptParser) VarsDeclaration() (localctx IVarsDeclarationContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(112) + p.SetState(114) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -2457,7 +2465,7 @@ func (p *NumscriptParser) Program() (localctx IProgramContext) { var _la int p.EnterOuterAlt(localctx, 1) - p.SetState(115) + p.SetState(117) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2466,25 +2474,25 @@ func (p *NumscriptParser) Program() (localctx IProgramContext) { if _la == NumscriptParserVARS { { - p.SetState(114) + p.SetState(116) p.VarsDeclaration() } } - p.SetState(120) + p.SetState(122) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&17180459520) != 0 { + for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&34360328704) != 0 { { - p.SetState(117) + p.SetState(119) p.Statement() } - p.SetState(122) + p.SetState(124) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2492,7 +2500,7 @@ func (p *NumscriptParser) Program() (localctx IProgramContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(123) + p.SetState(125) p.Match(NumscriptParserEOF) if p.HasError() { // Recognition error - abort rule @@ -2626,7 +2634,7 @@ func (p *NumscriptParser) SentAllLit() (localctx ISentAllLitContext) { p.EnterRule(localctx, 18, NumscriptParserRULE_sentAllLit) p.EnterOuterAlt(localctx, 1) { - p.SetState(125) + p.SetState(127) p.Match(NumscriptParserLBRACKET) if p.HasError() { // Recognition error - abort rule @@ -2635,7 +2643,7 @@ func (p *NumscriptParser) SentAllLit() (localctx ISentAllLitContext) { } { - p.SetState(126) + p.SetState(128) var _x = p.valueExpr(0) @@ -2643,7 +2651,7 @@ func (p *NumscriptParser) SentAllLit() (localctx ISentAllLitContext) { } { - p.SetState(127) + p.SetState(129) p.Match(NumscriptParserSTAR) if p.HasError() { // Recognition error - abort rule @@ -2651,7 +2659,7 @@ func (p *NumscriptParser) SentAllLit() (localctx ISentAllLitContext) { } } { - p.SetState(128) + p.SetState(130) p.Match(NumscriptParserRBRACKET) if p.HasError() { // Recognition error - abort rule @@ -2809,7 +2817,7 @@ func (s *PortionedAllotmentContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) Allotment() (localctx IAllotmentContext) { localctx = NewAllotmentContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 20, NumscriptParserRULE_allotment) - p.SetState(132) + p.SetState(134) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2820,7 +2828,7 @@ func (p *NumscriptParser) Allotment() (localctx IAllotmentContext) { localctx = NewPortionedAllotmentContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(130) + p.SetState(132) p.valueExpr(0) } @@ -2828,7 +2836,7 @@ func (p *NumscriptParser) Allotment() (localctx IAllotmentContext) { localctx = NewRemainingAllotmentContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(131) + p.SetState(133) p.Match(NumscriptParserREMAINING) if p.HasError() { // Recognition error - abort rule @@ -2854,6 +2862,123 @@ errorExit: goto errorExit // Trick to prevent compiler error if the label is not used } +// IColorConstraintContext is an interface to support dynamic dispatch. +type IColorConstraintContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RESTRICT() antlr.TerminalNode + ValueExpr() IValueExprContext + + // IsColorConstraintContext differentiates from other interfaces. + IsColorConstraintContext() +} + +type ColorConstraintContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyColorConstraintContext() *ColorConstraintContext { + var p = new(ColorConstraintContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = NumscriptParserRULE_colorConstraint + return p +} + +func InitEmptyColorConstraintContext(p *ColorConstraintContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = NumscriptParserRULE_colorConstraint +} + +func (*ColorConstraintContext) IsColorConstraintContext() {} + +func NewColorConstraintContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ColorConstraintContext { + var p = new(ColorConstraintContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = NumscriptParserRULE_colorConstraint + + return p +} + +func (s *ColorConstraintContext) GetParser() antlr.Parser { return s.parser } + +func (s *ColorConstraintContext) RESTRICT() antlr.TerminalNode { + return s.GetToken(NumscriptParserRESTRICT, 0) +} + +func (s *ColorConstraintContext) ValueExpr() IValueExprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IValueExprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IValueExprContext) +} + +func (s *ColorConstraintContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ColorConstraintContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ColorConstraintContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(NumscriptListener); ok { + listenerT.EnterColorConstraint(s) + } +} + +func (s *ColorConstraintContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(NumscriptListener); ok { + listenerT.ExitColorConstraint(s) + } +} + +func (p *NumscriptParser) ColorConstraint() (localctx IColorConstraintContext) { + localctx = NewColorConstraintContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 22, NumscriptParserRULE_colorConstraint) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(136) + p.Match(NumscriptParserRESTRICT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(137) + p.valueExpr(0) + } + +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 +} + // ISourceContext is an interface to support dynamic dispatch. type ISourceContext interface { antlr.ParserRuleContext @@ -2993,6 +3118,22 @@ func (s *SrcAccountBoundedOverdraftContext) ValueExpr(i int) IValueExprContext { return t.(IValueExprContext) } +func (s *SrcAccountBoundedOverdraftContext) ColorConstraint() IColorConstraintContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColorConstraintContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColorConstraintContext) +} + func (s *SrcAccountBoundedOverdraftContext) EnterRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(NumscriptListener); ok { listenerT.EnterSrcAccountBoundedOverdraft(s) @@ -3139,6 +3280,22 @@ func (s *SrcAccountUnboundedOverdraftContext) ValueExpr() IValueExprContext { return t.(IValueExprContext) } +func (s *SrcAccountUnboundedOverdraftContext) ColorConstraint() IColorConstraintContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColorConstraintContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColorConstraintContext) +} + func (s *SrcAccountUnboundedOverdraftContext) EnterRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(NumscriptListener); ok { listenerT.EnterSrcAccountUnboundedOverdraft(s) @@ -3418,6 +3575,22 @@ func (s *SrcAccountContext) ValueExpr() IValueExprContext { return t.(IValueExprContext) } +func (s *SrcAccountContext) ColorConstraint() IColorConstraintContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColorConstraintContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColorConstraintContext) +} + func (s *SrcAccountContext) EnterRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(NumscriptListener); ok { listenerT.EnterSrcAccount(s) @@ -3432,28 +3605,42 @@ func (s *SrcAccountContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) Source() (localctx ISourceContext) { localctx = NewSourceContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 22, NumscriptParserRULE_source) + p.EnterRule(localctx, 24, NumscriptParserRULE_source) var _la int - p.SetState(177) + p.SetState(191) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 15, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 18, p.GetParserRuleContext()) { case 1: localctx = NewSrcAccountUnboundedOverdraftContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(134) + p.SetState(139) var _x = p.valueExpr(0) localctx.(*SrcAccountUnboundedOverdraftContext).address = _x } + p.SetState(141) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == NumscriptParserRESTRICT { + { + p.SetState(140) + p.ColorConstraint() + } + + } { - p.SetState(135) + p.SetState(143) p.Match(NumscriptParserALLOWING) if p.HasError() { // Recognition error - abort rule @@ -3461,7 +3648,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(136) + p.SetState(144) p.Match(NumscriptParserUNBOUNDED) if p.HasError() { // Recognition error - abort rule @@ -3469,7 +3656,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(137) + p.SetState(145) p.Match(NumscriptParserOVERDRAFT) if p.HasError() { // Recognition error - abort rule @@ -3481,14 +3668,28 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { localctx = NewSrcAccountBoundedOverdraftContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(139) + p.SetState(147) var _x = p.valueExpr(0) localctx.(*SrcAccountBoundedOverdraftContext).address = _x } + p.SetState(149) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == NumscriptParserRESTRICT { + { + p.SetState(148) + p.ColorConstraint() + } + + } { - p.SetState(140) + p.SetState(151) p.Match(NumscriptParserALLOWING) if p.HasError() { // Recognition error - abort rule @@ -3496,7 +3697,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(141) + p.SetState(152) p.Match(NumscriptParserOVERDRAFT) if p.HasError() { // Recognition error - abort rule @@ -3504,7 +3705,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(142) + p.SetState(153) p.Match(NumscriptParserUP) if p.HasError() { // Recognition error - abort rule @@ -3512,7 +3713,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(143) + p.SetState(154) p.Match(NumscriptParserTO) if p.HasError() { // Recognition error - abort rule @@ -3520,7 +3721,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(144) + p.SetState(155) var _x = p.valueExpr(0) @@ -3531,35 +3732,49 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { localctx = NewSrcAccountContext(p, localctx) p.EnterOuterAlt(localctx, 3) { - p.SetState(146) + p.SetState(157) p.valueExpr(0) } + p.SetState(159) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == NumscriptParserRESTRICT { + { + p.SetState(158) + p.ColorConstraint() + } + + } case 4: localctx = NewSrcAllotmentContext(p, localctx) p.EnterOuterAlt(localctx, 4) { - p.SetState(147) + p.SetState(161) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(149) + p.SetState(163) 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)&2469611511808) != 0) { + for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&4939217707008) != 0) { { - p.SetState(148) + p.SetState(162) p.AllotmentClauseSrc() } - p.SetState(151) + p.SetState(165) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3567,7 +3782,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(153) + p.SetState(167) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -3579,27 +3794,27 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { localctx = NewSrcInorderContext(p, localctx) p.EnterOuterAlt(localctx, 5) { - p.SetState(155) + p.SetState(169) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(159) + p.SetState(173) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2469628411968) != 0 { + for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&4939234607168) != 0 { { - p.SetState(156) + p.SetState(170) p.Source() } - p.SetState(161) + p.SetState(175) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3607,7 +3822,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(162) + p.SetState(176) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -3619,7 +3834,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { localctx = NewSrcOneofContext(p, localctx) p.EnterOuterAlt(localctx, 6) { - p.SetState(163) + p.SetState(177) p.Match(NumscriptParserONEOF) if p.HasError() { // Recognition error - abort rule @@ -3627,27 +3842,27 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(164) + p.SetState(178) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(166) + p.SetState(180) 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)&2469628411968) != 0) { + for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&4939234607168) != 0) { { - p.SetState(165) + p.SetState(179) p.Source() } - p.SetState(168) + p.SetState(182) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3655,7 +3870,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(170) + p.SetState(184) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -3667,7 +3882,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { localctx = NewSrcCappedContext(p, localctx) p.EnterOuterAlt(localctx, 7) { - p.SetState(172) + p.SetState(186) p.Match(NumscriptParserMAX) if p.HasError() { // Recognition error - abort rule @@ -3675,14 +3890,14 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(173) + p.SetState(187) var _x = p.valueExpr(0) localctx.(*SrcCappedContext).cap_ = _x } { - p.SetState(174) + p.SetState(188) p.Match(NumscriptParserFROM) if p.HasError() { // Recognition error - abort rule @@ -3690,7 +3905,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(175) + p.SetState(189) p.Source() } @@ -3817,14 +4032,14 @@ func (s *AllotmentClauseSrcContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) AllotmentClauseSrc() (localctx IAllotmentClauseSrcContext) { localctx = NewAllotmentClauseSrcContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 24, NumscriptParserRULE_allotmentClauseSrc) + p.EnterRule(localctx, 26, NumscriptParserRULE_allotmentClauseSrc) p.EnterOuterAlt(localctx, 1) { - p.SetState(179) + p.SetState(193) p.Allotment() } { - p.SetState(180) + p.SetState(194) p.Match(NumscriptParserFROM) if p.HasError() { // Recognition error - abort rule @@ -3832,7 +4047,7 @@ func (p *NumscriptParser) AllotmentClauseSrc() (localctx IAllotmentClauseSrcCont } } { - p.SetState(181) + p.SetState(195) p.Source() } @@ -3989,8 +4204,8 @@ func (s *DestinationToContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) KeptOrDestination() (localctx IKeptOrDestinationContext) { localctx = NewKeptOrDestinationContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 26, NumscriptParserRULE_keptOrDestination) - p.SetState(186) + p.EnterRule(localctx, 28, NumscriptParserRULE_keptOrDestination) + p.SetState(200) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4001,7 +4216,7 @@ func (p *NumscriptParser) KeptOrDestination() (localctx IKeptOrDestinationContex localctx = NewDestinationToContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(183) + p.SetState(197) p.Match(NumscriptParserTO) if p.HasError() { // Recognition error - abort rule @@ -4009,7 +4224,7 @@ func (p *NumscriptParser) KeptOrDestination() (localctx IKeptOrDestinationContex } } { - p.SetState(184) + p.SetState(198) p.Destination() } @@ -4017,7 +4232,7 @@ func (p *NumscriptParser) KeptOrDestination() (localctx IKeptOrDestinationContex localctx = NewDestinationKeptContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(185) + p.SetState(199) p.Match(NumscriptParserKEPT) if p.HasError() { // Recognition error - abort rule @@ -4149,10 +4364,10 @@ func (s *DestinationInOrderClauseContext) ExitRule(listener antlr.ParseTreeListe func (p *NumscriptParser) DestinationInOrderClause() (localctx IDestinationInOrderClauseContext) { localctx = NewDestinationInOrderClauseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 28, NumscriptParserRULE_destinationInOrderClause) + p.EnterRule(localctx, 30, NumscriptParserRULE_destinationInOrderClause) p.EnterOuterAlt(localctx, 1) { - p.SetState(188) + p.SetState(202) p.Match(NumscriptParserMAX) if p.HasError() { // Recognition error - abort rule @@ -4160,11 +4375,11 @@ func (p *NumscriptParser) DestinationInOrderClause() (localctx IDestinationInOrd } } { - p.SetState(189) + p.SetState(203) p.valueExpr(0) } { - p.SetState(190) + p.SetState(204) p.KeptOrDestination() } @@ -4564,21 +4779,21 @@ func (s *DestAllotmentContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) Destination() (localctx IDestinationContext) { localctx = NewDestinationContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 30, NumscriptParserRULE_destination) + p.EnterRule(localctx, 32, NumscriptParserRULE_destination) var _la int - p.SetState(224) + p.SetState(238) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 20, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 23, p.GetParserRuleContext()) { case 1: localctx = NewDestAccountContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(192) + p.SetState(206) p.valueExpr(0) } @@ -4586,27 +4801,27 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { localctx = NewDestAllotmentContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(193) + p.SetState(207) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(195) + p.SetState(209) 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)&2469611511808) != 0) { + for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&4939217707008) != 0) { { - p.SetState(194) + p.SetState(208) p.AllotmentClauseDest() } - p.SetState(197) + p.SetState(211) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4614,7 +4829,7 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(199) + p.SetState(213) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -4626,14 +4841,14 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { localctx = NewDestInorderContext(p, localctx) p.EnterOuterAlt(localctx, 3) { - p.SetState(201) + p.SetState(215) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(205) + p.SetState(219) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4642,11 +4857,11 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { for _la == NumscriptParserMAX { { - p.SetState(202) + p.SetState(216) p.DestinationInOrderClause() } - p.SetState(207) + p.SetState(221) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4654,7 +4869,7 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(208) + p.SetState(222) p.Match(NumscriptParserREMAINING) if p.HasError() { // Recognition error - abort rule @@ -4662,11 +4877,11 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { } } { - p.SetState(209) + p.SetState(223) p.KeptOrDestination() } { - p.SetState(210) + p.SetState(224) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -4678,7 +4893,7 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { localctx = NewDestOneofContext(p, localctx) p.EnterOuterAlt(localctx, 4) { - p.SetState(212) + p.SetState(226) p.Match(NumscriptParserONEOF) if p.HasError() { // Recognition error - abort rule @@ -4686,14 +4901,14 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { } } { - p.SetState(213) + p.SetState(227) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(217) + p.SetState(231) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4702,11 +4917,11 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { for _la == NumscriptParserMAX { { - p.SetState(214) + p.SetState(228) p.DestinationInOrderClause() } - p.SetState(219) + p.SetState(233) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4714,7 +4929,7 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(220) + p.SetState(234) p.Match(NumscriptParserREMAINING) if p.HasError() { // Recognition error - abort rule @@ -4722,11 +4937,11 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { } } { - p.SetState(221) + p.SetState(235) p.KeptOrDestination() } { - p.SetState(222) + p.SetState(236) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -4852,14 +5067,14 @@ func (s *AllotmentClauseDestContext) ExitRule(listener antlr.ParseTreeListener) func (p *NumscriptParser) AllotmentClauseDest() (localctx IAllotmentClauseDestContext) { localctx = NewAllotmentClauseDestContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 32, NumscriptParserRULE_allotmentClauseDest) + p.EnterRule(localctx, 34, NumscriptParserRULE_allotmentClauseDest) p.EnterOuterAlt(localctx, 1) { - p.SetState(226) + p.SetState(240) p.Allotment() } { - p.SetState(227) + p.SetState(241) p.KeptOrDestination() } @@ -5024,19 +5239,19 @@ func (s *SentLiteralContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) SentValue() (localctx ISentValueContext) { localctx = NewSentValueContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 34, NumscriptParserRULE_sentValue) - p.SetState(231) + p.EnterRule(localctx, 36, NumscriptParserRULE_sentValue) + p.SetState(245) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 21, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 24, p.GetParserRuleContext()) { case 1: localctx = NewSentLiteralContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(229) + p.SetState(243) p.valueExpr(0) } @@ -5044,7 +5259,7 @@ func (p *NumscriptParser) SentValue() (localctx ISentValueContext) { localctx = NewSentAllContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(230) + p.SetState(244) p.SentAllLit() } @@ -5343,8 +5558,8 @@ func (s *FnCallStatementContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) Statement() (localctx IStatementContext) { localctx = NewStatementContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 36, NumscriptParserRULE_statement) - p.SetState(250) + p.EnterRule(localctx, 38, NumscriptParserRULE_statement) + p.SetState(264) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -5355,7 +5570,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { localctx = NewSendStatementContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(233) + p.SetState(247) p.Match(NumscriptParserSEND) if p.HasError() { // Recognition error - abort rule @@ -5363,11 +5578,11 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(234) + p.SetState(248) p.SentValue() } { - p.SetState(235) + p.SetState(249) p.Match(NumscriptParserLPARENS) if p.HasError() { // Recognition error - abort rule @@ -5375,7 +5590,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(236) + p.SetState(250) p.Match(NumscriptParserSOURCE) if p.HasError() { // Recognition error - abort rule @@ -5383,7 +5598,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(237) + p.SetState(251) p.Match(NumscriptParserEQ) if p.HasError() { // Recognition error - abort rule @@ -5391,11 +5606,11 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(238) + p.SetState(252) p.Source() } { - p.SetState(239) + p.SetState(253) p.Match(NumscriptParserDESTINATION) if p.HasError() { // Recognition error - abort rule @@ -5403,7 +5618,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(240) + p.SetState(254) p.Match(NumscriptParserEQ) if p.HasError() { // Recognition error - abort rule @@ -5411,11 +5626,11 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(241) + p.SetState(255) p.Destination() } { - p.SetState(242) + p.SetState(256) p.Match(NumscriptParserRPARENS) if p.HasError() { // Recognition error - abort rule @@ -5427,7 +5642,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { localctx = NewSaveStatementContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(244) + p.SetState(258) p.Match(NumscriptParserSAVE) if p.HasError() { // Recognition error - abort rule @@ -5435,11 +5650,11 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(245) + p.SetState(259) p.SentValue() } { - p.SetState(246) + p.SetState(260) p.Match(NumscriptParserFROM) if p.HasError() { // Recognition error - abort rule @@ -5447,7 +5662,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(247) + p.SetState(261) p.valueExpr(0) } @@ -5455,7 +5670,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { localctx = NewFnCallStatementContext(p, localctx) p.EnterOuterAlt(localctx, 3) { - p.SetState(249) + p.SetState(263) p.FunctionCall() } diff --git a/internal/parser/ast.go b/internal/parser/ast.go index a46d9b73..5dd4d776 100644 --- a/internal/parser/ast.go +++ b/internal/parser/ast.go @@ -133,6 +133,7 @@ func (*SourceOverdraft) source() {} type ( SourceAccount struct { + Color ValueExpr ValueExpr } @@ -165,6 +166,7 @@ type ( SourceOverdraft struct { Range + Color ValueExpr Address ValueExpr Bounded *ValueExpr } diff --git a/internal/parser/parser.go b/internal/parser/parser.go index 5258516d..4e37d84a 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -160,6 +160,16 @@ func parseVarType(tk antlr.Token) *TypeDecl { } } +func parseColorConstraint(colorConstraintCtx antlrParser.IColorConstraintContext) ValueExpr { + if colorConstraintCtx == nil { + return nil + } + + return parseValueExpr( + colorConstraintCtx.ValueExpr(), + ) +} + func parseSource(sourceCtx antlrParser.ISourceContext) Source { if sourceCtx == nil { return nil @@ -170,6 +180,7 @@ func parseSource(sourceCtx antlrParser.ISourceContext) Source { switch sourceCtx := sourceCtx.(type) { case *antlrParser.SrcAccountContext: return &SourceAccount{ + Color: parseColorConstraint(sourceCtx.ColorConstraint()), ValueExpr: parseValueExpr(sourceCtx.ValueExpr()), } @@ -218,6 +229,7 @@ func parseSource(sourceCtx antlrParser.ISourceContext) Source { case *antlrParser.SrcAccountUnboundedOverdraftContext: return &SourceOverdraft{ Range: ctxToRange(sourceCtx), + Color: parseColorConstraint(sourceCtx.ColorConstraint()), Address: parseValueExpr(sourceCtx.GetAddress()), } @@ -226,6 +238,7 @@ func parseSource(sourceCtx antlrParser.ISourceContext) Source { return &SourceOverdraft{ Range: ctxToRange(sourceCtx), + Color: parseColorConstraint(sourceCtx.ColorConstraint()), Address: parseValueExpr(sourceCtx.GetAddress()), Bounded: &varMon, } diff --git a/internal/parser/parser_test.go b/internal/parser/parser_test.go index 19e68fbc..3b70400e 100644 --- a/internal/parser/parser_test.go +++ b/internal/parser/parser_test.go @@ -474,3 +474,30 @@ set_tx_meta( require.Len(t, p.Errors, 0) snaps.MatchSnapshot(t, p.Value) } + +func TestColorRestriction(t *testing.T) { + p := parser.Parse(`send $sent ( + source = @s \ "red" + destination = @dest +)`) + snaps.MatchSnapshot(t, p.Value) + assert.Empty(t, p.Errors) +} + +func TestColorRestrictionBoundedOverdraft(t *testing.T) { + p := parser.Parse(`send $sent ( + source = @s \ "cl" allowing overdraft up to $ov + destination = @dest +)`) + snaps.MatchSnapshot(t, p.Value) + assert.Empty(t, p.Errors) +} + +func TestColorRestrictionUnboundedOverdraft(t *testing.T) { + p := parser.Parse(`send $sent ( + source = $acc \ $col allowing unbounded overdraft + destination = @dest +)`) + snaps.MatchSnapshot(t, p.Value) + assert.Empty(t, p.Errors) +}