Skip to content

Commit

Permalink
WIP temp
Browse files Browse the repository at this point in the history
  • Loading branch information
ascandone committed Feb 6, 2025
1 parent ae202e9 commit 1763302
Show file tree
Hide file tree
Showing 14 changed files with 827 additions and 975 deletions.
13 changes: 4 additions & 9 deletions Numscript.g4
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ EQ: '=';
STAR: '*';
MINUS: '-';

RATIO_PORTION_LITERAL: [0-9]+ [ ]? '/' [ ]? [0-9]+;
PERCENTAGE_PORTION_LITERAL: [0-9]+ ('.' [0-9]+)? '%';

STRING: '"' ('\\"' | ~[\r\n"])* '"';
Expand All @@ -45,18 +44,15 @@ ASSET: [A-Z/0-9]+;
monetaryLit:
LBRACKET (asset = valueExpr) (amt = valueExpr) RBRACKET;
portion:
RATIO_PORTION_LITERAL # ratio
| PERCENTAGE_PORTION_LITERAL # percentage;
valueExpr:
VARIABLE_NAME # variableExpr
| ASSET # assetLiteral
| STRING # stringLiteral
| ACCOUNT # accountLiteral
| NUMBER # numberLiteral
| PERCENTAGE_PORTION_LITERAL # percentagePortionLiteral
| monetaryLit # monetaryLiteral
| portion # portionLiteral
| left = valueExpr op = '/' right = valueExpr # infixExpr
| left = valueExpr op = ('+' | '-') right = valueExpr # infixExpr;
functionCallArgs: valueExpr ( COMMA valueExpr)*;
Expand All @@ -73,9 +69,8 @@ program: varsDeclaration? statement* EOF;
sentAllLit: LBRACKET (asset = valueExpr) STAR RBRACKET;
allotment:
portion # portionedAllotment
| VARIABLE_NAME # portionVariable
| REMAINING # remainingAllotment;
valueExpr # portionedAllotment
| REMAINING # remainingAllotment;
source:
address = valueExpr ALLOWING UNBOUNDED OVERDRAFT # srcAccountUnboundedOverdraft
Expand Down
33 changes: 26 additions & 7 deletions internal/analysis/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ func (res *CheckResult) checkExpression(lit parser.ValueExpr, requiredType strin
res.checkExpression(lit.Amount, TypeNumber)
case *parser.AccountLiteral:
res.assertHasType(lit, requiredType, TypeAccount)
case *parser.RatioLiteral:
case *parser.PortionLiteral:
res.assertHasType(lit, requiredType, TypePortion)
case *parser.AssetLiteral:
res.assertHasType(lit, requiredType, TypeAsset)
Expand Down Expand Up @@ -486,11 +486,30 @@ func (res *CheckResult) checkSource(source parser.Source) {
isLast := i == len(source.Items)-1

switch allotment := allottedItem.Allotment.(type) {
case *parser.Variable:
variableLiterals = append(variableLiterals, *allotment)
res.checkExpression(allotment, TypePortion)
case *parser.RatioLiteral:
sum.Add(sum, allotment.ToRatio())
case *parser.ValueExprAllotment:
switch expr := allotment.ValueExpr.(type) {
case *parser.Variable:
variableLiterals = append(variableLiterals, *expr)

case *parser.PercentageLiteral:
sum.Add(sum, expr.ToRatio())

case *parser.BinaryInfix:
if expr.Operator == "/" {
left, okl := expr.Left.(*parser.NumberLiteral)
right, okr := expr.Right.(*parser.NumberLiteral)
if okl && okr {
rat := big.NewRat(int64(left.Number), int64(right.Number))
sum.Add(sum, rat)
}
}
}

if v, ok := allotment.ValueExpr.(*parser.Variable); ok {
variableLiterals = append(variableLiterals, *v)
}
res.checkExpression(allotment.ValueExpr, TypePortion)

case *parser.RemainingAllotment:
if isLast {
remainingAllotment = allotment
Expand Down Expand Up @@ -542,7 +561,7 @@ func (res *CheckResult) checkDestination(destination parser.Destination) {
case *parser.Variable:
variableLiterals = append(variableLiterals, *allotment)
res.checkExpression(allotment, TypePortion)
case *parser.RatioLiteral:
case *parser.PortionLiteral:
sum.Add(sum, allotment.ToRatio())
case *parser.RemainingAllotment:
if isLast {
Expand Down
51 changes: 51 additions & 0 deletions internal/parser/__snapshots__/parser_test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2301,3 +2301,54 @@ parser.Program{
},
}
---

[TestDivInfix - 1]
parser.Program{
Vars: nil,
Statements: {
&parser.FnCall{
Range: parser.Range{
Start: parser.Position{Character:0, Line:1},
End: parser.Position{Character:26, Line:1},
},
Caller: &parser.FnCallIdentifier{
Range: parser.Range{
Start: parser.Position{Character:0, Line:1},
End: parser.Position{Character:11, Line:1},
},
Name: "set_tx_meta",
},
Args: {
&parser.StringLiteral{
Range: parser.Range{
Start: parser.Position{Character:12, Line:1},
End: parser.Position{Character:16, Line:1},
},
String: "k1",
},
&parser.BinaryInfix{
Range: parser.Range{
Start: parser.Position{Character:18, Line:1},
End: parser.Position{Character:25, Line:1},
},
Operator: "/",
Left: &parser.Variable{
Range: parser.Range{
Start: parser.Position{Character:18, Line:1},
End: parser.Position{Character:20, Line:1},
},
Name: "x",
},
Right: &parser.Variable{
Range: parser.Range{
Start: parser.Position{Character:23, Line:1},
End: parser.Position{Character:25, Line:1},
},
Name: "y",
},
},
},
},
},
}
---
7 changes: 3 additions & 4 deletions internal/parser/antlr/Numscript.interp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
token literal names:
null
'/'
'+'
null
null
Expand Down Expand Up @@ -36,11 +37,11 @@ null
null
null
null
null

token symbolic names:
null
null
null
WS
NEWLINE
MULTILINE_COMMENT
Expand Down Expand Up @@ -69,7 +70,6 @@ COMMA
EQ
STAR
MINUS
RATIO_PORTION_LITERAL
PERCENTAGE_PORTION_LITERAL
STRING
IDENTIFIER
Expand All @@ -80,7 +80,6 @@ ASSET

rule names:
monetaryLit
portion
valueExpr
functionCallArgs
functionCall
Expand All @@ -101,4 +100,4 @@ statement


atn:
[4, 1, 37, 217, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 3, 1, 46, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 56, 8, 2, 1, 2, 1, 2, 1, 2, 5, 2, 61, 8, 2, 10, 2, 12, 2, 64, 9, 2, 1, 3, 1, 3, 1, 3, 5, 3, 69, 8, 3, 10, 3, 12, 3, 72, 9, 3, 1, 4, 1, 4, 1, 4, 3, 4, 77, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 3, 6, 87, 8, 6, 1, 7, 1, 7, 1, 7, 5, 7, 92, 8, 7, 10, 7, 12, 7, 95, 9, 7, 1, 7, 1, 7, 1, 8, 3, 8, 100, 8, 8, 1, 8, 5, 8, 103, 8, 8, 10, 8, 12, 8, 106, 9, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 3, 10, 118, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 4, 11, 135, 8, 11, 11, 11, 12, 11, 136, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 143, 8, 11, 10, 11, 12, 11, 146, 9, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 154, 8, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 3, 13, 163, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 4, 15, 172, 8, 15, 11, 15, 12, 15, 173, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 180, 8, 15, 10, 15, 12, 15, 183, 9, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 189, 8, 15, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 3, 17, 196, 8, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 215, 8, 18, 1, 18, 0, 1, 4, 19, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 0, 2, 2, 0, 1, 1, 29, 29, 2, 0, 17, 17, 33, 33, 228, 0, 38, 1, 0, 0, 0, 2, 45, 1, 0, 0, 0, 4, 55, 1, 0, 0, 0, 6, 65, 1, 0, 0, 0, 8, 73, 1, 0, 0, 0, 10, 80, 1, 0, 0, 0, 12, 83, 1, 0, 0, 0, 14, 88, 1, 0, 0, 0, 16, 99, 1, 0, 0, 0, 18, 109, 1, 0, 0, 0, 20, 117, 1, 0, 0, 0, 22, 153, 1, 0, 0, 0, 24, 155, 1, 0, 0, 0, 26, 162, 1, 0, 0, 0, 28, 164, 1, 0, 0, 0, 30, 188, 1, 0, 0, 0, 32, 190, 1, 0, 0, 0, 34, 195, 1, 0, 0, 0, 36, 214, 1, 0, 0, 0, 38, 39, 5, 22, 0, 0, 39, 40, 3, 4, 2, 0, 40, 41, 3, 4, 2, 0, 41, 42, 5, 23, 0, 0, 42, 1, 1, 0, 0, 0, 43, 46, 5, 30, 0, 0, 44, 46, 5, 31, 0, 0, 45, 43, 1, 0, 0, 0, 45, 44, 1, 0, 0, 0, 46, 3, 1, 0, 0, 0, 47, 48, 6, 2, -1, 0, 48, 56, 5, 35, 0, 0, 49, 56, 5, 37, 0, 0, 50, 56, 5, 32, 0, 0, 51, 56, 5, 36, 0, 0, 52, 56, 5, 34, 0, 0, 53, 56, 3, 0, 0, 0, 54, 56, 3, 2, 1, 0, 55, 47, 1, 0, 0, 0, 55, 49, 1, 0, 0, 0, 55, 50, 1, 0, 0, 0, 55, 51, 1, 0, 0, 0, 55, 52, 1, 0, 0, 0, 55, 53, 1, 0, 0, 0, 55, 54, 1, 0, 0, 0, 56, 62, 1, 0, 0, 0, 57, 58, 10, 1, 0, 0, 58, 59, 7, 0, 0, 0, 59, 61, 3, 4, 2, 2, 60, 57, 1, 0, 0, 0, 61, 64, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 5, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 65, 70, 3, 4, 2, 0, 66, 67, 5, 26, 0, 0, 67, 69, 3, 4, 2, 0, 68, 66, 1, 0, 0, 0, 69, 72, 1, 0, 0, 0, 70, 68, 1, 0, 0, 0, 70, 71, 1, 0, 0, 0, 71, 7, 1, 0, 0, 0, 72, 70, 1, 0, 0, 0, 73, 74, 7, 1, 0, 0, 74, 76, 5, 20, 0, 0, 75, 77, 3, 6, 3, 0, 76, 75, 1, 0, 0, 0, 76, 77, 1, 0, 0, 0, 77, 78, 1, 0, 0, 0, 78, 79, 5, 21, 0, 0, 79, 9, 1, 0, 0, 0, 80, 81, 5, 27, 0, 0, 81, 82, 3, 8, 4, 0, 82, 11, 1, 0, 0, 0, 83, 84, 5, 33, 0, 0, 84, 86, 5, 35, 0, 0, 85, 87, 3, 10, 5, 0, 86, 85, 1, 0, 0, 0, 86, 87, 1, 0, 0, 0, 87, 13, 1, 0, 0, 0, 88, 89, 5, 6, 0, 0, 89, 93, 5, 24, 0, 0, 90, 92, 3, 12, 6, 0, 91, 90, 1, 0, 0, 0, 92, 95, 1, 0, 0, 0, 93, 91, 1, 0, 0, 0, 93, 94, 1, 0, 0, 0, 94, 96, 1, 0, 0, 0, 95, 93, 1, 0, 0, 0, 96, 97, 5, 25, 0, 0, 97, 15, 1, 0, 0, 0, 98, 100, 3, 14, 7, 0, 99, 98, 1, 0, 0, 0, 99, 100, 1, 0, 0, 0, 100, 104, 1, 0, 0, 0, 101, 103, 3, 36, 18, 0, 102, 101, 1, 0, 0, 0, 103, 106, 1, 0, 0, 0, 104, 102, 1, 0, 0, 0, 104, 105, 1, 0, 0, 0, 105, 107, 1, 0, 0, 0, 106, 104, 1, 0, 0, 0, 107, 108, 5, 0, 0, 1, 108, 17, 1, 0, 0, 0, 109, 110, 5, 22, 0, 0, 110, 111, 3, 4, 2, 0, 111, 112, 5, 28, 0, 0, 112, 113, 5, 23, 0, 0, 113, 19, 1, 0, 0, 0, 114, 118, 3, 2, 1, 0, 115, 118, 5, 35, 0, 0, 116, 118, 5, 14, 0, 0, 117, 114, 1, 0, 0, 0, 117, 115, 1, 0, 0, 0, 117, 116, 1, 0, 0, 0, 118, 21, 1, 0, 0, 0, 119, 120, 3, 4, 2, 0, 120, 121, 5, 15, 0, 0, 121, 122, 5, 16, 0, 0, 122, 123, 5, 17, 0, 0, 123, 154, 1, 0, 0, 0, 124, 125, 3, 4, 2, 0, 125, 126, 5, 15, 0, 0, 126, 127, 5, 17, 0, 0, 127, 128, 5, 12, 0, 0, 128, 129, 5, 13, 0, 0, 129, 130, 3, 4, 2, 0, 130, 154, 1, 0, 0, 0, 131, 154, 3, 4, 2, 0, 132, 134, 5, 24, 0, 0, 133, 135, 3, 24, 12, 0, 134, 133, 1, 0, 0, 0, 135, 136, 1, 0, 0, 0, 136, 134, 1, 0, 0, 0, 136, 137, 1, 0, 0, 0, 137, 138, 1, 0, 0, 0, 138, 139, 5, 25, 0, 0, 139, 154, 1, 0, 0, 0, 140, 144, 5, 24, 0, 0, 141, 143, 3, 22, 11, 0, 142, 141, 1, 0, 0, 0, 143, 146, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0, 144, 145, 1, 0, 0, 0, 145, 147, 1, 0, 0, 0, 146, 144, 1, 0, 0, 0, 147, 154, 5, 25, 0, 0, 148, 149, 5, 7, 0, 0, 149, 150, 3, 4, 2, 0, 150, 151, 5, 11, 0, 0, 151, 152, 3, 22, 11, 0, 152, 154, 1, 0, 0, 0, 153, 119, 1, 0, 0, 0, 153, 124, 1, 0, 0, 0, 153, 131, 1, 0, 0, 0, 153, 132, 1, 0, 0, 0, 153, 140, 1, 0, 0, 0, 153, 148, 1, 0, 0, 0, 154, 23, 1, 0, 0, 0, 155, 156, 3, 20, 10, 0, 156, 157, 5, 11, 0, 0, 157, 158, 3, 22, 11, 0, 158, 25, 1, 0, 0, 0, 159, 160, 5, 13, 0, 0, 160, 163, 3, 30, 15, 0, 161, 163, 5, 18, 0, 0, 162, 159, 1, 0, 0, 0, 162, 161, 1, 0, 0, 0, 163, 27, 1, 0, 0, 0, 164, 165, 5, 7, 0, 0, 165, 166, 3, 4, 2, 0, 166, 167, 3, 26, 13, 0, 167, 29, 1, 0, 0, 0, 168, 189, 3, 4, 2, 0, 169, 171, 5, 24, 0, 0, 170, 172, 3, 32, 16, 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, 189, 1, 0, 0, 0, 177, 181, 5, 24, 0, 0, 178, 180, 3, 28, 14, 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, 185, 5, 14, 0, 0, 185, 186, 3, 26, 13, 0, 186, 187, 5, 25, 0, 0, 187, 189, 1, 0, 0, 0, 188, 168, 1, 0, 0, 0, 188, 169, 1, 0, 0, 0, 188, 177, 1, 0, 0, 0, 189, 31, 1, 0, 0, 0, 190, 191, 3, 20, 10, 0, 191, 192, 3, 26, 13, 0, 192, 33, 1, 0, 0, 0, 193, 196, 3, 4, 2, 0, 194, 196, 3, 18, 9, 0, 195, 193, 1, 0, 0, 0, 195, 194, 1, 0, 0, 0, 196, 35, 1, 0, 0, 0, 197, 198, 5, 10, 0, 0, 198, 199, 3, 34, 17, 0, 199, 200, 5, 20, 0, 0, 200, 201, 5, 8, 0, 0, 201, 202, 5, 27, 0, 0, 202, 203, 3, 22, 11, 0, 203, 204, 5, 9, 0, 0, 204, 205, 5, 27, 0, 0, 205, 206, 3, 30, 15, 0, 206, 207, 5, 21, 0, 0, 207, 215, 1, 0, 0, 0, 208, 209, 5, 19, 0, 0, 209, 210, 3, 34, 17, 0, 210, 211, 5, 11, 0, 0, 211, 212, 3, 4, 2, 0, 212, 215, 1, 0, 0, 0, 213, 215, 3, 8, 4, 0, 214, 197, 1, 0, 0, 0, 214, 208, 1, 0, 0, 0, 214, 213, 1, 0, 0, 0, 215, 37, 1, 0, 0, 0, 19, 45, 55, 62, 70, 76, 86, 93, 99, 104, 117, 136, 144, 153, 162, 173, 181, 188, 195, 214]
[4, 1, 37, 213, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 50, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 58, 8, 1, 10, 1, 12, 1, 61, 9, 1, 1, 2, 1, 2, 1, 2, 5, 2, 66, 8, 2, 10, 2, 12, 2, 69, 9, 2, 1, 3, 1, 3, 1, 3, 3, 3, 74, 8, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 3, 5, 84, 8, 5, 1, 6, 1, 6, 1, 6, 5, 6, 89, 8, 6, 10, 6, 12, 6, 92, 9, 6, 1, 6, 1, 6, 1, 7, 3, 7, 97, 8, 7, 1, 7, 5, 7, 100, 8, 7, 10, 7, 12, 7, 103, 9, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 3, 9, 114, 8, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 4, 10, 131, 8, 10, 11, 10, 12, 10, 132, 1, 10, 1, 10, 1, 10, 1, 10, 5, 10, 139, 8, 10, 10, 10, 12, 10, 142, 9, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 150, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 3, 12, 159, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 4, 14, 168, 8, 14, 11, 14, 12, 14, 169, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 176, 8, 14, 10, 14, 12, 14, 179, 9, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 185, 8, 14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 3, 16, 192, 8, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 211, 8, 17, 1, 17, 0, 1, 2, 18, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 0, 2, 2, 0, 2, 2, 30, 30, 2, 0, 18, 18, 33, 33, 224, 0, 36, 1, 0, 0, 0, 2, 49, 1, 0, 0, 0, 4, 62, 1, 0, 0, 0, 6, 70, 1, 0, 0, 0, 8, 77, 1, 0, 0, 0, 10, 80, 1, 0, 0, 0, 12, 85, 1, 0, 0, 0, 14, 96, 1, 0, 0, 0, 16, 106, 1, 0, 0, 0, 18, 113, 1, 0, 0, 0, 20, 149, 1, 0, 0, 0, 22, 151, 1, 0, 0, 0, 24, 158, 1, 0, 0, 0, 26, 160, 1, 0, 0, 0, 28, 184, 1, 0, 0, 0, 30, 186, 1, 0, 0, 0, 32, 191, 1, 0, 0, 0, 34, 210, 1, 0, 0, 0, 36, 37, 5, 23, 0, 0, 37, 38, 3, 2, 1, 0, 38, 39, 3, 2, 1, 0, 39, 40, 5, 24, 0, 0, 40, 1, 1, 0, 0, 0, 41, 42, 6, 1, -1, 0, 42, 50, 5, 35, 0, 0, 43, 50, 5, 37, 0, 0, 44, 50, 5, 32, 0, 0, 45, 50, 5, 36, 0, 0, 46, 50, 5, 34, 0, 0, 47, 50, 5, 31, 0, 0, 48, 50, 3, 0, 0, 0, 49, 41, 1, 0, 0, 0, 49, 43, 1, 0, 0, 0, 49, 44, 1, 0, 0, 0, 49, 45, 1, 0, 0, 0, 49, 46, 1, 0, 0, 0, 49, 47, 1, 0, 0, 0, 49, 48, 1, 0, 0, 0, 50, 59, 1, 0, 0, 0, 51, 52, 10, 2, 0, 0, 52, 53, 5, 1, 0, 0, 53, 58, 3, 2, 1, 3, 54, 55, 10, 1, 0, 0, 55, 56, 7, 0, 0, 0, 56, 58, 3, 2, 1, 2, 57, 51, 1, 0, 0, 0, 57, 54, 1, 0, 0, 0, 58, 61, 1, 0, 0, 0, 59, 57, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 3, 1, 0, 0, 0, 61, 59, 1, 0, 0, 0, 62, 67, 3, 2, 1, 0, 63, 64, 5, 27, 0, 0, 64, 66, 3, 2, 1, 0, 65, 63, 1, 0, 0, 0, 66, 69, 1, 0, 0, 0, 67, 65, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 5, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 70, 71, 7, 1, 0, 0, 71, 73, 5, 21, 0, 0, 72, 74, 3, 4, 2, 0, 73, 72, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 75, 1, 0, 0, 0, 75, 76, 5, 22, 0, 0, 76, 7, 1, 0, 0, 0, 77, 78, 5, 28, 0, 0, 78, 79, 3, 6, 3, 0, 79, 9, 1, 0, 0, 0, 80, 81, 5, 33, 0, 0, 81, 83, 5, 35, 0, 0, 82, 84, 3, 8, 4, 0, 83, 82, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 11, 1, 0, 0, 0, 85, 86, 5, 7, 0, 0, 86, 90, 5, 25, 0, 0, 87, 89, 3, 10, 5, 0, 88, 87, 1, 0, 0, 0, 89, 92, 1, 0, 0, 0, 90, 88, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 93, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, 93, 94, 5, 26, 0, 0, 94, 13, 1, 0, 0, 0, 95, 97, 3, 12, 6, 0, 96, 95, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 101, 1, 0, 0, 0, 98, 100, 3, 34, 17, 0, 99, 98, 1, 0, 0, 0, 100, 103, 1, 0, 0, 0, 101, 99, 1, 0, 0, 0, 101, 102, 1, 0, 0, 0, 102, 104, 1, 0, 0, 0, 103, 101, 1, 0, 0, 0, 104, 105, 5, 0, 0, 1, 105, 15, 1, 0, 0, 0, 106, 107, 5, 23, 0, 0, 107, 108, 3, 2, 1, 0, 108, 109, 5, 29, 0, 0, 109, 110, 5, 24, 0, 0, 110, 17, 1, 0, 0, 0, 111, 114, 3, 2, 1, 0, 112, 114, 5, 15, 0, 0, 113, 111, 1, 0, 0, 0, 113, 112, 1, 0, 0, 0, 114, 19, 1, 0, 0, 0, 115, 116, 3, 2, 1, 0, 116, 117, 5, 16, 0, 0, 117, 118, 5, 17, 0, 0, 118, 119, 5, 18, 0, 0, 119, 150, 1, 0, 0, 0, 120, 121, 3, 2, 1, 0, 121, 122, 5, 16, 0, 0, 122, 123, 5, 18, 0, 0, 123, 124, 5, 13, 0, 0, 124, 125, 5, 14, 0, 0, 125, 126, 3, 2, 1, 0, 126, 150, 1, 0, 0, 0, 127, 150, 3, 2, 1, 0, 128, 130, 5, 25, 0, 0, 129, 131, 3, 22, 11, 0, 130, 129, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 130, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 134, 1, 0, 0, 0, 134, 135, 5, 26, 0, 0, 135, 150, 1, 0, 0, 0, 136, 140, 5, 25, 0, 0, 137, 139, 3, 20, 10, 0, 138, 137, 1, 0, 0, 0, 139, 142, 1, 0, 0, 0, 140, 138, 1, 0, 0, 0, 140, 141, 1, 0, 0, 0, 141, 143, 1, 0, 0, 0, 142, 140, 1, 0, 0, 0, 143, 150, 5, 26, 0, 0, 144, 145, 5, 8, 0, 0, 145, 146, 3, 2, 1, 0, 146, 147, 5, 12, 0, 0, 147, 148, 3, 20, 10, 0, 148, 150, 1, 0, 0, 0, 149, 115, 1, 0, 0, 0, 149, 120, 1, 0, 0, 0, 149, 127, 1, 0, 0, 0, 149, 128, 1, 0, 0, 0, 149, 136, 1, 0, 0, 0, 149, 144, 1, 0, 0, 0, 150, 21, 1, 0, 0, 0, 151, 152, 3, 18, 9, 0, 152, 153, 5, 12, 0, 0, 153, 154, 3, 20, 10, 0, 154, 23, 1, 0, 0, 0, 155, 156, 5, 14, 0, 0, 156, 159, 3, 28, 14, 0, 157, 159, 5, 19, 0, 0, 158, 155, 1, 0, 0, 0, 158, 157, 1, 0, 0, 0, 159, 25, 1, 0, 0, 0, 160, 161, 5, 8, 0, 0, 161, 162, 3, 2, 1, 0, 162, 163, 3, 24, 12, 0, 163, 27, 1, 0, 0, 0, 164, 185, 3, 2, 1, 0, 165, 167, 5, 25, 0, 0, 166, 168, 3, 30, 15, 0, 167, 166, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 167, 1, 0, 0, 0, 169, 170, 1, 0, 0, 0, 170, 171, 1, 0, 0, 0, 171, 172, 5, 26, 0, 0, 172, 185, 1, 0, 0, 0, 173, 177, 5, 25, 0, 0, 174, 176, 3, 26, 13, 0, 175, 174, 1, 0, 0, 0, 176, 179, 1, 0, 0, 0, 177, 175, 1, 0, 0, 0, 177, 178, 1, 0, 0, 0, 178, 180, 1, 0, 0, 0, 179, 177, 1, 0, 0, 0, 180, 181, 5, 15, 0, 0, 181, 182, 3, 24, 12, 0, 182, 183, 5, 26, 0, 0, 183, 185, 1, 0, 0, 0, 184, 164, 1, 0, 0, 0, 184, 165, 1, 0, 0, 0, 184, 173, 1, 0, 0, 0, 185, 29, 1, 0, 0, 0, 186, 187, 3, 18, 9, 0, 187, 188, 3, 24, 12, 0, 188, 31, 1, 0, 0, 0, 189, 192, 3, 2, 1, 0, 190, 192, 3, 16, 8, 0, 191, 189, 1, 0, 0, 0, 191, 190, 1, 0, 0, 0, 192, 33, 1, 0, 0, 0, 193, 194, 5, 11, 0, 0, 194, 195, 3, 32, 16, 0, 195, 196, 5, 21, 0, 0, 196, 197, 5, 9, 0, 0, 197, 198, 5, 28, 0, 0, 198, 199, 3, 20, 10, 0, 199, 200, 5, 10, 0, 0, 200, 201, 5, 28, 0, 0, 201, 202, 3, 28, 14, 0, 202, 203, 5, 22, 0, 0, 203, 211, 1, 0, 0, 0, 204, 205, 5, 20, 0, 0, 205, 206, 3, 32, 16, 0, 206, 207, 5, 12, 0, 0, 207, 208, 3, 2, 1, 0, 208, 211, 1, 0, 0, 0, 209, 211, 3, 6, 3, 0, 210, 193, 1, 0, 0, 0, 210, 204, 1, 0, 0, 0, 210, 209, 1, 0, 0, 0, 211, 35, 1, 0, 0, 0, 19, 49, 57, 59, 67, 73, 83, 90, 96, 101, 113, 132, 140, 149, 158, 169, 177, 184, 191, 210]
109 changes: 55 additions & 54 deletions internal/parser/antlr/Numscript.tokens
Original file line number Diff line number Diff line change
@@ -1,62 +1,63 @@
T__0=1
WS=2
NEWLINE=3
MULTILINE_COMMENT=4
LINE_COMMENT=5
VARS=6
MAX=7
SOURCE=8
DESTINATION=9
SEND=10
FROM=11
UP=12
TO=13
REMAINING=14
ALLOWING=15
UNBOUNDED=16
OVERDRAFT=17
KEPT=18
SAVE=19
LPARENS=20
RPARENS=21
LBRACKET=22
RBRACKET=23
LBRACE=24
RBRACE=25
COMMA=26
EQ=27
STAR=28
MINUS=29
RATIO_PORTION_LITERAL=30
T__1=2
WS=3
NEWLINE=4
MULTILINE_COMMENT=5
LINE_COMMENT=6
VARS=7
MAX=8
SOURCE=9
DESTINATION=10
SEND=11
FROM=12
UP=13
TO=14
REMAINING=15
ALLOWING=16
UNBOUNDED=17
OVERDRAFT=18
KEPT=19
SAVE=20
LPARENS=21
RPARENS=22
LBRACKET=23
RBRACKET=24
LBRACE=25
RBRACE=26
COMMA=27
EQ=28
STAR=29
MINUS=30
PERCENTAGE_PORTION_LITERAL=31
STRING=32
IDENTIFIER=33
NUMBER=34
VARIABLE_NAME=35
ACCOUNT=36
ASSET=37
'+'=1
'vars'=6
'max'=7
'source'=8
'destination'=9
'send'=10
'from'=11
'up'=12
'to'=13
'remaining'=14
'allowing'=15
'unbounded'=16
'overdraft'=17
'kept'=18
'save'=19
'('=20
')'=21
'['=22
']'=23
'{'=24
'}'=25
','=26
'='=27
'*'=28
'-'=29
'/'=1
'+'=2
'vars'=7
'max'=8
'source'=9
'destination'=10
'send'=11
'from'=12
'up'=13
'to'=14
'remaining'=15
'allowing'=16
'unbounded'=17
'overdraft'=18
'kept'=19
'save'=20
'('=21
')'=22
'['=23
']'=24
'{'=25
'}'=26
','=27
'='=28
'*'=29
'-'=30
Loading

0 comments on commit 1763302

Please sign in to comment.