diff --git a/Lexer.g4 b/Lexer.g4 index a4ab81be..17e0ce72 100644 --- a/Lexer.g4 +++ b/Lexer.g4 @@ -32,6 +32,9 @@ PLUS: '+'; MINUS: '-'; DIV: '/'; RESTRICT: '\\'; +WITH: 'with'; +SCALING: 'scaling'; +THROUGH: 'through'; PERCENTAGE_PORTION_LITERAL: [0-9]+ ('.' [0-9]+)? '%'; diff --git a/Numscript.g4 b/Numscript.g4 index ae136055..6c931c0a 100644 --- a/Numscript.g4 +++ b/Numscript.g4 @@ -44,10 +44,10 @@ allotment: colorConstraint: RESTRICT valueExpr; -source: - address = valueExpr colorConstraint? ALLOWING UNBOUNDED OVERDRAFT # srcAccountUnboundedOverdraft - | address = valueExpr colorConstraint? ALLOWING OVERDRAFT UP TO maxOvedraft = valueExpr # - srcAccountBoundedOverdraft +source + : address = valueExpr colorConstraint? ALLOWING UNBOUNDED OVERDRAFT # srcAccountUnboundedOverdraft + | address = valueExpr colorConstraint? ALLOWING OVERDRAFT UP TO maxOvedraft = valueExpr #srcAccountBoundedOverdraft + | address = valueExpr WITH SCALING THROUGH swap=valueExpr # srcAccountWithScaling | valueExpr colorConstraint? # srcAccount | LBRACE allotmentClauseSrc+ RBRACE # srcAllotment | LBRACE source* RBRACE # srcInorder diff --git a/internal/analysis/check.go b/internal/analysis/check.go index 567e65fb..641dd066 100644 --- a/internal/analysis/check.go +++ b/internal/analysis/check.go @@ -673,6 +673,11 @@ func (res *CheckResult) checkSource(source parser.Source) { res.unifyNodeWith(*source.Bounded, res.stmtType) } + case *parser.SourceWithScaling: + res.checkExpression(source.Address, TypeAccount) + res.checkExpression(source.Through, TypeAccount) + res.checkExpression(source.Color, TypeString) + case *parser.SourceInorder: for _, source := range source.Sources { res.checkSource(source) diff --git a/internal/analysis/hover.go b/internal/analysis/hover.go index 15b43035..3b7bb626 100644 --- a/internal/analysis/hover.go +++ b/internal/analysis/hover.go @@ -237,6 +237,18 @@ func hoverOnSource(source parser.Source, position parser.Position) Hover { return hover } } + case *parser.SourceWithScaling: + hover := hoverOnExpression(source.Address, position) + if hover != nil { + return hover + } + + hover = hoverOnExpression(source.Through, position) + if hover != nil { + return hover + } + + return nil case *parser.SourceAllotment: for _, item := range source.Items { diff --git a/internal/analysis/hover_test.go b/internal/analysis/hover_test.go index a785ba54..fd5ce493 100644 --- a/internal/analysis/hover_test.go +++ b/internal/analysis/hover_test.go @@ -523,3 +523,32 @@ send [ASSET *] ( resolved := checkResult.ResolveVar(variableHover.Node) require.NotNil(t, resolved) } + +func TestHover(t *testing.T) { + + input := `vars { + account $x +} + +send [EUR/2 *] ( + source = { + @acc1 + @acc2 with scaling through $x + } + destination = @dest +) + +` + + rng := parser.RangeOfIndexed(input, "$x", 1) + program := parser.Parse(input).Value + hover := analysis.HoverOn(program, rng.Start) + + varHover, ok := hover.(*analysis.VariableHover) + if !ok { + t.Fatalf("Expected a VariableHover") + } + + require.Equal(t, varHover.Node.Name, "x") + +} diff --git a/internal/flags/flags.go b/internal/flags/flags.go index 0cc593d4..efbe6516 100644 --- a/internal/flags/flags.go +++ b/internal/flags/flags.go @@ -10,6 +10,7 @@ const ( ExperimentalAccountInterpolationFlag FeatureFlag = "experimental-account-interpolation" ExperimentalMidScriptFunctionCall FeatureFlag = "experimental-mid-script-function-call" ExperimentalAssetColors FeatureFlag = "experimental-asset-colors" + AssetScaling FeatureFlag = "experimental-asset-scaling" ) var AllFlags []string = []string{ @@ -20,4 +21,5 @@ var AllFlags []string = []string{ ExperimentalAccountInterpolationFlag, ExperimentalMidScriptFunctionCall, ExperimentalAssetColors, + AssetScaling, } diff --git a/internal/interpreter/asset_scaling.go b/internal/interpreter/asset_scaling.go new file mode 100644 index 00000000..3cbb1755 --- /dev/null +++ b/internal/interpreter/asset_scaling.go @@ -0,0 +1,135 @@ +package interpreter + +import ( + "fmt" + "math/big" + "slices" + "strconv" + "strings" + + "github.com/formancehq/numscript/internal/utils" +) + +func assetToScaledAsset(asset string) string { + parts := strings.Split(asset, "/") + if len(parts) == 1 { + return asset + "/*" + } + return parts[0] + "/*" +} + +func buildScaledAsset(baseAsset string, scale int64) string { + if scale == 0 { + return baseAsset + } + return fmt.Sprintf("%s/%d", baseAsset, scale) +} + +func getAssetScale(asset string) (string, int64) { + parts := strings.Split(asset, "/") + if len(parts) == 2 { + scale, err := strconv.ParseInt(parts[1], 10, 64) + if err == nil { + return parts[0], scale + } + // fallback if parsing fails + return parts[0], 0 + } + return asset, 0 +} + +func getAssets(balance AccountBalance, baseAsset string) map[int64]*big.Int { + result := make(map[int64]*big.Int) + for asset, amount := range balance { + if strings.HasPrefix(asset, baseAsset) { + _, scale := getAssetScale(asset) + result[scale] = amount + } + } + return result +} + +type scalePair struct { + scale int64 + amount *big.Int +} + +// e.g. +// +// need=[EUR/2 100], got={EUR/2: 100, EUR: 1} +// => {EUR/2: 100, EUR: 1} +// +// need=[EUR 1], got={EUR/2: 100, EUR: 0} +// => {EUR/2: 100, EUR: 0} +// +// need=[EUR/2 199], got={EUR/2: 100, EUR: 2} +// => {EUR/2: 100, EUR: 1} +func findSolution( + neededAmt *big.Int, // <- can be nil + neededAmtScale int64, + scales map[int64]*big.Int, +) ([]scalePair, *big.Int) { + var assets []scalePair + for k, v := range scales { + assets = append(assets, scalePair{ + scale: k, + amount: v, + }) + } + + // Sort in ASC order (e.g. EUR, EUR/2, ..) + slices.SortFunc(assets, func(p scalePair, other scalePair) int { + return int(p.scale - other.scale) + }) + + var out []scalePair + + totalSent := big.NewInt(0) + + for _, p := range assets { + scaleDiff := neededAmtScale - p.scale + + exp := big.NewInt(scaleDiff) + exp.Abs(exp) + exp.Exp(big.NewInt(10), exp, nil) + + // scalingFactor := 10 ^ (neededAmtScale - p.scale) + // note that 10^0 == 1 and 10^(-n) == 1/(10^n) + scalingFactor := new(big.Rat).SetInt(exp) + if scaleDiff < 0 { + scalingFactor.Inv(scalingFactor) + } + + allowed := new(big.Int).Mul(p.amount, scalingFactor.Num()) + allowed.Div(allowed, scalingFactor.Denom()) + + var leftAmt *big.Int + var taken *big.Int + if neededAmt == nil { + taken = new(big.Int).Set(allowed) + } else { + leftAmt = new(big.Int).Sub(neededAmt, totalSent) + taken = utils.MinBigInt(allowed, leftAmt) + } + + totalSent.Add(totalSent, taken) + + intPart := new(big.Int).Mul(taken, scalingFactor.Denom()) + intPart.Div(intPart, scalingFactor.Num()) + + if intPart.Cmp(big.NewInt(0)) == 0 { + continue + } + + out = append(out, scalePair{ + scale: p.scale, + amount: intPart, + }) + + if leftAmt != nil && leftAmt.Cmp(big.NewInt(0)) != 1 { + break + } + } + + return out, totalSent +} diff --git a/internal/interpreter/asset_scaling_test.go b/internal/interpreter/asset_scaling_test.go new file mode 100644 index 00000000..69bca1b0 --- /dev/null +++ b/internal/interpreter/asset_scaling_test.go @@ -0,0 +1,153 @@ +package interpreter + +import ( + "math/big" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestScalingZeroNeeded(t *testing.T) { + t.Skip() + + // need [EUR/2 ] + sol, _ := findSolution( + big.NewInt(0), + 42, + map[int64]*big.Int{ + 2: big.NewInt(100), + 1: big.NewInt(1), + }) + + require.Equal(t, []scalePair{ + {42, big.NewInt(0)}, + }, sol) +} + +func TestScalingSameAsset(t *testing.T) { + sol, _ := findSolution( + // Need [EUR/2 200] + big.NewInt(200), + 2, + + // Have: {EUR/2: 201} + map[int64]*big.Int{ + 2: big.NewInt(201), + }) + + require.Equal(t, []scalePair{ + {2, big.NewInt(200)}, + }, sol) +} + +func TestScalingSolutionLowerScale(t *testing.T) { + sol, _ := findSolution( + big.NewInt(1), + 0, + map[int64]*big.Int{ + 2: big.NewInt(900), + }) + + require.Equal(t, []scalePair{ + {2, big.NewInt(100)}, + }, sol) +} + +func TestScalingSolutionHigherScale(t *testing.T) { + sol, _ := findSolution( + // Need [EUR/2 200] + big.NewInt(200), + 2, + + // Have: {EUR: 4} (eq to EUR/2 400) + map[int64]*big.Int{ + 0: big.NewInt(4), + }) + + require.Equal(t, []scalePair{ + {0, big.NewInt(2)}, + }, sol) +} + +func TestScalingSolutionHigherScaleNoSolution(t *testing.T) { + sol, _ := findSolution( + big.NewInt(1), + 2, + map[int64]*big.Int{ + 0: big.NewInt(100), + 1: big.NewInt(100), + }) + + require.Nil(t, sol) +} + +func TestMixedFail(t *testing.T) { + t.Skip() + + sol, _ := findSolution( + big.NewInt(400), + 2, + map[int64]*big.Int{ + 0: big.NewInt(1), + 2: big.NewInt(200), + 3: big.NewInt(10), + }) + + require.Nil(t, sol) +} + +func TestUnboundedScalingSameAsset(t *testing.T) { + sol, _ := findSolution( + nil, + // Need USD/2 + 2, + // Have: {EUR/2: 201} + map[int64]*big.Int{ + 2: big.NewInt(123), + }) + + require.Equal(t, []scalePair{ + {2, big.NewInt(123)}, + }, sol) +} + +func TestUnboundedScalingLowerAsset(t *testing.T) { + sol, _ := findSolution( + nil, + 2, + map[int64]*big.Int{ + 0: big.NewInt(1), + }) + + require.Equal(t, []scalePair{ + {0, big.NewInt(1)}, + }, sol) +} + +func TestUnboundedScalinHigherAsset(t *testing.T) { + sol, _ := findSolution( + nil, + 2, + map[int64]*big.Int{ + 3: big.NewInt(10), + }) + + require.Equal(t, + []scalePair{ + {3, big.NewInt(10)}, + }, + sol) +} + +func TestUnboundedScalinHigherAssetTrimRemainder(t *testing.T) { + sol, _ := findSolution( + nil, + 2, + map[int64]*big.Int{ + 3: big.NewInt(15), + }) + + require.Equal(t, []scalePair{ + {3, big.NewInt(10)}, + }, sol) +} diff --git a/internal/interpreter/batch_balances_query.go b/internal/interpreter/batch_balances_query.go index cedd25ec..6d95df4a 100644 --- a/internal/interpreter/batch_balances_query.go +++ b/internal/interpreter/batch_balances_query.go @@ -98,6 +98,21 @@ func (st *programState) findBalancesQueries(source parser.Source) InterpreterErr st.batchQuery(*account, st.CurrentAsset, color) return nil + case *parser.SourceWithScaling: + account, err := evaluateExprAs(st, source.Address, expectAccount) + if err != nil { + return err + } + // NOTE we don't query the swap account's balance + + color, err := evaluateOptExprAs(st, source.Color, expectString) + if err != nil { + return err + } + + st.batchQuery(*account, assetToScaledAsset(st.CurrentAsset), color) + return nil + case *parser.SourceOverdraft: // Skip balance tracking when balance is overdraft if source.Bounded == nil { diff --git a/internal/interpreter/interpreter.go b/internal/interpreter/interpreter.go index 6e4390a6..aaac15ba 100644 --- a/internal/interpreter/interpreter.go +++ b/internal/interpreter/interpreter.go @@ -51,12 +51,26 @@ func (s StaticStore) GetBalances(_ context.Context, q BalanceQuery) (Balances, e }) for _, curr := range queriedCurrencies { - n := new(big.Int) - outputAccountBalance[curr] = n - - if i, ok := accountBalanceLookup[curr]; ok { - n.Set(i) + baseAsset, isCatchAll := strings.CutSuffix(curr, "/*") + if isCatchAll { + + for k, v := range accountBalanceLookup { + matchesAsset := k == baseAsset || strings.HasPrefix(k, baseAsset+"/") + if !matchesAsset { + continue + } + outputAccountBalance[k] = new(big.Int).Set(v) + } + + } else { + n := new(big.Int) + outputAccountBalance[curr] = n + + if i, ok := accountBalanceLookup[curr]; ok { + n.Set(i) + } } + } } @@ -556,6 +570,63 @@ func (s *programState) sendAll(source parser.Source) (*big.Int, InterpreterError } return s.sendAllToAccount(source.Address, cap, source.Color) + case *parser.SourceWithScaling: + err := s.checkFeatureFlag(flags.AssetScaling) + if err != nil { + return nil, err + } + + account, err := evaluateExprAs(s, source.Address, expectAccount) + if err != nil { + return nil, err + } + + scalingAccount, err := evaluateExprAs(s, source.Through, expectAccount) + if err != nil { + return nil, err + } + + baseAsset, assetScale := getAssetScale(s.CurrentAsset) + acc, ok := s.CachedBalances[*account] + if !ok { + return nil, InvalidUnboundedAddressInScalingAddress{Range: source.Range} + } + + sol, totSent := findSolution( + nil, + assetScale, + getAssets(acc, baseAsset), + ) + + for _, convAmt := range sol { + scale := convAmt.scale + convAmt := convAmt.amount + + // here we manually emit postings based on the known solution, + // and update balances accordingly + asset := buildScaledAsset(baseAsset, scale) + s.Postings = append(s.Postings, Posting{ + Source: *account, + Destination: *scalingAccount, + Amount: new(big.Int).Set(convAmt), + Asset: asset, + }) + acc[asset].Sub(acc[asset], convAmt) + } + + s.Postings = append(s.Postings, Posting{ + Source: *scalingAccount, + Destination: *account, + Amount: new(big.Int).Set(totSent), + Asset: s.CurrentAsset, + }) + accBalance := utils.MapGetOrPutDefault(acc, s.CurrentAsset, func() *big.Int { + return big.NewInt(0) + }) + accBalance.Add(accBalance, totSent) + + return s.trySendingToAccount(source.Address, totSent, big.NewInt(0), source.Color) + case *parser.SourceInorder: totalSent := big.NewInt(0) for _, subSource := range source.Sources { @@ -666,6 +737,68 @@ func (s *programState) trySendingUpTo(source parser.Source, amount *big.Int) (*b case *parser.SourceAccount: return s.trySendingToAccount(source.ValueExpr, amount, big.NewInt(0), source.Color) + case *parser.SourceWithScaling: + err := s.checkFeatureFlag(flags.AssetScaling) + if err != nil { + return nil, err + } + + account, err := evaluateExprAs(s, source.Address, expectAccount) + if err != nil { + return nil, err + } + scalingAccount, err := evaluateExprAs(s, source.Through, expectAccount) + if err != nil { + return nil, err + } + + baseAsset, assetScale := getAssetScale(s.CurrentAsset) + acc, ok := s.CachedBalances[*account] + if !ok { + return nil, InvalidUnboundedAddressInScalingAddress{Range: source.Range} + } + + sol, total := findSolution( + amount, + assetScale, + getAssets(acc, baseAsset), + ) + + if amount.Cmp(total) == 1 { + // we already know we are failing, but we're delegating to the "standard" (non-scaled) mode + // so that we get a somewhat helpful (although limited) error message + return s.trySendingToAccount(source.Address, amount, big.NewInt(0), source.Color) + } + + for _, pair := range sol { + scale := pair.scale + sending := pair.amount + // here we manually emit postings based on the known solution, + // and update balances accordingly + asset := buildScaledAsset(baseAsset, scale) + s.Postings = append(s.Postings, Posting{ + Source: *account, + Destination: *scalingAccount, + Amount: new(big.Int).Set(sending), + Asset: asset, + }) + acc[asset].Sub(acc[asset], sending) + } + + s.Postings = append(s.Postings, Posting{ + Source: *scalingAccount, + Destination: *account, + Amount: new(big.Int).Set(amount), + Asset: s.CurrentAsset, + }) + + accBalance := utils.MapGetOrPutDefault(acc, s.CurrentAsset, func() *big.Int { + return big.NewInt(0) + }) + accBalance.Add(accBalance, amount) + + return s.trySendingToAccount(source.Address, amount, big.NewInt(0), source.Color) + case *parser.SourceOverdraft: var cap *big.Int if source.Bounded != nil { diff --git a/internal/interpreter/interpreter_error.go b/internal/interpreter/interpreter_error.go index 1d5bc415..d6ee11dd 100644 --- a/internal/interpreter/interpreter_error.go +++ b/internal/interpreter/interpreter_error.go @@ -255,3 +255,11 @@ type InvalidColor struct { func (e InvalidColor) Error() string { return fmt.Sprintf("Invalid color name: '%s'. Only uppercase letters are allowed.", e.Color) } + +type InvalidUnboundedAddressInScalingAddress struct { + parser.Range +} + +func (InvalidUnboundedAddressInScalingAddress) Error() string { + return "Invalid usage or @world account in scaling context" +} diff --git a/internal/interpreter/interpreter_test.go b/internal/interpreter/interpreter_test.go index 719bb10f..651d17b7 100644 --- a/internal/interpreter/interpreter_test.go +++ b/internal/interpreter/interpreter_test.go @@ -61,6 +61,9 @@ func removeRange(e machine.InterpreterError) machine.InterpreterError { case machine.MissingFundsErr: e.Range = parser.Range{} return e + case machine.InvalidUnboundedAddressInScalingAddress: + e.Range = parser.Range{} + return e case machine.TypeError: e.Range = parser.Range{} return e @@ -154,37 +157,65 @@ func testWithFeatureFlag(t *testing.T, testCase TestCase, flagName string) { } func TestStaticStore(t *testing.T) { - store := machine.StaticStore{ - Balances: machine.Balances{ + t.Run("request currencies", func(t *testing.T) { + store := machine.StaticStore{ + Balances: machine.Balances{ + "a": machine.AccountBalance{ + "USD/2": big.NewInt(10), + "EUR/2": big.NewInt(1), + }, + "b": machine.AccountBalance{ + "USD/2": big.NewInt(10), + "COIN": big.NewInt(11), + }, + }, + } + + q1, _ := store.GetBalances(context.TODO(), machine.BalanceQuery{ + "a": []string{"USD/2"}, + }) + require.Equal(t, machine.Balances{ "a": machine.AccountBalance{ "USD/2": big.NewInt(10), - "EUR/2": big.NewInt(1), }, + }, q1) + + q2, _ := store.GetBalances(context.TODO(), machine.BalanceQuery{ + "b": []string{"USD/2", "COIN"}, + }) + require.Equal(t, machine.Balances{ "b": machine.AccountBalance{ "USD/2": big.NewInt(10), "COIN": big.NewInt(11), }, - }, - } - - q1, _ := store.GetBalances(context.TODO(), machine.BalanceQuery{ - "a": []string{"USD/2"}, + }, q2) }) - require.Equal(t, machine.Balances{ - "a": machine.AccountBalance{ - "USD/2": big.NewInt(10), - }, - }, q1) - q2, _ := store.GetBalances(context.TODO(), machine.BalanceQuery{ - "b": []string{"USD/2", "COIN"}, + t.Run("assets catchall", func(t *testing.T) { + store := machine.StaticStore{ + Balances: machine.Balances{ + "a": machine.AccountBalance{ + "USD": big.NewInt(1), + "USD/2": big.NewInt(2), + "USD/3": big.NewInt(3), + }, + }, + } + + balances, err := store.GetBalances(context.Background(), machine.BalanceQuery{ + "a": []string{"USD/*"}, + }) + require.Nil(t, err) + require.Equal(t, machine.Balances{ + "a": machine.AccountBalance{ + "USD": big.NewInt(1), + "USD/2": big.NewInt(2), + "USD/3": big.NewInt(3), + }, + }, balances) + }) - require.Equal(t, machine.Balances{ - "b": machine.AccountBalance{ - "USD/2": big.NewInt(10), - "COIN": big.NewInt(11), - }, - }, q2) + } type CaseResult struct { @@ -1112,3 +1143,20 @@ func TestSafeWithdraft(t *testing.T) { }) } + +func TestInvalidScalingWorld(t *testing.T) { + script := ` +send [EUR/2 *] ( + source = @world with scaling through @swap + destination = @dest +) + ` + + tc := NewTestCase() + tc.compile(t, script) + + tc.expected = CaseResult{ + Error: machine.InvalidUnboundedAddressInScalingAddress{}, + } + testWithFeatureFlag(t, tc, flags.AssetScaling) +} diff --git a/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-all-allotment.num b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-all-allotment.num new file mode 100644 index 00000000..4f5e190c --- /dev/null +++ b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-all-allotment.num @@ -0,0 +1,7 @@ +send [EUR/2 *] ( + source = { + @acc1 + @acc2 with scaling through @swap + } + destination = @dest +) diff --git a/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-all-allotment.num.specs.json b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-all-allotment.num.specs.json new file mode 100644 index 00000000..ce35e9ea --- /dev/null +++ b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-all-allotment.num.specs.json @@ -0,0 +1,47 @@ +{ + "$schema": "https://raw.githubusercontent.com/formancehq/numscript/main/specs.schema.json", + "featureFlags": [ + "experimental-asset-scaling" + ], + "balances": { + "acc1": { + "EUR/2": 50 + } + }, + "testCases": [ + { + "it": "casts all the avlb", + "balances": { + "acc2": { + "EUR/3": 500 + } + }, + "expect.postings": [ + { + "source": "acc2", + "destination": "swap", + "amount": 500, + "asset": "EUR/3" + }, + { + "source": "swap", + "destination": "acc2", + "amount": 50, + "asset": "EUR/2" + }, + { + "source": "acc1", + "destination": "dest", + "amount": 50, + "asset": "EUR/2" + }, + { + "source": "acc2", + "destination": "dest", + "amount": 50, + "asset": "EUR/2" + } + ] + } + ] +} \ No newline at end of file diff --git a/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-allotment.num b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-allotment.num new file mode 100644 index 00000000..325dd87c --- /dev/null +++ b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-allotment.num @@ -0,0 +1,7 @@ +send [EUR/2 100] ( + source = { + @acc1 + @acc2 with scaling through @swap + } + destination = @dest +) diff --git a/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-allotment.num.specs.json b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-allotment.num.specs.json new file mode 100644 index 00000000..5c693b3b --- /dev/null +++ b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-allotment.num.specs.json @@ -0,0 +1,81 @@ +{ + "$schema": "https://raw.githubusercontent.com/formancehq/numscript/main/specs.schema.json", + "featureFlags": [ + "experimental-asset-scaling" + ], + "balances": { + "acc1": { + "EUR/2": 50 + } + }, + "testCases": [ + { + "it": "casts all the avlb", + "balances": { + "acc2": { + "EUR/3": 500 + } + }, + "expect.postings": [ + { + "source": "acc2", + "destination": "swap", + "amount": 500, + "asset": "EUR/3" + }, + { + "source": "swap", + "destination": "acc2", + "amount": 50, + "asset": "EUR/2" + }, + { + "source": "acc1", + "destination": "dest", + "amount": 50, + "asset": "EUR/2" + }, + { + "source": "acc2", + "destination": "dest", + "amount": 50, + "asset": "EUR/2" + } + ] + }, + { + "it": "doesn't send more than needed", + "balances": { + "acc2": { + "EUR/2": 999999 + } + }, + "expect.postings": [ + { + "source": "acc2", + "destination": "swap", + "amount": 50, + "asset": "EUR/2" + }, + { + "source": "swap", + "destination": "acc2", + "amount": 50, + "asset": "EUR/2" + }, + { + "source": "acc1", + "destination": "dest", + "amount": 50, + "asset": "EUR/2" + }, + { + "source": "acc2", + "destination": "dest", + "amount": 50, + "asset": "EUR/2" + } + ] + } + ] +} \ No newline at end of file diff --git a/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-kept.num b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-kept.num new file mode 100644 index 00000000..c3e85df4 --- /dev/null +++ b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-kept.num @@ -0,0 +1,6 @@ +send [BTC/2 *] ( + source = @acc with scaling through @swap + destination = { + remaining kept + } +) diff --git a/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-kept.num.specs.json b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-kept.num.specs.json new file mode 100644 index 00000000..561b7437 --- /dev/null +++ b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-kept.num.specs.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://raw.githubusercontent.com/formancehq/numscript/main/specs.schema.json", + "featureFlags": [ + "experimental-asset-scaling" + ], + "balances": { + "acc": { + "BTC/2": 2, + "BTC/8": 1000000 + } + }, + "testCases": [ + { + "it": "example spec", + "expect.postings": [ + { + "source": "acc", + "destination": "swap", + "amount": 2, + "asset": "BTC/2" + }, + { + "source": "acc", + "destination": "swap", + "amount": 1000000, + "asset": "BTC/8" + }, + { + "source": "swap", + "destination": "acc", + "amount": 3, + "asset": "BTC/2" + } + ] + } + ] +} \ No newline at end of file diff --git a/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-send-all.num b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-send-all.num new file mode 100644 index 00000000..d62b3abd --- /dev/null +++ b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-send-all.num @@ -0,0 +1,5 @@ +send [EUR/2 *] ( + source = @src with scaling through @swap + destination = @dest +) + diff --git a/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-send-all.num.specs.json b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-send-all.num.specs.json new file mode 100644 index 00000000..c0e0ccc5 --- /dev/null +++ b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-send-all.num.specs.json @@ -0,0 +1,78 @@ +{ + "$schema": "https://raw.githubusercontent.com/formancehq/numscript/main/specs.schema.json", + "featureFlags": [ + "experimental-asset-scaling" + ], + "testCases": [ + { + "it": "sends all the available assets that can be cast", + "balances": { + "src": { + "EUR": 2, + "EUR/2": 1, + "EUR/3": 30 + } + }, + "expect.postings": [ + { + "source": "src", + "destination": "swap", + "amount": 2, + "asset": "EUR" + }, + { + "source": "src", + "destination": "swap", + "amount": 1, + "asset": "EUR/2" + }, + { + "source": "src", + "destination": "swap", + "amount": 30, + "asset": "EUR/3" + }, + { + "source": "swap", + "destination": "src", + "amount": 204, + "asset": "EUR/2" + }, + { + "source": "src", + "destination": "dest", + "amount": 204, + "asset": "EUR/2" + } + ] + }, + { + "it": "avoids casting the remainder", + "balances": { + "src": { + "EUR/3": 21 + } + }, + "expect.postings": [ + { + "source": "src", + "destination": "swap", + "amount": 20, + "asset": "EUR/3" + }, + { + "source": "swap", + "destination": "src", + "amount": 2, + "asset": "EUR/2" + }, + { + "source": "src", + "destination": "dest", + "amount": 2, + "asset": "EUR/2" + } + ] + } + ] +} \ No newline at end of file diff --git a/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-with-oneof.num b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-with-oneof.num new file mode 100644 index 00000000..6840bdb7 --- /dev/null +++ b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-with-oneof.num @@ -0,0 +1,10 @@ +send [EUR/2 100] ( + source = oneof { + @acc1 with scaling through @swap + { + @acc1 + @acc2 + } + } + destination = @dest +) diff --git a/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-with-oneof.num.specs.json b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-with-oneof.num.specs.json new file mode 100644 index 00000000..3ed71f11 --- /dev/null +++ b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling-with-oneof.num.specs.json @@ -0,0 +1,65 @@ +{ + "$schema": "https://raw.githubusercontent.com/formancehq/numscript/main/specs.schema.json", + "featureFlags": [ + "experimental-oneof", + "experimental-asset-scaling" + ], + "balances": { + "acc1": {}, + "acc2": { + "EUR/2": 100 + } + }, + "testCases": [ + { + "it": "fallbacks to the second branch when there's not enough", + "balances": { + "acc1": { + "EUR/2": 1 + } + }, + "expect.postings": [ + { + "source": "acc1", + "destination": "dest", + "amount": 1, + "asset": "EUR/2" + }, + { + "source": "acc2", + "destination": "dest", + "amount": 99, + "asset": "EUR/2" + } + ] + }, + { + "it": "succeeds in the first branch", + "balances": { + "acc1": { + "EUR/2": 100 + } + }, + "expect.postings": [ + { + "source": "acc1", + "destination": "swap", + "amount": 100, + "asset": "EUR/2" + }, + { + "source": "swap", + "destination": "acc1", + "amount": 100, + "asset": "EUR/2" + }, + { + "source": "acc1", + "destination": "dest", + "amount": 100, + "asset": "EUR/2" + } + ] + } + ] +} \ No newline at end of file diff --git a/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling.num b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling.num new file mode 100644 index 00000000..a88683f9 --- /dev/null +++ b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling.num @@ -0,0 +1,4 @@ +send [EUR/2 400] ( + source = @src with scaling through @swap + destination = @dest +) diff --git a/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling.num.specs.json b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling.num.specs.json new file mode 100644 index 00000000..fbaf9110 --- /dev/null +++ b/internal/interpreter/testdata/script-tests/experimental/asset-scaling/scaling.num.specs.json @@ -0,0 +1,111 @@ +{ + "$schema": "https://raw.githubusercontent.com/formancehq/numscript/main/specs.schema.json", + "featureFlags": [ + "experimental-asset-scaling" + ], + "testCases": [ + { + "it": "upscales to an higher currency if possible", + "balances": { + "src": { + "EUR": 99, + "EUR/2": 1 + } + }, + "expect.postings": [ + { + "source": "src", + "destination": "swap", + "asset": "EUR", + "amount": 4 + }, + { + "source": "swap", + "destination": "src", + "asset": "EUR/2", + "amount": 400 + }, + { + "source": "src", + "destination": "dest", + "asset": "EUR/2", + "amount": 400 + } + ] + }, + { + "it": "downscales to an smaller currency if possible", + "balances": { + "src": { + "EUR/3": 4000 + } + }, + "expect.postings": [ + { + "source": "src", + "destination": "swap", + "asset": "EUR/3", + "amount": 4000 + }, + { + "source": "swap", + "destination": "src", + "asset": "EUR/2", + "amount": 400 + }, + { + "source": "src", + "destination": "dest", + "asset": "EUR/2", + "amount": 400 + } + ] + }, + { + "it": "mix", + "balances": { + "src": { + "EUR": 2, + "EUR/2": 200 + } + }, + "expect.postings": [ + { + "source": "src", + "destination": "swap", + "asset": "EUR", + "amount": 2 + }, + { + "source": "src", + "destination": "swap", + "asset": "EUR/2", + "amount": 200 + }, + { + "source": "swap", + "destination": "src", + "asset": "EUR/2", + "amount": 400 + }, + { + "source": "src", + "destination": "dest", + "asset": "EUR/2", + "amount": 400 + } + ] + }, + { + "it": "fails when there aren't enough funds", + "balances": { + "src": { + "EUR": 1, + "EUR/2": 200, + "EUR/3": 10 + } + }, + "expect.error.missingFunds": true + } + ] +} \ No newline at end of file diff --git a/internal/parser/__snapshots__/parser_test.snap b/internal/parser/__snapshots__/parser_test.snap index 85eacf76..6da35fbf 100755 --- a/internal/parser/__snapshots__/parser_test.snap +++ b/internal/parser/__snapshots__/parser_test.snap @@ -3413,3 +3413,67 @@ parser.Program{ Comments: nil, } --- + +[TestScalingSyntax - 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.SourceWithScaling{ + Range: parser.Range{ + Start: parser.Position{Character:11, Line:1}, + End: parser.Position{Character:42, Line:1}, + }, + Color: nil, + Address: &parser.AccountInterpLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:11, Line:1}, + End: parser.Position{Character:15, Line:1}, + }, + Parts: { + parser.AccountTextPart{Name:"src"}, + }, + }, + Through: &parser.AccountInterpLiteral{ + Range: parser.Range{ + Start: parser.Position{Character:37, Line:1}, + End: parser.Position{Character:42, Line:1}, + }, + Parts: { + parser.AccountTextPart{Name:"swap"}, + }, + }, + }, + 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 c7f5a72d..15366d9e 100644 --- a/internal/parser/antlrParser/Lexer.interp +++ b/internal/parser/antlrParser/Lexer.interp @@ -32,6 +32,9 @@ null '-' '/' '\\' +'with' +'scaling' +'through' null null null @@ -77,6 +80,9 @@ PLUS MINUS DIV RESTRICT +WITH +SCALING +THROUGH PERCENTAGE_PORTION_LITERAL STRING IDENTIFIER @@ -121,6 +127,9 @@ PLUS MINUS DIV RESTRICT +WITH +SCALING +THROUGH PERCENTAGE_PORTION_LITERAL STRING IDENTIFIER @@ -142,4 +151,4 @@ DEFAULT_MODE ACCOUNT_MODE atn: -[4, 0, 42, 354, 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, 4, 35, 292, 8, 35, 11, 35, 12, 35, 293, 1, 35, 1, 35, 4, 35, 298, 8, 35, 11, 35, 12, 35, 299, 5, 35, 302, 8, 35, 10, 35, 12, 35, 305, 9, 35, 1, 36, 1, 36, 5, 36, 309, 8, 36, 10, 36, 12, 36, 312, 9, 36, 1, 36, 1, 36, 4, 36, 316, 8, 36, 11, 36, 12, 36, 317, 3, 36, 320, 8, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 4, 39, 332, 8, 39, 11, 39, 12, 39, 333, 1, 39, 5, 39, 337, 8, 39, 10, 39, 12, 39, 340, 9, 39, 1, 40, 4, 40, 343, 8, 40, 11, 40, 12, 40, 344, 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, 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, 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, 306, 1, 0, 0, 0, 76, 321, 1, 0, 0, 0, 78, 325, 1, 0, 0, 0, 80, 329, 1, 0, 0, 0, 82, 342, 1, 0, 0, 0, 84, 348, 1, 0, 0, 0, 86, 352, 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, 7, 2, 0, 0, 291, 290, 1, 0, 0, 0, 292, 293, 1, 0, 0, 0, 293, 291, 1, 0, 0, 0, 293, 294, 1, 0, 0, 0, 294, 303, 1, 0, 0, 0, 295, 297, 5, 95, 0, 0, 296, 298, 7, 2, 0, 0, 297, 296, 1, 0, 0, 0, 298, 299, 1, 0, 0, 0, 299, 297, 1, 0, 0, 0, 299, 300, 1, 0, 0, 0, 300, 302, 1, 0, 0, 0, 301, 295, 1, 0, 0, 0, 302, 305, 1, 0, 0, 0, 303, 301, 1, 0, 0, 0, 303, 304, 1, 0, 0, 0, 304, 73, 1, 0, 0, 0, 305, 303, 1, 0, 0, 0, 306, 310, 7, 6, 0, 0, 307, 309, 7, 7, 0, 0, 308, 307, 1, 0, 0, 0, 309, 312, 1, 0, 0, 0, 310, 308, 1, 0, 0, 0, 310, 311, 1, 0, 0, 0, 311, 319, 1, 0, 0, 0, 312, 310, 1, 0, 0, 0, 313, 315, 5, 47, 0, 0, 314, 316, 7, 2, 0, 0, 315, 314, 1, 0, 0, 0, 316, 317, 1, 0, 0, 0, 317, 315, 1, 0, 0, 0, 317, 318, 1, 0, 0, 0, 318, 320, 1, 0, 0, 0, 319, 313, 1, 0, 0, 0, 319, 320, 1, 0, 0, 0, 320, 75, 1, 0, 0, 0, 321, 322, 5, 64, 0, 0, 322, 323, 1, 0, 0, 0, 323, 324, 6, 37, 2, 0, 324, 77, 1, 0, 0, 0, 325, 326, 5, 58, 0, 0, 326, 327, 1, 0, 0, 0, 327, 328, 6, 38, 2, 0, 328, 79, 1, 0, 0, 0, 329, 331, 5, 36, 0, 0, 330, 332, 7, 5, 0, 0, 331, 330, 1, 0, 0, 0, 332, 333, 1, 0, 0, 0, 333, 331, 1, 0, 0, 0, 333, 334, 1, 0, 0, 0, 334, 338, 1, 0, 0, 0, 335, 337, 7, 8, 0, 0, 336, 335, 1, 0, 0, 0, 337, 340, 1, 0, 0, 0, 338, 336, 1, 0, 0, 0, 338, 339, 1, 0, 0, 0, 339, 81, 1, 0, 0, 0, 340, 338, 1, 0, 0, 0, 341, 343, 7, 9, 0, 0, 342, 341, 1, 0, 0, 0, 343, 344, 1, 0, 0, 0, 344, 342, 1, 0, 0, 0, 344, 345, 1, 0, 0, 0, 345, 346, 1, 0, 0, 0, 346, 347, 6, 40, 3, 0, 347, 83, 1, 0, 0, 0, 348, 349, 3, 80, 39, 0, 349, 350, 1, 0, 0, 0, 350, 351, 6, 41, 3, 0, 351, 85, 1, 0, 0, 0, 352, 353, 3, 80, 39, 0, 353, 87, 1, 0, 0, 0, 23, 0, 1, 91, 98, 105, 107, 121, 256, 262, 264, 272, 274, 282, 287, 293, 299, 303, 310, 317, 319, 333, 338, 344, 4, 6, 0, 0, 0, 1, 0, 5, 1, 0, 4, 0, 0] \ No newline at end of file +[4, 0, 45, 381, 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, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 1, 0, 4, 0, 96, 8, 0, 11, 0, 12, 0, 97, 1, 0, 1, 0, 1, 1, 4, 1, 103, 8, 1, 11, 1, 12, 1, 104, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 112, 8, 2, 10, 2, 12, 2, 115, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 5, 3, 126, 8, 3, 10, 3, 12, 3, 129, 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, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 4, 35, 282, 8, 35, 11, 35, 12, 35, 283, 1, 35, 1, 35, 4, 35, 288, 8, 35, 11, 35, 12, 35, 289, 3, 35, 292, 8, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 5, 36, 300, 8, 36, 10, 36, 12, 36, 303, 9, 36, 1, 36, 1, 36, 1, 37, 4, 37, 308, 8, 37, 11, 37, 12, 37, 309, 1, 37, 5, 37, 313, 8, 37, 10, 37, 12, 37, 316, 9, 37, 1, 38, 4, 38, 319, 8, 38, 11, 38, 12, 38, 320, 1, 38, 1, 38, 4, 38, 325, 8, 38, 11, 38, 12, 38, 326, 5, 38, 329, 8, 38, 10, 38, 12, 38, 332, 9, 38, 1, 39, 1, 39, 5, 39, 336, 8, 39, 10, 39, 12, 39, 339, 9, 39, 1, 39, 1, 39, 4, 39, 343, 8, 39, 11, 39, 12, 39, 344, 3, 39, 347, 8, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 4, 42, 359, 8, 42, 11, 42, 12, 42, 360, 1, 42, 5, 42, 364, 8, 42, 10, 42, 12, 42, 367, 9, 42, 1, 43, 4, 43, 370, 8, 43, 11, 43, 12, 43, 371, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 2, 113, 127, 0, 46, 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, 40, 82, 41, 84, 42, 86, 0, 88, 43, 90, 44, 92, 45, 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, 399, 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, 80, 1, 0, 0, 0, 0, 82, 1, 0, 0, 0, 0, 84, 1, 0, 0, 0, 0, 92, 1, 0, 0, 0, 1, 88, 1, 0, 0, 0, 1, 90, 1, 0, 0, 0, 2, 95, 1, 0, 0, 0, 4, 102, 1, 0, 0, 0, 6, 106, 1, 0, 0, 0, 8, 121, 1, 0, 0, 0, 10, 134, 1, 0, 0, 0, 12, 139, 1, 0, 0, 0, 14, 143, 1, 0, 0, 0, 16, 150, 1, 0, 0, 0, 18, 162, 1, 0, 0, 0, 20, 167, 1, 0, 0, 0, 22, 172, 1, 0, 0, 0, 24, 175, 1, 0, 0, 0, 26, 178, 1, 0, 0, 0, 28, 188, 1, 0, 0, 0, 30, 197, 1, 0, 0, 0, 32, 207, 1, 0, 0, 0, 34, 217, 1, 0, 0, 0, 36, 223, 1, 0, 0, 0, 38, 228, 1, 0, 0, 0, 40, 233, 1, 0, 0, 0, 42, 235, 1, 0, 0, 0, 44, 237, 1, 0, 0, 0, 46, 239, 1, 0, 0, 0, 48, 241, 1, 0, 0, 0, 50, 243, 1, 0, 0, 0, 52, 245, 1, 0, 0, 0, 54, 247, 1, 0, 0, 0, 56, 249, 1, 0, 0, 0, 58, 251, 1, 0, 0, 0, 60, 253, 1, 0, 0, 0, 62, 255, 1, 0, 0, 0, 64, 257, 1, 0, 0, 0, 66, 259, 1, 0, 0, 0, 68, 264, 1, 0, 0, 0, 70, 272, 1, 0, 0, 0, 72, 281, 1, 0, 0, 0, 74, 295, 1, 0, 0, 0, 76, 307, 1, 0, 0, 0, 78, 318, 1, 0, 0, 0, 80, 333, 1, 0, 0, 0, 82, 348, 1, 0, 0, 0, 84, 352, 1, 0, 0, 0, 86, 356, 1, 0, 0, 0, 88, 369, 1, 0, 0, 0, 90, 375, 1, 0, 0, 0, 92, 379, 1, 0, 0, 0, 94, 96, 7, 0, 0, 0, 95, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 99, 1, 0, 0, 0, 99, 100, 6, 0, 0, 0, 100, 3, 1, 0, 0, 0, 101, 103, 7, 1, 0, 0, 102, 101, 1, 0, 0, 0, 103, 104, 1, 0, 0, 0, 104, 102, 1, 0, 0, 0, 104, 105, 1, 0, 0, 0, 105, 5, 1, 0, 0, 0, 106, 107, 5, 47, 0, 0, 107, 108, 5, 42, 0, 0, 108, 113, 1, 0, 0, 0, 109, 112, 3, 6, 2, 0, 110, 112, 9, 0, 0, 0, 111, 109, 1, 0, 0, 0, 111, 110, 1, 0, 0, 0, 112, 115, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 114, 116, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 116, 117, 5, 42, 0, 0, 117, 118, 5, 47, 0, 0, 118, 119, 1, 0, 0, 0, 119, 120, 6, 2, 0, 0, 120, 7, 1, 0, 0, 0, 121, 122, 5, 47, 0, 0, 122, 123, 5, 47, 0, 0, 123, 127, 1, 0, 0, 0, 124, 126, 9, 0, 0, 0, 125, 124, 1, 0, 0, 0, 126, 129, 1, 0, 0, 0, 127, 128, 1, 0, 0, 0, 127, 125, 1, 0, 0, 0, 128, 130, 1, 0, 0, 0, 129, 127, 1, 0, 0, 0, 130, 131, 3, 4, 1, 0, 131, 132, 1, 0, 0, 0, 132, 133, 6, 3, 1, 0, 133, 9, 1, 0, 0, 0, 134, 135, 5, 118, 0, 0, 135, 136, 5, 97, 0, 0, 136, 137, 5, 114, 0, 0, 137, 138, 5, 115, 0, 0, 138, 11, 1, 0, 0, 0, 139, 140, 5, 109, 0, 0, 140, 141, 5, 97, 0, 0, 141, 142, 5, 120, 0, 0, 142, 13, 1, 0, 0, 0, 143, 144, 5, 115, 0, 0, 144, 145, 5, 111, 0, 0, 145, 146, 5, 117, 0, 0, 146, 147, 5, 114, 0, 0, 147, 148, 5, 99, 0, 0, 148, 149, 5, 101, 0, 0, 149, 15, 1, 0, 0, 0, 150, 151, 5, 100, 0, 0, 151, 152, 5, 101, 0, 0, 152, 153, 5, 115, 0, 0, 153, 154, 5, 116, 0, 0, 154, 155, 5, 105, 0, 0, 155, 156, 5, 110, 0, 0, 156, 157, 5, 97, 0, 0, 157, 158, 5, 116, 0, 0, 158, 159, 5, 105, 0, 0, 159, 160, 5, 111, 0, 0, 160, 161, 5, 110, 0, 0, 161, 17, 1, 0, 0, 0, 162, 163, 5, 115, 0, 0, 163, 164, 5, 101, 0, 0, 164, 165, 5, 110, 0, 0, 165, 166, 5, 100, 0, 0, 166, 19, 1, 0, 0, 0, 167, 168, 5, 102, 0, 0, 168, 169, 5, 114, 0, 0, 169, 170, 5, 111, 0, 0, 170, 171, 5, 109, 0, 0, 171, 21, 1, 0, 0, 0, 172, 173, 5, 117, 0, 0, 173, 174, 5, 112, 0, 0, 174, 23, 1, 0, 0, 0, 175, 176, 5, 116, 0, 0, 176, 177, 5, 111, 0, 0, 177, 25, 1, 0, 0, 0, 178, 179, 5, 114, 0, 0, 179, 180, 5, 101, 0, 0, 180, 181, 5, 109, 0, 0, 181, 182, 5, 97, 0, 0, 182, 183, 5, 105, 0, 0, 183, 184, 5, 110, 0, 0, 184, 185, 5, 105, 0, 0, 185, 186, 5, 110, 0, 0, 186, 187, 5, 103, 0, 0, 187, 27, 1, 0, 0, 0, 188, 189, 5, 97, 0, 0, 189, 190, 5, 108, 0, 0, 190, 191, 5, 108, 0, 0, 191, 192, 5, 111, 0, 0, 192, 193, 5, 119, 0, 0, 193, 194, 5, 105, 0, 0, 194, 195, 5, 110, 0, 0, 195, 196, 5, 103, 0, 0, 196, 29, 1, 0, 0, 0, 197, 198, 5, 117, 0, 0, 198, 199, 5, 110, 0, 0, 199, 200, 5, 98, 0, 0, 200, 201, 5, 111, 0, 0, 201, 202, 5, 117, 0, 0, 202, 203, 5, 110, 0, 0, 203, 204, 5, 100, 0, 0, 204, 205, 5, 101, 0, 0, 205, 206, 5, 100, 0, 0, 206, 31, 1, 0, 0, 0, 207, 208, 5, 111, 0, 0, 208, 209, 5, 118, 0, 0, 209, 210, 5, 101, 0, 0, 210, 211, 5, 114, 0, 0, 211, 212, 5, 100, 0, 0, 212, 213, 5, 114, 0, 0, 213, 214, 5, 97, 0, 0, 214, 215, 5, 102, 0, 0, 215, 216, 5, 116, 0, 0, 216, 33, 1, 0, 0, 0, 217, 218, 5, 111, 0, 0, 218, 219, 5, 110, 0, 0, 219, 220, 5, 101, 0, 0, 220, 221, 5, 111, 0, 0, 221, 222, 5, 102, 0, 0, 222, 35, 1, 0, 0, 0, 223, 224, 5, 107, 0, 0, 224, 225, 5, 101, 0, 0, 225, 226, 5, 112, 0, 0, 226, 227, 5, 116, 0, 0, 227, 37, 1, 0, 0, 0, 228, 229, 5, 115, 0, 0, 229, 230, 5, 97, 0, 0, 230, 231, 5, 118, 0, 0, 231, 232, 5, 101, 0, 0, 232, 39, 1, 0, 0, 0, 233, 234, 5, 40, 0, 0, 234, 41, 1, 0, 0, 0, 235, 236, 5, 41, 0, 0, 236, 43, 1, 0, 0, 0, 237, 238, 5, 91, 0, 0, 238, 45, 1, 0, 0, 0, 239, 240, 5, 93, 0, 0, 240, 47, 1, 0, 0, 0, 241, 242, 5, 123, 0, 0, 242, 49, 1, 0, 0, 0, 243, 244, 5, 125, 0, 0, 244, 51, 1, 0, 0, 0, 245, 246, 5, 44, 0, 0, 246, 53, 1, 0, 0, 0, 247, 248, 5, 61, 0, 0, 248, 55, 1, 0, 0, 0, 249, 250, 5, 42, 0, 0, 250, 57, 1, 0, 0, 0, 251, 252, 5, 43, 0, 0, 252, 59, 1, 0, 0, 0, 253, 254, 5, 45, 0, 0, 254, 61, 1, 0, 0, 0, 255, 256, 5, 47, 0, 0, 256, 63, 1, 0, 0, 0, 257, 258, 5, 92, 0, 0, 258, 65, 1, 0, 0, 0, 259, 260, 5, 119, 0, 0, 260, 261, 5, 105, 0, 0, 261, 262, 5, 116, 0, 0, 262, 263, 5, 104, 0, 0, 263, 67, 1, 0, 0, 0, 264, 265, 5, 115, 0, 0, 265, 266, 5, 99, 0, 0, 266, 267, 5, 97, 0, 0, 267, 268, 5, 108, 0, 0, 268, 269, 5, 105, 0, 0, 269, 270, 5, 110, 0, 0, 270, 271, 5, 103, 0, 0, 271, 69, 1, 0, 0, 0, 272, 273, 5, 116, 0, 0, 273, 274, 5, 104, 0, 0, 274, 275, 5, 114, 0, 0, 275, 276, 5, 111, 0, 0, 276, 277, 5, 117, 0, 0, 277, 278, 5, 103, 0, 0, 278, 279, 5, 104, 0, 0, 279, 71, 1, 0, 0, 0, 280, 282, 7, 2, 0, 0, 281, 280, 1, 0, 0, 0, 282, 283, 1, 0, 0, 0, 283, 281, 1, 0, 0, 0, 283, 284, 1, 0, 0, 0, 284, 291, 1, 0, 0, 0, 285, 287, 5, 46, 0, 0, 286, 288, 7, 2, 0, 0, 287, 286, 1, 0, 0, 0, 288, 289, 1, 0, 0, 0, 289, 287, 1, 0, 0, 0, 289, 290, 1, 0, 0, 0, 290, 292, 1, 0, 0, 0, 291, 285, 1, 0, 0, 0, 291, 292, 1, 0, 0, 0, 292, 293, 1, 0, 0, 0, 293, 294, 5, 37, 0, 0, 294, 73, 1, 0, 0, 0, 295, 301, 5, 34, 0, 0, 296, 297, 5, 92, 0, 0, 297, 300, 5, 34, 0, 0, 298, 300, 8, 3, 0, 0, 299, 296, 1, 0, 0, 0, 299, 298, 1, 0, 0, 0, 300, 303, 1, 0, 0, 0, 301, 299, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 304, 1, 0, 0, 0, 303, 301, 1, 0, 0, 0, 304, 305, 5, 34, 0, 0, 305, 75, 1, 0, 0, 0, 306, 308, 7, 4, 0, 0, 307, 306, 1, 0, 0, 0, 308, 309, 1, 0, 0, 0, 309, 307, 1, 0, 0, 0, 309, 310, 1, 0, 0, 0, 310, 314, 1, 0, 0, 0, 311, 313, 7, 5, 0, 0, 312, 311, 1, 0, 0, 0, 313, 316, 1, 0, 0, 0, 314, 312, 1, 0, 0, 0, 314, 315, 1, 0, 0, 0, 315, 77, 1, 0, 0, 0, 316, 314, 1, 0, 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, 330, 1, 0, 0, 0, 322, 324, 5, 95, 0, 0, 323, 325, 7, 2, 0, 0, 324, 323, 1, 0, 0, 0, 325, 326, 1, 0, 0, 0, 326, 324, 1, 0, 0, 0, 326, 327, 1, 0, 0, 0, 327, 329, 1, 0, 0, 0, 328, 322, 1, 0, 0, 0, 329, 332, 1, 0, 0, 0, 330, 328, 1, 0, 0, 0, 330, 331, 1, 0, 0, 0, 331, 79, 1, 0, 0, 0, 332, 330, 1, 0, 0, 0, 333, 337, 7, 6, 0, 0, 334, 336, 7, 7, 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, 346, 1, 0, 0, 0, 339, 337, 1, 0, 0, 0, 340, 342, 5, 47, 0, 0, 341, 343, 7, 2, 0, 0, 342, 341, 1, 0, 0, 0, 343, 344, 1, 0, 0, 0, 344, 342, 1, 0, 0, 0, 344, 345, 1, 0, 0, 0, 345, 347, 1, 0, 0, 0, 346, 340, 1, 0, 0, 0, 346, 347, 1, 0, 0, 0, 347, 81, 1, 0, 0, 0, 348, 349, 5, 64, 0, 0, 349, 350, 1, 0, 0, 0, 350, 351, 6, 40, 2, 0, 351, 83, 1, 0, 0, 0, 352, 353, 5, 58, 0, 0, 353, 354, 1, 0, 0, 0, 354, 355, 6, 41, 2, 0, 355, 85, 1, 0, 0, 0, 356, 358, 5, 36, 0, 0, 357, 359, 7, 5, 0, 0, 358, 357, 1, 0, 0, 0, 359, 360, 1, 0, 0, 0, 360, 358, 1, 0, 0, 0, 360, 361, 1, 0, 0, 0, 361, 365, 1, 0, 0, 0, 362, 364, 7, 8, 0, 0, 363, 362, 1, 0, 0, 0, 364, 367, 1, 0, 0, 0, 365, 363, 1, 0, 0, 0, 365, 366, 1, 0, 0, 0, 366, 87, 1, 0, 0, 0, 367, 365, 1, 0, 0, 0, 368, 370, 7, 9, 0, 0, 369, 368, 1, 0, 0, 0, 370, 371, 1, 0, 0, 0, 371, 369, 1, 0, 0, 0, 371, 372, 1, 0, 0, 0, 372, 373, 1, 0, 0, 0, 373, 374, 6, 43, 3, 0, 374, 89, 1, 0, 0, 0, 375, 376, 3, 86, 42, 0, 376, 377, 1, 0, 0, 0, 377, 378, 6, 44, 3, 0, 378, 91, 1, 0, 0, 0, 379, 380, 3, 86, 42, 0, 380, 93, 1, 0, 0, 0, 23, 0, 1, 97, 104, 111, 113, 127, 283, 289, 291, 299, 301, 309, 314, 320, 326, 330, 337, 344, 346, 360, 365, 371, 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 5fea9de1..8e7eb0ea 100644 --- a/internal/parser/antlrParser/Lexer.tokens +++ b/internal/parser/antlrParser/Lexer.tokens @@ -30,16 +30,19 @@ PLUS=29 MINUS=30 DIV=31 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 +WITH=33 +SCALING=34 +THROUGH=35 +PERCENTAGE_PORTION_LITERAL=36 +STRING=37 +IDENTIFIER=38 +NUMBER=39 +ASSET=40 +ACCOUNT_START=41 +COLON=42 +ACCOUNT_TEXT=43 +VARIABLE_NAME_ACC=44 +VARIABLE_NAME=45 'vars'=5 'max'=6 'source'=7 @@ -68,5 +71,8 @@ VARIABLE_NAME=42 '-'=30 '/'=31 '\\'=32 -'@'=38 -':'=39 +'with'=33 +'scaling'=34 +'through'=35 +'@'=41 +':'=42 diff --git a/internal/parser/antlrParser/Numscript.interp b/internal/parser/antlrParser/Numscript.interp index 36f269a6..700f6da0 100644 --- a/internal/parser/antlrParser/Numscript.interp +++ b/internal/parser/antlrParser/Numscript.interp @@ -32,6 +32,9 @@ null '-' '/' '\\' +'with' +'scaling' +'through' null null null @@ -77,6 +80,9 @@ PLUS MINUS DIV RESTRICT +WITH +SCALING +THROUGH PERCENTAGE_PORTION_LITERAL STRING IDENTIFIER @@ -112,4 +118,4 @@ statement atn: -[4, 1, 42, 269, 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, 1, 2, 1, 2, 3, 2, 73, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 81, 8, 2, 10, 2, 12, 2, 84, 9, 2, 1, 3, 1, 3, 1, 3, 5, 3, 89, 8, 3, 10, 3, 12, 3, 92, 9, 3, 1, 4, 1, 4, 1, 4, 3, 4, 97, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 3, 6, 107, 8, 6, 1, 7, 1, 7, 1, 7, 5, 7, 112, 8, 7, 10, 7, 12, 7, 115, 9, 7, 1, 7, 1, 7, 1, 8, 3, 8, 120, 8, 8, 1, 8, 5, 8, 123, 8, 8, 10, 8, 12, 8, 126, 9, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 3, 10, 137, 8, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 144, 8, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 152, 8, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 162, 8, 12, 1, 12, 1, 12, 4, 12, 166, 8, 12, 11, 12, 12, 12, 167, 1, 12, 1, 12, 1, 12, 1, 12, 5, 12, 174, 8, 12, 10, 12, 12, 12, 177, 9, 12, 1, 12, 1, 12, 1, 12, 1, 12, 4, 12, 183, 8, 12, 11, 12, 12, 12, 184, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 194, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 3, 14, 203, 8, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 4, 16, 212, 8, 16, 11, 16, 12, 16, 213, 1, 16, 1, 16, 1, 16, 1, 16, 5, 16, 220, 8, 16, 10, 16, 12, 16, 223, 9, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 5, 16, 232, 8, 16, 10, 16, 12, 16, 235, 9, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 241, 8, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 3, 18, 248, 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, 267, 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, 290, 0, 40, 1, 0, 0, 0, 2, 47, 1, 0, 0, 0, 4, 72, 1, 0, 0, 0, 6, 85, 1, 0, 0, 0, 8, 93, 1, 0, 0, 0, 10, 100, 1, 0, 0, 0, 12, 103, 1, 0, 0, 0, 14, 108, 1, 0, 0, 0, 16, 119, 1, 0, 0, 0, 18, 129, 1, 0, 0, 0, 20, 136, 1, 0, 0, 0, 22, 138, 1, 0, 0, 0, 24, 193, 1, 0, 0, 0, 26, 195, 1, 0, 0, 0, 28, 202, 1, 0, 0, 0, 30, 204, 1, 0, 0, 0, 32, 240, 1, 0, 0, 0, 34, 242, 1, 0, 0, 0, 36, 247, 1, 0, 0, 0, 38, 266, 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, 73, 5, 42, 0, 0, 51, 73, 5, 37, 0, 0, 52, 73, 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, 73, 1, 0, 0, 0, 61, 59, 1, 0, 0, 0, 62, 73, 5, 36, 0, 0, 63, 73, 5, 33, 0, 0, 64, 73, 3, 0, 0, 0, 65, 66, 5, 30, 0, 0, 66, 73, 3, 4, 2, 5, 67, 68, 5, 20, 0, 0, 68, 69, 3, 4, 2, 0, 69, 70, 5, 21, 0, 0, 70, 73, 1, 0, 0, 0, 71, 73, 3, 8, 4, 0, 72, 49, 1, 0, 0, 0, 72, 51, 1, 0, 0, 0, 72, 52, 1, 0, 0, 0, 72, 53, 1, 0, 0, 0, 72, 62, 1, 0, 0, 0, 72, 63, 1, 0, 0, 0, 72, 64, 1, 0, 0, 0, 72, 65, 1, 0, 0, 0, 72, 67, 1, 0, 0, 0, 72, 71, 1, 0, 0, 0, 73, 82, 1, 0, 0, 0, 74, 75, 10, 4, 0, 0, 75, 76, 5, 31, 0, 0, 76, 81, 3, 4, 2, 5, 77, 78, 10, 3, 0, 0, 78, 79, 7, 0, 0, 0, 79, 81, 3, 4, 2, 4, 80, 74, 1, 0, 0, 0, 80, 77, 1, 0, 0, 0, 81, 84, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 5, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 85, 90, 3, 4, 2, 0, 86, 87, 5, 26, 0, 0, 87, 89, 3, 4, 2, 0, 88, 86, 1, 0, 0, 0, 89, 92, 1, 0, 0, 0, 90, 88, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 7, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, 93, 94, 7, 1, 0, 0, 94, 96, 5, 20, 0, 0, 95, 97, 3, 6, 3, 0, 96, 95, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 99, 5, 21, 0, 0, 99, 9, 1, 0, 0, 0, 100, 101, 5, 27, 0, 0, 101, 102, 3, 4, 2, 0, 102, 11, 1, 0, 0, 0, 103, 104, 5, 35, 0, 0, 104, 106, 5, 42, 0, 0, 105, 107, 3, 10, 5, 0, 106, 105, 1, 0, 0, 0, 106, 107, 1, 0, 0, 0, 107, 13, 1, 0, 0, 0, 108, 109, 5, 5, 0, 0, 109, 113, 5, 24, 0, 0, 110, 112, 3, 12, 6, 0, 111, 110, 1, 0, 0, 0, 112, 115, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 116, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 116, 117, 5, 25, 0, 0, 117, 15, 1, 0, 0, 0, 118, 120, 3, 14, 7, 0, 119, 118, 1, 0, 0, 0, 119, 120, 1, 0, 0, 0, 120, 124, 1, 0, 0, 0, 121, 123, 3, 38, 19, 0, 122, 121, 1, 0, 0, 0, 123, 126, 1, 0, 0, 0, 124, 122, 1, 0, 0, 0, 124, 125, 1, 0, 0, 0, 125, 127, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 127, 128, 5, 0, 0, 1, 128, 17, 1, 0, 0, 0, 129, 130, 5, 22, 0, 0, 130, 131, 3, 4, 2, 0, 131, 132, 5, 28, 0, 0, 132, 133, 5, 23, 0, 0, 133, 19, 1, 0, 0, 0, 134, 137, 3, 4, 2, 0, 135, 137, 5, 13, 0, 0, 136, 134, 1, 0, 0, 0, 136, 135, 1, 0, 0, 0, 137, 21, 1, 0, 0, 0, 138, 139, 5, 32, 0, 0, 139, 140, 3, 4, 2, 0, 140, 23, 1, 0, 0, 0, 141, 143, 3, 4, 2, 0, 142, 144, 3, 22, 11, 0, 143, 142, 1, 0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 145, 1, 0, 0, 0, 145, 146, 5, 14, 0, 0, 146, 147, 5, 15, 0, 0, 147, 148, 5, 16, 0, 0, 148, 194, 1, 0, 0, 0, 149, 151, 3, 4, 2, 0, 150, 152, 3, 22, 11, 0, 151, 150, 1, 0, 0, 0, 151, 152, 1, 0, 0, 0, 152, 153, 1, 0, 0, 0, 153, 154, 5, 14, 0, 0, 154, 155, 5, 16, 0, 0, 155, 156, 5, 11, 0, 0, 156, 157, 5, 12, 0, 0, 157, 158, 3, 4, 2, 0, 158, 194, 1, 0, 0, 0, 159, 161, 3, 4, 2, 0, 160, 162, 3, 22, 11, 0, 161, 160, 1, 0, 0, 0, 161, 162, 1, 0, 0, 0, 162, 194, 1, 0, 0, 0, 163, 165, 5, 24, 0, 0, 164, 166, 3, 26, 13, 0, 165, 164, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 165, 1, 0, 0, 0, 167, 168, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 170, 5, 25, 0, 0, 170, 194, 1, 0, 0, 0, 171, 175, 5, 24, 0, 0, 172, 174, 3, 24, 12, 0, 173, 172, 1, 0, 0, 0, 174, 177, 1, 0, 0, 0, 175, 173, 1, 0, 0, 0, 175, 176, 1, 0, 0, 0, 176, 178, 1, 0, 0, 0, 177, 175, 1, 0, 0, 0, 178, 194, 5, 25, 0, 0, 179, 180, 5, 17, 0, 0, 180, 182, 5, 24, 0, 0, 181, 183, 3, 24, 12, 0, 182, 181, 1, 0, 0, 0, 183, 184, 1, 0, 0, 0, 184, 182, 1, 0, 0, 0, 184, 185, 1, 0, 0, 0, 185, 186, 1, 0, 0, 0, 186, 187, 5, 25, 0, 0, 187, 194, 1, 0, 0, 0, 188, 189, 5, 6, 0, 0, 189, 190, 3, 4, 2, 0, 190, 191, 5, 10, 0, 0, 191, 192, 3, 24, 12, 0, 192, 194, 1, 0, 0, 0, 193, 141, 1, 0, 0, 0, 193, 149, 1, 0, 0, 0, 193, 159, 1, 0, 0, 0, 193, 163, 1, 0, 0, 0, 193, 171, 1, 0, 0, 0, 193, 179, 1, 0, 0, 0, 193, 188, 1, 0, 0, 0, 194, 25, 1, 0, 0, 0, 195, 196, 3, 20, 10, 0, 196, 197, 5, 10, 0, 0, 197, 198, 3, 24, 12, 0, 198, 27, 1, 0, 0, 0, 199, 200, 5, 12, 0, 0, 200, 203, 3, 32, 16, 0, 201, 203, 5, 18, 0, 0, 202, 199, 1, 0, 0, 0, 202, 201, 1, 0, 0, 0, 203, 29, 1, 0, 0, 0, 204, 205, 5, 6, 0, 0, 205, 206, 3, 4, 2, 0, 206, 207, 3, 28, 14, 0, 207, 31, 1, 0, 0, 0, 208, 241, 3, 4, 2, 0, 209, 211, 5, 24, 0, 0, 210, 212, 3, 34, 17, 0, 211, 210, 1, 0, 0, 0, 212, 213, 1, 0, 0, 0, 213, 211, 1, 0, 0, 0, 213, 214, 1, 0, 0, 0, 214, 215, 1, 0, 0, 0, 215, 216, 5, 25, 0, 0, 216, 241, 1, 0, 0, 0, 217, 221, 5, 24, 0, 0, 218, 220, 3, 30, 15, 0, 219, 218, 1, 0, 0, 0, 220, 223, 1, 0, 0, 0, 221, 219, 1, 0, 0, 0, 221, 222, 1, 0, 0, 0, 222, 224, 1, 0, 0, 0, 223, 221, 1, 0, 0, 0, 224, 225, 5, 13, 0, 0, 225, 226, 3, 28, 14, 0, 226, 227, 5, 25, 0, 0, 227, 241, 1, 0, 0, 0, 228, 229, 5, 17, 0, 0, 229, 233, 5, 24, 0, 0, 230, 232, 3, 30, 15, 0, 231, 230, 1, 0, 0, 0, 232, 235, 1, 0, 0, 0, 233, 231, 1, 0, 0, 0, 233, 234, 1, 0, 0, 0, 234, 236, 1, 0, 0, 0, 235, 233, 1, 0, 0, 0, 236, 237, 5, 13, 0, 0, 237, 238, 3, 28, 14, 0, 238, 239, 5, 25, 0, 0, 239, 241, 1, 0, 0, 0, 240, 208, 1, 0, 0, 0, 240, 209, 1, 0, 0, 0, 240, 217, 1, 0, 0, 0, 240, 228, 1, 0, 0, 0, 241, 33, 1, 0, 0, 0, 242, 243, 3, 20, 10, 0, 243, 244, 3, 28, 14, 0, 244, 35, 1, 0, 0, 0, 245, 248, 3, 4, 2, 0, 246, 248, 3, 18, 9, 0, 247, 245, 1, 0, 0, 0, 247, 246, 1, 0, 0, 0, 248, 37, 1, 0, 0, 0, 249, 250, 5, 9, 0, 0, 250, 251, 3, 36, 18, 0, 251, 252, 5, 20, 0, 0, 252, 253, 5, 7, 0, 0, 253, 254, 5, 27, 0, 0, 254, 255, 3, 24, 12, 0, 255, 256, 5, 8, 0, 0, 256, 257, 5, 27, 0, 0, 257, 258, 3, 32, 16, 0, 258, 259, 5, 21, 0, 0, 259, 267, 1, 0, 0, 0, 260, 261, 5, 19, 0, 0, 261, 262, 3, 36, 18, 0, 262, 263, 5, 10, 0, 0, 263, 264, 3, 4, 2, 0, 264, 267, 1, 0, 0, 0, 265, 267, 3, 8, 4, 0, 266, 249, 1, 0, 0, 0, 266, 260, 1, 0, 0, 0, 266, 265, 1, 0, 0, 0, 267, 39, 1, 0, 0, 0, 26, 47, 59, 72, 80, 82, 90, 96, 106, 113, 119, 124, 136, 143, 151, 161, 167, 175, 184, 193, 202, 213, 221, 233, 240, 247, 266] \ No newline at end of file +[4, 1, 45, 275, 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, 1, 2, 1, 2, 3, 2, 73, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 81, 8, 2, 10, 2, 12, 2, 84, 9, 2, 1, 3, 1, 3, 1, 3, 5, 3, 89, 8, 3, 10, 3, 12, 3, 92, 9, 3, 1, 4, 1, 4, 1, 4, 3, 4, 97, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 3, 6, 107, 8, 6, 1, 7, 1, 7, 1, 7, 5, 7, 112, 8, 7, 10, 7, 12, 7, 115, 9, 7, 1, 7, 1, 7, 1, 8, 3, 8, 120, 8, 8, 1, 8, 5, 8, 123, 8, 8, 10, 8, 12, 8, 126, 9, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 3, 10, 137, 8, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 144, 8, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 152, 8, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 168, 8, 12, 1, 12, 1, 12, 4, 12, 172, 8, 12, 11, 12, 12, 12, 173, 1, 12, 1, 12, 1, 12, 1, 12, 5, 12, 180, 8, 12, 10, 12, 12, 12, 183, 9, 12, 1, 12, 1, 12, 1, 12, 1, 12, 4, 12, 189, 8, 12, 11, 12, 12, 12, 190, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 200, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 3, 14, 209, 8, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 4, 16, 218, 8, 16, 11, 16, 12, 16, 219, 1, 16, 1, 16, 1, 16, 1, 16, 5, 16, 226, 8, 16, 10, 16, 12, 16, 229, 9, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 5, 16, 238, 8, 16, 10, 16, 12, 16, 241, 9, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 247, 8, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 3, 18, 254, 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, 273, 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, 38, 38, 297, 0, 40, 1, 0, 0, 0, 2, 47, 1, 0, 0, 0, 4, 72, 1, 0, 0, 0, 6, 85, 1, 0, 0, 0, 8, 93, 1, 0, 0, 0, 10, 100, 1, 0, 0, 0, 12, 103, 1, 0, 0, 0, 14, 108, 1, 0, 0, 0, 16, 119, 1, 0, 0, 0, 18, 129, 1, 0, 0, 0, 20, 136, 1, 0, 0, 0, 22, 138, 1, 0, 0, 0, 24, 199, 1, 0, 0, 0, 26, 201, 1, 0, 0, 0, 28, 208, 1, 0, 0, 0, 30, 210, 1, 0, 0, 0, 32, 246, 1, 0, 0, 0, 34, 248, 1, 0, 0, 0, 36, 253, 1, 0, 0, 0, 38, 272, 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, 43, 0, 0, 46, 48, 5, 44, 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, 73, 5, 45, 0, 0, 51, 73, 5, 40, 0, 0, 52, 73, 5, 37, 0, 0, 53, 54, 5, 41, 0, 0, 54, 59, 3, 2, 1, 0, 55, 56, 5, 42, 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, 73, 1, 0, 0, 0, 61, 59, 1, 0, 0, 0, 62, 73, 5, 39, 0, 0, 63, 73, 5, 36, 0, 0, 64, 73, 3, 0, 0, 0, 65, 66, 5, 30, 0, 0, 66, 73, 3, 4, 2, 5, 67, 68, 5, 20, 0, 0, 68, 69, 3, 4, 2, 0, 69, 70, 5, 21, 0, 0, 70, 73, 1, 0, 0, 0, 71, 73, 3, 8, 4, 0, 72, 49, 1, 0, 0, 0, 72, 51, 1, 0, 0, 0, 72, 52, 1, 0, 0, 0, 72, 53, 1, 0, 0, 0, 72, 62, 1, 0, 0, 0, 72, 63, 1, 0, 0, 0, 72, 64, 1, 0, 0, 0, 72, 65, 1, 0, 0, 0, 72, 67, 1, 0, 0, 0, 72, 71, 1, 0, 0, 0, 73, 82, 1, 0, 0, 0, 74, 75, 10, 4, 0, 0, 75, 76, 5, 31, 0, 0, 76, 81, 3, 4, 2, 5, 77, 78, 10, 3, 0, 0, 78, 79, 7, 0, 0, 0, 79, 81, 3, 4, 2, 4, 80, 74, 1, 0, 0, 0, 80, 77, 1, 0, 0, 0, 81, 84, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 5, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 85, 90, 3, 4, 2, 0, 86, 87, 5, 26, 0, 0, 87, 89, 3, 4, 2, 0, 88, 86, 1, 0, 0, 0, 89, 92, 1, 0, 0, 0, 90, 88, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 7, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, 93, 94, 7, 1, 0, 0, 94, 96, 5, 20, 0, 0, 95, 97, 3, 6, 3, 0, 96, 95, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 99, 5, 21, 0, 0, 99, 9, 1, 0, 0, 0, 100, 101, 5, 27, 0, 0, 101, 102, 3, 4, 2, 0, 102, 11, 1, 0, 0, 0, 103, 104, 5, 38, 0, 0, 104, 106, 5, 45, 0, 0, 105, 107, 3, 10, 5, 0, 106, 105, 1, 0, 0, 0, 106, 107, 1, 0, 0, 0, 107, 13, 1, 0, 0, 0, 108, 109, 5, 5, 0, 0, 109, 113, 5, 24, 0, 0, 110, 112, 3, 12, 6, 0, 111, 110, 1, 0, 0, 0, 112, 115, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 116, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 116, 117, 5, 25, 0, 0, 117, 15, 1, 0, 0, 0, 118, 120, 3, 14, 7, 0, 119, 118, 1, 0, 0, 0, 119, 120, 1, 0, 0, 0, 120, 124, 1, 0, 0, 0, 121, 123, 3, 38, 19, 0, 122, 121, 1, 0, 0, 0, 123, 126, 1, 0, 0, 0, 124, 122, 1, 0, 0, 0, 124, 125, 1, 0, 0, 0, 125, 127, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 127, 128, 5, 0, 0, 1, 128, 17, 1, 0, 0, 0, 129, 130, 5, 22, 0, 0, 130, 131, 3, 4, 2, 0, 131, 132, 5, 28, 0, 0, 132, 133, 5, 23, 0, 0, 133, 19, 1, 0, 0, 0, 134, 137, 3, 4, 2, 0, 135, 137, 5, 13, 0, 0, 136, 134, 1, 0, 0, 0, 136, 135, 1, 0, 0, 0, 137, 21, 1, 0, 0, 0, 138, 139, 5, 32, 0, 0, 139, 140, 3, 4, 2, 0, 140, 23, 1, 0, 0, 0, 141, 143, 3, 4, 2, 0, 142, 144, 3, 22, 11, 0, 143, 142, 1, 0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 145, 1, 0, 0, 0, 145, 146, 5, 14, 0, 0, 146, 147, 5, 15, 0, 0, 147, 148, 5, 16, 0, 0, 148, 200, 1, 0, 0, 0, 149, 151, 3, 4, 2, 0, 150, 152, 3, 22, 11, 0, 151, 150, 1, 0, 0, 0, 151, 152, 1, 0, 0, 0, 152, 153, 1, 0, 0, 0, 153, 154, 5, 14, 0, 0, 154, 155, 5, 16, 0, 0, 155, 156, 5, 11, 0, 0, 156, 157, 5, 12, 0, 0, 157, 158, 3, 4, 2, 0, 158, 200, 1, 0, 0, 0, 159, 160, 3, 4, 2, 0, 160, 161, 5, 33, 0, 0, 161, 162, 5, 34, 0, 0, 162, 163, 5, 35, 0, 0, 163, 164, 3, 4, 2, 0, 164, 200, 1, 0, 0, 0, 165, 167, 3, 4, 2, 0, 166, 168, 3, 22, 11, 0, 167, 166, 1, 0, 0, 0, 167, 168, 1, 0, 0, 0, 168, 200, 1, 0, 0, 0, 169, 171, 5, 24, 0, 0, 170, 172, 3, 26, 13, 0, 171, 170, 1, 0, 0, 0, 172, 173, 1, 0, 0, 0, 173, 171, 1, 0, 0, 0, 173, 174, 1, 0, 0, 0, 174, 175, 1, 0, 0, 0, 175, 176, 5, 25, 0, 0, 176, 200, 1, 0, 0, 0, 177, 181, 5, 24, 0, 0, 178, 180, 3, 24, 12, 0, 179, 178, 1, 0, 0, 0, 180, 183, 1, 0, 0, 0, 181, 179, 1, 0, 0, 0, 181, 182, 1, 0, 0, 0, 182, 184, 1, 0, 0, 0, 183, 181, 1, 0, 0, 0, 184, 200, 5, 25, 0, 0, 185, 186, 5, 17, 0, 0, 186, 188, 5, 24, 0, 0, 187, 189, 3, 24, 12, 0, 188, 187, 1, 0, 0, 0, 189, 190, 1, 0, 0, 0, 190, 188, 1, 0, 0, 0, 190, 191, 1, 0, 0, 0, 191, 192, 1, 0, 0, 0, 192, 193, 5, 25, 0, 0, 193, 200, 1, 0, 0, 0, 194, 195, 5, 6, 0, 0, 195, 196, 3, 4, 2, 0, 196, 197, 5, 10, 0, 0, 197, 198, 3, 24, 12, 0, 198, 200, 1, 0, 0, 0, 199, 141, 1, 0, 0, 0, 199, 149, 1, 0, 0, 0, 199, 159, 1, 0, 0, 0, 199, 165, 1, 0, 0, 0, 199, 169, 1, 0, 0, 0, 199, 177, 1, 0, 0, 0, 199, 185, 1, 0, 0, 0, 199, 194, 1, 0, 0, 0, 200, 25, 1, 0, 0, 0, 201, 202, 3, 20, 10, 0, 202, 203, 5, 10, 0, 0, 203, 204, 3, 24, 12, 0, 204, 27, 1, 0, 0, 0, 205, 206, 5, 12, 0, 0, 206, 209, 3, 32, 16, 0, 207, 209, 5, 18, 0, 0, 208, 205, 1, 0, 0, 0, 208, 207, 1, 0, 0, 0, 209, 29, 1, 0, 0, 0, 210, 211, 5, 6, 0, 0, 211, 212, 3, 4, 2, 0, 212, 213, 3, 28, 14, 0, 213, 31, 1, 0, 0, 0, 214, 247, 3, 4, 2, 0, 215, 217, 5, 24, 0, 0, 216, 218, 3, 34, 17, 0, 217, 216, 1, 0, 0, 0, 218, 219, 1, 0, 0, 0, 219, 217, 1, 0, 0, 0, 219, 220, 1, 0, 0, 0, 220, 221, 1, 0, 0, 0, 221, 222, 5, 25, 0, 0, 222, 247, 1, 0, 0, 0, 223, 227, 5, 24, 0, 0, 224, 226, 3, 30, 15, 0, 225, 224, 1, 0, 0, 0, 226, 229, 1, 0, 0, 0, 227, 225, 1, 0, 0, 0, 227, 228, 1, 0, 0, 0, 228, 230, 1, 0, 0, 0, 229, 227, 1, 0, 0, 0, 230, 231, 5, 13, 0, 0, 231, 232, 3, 28, 14, 0, 232, 233, 5, 25, 0, 0, 233, 247, 1, 0, 0, 0, 234, 235, 5, 17, 0, 0, 235, 239, 5, 24, 0, 0, 236, 238, 3, 30, 15, 0, 237, 236, 1, 0, 0, 0, 238, 241, 1, 0, 0, 0, 239, 237, 1, 0, 0, 0, 239, 240, 1, 0, 0, 0, 240, 242, 1, 0, 0, 0, 241, 239, 1, 0, 0, 0, 242, 243, 5, 13, 0, 0, 243, 244, 3, 28, 14, 0, 244, 245, 5, 25, 0, 0, 245, 247, 1, 0, 0, 0, 246, 214, 1, 0, 0, 0, 246, 215, 1, 0, 0, 0, 246, 223, 1, 0, 0, 0, 246, 234, 1, 0, 0, 0, 247, 33, 1, 0, 0, 0, 248, 249, 3, 20, 10, 0, 249, 250, 3, 28, 14, 0, 250, 35, 1, 0, 0, 0, 251, 254, 3, 4, 2, 0, 252, 254, 3, 18, 9, 0, 253, 251, 1, 0, 0, 0, 253, 252, 1, 0, 0, 0, 254, 37, 1, 0, 0, 0, 255, 256, 5, 9, 0, 0, 256, 257, 3, 36, 18, 0, 257, 258, 5, 20, 0, 0, 258, 259, 5, 7, 0, 0, 259, 260, 5, 27, 0, 0, 260, 261, 3, 24, 12, 0, 261, 262, 5, 8, 0, 0, 262, 263, 5, 27, 0, 0, 263, 264, 3, 32, 16, 0, 264, 265, 5, 21, 0, 0, 265, 273, 1, 0, 0, 0, 266, 267, 5, 19, 0, 0, 267, 268, 3, 36, 18, 0, 268, 269, 5, 10, 0, 0, 269, 270, 3, 4, 2, 0, 270, 273, 1, 0, 0, 0, 271, 273, 3, 8, 4, 0, 272, 255, 1, 0, 0, 0, 272, 266, 1, 0, 0, 0, 272, 271, 1, 0, 0, 0, 273, 39, 1, 0, 0, 0, 26, 47, 59, 72, 80, 82, 90, 96, 106, 113, 119, 124, 136, 143, 151, 167, 173, 181, 190, 199, 208, 219, 227, 239, 246, 253, 272] \ No newline at end of file diff --git a/internal/parser/antlrParser/Numscript.tokens b/internal/parser/antlrParser/Numscript.tokens index 5fea9de1..8e7eb0ea 100644 --- a/internal/parser/antlrParser/Numscript.tokens +++ b/internal/parser/antlrParser/Numscript.tokens @@ -30,16 +30,19 @@ PLUS=29 MINUS=30 DIV=31 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 +WITH=33 +SCALING=34 +THROUGH=35 +PERCENTAGE_PORTION_LITERAL=36 +STRING=37 +IDENTIFIER=38 +NUMBER=39 +ASSET=40 +ACCOUNT_START=41 +COLON=42 +ACCOUNT_TEXT=43 +VARIABLE_NAME_ACC=44 +VARIABLE_NAME=45 'vars'=5 'max'=6 'source'=7 @@ -68,5 +71,8 @@ VARIABLE_NAME=42 '-'=30 '/'=31 '\\'=32 -'@'=38 -':'=39 +'with'=33 +'scaling'=34 +'through'=35 +'@'=41 +':'=42 diff --git a/internal/parser/antlrParser/lexer.go b/internal/parser/antlrParser/lexer.go index 449fcd65..950cbb6c 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'", "'('", "')'", "'['", "']'", - "'{'", "'}'", "','", "'='", "'*'", "'+'", "'-'", "'/'", "'\\'", "", - "", "", "", "", "'@'", "':'", + "'{'", "'}'", "','", "'='", "'*'", "'+'", "'-'", "'/'", "'\\'", "'with'", + "'scaling'", "'through'", "", "", "", "", "", "'@'", "':'", } 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", "RESTRICT", "PERCENTAGE_PORTION_LITERAL", "STRING", - "IDENTIFIER", "NUMBER", "ASSET", "ACCOUNT_START", "COLON", "ACCOUNT_TEXT", - "VARIABLE_NAME_ACC", "VARIABLE_NAME", + "MINUS", "DIV", "RESTRICT", "WITH", "SCALING", "THROUGH", "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", "RESTRICT", "PERCENTAGE_PORTION_LITERAL", "STRING", - "IDENTIFIER", "NUMBER", "ASSET", "ACCOUNT_START", "COLON", "VARIABLE_NAME_FRAGMENT", - "ACCOUNT_TEXT", "VARIABLE_NAME_ACC", "VARIABLE_NAME", + "MINUS", "DIV", "RESTRICT", "WITH", "SCALING", "THROUGH", "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, 42, 354, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, + 4, 0, 45, 381, 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,169 @@ 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, 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, 4, 35, 292, 8, 35, 11, 35, 12, 35, 293, 1, 35, - 1, 35, 4, 35, 298, 8, 35, 11, 35, 12, 35, 299, 5, 35, 302, 8, 35, 10, 35, - 12, 35, 305, 9, 35, 1, 36, 1, 36, 5, 36, 309, 8, 36, 10, 36, 12, 36, 312, - 9, 36, 1, 36, 1, 36, 4, 36, 316, 8, 36, 11, 36, 12, 36, 317, 3, 36, 320, - 8, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, - 39, 4, 39, 332, 8, 39, 11, 39, 12, 39, 333, 1, 39, 5, 39, 337, 8, 39, 10, - 39, 12, 39, 340, 9, 39, 1, 40, 4, 40, 343, 8, 40, 11, 40, 12, 40, 344, - 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, 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, 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, 306, 1, 0, 0, 0, 76, 321, 1, 0, 0, - 0, 78, 325, 1, 0, 0, 0, 80, 329, 1, 0, 0, 0, 82, 342, 1, 0, 0, 0, 84, 348, - 1, 0, 0, 0, 86, 352, 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, 7, 2, 0, 0, 291, 290, 1, 0, 0, 0, - 292, 293, 1, 0, 0, 0, 293, 291, 1, 0, 0, 0, 293, 294, 1, 0, 0, 0, 294, - 303, 1, 0, 0, 0, 295, 297, 5, 95, 0, 0, 296, 298, 7, 2, 0, 0, 297, 296, - 1, 0, 0, 0, 298, 299, 1, 0, 0, 0, 299, 297, 1, 0, 0, 0, 299, 300, 1, 0, - 0, 0, 300, 302, 1, 0, 0, 0, 301, 295, 1, 0, 0, 0, 302, 305, 1, 0, 0, 0, - 303, 301, 1, 0, 0, 0, 303, 304, 1, 0, 0, 0, 304, 73, 1, 0, 0, 0, 305, 303, - 1, 0, 0, 0, 306, 310, 7, 6, 0, 0, 307, 309, 7, 7, 0, 0, 308, 307, 1, 0, - 0, 0, 309, 312, 1, 0, 0, 0, 310, 308, 1, 0, 0, 0, 310, 311, 1, 0, 0, 0, - 311, 319, 1, 0, 0, 0, 312, 310, 1, 0, 0, 0, 313, 315, 5, 47, 0, 0, 314, - 316, 7, 2, 0, 0, 315, 314, 1, 0, 0, 0, 316, 317, 1, 0, 0, 0, 317, 315, - 1, 0, 0, 0, 317, 318, 1, 0, 0, 0, 318, 320, 1, 0, 0, 0, 319, 313, 1, 0, - 0, 0, 319, 320, 1, 0, 0, 0, 320, 75, 1, 0, 0, 0, 321, 322, 5, 64, 0, 0, - 322, 323, 1, 0, 0, 0, 323, 324, 6, 37, 2, 0, 324, 77, 1, 0, 0, 0, 325, - 326, 5, 58, 0, 0, 326, 327, 1, 0, 0, 0, 327, 328, 6, 38, 2, 0, 328, 79, - 1, 0, 0, 0, 329, 331, 5, 36, 0, 0, 330, 332, 7, 5, 0, 0, 331, 330, 1, 0, - 0, 0, 332, 333, 1, 0, 0, 0, 333, 331, 1, 0, 0, 0, 333, 334, 1, 0, 0, 0, - 334, 338, 1, 0, 0, 0, 335, 337, 7, 8, 0, 0, 336, 335, 1, 0, 0, 0, 337, - 340, 1, 0, 0, 0, 338, 336, 1, 0, 0, 0, 338, 339, 1, 0, 0, 0, 339, 81, 1, - 0, 0, 0, 340, 338, 1, 0, 0, 0, 341, 343, 7, 9, 0, 0, 342, 341, 1, 0, 0, - 0, 343, 344, 1, 0, 0, 0, 344, 342, 1, 0, 0, 0, 344, 345, 1, 0, 0, 0, 345, - 346, 1, 0, 0, 0, 346, 347, 6, 40, 3, 0, 347, 83, 1, 0, 0, 0, 348, 349, - 3, 80, 39, 0, 349, 350, 1, 0, 0, 0, 350, 351, 6, 41, 3, 0, 351, 85, 1, - 0, 0, 0, 352, 353, 3, 80, 39, 0, 353, 87, 1, 0, 0, 0, 23, 0, 1, 91, 98, - 105, 107, 121, 256, 262, 264, 272, 274, 282, 287, 293, 299, 303, 310, 317, - 319, 333, 338, 344, 4, 6, 0, 0, 0, 1, 0, 5, 1, 0, 4, 0, 0, + 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 1, + 0, 4, 0, 96, 8, 0, 11, 0, 12, 0, 97, 1, 0, 1, 0, 1, 1, 4, 1, 103, 8, 1, + 11, 1, 12, 1, 104, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 112, 8, 2, 10, 2, + 12, 2, 115, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, + 5, 3, 126, 8, 3, 10, 3, 12, 3, 129, 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, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, + 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, + 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 4, 35, 282, 8, 35, 11, 35, 12, 35, 283, + 1, 35, 1, 35, 4, 35, 288, 8, 35, 11, 35, 12, 35, 289, 3, 35, 292, 8, 35, + 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 5, 36, 300, 8, 36, 10, 36, 12, + 36, 303, 9, 36, 1, 36, 1, 36, 1, 37, 4, 37, 308, 8, 37, 11, 37, 12, 37, + 309, 1, 37, 5, 37, 313, 8, 37, 10, 37, 12, 37, 316, 9, 37, 1, 38, 4, 38, + 319, 8, 38, 11, 38, 12, 38, 320, 1, 38, 1, 38, 4, 38, 325, 8, 38, 11, 38, + 12, 38, 326, 5, 38, 329, 8, 38, 10, 38, 12, 38, 332, 9, 38, 1, 39, 1, 39, + 5, 39, 336, 8, 39, 10, 39, 12, 39, 339, 9, 39, 1, 39, 1, 39, 4, 39, 343, + 8, 39, 11, 39, 12, 39, 344, 3, 39, 347, 8, 39, 1, 40, 1, 40, 1, 40, 1, + 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 4, 42, 359, 8, 42, 11, 42, + 12, 42, 360, 1, 42, 5, 42, 364, 8, 42, 10, 42, 12, 42, 367, 9, 42, 1, 43, + 4, 43, 370, 8, 43, 11, 43, 12, 43, 371, 1, 43, 1, 43, 1, 44, 1, 44, 1, + 44, 1, 44, 1, 45, 1, 45, 2, 113, 127, 0, 46, 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, 40, 82, 41, + 84, 42, 86, 0, 88, 43, 90, 44, 92, 45, 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, 399, 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, 80, 1, 0, 0, 0, 0, 82, 1, 0, 0, 0, 0, 84, 1, 0, 0, + 0, 0, 92, 1, 0, 0, 0, 1, 88, 1, 0, 0, 0, 1, 90, 1, 0, 0, 0, 2, 95, 1, 0, + 0, 0, 4, 102, 1, 0, 0, 0, 6, 106, 1, 0, 0, 0, 8, 121, 1, 0, 0, 0, 10, 134, + 1, 0, 0, 0, 12, 139, 1, 0, 0, 0, 14, 143, 1, 0, 0, 0, 16, 150, 1, 0, 0, + 0, 18, 162, 1, 0, 0, 0, 20, 167, 1, 0, 0, 0, 22, 172, 1, 0, 0, 0, 24, 175, + 1, 0, 0, 0, 26, 178, 1, 0, 0, 0, 28, 188, 1, 0, 0, 0, 30, 197, 1, 0, 0, + 0, 32, 207, 1, 0, 0, 0, 34, 217, 1, 0, 0, 0, 36, 223, 1, 0, 0, 0, 38, 228, + 1, 0, 0, 0, 40, 233, 1, 0, 0, 0, 42, 235, 1, 0, 0, 0, 44, 237, 1, 0, 0, + 0, 46, 239, 1, 0, 0, 0, 48, 241, 1, 0, 0, 0, 50, 243, 1, 0, 0, 0, 52, 245, + 1, 0, 0, 0, 54, 247, 1, 0, 0, 0, 56, 249, 1, 0, 0, 0, 58, 251, 1, 0, 0, + 0, 60, 253, 1, 0, 0, 0, 62, 255, 1, 0, 0, 0, 64, 257, 1, 0, 0, 0, 66, 259, + 1, 0, 0, 0, 68, 264, 1, 0, 0, 0, 70, 272, 1, 0, 0, 0, 72, 281, 1, 0, 0, + 0, 74, 295, 1, 0, 0, 0, 76, 307, 1, 0, 0, 0, 78, 318, 1, 0, 0, 0, 80, 333, + 1, 0, 0, 0, 82, 348, 1, 0, 0, 0, 84, 352, 1, 0, 0, 0, 86, 356, 1, 0, 0, + 0, 88, 369, 1, 0, 0, 0, 90, 375, 1, 0, 0, 0, 92, 379, 1, 0, 0, 0, 94, 96, + 7, 0, 0, 0, 95, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, + 97, 98, 1, 0, 0, 0, 98, 99, 1, 0, 0, 0, 99, 100, 6, 0, 0, 0, 100, 3, 1, + 0, 0, 0, 101, 103, 7, 1, 0, 0, 102, 101, 1, 0, 0, 0, 103, 104, 1, 0, 0, + 0, 104, 102, 1, 0, 0, 0, 104, 105, 1, 0, 0, 0, 105, 5, 1, 0, 0, 0, 106, + 107, 5, 47, 0, 0, 107, 108, 5, 42, 0, 0, 108, 113, 1, 0, 0, 0, 109, 112, + 3, 6, 2, 0, 110, 112, 9, 0, 0, 0, 111, 109, 1, 0, 0, 0, 111, 110, 1, 0, + 0, 0, 112, 115, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, + 114, 116, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 116, 117, 5, 42, 0, 0, 117, + 118, 5, 47, 0, 0, 118, 119, 1, 0, 0, 0, 119, 120, 6, 2, 0, 0, 120, 7, 1, + 0, 0, 0, 121, 122, 5, 47, 0, 0, 122, 123, 5, 47, 0, 0, 123, 127, 1, 0, + 0, 0, 124, 126, 9, 0, 0, 0, 125, 124, 1, 0, 0, 0, 126, 129, 1, 0, 0, 0, + 127, 128, 1, 0, 0, 0, 127, 125, 1, 0, 0, 0, 128, 130, 1, 0, 0, 0, 129, + 127, 1, 0, 0, 0, 130, 131, 3, 4, 1, 0, 131, 132, 1, 0, 0, 0, 132, 133, + 6, 3, 1, 0, 133, 9, 1, 0, 0, 0, 134, 135, 5, 118, 0, 0, 135, 136, 5, 97, + 0, 0, 136, 137, 5, 114, 0, 0, 137, 138, 5, 115, 0, 0, 138, 11, 1, 0, 0, + 0, 139, 140, 5, 109, 0, 0, 140, 141, 5, 97, 0, 0, 141, 142, 5, 120, 0, + 0, 142, 13, 1, 0, 0, 0, 143, 144, 5, 115, 0, 0, 144, 145, 5, 111, 0, 0, + 145, 146, 5, 117, 0, 0, 146, 147, 5, 114, 0, 0, 147, 148, 5, 99, 0, 0, + 148, 149, 5, 101, 0, 0, 149, 15, 1, 0, 0, 0, 150, 151, 5, 100, 0, 0, 151, + 152, 5, 101, 0, 0, 152, 153, 5, 115, 0, 0, 153, 154, 5, 116, 0, 0, 154, + 155, 5, 105, 0, 0, 155, 156, 5, 110, 0, 0, 156, 157, 5, 97, 0, 0, 157, + 158, 5, 116, 0, 0, 158, 159, 5, 105, 0, 0, 159, 160, 5, 111, 0, 0, 160, + 161, 5, 110, 0, 0, 161, 17, 1, 0, 0, 0, 162, 163, 5, 115, 0, 0, 163, 164, + 5, 101, 0, 0, 164, 165, 5, 110, 0, 0, 165, 166, 5, 100, 0, 0, 166, 19, + 1, 0, 0, 0, 167, 168, 5, 102, 0, 0, 168, 169, 5, 114, 0, 0, 169, 170, 5, + 111, 0, 0, 170, 171, 5, 109, 0, 0, 171, 21, 1, 0, 0, 0, 172, 173, 5, 117, + 0, 0, 173, 174, 5, 112, 0, 0, 174, 23, 1, 0, 0, 0, 175, 176, 5, 116, 0, + 0, 176, 177, 5, 111, 0, 0, 177, 25, 1, 0, 0, 0, 178, 179, 5, 114, 0, 0, + 179, 180, 5, 101, 0, 0, 180, 181, 5, 109, 0, 0, 181, 182, 5, 97, 0, 0, + 182, 183, 5, 105, 0, 0, 183, 184, 5, 110, 0, 0, 184, 185, 5, 105, 0, 0, + 185, 186, 5, 110, 0, 0, 186, 187, 5, 103, 0, 0, 187, 27, 1, 0, 0, 0, 188, + 189, 5, 97, 0, 0, 189, 190, 5, 108, 0, 0, 190, 191, 5, 108, 0, 0, 191, + 192, 5, 111, 0, 0, 192, 193, 5, 119, 0, 0, 193, 194, 5, 105, 0, 0, 194, + 195, 5, 110, 0, 0, 195, 196, 5, 103, 0, 0, 196, 29, 1, 0, 0, 0, 197, 198, + 5, 117, 0, 0, 198, 199, 5, 110, 0, 0, 199, 200, 5, 98, 0, 0, 200, 201, + 5, 111, 0, 0, 201, 202, 5, 117, 0, 0, 202, 203, 5, 110, 0, 0, 203, 204, + 5, 100, 0, 0, 204, 205, 5, 101, 0, 0, 205, 206, 5, 100, 0, 0, 206, 31, + 1, 0, 0, 0, 207, 208, 5, 111, 0, 0, 208, 209, 5, 118, 0, 0, 209, 210, 5, + 101, 0, 0, 210, 211, 5, 114, 0, 0, 211, 212, 5, 100, 0, 0, 212, 213, 5, + 114, 0, 0, 213, 214, 5, 97, 0, 0, 214, 215, 5, 102, 0, 0, 215, 216, 5, + 116, 0, 0, 216, 33, 1, 0, 0, 0, 217, 218, 5, 111, 0, 0, 218, 219, 5, 110, + 0, 0, 219, 220, 5, 101, 0, 0, 220, 221, 5, 111, 0, 0, 221, 222, 5, 102, + 0, 0, 222, 35, 1, 0, 0, 0, 223, 224, 5, 107, 0, 0, 224, 225, 5, 101, 0, + 0, 225, 226, 5, 112, 0, 0, 226, 227, 5, 116, 0, 0, 227, 37, 1, 0, 0, 0, + 228, 229, 5, 115, 0, 0, 229, 230, 5, 97, 0, 0, 230, 231, 5, 118, 0, 0, + 231, 232, 5, 101, 0, 0, 232, 39, 1, 0, 0, 0, 233, 234, 5, 40, 0, 0, 234, + 41, 1, 0, 0, 0, 235, 236, 5, 41, 0, 0, 236, 43, 1, 0, 0, 0, 237, 238, 5, + 91, 0, 0, 238, 45, 1, 0, 0, 0, 239, 240, 5, 93, 0, 0, 240, 47, 1, 0, 0, + 0, 241, 242, 5, 123, 0, 0, 242, 49, 1, 0, 0, 0, 243, 244, 5, 125, 0, 0, + 244, 51, 1, 0, 0, 0, 245, 246, 5, 44, 0, 0, 246, 53, 1, 0, 0, 0, 247, 248, + 5, 61, 0, 0, 248, 55, 1, 0, 0, 0, 249, 250, 5, 42, 0, 0, 250, 57, 1, 0, + 0, 0, 251, 252, 5, 43, 0, 0, 252, 59, 1, 0, 0, 0, 253, 254, 5, 45, 0, 0, + 254, 61, 1, 0, 0, 0, 255, 256, 5, 47, 0, 0, 256, 63, 1, 0, 0, 0, 257, 258, + 5, 92, 0, 0, 258, 65, 1, 0, 0, 0, 259, 260, 5, 119, 0, 0, 260, 261, 5, + 105, 0, 0, 261, 262, 5, 116, 0, 0, 262, 263, 5, 104, 0, 0, 263, 67, 1, + 0, 0, 0, 264, 265, 5, 115, 0, 0, 265, 266, 5, 99, 0, 0, 266, 267, 5, 97, + 0, 0, 267, 268, 5, 108, 0, 0, 268, 269, 5, 105, 0, 0, 269, 270, 5, 110, + 0, 0, 270, 271, 5, 103, 0, 0, 271, 69, 1, 0, 0, 0, 272, 273, 5, 116, 0, + 0, 273, 274, 5, 104, 0, 0, 274, 275, 5, 114, 0, 0, 275, 276, 5, 111, 0, + 0, 276, 277, 5, 117, 0, 0, 277, 278, 5, 103, 0, 0, 278, 279, 5, 104, 0, + 0, 279, 71, 1, 0, 0, 0, 280, 282, 7, 2, 0, 0, 281, 280, 1, 0, 0, 0, 282, + 283, 1, 0, 0, 0, 283, 281, 1, 0, 0, 0, 283, 284, 1, 0, 0, 0, 284, 291, + 1, 0, 0, 0, 285, 287, 5, 46, 0, 0, 286, 288, 7, 2, 0, 0, 287, 286, 1, 0, + 0, 0, 288, 289, 1, 0, 0, 0, 289, 287, 1, 0, 0, 0, 289, 290, 1, 0, 0, 0, + 290, 292, 1, 0, 0, 0, 291, 285, 1, 0, 0, 0, 291, 292, 1, 0, 0, 0, 292, + 293, 1, 0, 0, 0, 293, 294, 5, 37, 0, 0, 294, 73, 1, 0, 0, 0, 295, 301, + 5, 34, 0, 0, 296, 297, 5, 92, 0, 0, 297, 300, 5, 34, 0, 0, 298, 300, 8, + 3, 0, 0, 299, 296, 1, 0, 0, 0, 299, 298, 1, 0, 0, 0, 300, 303, 1, 0, 0, + 0, 301, 299, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 304, 1, 0, 0, 0, 303, + 301, 1, 0, 0, 0, 304, 305, 5, 34, 0, 0, 305, 75, 1, 0, 0, 0, 306, 308, + 7, 4, 0, 0, 307, 306, 1, 0, 0, 0, 308, 309, 1, 0, 0, 0, 309, 307, 1, 0, + 0, 0, 309, 310, 1, 0, 0, 0, 310, 314, 1, 0, 0, 0, 311, 313, 7, 5, 0, 0, + 312, 311, 1, 0, 0, 0, 313, 316, 1, 0, 0, 0, 314, 312, 1, 0, 0, 0, 314, + 315, 1, 0, 0, 0, 315, 77, 1, 0, 0, 0, 316, 314, 1, 0, 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, 330, 1, 0, 0, 0, 322, 324, 5, 95, 0, 0, 323, + 325, 7, 2, 0, 0, 324, 323, 1, 0, 0, 0, 325, 326, 1, 0, 0, 0, 326, 324, + 1, 0, 0, 0, 326, 327, 1, 0, 0, 0, 327, 329, 1, 0, 0, 0, 328, 322, 1, 0, + 0, 0, 329, 332, 1, 0, 0, 0, 330, 328, 1, 0, 0, 0, 330, 331, 1, 0, 0, 0, + 331, 79, 1, 0, 0, 0, 332, 330, 1, 0, 0, 0, 333, 337, 7, 6, 0, 0, 334, 336, + 7, 7, 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, 346, 1, 0, 0, 0, 339, 337, 1, 0, 0, 0, + 340, 342, 5, 47, 0, 0, 341, 343, 7, 2, 0, 0, 342, 341, 1, 0, 0, 0, 343, + 344, 1, 0, 0, 0, 344, 342, 1, 0, 0, 0, 344, 345, 1, 0, 0, 0, 345, 347, + 1, 0, 0, 0, 346, 340, 1, 0, 0, 0, 346, 347, 1, 0, 0, 0, 347, 81, 1, 0, + 0, 0, 348, 349, 5, 64, 0, 0, 349, 350, 1, 0, 0, 0, 350, 351, 6, 40, 2, + 0, 351, 83, 1, 0, 0, 0, 352, 353, 5, 58, 0, 0, 353, 354, 1, 0, 0, 0, 354, + 355, 6, 41, 2, 0, 355, 85, 1, 0, 0, 0, 356, 358, 5, 36, 0, 0, 357, 359, + 7, 5, 0, 0, 358, 357, 1, 0, 0, 0, 359, 360, 1, 0, 0, 0, 360, 358, 1, 0, + 0, 0, 360, 361, 1, 0, 0, 0, 361, 365, 1, 0, 0, 0, 362, 364, 7, 8, 0, 0, + 363, 362, 1, 0, 0, 0, 364, 367, 1, 0, 0, 0, 365, 363, 1, 0, 0, 0, 365, + 366, 1, 0, 0, 0, 366, 87, 1, 0, 0, 0, 367, 365, 1, 0, 0, 0, 368, 370, 7, + 9, 0, 0, 369, 368, 1, 0, 0, 0, 370, 371, 1, 0, 0, 0, 371, 369, 1, 0, 0, + 0, 371, 372, 1, 0, 0, 0, 372, 373, 1, 0, 0, 0, 373, 374, 6, 43, 3, 0, 374, + 89, 1, 0, 0, 0, 375, 376, 3, 86, 42, 0, 376, 377, 1, 0, 0, 0, 377, 378, + 6, 44, 3, 0, 378, 91, 1, 0, 0, 0, 379, 380, 3, 86, 42, 0, 380, 93, 1, 0, + 0, 0, 23, 0, 1, 97, 104, 111, 113, 127, 283, 289, 291, 299, 301, 309, 314, + 320, 326, 330, 337, 344, 346, 360, 365, 371, 4, 6, 0, 0, 0, 1, 0, 5, 1, + 0, 4, 0, 0, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -300,16 +312,19 @@ const ( LexerMINUS = 30 LexerDIV = 31 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 + LexerWITH = 33 + LexerSCALING = 34 + LexerTHROUGH = 35 + LexerPERCENTAGE_PORTION_LITERAL = 36 + LexerSTRING = 37 + LexerIDENTIFIER = 38 + LexerNUMBER = 39 + LexerASSET = 40 + LexerACCOUNT_START = 41 + LexerCOLON = 42 + LexerACCOUNT_TEXT = 43 + LexerVARIABLE_NAME_ACC = 44 + LexerVARIABLE_NAME = 45 ) // 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 47339927..63d12446 100644 --- a/internal/parser/antlrParser/numscript_base_listener.go +++ b/internal/parser/antlrParser/numscript_base_listener.go @@ -180,6 +180,12 @@ func (s *BaseNumscriptListener) EnterSrcAccountBoundedOverdraft(ctx *SrcAccountB func (s *BaseNumscriptListener) ExitSrcAccountBoundedOverdraft(ctx *SrcAccountBoundedOverdraftContext) { } +// EnterSrcAccountWithScaling is called when production srcAccountWithScaling is entered. +func (s *BaseNumscriptListener) EnterSrcAccountWithScaling(ctx *SrcAccountWithScalingContext) {} + +// ExitSrcAccountWithScaling is called when production srcAccountWithScaling is exited. +func (s *BaseNumscriptListener) ExitSrcAccountWithScaling(ctx *SrcAccountWithScalingContext) {} + // EnterSrcAccount is called when production srcAccount is entered. func (s *BaseNumscriptListener) EnterSrcAccount(ctx *SrcAccountContext) {} diff --git a/internal/parser/antlrParser/numscript_listener.go b/internal/parser/antlrParser/numscript_listener.go index 36a1fc48..d11eb3d0 100644 --- a/internal/parser/antlrParser/numscript_listener.go +++ b/internal/parser/antlrParser/numscript_listener.go @@ -85,6 +85,9 @@ type NumscriptListener interface { // EnterSrcAccountBoundedOverdraft is called when entering the srcAccountBoundedOverdraft production. EnterSrcAccountBoundedOverdraft(c *SrcAccountBoundedOverdraftContext) + // EnterSrcAccountWithScaling is called when entering the srcAccountWithScaling production. + EnterSrcAccountWithScaling(c *SrcAccountWithScalingContext) + // EnterSrcAccount is called when entering the srcAccount production. EnterSrcAccount(c *SrcAccountContext) @@ -220,6 +223,9 @@ type NumscriptListener interface { // ExitSrcAccountBoundedOverdraft is called when exiting the srcAccountBoundedOverdraft production. ExitSrcAccountBoundedOverdraft(c *SrcAccountBoundedOverdraftContext) + // ExitSrcAccountWithScaling is called when exiting the srcAccountWithScaling production. + ExitSrcAccountWithScaling(c *SrcAccountWithScalingContext) + // ExitSrcAccount is called when exiting the srcAccount production. ExitSrcAccount(c *SrcAccountContext) diff --git a/internal/parser/antlrParser/numscript_parser.go b/internal/parser/antlrParser/numscript_parser.go index 68477afd..cd8776ad 100644 --- a/internal/parser/antlrParser/numscript_parser.go +++ b/internal/parser/antlrParser/numscript_parser.go @@ -35,17 +35,17 @@ func numscriptParserInit() { "", "", "", "", "", "'vars'", "'max'", "'source'", "'destination'", "'send'", "'from'", "'up'", "'to'", "'remaining'", "'allowing'", "'unbounded'", "'overdraft'", "'oneof'", "'kept'", "'save'", "'('", "')'", "'['", "']'", - "'{'", "'}'", "','", "'='", "'*'", "'+'", "'-'", "'/'", "'\\'", "", - "", "", "", "", "'@'", "':'", + "'{'", "'}'", "','", "'='", "'*'", "'+'", "'-'", "'/'", "'\\'", "'with'", + "'scaling'", "'through'", "", "", "", "", "", "'@'", "':'", } 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", "RESTRICT", "PERCENTAGE_PORTION_LITERAL", "STRING", - "IDENTIFIER", "NUMBER", "ASSET", "ACCOUNT_START", "COLON", "ACCOUNT_TEXT", - "VARIABLE_NAME_ACC", "VARIABLE_NAME", + "MINUS", "DIV", "RESTRICT", "WITH", "SCALING", "THROUGH", "PERCENTAGE_PORTION_LITERAL", + "STRING", "IDENTIFIER", "NUMBER", "ASSET", "ACCOUNT_START", "COLON", + "ACCOUNT_TEXT", "VARIABLE_NAME_ACC", "VARIABLE_NAME", } staticData.RuleNames = []string{ "monetaryLit", "accountLiteralPart", "valueExpr", "functionCallArgs", @@ -56,7 +56,7 @@ func numscriptParserInit() { } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 1, 42, 269, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, + 4, 1, 45, 275, 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, @@ -71,110 +71,112 @@ func numscriptParserInit() { 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 3, 10, 137, 8, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 144, 8, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 152, 8, 12, 1, 12, 1, 12, 1, 12, - 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 162, 8, 12, 1, 12, 1, 12, 4, - 12, 166, 8, 12, 11, 12, 12, 12, 167, 1, 12, 1, 12, 1, 12, 1, 12, 5, 12, - 174, 8, 12, 10, 12, 12, 12, 177, 9, 12, 1, 12, 1, 12, 1, 12, 1, 12, 4, - 12, 183, 8, 12, 11, 12, 12, 12, 184, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, - 1, 12, 1, 12, 3, 12, 194, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, - 14, 1, 14, 3, 14, 203, 8, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, - 1, 16, 4, 16, 212, 8, 16, 11, 16, 12, 16, 213, 1, 16, 1, 16, 1, 16, 1, - 16, 5, 16, 220, 8, 16, 10, 16, 12, 16, 223, 9, 16, 1, 16, 1, 16, 1, 16, - 1, 16, 1, 16, 1, 16, 1, 16, 5, 16, 232, 8, 16, 10, 16, 12, 16, 235, 9, - 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 241, 8, 16, 1, 17, 1, 17, 1, 17, - 1, 18, 1, 18, 3, 18, 248, 8, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, + 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, + 12, 3, 12, 168, 8, 12, 1, 12, 1, 12, 4, 12, 172, 8, 12, 11, 12, 12, 12, + 173, 1, 12, 1, 12, 1, 12, 1, 12, 5, 12, 180, 8, 12, 10, 12, 12, 12, 183, + 9, 12, 1, 12, 1, 12, 1, 12, 1, 12, 4, 12, 189, 8, 12, 11, 12, 12, 12, 190, + 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 200, 8, 12, 1, + 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 3, 14, 209, 8, 14, 1, 15, + 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 4, 16, 218, 8, 16, 11, 16, 12, + 16, 219, 1, 16, 1, 16, 1, 16, 1, 16, 5, 16, 226, 8, 16, 10, 16, 12, 16, + 229, 9, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 5, 16, 238, + 8, 16, 10, 16, 12, 16, 241, 9, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 247, + 8, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 3, 18, 254, 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, 3, 19, 267, 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, 290, 0, 40, 1, 0, 0, 0, 2, 47, 1, 0, 0, 0, 4, 72, 1, - 0, 0, 0, 6, 85, 1, 0, 0, 0, 8, 93, 1, 0, 0, 0, 10, 100, 1, 0, 0, 0, 12, - 103, 1, 0, 0, 0, 14, 108, 1, 0, 0, 0, 16, 119, 1, 0, 0, 0, 18, 129, 1, - 0, 0, 0, 20, 136, 1, 0, 0, 0, 22, 138, 1, 0, 0, 0, 24, 193, 1, 0, 0, 0, - 26, 195, 1, 0, 0, 0, 28, 202, 1, 0, 0, 0, 30, 204, 1, 0, 0, 0, 32, 240, - 1, 0, 0, 0, 34, 242, 1, 0, 0, 0, 36, 247, 1, 0, 0, 0, 38, 266, 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, 73, 5, 42, 0, 0, 51, 73, 5, 37, 0, 0, 52, 73, 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, 73, 1, 0, 0, 0, 61, 59, 1, 0, 0, 0, 62, 73, 5, 36, - 0, 0, 63, 73, 5, 33, 0, 0, 64, 73, 3, 0, 0, 0, 65, 66, 5, 30, 0, 0, 66, - 73, 3, 4, 2, 5, 67, 68, 5, 20, 0, 0, 68, 69, 3, 4, 2, 0, 69, 70, 5, 21, - 0, 0, 70, 73, 1, 0, 0, 0, 71, 73, 3, 8, 4, 0, 72, 49, 1, 0, 0, 0, 72, 51, - 1, 0, 0, 0, 72, 52, 1, 0, 0, 0, 72, 53, 1, 0, 0, 0, 72, 62, 1, 0, 0, 0, - 72, 63, 1, 0, 0, 0, 72, 64, 1, 0, 0, 0, 72, 65, 1, 0, 0, 0, 72, 67, 1, - 0, 0, 0, 72, 71, 1, 0, 0, 0, 73, 82, 1, 0, 0, 0, 74, 75, 10, 4, 0, 0, 75, - 76, 5, 31, 0, 0, 76, 81, 3, 4, 2, 5, 77, 78, 10, 3, 0, 0, 78, 79, 7, 0, - 0, 0, 79, 81, 3, 4, 2, 4, 80, 74, 1, 0, 0, 0, 80, 77, 1, 0, 0, 0, 81, 84, - 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 5, 1, 0, 0, 0, - 84, 82, 1, 0, 0, 0, 85, 90, 3, 4, 2, 0, 86, 87, 5, 26, 0, 0, 87, 89, 3, - 4, 2, 0, 88, 86, 1, 0, 0, 0, 89, 92, 1, 0, 0, 0, 90, 88, 1, 0, 0, 0, 90, - 91, 1, 0, 0, 0, 91, 7, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, 93, 94, 7, 1, 0, - 0, 94, 96, 5, 20, 0, 0, 95, 97, 3, 6, 3, 0, 96, 95, 1, 0, 0, 0, 96, 97, - 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 99, 5, 21, 0, 0, 99, 9, 1, 0, 0, 0, - 100, 101, 5, 27, 0, 0, 101, 102, 3, 4, 2, 0, 102, 11, 1, 0, 0, 0, 103, - 104, 5, 35, 0, 0, 104, 106, 5, 42, 0, 0, 105, 107, 3, 10, 5, 0, 106, 105, - 1, 0, 0, 0, 106, 107, 1, 0, 0, 0, 107, 13, 1, 0, 0, 0, 108, 109, 5, 5, - 0, 0, 109, 113, 5, 24, 0, 0, 110, 112, 3, 12, 6, 0, 111, 110, 1, 0, 0, - 0, 112, 115, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, - 116, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 116, 117, 5, 25, 0, 0, 117, 15, - 1, 0, 0, 0, 118, 120, 3, 14, 7, 0, 119, 118, 1, 0, 0, 0, 119, 120, 1, 0, - 0, 0, 120, 124, 1, 0, 0, 0, 121, 123, 3, 38, 19, 0, 122, 121, 1, 0, 0, - 0, 123, 126, 1, 0, 0, 0, 124, 122, 1, 0, 0, 0, 124, 125, 1, 0, 0, 0, 125, - 127, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 127, 128, 5, 0, 0, 1, 128, 17, 1, - 0, 0, 0, 129, 130, 5, 22, 0, 0, 130, 131, 3, 4, 2, 0, 131, 132, 5, 28, - 0, 0, 132, 133, 5, 23, 0, 0, 133, 19, 1, 0, 0, 0, 134, 137, 3, 4, 2, 0, - 135, 137, 5, 13, 0, 0, 136, 134, 1, 0, 0, 0, 136, 135, 1, 0, 0, 0, 137, - 21, 1, 0, 0, 0, 138, 139, 5, 32, 0, 0, 139, 140, 3, 4, 2, 0, 140, 23, 1, - 0, 0, 0, 141, 143, 3, 4, 2, 0, 142, 144, 3, 22, 11, 0, 143, 142, 1, 0, - 0, 0, 143, 144, 1, 0, 0, 0, 144, 145, 1, 0, 0, 0, 145, 146, 5, 14, 0, 0, - 146, 147, 5, 15, 0, 0, 147, 148, 5, 16, 0, 0, 148, 194, 1, 0, 0, 0, 149, - 151, 3, 4, 2, 0, 150, 152, 3, 22, 11, 0, 151, 150, 1, 0, 0, 0, 151, 152, - 1, 0, 0, 0, 152, 153, 1, 0, 0, 0, 153, 154, 5, 14, 0, 0, 154, 155, 5, 16, - 0, 0, 155, 156, 5, 11, 0, 0, 156, 157, 5, 12, 0, 0, 157, 158, 3, 4, 2, - 0, 158, 194, 1, 0, 0, 0, 159, 161, 3, 4, 2, 0, 160, 162, 3, 22, 11, 0, - 161, 160, 1, 0, 0, 0, 161, 162, 1, 0, 0, 0, 162, 194, 1, 0, 0, 0, 163, - 165, 5, 24, 0, 0, 164, 166, 3, 26, 13, 0, 165, 164, 1, 0, 0, 0, 166, 167, - 1, 0, 0, 0, 167, 165, 1, 0, 0, 0, 167, 168, 1, 0, 0, 0, 168, 169, 1, 0, - 0, 0, 169, 170, 5, 25, 0, 0, 170, 194, 1, 0, 0, 0, 171, 175, 5, 24, 0, - 0, 172, 174, 3, 24, 12, 0, 173, 172, 1, 0, 0, 0, 174, 177, 1, 0, 0, 0, - 175, 173, 1, 0, 0, 0, 175, 176, 1, 0, 0, 0, 176, 178, 1, 0, 0, 0, 177, - 175, 1, 0, 0, 0, 178, 194, 5, 25, 0, 0, 179, 180, 5, 17, 0, 0, 180, 182, - 5, 24, 0, 0, 181, 183, 3, 24, 12, 0, 182, 181, 1, 0, 0, 0, 183, 184, 1, - 0, 0, 0, 184, 182, 1, 0, 0, 0, 184, 185, 1, 0, 0, 0, 185, 186, 1, 0, 0, - 0, 186, 187, 5, 25, 0, 0, 187, 194, 1, 0, 0, 0, 188, 189, 5, 6, 0, 0, 189, - 190, 3, 4, 2, 0, 190, 191, 5, 10, 0, 0, 191, 192, 3, 24, 12, 0, 192, 194, - 1, 0, 0, 0, 193, 141, 1, 0, 0, 0, 193, 149, 1, 0, 0, 0, 193, 159, 1, 0, - 0, 0, 193, 163, 1, 0, 0, 0, 193, 171, 1, 0, 0, 0, 193, 179, 1, 0, 0, 0, - 193, 188, 1, 0, 0, 0, 194, 25, 1, 0, 0, 0, 195, 196, 3, 20, 10, 0, 196, - 197, 5, 10, 0, 0, 197, 198, 3, 24, 12, 0, 198, 27, 1, 0, 0, 0, 199, 200, - 5, 12, 0, 0, 200, 203, 3, 32, 16, 0, 201, 203, 5, 18, 0, 0, 202, 199, 1, - 0, 0, 0, 202, 201, 1, 0, 0, 0, 203, 29, 1, 0, 0, 0, 204, 205, 5, 6, 0, - 0, 205, 206, 3, 4, 2, 0, 206, 207, 3, 28, 14, 0, 207, 31, 1, 0, 0, 0, 208, - 241, 3, 4, 2, 0, 209, 211, 5, 24, 0, 0, 210, 212, 3, 34, 17, 0, 211, 210, - 1, 0, 0, 0, 212, 213, 1, 0, 0, 0, 213, 211, 1, 0, 0, 0, 213, 214, 1, 0, - 0, 0, 214, 215, 1, 0, 0, 0, 215, 216, 5, 25, 0, 0, 216, 241, 1, 0, 0, 0, - 217, 221, 5, 24, 0, 0, 218, 220, 3, 30, 15, 0, 219, 218, 1, 0, 0, 0, 220, - 223, 1, 0, 0, 0, 221, 219, 1, 0, 0, 0, 221, 222, 1, 0, 0, 0, 222, 224, - 1, 0, 0, 0, 223, 221, 1, 0, 0, 0, 224, 225, 5, 13, 0, 0, 225, 226, 3, 28, - 14, 0, 226, 227, 5, 25, 0, 0, 227, 241, 1, 0, 0, 0, 228, 229, 5, 17, 0, - 0, 229, 233, 5, 24, 0, 0, 230, 232, 3, 30, 15, 0, 231, 230, 1, 0, 0, 0, - 232, 235, 1, 0, 0, 0, 233, 231, 1, 0, 0, 0, 233, 234, 1, 0, 0, 0, 234, - 236, 1, 0, 0, 0, 235, 233, 1, 0, 0, 0, 236, 237, 5, 13, 0, 0, 237, 238, - 3, 28, 14, 0, 238, 239, 5, 25, 0, 0, 239, 241, 1, 0, 0, 0, 240, 208, 1, - 0, 0, 0, 240, 209, 1, 0, 0, 0, 240, 217, 1, 0, 0, 0, 240, 228, 1, 0, 0, - 0, 241, 33, 1, 0, 0, 0, 242, 243, 3, 20, 10, 0, 243, 244, 3, 28, 14, 0, - 244, 35, 1, 0, 0, 0, 245, 248, 3, 4, 2, 0, 246, 248, 3, 18, 9, 0, 247, - 245, 1, 0, 0, 0, 247, 246, 1, 0, 0, 0, 248, 37, 1, 0, 0, 0, 249, 250, 5, - 9, 0, 0, 250, 251, 3, 36, 18, 0, 251, 252, 5, 20, 0, 0, 252, 253, 5, 7, - 0, 0, 253, 254, 5, 27, 0, 0, 254, 255, 3, 24, 12, 0, 255, 256, 5, 8, 0, - 0, 256, 257, 5, 27, 0, 0, 257, 258, 3, 32, 16, 0, 258, 259, 5, 21, 0, 0, - 259, 267, 1, 0, 0, 0, 260, 261, 5, 19, 0, 0, 261, 262, 3, 36, 18, 0, 262, - 263, 5, 10, 0, 0, 263, 264, 3, 4, 2, 0, 264, 267, 1, 0, 0, 0, 265, 267, - 3, 8, 4, 0, 266, 249, 1, 0, 0, 0, 266, 260, 1, 0, 0, 0, 266, 265, 1, 0, - 0, 0, 267, 39, 1, 0, 0, 0, 26, 47, 59, 72, 80, 82, 90, 96, 106, 113, 119, - 124, 136, 143, 151, 161, 167, 175, 184, 193, 202, 213, 221, 233, 240, 247, - 266, + 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 3, 19, 273, 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, 38, 38, 297, 0, 40, 1, 0, 0, 0, 2, + 47, 1, 0, 0, 0, 4, 72, 1, 0, 0, 0, 6, 85, 1, 0, 0, 0, 8, 93, 1, 0, 0, 0, + 10, 100, 1, 0, 0, 0, 12, 103, 1, 0, 0, 0, 14, 108, 1, 0, 0, 0, 16, 119, + 1, 0, 0, 0, 18, 129, 1, 0, 0, 0, 20, 136, 1, 0, 0, 0, 22, 138, 1, 0, 0, + 0, 24, 199, 1, 0, 0, 0, 26, 201, 1, 0, 0, 0, 28, 208, 1, 0, 0, 0, 30, 210, + 1, 0, 0, 0, 32, 246, 1, 0, 0, 0, 34, 248, 1, 0, 0, 0, 36, 253, 1, 0, 0, + 0, 38, 272, 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, 43, 0, 0, + 46, 48, 5, 44, 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, 73, 5, 45, 0, 0, 51, 73, 5, 40, 0, 0, + 52, 73, 5, 37, 0, 0, 53, 54, 5, 41, 0, 0, 54, 59, 3, 2, 1, 0, 55, 56, 5, + 42, 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, 73, 1, 0, 0, 0, 61, 59, 1, 0, 0, + 0, 62, 73, 5, 39, 0, 0, 63, 73, 5, 36, 0, 0, 64, 73, 3, 0, 0, 0, 65, 66, + 5, 30, 0, 0, 66, 73, 3, 4, 2, 5, 67, 68, 5, 20, 0, 0, 68, 69, 3, 4, 2, + 0, 69, 70, 5, 21, 0, 0, 70, 73, 1, 0, 0, 0, 71, 73, 3, 8, 4, 0, 72, 49, + 1, 0, 0, 0, 72, 51, 1, 0, 0, 0, 72, 52, 1, 0, 0, 0, 72, 53, 1, 0, 0, 0, + 72, 62, 1, 0, 0, 0, 72, 63, 1, 0, 0, 0, 72, 64, 1, 0, 0, 0, 72, 65, 1, + 0, 0, 0, 72, 67, 1, 0, 0, 0, 72, 71, 1, 0, 0, 0, 73, 82, 1, 0, 0, 0, 74, + 75, 10, 4, 0, 0, 75, 76, 5, 31, 0, 0, 76, 81, 3, 4, 2, 5, 77, 78, 10, 3, + 0, 0, 78, 79, 7, 0, 0, 0, 79, 81, 3, 4, 2, 4, 80, 74, 1, 0, 0, 0, 80, 77, + 1, 0, 0, 0, 81, 84, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, + 83, 5, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 85, 90, 3, 4, 2, 0, 86, 87, 5, 26, + 0, 0, 87, 89, 3, 4, 2, 0, 88, 86, 1, 0, 0, 0, 89, 92, 1, 0, 0, 0, 90, 88, + 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 7, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, + 93, 94, 7, 1, 0, 0, 94, 96, 5, 20, 0, 0, 95, 97, 3, 6, 3, 0, 96, 95, 1, + 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 99, 5, 21, 0, 0, 99, + 9, 1, 0, 0, 0, 100, 101, 5, 27, 0, 0, 101, 102, 3, 4, 2, 0, 102, 11, 1, + 0, 0, 0, 103, 104, 5, 38, 0, 0, 104, 106, 5, 45, 0, 0, 105, 107, 3, 10, + 5, 0, 106, 105, 1, 0, 0, 0, 106, 107, 1, 0, 0, 0, 107, 13, 1, 0, 0, 0, + 108, 109, 5, 5, 0, 0, 109, 113, 5, 24, 0, 0, 110, 112, 3, 12, 6, 0, 111, + 110, 1, 0, 0, 0, 112, 115, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 113, 114, + 1, 0, 0, 0, 114, 116, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 116, 117, 5, 25, + 0, 0, 117, 15, 1, 0, 0, 0, 118, 120, 3, 14, 7, 0, 119, 118, 1, 0, 0, 0, + 119, 120, 1, 0, 0, 0, 120, 124, 1, 0, 0, 0, 121, 123, 3, 38, 19, 0, 122, + 121, 1, 0, 0, 0, 123, 126, 1, 0, 0, 0, 124, 122, 1, 0, 0, 0, 124, 125, + 1, 0, 0, 0, 125, 127, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 127, 128, 5, 0, + 0, 1, 128, 17, 1, 0, 0, 0, 129, 130, 5, 22, 0, 0, 130, 131, 3, 4, 2, 0, + 131, 132, 5, 28, 0, 0, 132, 133, 5, 23, 0, 0, 133, 19, 1, 0, 0, 0, 134, + 137, 3, 4, 2, 0, 135, 137, 5, 13, 0, 0, 136, 134, 1, 0, 0, 0, 136, 135, + 1, 0, 0, 0, 137, 21, 1, 0, 0, 0, 138, 139, 5, 32, 0, 0, 139, 140, 3, 4, + 2, 0, 140, 23, 1, 0, 0, 0, 141, 143, 3, 4, 2, 0, 142, 144, 3, 22, 11, 0, + 143, 142, 1, 0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 145, 1, 0, 0, 0, 145, + 146, 5, 14, 0, 0, 146, 147, 5, 15, 0, 0, 147, 148, 5, 16, 0, 0, 148, 200, + 1, 0, 0, 0, 149, 151, 3, 4, 2, 0, 150, 152, 3, 22, 11, 0, 151, 150, 1, + 0, 0, 0, 151, 152, 1, 0, 0, 0, 152, 153, 1, 0, 0, 0, 153, 154, 5, 14, 0, + 0, 154, 155, 5, 16, 0, 0, 155, 156, 5, 11, 0, 0, 156, 157, 5, 12, 0, 0, + 157, 158, 3, 4, 2, 0, 158, 200, 1, 0, 0, 0, 159, 160, 3, 4, 2, 0, 160, + 161, 5, 33, 0, 0, 161, 162, 5, 34, 0, 0, 162, 163, 5, 35, 0, 0, 163, 164, + 3, 4, 2, 0, 164, 200, 1, 0, 0, 0, 165, 167, 3, 4, 2, 0, 166, 168, 3, 22, + 11, 0, 167, 166, 1, 0, 0, 0, 167, 168, 1, 0, 0, 0, 168, 200, 1, 0, 0, 0, + 169, 171, 5, 24, 0, 0, 170, 172, 3, 26, 13, 0, 171, 170, 1, 0, 0, 0, 172, + 173, 1, 0, 0, 0, 173, 171, 1, 0, 0, 0, 173, 174, 1, 0, 0, 0, 174, 175, + 1, 0, 0, 0, 175, 176, 5, 25, 0, 0, 176, 200, 1, 0, 0, 0, 177, 181, 5, 24, + 0, 0, 178, 180, 3, 24, 12, 0, 179, 178, 1, 0, 0, 0, 180, 183, 1, 0, 0, + 0, 181, 179, 1, 0, 0, 0, 181, 182, 1, 0, 0, 0, 182, 184, 1, 0, 0, 0, 183, + 181, 1, 0, 0, 0, 184, 200, 5, 25, 0, 0, 185, 186, 5, 17, 0, 0, 186, 188, + 5, 24, 0, 0, 187, 189, 3, 24, 12, 0, 188, 187, 1, 0, 0, 0, 189, 190, 1, + 0, 0, 0, 190, 188, 1, 0, 0, 0, 190, 191, 1, 0, 0, 0, 191, 192, 1, 0, 0, + 0, 192, 193, 5, 25, 0, 0, 193, 200, 1, 0, 0, 0, 194, 195, 5, 6, 0, 0, 195, + 196, 3, 4, 2, 0, 196, 197, 5, 10, 0, 0, 197, 198, 3, 24, 12, 0, 198, 200, + 1, 0, 0, 0, 199, 141, 1, 0, 0, 0, 199, 149, 1, 0, 0, 0, 199, 159, 1, 0, + 0, 0, 199, 165, 1, 0, 0, 0, 199, 169, 1, 0, 0, 0, 199, 177, 1, 0, 0, 0, + 199, 185, 1, 0, 0, 0, 199, 194, 1, 0, 0, 0, 200, 25, 1, 0, 0, 0, 201, 202, + 3, 20, 10, 0, 202, 203, 5, 10, 0, 0, 203, 204, 3, 24, 12, 0, 204, 27, 1, + 0, 0, 0, 205, 206, 5, 12, 0, 0, 206, 209, 3, 32, 16, 0, 207, 209, 5, 18, + 0, 0, 208, 205, 1, 0, 0, 0, 208, 207, 1, 0, 0, 0, 209, 29, 1, 0, 0, 0, + 210, 211, 5, 6, 0, 0, 211, 212, 3, 4, 2, 0, 212, 213, 3, 28, 14, 0, 213, + 31, 1, 0, 0, 0, 214, 247, 3, 4, 2, 0, 215, 217, 5, 24, 0, 0, 216, 218, + 3, 34, 17, 0, 217, 216, 1, 0, 0, 0, 218, 219, 1, 0, 0, 0, 219, 217, 1, + 0, 0, 0, 219, 220, 1, 0, 0, 0, 220, 221, 1, 0, 0, 0, 221, 222, 5, 25, 0, + 0, 222, 247, 1, 0, 0, 0, 223, 227, 5, 24, 0, 0, 224, 226, 3, 30, 15, 0, + 225, 224, 1, 0, 0, 0, 226, 229, 1, 0, 0, 0, 227, 225, 1, 0, 0, 0, 227, + 228, 1, 0, 0, 0, 228, 230, 1, 0, 0, 0, 229, 227, 1, 0, 0, 0, 230, 231, + 5, 13, 0, 0, 231, 232, 3, 28, 14, 0, 232, 233, 5, 25, 0, 0, 233, 247, 1, + 0, 0, 0, 234, 235, 5, 17, 0, 0, 235, 239, 5, 24, 0, 0, 236, 238, 3, 30, + 15, 0, 237, 236, 1, 0, 0, 0, 238, 241, 1, 0, 0, 0, 239, 237, 1, 0, 0, 0, + 239, 240, 1, 0, 0, 0, 240, 242, 1, 0, 0, 0, 241, 239, 1, 0, 0, 0, 242, + 243, 5, 13, 0, 0, 243, 244, 3, 28, 14, 0, 244, 245, 5, 25, 0, 0, 245, 247, + 1, 0, 0, 0, 246, 214, 1, 0, 0, 0, 246, 215, 1, 0, 0, 0, 246, 223, 1, 0, + 0, 0, 246, 234, 1, 0, 0, 0, 247, 33, 1, 0, 0, 0, 248, 249, 3, 20, 10, 0, + 249, 250, 3, 28, 14, 0, 250, 35, 1, 0, 0, 0, 251, 254, 3, 4, 2, 0, 252, + 254, 3, 18, 9, 0, 253, 251, 1, 0, 0, 0, 253, 252, 1, 0, 0, 0, 254, 37, + 1, 0, 0, 0, 255, 256, 5, 9, 0, 0, 256, 257, 3, 36, 18, 0, 257, 258, 5, + 20, 0, 0, 258, 259, 5, 7, 0, 0, 259, 260, 5, 27, 0, 0, 260, 261, 3, 24, + 12, 0, 261, 262, 5, 8, 0, 0, 262, 263, 5, 27, 0, 0, 263, 264, 3, 32, 16, + 0, 264, 265, 5, 21, 0, 0, 265, 273, 1, 0, 0, 0, 266, 267, 5, 19, 0, 0, + 267, 268, 3, 36, 18, 0, 268, 269, 5, 10, 0, 0, 269, 270, 3, 4, 2, 0, 270, + 273, 1, 0, 0, 0, 271, 273, 3, 8, 4, 0, 272, 255, 1, 0, 0, 0, 272, 266, + 1, 0, 0, 0, 272, 271, 1, 0, 0, 0, 273, 39, 1, 0, 0, 0, 26, 47, 59, 72, + 80, 82, 90, 96, 106, 113, 119, 124, 136, 143, 151, 167, 173, 181, 190, + 199, 208, 219, 227, 239, 246, 253, 272, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -245,16 +247,19 @@ const ( NumscriptParserMINUS = 30 NumscriptParserDIV = 31 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 + NumscriptParserWITH = 33 + NumscriptParserSCALING = 34 + NumscriptParserTHROUGH = 35 + NumscriptParserPERCENTAGE_PORTION_LITERAL = 36 + NumscriptParserSTRING = 37 + NumscriptParserIDENTIFIER = 38 + NumscriptParserNUMBER = 39 + NumscriptParserASSET = 40 + NumscriptParserACCOUNT_START = 41 + NumscriptParserCOLON = 42 + NumscriptParserACCOUNT_TEXT = 43 + NumscriptParserVARIABLE_NAME_ACC = 44 + NumscriptParserVARIABLE_NAME = 45 ) // NumscriptParser rules. @@ -1903,7 +1908,7 @@ func (p *NumscriptParser) FunctionCall() (localctx IFunctionCallContext) { } _la = p.GetTokenStream().LA(1) - if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&4940291440640) != 0 { + if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&39514778173440) != 0 { { p.SetState(95) p.FunctionCallArgs() @@ -2563,7 +2568,7 @@ func (p *NumscriptParser) Program() (localctx IProgramContext) { } _la = p.GetTokenStream().LA(1) - for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&34360328704) != 0 { + for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&274878497280) != 0 { { p.SetState(121) p.Statement() @@ -3385,6 +3390,99 @@ func (s *SrcAccountUnboundedOverdraftContext) ExitRule(listener antlr.ParseTreeL } } +type SrcAccountWithScalingContext struct { + SourceContext + address IValueExprContext + swap IValueExprContext +} + +func NewSrcAccountWithScalingContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *SrcAccountWithScalingContext { + var p = new(SrcAccountWithScalingContext) + + InitEmptySourceContext(&p.SourceContext) + p.parser = parser + p.CopyAll(ctx.(*SourceContext)) + + return p +} + +func (s *SrcAccountWithScalingContext) GetAddress() IValueExprContext { return s.address } + +func (s *SrcAccountWithScalingContext) GetSwap() IValueExprContext { return s.swap } + +func (s *SrcAccountWithScalingContext) SetAddress(v IValueExprContext) { s.address = v } + +func (s *SrcAccountWithScalingContext) SetSwap(v IValueExprContext) { s.swap = v } + +func (s *SrcAccountWithScalingContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *SrcAccountWithScalingContext) WITH() antlr.TerminalNode { + return s.GetToken(NumscriptParserWITH, 0) +} + +func (s *SrcAccountWithScalingContext) SCALING() antlr.TerminalNode { + return s.GetToken(NumscriptParserSCALING, 0) +} + +func (s *SrcAccountWithScalingContext) THROUGH() antlr.TerminalNode { + return s.GetToken(NumscriptParserTHROUGH, 0) +} + +func (s *SrcAccountWithScalingContext) AllValueExpr() []IValueExprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IValueExprContext); ok { + len++ + } + } + + tst := make([]IValueExprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IValueExprContext); ok { + tst[i] = t.(IValueExprContext) + i++ + } + } + + return tst +} + +func (s *SrcAccountWithScalingContext) ValueExpr(i int) IValueExprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IValueExprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IValueExprContext) +} + +func (s *SrcAccountWithScalingContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(NumscriptListener); ok { + listenerT.EnterSrcAccountWithScaling(s) + } +} + +func (s *SrcAccountWithScalingContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(NumscriptListener); ok { + listenerT.ExitSrcAccountWithScaling(s) + } +} + type SrcAllotmentContext struct { SourceContext } @@ -3685,7 +3783,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { p.EnterRule(localctx, 24, NumscriptParserRULE_source) var _la int - p.SetState(193) + p.SetState(199) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3806,13 +3904,55 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } case 3: - localctx = NewSrcAccountContext(p, localctx) + localctx = NewSrcAccountWithScalingContext(p, localctx) p.EnterOuterAlt(localctx, 3) { p.SetState(159) + + var _x = p.valueExpr(0) + + localctx.(*SrcAccountWithScalingContext).address = _x + } + { + p.SetState(160) + p.Match(NumscriptParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(161) + p.Match(NumscriptParserSCALING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(162) + p.Match(NumscriptParserTHROUGH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(163) + + var _x = p.valueExpr(0) + + localctx.(*SrcAccountWithScalingContext).swap = _x + } + + case 4: + localctx = NewSrcAccountContext(p, localctx) + p.EnterOuterAlt(localctx, 4) + { + p.SetState(165) p.valueExpr(0) } - p.SetState(161) + p.SetState(167) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3821,37 +3961,37 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { if _la == NumscriptParserRESTRICT { { - p.SetState(160) + p.SetState(166) p.ColorConstraint() } } - case 4: + case 5: localctx = NewSrcAllotmentContext(p, localctx) - p.EnterOuterAlt(localctx, 4) + p.EnterOuterAlt(localctx, 5) { - p.SetState(163) + p.SetState(169) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(165) + p.SetState(171) 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)&4940291448832) != 0) { + for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&39514778181632) != 0) { { - p.SetState(164) + p.SetState(170) p.AllotmentClauseSrc() } - p.SetState(167) + p.SetState(173) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3859,7 +3999,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(169) + p.SetState(175) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -3867,31 +4007,31 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } - case 5: + case 6: localctx = NewSrcInorderContext(p, localctx) - p.EnterOuterAlt(localctx, 5) + p.EnterOuterAlt(localctx, 6) { - p.SetState(171) + p.SetState(177) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(175) + p.SetState(181) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&4940308348992) != 0 { + for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&39514795081792) != 0 { { - p.SetState(172) + p.SetState(178) p.Source() } - p.SetState(177) + p.SetState(183) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3899,7 +4039,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(178) + p.SetState(184) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -3907,11 +4047,11 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } - case 6: + case 7: localctx = NewSrcOneofContext(p, localctx) - p.EnterOuterAlt(localctx, 6) + p.EnterOuterAlt(localctx, 7) { - p.SetState(179) + p.SetState(185) p.Match(NumscriptParserONEOF) if p.HasError() { // Recognition error - abort rule @@ -3919,27 +4059,27 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(180) + p.SetState(186) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(182) + p.SetState(188) 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)&4940308348992) != 0) { + for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&39514795081792) != 0) { { - p.SetState(181) + p.SetState(187) p.Source() } - p.SetState(184) + p.SetState(190) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3947,7 +4087,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(186) + p.SetState(192) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -3955,11 +4095,11 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } - case 7: + case 8: localctx = NewSrcCappedContext(p, localctx) - p.EnterOuterAlt(localctx, 7) + p.EnterOuterAlt(localctx, 8) { - p.SetState(188) + p.SetState(194) p.Match(NumscriptParserMAX) if p.HasError() { // Recognition error - abort rule @@ -3967,14 +4107,14 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(189) + p.SetState(195) var _x = p.valueExpr(0) localctx.(*SrcCappedContext).cap_ = _x } { - p.SetState(190) + p.SetState(196) p.Match(NumscriptParserFROM) if p.HasError() { // Recognition error - abort rule @@ -3982,7 +4122,7 @@ func (p *NumscriptParser) Source() (localctx ISourceContext) { } } { - p.SetState(191) + p.SetState(197) p.Source() } @@ -4112,11 +4252,11 @@ func (p *NumscriptParser) AllotmentClauseSrc() (localctx IAllotmentClauseSrcCont p.EnterRule(localctx, 26, NumscriptParserRULE_allotmentClauseSrc) p.EnterOuterAlt(localctx, 1) { - p.SetState(195) + p.SetState(201) p.Allotment() } { - p.SetState(196) + p.SetState(202) p.Match(NumscriptParserFROM) if p.HasError() { // Recognition error - abort rule @@ -4124,7 +4264,7 @@ func (p *NumscriptParser) AllotmentClauseSrc() (localctx IAllotmentClauseSrcCont } } { - p.SetState(197) + p.SetState(203) p.Source() } @@ -4282,7 +4422,7 @@ func (s *DestinationToContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) KeptOrDestination() (localctx IKeptOrDestinationContext) { localctx = NewKeptOrDestinationContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 28, NumscriptParserRULE_keptOrDestination) - p.SetState(202) + p.SetState(208) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4293,7 +4433,7 @@ func (p *NumscriptParser) KeptOrDestination() (localctx IKeptOrDestinationContex localctx = NewDestinationToContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(199) + p.SetState(205) p.Match(NumscriptParserTO) if p.HasError() { // Recognition error - abort rule @@ -4301,7 +4441,7 @@ func (p *NumscriptParser) KeptOrDestination() (localctx IKeptOrDestinationContex } } { - p.SetState(200) + p.SetState(206) p.Destination() } @@ -4309,7 +4449,7 @@ func (p *NumscriptParser) KeptOrDestination() (localctx IKeptOrDestinationContex localctx = NewDestinationKeptContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(201) + p.SetState(207) p.Match(NumscriptParserKEPT) if p.HasError() { // Recognition error - abort rule @@ -4444,7 +4584,7 @@ func (p *NumscriptParser) DestinationInOrderClause() (localctx IDestinationInOrd p.EnterRule(localctx, 30, NumscriptParserRULE_destinationInOrderClause) p.EnterOuterAlt(localctx, 1) { - p.SetState(204) + p.SetState(210) p.Match(NumscriptParserMAX) if p.HasError() { // Recognition error - abort rule @@ -4452,11 +4592,11 @@ func (p *NumscriptParser) DestinationInOrderClause() (localctx IDestinationInOrd } } { - p.SetState(205) + p.SetState(211) p.valueExpr(0) } { - p.SetState(206) + p.SetState(212) p.KeptOrDestination() } @@ -4859,7 +4999,7 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { p.EnterRule(localctx, 32, NumscriptParserRULE_destination) var _la int - p.SetState(240) + p.SetState(246) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4870,7 +5010,7 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { localctx = NewDestAccountContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(208) + p.SetState(214) p.valueExpr(0) } @@ -4878,27 +5018,27 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { localctx = NewDestAllotmentContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(209) + p.SetState(215) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(211) + p.SetState(217) 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)&4940291448832) != 0) { + for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&39514778181632) != 0) { { - p.SetState(210) + p.SetState(216) p.AllotmentClauseDest() } - p.SetState(213) + p.SetState(219) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4906,7 +5046,7 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(215) + p.SetState(221) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -4918,14 +5058,14 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { localctx = NewDestInorderContext(p, localctx) p.EnterOuterAlt(localctx, 3) { - p.SetState(217) + p.SetState(223) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(221) + p.SetState(227) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4934,11 +5074,11 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { for _la == NumscriptParserMAX { { - p.SetState(218) + p.SetState(224) p.DestinationInOrderClause() } - p.SetState(223) + p.SetState(229) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4946,7 +5086,7 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(224) + p.SetState(230) p.Match(NumscriptParserREMAINING) if p.HasError() { // Recognition error - abort rule @@ -4954,11 +5094,11 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { } } { - p.SetState(225) + p.SetState(231) p.KeptOrDestination() } { - p.SetState(226) + p.SetState(232) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -4970,7 +5110,7 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { localctx = NewDestOneofContext(p, localctx) p.EnterOuterAlt(localctx, 4) { - p.SetState(228) + p.SetState(234) p.Match(NumscriptParserONEOF) if p.HasError() { // Recognition error - abort rule @@ -4978,14 +5118,14 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { } } { - p.SetState(229) + p.SetState(235) p.Match(NumscriptParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(233) + p.SetState(239) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4994,11 +5134,11 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { for _la == NumscriptParserMAX { { - p.SetState(230) + p.SetState(236) p.DestinationInOrderClause() } - p.SetState(235) + p.SetState(241) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -5006,7 +5146,7 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(236) + p.SetState(242) p.Match(NumscriptParserREMAINING) if p.HasError() { // Recognition error - abort rule @@ -5014,11 +5154,11 @@ func (p *NumscriptParser) Destination() (localctx IDestinationContext) { } } { - p.SetState(237) + p.SetState(243) p.KeptOrDestination() } { - p.SetState(238) + p.SetState(244) p.Match(NumscriptParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -5147,11 +5287,11 @@ func (p *NumscriptParser) AllotmentClauseDest() (localctx IAllotmentClauseDestCo p.EnterRule(localctx, 34, NumscriptParserRULE_allotmentClauseDest) p.EnterOuterAlt(localctx, 1) { - p.SetState(242) + p.SetState(248) p.Allotment() } { - p.SetState(243) + p.SetState(249) p.KeptOrDestination() } @@ -5317,7 +5457,7 @@ func (s *SentLiteralContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) SentValue() (localctx ISentValueContext) { localctx = NewSentValueContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 36, NumscriptParserRULE_sentValue) - p.SetState(247) + p.SetState(253) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -5328,7 +5468,7 @@ func (p *NumscriptParser) SentValue() (localctx ISentValueContext) { localctx = NewSentLiteralContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(245) + p.SetState(251) p.valueExpr(0) } @@ -5336,7 +5476,7 @@ func (p *NumscriptParser) SentValue() (localctx ISentValueContext) { localctx = NewSentAllContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(246) + p.SetState(252) p.SentAllLit() } @@ -5636,7 +5776,7 @@ func (s *FnCallStatementContext) ExitRule(listener antlr.ParseTreeListener) { func (p *NumscriptParser) Statement() (localctx IStatementContext) { localctx = NewStatementContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 38, NumscriptParserRULE_statement) - p.SetState(266) + p.SetState(272) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -5647,7 +5787,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { localctx = NewSendStatementContext(p, localctx) p.EnterOuterAlt(localctx, 1) { - p.SetState(249) + p.SetState(255) p.Match(NumscriptParserSEND) if p.HasError() { // Recognition error - abort rule @@ -5655,11 +5795,11 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(250) + p.SetState(256) p.SentValue() } { - p.SetState(251) + p.SetState(257) p.Match(NumscriptParserLPARENS) if p.HasError() { // Recognition error - abort rule @@ -5667,7 +5807,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(252) + p.SetState(258) p.Match(NumscriptParserSOURCE) if p.HasError() { // Recognition error - abort rule @@ -5675,7 +5815,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(253) + p.SetState(259) p.Match(NumscriptParserEQ) if p.HasError() { // Recognition error - abort rule @@ -5683,11 +5823,11 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(254) + p.SetState(260) p.Source() } { - p.SetState(255) + p.SetState(261) p.Match(NumscriptParserDESTINATION) if p.HasError() { // Recognition error - abort rule @@ -5695,7 +5835,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(256) + p.SetState(262) p.Match(NumscriptParserEQ) if p.HasError() { // Recognition error - abort rule @@ -5703,11 +5843,11 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(257) + p.SetState(263) p.Destination() } { - p.SetState(258) + p.SetState(264) p.Match(NumscriptParserRPARENS) if p.HasError() { // Recognition error - abort rule @@ -5719,7 +5859,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { localctx = NewSaveStatementContext(p, localctx) p.EnterOuterAlt(localctx, 2) { - p.SetState(260) + p.SetState(266) p.Match(NumscriptParserSAVE) if p.HasError() { // Recognition error - abort rule @@ -5727,11 +5867,11 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(261) + p.SetState(267) p.SentValue() } { - p.SetState(262) + p.SetState(268) p.Match(NumscriptParserFROM) if p.HasError() { // Recognition error - abort rule @@ -5739,7 +5879,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { } } { - p.SetState(263) + p.SetState(269) p.valueExpr(0) } @@ -5747,7 +5887,7 @@ func (p *NumscriptParser) Statement() (localctx IStatementContext) { localctx = NewFnCallStatementContext(p, localctx) p.EnterOuterAlt(localctx, 3) { - p.SetState(265) + p.SetState(271) p.FunctionCall() } diff --git a/internal/parser/ast.go b/internal/parser/ast.go index 8ce0911c..79923fb7 100644 --- a/internal/parser/ast.go +++ b/internal/parser/ast.go @@ -137,12 +137,13 @@ type Source interface { GetRange() Range } -func (*SourceInorder) source() {} -func (*SourceOneof) source() {} -func (*SourceAllotment) source() {} -func (*SourceAccount) source() {} -func (*SourceCapped) source() {} -func (*SourceOverdraft) source() {} +func (*SourceInorder) source() {} +func (*SourceOneof) source() {} +func (*SourceAllotment) source() {} +func (*SourceAccount) source() {} +func (*SourceCapped) source() {} +func (*SourceOverdraft) source() {} +func (*SourceWithScaling) source() {} type ( SourceAccount struct { @@ -183,6 +184,13 @@ type ( Address ValueExpr Bounded *ValueExpr } + + SourceWithScaling struct { + Range + Color ValueExpr + Address ValueExpr + Through ValueExpr + } ) type AllotmentValue interface{ allotmentValue() } diff --git a/internal/parser/parser.go b/internal/parser/parser.go index 0b165004..f399a81c 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -237,6 +237,13 @@ func parseSource(sourceCtx antlrParser.ISourceContext) Source { Address: parseValueExpr(sourceCtx.GetAddress()), } + case *antlrParser.SrcAccountWithScalingContext: + return &SourceWithScaling{ + Range: ctxToRange(sourceCtx), + Address: parseValueExpr(sourceCtx.GetAddress()), + Through: parseValueExpr(sourceCtx.GetSwap()), + } + case *antlrParser.SrcAccountBoundedOverdraftContext: varMon := parseValueExpr(sourceCtx.GetMaxOvedraft()) diff --git a/internal/parser/parser_test.go b/internal/parser/parser_test.go index 3b70400e..97d67161 100644 --- a/internal/parser/parser_test.go +++ b/internal/parser/parser_test.go @@ -501,3 +501,12 @@ func TestColorRestrictionUnboundedOverdraft(t *testing.T) { snaps.MatchSnapshot(t, p.Value) assert.Empty(t, p.Errors) } + +func TestScalingSyntax(t *testing.T) { + p := parser.Parse(`send $sent ( + source = @src with scaling through @swap + destination = @dest +)`) + snaps.MatchSnapshot(t, p.Value) + assert.Empty(t, p.Errors) +}