diff --git a/packages/cashc/src/Errors.ts b/packages/cashc/src/Errors.ts index aca72ce5d..05ca2d22e 100644 --- a/packages/cashc/src/Errors.ts +++ b/packages/cashc/src/Errors.ts @@ -20,6 +20,7 @@ import { ContractNode, SliceNode, IntLiteralNode, + TupleAssignmentNode, } from './ast/AST.js'; import { Symbol, SymbolType } from './ast/SymbolTable.js'; import { Location } from './ast/Location.js'; @@ -283,6 +284,15 @@ export class DivisionByZeroError extends CashScriptError { } } +export class DuplicateTupleTargetError extends CashScriptError { + constructor( + node: TupleAssignmentNode, + name: string, + ) { + super(node, `Duplicate target '${name}' in tuple destructuring`); + } +} + export class ConstantModificationError extends CashScriptError { constructor(node: VariableDefinitionNode | ConstantDefinitionNode); constructor(node: Node, name: string); diff --git a/packages/cashc/src/ast/AST.ts b/packages/cashc/src/ast/AST.ts index 01f08e16c..3b787b5ea 100644 --- a/packages/cashc/src/ast/AST.ts +++ b/packages/cashc/src/ast/AST.ts @@ -155,13 +155,13 @@ export class VariableDefinitionNode extends NonControlStatementNode implements N } export interface TupleAssignmentTarget { - name: string; - type: Type; + identifier: IdentifierNode; + type?: Type; + isReassignment?: boolean; } export class TupleAssignmentNode extends NonControlStatementNode { constructor( - // TODO: Use IdentifierNodes instead of a custom type public targets: TupleAssignmentTarget[], public tuple: ExpressionNode, ) { diff --git a/packages/cashc/src/ast/AstBuilder.ts b/packages/cashc/src/ast/AstBuilder.ts index 05db951d4..53e16bce3 100644 --- a/packages/cashc/src/ast/AstBuilder.ts +++ b/packages/cashc/src/ast/AstBuilder.ts @@ -249,11 +249,16 @@ export default class AstBuilder visitTupleAssignment(ctx: TupleAssignmentContext): TupleAssignmentNode { const expression = this.visit(ctx.expression()); - const types = ctx.typeName_list(); - const targets = ctx.Identifier_list().map((name, i) => ({ - name: name.getText(), - type: parseType(types[i].getText()), - })); + const targets = ctx.tupleTarget_list().map((target) => { + const typeName = target.typeName(); + const identifier = new IdentifierNode(target.Identifier().getText()); + identifier.location = Location.fromToken(target.Identifier().symbol); + return { + identifier, + type: typeName ? parseType(typeName.getText()) : undefined, + isReassignment: !typeName, + }; + }); const tupleAssignment = new TupleAssignmentNode(targets, expression); tupleAssignment.location = Location.fromCtx(ctx); return tupleAssignment; diff --git a/packages/cashc/src/generation/GenerateTargetTraversal.ts b/packages/cashc/src/generation/GenerateTargetTraversal.ts index 076c9650a..ad905b8fc 100644 --- a/packages/cashc/src/generation/GenerateTargetTraversal.ts +++ b/packages/cashc/src/generation/GenerateTargetTraversal.ts @@ -508,8 +508,34 @@ export default class GenerateTargetTraversal extends AstTraversal { visitTupleAssignment(node: TupleAssignmentNode): Node { node.tuple = this.visit(node.tuple); - this.popFromStack(node.targets.length); - node.targets.forEach((target) => this.pushToStack(target.name)); + + // Outside of a loop/branch, a reassignment is just a rename (the old value stays on the stack) + const scopedReassign = this.scopeDepth > 0 && node.targets.some((target) => target.isReassignment); + if (!scopedReassign) { + this.popFromStack(node.targets.length); + node.targets.forEach((target) => this.pushToStack(target.identifier.name)); + return node; + } + + const locationData = { location: node.location, positionHint: PositionHint.END }; + const parkedDeclarations: string[] = []; + + const reversedTargets = [...node.targets].reverse(); + reversedTargets.forEach((target) => { + if (target.isReassignment) { + this.emitReplace(this.getStackIndex(target.identifier.name), node); + } else { + this.emit(Op.OP_TOALTSTACK, locationData); + parkedDeclarations.push(target.identifier.name); + } + this.popFromStack(); + }); + + parkedDeclarations.reverse().forEach((name) => { + this.emit(Op.OP_FROMALTSTACK, locationData); + this.pushToStack(name); + }); + return node; } @@ -1017,4 +1043,3 @@ export default class GenerateTargetTraversal extends AstTraversal { return node; } } - diff --git a/packages/cashc/src/grammar/CashScript.g4 b/packages/cashc/src/grammar/CashScript.g4 index 7800db392..5e6ed26b6 100644 --- a/packages/cashc/src/grammar/CashScript.g4 +++ b/packages/cashc/src/grammar/CashScript.g4 @@ -101,7 +101,13 @@ variableDefinition ; tupleAssignment - : typeName Identifier (',' typeName Identifier)+ '=' expression + : tupleTarget (',' tupleTarget)+ '=' expression + | '(' tupleTarget (',' tupleTarget)+ ')' '=' expression + ; + +tupleTarget + : typeName Identifier + | Identifier ; assignStatement @@ -215,8 +221,8 @@ numberLiteral ; typeName - : PrimitiveType - | BoundedBytes + : PrimitiveType + | BoundedBytes | UnboundedBytes ; diff --git a/packages/cashc/src/grammar/CashScript.interp b/packages/cashc/src/grammar/CashScript.interp index 63f11d9df..04be55783 100644 --- a/packages/cashc/src/grammar/CashScript.interp +++ b/packages/cashc/src/grammar/CashScript.interp @@ -198,6 +198,7 @@ returnStatement controlStatement variableDefinition tupleAssignment +tupleTarget assignStatement timeOpStatement requireStatement @@ -222,4 +223,4 @@ typeCast atn: -[4, 1, 85, 515, 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, 1, 0, 5, 0, 90, 8, 0, 10, 0, 12, 0, 93, 9, 0, 1, 0, 5, 0, 96, 8, 0, 10, 0, 12, 0, 99, 9, 0, 1, 0, 5, 0, 102, 8, 0, 10, 0, 12, 0, 105, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 3, 3, 118, 8, 3, 1, 4, 3, 4, 121, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 3, 7, 134, 8, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 5, 8, 144, 8, 8, 10, 8, 12, 8, 147, 9, 8, 1, 8, 1, 8, 3, 8, 151, 8, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 5, 10, 167, 8, 10, 10, 10, 12, 10, 170, 9, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 5, 12, 181, 8, 12, 10, 12, 12, 12, 184, 9, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 5, 13, 192, 8, 13, 10, 13, 12, 13, 195, 9, 13, 1, 13, 3, 13, 198, 8, 13, 3, 13, 200, 8, 13, 1, 13, 1, 13, 1, 14, 1, 14, 5, 14, 206, 8, 14, 10, 14, 12, 14, 209, 9, 14, 1, 14, 1, 14, 1, 15, 1, 15, 5, 15, 215, 8, 15, 10, 15, 12, 15, 218, 9, 15, 1, 15, 1, 15, 3, 15, 222, 8, 15, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 228, 8, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 238, 8, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 246, 8, 19, 10, 19, 12, 19, 249, 9, 19, 1, 20, 1, 20, 3, 20, 253, 8, 20, 1, 21, 1, 21, 5, 21, 257, 8, 21, 10, 21, 12, 21, 260, 9, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 4, 22, 272, 8, 22, 11, 22, 12, 22, 273, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 3, 23, 284, 8, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 3, 24, 293, 8, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 3, 25, 302, 8, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 3, 27, 316, 8, 27, 1, 28, 1, 28, 1, 28, 3, 28, 321, 8, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 3, 32, 349, 8, 32, 1, 33, 1, 33, 1, 34, 1, 34, 3, 34, 355, 8, 34, 1, 35, 1, 35, 1, 35, 1, 35, 5, 35, 361, 8, 35, 10, 35, 12, 35, 364, 9, 35, 1, 35, 3, 35, 367, 8, 35, 3, 35, 369, 8, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 380, 8, 37, 10, 37, 12, 37, 383, 9, 37, 1, 37, 3, 37, 386, 8, 37, 3, 37, 388, 8, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 401, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 427, 8, 38, 10, 38, 12, 38, 430, 9, 38, 1, 38, 3, 38, 433, 8, 38, 3, 38, 435, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 441, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 493, 8, 38, 10, 38, 12, 38, 496, 9, 38, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 3, 40, 505, 8, 40, 1, 41, 1, 41, 3, 41, 509, 8, 41, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 0, 1, 76, 44, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 0, 15, 1, 0, 4, 10, 2, 0, 10, 10, 22, 23, 1, 0, 24, 25, 1, 0, 37, 41, 2, 0, 37, 41, 43, 46, 2, 0, 5, 5, 51, 52, 1, 0, 53, 55, 2, 0, 52, 52, 56, 56, 1, 0, 57, 58, 1, 0, 6, 9, 1, 0, 59, 60, 1, 0, 47, 48, 2, 0, 17, 17, 65, 65, 1, 0, 72, 74, 2, 0, 72, 73, 80, 80, 546, 0, 91, 1, 0, 0, 0, 2, 108, 1, 0, 0, 0, 4, 113, 1, 0, 0, 0, 6, 115, 1, 0, 0, 0, 8, 120, 1, 0, 0, 0, 10, 124, 1, 0, 0, 0, 12, 126, 1, 0, 0, 0, 14, 133, 1, 0, 0, 0, 16, 135, 1, 0, 0, 0, 18, 154, 1, 0, 0, 0, 20, 161, 1, 0, 0, 0, 22, 173, 1, 0, 0, 0, 24, 178, 1, 0, 0, 0, 26, 187, 1, 0, 0, 0, 28, 203, 1, 0, 0, 0, 30, 221, 1, 0, 0, 0, 32, 227, 1, 0, 0, 0, 34, 237, 1, 0, 0, 0, 36, 239, 1, 0, 0, 0, 38, 241, 1, 0, 0, 0, 40, 252, 1, 0, 0, 0, 42, 254, 1, 0, 0, 0, 44, 265, 1, 0, 0, 0, 46, 283, 1, 0, 0, 0, 48, 285, 1, 0, 0, 0, 50, 296, 1, 0, 0, 0, 52, 305, 1, 0, 0, 0, 54, 308, 1, 0, 0, 0, 56, 320, 1, 0, 0, 0, 58, 322, 1, 0, 0, 0, 60, 330, 1, 0, 0, 0, 62, 336, 1, 0, 0, 0, 64, 348, 1, 0, 0, 0, 66, 350, 1, 0, 0, 0, 68, 354, 1, 0, 0, 0, 70, 356, 1, 0, 0, 0, 72, 372, 1, 0, 0, 0, 74, 375, 1, 0, 0, 0, 76, 440, 1, 0, 0, 0, 78, 497, 1, 0, 0, 0, 80, 504, 1, 0, 0, 0, 82, 506, 1, 0, 0, 0, 84, 510, 1, 0, 0, 0, 86, 512, 1, 0, 0, 0, 88, 90, 3, 2, 1, 0, 89, 88, 1, 0, 0, 0, 90, 93, 1, 0, 0, 0, 91, 89, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 97, 1, 0, 0, 0, 93, 91, 1, 0, 0, 0, 94, 96, 3, 12, 6, 0, 95, 94, 1, 0, 0, 0, 96, 99, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 103, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 100, 102, 3, 14, 7, 0, 101, 100, 1, 0, 0, 0, 102, 105, 1, 0, 0, 0, 103, 101, 1, 0, 0, 0, 103, 104, 1, 0, 0, 0, 104, 106, 1, 0, 0, 0, 105, 103, 1, 0, 0, 0, 106, 107, 5, 0, 0, 1, 107, 1, 1, 0, 0, 0, 108, 109, 5, 1, 0, 0, 109, 110, 3, 4, 2, 0, 110, 111, 3, 6, 3, 0, 111, 112, 5, 2, 0, 0, 112, 3, 1, 0, 0, 0, 113, 114, 5, 3, 0, 0, 114, 5, 1, 0, 0, 0, 115, 117, 3, 8, 4, 0, 116, 118, 3, 8, 4, 0, 117, 116, 1, 0, 0, 0, 117, 118, 1, 0, 0, 0, 118, 7, 1, 0, 0, 0, 119, 121, 3, 10, 5, 0, 120, 119, 1, 0, 0, 0, 120, 121, 1, 0, 0, 0, 121, 122, 1, 0, 0, 0, 122, 123, 5, 66, 0, 0, 123, 9, 1, 0, 0, 0, 124, 125, 7, 0, 0, 0, 125, 11, 1, 0, 0, 0, 126, 127, 5, 11, 0, 0, 127, 128, 5, 76, 0, 0, 128, 129, 5, 2, 0, 0, 129, 13, 1, 0, 0, 0, 130, 134, 3, 16, 8, 0, 131, 134, 3, 18, 9, 0, 132, 134, 3, 20, 10, 0, 133, 130, 1, 0, 0, 0, 133, 131, 1, 0, 0, 0, 133, 132, 1, 0, 0, 0, 134, 15, 1, 0, 0, 0, 135, 136, 5, 12, 0, 0, 136, 137, 5, 82, 0, 0, 137, 150, 3, 26, 13, 0, 138, 139, 5, 13, 0, 0, 139, 140, 5, 14, 0, 0, 140, 145, 3, 84, 42, 0, 141, 142, 5, 15, 0, 0, 142, 144, 3, 84, 42, 0, 143, 141, 1, 0, 0, 0, 144, 147, 1, 0, 0, 0, 145, 143, 1, 0, 0, 0, 145, 146, 1, 0, 0, 0, 146, 148, 1, 0, 0, 0, 147, 145, 1, 0, 0, 0, 148, 149, 5, 16, 0, 0, 149, 151, 1, 0, 0, 0, 150, 138, 1, 0, 0, 0, 150, 151, 1, 0, 0, 0, 151, 152, 1, 0, 0, 0, 152, 153, 3, 24, 12, 0, 153, 17, 1, 0, 0, 0, 154, 155, 3, 84, 42, 0, 155, 156, 5, 17, 0, 0, 156, 157, 5, 82, 0, 0, 157, 158, 5, 10, 0, 0, 158, 159, 3, 76, 38, 0, 159, 160, 5, 2, 0, 0, 160, 19, 1, 0, 0, 0, 161, 162, 5, 18, 0, 0, 162, 163, 5, 82, 0, 0, 163, 164, 3, 26, 13, 0, 164, 168, 5, 19, 0, 0, 165, 167, 3, 22, 11, 0, 166, 165, 1, 0, 0, 0, 167, 170, 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 171, 1, 0, 0, 0, 170, 168, 1, 0, 0, 0, 171, 172, 5, 20, 0, 0, 172, 21, 1, 0, 0, 0, 173, 174, 5, 12, 0, 0, 174, 175, 5, 82, 0, 0, 175, 176, 3, 26, 13, 0, 176, 177, 3, 24, 12, 0, 177, 23, 1, 0, 0, 0, 178, 182, 5, 19, 0, 0, 179, 181, 3, 32, 16, 0, 180, 179, 1, 0, 0, 0, 181, 184, 1, 0, 0, 0, 182, 180, 1, 0, 0, 0, 182, 183, 1, 0, 0, 0, 183, 185, 1, 0, 0, 0, 184, 182, 1, 0, 0, 0, 185, 186, 5, 20, 0, 0, 186, 25, 1, 0, 0, 0, 187, 199, 5, 14, 0, 0, 188, 193, 3, 28, 14, 0, 189, 190, 5, 15, 0, 0, 190, 192, 3, 28, 14, 0, 191, 189, 1, 0, 0, 0, 192, 195, 1, 0, 0, 0, 193, 191, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 197, 1, 0, 0, 0, 195, 193, 1, 0, 0, 0, 196, 198, 5, 15, 0, 0, 197, 196, 1, 0, 0, 0, 197, 198, 1, 0, 0, 0, 198, 200, 1, 0, 0, 0, 199, 188, 1, 0, 0, 0, 199, 200, 1, 0, 0, 0, 200, 201, 1, 0, 0, 0, 201, 202, 5, 16, 0, 0, 202, 27, 1, 0, 0, 0, 203, 207, 3, 84, 42, 0, 204, 206, 3, 78, 39, 0, 205, 204, 1, 0, 0, 0, 206, 209, 1, 0, 0, 0, 207, 205, 1, 0, 0, 0, 207, 208, 1, 0, 0, 0, 208, 210, 1, 0, 0, 0, 209, 207, 1, 0, 0, 0, 210, 211, 5, 82, 0, 0, 211, 29, 1, 0, 0, 0, 212, 216, 5, 19, 0, 0, 213, 215, 3, 32, 16, 0, 214, 213, 1, 0, 0, 0, 215, 218, 1, 0, 0, 0, 216, 214, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 219, 1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 219, 222, 5, 20, 0, 0, 220, 222, 3, 32, 16, 0, 221, 212, 1, 0, 0, 0, 221, 220, 1, 0, 0, 0, 222, 31, 1, 0, 0, 0, 223, 228, 3, 40, 20, 0, 224, 225, 3, 34, 17, 0, 225, 226, 5, 2, 0, 0, 226, 228, 1, 0, 0, 0, 227, 223, 1, 0, 0, 0, 227, 224, 1, 0, 0, 0, 228, 33, 1, 0, 0, 0, 229, 238, 3, 42, 21, 0, 230, 238, 3, 44, 22, 0, 231, 238, 3, 46, 23, 0, 232, 238, 3, 48, 24, 0, 233, 238, 3, 50, 25, 0, 234, 238, 3, 36, 18, 0, 235, 238, 3, 52, 26, 0, 236, 238, 3, 38, 19, 0, 237, 229, 1, 0, 0, 0, 237, 230, 1, 0, 0, 0, 237, 231, 1, 0, 0, 0, 237, 232, 1, 0, 0, 0, 237, 233, 1, 0, 0, 0, 237, 234, 1, 0, 0, 0, 237, 235, 1, 0, 0, 0, 237, 236, 1, 0, 0, 0, 238, 35, 1, 0, 0, 0, 239, 240, 3, 72, 36, 0, 240, 37, 1, 0, 0, 0, 241, 242, 5, 21, 0, 0, 242, 247, 3, 76, 38, 0, 243, 244, 5, 15, 0, 0, 244, 246, 3, 76, 38, 0, 245, 243, 1, 0, 0, 0, 246, 249, 1, 0, 0, 0, 247, 245, 1, 0, 0, 0, 247, 248, 1, 0, 0, 0, 248, 39, 1, 0, 0, 0, 249, 247, 1, 0, 0, 0, 250, 253, 3, 54, 27, 0, 251, 253, 3, 56, 28, 0, 252, 250, 1, 0, 0, 0, 252, 251, 1, 0, 0, 0, 253, 41, 1, 0, 0, 0, 254, 258, 3, 84, 42, 0, 255, 257, 3, 78, 39, 0, 256, 255, 1, 0, 0, 0, 257, 260, 1, 0, 0, 0, 258, 256, 1, 0, 0, 0, 258, 259, 1, 0, 0, 0, 259, 261, 1, 0, 0, 0, 260, 258, 1, 0, 0, 0, 261, 262, 5, 82, 0, 0, 262, 263, 5, 10, 0, 0, 263, 264, 3, 76, 38, 0, 264, 43, 1, 0, 0, 0, 265, 266, 3, 84, 42, 0, 266, 271, 5, 82, 0, 0, 267, 268, 5, 15, 0, 0, 268, 269, 3, 84, 42, 0, 269, 270, 5, 82, 0, 0, 270, 272, 1, 0, 0, 0, 271, 267, 1, 0, 0, 0, 272, 273, 1, 0, 0, 0, 273, 271, 1, 0, 0, 0, 273, 274, 1, 0, 0, 0, 274, 275, 1, 0, 0, 0, 275, 276, 5, 10, 0, 0, 276, 277, 3, 76, 38, 0, 277, 45, 1, 0, 0, 0, 278, 279, 5, 82, 0, 0, 279, 280, 7, 1, 0, 0, 280, 284, 3, 76, 38, 0, 281, 282, 5, 82, 0, 0, 282, 284, 7, 2, 0, 0, 283, 278, 1, 0, 0, 0, 283, 281, 1, 0, 0, 0, 284, 47, 1, 0, 0, 0, 285, 286, 5, 26, 0, 0, 286, 287, 5, 14, 0, 0, 287, 288, 5, 79, 0, 0, 288, 289, 5, 6, 0, 0, 289, 292, 3, 76, 38, 0, 290, 291, 5, 15, 0, 0, 291, 293, 3, 66, 33, 0, 292, 290, 1, 0, 0, 0, 292, 293, 1, 0, 0, 0, 293, 294, 1, 0, 0, 0, 294, 295, 5, 16, 0, 0, 295, 49, 1, 0, 0, 0, 296, 297, 5, 26, 0, 0, 297, 298, 5, 14, 0, 0, 298, 301, 3, 76, 38, 0, 299, 300, 5, 15, 0, 0, 300, 302, 3, 66, 33, 0, 301, 299, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 303, 1, 0, 0, 0, 303, 304, 5, 16, 0, 0, 304, 51, 1, 0, 0, 0, 305, 306, 5, 27, 0, 0, 306, 307, 3, 70, 35, 0, 307, 53, 1, 0, 0, 0, 308, 309, 5, 28, 0, 0, 309, 310, 5, 14, 0, 0, 310, 311, 3, 76, 38, 0, 311, 312, 5, 16, 0, 0, 312, 315, 3, 30, 15, 0, 313, 314, 5, 29, 0, 0, 314, 316, 3, 30, 15, 0, 315, 313, 1, 0, 0, 0, 315, 316, 1, 0, 0, 0, 316, 55, 1, 0, 0, 0, 317, 321, 3, 58, 29, 0, 318, 321, 3, 60, 30, 0, 319, 321, 3, 62, 31, 0, 320, 317, 1, 0, 0, 0, 320, 318, 1, 0, 0, 0, 320, 319, 1, 0, 0, 0, 321, 57, 1, 0, 0, 0, 322, 323, 5, 30, 0, 0, 323, 324, 3, 30, 15, 0, 324, 325, 5, 31, 0, 0, 325, 326, 5, 14, 0, 0, 326, 327, 3, 76, 38, 0, 327, 328, 5, 16, 0, 0, 328, 329, 5, 2, 0, 0, 329, 59, 1, 0, 0, 0, 330, 331, 5, 31, 0, 0, 331, 332, 5, 14, 0, 0, 332, 333, 3, 76, 38, 0, 333, 334, 5, 16, 0, 0, 334, 335, 3, 30, 15, 0, 335, 61, 1, 0, 0, 0, 336, 337, 5, 32, 0, 0, 337, 338, 5, 14, 0, 0, 338, 339, 3, 64, 32, 0, 339, 340, 5, 2, 0, 0, 340, 341, 3, 76, 38, 0, 341, 342, 5, 2, 0, 0, 342, 343, 3, 46, 23, 0, 343, 344, 5, 16, 0, 0, 344, 345, 3, 30, 15, 0, 345, 63, 1, 0, 0, 0, 346, 349, 3, 42, 21, 0, 347, 349, 3, 46, 23, 0, 348, 346, 1, 0, 0, 0, 348, 347, 1, 0, 0, 0, 349, 65, 1, 0, 0, 0, 350, 351, 5, 76, 0, 0, 351, 67, 1, 0, 0, 0, 352, 355, 5, 82, 0, 0, 353, 355, 3, 80, 40, 0, 354, 352, 1, 0, 0, 0, 354, 353, 1, 0, 0, 0, 355, 69, 1, 0, 0, 0, 356, 368, 5, 14, 0, 0, 357, 362, 3, 68, 34, 0, 358, 359, 5, 15, 0, 0, 359, 361, 3, 68, 34, 0, 360, 358, 1, 0, 0, 0, 361, 364, 1, 0, 0, 0, 362, 360, 1, 0, 0, 0, 362, 363, 1, 0, 0, 0, 363, 366, 1, 0, 0, 0, 364, 362, 1, 0, 0, 0, 365, 367, 5, 15, 0, 0, 366, 365, 1, 0, 0, 0, 366, 367, 1, 0, 0, 0, 367, 369, 1, 0, 0, 0, 368, 357, 1, 0, 0, 0, 368, 369, 1, 0, 0, 0, 369, 370, 1, 0, 0, 0, 370, 371, 5, 16, 0, 0, 371, 71, 1, 0, 0, 0, 372, 373, 5, 82, 0, 0, 373, 374, 3, 74, 37, 0, 374, 73, 1, 0, 0, 0, 375, 387, 5, 14, 0, 0, 376, 381, 3, 76, 38, 0, 377, 378, 5, 15, 0, 0, 378, 380, 3, 76, 38, 0, 379, 377, 1, 0, 0, 0, 380, 383, 1, 0, 0, 0, 381, 379, 1, 0, 0, 0, 381, 382, 1, 0, 0, 0, 382, 385, 1, 0, 0, 0, 383, 381, 1, 0, 0, 0, 384, 386, 5, 15, 0, 0, 385, 384, 1, 0, 0, 0, 385, 386, 1, 0, 0, 0, 386, 388, 1, 0, 0, 0, 387, 376, 1, 0, 0, 0, 387, 388, 1, 0, 0, 0, 388, 389, 1, 0, 0, 0, 389, 390, 5, 16, 0, 0, 390, 75, 1, 0, 0, 0, 391, 392, 6, 38, -1, 0, 392, 393, 5, 14, 0, 0, 393, 394, 3, 76, 38, 0, 394, 395, 5, 16, 0, 0, 395, 441, 1, 0, 0, 0, 396, 397, 3, 86, 43, 0, 397, 398, 5, 14, 0, 0, 398, 400, 3, 76, 38, 0, 399, 401, 5, 15, 0, 0, 400, 399, 1, 0, 0, 0, 400, 401, 1, 0, 0, 0, 401, 402, 1, 0, 0, 0, 402, 403, 5, 16, 0, 0, 403, 441, 1, 0, 0, 0, 404, 441, 3, 72, 36, 0, 405, 406, 5, 33, 0, 0, 406, 407, 5, 82, 0, 0, 407, 441, 3, 74, 37, 0, 408, 409, 5, 36, 0, 0, 409, 410, 5, 34, 0, 0, 410, 411, 3, 76, 38, 0, 411, 412, 5, 35, 0, 0, 412, 413, 7, 3, 0, 0, 413, 441, 1, 0, 0, 0, 414, 415, 5, 42, 0, 0, 415, 416, 5, 34, 0, 0, 416, 417, 3, 76, 38, 0, 417, 418, 5, 35, 0, 0, 418, 419, 7, 4, 0, 0, 419, 441, 1, 0, 0, 0, 420, 421, 7, 5, 0, 0, 421, 441, 3, 76, 38, 15, 422, 434, 5, 34, 0, 0, 423, 428, 3, 76, 38, 0, 424, 425, 5, 15, 0, 0, 425, 427, 3, 76, 38, 0, 426, 424, 1, 0, 0, 0, 427, 430, 1, 0, 0, 0, 428, 426, 1, 0, 0, 0, 428, 429, 1, 0, 0, 0, 429, 432, 1, 0, 0, 0, 430, 428, 1, 0, 0, 0, 431, 433, 5, 15, 0, 0, 432, 431, 1, 0, 0, 0, 432, 433, 1, 0, 0, 0, 433, 435, 1, 0, 0, 0, 434, 423, 1, 0, 0, 0, 434, 435, 1, 0, 0, 0, 435, 436, 1, 0, 0, 0, 436, 441, 5, 35, 0, 0, 437, 441, 5, 81, 0, 0, 438, 441, 5, 82, 0, 0, 439, 441, 3, 80, 40, 0, 440, 391, 1, 0, 0, 0, 440, 396, 1, 0, 0, 0, 440, 404, 1, 0, 0, 0, 440, 405, 1, 0, 0, 0, 440, 408, 1, 0, 0, 0, 440, 414, 1, 0, 0, 0, 440, 420, 1, 0, 0, 0, 440, 422, 1, 0, 0, 0, 440, 437, 1, 0, 0, 0, 440, 438, 1, 0, 0, 0, 440, 439, 1, 0, 0, 0, 441, 494, 1, 0, 0, 0, 442, 443, 10, 14, 0, 0, 443, 444, 7, 6, 0, 0, 444, 493, 3, 76, 38, 15, 445, 446, 10, 13, 0, 0, 446, 447, 7, 7, 0, 0, 447, 493, 3, 76, 38, 14, 448, 449, 10, 12, 0, 0, 449, 450, 7, 8, 0, 0, 450, 493, 3, 76, 38, 13, 451, 452, 10, 11, 0, 0, 452, 453, 7, 9, 0, 0, 453, 493, 3, 76, 38, 12, 454, 455, 10, 10, 0, 0, 455, 456, 7, 10, 0, 0, 456, 493, 3, 76, 38, 11, 457, 458, 10, 9, 0, 0, 458, 459, 5, 61, 0, 0, 459, 493, 3, 76, 38, 10, 460, 461, 10, 8, 0, 0, 461, 462, 5, 4, 0, 0, 462, 493, 3, 76, 38, 9, 463, 464, 10, 7, 0, 0, 464, 465, 5, 62, 0, 0, 465, 493, 3, 76, 38, 8, 466, 467, 10, 6, 0, 0, 467, 468, 5, 63, 0, 0, 468, 493, 3, 76, 38, 7, 469, 470, 10, 5, 0, 0, 470, 471, 5, 64, 0, 0, 471, 493, 3, 76, 38, 6, 472, 473, 10, 21, 0, 0, 473, 474, 5, 34, 0, 0, 474, 475, 5, 69, 0, 0, 475, 493, 5, 35, 0, 0, 476, 477, 10, 18, 0, 0, 477, 493, 7, 11, 0, 0, 478, 479, 10, 17, 0, 0, 479, 480, 5, 49, 0, 0, 480, 481, 5, 14, 0, 0, 481, 482, 3, 76, 38, 0, 482, 483, 5, 16, 0, 0, 483, 493, 1, 0, 0, 0, 484, 485, 10, 16, 0, 0, 485, 486, 5, 50, 0, 0, 486, 487, 5, 14, 0, 0, 487, 488, 3, 76, 38, 0, 488, 489, 5, 15, 0, 0, 489, 490, 3, 76, 38, 0, 490, 491, 5, 16, 0, 0, 491, 493, 1, 0, 0, 0, 492, 442, 1, 0, 0, 0, 492, 445, 1, 0, 0, 0, 492, 448, 1, 0, 0, 0, 492, 451, 1, 0, 0, 0, 492, 454, 1, 0, 0, 0, 492, 457, 1, 0, 0, 0, 492, 460, 1, 0, 0, 0, 492, 463, 1, 0, 0, 0, 492, 466, 1, 0, 0, 0, 492, 469, 1, 0, 0, 0, 492, 472, 1, 0, 0, 0, 492, 476, 1, 0, 0, 0, 492, 478, 1, 0, 0, 0, 492, 484, 1, 0, 0, 0, 493, 496, 1, 0, 0, 0, 494, 492, 1, 0, 0, 0, 494, 495, 1, 0, 0, 0, 495, 77, 1, 0, 0, 0, 496, 494, 1, 0, 0, 0, 497, 498, 7, 12, 0, 0, 498, 79, 1, 0, 0, 0, 499, 505, 5, 67, 0, 0, 500, 505, 3, 82, 41, 0, 501, 505, 5, 76, 0, 0, 502, 505, 5, 77, 0, 0, 503, 505, 5, 78, 0, 0, 504, 499, 1, 0, 0, 0, 504, 500, 1, 0, 0, 0, 504, 501, 1, 0, 0, 0, 504, 502, 1, 0, 0, 0, 504, 503, 1, 0, 0, 0, 505, 81, 1, 0, 0, 0, 506, 508, 5, 69, 0, 0, 507, 509, 5, 68, 0, 0, 508, 507, 1, 0, 0, 0, 508, 509, 1, 0, 0, 0, 509, 83, 1, 0, 0, 0, 510, 511, 7, 13, 0, 0, 511, 85, 1, 0, 0, 0, 512, 513, 7, 14, 0, 0, 513, 87, 1, 0, 0, 0, 44, 91, 97, 103, 117, 120, 133, 145, 150, 168, 182, 193, 197, 199, 207, 216, 221, 227, 237, 247, 252, 258, 273, 283, 292, 301, 315, 320, 348, 354, 362, 366, 368, 381, 385, 387, 400, 428, 432, 434, 440, 492, 494, 504, 508] \ No newline at end of file +[4, 1, 85, 534, 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, 1, 0, 5, 0, 92, 8, 0, 10, 0, 12, 0, 95, 9, 0, 1, 0, 5, 0, 98, 8, 0, 10, 0, 12, 0, 101, 9, 0, 1, 0, 5, 0, 104, 8, 0, 10, 0, 12, 0, 107, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 3, 3, 120, 8, 3, 1, 4, 3, 4, 123, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 3, 7, 136, 8, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 5, 8, 146, 8, 8, 10, 8, 12, 8, 149, 9, 8, 1, 8, 1, 8, 3, 8, 153, 8, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 5, 10, 169, 8, 10, 10, 10, 12, 10, 172, 9, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 5, 12, 183, 8, 12, 10, 12, 12, 12, 186, 9, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 5, 13, 194, 8, 13, 10, 13, 12, 13, 197, 9, 13, 1, 13, 3, 13, 200, 8, 13, 3, 13, 202, 8, 13, 1, 13, 1, 13, 1, 14, 1, 14, 5, 14, 208, 8, 14, 10, 14, 12, 14, 211, 9, 14, 1, 14, 1, 14, 1, 15, 1, 15, 5, 15, 217, 8, 15, 10, 15, 12, 15, 220, 9, 15, 1, 15, 1, 15, 3, 15, 224, 8, 15, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 230, 8, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 240, 8, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 248, 8, 19, 10, 19, 12, 19, 251, 9, 19, 1, 20, 1, 20, 3, 20, 255, 8, 20, 1, 21, 1, 21, 5, 21, 259, 8, 21, 10, 21, 12, 21, 262, 9, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 4, 22, 271, 8, 22, 11, 22, 12, 22, 272, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 4, 22, 282, 8, 22, 11, 22, 12, 22, 283, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 290, 8, 22, 1, 23, 1, 23, 1, 23, 1, 23, 3, 23, 296, 8, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 3, 24, 303, 8, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 3, 25, 312, 8, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 3, 26, 321, 8, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 3, 28, 335, 8, 28, 1, 29, 1, 29, 1, 29, 3, 29, 340, 8, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 3, 33, 368, 8, 33, 1, 34, 1, 34, 1, 35, 1, 35, 3, 35, 374, 8, 35, 1, 36, 1, 36, 1, 36, 1, 36, 5, 36, 380, 8, 36, 10, 36, 12, 36, 383, 9, 36, 1, 36, 3, 36, 386, 8, 36, 3, 36, 388, 8, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 399, 8, 38, 10, 38, 12, 38, 402, 9, 38, 1, 38, 3, 38, 405, 8, 38, 3, 38, 407, 8, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 420, 8, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 5, 39, 446, 8, 39, 10, 39, 12, 39, 449, 9, 39, 1, 39, 3, 39, 452, 8, 39, 3, 39, 454, 8, 39, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 460, 8, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 5, 39, 512, 8, 39, 10, 39, 12, 39, 515, 9, 39, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 524, 8, 41, 1, 42, 1, 42, 3, 42, 528, 8, 42, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 0, 1, 78, 45, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 0, 15, 1, 0, 4, 10, 2, 0, 10, 10, 22, 23, 1, 0, 24, 25, 1, 0, 37, 41, 2, 0, 37, 41, 43, 46, 2, 0, 5, 5, 51, 52, 1, 0, 53, 55, 2, 0, 52, 52, 56, 56, 1, 0, 57, 58, 1, 0, 6, 9, 1, 0, 59, 60, 1, 0, 47, 48, 2, 0, 17, 17, 65, 65, 1, 0, 72, 74, 2, 0, 72, 73, 80, 80, 567, 0, 93, 1, 0, 0, 0, 2, 110, 1, 0, 0, 0, 4, 115, 1, 0, 0, 0, 6, 117, 1, 0, 0, 0, 8, 122, 1, 0, 0, 0, 10, 126, 1, 0, 0, 0, 12, 128, 1, 0, 0, 0, 14, 135, 1, 0, 0, 0, 16, 137, 1, 0, 0, 0, 18, 156, 1, 0, 0, 0, 20, 163, 1, 0, 0, 0, 22, 175, 1, 0, 0, 0, 24, 180, 1, 0, 0, 0, 26, 189, 1, 0, 0, 0, 28, 205, 1, 0, 0, 0, 30, 223, 1, 0, 0, 0, 32, 229, 1, 0, 0, 0, 34, 239, 1, 0, 0, 0, 36, 241, 1, 0, 0, 0, 38, 243, 1, 0, 0, 0, 40, 254, 1, 0, 0, 0, 42, 256, 1, 0, 0, 0, 44, 289, 1, 0, 0, 0, 46, 295, 1, 0, 0, 0, 48, 302, 1, 0, 0, 0, 50, 304, 1, 0, 0, 0, 52, 315, 1, 0, 0, 0, 54, 324, 1, 0, 0, 0, 56, 327, 1, 0, 0, 0, 58, 339, 1, 0, 0, 0, 60, 341, 1, 0, 0, 0, 62, 349, 1, 0, 0, 0, 64, 355, 1, 0, 0, 0, 66, 367, 1, 0, 0, 0, 68, 369, 1, 0, 0, 0, 70, 373, 1, 0, 0, 0, 72, 375, 1, 0, 0, 0, 74, 391, 1, 0, 0, 0, 76, 394, 1, 0, 0, 0, 78, 459, 1, 0, 0, 0, 80, 516, 1, 0, 0, 0, 82, 523, 1, 0, 0, 0, 84, 525, 1, 0, 0, 0, 86, 529, 1, 0, 0, 0, 88, 531, 1, 0, 0, 0, 90, 92, 3, 2, 1, 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, 99, 1, 0, 0, 0, 95, 93, 1, 0, 0, 0, 96, 98, 3, 12, 6, 0, 97, 96, 1, 0, 0, 0, 98, 101, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 99, 100, 1, 0, 0, 0, 100, 105, 1, 0, 0, 0, 101, 99, 1, 0, 0, 0, 102, 104, 3, 14, 7, 0, 103, 102, 1, 0, 0, 0, 104, 107, 1, 0, 0, 0, 105, 103, 1, 0, 0, 0, 105, 106, 1, 0, 0, 0, 106, 108, 1, 0, 0, 0, 107, 105, 1, 0, 0, 0, 108, 109, 5, 0, 0, 1, 109, 1, 1, 0, 0, 0, 110, 111, 5, 1, 0, 0, 111, 112, 3, 4, 2, 0, 112, 113, 3, 6, 3, 0, 113, 114, 5, 2, 0, 0, 114, 3, 1, 0, 0, 0, 115, 116, 5, 3, 0, 0, 116, 5, 1, 0, 0, 0, 117, 119, 3, 8, 4, 0, 118, 120, 3, 8, 4, 0, 119, 118, 1, 0, 0, 0, 119, 120, 1, 0, 0, 0, 120, 7, 1, 0, 0, 0, 121, 123, 3, 10, 5, 0, 122, 121, 1, 0, 0, 0, 122, 123, 1, 0, 0, 0, 123, 124, 1, 0, 0, 0, 124, 125, 5, 66, 0, 0, 125, 9, 1, 0, 0, 0, 126, 127, 7, 0, 0, 0, 127, 11, 1, 0, 0, 0, 128, 129, 5, 11, 0, 0, 129, 130, 5, 76, 0, 0, 130, 131, 5, 2, 0, 0, 131, 13, 1, 0, 0, 0, 132, 136, 3, 16, 8, 0, 133, 136, 3, 18, 9, 0, 134, 136, 3, 20, 10, 0, 135, 132, 1, 0, 0, 0, 135, 133, 1, 0, 0, 0, 135, 134, 1, 0, 0, 0, 136, 15, 1, 0, 0, 0, 137, 138, 5, 12, 0, 0, 138, 139, 5, 82, 0, 0, 139, 152, 3, 26, 13, 0, 140, 141, 5, 13, 0, 0, 141, 142, 5, 14, 0, 0, 142, 147, 3, 86, 43, 0, 143, 144, 5, 15, 0, 0, 144, 146, 3, 86, 43, 0, 145, 143, 1, 0, 0, 0, 146, 149, 1, 0, 0, 0, 147, 145, 1, 0, 0, 0, 147, 148, 1, 0, 0, 0, 148, 150, 1, 0, 0, 0, 149, 147, 1, 0, 0, 0, 150, 151, 5, 16, 0, 0, 151, 153, 1, 0, 0, 0, 152, 140, 1, 0, 0, 0, 152, 153, 1, 0, 0, 0, 153, 154, 1, 0, 0, 0, 154, 155, 3, 24, 12, 0, 155, 17, 1, 0, 0, 0, 156, 157, 3, 86, 43, 0, 157, 158, 5, 17, 0, 0, 158, 159, 5, 82, 0, 0, 159, 160, 5, 10, 0, 0, 160, 161, 3, 78, 39, 0, 161, 162, 5, 2, 0, 0, 162, 19, 1, 0, 0, 0, 163, 164, 5, 18, 0, 0, 164, 165, 5, 82, 0, 0, 165, 166, 3, 26, 13, 0, 166, 170, 5, 19, 0, 0, 167, 169, 3, 22, 11, 0, 168, 167, 1, 0, 0, 0, 169, 172, 1, 0, 0, 0, 170, 168, 1, 0, 0, 0, 170, 171, 1, 0, 0, 0, 171, 173, 1, 0, 0, 0, 172, 170, 1, 0, 0, 0, 173, 174, 5, 20, 0, 0, 174, 21, 1, 0, 0, 0, 175, 176, 5, 12, 0, 0, 176, 177, 5, 82, 0, 0, 177, 178, 3, 26, 13, 0, 178, 179, 3, 24, 12, 0, 179, 23, 1, 0, 0, 0, 180, 184, 5, 19, 0, 0, 181, 183, 3, 32, 16, 0, 182, 181, 1, 0, 0, 0, 183, 186, 1, 0, 0, 0, 184, 182, 1, 0, 0, 0, 184, 185, 1, 0, 0, 0, 185, 187, 1, 0, 0, 0, 186, 184, 1, 0, 0, 0, 187, 188, 5, 20, 0, 0, 188, 25, 1, 0, 0, 0, 189, 201, 5, 14, 0, 0, 190, 195, 3, 28, 14, 0, 191, 192, 5, 15, 0, 0, 192, 194, 3, 28, 14, 0, 193, 191, 1, 0, 0, 0, 194, 197, 1, 0, 0, 0, 195, 193, 1, 0, 0, 0, 195, 196, 1, 0, 0, 0, 196, 199, 1, 0, 0, 0, 197, 195, 1, 0, 0, 0, 198, 200, 5, 15, 0, 0, 199, 198, 1, 0, 0, 0, 199, 200, 1, 0, 0, 0, 200, 202, 1, 0, 0, 0, 201, 190, 1, 0, 0, 0, 201, 202, 1, 0, 0, 0, 202, 203, 1, 0, 0, 0, 203, 204, 5, 16, 0, 0, 204, 27, 1, 0, 0, 0, 205, 209, 3, 86, 43, 0, 206, 208, 3, 80, 40, 0, 207, 206, 1, 0, 0, 0, 208, 211, 1, 0, 0, 0, 209, 207, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, 212, 1, 0, 0, 0, 211, 209, 1, 0, 0, 0, 212, 213, 5, 82, 0, 0, 213, 29, 1, 0, 0, 0, 214, 218, 5, 19, 0, 0, 215, 217, 3, 32, 16, 0, 216, 215, 1, 0, 0, 0, 217, 220, 1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 218, 219, 1, 0, 0, 0, 219, 221, 1, 0, 0, 0, 220, 218, 1, 0, 0, 0, 221, 224, 5, 20, 0, 0, 222, 224, 3, 32, 16, 0, 223, 214, 1, 0, 0, 0, 223, 222, 1, 0, 0, 0, 224, 31, 1, 0, 0, 0, 225, 230, 3, 40, 20, 0, 226, 227, 3, 34, 17, 0, 227, 228, 5, 2, 0, 0, 228, 230, 1, 0, 0, 0, 229, 225, 1, 0, 0, 0, 229, 226, 1, 0, 0, 0, 230, 33, 1, 0, 0, 0, 231, 240, 3, 42, 21, 0, 232, 240, 3, 44, 22, 0, 233, 240, 3, 48, 24, 0, 234, 240, 3, 50, 25, 0, 235, 240, 3, 52, 26, 0, 236, 240, 3, 36, 18, 0, 237, 240, 3, 54, 27, 0, 238, 240, 3, 38, 19, 0, 239, 231, 1, 0, 0, 0, 239, 232, 1, 0, 0, 0, 239, 233, 1, 0, 0, 0, 239, 234, 1, 0, 0, 0, 239, 235, 1, 0, 0, 0, 239, 236, 1, 0, 0, 0, 239, 237, 1, 0, 0, 0, 239, 238, 1, 0, 0, 0, 240, 35, 1, 0, 0, 0, 241, 242, 3, 74, 37, 0, 242, 37, 1, 0, 0, 0, 243, 244, 5, 21, 0, 0, 244, 249, 3, 78, 39, 0, 245, 246, 5, 15, 0, 0, 246, 248, 3, 78, 39, 0, 247, 245, 1, 0, 0, 0, 248, 251, 1, 0, 0, 0, 249, 247, 1, 0, 0, 0, 249, 250, 1, 0, 0, 0, 250, 39, 1, 0, 0, 0, 251, 249, 1, 0, 0, 0, 252, 255, 3, 56, 28, 0, 253, 255, 3, 58, 29, 0, 254, 252, 1, 0, 0, 0, 254, 253, 1, 0, 0, 0, 255, 41, 1, 0, 0, 0, 256, 260, 3, 86, 43, 0, 257, 259, 3, 80, 40, 0, 258, 257, 1, 0, 0, 0, 259, 262, 1, 0, 0, 0, 260, 258, 1, 0, 0, 0, 260, 261, 1, 0, 0, 0, 261, 263, 1, 0, 0, 0, 262, 260, 1, 0, 0, 0, 263, 264, 5, 82, 0, 0, 264, 265, 5, 10, 0, 0, 265, 266, 3, 78, 39, 0, 266, 43, 1, 0, 0, 0, 267, 270, 3, 46, 23, 0, 268, 269, 5, 15, 0, 0, 269, 271, 3, 46, 23, 0, 270, 268, 1, 0, 0, 0, 271, 272, 1, 0, 0, 0, 272, 270, 1, 0, 0, 0, 272, 273, 1, 0, 0, 0, 273, 274, 1, 0, 0, 0, 274, 275, 5, 10, 0, 0, 275, 276, 3, 78, 39, 0, 276, 290, 1, 0, 0, 0, 277, 278, 5, 14, 0, 0, 278, 281, 3, 46, 23, 0, 279, 280, 5, 15, 0, 0, 280, 282, 3, 46, 23, 0, 281, 279, 1, 0, 0, 0, 282, 283, 1, 0, 0, 0, 283, 281, 1, 0, 0, 0, 283, 284, 1, 0, 0, 0, 284, 285, 1, 0, 0, 0, 285, 286, 5, 16, 0, 0, 286, 287, 5, 10, 0, 0, 287, 288, 3, 78, 39, 0, 288, 290, 1, 0, 0, 0, 289, 267, 1, 0, 0, 0, 289, 277, 1, 0, 0, 0, 290, 45, 1, 0, 0, 0, 291, 292, 3, 86, 43, 0, 292, 293, 5, 82, 0, 0, 293, 296, 1, 0, 0, 0, 294, 296, 5, 82, 0, 0, 295, 291, 1, 0, 0, 0, 295, 294, 1, 0, 0, 0, 296, 47, 1, 0, 0, 0, 297, 298, 5, 82, 0, 0, 298, 299, 7, 1, 0, 0, 299, 303, 3, 78, 39, 0, 300, 301, 5, 82, 0, 0, 301, 303, 7, 2, 0, 0, 302, 297, 1, 0, 0, 0, 302, 300, 1, 0, 0, 0, 303, 49, 1, 0, 0, 0, 304, 305, 5, 26, 0, 0, 305, 306, 5, 14, 0, 0, 306, 307, 5, 79, 0, 0, 307, 308, 5, 6, 0, 0, 308, 311, 3, 78, 39, 0, 309, 310, 5, 15, 0, 0, 310, 312, 3, 68, 34, 0, 311, 309, 1, 0, 0, 0, 311, 312, 1, 0, 0, 0, 312, 313, 1, 0, 0, 0, 313, 314, 5, 16, 0, 0, 314, 51, 1, 0, 0, 0, 315, 316, 5, 26, 0, 0, 316, 317, 5, 14, 0, 0, 317, 320, 3, 78, 39, 0, 318, 319, 5, 15, 0, 0, 319, 321, 3, 68, 34, 0, 320, 318, 1, 0, 0, 0, 320, 321, 1, 0, 0, 0, 321, 322, 1, 0, 0, 0, 322, 323, 5, 16, 0, 0, 323, 53, 1, 0, 0, 0, 324, 325, 5, 27, 0, 0, 325, 326, 3, 72, 36, 0, 326, 55, 1, 0, 0, 0, 327, 328, 5, 28, 0, 0, 328, 329, 5, 14, 0, 0, 329, 330, 3, 78, 39, 0, 330, 331, 5, 16, 0, 0, 331, 334, 3, 30, 15, 0, 332, 333, 5, 29, 0, 0, 333, 335, 3, 30, 15, 0, 334, 332, 1, 0, 0, 0, 334, 335, 1, 0, 0, 0, 335, 57, 1, 0, 0, 0, 336, 340, 3, 60, 30, 0, 337, 340, 3, 62, 31, 0, 338, 340, 3, 64, 32, 0, 339, 336, 1, 0, 0, 0, 339, 337, 1, 0, 0, 0, 339, 338, 1, 0, 0, 0, 340, 59, 1, 0, 0, 0, 341, 342, 5, 30, 0, 0, 342, 343, 3, 30, 15, 0, 343, 344, 5, 31, 0, 0, 344, 345, 5, 14, 0, 0, 345, 346, 3, 78, 39, 0, 346, 347, 5, 16, 0, 0, 347, 348, 5, 2, 0, 0, 348, 61, 1, 0, 0, 0, 349, 350, 5, 31, 0, 0, 350, 351, 5, 14, 0, 0, 351, 352, 3, 78, 39, 0, 352, 353, 5, 16, 0, 0, 353, 354, 3, 30, 15, 0, 354, 63, 1, 0, 0, 0, 355, 356, 5, 32, 0, 0, 356, 357, 5, 14, 0, 0, 357, 358, 3, 66, 33, 0, 358, 359, 5, 2, 0, 0, 359, 360, 3, 78, 39, 0, 360, 361, 5, 2, 0, 0, 361, 362, 3, 48, 24, 0, 362, 363, 5, 16, 0, 0, 363, 364, 3, 30, 15, 0, 364, 65, 1, 0, 0, 0, 365, 368, 3, 42, 21, 0, 366, 368, 3, 48, 24, 0, 367, 365, 1, 0, 0, 0, 367, 366, 1, 0, 0, 0, 368, 67, 1, 0, 0, 0, 369, 370, 5, 76, 0, 0, 370, 69, 1, 0, 0, 0, 371, 374, 5, 82, 0, 0, 372, 374, 3, 82, 41, 0, 373, 371, 1, 0, 0, 0, 373, 372, 1, 0, 0, 0, 374, 71, 1, 0, 0, 0, 375, 387, 5, 14, 0, 0, 376, 381, 3, 70, 35, 0, 377, 378, 5, 15, 0, 0, 378, 380, 3, 70, 35, 0, 379, 377, 1, 0, 0, 0, 380, 383, 1, 0, 0, 0, 381, 379, 1, 0, 0, 0, 381, 382, 1, 0, 0, 0, 382, 385, 1, 0, 0, 0, 383, 381, 1, 0, 0, 0, 384, 386, 5, 15, 0, 0, 385, 384, 1, 0, 0, 0, 385, 386, 1, 0, 0, 0, 386, 388, 1, 0, 0, 0, 387, 376, 1, 0, 0, 0, 387, 388, 1, 0, 0, 0, 388, 389, 1, 0, 0, 0, 389, 390, 5, 16, 0, 0, 390, 73, 1, 0, 0, 0, 391, 392, 5, 82, 0, 0, 392, 393, 3, 76, 38, 0, 393, 75, 1, 0, 0, 0, 394, 406, 5, 14, 0, 0, 395, 400, 3, 78, 39, 0, 396, 397, 5, 15, 0, 0, 397, 399, 3, 78, 39, 0, 398, 396, 1, 0, 0, 0, 399, 402, 1, 0, 0, 0, 400, 398, 1, 0, 0, 0, 400, 401, 1, 0, 0, 0, 401, 404, 1, 0, 0, 0, 402, 400, 1, 0, 0, 0, 403, 405, 5, 15, 0, 0, 404, 403, 1, 0, 0, 0, 404, 405, 1, 0, 0, 0, 405, 407, 1, 0, 0, 0, 406, 395, 1, 0, 0, 0, 406, 407, 1, 0, 0, 0, 407, 408, 1, 0, 0, 0, 408, 409, 5, 16, 0, 0, 409, 77, 1, 0, 0, 0, 410, 411, 6, 39, -1, 0, 411, 412, 5, 14, 0, 0, 412, 413, 3, 78, 39, 0, 413, 414, 5, 16, 0, 0, 414, 460, 1, 0, 0, 0, 415, 416, 3, 88, 44, 0, 416, 417, 5, 14, 0, 0, 417, 419, 3, 78, 39, 0, 418, 420, 5, 15, 0, 0, 419, 418, 1, 0, 0, 0, 419, 420, 1, 0, 0, 0, 420, 421, 1, 0, 0, 0, 421, 422, 5, 16, 0, 0, 422, 460, 1, 0, 0, 0, 423, 460, 3, 74, 37, 0, 424, 425, 5, 33, 0, 0, 425, 426, 5, 82, 0, 0, 426, 460, 3, 76, 38, 0, 427, 428, 5, 36, 0, 0, 428, 429, 5, 34, 0, 0, 429, 430, 3, 78, 39, 0, 430, 431, 5, 35, 0, 0, 431, 432, 7, 3, 0, 0, 432, 460, 1, 0, 0, 0, 433, 434, 5, 42, 0, 0, 434, 435, 5, 34, 0, 0, 435, 436, 3, 78, 39, 0, 436, 437, 5, 35, 0, 0, 437, 438, 7, 4, 0, 0, 438, 460, 1, 0, 0, 0, 439, 440, 7, 5, 0, 0, 440, 460, 3, 78, 39, 15, 441, 453, 5, 34, 0, 0, 442, 447, 3, 78, 39, 0, 443, 444, 5, 15, 0, 0, 444, 446, 3, 78, 39, 0, 445, 443, 1, 0, 0, 0, 446, 449, 1, 0, 0, 0, 447, 445, 1, 0, 0, 0, 447, 448, 1, 0, 0, 0, 448, 451, 1, 0, 0, 0, 449, 447, 1, 0, 0, 0, 450, 452, 5, 15, 0, 0, 451, 450, 1, 0, 0, 0, 451, 452, 1, 0, 0, 0, 452, 454, 1, 0, 0, 0, 453, 442, 1, 0, 0, 0, 453, 454, 1, 0, 0, 0, 454, 455, 1, 0, 0, 0, 455, 460, 5, 35, 0, 0, 456, 460, 5, 81, 0, 0, 457, 460, 5, 82, 0, 0, 458, 460, 3, 82, 41, 0, 459, 410, 1, 0, 0, 0, 459, 415, 1, 0, 0, 0, 459, 423, 1, 0, 0, 0, 459, 424, 1, 0, 0, 0, 459, 427, 1, 0, 0, 0, 459, 433, 1, 0, 0, 0, 459, 439, 1, 0, 0, 0, 459, 441, 1, 0, 0, 0, 459, 456, 1, 0, 0, 0, 459, 457, 1, 0, 0, 0, 459, 458, 1, 0, 0, 0, 460, 513, 1, 0, 0, 0, 461, 462, 10, 14, 0, 0, 462, 463, 7, 6, 0, 0, 463, 512, 3, 78, 39, 15, 464, 465, 10, 13, 0, 0, 465, 466, 7, 7, 0, 0, 466, 512, 3, 78, 39, 14, 467, 468, 10, 12, 0, 0, 468, 469, 7, 8, 0, 0, 469, 512, 3, 78, 39, 13, 470, 471, 10, 11, 0, 0, 471, 472, 7, 9, 0, 0, 472, 512, 3, 78, 39, 12, 473, 474, 10, 10, 0, 0, 474, 475, 7, 10, 0, 0, 475, 512, 3, 78, 39, 11, 476, 477, 10, 9, 0, 0, 477, 478, 5, 61, 0, 0, 478, 512, 3, 78, 39, 10, 479, 480, 10, 8, 0, 0, 480, 481, 5, 4, 0, 0, 481, 512, 3, 78, 39, 9, 482, 483, 10, 7, 0, 0, 483, 484, 5, 62, 0, 0, 484, 512, 3, 78, 39, 8, 485, 486, 10, 6, 0, 0, 486, 487, 5, 63, 0, 0, 487, 512, 3, 78, 39, 7, 488, 489, 10, 5, 0, 0, 489, 490, 5, 64, 0, 0, 490, 512, 3, 78, 39, 6, 491, 492, 10, 21, 0, 0, 492, 493, 5, 34, 0, 0, 493, 494, 5, 69, 0, 0, 494, 512, 5, 35, 0, 0, 495, 496, 10, 18, 0, 0, 496, 512, 7, 11, 0, 0, 497, 498, 10, 17, 0, 0, 498, 499, 5, 49, 0, 0, 499, 500, 5, 14, 0, 0, 500, 501, 3, 78, 39, 0, 501, 502, 5, 16, 0, 0, 502, 512, 1, 0, 0, 0, 503, 504, 10, 16, 0, 0, 504, 505, 5, 50, 0, 0, 505, 506, 5, 14, 0, 0, 506, 507, 3, 78, 39, 0, 507, 508, 5, 15, 0, 0, 508, 509, 3, 78, 39, 0, 509, 510, 5, 16, 0, 0, 510, 512, 1, 0, 0, 0, 511, 461, 1, 0, 0, 0, 511, 464, 1, 0, 0, 0, 511, 467, 1, 0, 0, 0, 511, 470, 1, 0, 0, 0, 511, 473, 1, 0, 0, 0, 511, 476, 1, 0, 0, 0, 511, 479, 1, 0, 0, 0, 511, 482, 1, 0, 0, 0, 511, 485, 1, 0, 0, 0, 511, 488, 1, 0, 0, 0, 511, 491, 1, 0, 0, 0, 511, 495, 1, 0, 0, 0, 511, 497, 1, 0, 0, 0, 511, 503, 1, 0, 0, 0, 512, 515, 1, 0, 0, 0, 513, 511, 1, 0, 0, 0, 513, 514, 1, 0, 0, 0, 514, 79, 1, 0, 0, 0, 515, 513, 1, 0, 0, 0, 516, 517, 7, 12, 0, 0, 517, 81, 1, 0, 0, 0, 518, 524, 5, 67, 0, 0, 519, 524, 3, 84, 42, 0, 520, 524, 5, 76, 0, 0, 521, 524, 5, 77, 0, 0, 522, 524, 5, 78, 0, 0, 523, 518, 1, 0, 0, 0, 523, 519, 1, 0, 0, 0, 523, 520, 1, 0, 0, 0, 523, 521, 1, 0, 0, 0, 523, 522, 1, 0, 0, 0, 524, 83, 1, 0, 0, 0, 525, 527, 5, 69, 0, 0, 526, 528, 5, 68, 0, 0, 527, 526, 1, 0, 0, 0, 527, 528, 1, 0, 0, 0, 528, 85, 1, 0, 0, 0, 529, 530, 7, 13, 0, 0, 530, 87, 1, 0, 0, 0, 531, 532, 7, 14, 0, 0, 532, 89, 1, 0, 0, 0, 47, 93, 99, 105, 119, 122, 135, 147, 152, 170, 184, 195, 199, 201, 209, 218, 223, 229, 239, 249, 254, 260, 272, 283, 289, 295, 302, 311, 320, 334, 339, 367, 373, 381, 385, 387, 400, 404, 406, 419, 447, 451, 453, 459, 511, 513, 523, 527] \ No newline at end of file diff --git a/packages/cashc/src/grammar/CashScriptParser.ts b/packages/cashc/src/grammar/CashScriptParser.ts index c94f6b254..d08aa12af 100644 --- a/packages/cashc/src/grammar/CashScriptParser.ts +++ b/packages/cashc/src/grammar/CashScriptParser.ts @@ -127,27 +127,28 @@ export default class CashScriptParser extends Parser { public static readonly RULE_controlStatement = 20; public static readonly RULE_variableDefinition = 21; public static readonly RULE_tupleAssignment = 22; - public static readonly RULE_assignStatement = 23; - public static readonly RULE_timeOpStatement = 24; - public static readonly RULE_requireStatement = 25; - public static readonly RULE_consoleStatement = 26; - public static readonly RULE_ifStatement = 27; - public static readonly RULE_loopStatement = 28; - public static readonly RULE_doWhileStatement = 29; - public static readonly RULE_whileStatement = 30; - public static readonly RULE_forStatement = 31; - public static readonly RULE_forInit = 32; - public static readonly RULE_requireMessage = 33; - public static readonly RULE_consoleParameter = 34; - public static readonly RULE_consoleParameterList = 35; - public static readonly RULE_functionCall = 36; - public static readonly RULE_expressionList = 37; - public static readonly RULE_expression = 38; - public static readonly RULE_modifier = 39; - public static readonly RULE_literal = 40; - public static readonly RULE_numberLiteral = 41; - public static readonly RULE_typeName = 42; - public static readonly RULE_typeCast = 43; + public static readonly RULE_tupleTarget = 23; + public static readonly RULE_assignStatement = 24; + public static readonly RULE_timeOpStatement = 25; + public static readonly RULE_requireStatement = 26; + public static readonly RULE_consoleStatement = 27; + public static readonly RULE_ifStatement = 28; + public static readonly RULE_loopStatement = 29; + public static readonly RULE_doWhileStatement = 30; + public static readonly RULE_whileStatement = 31; + public static readonly RULE_forStatement = 32; + public static readonly RULE_forInit = 33; + public static readonly RULE_requireMessage = 34; + public static readonly RULE_consoleParameter = 35; + public static readonly RULE_consoleParameterList = 36; + public static readonly RULE_functionCall = 37; + public static readonly RULE_expressionList = 38; + public static readonly RULE_expression = 39; + public static readonly RULE_modifier = 40; + public static readonly RULE_literal = 41; + public static readonly RULE_numberLiteral = 42; + public static readonly RULE_typeName = 43; + public static readonly RULE_typeCast = 44; public static readonly literalNames: (string | null)[] = [ null, "'pragma'", "';'", "'cashscript'", "'^'", "'~'", @@ -254,11 +255,11 @@ export default class CashScriptParser extends Parser { "constantDefinition", "contractDefinition", "contractFunctionDefinition", "functionBody", "parameterList", "parameter", "block", "statement", "nonControlStatement", "functionCallStatement", "returnStatement", "controlStatement", "variableDefinition", - "tupleAssignment", "assignStatement", "timeOpStatement", "requireStatement", - "consoleStatement", "ifStatement", "loopStatement", "doWhileStatement", - "whileStatement", "forStatement", "forInit", "requireMessage", "consoleParameter", - "consoleParameterList", "functionCall", "expressionList", "expression", - "modifier", "literal", "numberLiteral", "typeName", "typeCast", + "tupleAssignment", "tupleTarget", "assignStatement", "timeOpStatement", + "requireStatement", "consoleStatement", "ifStatement", "loopStatement", + "doWhileStatement", "whileStatement", "forStatement", "forInit", "requireMessage", + "consoleParameter", "consoleParameterList", "functionCall", "expressionList", + "expression", "modifier", "literal", "numberLiteral", "typeName", "typeCast", ]; public get grammarFileName(): string { return "CashScript.g4"; } public get literalNames(): (string | null)[] { return CashScriptParser.literalNames; } @@ -282,49 +283,49 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 91; + this.state = 93; this._errHandler.sync(this); _la = this._input.LA(1); while (_la===1) { { { - this.state = 88; + this.state = 90; this.pragmaDirective(); } } - this.state = 93; + this.state = 95; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 97; + this.state = 99; this._errHandler.sync(this); _la = this._input.LA(1); while (_la===11) { { { - this.state = 94; + this.state = 96; this.importDirective(); } } - this.state = 99; + this.state = 101; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 103; + this.state = 105; this._errHandler.sync(this); _la = this._input.LA(1); while (_la===12 || _la===18 || ((((_la - 72)) & ~0x1F) === 0 && ((1 << (_la - 72)) & 7) !== 0)) { { { - this.state = 100; + this.state = 102; this.topLevelDefinition(); } } - this.state = 105; + this.state = 107; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 106; + this.state = 108; this.match(CashScriptParser.EOF); } } @@ -349,13 +350,13 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 108; + this.state = 110; this.match(CashScriptParser.T__0); - this.state = 109; + this.state = 111; this.pragmaName(); - this.state = 110; + this.state = 112; this.pragmaValue(); - this.state = 111; + this.state = 113; this.match(CashScriptParser.T__1); } } @@ -380,7 +381,7 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 113; + this.state = 115; this.match(CashScriptParser.T__2); } } @@ -406,14 +407,14 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 115; - this.versionConstraint(); this.state = 117; + this.versionConstraint(); + this.state = 119; this._errHandler.sync(this); _la = this._input.LA(1); if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 2032) !== 0) || _la===66) { { - this.state = 116; + this.state = 118; this.versionConstraint(); } } @@ -442,17 +443,17 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 120; + this.state = 122; this._errHandler.sync(this); _la = this._input.LA(1); if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 2032) !== 0)) { { - this.state = 119; + this.state = 121; this.versionOperator(); } } - this.state = 122; + this.state = 124; this.match(CashScriptParser.VersionLiteral); } } @@ -478,7 +479,7 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 124; + this.state = 126; _la = this._input.LA(1); if(!((((_la) & ~0x1F) === 0 && ((1 << _la) & 2032) !== 0))) { this._errHandler.recoverInline(this); @@ -510,11 +511,11 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 126; + this.state = 128; this.match(CashScriptParser.T__10); - this.state = 127; + this.state = 129; this.match(CashScriptParser.StringLiteral); - this.state = 128; + this.state = 130; this.match(CashScriptParser.T__1); } } @@ -537,13 +538,13 @@ export default class CashScriptParser extends Parser { let localctx: TopLevelDefinitionContext = new TopLevelDefinitionContext(this, this._ctx, this.state); this.enterRule(localctx, 14, CashScriptParser.RULE_topLevelDefinition); try { - this.state = 133; + this.state = 135; this._errHandler.sync(this); switch (this._input.LA(1)) { case 12: this.enterOuterAlt(localctx, 1); { - this.state = 130; + this.state = 132; this.globalFunctionDefinition(); } break; @@ -552,14 +553,14 @@ export default class CashScriptParser extends Parser { case 74: this.enterOuterAlt(localctx, 2); { - this.state = 131; + this.state = 133; this.constantDefinition(); } break; case 18: this.enterOuterAlt(localctx, 3); { - this.state = 132; + this.state = 134; this.contractDefinition(); } break; @@ -589,45 +590,45 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 135; + this.state = 137; this.match(CashScriptParser.T__11); - this.state = 136; + this.state = 138; this.match(CashScriptParser.Identifier); - this.state = 137; + this.state = 139; this.parameterList(); - this.state = 150; + this.state = 152; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===13) { { - this.state = 138; + this.state = 140; this.match(CashScriptParser.T__12); - this.state = 139; + this.state = 141; this.match(CashScriptParser.T__13); - this.state = 140; + this.state = 142; this.typeName(); - this.state = 145; + this.state = 147; this._errHandler.sync(this); _la = this._input.LA(1); while (_la===15) { { { - this.state = 141; + this.state = 143; this.match(CashScriptParser.T__14); - this.state = 142; + this.state = 144; this.typeName(); } } - this.state = 147; + this.state = 149; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 148; + this.state = 150; this.match(CashScriptParser.T__15); } } - this.state = 152; + this.state = 154; this.functionBody(); } } @@ -652,17 +653,17 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 154; + this.state = 156; this.typeName(); - this.state = 155; + this.state = 157; this.match(CashScriptParser.T__16); - this.state = 156; + this.state = 158; this.match(CashScriptParser.Identifier); - this.state = 157; + this.state = 159; this.match(CashScriptParser.T__9); - this.state = 158; + this.state = 160; this.expression(0); - this.state = 159; + this.state = 161; this.match(CashScriptParser.T__1); } } @@ -688,29 +689,29 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 161; + this.state = 163; this.match(CashScriptParser.T__17); - this.state = 162; + this.state = 164; this.match(CashScriptParser.Identifier); - this.state = 163; + this.state = 165; this.parameterList(); - this.state = 164; + this.state = 166; this.match(CashScriptParser.T__18); - this.state = 168; + this.state = 170; this._errHandler.sync(this); _la = this._input.LA(1); while (_la===12) { { { - this.state = 165; + this.state = 167; this.contractFunctionDefinition(); } } - this.state = 170; + this.state = 172; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 171; + this.state = 173; this.match(CashScriptParser.T__19); } } @@ -735,13 +736,13 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 173; + this.state = 175; this.match(CashScriptParser.T__11); - this.state = 174; + this.state = 176; this.match(CashScriptParser.Identifier); - this.state = 175; + this.state = 177; this.parameterList(); - this.state = 176; + this.state = 178; this.functionBody(); } } @@ -767,23 +768,23 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 178; + this.state = 180; this.match(CashScriptParser.T__18); - this.state = 182; + this.state = 184; this._errHandler.sync(this); _la = this._input.LA(1); - while (((((_la - 21)) & ~0x1F) === 0 && ((1 << (_la - 21)) & 3809) !== 0) || ((((_la - 72)) & ~0x1F) === 0 && ((1 << (_la - 72)) & 1031) !== 0)) { + while (((((_la - 14)) & ~0x1F) === 0 && ((1 << (_la - 14)) & 487553) !== 0) || ((((_la - 72)) & ~0x1F) === 0 && ((1 << (_la - 72)) & 1031) !== 0)) { { { - this.state = 179; + this.state = 181; this.statement(); } } - this.state = 184; + this.state = 186; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 185; + this.state = 187; this.match(CashScriptParser.T__19); } } @@ -810,39 +811,39 @@ export default class CashScriptParser extends Parser { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 187; + this.state = 189; this.match(CashScriptParser.T__13); - this.state = 199; + this.state = 201; this._errHandler.sync(this); _la = this._input.LA(1); if (((((_la - 72)) & ~0x1F) === 0 && ((1 << (_la - 72)) & 7) !== 0)) { { - this.state = 188; + this.state = 190; this.parameter(); - this.state = 193; + this.state = 195; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 10, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 189; + this.state = 191; this.match(CashScriptParser.T__14); - this.state = 190; + this.state = 192; this.parameter(); } } } - this.state = 195; + this.state = 197; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 10, this._ctx); } - this.state = 197; + this.state = 199; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===15) { { - this.state = 196; + this.state = 198; this.match(CashScriptParser.T__14); } } @@ -850,7 +851,7 @@ export default class CashScriptParser extends Parser { } } - this.state = 201; + this.state = 203; this.match(CashScriptParser.T__15); } } @@ -876,23 +877,23 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 203; + this.state = 205; this.typeName(); - this.state = 207; + this.state = 209; this._errHandler.sync(this); _la = this._input.LA(1); while (_la===17 || _la===65) { { { - this.state = 204; + this.state = 206; this.modifier(); } } - this.state = 209; + this.state = 211; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 210; + this.state = 212; this.match(CashScriptParser.Identifier); } } @@ -916,32 +917,33 @@ export default class CashScriptParser extends Parser { this.enterRule(localctx, 30, CashScriptParser.RULE_block); let _la: number; try { - this.state = 221; + this.state = 223; this._errHandler.sync(this); switch (this._input.LA(1)) { case 19: this.enterOuterAlt(localctx, 1); { - this.state = 212; + this.state = 214; this.match(CashScriptParser.T__18); - this.state = 216; + this.state = 218; this._errHandler.sync(this); _la = this._input.LA(1); - while (((((_la - 21)) & ~0x1F) === 0 && ((1 << (_la - 21)) & 3809) !== 0) || ((((_la - 72)) & ~0x1F) === 0 && ((1 << (_la - 72)) & 1031) !== 0)) { + while (((((_la - 14)) & ~0x1F) === 0 && ((1 << (_la - 14)) & 487553) !== 0) || ((((_la - 72)) & ~0x1F) === 0 && ((1 << (_la - 72)) & 1031) !== 0)) { { { - this.state = 213; + this.state = 215; this.statement(); } } - this.state = 218; + this.state = 220; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 219; + this.state = 221; this.match(CashScriptParser.T__19); } break; + case 14: case 21: case 26: case 27: @@ -955,7 +957,7 @@ export default class CashScriptParser extends Parser { case 82: this.enterOuterAlt(localctx, 2); { - this.state = 220; + this.state = 222; this.statement(); } break; @@ -982,7 +984,7 @@ export default class CashScriptParser extends Parser { let localctx: StatementContext = new StatementContext(this, this._ctx, this.state); this.enterRule(localctx, 32, CashScriptParser.RULE_statement); try { - this.state = 227; + this.state = 229; this._errHandler.sync(this); switch (this._input.LA(1)) { case 28: @@ -991,10 +993,11 @@ export default class CashScriptParser extends Parser { case 32: this.enterOuterAlt(localctx, 1); { - this.state = 223; + this.state = 225; this.controlStatement(); } break; + case 14: case 21: case 26: case 27: @@ -1004,9 +1007,9 @@ export default class CashScriptParser extends Parser { case 82: this.enterOuterAlt(localctx, 2); { - this.state = 224; + this.state = 226; this.nonControlStatement(); - this.state = 225; + this.state = 227; this.match(CashScriptParser.T__1); } break; @@ -1033,62 +1036,62 @@ export default class CashScriptParser extends Parser { let localctx: NonControlStatementContext = new NonControlStatementContext(this, this._ctx, this.state); this.enterRule(localctx, 34, CashScriptParser.RULE_nonControlStatement); try { - this.state = 237; + this.state = 239; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 17, this._ctx) ) { case 1: this.enterOuterAlt(localctx, 1); { - this.state = 229; + this.state = 231; this.variableDefinition(); } break; case 2: this.enterOuterAlt(localctx, 2); { - this.state = 230; + this.state = 232; this.tupleAssignment(); } break; case 3: this.enterOuterAlt(localctx, 3); { - this.state = 231; + this.state = 233; this.assignStatement(); } break; case 4: this.enterOuterAlt(localctx, 4); { - this.state = 232; + this.state = 234; this.timeOpStatement(); } break; case 5: this.enterOuterAlt(localctx, 5); { - this.state = 233; + this.state = 235; this.requireStatement(); } break; case 6: this.enterOuterAlt(localctx, 6); { - this.state = 234; + this.state = 236; this.functionCallStatement(); } break; case 7: this.enterOuterAlt(localctx, 7); { - this.state = 235; + this.state = 237; this.consoleStatement(); } break; case 8: this.enterOuterAlt(localctx, 8); { - this.state = 236; + this.state = 238; this.returnStatement(); } break; @@ -1115,7 +1118,7 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 239; + this.state = 241; this.functionCall(); } } @@ -1141,23 +1144,23 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 241; + this.state = 243; this.match(CashScriptParser.T__20); - this.state = 242; + this.state = 244; this.expression(0); - this.state = 247; + this.state = 249; this._errHandler.sync(this); _la = this._input.LA(1); while (_la===15) { { { - this.state = 243; + this.state = 245; this.match(CashScriptParser.T__14); - this.state = 244; + this.state = 246; this.expression(0); } } - this.state = 249; + this.state = 251; this._errHandler.sync(this); _la = this._input.LA(1); } @@ -1182,13 +1185,13 @@ export default class CashScriptParser extends Parser { let localctx: ControlStatementContext = new ControlStatementContext(this, this._ctx, this.state); this.enterRule(localctx, 40, CashScriptParser.RULE_controlStatement); try { - this.state = 252; + this.state = 254; this._errHandler.sync(this); switch (this._input.LA(1)) { case 28: this.enterOuterAlt(localctx, 1); { - this.state = 250; + this.state = 252; this.ifStatement(); } break; @@ -1197,7 +1200,7 @@ export default class CashScriptParser extends Parser { case 32: this.enterOuterAlt(localctx, 2); { - this.state = 251; + this.state = 253; this.loopStatement(); } break; @@ -1227,27 +1230,27 @@ export default class CashScriptParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 254; + this.state = 256; this.typeName(); - this.state = 258; + this.state = 260; this._errHandler.sync(this); _la = this._input.LA(1); while (_la===17 || _la===65) { { { - this.state = 255; + this.state = 257; this.modifier(); } } - this.state = 260; + this.state = 262; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 261; + this.state = 263; this.match(CashScriptParser.Identifier); - this.state = 262; + this.state = 264; this.match(CashScriptParser.T__9); - this.state = 263; + this.state = 265; this.expression(0); } } @@ -1271,34 +1274,116 @@ export default class CashScriptParser extends Parser { this.enterRule(localctx, 44, CashScriptParser.RULE_tupleAssignment); let _la: number; try { - this.enterOuterAlt(localctx, 1); - { - this.state = 265; - this.typeName(); - this.state = 266; - this.match(CashScriptParser.Identifier); - this.state = 271; + this.state = 289; this._errHandler.sync(this); - _la = this._input.LA(1); - do { - { + switch (this._input.LA(1)) { + case 72: + case 73: + case 74: + case 82: + this.enterOuterAlt(localctx, 1); { this.state = 267; - this.match(CashScriptParser.T__14); - this.state = 268; + this.tupleTarget(); + this.state = 270; + this._errHandler.sync(this); + _la = this._input.LA(1); + do { + { + { + this.state = 268; + this.match(CashScriptParser.T__14); + this.state = 269; + this.tupleTarget(); + } + } + this.state = 272; + this._errHandler.sync(this); + _la = this._input.LA(1); + } while (_la===15); + this.state = 274; + this.match(CashScriptParser.T__9); + this.state = 275; + this.expression(0); + } + break; + case 14: + this.enterOuterAlt(localctx, 2); + { + this.state = 277; + this.match(CashScriptParser.T__13); + this.state = 278; + this.tupleTarget(); + this.state = 281; + this._errHandler.sync(this); + _la = this._input.LA(1); + do { + { + { + this.state = 279; + this.match(CashScriptParser.T__14); + this.state = 280; + this.tupleTarget(); + } + } + this.state = 283; + this._errHandler.sync(this); + _la = this._input.LA(1); + } while (_la===15); + this.state = 285; + this.match(CashScriptParser.T__15); + this.state = 286; + this.match(CashScriptParser.T__9); + this.state = 287; + this.expression(0); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (re) { + if (re instanceof RecognitionException) { + localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return localctx; + } + // @RuleVersion(0) + public tupleTarget(): TupleTargetContext { + let localctx: TupleTargetContext = new TupleTargetContext(this, this._ctx, this.state); + this.enterRule(localctx, 46, CashScriptParser.RULE_tupleTarget); + try { + this.state = 295; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case 72: + case 73: + case 74: + this.enterOuterAlt(localctx, 1); + { + this.state = 291; this.typeName(); - this.state = 269; + this.state = 292; this.match(CashScriptParser.Identifier); } + break; + case 82: + this.enterOuterAlt(localctx, 2); + { + this.state = 294; + this.match(CashScriptParser.Identifier); } - this.state = 273; - this._errHandler.sync(this); - _la = this._input.LA(1); - } while (_la===15); - this.state = 275; - this.match(CashScriptParser.T__9); - this.state = 276; - this.expression(0); + break; + default: + throw new NoViableAltException(this); } } catch (re) { @@ -1318,18 +1403,18 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public assignStatement(): AssignStatementContext { let localctx: AssignStatementContext = new AssignStatementContext(this, this._ctx, this.state); - this.enterRule(localctx, 46, CashScriptParser.RULE_assignStatement); + this.enterRule(localctx, 48, CashScriptParser.RULE_assignStatement); let _la: number; try { - this.state = 283; + this.state = 302; this._errHandler.sync(this); - switch ( this._interp.adaptivePredict(this._input, 22, this._ctx) ) { + switch ( this._interp.adaptivePredict(this._input, 25, this._ctx) ) { case 1: this.enterOuterAlt(localctx, 1); { - this.state = 278; + this.state = 297; this.match(CashScriptParser.Identifier); - this.state = 279; + this.state = 298; localctx._op = this._input.LT(1); _la = this._input.LA(1); if(!((((_la) & ~0x1F) === 0 && ((1 << _la) & 12583936) !== 0))) { @@ -1339,16 +1424,16 @@ export default class CashScriptParser extends Parser { this._errHandler.reportMatch(this); this.consume(); } - this.state = 280; + this.state = 299; this.expression(0); } break; case 2: this.enterOuterAlt(localctx, 2); { - this.state = 281; + this.state = 300; this.match(CashScriptParser.Identifier); - this.state = 282; + this.state = 301; localctx._op = this._input.LT(1); _la = this._input.LA(1); if(!(_la===24 || _la===25)) { @@ -1379,34 +1464,34 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public timeOpStatement(): TimeOpStatementContext { let localctx: TimeOpStatementContext = new TimeOpStatementContext(this, this._ctx, this.state); - this.enterRule(localctx, 48, CashScriptParser.RULE_timeOpStatement); + this.enterRule(localctx, 50, CashScriptParser.RULE_timeOpStatement); let _la: number; try { this.enterOuterAlt(localctx, 1); { - this.state = 285; + this.state = 304; this.match(CashScriptParser.T__25); - this.state = 286; + this.state = 305; this.match(CashScriptParser.T__13); - this.state = 287; + this.state = 306; this.match(CashScriptParser.TxVar); - this.state = 288; + this.state = 307; this.match(CashScriptParser.T__5); - this.state = 289; + this.state = 308; this.expression(0); - this.state = 292; + this.state = 311; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===15) { { - this.state = 290; + this.state = 309; this.match(CashScriptParser.T__14); - this.state = 291; + this.state = 310; this.requireMessage(); } } - this.state = 294; + this.state = 313; this.match(CashScriptParser.T__15); } } @@ -1427,30 +1512,30 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public requireStatement(): RequireStatementContext { let localctx: RequireStatementContext = new RequireStatementContext(this, this._ctx, this.state); - this.enterRule(localctx, 50, CashScriptParser.RULE_requireStatement); + this.enterRule(localctx, 52, CashScriptParser.RULE_requireStatement); let _la: number; try { this.enterOuterAlt(localctx, 1); { - this.state = 296; + this.state = 315; this.match(CashScriptParser.T__25); - this.state = 297; + this.state = 316; this.match(CashScriptParser.T__13); - this.state = 298; + this.state = 317; this.expression(0); - this.state = 301; + this.state = 320; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===15) { { - this.state = 299; + this.state = 318; this.match(CashScriptParser.T__14); - this.state = 300; + this.state = 319; this.requireMessage(); } } - this.state = 303; + this.state = 322; this.match(CashScriptParser.T__15); } } @@ -1471,13 +1556,13 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public consoleStatement(): ConsoleStatementContext { let localctx: ConsoleStatementContext = new ConsoleStatementContext(this, this._ctx, this.state); - this.enterRule(localctx, 52, CashScriptParser.RULE_consoleStatement); + this.enterRule(localctx, 54, CashScriptParser.RULE_consoleStatement); try { this.enterOuterAlt(localctx, 1); { - this.state = 305; + this.state = 324; this.match(CashScriptParser.T__26); - this.state = 306; + this.state = 325; this.consoleParameterList(); } } @@ -1498,28 +1583,28 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public ifStatement(): IfStatementContext { let localctx: IfStatementContext = new IfStatementContext(this, this._ctx, this.state); - this.enterRule(localctx, 54, CashScriptParser.RULE_ifStatement); + this.enterRule(localctx, 56, CashScriptParser.RULE_ifStatement); try { this.enterOuterAlt(localctx, 1); { - this.state = 308; + this.state = 327; this.match(CashScriptParser.T__27); - this.state = 309; + this.state = 328; this.match(CashScriptParser.T__13); - this.state = 310; + this.state = 329; this.expression(0); - this.state = 311; + this.state = 330; this.match(CashScriptParser.T__15); - this.state = 312; + this.state = 331; localctx._ifBlock = this.block(); - this.state = 315; + this.state = 334; this._errHandler.sync(this); - switch ( this._interp.adaptivePredict(this._input, 25, this._ctx) ) { + switch ( this._interp.adaptivePredict(this._input, 28, this._ctx) ) { case 1: { - this.state = 313; + this.state = 332; this.match(CashScriptParser.T__28); - this.state = 314; + this.state = 333; localctx._elseBlock = this.block(); } break; @@ -1543,29 +1628,29 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public loopStatement(): LoopStatementContext { let localctx: LoopStatementContext = new LoopStatementContext(this, this._ctx, this.state); - this.enterRule(localctx, 56, CashScriptParser.RULE_loopStatement); + this.enterRule(localctx, 58, CashScriptParser.RULE_loopStatement); try { - this.state = 320; + this.state = 339; this._errHandler.sync(this); switch (this._input.LA(1)) { case 30: this.enterOuterAlt(localctx, 1); { - this.state = 317; + this.state = 336; this.doWhileStatement(); } break; case 31: this.enterOuterAlt(localctx, 2); { - this.state = 318; + this.state = 337; this.whileStatement(); } break; case 32: this.enterOuterAlt(localctx, 3); { - this.state = 319; + this.state = 338; this.forStatement(); } break; @@ -1590,23 +1675,23 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public doWhileStatement(): DoWhileStatementContext { let localctx: DoWhileStatementContext = new DoWhileStatementContext(this, this._ctx, this.state); - this.enterRule(localctx, 58, CashScriptParser.RULE_doWhileStatement); + this.enterRule(localctx, 60, CashScriptParser.RULE_doWhileStatement); try { this.enterOuterAlt(localctx, 1); { - this.state = 322; + this.state = 341; this.match(CashScriptParser.T__29); - this.state = 323; + this.state = 342; this.block(); - this.state = 324; + this.state = 343; this.match(CashScriptParser.T__30); - this.state = 325; + this.state = 344; this.match(CashScriptParser.T__13); - this.state = 326; + this.state = 345; this.expression(0); - this.state = 327; + this.state = 346; this.match(CashScriptParser.T__15); - this.state = 328; + this.state = 347; this.match(CashScriptParser.T__1); } } @@ -1627,19 +1712,19 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public whileStatement(): WhileStatementContext { let localctx: WhileStatementContext = new WhileStatementContext(this, this._ctx, this.state); - this.enterRule(localctx, 60, CashScriptParser.RULE_whileStatement); + this.enterRule(localctx, 62, CashScriptParser.RULE_whileStatement); try { this.enterOuterAlt(localctx, 1); { - this.state = 330; + this.state = 349; this.match(CashScriptParser.T__30); - this.state = 331; + this.state = 350; this.match(CashScriptParser.T__13); - this.state = 332; + this.state = 351; this.expression(0); - this.state = 333; + this.state = 352; this.match(CashScriptParser.T__15); - this.state = 334; + this.state = 353; this.block(); } } @@ -1660,27 +1745,27 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public forStatement(): ForStatementContext { let localctx: ForStatementContext = new ForStatementContext(this, this._ctx, this.state); - this.enterRule(localctx, 62, CashScriptParser.RULE_forStatement); + this.enterRule(localctx, 64, CashScriptParser.RULE_forStatement); try { this.enterOuterAlt(localctx, 1); { - this.state = 336; + this.state = 355; this.match(CashScriptParser.T__31); - this.state = 337; + this.state = 356; this.match(CashScriptParser.T__13); - this.state = 338; + this.state = 357; this.forInit(); - this.state = 339; + this.state = 358; this.match(CashScriptParser.T__1); - this.state = 340; + this.state = 359; this.expression(0); - this.state = 341; + this.state = 360; this.match(CashScriptParser.T__1); - this.state = 342; + this.state = 361; this.assignStatement(); - this.state = 343; + this.state = 362; this.match(CashScriptParser.T__15); - this.state = 344; + this.state = 363; this.block(); } } @@ -1701,9 +1786,9 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public forInit(): ForInitContext { let localctx: ForInitContext = new ForInitContext(this, this._ctx, this.state); - this.enterRule(localctx, 64, CashScriptParser.RULE_forInit); + this.enterRule(localctx, 66, CashScriptParser.RULE_forInit); try { - this.state = 348; + this.state = 367; this._errHandler.sync(this); switch (this._input.LA(1)) { case 72: @@ -1711,14 +1796,14 @@ export default class CashScriptParser extends Parser { case 74: this.enterOuterAlt(localctx, 1); { - this.state = 346; + this.state = 365; this.variableDefinition(); } break; case 82: this.enterOuterAlt(localctx, 2); { - this.state = 347; + this.state = 366; this.assignStatement(); } break; @@ -1743,11 +1828,11 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public requireMessage(): RequireMessageContext { let localctx: RequireMessageContext = new RequireMessageContext(this, this._ctx, this.state); - this.enterRule(localctx, 66, CashScriptParser.RULE_requireMessage); + this.enterRule(localctx, 68, CashScriptParser.RULE_requireMessage); try { this.enterOuterAlt(localctx, 1); { - this.state = 350; + this.state = 369; this.match(CashScriptParser.StringLiteral); } } @@ -1768,15 +1853,15 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public consoleParameter(): ConsoleParameterContext { let localctx: ConsoleParameterContext = new ConsoleParameterContext(this, this._ctx, this.state); - this.enterRule(localctx, 68, CashScriptParser.RULE_consoleParameter); + this.enterRule(localctx, 70, CashScriptParser.RULE_consoleParameter); try { - this.state = 354; + this.state = 373; this._errHandler.sync(this); switch (this._input.LA(1)) { case 82: this.enterOuterAlt(localctx, 1); { - this.state = 352; + this.state = 371; this.match(CashScriptParser.Identifier); } break; @@ -1787,7 +1872,7 @@ export default class CashScriptParser extends Parser { case 78: this.enterOuterAlt(localctx, 2); { - this.state = 353; + this.state = 372; this.literal(); } break; @@ -1812,45 +1897,45 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public consoleParameterList(): ConsoleParameterListContext { let localctx: ConsoleParameterListContext = new ConsoleParameterListContext(this, this._ctx, this.state); - this.enterRule(localctx, 70, CashScriptParser.RULE_consoleParameterList); + this.enterRule(localctx, 72, CashScriptParser.RULE_consoleParameterList); let _la: number; try { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 356; + this.state = 375; this.match(CashScriptParser.T__13); - this.state = 368; + this.state = 387; this._errHandler.sync(this); _la = this._input.LA(1); if (((((_la - 67)) & ~0x1F) === 0 && ((1 << (_la - 67)) & 36357) !== 0)) { { - this.state = 357; + this.state = 376; this.consoleParameter(); - this.state = 362; + this.state = 381; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 29, this._ctx); + _alt = this._interp.adaptivePredict(this._input, 32, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 358; + this.state = 377; this.match(CashScriptParser.T__14); - this.state = 359; + this.state = 378; this.consoleParameter(); } } } - this.state = 364; + this.state = 383; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 29, this._ctx); + _alt = this._interp.adaptivePredict(this._input, 32, this._ctx); } - this.state = 366; + this.state = 385; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===15) { { - this.state = 365; + this.state = 384; this.match(CashScriptParser.T__14); } } @@ -1858,7 +1943,7 @@ export default class CashScriptParser extends Parser { } } - this.state = 370; + this.state = 389; this.match(CashScriptParser.T__15); } } @@ -1879,13 +1964,13 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public functionCall(): FunctionCallContext { let localctx: FunctionCallContext = new FunctionCallContext(this, this._ctx, this.state); - this.enterRule(localctx, 72, CashScriptParser.RULE_functionCall); + this.enterRule(localctx, 74, CashScriptParser.RULE_functionCall); try { this.enterOuterAlt(localctx, 1); { - this.state = 372; + this.state = 391; this.match(CashScriptParser.Identifier); - this.state = 373; + this.state = 392; this.expressionList(); } } @@ -1906,45 +1991,45 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public expressionList(): ExpressionListContext { let localctx: ExpressionListContext = new ExpressionListContext(this, this._ctx, this.state); - this.enterRule(localctx, 74, CashScriptParser.RULE_expressionList); + this.enterRule(localctx, 76, CashScriptParser.RULE_expressionList); let _la: number; try { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 375; + this.state = 394; this.match(CashScriptParser.T__13); - this.state = 387; + this.state = 406; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===5 || _la===14 || ((((_la - 33)) & ~0x1F) === 0 && ((1 << (_la - 33)) & 786955) !== 0) || ((((_la - 67)) & ~0x1F) === 0 && ((1 << (_la - 67)) & 61029) !== 0)) { { - this.state = 376; + this.state = 395; this.expression(0); - this.state = 381; + this.state = 400; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 32, this._ctx); + _alt = this._interp.adaptivePredict(this._input, 35, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 377; + this.state = 396; this.match(CashScriptParser.T__14); - this.state = 378; + this.state = 397; this.expression(0); } } } - this.state = 383; + this.state = 402; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 32, this._ctx); + _alt = this._interp.adaptivePredict(this._input, 35, this._ctx); } - this.state = 385; + this.state = 404; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===15) { { - this.state = 384; + this.state = 403; this.match(CashScriptParser.T__14); } } @@ -1952,7 +2037,7 @@ export default class CashScriptParser extends Parser { } } - this.state = 389; + this.state = 408; this.match(CashScriptParser.T__15); } } @@ -1983,27 +2068,27 @@ export default class CashScriptParser extends Parser { let _parentState: number = this.state; let localctx: ExpressionContext = new ExpressionContext(this, this._ctx, _parentState); let _prevctx: ExpressionContext = localctx; - let _startState: number = 76; - this.enterRecursionRule(localctx, 76, CashScriptParser.RULE_expression, _p); + let _startState: number = 78; + this.enterRecursionRule(localctx, 78, CashScriptParser.RULE_expression, _p); let _la: number; try { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 440; + this.state = 459; this._errHandler.sync(this); - switch ( this._interp.adaptivePredict(this._input, 39, this._ctx) ) { + switch ( this._interp.adaptivePredict(this._input, 42, this._ctx) ) { case 1: { localctx = new ParenthesisedContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 392; + this.state = 411; this.match(CashScriptParser.T__13); - this.state = 393; + this.state = 412; this.expression(0); - this.state = 394; + this.state = 413; this.match(CashScriptParser.T__15); } break; @@ -2012,23 +2097,23 @@ export default class CashScriptParser extends Parser { localctx = new CastContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 396; + this.state = 415; this.typeCast(); - this.state = 397; + this.state = 416; this.match(CashScriptParser.T__13); - this.state = 398; + this.state = 417; (localctx as CastContext)._castable = this.expression(0); - this.state = 400; + this.state = 419; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===15) { { - this.state = 399; + this.state = 418; this.match(CashScriptParser.T__14); } } - this.state = 402; + this.state = 421; this.match(CashScriptParser.T__15); } break; @@ -2037,7 +2122,7 @@ export default class CashScriptParser extends Parser { localctx = new FunctionCallExpressionContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 404; + this.state = 423; this.functionCall(); } break; @@ -2046,11 +2131,11 @@ export default class CashScriptParser extends Parser { localctx = new InstantiationContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 405; + this.state = 424; this.match(CashScriptParser.T__32); - this.state = 406; + this.state = 425; this.match(CashScriptParser.Identifier); - this.state = 407; + this.state = 426; this.expressionList(); } break; @@ -2059,15 +2144,15 @@ export default class CashScriptParser extends Parser { localctx = new UnaryIntrospectionOpContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 408; + this.state = 427; (localctx as UnaryIntrospectionOpContext)._scope = this.match(CashScriptParser.T__35); - this.state = 409; + this.state = 428; this.match(CashScriptParser.T__33); - this.state = 410; + this.state = 429; this.expression(0); - this.state = 411; + this.state = 430; this.match(CashScriptParser.T__34); - this.state = 412; + this.state = 431; (localctx as UnaryIntrospectionOpContext)._op = this._input.LT(1); _la = this._input.LA(1); if(!(((((_la - 37)) & ~0x1F) === 0 && ((1 << (_la - 37)) & 31) !== 0))) { @@ -2084,15 +2169,15 @@ export default class CashScriptParser extends Parser { localctx = new UnaryIntrospectionOpContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 414; + this.state = 433; (localctx as UnaryIntrospectionOpContext)._scope = this.match(CashScriptParser.T__41); - this.state = 415; + this.state = 434; this.match(CashScriptParser.T__33); - this.state = 416; + this.state = 435; this.expression(0); - this.state = 417; + this.state = 436; this.match(CashScriptParser.T__34); - this.state = 418; + this.state = 437; (localctx as UnaryIntrospectionOpContext)._op = this._input.LT(1); _la = this._input.LA(1); if(!(((((_la - 37)) & ~0x1F) === 0 && ((1 << (_la - 37)) & 991) !== 0))) { @@ -2109,7 +2194,7 @@ export default class CashScriptParser extends Parser { localctx = new UnaryOpContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 420; + this.state = 439; (localctx as UnaryOpContext)._op = this._input.LT(1); _la = this._input.LA(1); if(!(_la===5 || _la===51 || _la===52)) { @@ -2119,7 +2204,7 @@ export default class CashScriptParser extends Parser { this._errHandler.reportMatch(this); this.consume(); } - this.state = 421; + this.state = 440; this.expression(15); } break; @@ -2128,39 +2213,39 @@ export default class CashScriptParser extends Parser { localctx = new ArrayContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 422; + this.state = 441; this.match(CashScriptParser.T__33); - this.state = 434; + this.state = 453; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===5 || _la===14 || ((((_la - 33)) & ~0x1F) === 0 && ((1 << (_la - 33)) & 786955) !== 0) || ((((_la - 67)) & ~0x1F) === 0 && ((1 << (_la - 67)) & 61029) !== 0)) { { - this.state = 423; + this.state = 442; this.expression(0); - this.state = 428; + this.state = 447; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 36, this._ctx); + _alt = this._interp.adaptivePredict(this._input, 39, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 424; + this.state = 443; this.match(CashScriptParser.T__14); - this.state = 425; + this.state = 444; this.expression(0); } } } - this.state = 430; + this.state = 449; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 36, this._ctx); + _alt = this._interp.adaptivePredict(this._input, 39, this._ctx); } - this.state = 432; + this.state = 451; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===15) { { - this.state = 431; + this.state = 450; this.match(CashScriptParser.T__14); } } @@ -2168,7 +2253,7 @@ export default class CashScriptParser extends Parser { } } - this.state = 436; + this.state = 455; this.match(CashScriptParser.T__34); } break; @@ -2177,7 +2262,7 @@ export default class CashScriptParser extends Parser { localctx = new NullaryOpContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 437; + this.state = 456; this.match(CashScriptParser.NullaryOp); } break; @@ -2186,7 +2271,7 @@ export default class CashScriptParser extends Parser { localctx = new IdentifierContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 438; + this.state = 457; this.match(CashScriptParser.Identifier); } break; @@ -2195,15 +2280,15 @@ export default class CashScriptParser extends Parser { localctx = new LiteralExpressionContext(this, localctx); this._ctx = localctx; _prevctx = localctx; - this.state = 439; + this.state = 458; this.literal(); } break; } this._ctx.stop = this._input.LT(-1); - this.state = 494; + this.state = 513; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 41, this._ctx); + _alt = this._interp.adaptivePredict(this._input, 44, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { if (this._parseListeners != null) { @@ -2211,19 +2296,19 @@ export default class CashScriptParser extends Parser { } _prevctx = localctx; { - this.state = 492; + this.state = 511; this._errHandler.sync(this); - switch ( this._interp.adaptivePredict(this._input, 40, this._ctx) ) { + switch ( this._interp.adaptivePredict(this._input, 43, this._ctx) ) { case 1: { localctx = new BinaryOpContext(this, new ExpressionContext(this, _parentctx, _parentState)); (localctx as BinaryOpContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, CashScriptParser.RULE_expression); - this.state = 442; + this.state = 461; if (!(this.precpred(this._ctx, 14))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 14)"); } - this.state = 443; + this.state = 462; (localctx as BinaryOpContext)._op = this._input.LT(1); _la = this._input.LA(1); if(!(((((_la - 53)) & ~0x1F) === 0 && ((1 << (_la - 53)) & 7) !== 0))) { @@ -2233,7 +2318,7 @@ export default class CashScriptParser extends Parser { this._errHandler.reportMatch(this); this.consume(); } - this.state = 444; + this.state = 463; (localctx as BinaryOpContext)._right = this.expression(15); } break; @@ -2242,11 +2327,11 @@ export default class CashScriptParser extends Parser { localctx = new BinaryOpContext(this, new ExpressionContext(this, _parentctx, _parentState)); (localctx as BinaryOpContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, CashScriptParser.RULE_expression); - this.state = 445; + this.state = 464; if (!(this.precpred(this._ctx, 13))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 13)"); } - this.state = 446; + this.state = 465; (localctx as BinaryOpContext)._op = this._input.LT(1); _la = this._input.LA(1); if(!(_la===52 || _la===56)) { @@ -2256,7 +2341,7 @@ export default class CashScriptParser extends Parser { this._errHandler.reportMatch(this); this.consume(); } - this.state = 447; + this.state = 466; (localctx as BinaryOpContext)._right = this.expression(14); } break; @@ -2265,11 +2350,11 @@ export default class CashScriptParser extends Parser { localctx = new BinaryOpContext(this, new ExpressionContext(this, _parentctx, _parentState)); (localctx as BinaryOpContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, CashScriptParser.RULE_expression); - this.state = 448; + this.state = 467; if (!(this.precpred(this._ctx, 12))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 12)"); } - this.state = 449; + this.state = 468; (localctx as BinaryOpContext)._op = this._input.LT(1); _la = this._input.LA(1); if(!(_la===57 || _la===58)) { @@ -2279,7 +2364,7 @@ export default class CashScriptParser extends Parser { this._errHandler.reportMatch(this); this.consume(); } - this.state = 450; + this.state = 469; (localctx as BinaryOpContext)._right = this.expression(13); } break; @@ -2288,11 +2373,11 @@ export default class CashScriptParser extends Parser { localctx = new BinaryOpContext(this, new ExpressionContext(this, _parentctx, _parentState)); (localctx as BinaryOpContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, CashScriptParser.RULE_expression); - this.state = 451; + this.state = 470; if (!(this.precpred(this._ctx, 11))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 11)"); } - this.state = 452; + this.state = 471; (localctx as BinaryOpContext)._op = this._input.LT(1); _la = this._input.LA(1); if(!((((_la) & ~0x1F) === 0 && ((1 << _la) & 960) !== 0))) { @@ -2302,7 +2387,7 @@ export default class CashScriptParser extends Parser { this._errHandler.reportMatch(this); this.consume(); } - this.state = 453; + this.state = 472; (localctx as BinaryOpContext)._right = this.expression(12); } break; @@ -2311,11 +2396,11 @@ export default class CashScriptParser extends Parser { localctx = new BinaryOpContext(this, new ExpressionContext(this, _parentctx, _parentState)); (localctx as BinaryOpContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, CashScriptParser.RULE_expression); - this.state = 454; + this.state = 473; if (!(this.precpred(this._ctx, 10))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 10)"); } - this.state = 455; + this.state = 474; (localctx as BinaryOpContext)._op = this._input.LT(1); _la = this._input.LA(1); if(!(_la===59 || _la===60)) { @@ -2325,7 +2410,7 @@ export default class CashScriptParser extends Parser { this._errHandler.reportMatch(this); this.consume(); } - this.state = 456; + this.state = 475; (localctx as BinaryOpContext)._right = this.expression(11); } break; @@ -2334,13 +2419,13 @@ export default class CashScriptParser extends Parser { localctx = new BinaryOpContext(this, new ExpressionContext(this, _parentctx, _parentState)); (localctx as BinaryOpContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, CashScriptParser.RULE_expression); - this.state = 457; + this.state = 476; if (!(this.precpred(this._ctx, 9))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 9)"); } - this.state = 458; + this.state = 477; (localctx as BinaryOpContext)._op = this.match(CashScriptParser.T__60); - this.state = 459; + this.state = 478; (localctx as BinaryOpContext)._right = this.expression(10); } break; @@ -2349,13 +2434,13 @@ export default class CashScriptParser extends Parser { localctx = new BinaryOpContext(this, new ExpressionContext(this, _parentctx, _parentState)); (localctx as BinaryOpContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, CashScriptParser.RULE_expression); - this.state = 460; + this.state = 479; if (!(this.precpred(this._ctx, 8))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 8)"); } - this.state = 461; + this.state = 480; (localctx as BinaryOpContext)._op = this.match(CashScriptParser.T__3); - this.state = 462; + this.state = 481; (localctx as BinaryOpContext)._right = this.expression(9); } break; @@ -2364,13 +2449,13 @@ export default class CashScriptParser extends Parser { localctx = new BinaryOpContext(this, new ExpressionContext(this, _parentctx, _parentState)); (localctx as BinaryOpContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, CashScriptParser.RULE_expression); - this.state = 463; + this.state = 482; if (!(this.precpred(this._ctx, 7))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 7)"); } - this.state = 464; + this.state = 483; (localctx as BinaryOpContext)._op = this.match(CashScriptParser.T__61); - this.state = 465; + this.state = 484; (localctx as BinaryOpContext)._right = this.expression(8); } break; @@ -2379,13 +2464,13 @@ export default class CashScriptParser extends Parser { localctx = new BinaryOpContext(this, new ExpressionContext(this, _parentctx, _parentState)); (localctx as BinaryOpContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, CashScriptParser.RULE_expression); - this.state = 466; + this.state = 485; if (!(this.precpred(this._ctx, 6))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 6)"); } - this.state = 467; + this.state = 486; (localctx as BinaryOpContext)._op = this.match(CashScriptParser.T__62); - this.state = 468; + this.state = 487; (localctx as BinaryOpContext)._right = this.expression(7); } break; @@ -2394,13 +2479,13 @@ export default class CashScriptParser extends Parser { localctx = new BinaryOpContext(this, new ExpressionContext(this, _parentctx, _parentState)); (localctx as BinaryOpContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, CashScriptParser.RULE_expression); - this.state = 469; + this.state = 488; if (!(this.precpred(this._ctx, 5))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 5)"); } - this.state = 470; + this.state = 489; (localctx as BinaryOpContext)._op = this.match(CashScriptParser.T__63); - this.state = 471; + this.state = 490; (localctx as BinaryOpContext)._right = this.expression(6); } break; @@ -2408,15 +2493,15 @@ export default class CashScriptParser extends Parser { { localctx = new TupleIndexOpContext(this, new ExpressionContext(this, _parentctx, _parentState)); this.pushNewRecursionContext(localctx, _startState, CashScriptParser.RULE_expression); - this.state = 472; + this.state = 491; if (!(this.precpred(this._ctx, 21))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 21)"); } - this.state = 473; + this.state = 492; this.match(CashScriptParser.T__33); - this.state = 474; + this.state = 493; (localctx as TupleIndexOpContext)._index = this.match(CashScriptParser.NumberLiteral); - this.state = 475; + this.state = 494; this.match(CashScriptParser.T__34); } break; @@ -2424,11 +2509,11 @@ export default class CashScriptParser extends Parser { { localctx = new UnaryOpContext(this, new ExpressionContext(this, _parentctx, _parentState)); this.pushNewRecursionContext(localctx, _startState, CashScriptParser.RULE_expression); - this.state = 476; + this.state = 495; if (!(this.precpred(this._ctx, 18))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 18)"); } - this.state = 477; + this.state = 496; (localctx as UnaryOpContext)._op = this._input.LT(1); _la = this._input.LA(1); if(!(_la===47 || _la===48)) { @@ -2445,17 +2530,17 @@ export default class CashScriptParser extends Parser { localctx = new BinaryOpContext(this, new ExpressionContext(this, _parentctx, _parentState)); (localctx as BinaryOpContext)._left = _prevctx; this.pushNewRecursionContext(localctx, _startState, CashScriptParser.RULE_expression); - this.state = 478; + this.state = 497; if (!(this.precpred(this._ctx, 17))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 17)"); } - this.state = 479; + this.state = 498; (localctx as BinaryOpContext)._op = this.match(CashScriptParser.T__48); - this.state = 480; + this.state = 499; this.match(CashScriptParser.T__13); - this.state = 481; + this.state = 500; (localctx as BinaryOpContext)._right = this.expression(0); - this.state = 482; + this.state = 501; this.match(CashScriptParser.T__15); } break; @@ -2464,30 +2549,30 @@ export default class CashScriptParser extends Parser { localctx = new SliceContext(this, new ExpressionContext(this, _parentctx, _parentState)); (localctx as SliceContext)._element = _prevctx; this.pushNewRecursionContext(localctx, _startState, CashScriptParser.RULE_expression); - this.state = 484; + this.state = 503; if (!(this.precpred(this._ctx, 16))) { throw this.createFailedPredicateException("this.precpred(this._ctx, 16)"); } - this.state = 485; + this.state = 504; this.match(CashScriptParser.T__49); - this.state = 486; + this.state = 505; this.match(CashScriptParser.T__13); - this.state = 487; + this.state = 506; (localctx as SliceContext)._start = this.expression(0); - this.state = 488; + this.state = 507; this.match(CashScriptParser.T__14); - this.state = 489; + this.state = 508; (localctx as SliceContext)._end = this.expression(0); - this.state = 490; + this.state = 509; this.match(CashScriptParser.T__15); } break; } } } - this.state = 496; + this.state = 515; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 41, this._ctx); + _alt = this._interp.adaptivePredict(this._input, 44, this._ctx); } } } @@ -2508,12 +2593,12 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public modifier(): ModifierContext { let localctx: ModifierContext = new ModifierContext(this, this._ctx, this.state); - this.enterRule(localctx, 78, CashScriptParser.RULE_modifier); + this.enterRule(localctx, 80, CashScriptParser.RULE_modifier); let _la: number; try { this.enterOuterAlt(localctx, 1); { - this.state = 497; + this.state = 516; _la = this._input.LA(1); if(!(_la===17 || _la===65)) { this._errHandler.recoverInline(this); @@ -2541,43 +2626,43 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public literal(): LiteralContext { let localctx: LiteralContext = new LiteralContext(this, this._ctx, this.state); - this.enterRule(localctx, 80, CashScriptParser.RULE_literal); + this.enterRule(localctx, 82, CashScriptParser.RULE_literal); try { - this.state = 504; + this.state = 523; this._errHandler.sync(this); switch (this._input.LA(1)) { case 67: this.enterOuterAlt(localctx, 1); { - this.state = 499; + this.state = 518; this.match(CashScriptParser.BooleanLiteral); } break; case 69: this.enterOuterAlt(localctx, 2); { - this.state = 500; + this.state = 519; this.numberLiteral(); } break; case 76: this.enterOuterAlt(localctx, 3); { - this.state = 501; + this.state = 520; this.match(CashScriptParser.StringLiteral); } break; case 77: this.enterOuterAlt(localctx, 4); { - this.state = 502; + this.state = 521; this.match(CashScriptParser.DateLiteral); } break; case 78: this.enterOuterAlt(localctx, 5); { - this.state = 503; + this.state = 522; this.match(CashScriptParser.HexLiteral); } break; @@ -2602,18 +2687,18 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public numberLiteral(): NumberLiteralContext { let localctx: NumberLiteralContext = new NumberLiteralContext(this, this._ctx, this.state); - this.enterRule(localctx, 82, CashScriptParser.RULE_numberLiteral); + this.enterRule(localctx, 84, CashScriptParser.RULE_numberLiteral); try { this.enterOuterAlt(localctx, 1); { - this.state = 506; + this.state = 525; this.match(CashScriptParser.NumberLiteral); - this.state = 508; + this.state = 527; this._errHandler.sync(this); - switch ( this._interp.adaptivePredict(this._input, 43, this._ctx) ) { + switch ( this._interp.adaptivePredict(this._input, 46, this._ctx) ) { case 1: { - this.state = 507; + this.state = 526; this.match(CashScriptParser.NumberUnit); } break; @@ -2637,12 +2722,12 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public typeName(): TypeNameContext { let localctx: TypeNameContext = new TypeNameContext(this, this._ctx, this.state); - this.enterRule(localctx, 84, CashScriptParser.RULE_typeName); + this.enterRule(localctx, 86, CashScriptParser.RULE_typeName); let _la: number; try { this.enterOuterAlt(localctx, 1); { - this.state = 510; + this.state = 529; _la = this._input.LA(1); if(!(((((_la - 72)) & ~0x1F) === 0 && ((1 << (_la - 72)) & 7) !== 0))) { this._errHandler.recoverInline(this); @@ -2670,12 +2755,12 @@ export default class CashScriptParser extends Parser { // @RuleVersion(0) public typeCast(): TypeCastContext { let localctx: TypeCastContext = new TypeCastContext(this, this._ctx, this.state); - this.enterRule(localctx, 86, CashScriptParser.RULE_typeCast); + this.enterRule(localctx, 88, CashScriptParser.RULE_typeCast); let _la: number; try { this.enterOuterAlt(localctx, 1); { - this.state = 512; + this.state = 531; _la = this._input.LA(1); if(!(((((_la - 72)) & ~0x1F) === 0 && ((1 << (_la - 72)) & 259) !== 0))) { this._errHandler.recoverInline(this); @@ -2703,7 +2788,7 @@ export default class CashScriptParser extends Parser { public sempred(localctx: RuleContext, ruleIndex: number, predIndex: number): boolean { switch (ruleIndex) { - case 38: + case 39: return this.expression_sempred(localctx as ExpressionContext, predIndex); } return true; @@ -2742,177 +2827,183 @@ export default class CashScriptParser extends Parser { return true; } - public static readonly _serializedATN: number[] = [4,1,85,515,2,0,7,0,2, + public static readonly _serializedATN: number[] = [4,1,85,534,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,1,0,5,0,90,8,0,10,0,12, - 0,93,9,0,1,0,5,0,96,8,0,10,0,12,0,99,9,0,1,0,5,0,102,8,0,10,0,12,0,105, - 9,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,3,1,3,3,3,118,8,3,1,4,3,4,121, - 8,4,1,4,1,4,1,5,1,5,1,6,1,6,1,6,1,6,1,7,1,7,1,7,3,7,134,8,7,1,8,1,8,1,8, - 1,8,1,8,1,8,1,8,1,8,5,8,144,8,8,10,8,12,8,147,9,8,1,8,1,8,3,8,151,8,8,1, - 8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,5,10,167,8,10, - 10,10,12,10,170,9,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,12,1,12,5,12, - 181,8,12,10,12,12,12,184,9,12,1,12,1,12,1,13,1,13,1,13,1,13,5,13,192,8, - 13,10,13,12,13,195,9,13,1,13,3,13,198,8,13,3,13,200,8,13,1,13,1,13,1,14, - 1,14,5,14,206,8,14,10,14,12,14,209,9,14,1,14,1,14,1,15,1,15,5,15,215,8, - 15,10,15,12,15,218,9,15,1,15,1,15,3,15,222,8,15,1,16,1,16,1,16,1,16,3,16, - 228,8,16,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,3,17,238,8,17,1,18,1,18, - 1,19,1,19,1,19,1,19,5,19,246,8,19,10,19,12,19,249,9,19,1,20,1,20,3,20,253, - 8,20,1,21,1,21,5,21,257,8,21,10,21,12,21,260,9,21,1,21,1,21,1,21,1,21,1, - 22,1,22,1,22,1,22,1,22,1,22,4,22,272,8,22,11,22,12,22,273,1,22,1,22,1,22, - 1,23,1,23,1,23,1,23,1,23,3,23,284,8,23,1,24,1,24,1,24,1,24,1,24,1,24,1, - 24,3,24,293,8,24,1,24,1,24,1,25,1,25,1,25,1,25,1,25,3,25,302,8,25,1,25, - 1,25,1,26,1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,27,1,27,3,27,316,8,27,1, - 28,1,28,1,28,3,28,321,8,28,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,30, - 1,30,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,31,1,31,1,31,1,31,1,31,1,31,1, - 31,1,32,1,32,3,32,349,8,32,1,33,1,33,1,34,1,34,3,34,355,8,34,1,35,1,35, - 1,35,1,35,5,35,361,8,35,10,35,12,35,364,9,35,1,35,3,35,367,8,35,3,35,369, - 8,35,1,35,1,35,1,36,1,36,1,36,1,37,1,37,1,37,1,37,5,37,380,8,37,10,37,12, - 37,383,9,37,1,37,3,37,386,8,37,3,37,388,8,37,1,37,1,37,1,38,1,38,1,38,1, - 38,1,38,1,38,1,38,1,38,1,38,3,38,401,8,38,1,38,1,38,1,38,1,38,1,38,1,38, - 1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1, - 38,1,38,1,38,1,38,5,38,427,8,38,10,38,12,38,430,9,38,1,38,3,38,433,8,38, - 3,38,435,8,38,1,38,1,38,1,38,1,38,3,38,441,8,38,1,38,1,38,1,38,1,38,1,38, - 1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1, - 38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38, - 1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1, - 38,1,38,5,38,493,8,38,10,38,12,38,496,9,38,1,39,1,39,1,40,1,40,1,40,1,40, - 1,40,3,40,505,8,40,1,41,1,41,3,41,509,8,41,1,42,1,42,1,43,1,43,1,43,0,1, - 76,44,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46, - 48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,0,15,1,0,4, - 10,2,0,10,10,22,23,1,0,24,25,1,0,37,41,2,0,37,41,43,46,2,0,5,5,51,52,1, - 0,53,55,2,0,52,52,56,56,1,0,57,58,1,0,6,9,1,0,59,60,1,0,47,48,2,0,17,17, - 65,65,1,0,72,74,2,0,72,73,80,80,546,0,91,1,0,0,0,2,108,1,0,0,0,4,113,1, - 0,0,0,6,115,1,0,0,0,8,120,1,0,0,0,10,124,1,0,0,0,12,126,1,0,0,0,14,133, - 1,0,0,0,16,135,1,0,0,0,18,154,1,0,0,0,20,161,1,0,0,0,22,173,1,0,0,0,24, - 178,1,0,0,0,26,187,1,0,0,0,28,203,1,0,0,0,30,221,1,0,0,0,32,227,1,0,0,0, - 34,237,1,0,0,0,36,239,1,0,0,0,38,241,1,0,0,0,40,252,1,0,0,0,42,254,1,0, - 0,0,44,265,1,0,0,0,46,283,1,0,0,0,48,285,1,0,0,0,50,296,1,0,0,0,52,305, - 1,0,0,0,54,308,1,0,0,0,56,320,1,0,0,0,58,322,1,0,0,0,60,330,1,0,0,0,62, - 336,1,0,0,0,64,348,1,0,0,0,66,350,1,0,0,0,68,354,1,0,0,0,70,356,1,0,0,0, - 72,372,1,0,0,0,74,375,1,0,0,0,76,440,1,0,0,0,78,497,1,0,0,0,80,504,1,0, - 0,0,82,506,1,0,0,0,84,510,1,0,0,0,86,512,1,0,0,0,88,90,3,2,1,0,89,88,1, - 0,0,0,90,93,1,0,0,0,91,89,1,0,0,0,91,92,1,0,0,0,92,97,1,0,0,0,93,91,1,0, - 0,0,94,96,3,12,6,0,95,94,1,0,0,0,96,99,1,0,0,0,97,95,1,0,0,0,97,98,1,0, - 0,0,98,103,1,0,0,0,99,97,1,0,0,0,100,102,3,14,7,0,101,100,1,0,0,0,102,105, - 1,0,0,0,103,101,1,0,0,0,103,104,1,0,0,0,104,106,1,0,0,0,105,103,1,0,0,0, - 106,107,5,0,0,1,107,1,1,0,0,0,108,109,5,1,0,0,109,110,3,4,2,0,110,111,3, - 6,3,0,111,112,5,2,0,0,112,3,1,0,0,0,113,114,5,3,0,0,114,5,1,0,0,0,115,117, - 3,8,4,0,116,118,3,8,4,0,117,116,1,0,0,0,117,118,1,0,0,0,118,7,1,0,0,0,119, - 121,3,10,5,0,120,119,1,0,0,0,120,121,1,0,0,0,121,122,1,0,0,0,122,123,5, - 66,0,0,123,9,1,0,0,0,124,125,7,0,0,0,125,11,1,0,0,0,126,127,5,11,0,0,127, - 128,5,76,0,0,128,129,5,2,0,0,129,13,1,0,0,0,130,134,3,16,8,0,131,134,3, - 18,9,0,132,134,3,20,10,0,133,130,1,0,0,0,133,131,1,0,0,0,133,132,1,0,0, - 0,134,15,1,0,0,0,135,136,5,12,0,0,136,137,5,82,0,0,137,150,3,26,13,0,138, - 139,5,13,0,0,139,140,5,14,0,0,140,145,3,84,42,0,141,142,5,15,0,0,142,144, - 3,84,42,0,143,141,1,0,0,0,144,147,1,0,0,0,145,143,1,0,0,0,145,146,1,0,0, - 0,146,148,1,0,0,0,147,145,1,0,0,0,148,149,5,16,0,0,149,151,1,0,0,0,150, - 138,1,0,0,0,150,151,1,0,0,0,151,152,1,0,0,0,152,153,3,24,12,0,153,17,1, - 0,0,0,154,155,3,84,42,0,155,156,5,17,0,0,156,157,5,82,0,0,157,158,5,10, - 0,0,158,159,3,76,38,0,159,160,5,2,0,0,160,19,1,0,0,0,161,162,5,18,0,0,162, - 163,5,82,0,0,163,164,3,26,13,0,164,168,5,19,0,0,165,167,3,22,11,0,166,165, - 1,0,0,0,167,170,1,0,0,0,168,166,1,0,0,0,168,169,1,0,0,0,169,171,1,0,0,0, - 170,168,1,0,0,0,171,172,5,20,0,0,172,21,1,0,0,0,173,174,5,12,0,0,174,175, - 5,82,0,0,175,176,3,26,13,0,176,177,3,24,12,0,177,23,1,0,0,0,178,182,5,19, - 0,0,179,181,3,32,16,0,180,179,1,0,0,0,181,184,1,0,0,0,182,180,1,0,0,0,182, - 183,1,0,0,0,183,185,1,0,0,0,184,182,1,0,0,0,185,186,5,20,0,0,186,25,1,0, - 0,0,187,199,5,14,0,0,188,193,3,28,14,0,189,190,5,15,0,0,190,192,3,28,14, - 0,191,189,1,0,0,0,192,195,1,0,0,0,193,191,1,0,0,0,193,194,1,0,0,0,194,197, - 1,0,0,0,195,193,1,0,0,0,196,198,5,15,0,0,197,196,1,0,0,0,197,198,1,0,0, - 0,198,200,1,0,0,0,199,188,1,0,0,0,199,200,1,0,0,0,200,201,1,0,0,0,201,202, - 5,16,0,0,202,27,1,0,0,0,203,207,3,84,42,0,204,206,3,78,39,0,205,204,1,0, - 0,0,206,209,1,0,0,0,207,205,1,0,0,0,207,208,1,0,0,0,208,210,1,0,0,0,209, - 207,1,0,0,0,210,211,5,82,0,0,211,29,1,0,0,0,212,216,5,19,0,0,213,215,3, - 32,16,0,214,213,1,0,0,0,215,218,1,0,0,0,216,214,1,0,0,0,216,217,1,0,0,0, - 217,219,1,0,0,0,218,216,1,0,0,0,219,222,5,20,0,0,220,222,3,32,16,0,221, - 212,1,0,0,0,221,220,1,0,0,0,222,31,1,0,0,0,223,228,3,40,20,0,224,225,3, - 34,17,0,225,226,5,2,0,0,226,228,1,0,0,0,227,223,1,0,0,0,227,224,1,0,0,0, - 228,33,1,0,0,0,229,238,3,42,21,0,230,238,3,44,22,0,231,238,3,46,23,0,232, - 238,3,48,24,0,233,238,3,50,25,0,234,238,3,36,18,0,235,238,3,52,26,0,236, - 238,3,38,19,0,237,229,1,0,0,0,237,230,1,0,0,0,237,231,1,0,0,0,237,232,1, - 0,0,0,237,233,1,0,0,0,237,234,1,0,0,0,237,235,1,0,0,0,237,236,1,0,0,0,238, - 35,1,0,0,0,239,240,3,72,36,0,240,37,1,0,0,0,241,242,5,21,0,0,242,247,3, - 76,38,0,243,244,5,15,0,0,244,246,3,76,38,0,245,243,1,0,0,0,246,249,1,0, - 0,0,247,245,1,0,0,0,247,248,1,0,0,0,248,39,1,0,0,0,249,247,1,0,0,0,250, - 253,3,54,27,0,251,253,3,56,28,0,252,250,1,0,0,0,252,251,1,0,0,0,253,41, - 1,0,0,0,254,258,3,84,42,0,255,257,3,78,39,0,256,255,1,0,0,0,257,260,1,0, - 0,0,258,256,1,0,0,0,258,259,1,0,0,0,259,261,1,0,0,0,260,258,1,0,0,0,261, - 262,5,82,0,0,262,263,5,10,0,0,263,264,3,76,38,0,264,43,1,0,0,0,265,266, - 3,84,42,0,266,271,5,82,0,0,267,268,5,15,0,0,268,269,3,84,42,0,269,270,5, - 82,0,0,270,272,1,0,0,0,271,267,1,0,0,0,272,273,1,0,0,0,273,271,1,0,0,0, - 273,274,1,0,0,0,274,275,1,0,0,0,275,276,5,10,0,0,276,277,3,76,38,0,277, - 45,1,0,0,0,278,279,5,82,0,0,279,280,7,1,0,0,280,284,3,76,38,0,281,282,5, - 82,0,0,282,284,7,2,0,0,283,278,1,0,0,0,283,281,1,0,0,0,284,47,1,0,0,0,285, - 286,5,26,0,0,286,287,5,14,0,0,287,288,5,79,0,0,288,289,5,6,0,0,289,292, - 3,76,38,0,290,291,5,15,0,0,291,293,3,66,33,0,292,290,1,0,0,0,292,293,1, - 0,0,0,293,294,1,0,0,0,294,295,5,16,0,0,295,49,1,0,0,0,296,297,5,26,0,0, - 297,298,5,14,0,0,298,301,3,76,38,0,299,300,5,15,0,0,300,302,3,66,33,0,301, - 299,1,0,0,0,301,302,1,0,0,0,302,303,1,0,0,0,303,304,5,16,0,0,304,51,1,0, - 0,0,305,306,5,27,0,0,306,307,3,70,35,0,307,53,1,0,0,0,308,309,5,28,0,0, - 309,310,5,14,0,0,310,311,3,76,38,0,311,312,5,16,0,0,312,315,3,30,15,0,313, - 314,5,29,0,0,314,316,3,30,15,0,315,313,1,0,0,0,315,316,1,0,0,0,316,55,1, - 0,0,0,317,321,3,58,29,0,318,321,3,60,30,0,319,321,3,62,31,0,320,317,1,0, - 0,0,320,318,1,0,0,0,320,319,1,0,0,0,321,57,1,0,0,0,322,323,5,30,0,0,323, - 324,3,30,15,0,324,325,5,31,0,0,325,326,5,14,0,0,326,327,3,76,38,0,327,328, - 5,16,0,0,328,329,5,2,0,0,329,59,1,0,0,0,330,331,5,31,0,0,331,332,5,14,0, - 0,332,333,3,76,38,0,333,334,5,16,0,0,334,335,3,30,15,0,335,61,1,0,0,0,336, - 337,5,32,0,0,337,338,5,14,0,0,338,339,3,64,32,0,339,340,5,2,0,0,340,341, - 3,76,38,0,341,342,5,2,0,0,342,343,3,46,23,0,343,344,5,16,0,0,344,345,3, - 30,15,0,345,63,1,0,0,0,346,349,3,42,21,0,347,349,3,46,23,0,348,346,1,0, - 0,0,348,347,1,0,0,0,349,65,1,0,0,0,350,351,5,76,0,0,351,67,1,0,0,0,352, - 355,5,82,0,0,353,355,3,80,40,0,354,352,1,0,0,0,354,353,1,0,0,0,355,69,1, - 0,0,0,356,368,5,14,0,0,357,362,3,68,34,0,358,359,5,15,0,0,359,361,3,68, - 34,0,360,358,1,0,0,0,361,364,1,0,0,0,362,360,1,0,0,0,362,363,1,0,0,0,363, - 366,1,0,0,0,364,362,1,0,0,0,365,367,5,15,0,0,366,365,1,0,0,0,366,367,1, - 0,0,0,367,369,1,0,0,0,368,357,1,0,0,0,368,369,1,0,0,0,369,370,1,0,0,0,370, - 371,5,16,0,0,371,71,1,0,0,0,372,373,5,82,0,0,373,374,3,74,37,0,374,73,1, - 0,0,0,375,387,5,14,0,0,376,381,3,76,38,0,377,378,5,15,0,0,378,380,3,76, - 38,0,379,377,1,0,0,0,380,383,1,0,0,0,381,379,1,0,0,0,381,382,1,0,0,0,382, - 385,1,0,0,0,383,381,1,0,0,0,384,386,5,15,0,0,385,384,1,0,0,0,385,386,1, - 0,0,0,386,388,1,0,0,0,387,376,1,0,0,0,387,388,1,0,0,0,388,389,1,0,0,0,389, - 390,5,16,0,0,390,75,1,0,0,0,391,392,6,38,-1,0,392,393,5,14,0,0,393,394, - 3,76,38,0,394,395,5,16,0,0,395,441,1,0,0,0,396,397,3,86,43,0,397,398,5, - 14,0,0,398,400,3,76,38,0,399,401,5,15,0,0,400,399,1,0,0,0,400,401,1,0,0, - 0,401,402,1,0,0,0,402,403,5,16,0,0,403,441,1,0,0,0,404,441,3,72,36,0,405, - 406,5,33,0,0,406,407,5,82,0,0,407,441,3,74,37,0,408,409,5,36,0,0,409,410, - 5,34,0,0,410,411,3,76,38,0,411,412,5,35,0,0,412,413,7,3,0,0,413,441,1,0, - 0,0,414,415,5,42,0,0,415,416,5,34,0,0,416,417,3,76,38,0,417,418,5,35,0, - 0,418,419,7,4,0,0,419,441,1,0,0,0,420,421,7,5,0,0,421,441,3,76,38,15,422, - 434,5,34,0,0,423,428,3,76,38,0,424,425,5,15,0,0,425,427,3,76,38,0,426,424, - 1,0,0,0,427,430,1,0,0,0,428,426,1,0,0,0,428,429,1,0,0,0,429,432,1,0,0,0, - 430,428,1,0,0,0,431,433,5,15,0,0,432,431,1,0,0,0,432,433,1,0,0,0,433,435, - 1,0,0,0,434,423,1,0,0,0,434,435,1,0,0,0,435,436,1,0,0,0,436,441,5,35,0, - 0,437,441,5,81,0,0,438,441,5,82,0,0,439,441,3,80,40,0,440,391,1,0,0,0,440, - 396,1,0,0,0,440,404,1,0,0,0,440,405,1,0,0,0,440,408,1,0,0,0,440,414,1,0, - 0,0,440,420,1,0,0,0,440,422,1,0,0,0,440,437,1,0,0,0,440,438,1,0,0,0,440, - 439,1,0,0,0,441,494,1,0,0,0,442,443,10,14,0,0,443,444,7,6,0,0,444,493,3, - 76,38,15,445,446,10,13,0,0,446,447,7,7,0,0,447,493,3,76,38,14,448,449,10, - 12,0,0,449,450,7,8,0,0,450,493,3,76,38,13,451,452,10,11,0,0,452,453,7,9, - 0,0,453,493,3,76,38,12,454,455,10,10,0,0,455,456,7,10,0,0,456,493,3,76, - 38,11,457,458,10,9,0,0,458,459,5,61,0,0,459,493,3,76,38,10,460,461,10,8, - 0,0,461,462,5,4,0,0,462,493,3,76,38,9,463,464,10,7,0,0,464,465,5,62,0,0, - 465,493,3,76,38,8,466,467,10,6,0,0,467,468,5,63,0,0,468,493,3,76,38,7,469, - 470,10,5,0,0,470,471,5,64,0,0,471,493,3,76,38,6,472,473,10,21,0,0,473,474, - 5,34,0,0,474,475,5,69,0,0,475,493,5,35,0,0,476,477,10,18,0,0,477,493,7, - 11,0,0,478,479,10,17,0,0,479,480,5,49,0,0,480,481,5,14,0,0,481,482,3,76, - 38,0,482,483,5,16,0,0,483,493,1,0,0,0,484,485,10,16,0,0,485,486,5,50,0, - 0,486,487,5,14,0,0,487,488,3,76,38,0,488,489,5,15,0,0,489,490,3,76,38,0, - 490,491,5,16,0,0,491,493,1,0,0,0,492,442,1,0,0,0,492,445,1,0,0,0,492,448, - 1,0,0,0,492,451,1,0,0,0,492,454,1,0,0,0,492,457,1,0,0,0,492,460,1,0,0,0, - 492,463,1,0,0,0,492,466,1,0,0,0,492,469,1,0,0,0,492,472,1,0,0,0,492,476, - 1,0,0,0,492,478,1,0,0,0,492,484,1,0,0,0,493,496,1,0,0,0,494,492,1,0,0,0, - 494,495,1,0,0,0,495,77,1,0,0,0,496,494,1,0,0,0,497,498,7,12,0,0,498,79, - 1,0,0,0,499,505,5,67,0,0,500,505,3,82,41,0,501,505,5,76,0,0,502,505,5,77, - 0,0,503,505,5,78,0,0,504,499,1,0,0,0,504,500,1,0,0,0,504,501,1,0,0,0,504, - 502,1,0,0,0,504,503,1,0,0,0,505,81,1,0,0,0,506,508,5,69,0,0,507,509,5,68, - 0,0,508,507,1,0,0,0,508,509,1,0,0,0,509,83,1,0,0,0,510,511,7,13,0,0,511, - 85,1,0,0,0,512,513,7,14,0,0,513,87,1,0,0,0,44,91,97,103,117,120,133,145, - 150,168,182,193,197,199,207,216,221,227,237,247,252,258,273,283,292,301, - 315,320,348,354,362,366,368,381,385,387,400,428,432,434,440,492,494,504, - 508]; + 39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,1,0,5,0,92,8, + 0,10,0,12,0,95,9,0,1,0,5,0,98,8,0,10,0,12,0,101,9,0,1,0,5,0,104,8,0,10, + 0,12,0,107,9,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,3,1,3,3,3,120,8,3, + 1,4,3,4,123,8,4,1,4,1,4,1,5,1,5,1,6,1,6,1,6,1,6,1,7,1,7,1,7,3,7,136,8,7, + 1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,5,8,146,8,8,10,8,12,8,149,9,8,1,8,1,8,3, + 8,153,8,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10, + 5,10,169,8,10,10,10,12,10,172,9,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1, + 12,1,12,5,12,183,8,12,10,12,12,12,186,9,12,1,12,1,12,1,13,1,13,1,13,1,13, + 5,13,194,8,13,10,13,12,13,197,9,13,1,13,3,13,200,8,13,3,13,202,8,13,1,13, + 1,13,1,14,1,14,5,14,208,8,14,10,14,12,14,211,9,14,1,14,1,14,1,15,1,15,5, + 15,217,8,15,10,15,12,15,220,9,15,1,15,1,15,3,15,224,8,15,1,16,1,16,1,16, + 1,16,3,16,230,8,16,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,3,17,240,8,17, + 1,18,1,18,1,19,1,19,1,19,1,19,5,19,248,8,19,10,19,12,19,251,9,19,1,20,1, + 20,3,20,255,8,20,1,21,1,21,5,21,259,8,21,10,21,12,21,262,9,21,1,21,1,21, + 1,21,1,21,1,22,1,22,1,22,4,22,271,8,22,11,22,12,22,272,1,22,1,22,1,22,1, + 22,1,22,1,22,1,22,4,22,282,8,22,11,22,12,22,283,1,22,1,22,1,22,1,22,3,22, + 290,8,22,1,23,1,23,1,23,1,23,3,23,296,8,23,1,24,1,24,1,24,1,24,1,24,3,24, + 303,8,24,1,25,1,25,1,25,1,25,1,25,1,25,1,25,3,25,312,8,25,1,25,1,25,1,26, + 1,26,1,26,1,26,1,26,3,26,321,8,26,1,26,1,26,1,27,1,27,1,27,1,28,1,28,1, + 28,1,28,1,28,1,28,1,28,3,28,335,8,28,1,29,1,29,1,29,3,29,340,8,29,1,30, + 1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,31,1,31,1,31,1,32,1, + 32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,33,1,33,3,33,368,8,33,1,34, + 1,34,1,35,1,35,3,35,374,8,35,1,36,1,36,1,36,1,36,5,36,380,8,36,10,36,12, + 36,383,9,36,1,36,3,36,386,8,36,3,36,388,8,36,1,36,1,36,1,37,1,37,1,37,1, + 38,1,38,1,38,1,38,5,38,399,8,38,10,38,12,38,402,9,38,1,38,3,38,405,8,38, + 3,38,407,8,38,1,38,1,38,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,3, + 39,420,8,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39, + 1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,5,39,446,8, + 39,10,39,12,39,449,9,39,1,39,3,39,452,8,39,3,39,454,8,39,1,39,1,39,1,39, + 1,39,3,39,460,8,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1, + 39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39, + 1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1, + 39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,5,39,512,8,39,10,39, + 12,39,515,9,39,1,40,1,40,1,41,1,41,1,41,1,41,1,41,3,41,524,8,41,1,42,1, + 42,3,42,528,8,42,1,43,1,43,1,44,1,44,1,44,0,1,78,45,0,2,4,6,8,10,12,14, + 16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62, + 64,66,68,70,72,74,76,78,80,82,84,86,88,0,15,1,0,4,10,2,0,10,10,22,23,1, + 0,24,25,1,0,37,41,2,0,37,41,43,46,2,0,5,5,51,52,1,0,53,55,2,0,52,52,56, + 56,1,0,57,58,1,0,6,9,1,0,59,60,1,0,47,48,2,0,17,17,65,65,1,0,72,74,2,0, + 72,73,80,80,567,0,93,1,0,0,0,2,110,1,0,0,0,4,115,1,0,0,0,6,117,1,0,0,0, + 8,122,1,0,0,0,10,126,1,0,0,0,12,128,1,0,0,0,14,135,1,0,0,0,16,137,1,0,0, + 0,18,156,1,0,0,0,20,163,1,0,0,0,22,175,1,0,0,0,24,180,1,0,0,0,26,189,1, + 0,0,0,28,205,1,0,0,0,30,223,1,0,0,0,32,229,1,0,0,0,34,239,1,0,0,0,36,241, + 1,0,0,0,38,243,1,0,0,0,40,254,1,0,0,0,42,256,1,0,0,0,44,289,1,0,0,0,46, + 295,1,0,0,0,48,302,1,0,0,0,50,304,1,0,0,0,52,315,1,0,0,0,54,324,1,0,0,0, + 56,327,1,0,0,0,58,339,1,0,0,0,60,341,1,0,0,0,62,349,1,0,0,0,64,355,1,0, + 0,0,66,367,1,0,0,0,68,369,1,0,0,0,70,373,1,0,0,0,72,375,1,0,0,0,74,391, + 1,0,0,0,76,394,1,0,0,0,78,459,1,0,0,0,80,516,1,0,0,0,82,523,1,0,0,0,84, + 525,1,0,0,0,86,529,1,0,0,0,88,531,1,0,0,0,90,92,3,2,1,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,99,1,0,0,0,95,93,1,0,0,0,96,98, + 3,12,6,0,97,96,1,0,0,0,98,101,1,0,0,0,99,97,1,0,0,0,99,100,1,0,0,0,100, + 105,1,0,0,0,101,99,1,0,0,0,102,104,3,14,7,0,103,102,1,0,0,0,104,107,1,0, + 0,0,105,103,1,0,0,0,105,106,1,0,0,0,106,108,1,0,0,0,107,105,1,0,0,0,108, + 109,5,0,0,1,109,1,1,0,0,0,110,111,5,1,0,0,111,112,3,4,2,0,112,113,3,6,3, + 0,113,114,5,2,0,0,114,3,1,0,0,0,115,116,5,3,0,0,116,5,1,0,0,0,117,119,3, + 8,4,0,118,120,3,8,4,0,119,118,1,0,0,0,119,120,1,0,0,0,120,7,1,0,0,0,121, + 123,3,10,5,0,122,121,1,0,0,0,122,123,1,0,0,0,123,124,1,0,0,0,124,125,5, + 66,0,0,125,9,1,0,0,0,126,127,7,0,0,0,127,11,1,0,0,0,128,129,5,11,0,0,129, + 130,5,76,0,0,130,131,5,2,0,0,131,13,1,0,0,0,132,136,3,16,8,0,133,136,3, + 18,9,0,134,136,3,20,10,0,135,132,1,0,0,0,135,133,1,0,0,0,135,134,1,0,0, + 0,136,15,1,0,0,0,137,138,5,12,0,0,138,139,5,82,0,0,139,152,3,26,13,0,140, + 141,5,13,0,0,141,142,5,14,0,0,142,147,3,86,43,0,143,144,5,15,0,0,144,146, + 3,86,43,0,145,143,1,0,0,0,146,149,1,0,0,0,147,145,1,0,0,0,147,148,1,0,0, + 0,148,150,1,0,0,0,149,147,1,0,0,0,150,151,5,16,0,0,151,153,1,0,0,0,152, + 140,1,0,0,0,152,153,1,0,0,0,153,154,1,0,0,0,154,155,3,24,12,0,155,17,1, + 0,0,0,156,157,3,86,43,0,157,158,5,17,0,0,158,159,5,82,0,0,159,160,5,10, + 0,0,160,161,3,78,39,0,161,162,5,2,0,0,162,19,1,0,0,0,163,164,5,18,0,0,164, + 165,5,82,0,0,165,166,3,26,13,0,166,170,5,19,0,0,167,169,3,22,11,0,168,167, + 1,0,0,0,169,172,1,0,0,0,170,168,1,0,0,0,170,171,1,0,0,0,171,173,1,0,0,0, + 172,170,1,0,0,0,173,174,5,20,0,0,174,21,1,0,0,0,175,176,5,12,0,0,176,177, + 5,82,0,0,177,178,3,26,13,0,178,179,3,24,12,0,179,23,1,0,0,0,180,184,5,19, + 0,0,181,183,3,32,16,0,182,181,1,0,0,0,183,186,1,0,0,0,184,182,1,0,0,0,184, + 185,1,0,0,0,185,187,1,0,0,0,186,184,1,0,0,0,187,188,5,20,0,0,188,25,1,0, + 0,0,189,201,5,14,0,0,190,195,3,28,14,0,191,192,5,15,0,0,192,194,3,28,14, + 0,193,191,1,0,0,0,194,197,1,0,0,0,195,193,1,0,0,0,195,196,1,0,0,0,196,199, + 1,0,0,0,197,195,1,0,0,0,198,200,5,15,0,0,199,198,1,0,0,0,199,200,1,0,0, + 0,200,202,1,0,0,0,201,190,1,0,0,0,201,202,1,0,0,0,202,203,1,0,0,0,203,204, + 5,16,0,0,204,27,1,0,0,0,205,209,3,86,43,0,206,208,3,80,40,0,207,206,1,0, + 0,0,208,211,1,0,0,0,209,207,1,0,0,0,209,210,1,0,0,0,210,212,1,0,0,0,211, + 209,1,0,0,0,212,213,5,82,0,0,213,29,1,0,0,0,214,218,5,19,0,0,215,217,3, + 32,16,0,216,215,1,0,0,0,217,220,1,0,0,0,218,216,1,0,0,0,218,219,1,0,0,0, + 219,221,1,0,0,0,220,218,1,0,0,0,221,224,5,20,0,0,222,224,3,32,16,0,223, + 214,1,0,0,0,223,222,1,0,0,0,224,31,1,0,0,0,225,230,3,40,20,0,226,227,3, + 34,17,0,227,228,5,2,0,0,228,230,1,0,0,0,229,225,1,0,0,0,229,226,1,0,0,0, + 230,33,1,0,0,0,231,240,3,42,21,0,232,240,3,44,22,0,233,240,3,48,24,0,234, + 240,3,50,25,0,235,240,3,52,26,0,236,240,3,36,18,0,237,240,3,54,27,0,238, + 240,3,38,19,0,239,231,1,0,0,0,239,232,1,0,0,0,239,233,1,0,0,0,239,234,1, + 0,0,0,239,235,1,0,0,0,239,236,1,0,0,0,239,237,1,0,0,0,239,238,1,0,0,0,240, + 35,1,0,0,0,241,242,3,74,37,0,242,37,1,0,0,0,243,244,5,21,0,0,244,249,3, + 78,39,0,245,246,5,15,0,0,246,248,3,78,39,0,247,245,1,0,0,0,248,251,1,0, + 0,0,249,247,1,0,0,0,249,250,1,0,0,0,250,39,1,0,0,0,251,249,1,0,0,0,252, + 255,3,56,28,0,253,255,3,58,29,0,254,252,1,0,0,0,254,253,1,0,0,0,255,41, + 1,0,0,0,256,260,3,86,43,0,257,259,3,80,40,0,258,257,1,0,0,0,259,262,1,0, + 0,0,260,258,1,0,0,0,260,261,1,0,0,0,261,263,1,0,0,0,262,260,1,0,0,0,263, + 264,5,82,0,0,264,265,5,10,0,0,265,266,3,78,39,0,266,43,1,0,0,0,267,270, + 3,46,23,0,268,269,5,15,0,0,269,271,3,46,23,0,270,268,1,0,0,0,271,272,1, + 0,0,0,272,270,1,0,0,0,272,273,1,0,0,0,273,274,1,0,0,0,274,275,5,10,0,0, + 275,276,3,78,39,0,276,290,1,0,0,0,277,278,5,14,0,0,278,281,3,46,23,0,279, + 280,5,15,0,0,280,282,3,46,23,0,281,279,1,0,0,0,282,283,1,0,0,0,283,281, + 1,0,0,0,283,284,1,0,0,0,284,285,1,0,0,0,285,286,5,16,0,0,286,287,5,10,0, + 0,287,288,3,78,39,0,288,290,1,0,0,0,289,267,1,0,0,0,289,277,1,0,0,0,290, + 45,1,0,0,0,291,292,3,86,43,0,292,293,5,82,0,0,293,296,1,0,0,0,294,296,5, + 82,0,0,295,291,1,0,0,0,295,294,1,0,0,0,296,47,1,0,0,0,297,298,5,82,0,0, + 298,299,7,1,0,0,299,303,3,78,39,0,300,301,5,82,0,0,301,303,7,2,0,0,302, + 297,1,0,0,0,302,300,1,0,0,0,303,49,1,0,0,0,304,305,5,26,0,0,305,306,5,14, + 0,0,306,307,5,79,0,0,307,308,5,6,0,0,308,311,3,78,39,0,309,310,5,15,0,0, + 310,312,3,68,34,0,311,309,1,0,0,0,311,312,1,0,0,0,312,313,1,0,0,0,313,314, + 5,16,0,0,314,51,1,0,0,0,315,316,5,26,0,0,316,317,5,14,0,0,317,320,3,78, + 39,0,318,319,5,15,0,0,319,321,3,68,34,0,320,318,1,0,0,0,320,321,1,0,0,0, + 321,322,1,0,0,0,322,323,5,16,0,0,323,53,1,0,0,0,324,325,5,27,0,0,325,326, + 3,72,36,0,326,55,1,0,0,0,327,328,5,28,0,0,328,329,5,14,0,0,329,330,3,78, + 39,0,330,331,5,16,0,0,331,334,3,30,15,0,332,333,5,29,0,0,333,335,3,30,15, + 0,334,332,1,0,0,0,334,335,1,0,0,0,335,57,1,0,0,0,336,340,3,60,30,0,337, + 340,3,62,31,0,338,340,3,64,32,0,339,336,1,0,0,0,339,337,1,0,0,0,339,338, + 1,0,0,0,340,59,1,0,0,0,341,342,5,30,0,0,342,343,3,30,15,0,343,344,5,31, + 0,0,344,345,5,14,0,0,345,346,3,78,39,0,346,347,5,16,0,0,347,348,5,2,0,0, + 348,61,1,0,0,0,349,350,5,31,0,0,350,351,5,14,0,0,351,352,3,78,39,0,352, + 353,5,16,0,0,353,354,3,30,15,0,354,63,1,0,0,0,355,356,5,32,0,0,356,357, + 5,14,0,0,357,358,3,66,33,0,358,359,5,2,0,0,359,360,3,78,39,0,360,361,5, + 2,0,0,361,362,3,48,24,0,362,363,5,16,0,0,363,364,3,30,15,0,364,65,1,0,0, + 0,365,368,3,42,21,0,366,368,3,48,24,0,367,365,1,0,0,0,367,366,1,0,0,0,368, + 67,1,0,0,0,369,370,5,76,0,0,370,69,1,0,0,0,371,374,5,82,0,0,372,374,3,82, + 41,0,373,371,1,0,0,0,373,372,1,0,0,0,374,71,1,0,0,0,375,387,5,14,0,0,376, + 381,3,70,35,0,377,378,5,15,0,0,378,380,3,70,35,0,379,377,1,0,0,0,380,383, + 1,0,0,0,381,379,1,0,0,0,381,382,1,0,0,0,382,385,1,0,0,0,383,381,1,0,0,0, + 384,386,5,15,0,0,385,384,1,0,0,0,385,386,1,0,0,0,386,388,1,0,0,0,387,376, + 1,0,0,0,387,388,1,0,0,0,388,389,1,0,0,0,389,390,5,16,0,0,390,73,1,0,0,0, + 391,392,5,82,0,0,392,393,3,76,38,0,393,75,1,0,0,0,394,406,5,14,0,0,395, + 400,3,78,39,0,396,397,5,15,0,0,397,399,3,78,39,0,398,396,1,0,0,0,399,402, + 1,0,0,0,400,398,1,0,0,0,400,401,1,0,0,0,401,404,1,0,0,0,402,400,1,0,0,0, + 403,405,5,15,0,0,404,403,1,0,0,0,404,405,1,0,0,0,405,407,1,0,0,0,406,395, + 1,0,0,0,406,407,1,0,0,0,407,408,1,0,0,0,408,409,5,16,0,0,409,77,1,0,0,0, + 410,411,6,39,-1,0,411,412,5,14,0,0,412,413,3,78,39,0,413,414,5,16,0,0,414, + 460,1,0,0,0,415,416,3,88,44,0,416,417,5,14,0,0,417,419,3,78,39,0,418,420, + 5,15,0,0,419,418,1,0,0,0,419,420,1,0,0,0,420,421,1,0,0,0,421,422,5,16,0, + 0,422,460,1,0,0,0,423,460,3,74,37,0,424,425,5,33,0,0,425,426,5,82,0,0,426, + 460,3,76,38,0,427,428,5,36,0,0,428,429,5,34,0,0,429,430,3,78,39,0,430,431, + 5,35,0,0,431,432,7,3,0,0,432,460,1,0,0,0,433,434,5,42,0,0,434,435,5,34, + 0,0,435,436,3,78,39,0,436,437,5,35,0,0,437,438,7,4,0,0,438,460,1,0,0,0, + 439,440,7,5,0,0,440,460,3,78,39,15,441,453,5,34,0,0,442,447,3,78,39,0,443, + 444,5,15,0,0,444,446,3,78,39,0,445,443,1,0,0,0,446,449,1,0,0,0,447,445, + 1,0,0,0,447,448,1,0,0,0,448,451,1,0,0,0,449,447,1,0,0,0,450,452,5,15,0, + 0,451,450,1,0,0,0,451,452,1,0,0,0,452,454,1,0,0,0,453,442,1,0,0,0,453,454, + 1,0,0,0,454,455,1,0,0,0,455,460,5,35,0,0,456,460,5,81,0,0,457,460,5,82, + 0,0,458,460,3,82,41,0,459,410,1,0,0,0,459,415,1,0,0,0,459,423,1,0,0,0,459, + 424,1,0,0,0,459,427,1,0,0,0,459,433,1,0,0,0,459,439,1,0,0,0,459,441,1,0, + 0,0,459,456,1,0,0,0,459,457,1,0,0,0,459,458,1,0,0,0,460,513,1,0,0,0,461, + 462,10,14,0,0,462,463,7,6,0,0,463,512,3,78,39,15,464,465,10,13,0,0,465, + 466,7,7,0,0,466,512,3,78,39,14,467,468,10,12,0,0,468,469,7,8,0,0,469,512, + 3,78,39,13,470,471,10,11,0,0,471,472,7,9,0,0,472,512,3,78,39,12,473,474, + 10,10,0,0,474,475,7,10,0,0,475,512,3,78,39,11,476,477,10,9,0,0,477,478, + 5,61,0,0,478,512,3,78,39,10,479,480,10,8,0,0,480,481,5,4,0,0,481,512,3, + 78,39,9,482,483,10,7,0,0,483,484,5,62,0,0,484,512,3,78,39,8,485,486,10, + 6,0,0,486,487,5,63,0,0,487,512,3,78,39,7,488,489,10,5,0,0,489,490,5,64, + 0,0,490,512,3,78,39,6,491,492,10,21,0,0,492,493,5,34,0,0,493,494,5,69,0, + 0,494,512,5,35,0,0,495,496,10,18,0,0,496,512,7,11,0,0,497,498,10,17,0,0, + 498,499,5,49,0,0,499,500,5,14,0,0,500,501,3,78,39,0,501,502,5,16,0,0,502, + 512,1,0,0,0,503,504,10,16,0,0,504,505,5,50,0,0,505,506,5,14,0,0,506,507, + 3,78,39,0,507,508,5,15,0,0,508,509,3,78,39,0,509,510,5,16,0,0,510,512,1, + 0,0,0,511,461,1,0,0,0,511,464,1,0,0,0,511,467,1,0,0,0,511,470,1,0,0,0,511, + 473,1,0,0,0,511,476,1,0,0,0,511,479,1,0,0,0,511,482,1,0,0,0,511,485,1,0, + 0,0,511,488,1,0,0,0,511,491,1,0,0,0,511,495,1,0,0,0,511,497,1,0,0,0,511, + 503,1,0,0,0,512,515,1,0,0,0,513,511,1,0,0,0,513,514,1,0,0,0,514,79,1,0, + 0,0,515,513,1,0,0,0,516,517,7,12,0,0,517,81,1,0,0,0,518,524,5,67,0,0,519, + 524,3,84,42,0,520,524,5,76,0,0,521,524,5,77,0,0,522,524,5,78,0,0,523,518, + 1,0,0,0,523,519,1,0,0,0,523,520,1,0,0,0,523,521,1,0,0,0,523,522,1,0,0,0, + 524,83,1,0,0,0,525,527,5,69,0,0,526,528,5,68,0,0,527,526,1,0,0,0,527,528, + 1,0,0,0,528,85,1,0,0,0,529,530,7,13,0,0,530,87,1,0,0,0,531,532,7,14,0,0, + 532,89,1,0,0,0,47,93,99,105,119,122,135,147,152,170,184,195,199,201,209, + 218,223,229,239,249,254,260,272,283,289,295,302,311,320,334,339,367,373, + 381,385,387,400,404,406,419,447,451,453,459,511,513,523,527]; private static __ATN: ATN; public static get _ATN(): ATN { @@ -3537,17 +3628,11 @@ export class TupleAssignmentContext extends ParserRuleContext { super(parent, invokingState); this.parser = parser; } - public typeName_list(): TypeNameContext[] { - return this.getTypedRuleContexts(TypeNameContext) as TypeNameContext[]; - } - public typeName(i: number): TypeNameContext { - return this.getTypedRuleContext(TypeNameContext, i) as TypeNameContext; + public tupleTarget_list(): TupleTargetContext[] { + return this.getTypedRuleContexts(TupleTargetContext) as TupleTargetContext[]; } - public Identifier_list(): TerminalNode[] { - return this.getTokens(CashScriptParser.Identifier); - } - public Identifier(i: number): TerminalNode { - return this.getToken(CashScriptParser.Identifier, i); + public tupleTarget(i: number): TupleTargetContext { + return this.getTypedRuleContext(TupleTargetContext, i) as TupleTargetContext; } public expression(): ExpressionContext { return this.getTypedRuleContext(ExpressionContext, 0) as ExpressionContext; @@ -3566,6 +3651,31 @@ export class TupleAssignmentContext extends ParserRuleContext { } +export class TupleTargetContext extends ParserRuleContext { + constructor(parser?: CashScriptParser, parent?: ParserRuleContext, invokingState?: number) { + super(parent, invokingState); + this.parser = parser; + } + public typeName(): TypeNameContext { + return this.getTypedRuleContext(TypeNameContext, 0) as TypeNameContext; + } + public Identifier(): TerminalNode { + return this.getToken(CashScriptParser.Identifier, 0); + } + public get ruleIndex(): number { + return CashScriptParser.RULE_tupleTarget; + } + // @Override + public accept(visitor: CashScriptVisitor): Result { + if (visitor.visitTupleTarget) { + return visitor.visitTupleTarget(this); + } else { + return visitor.visitChildren(this); + } + } +} + + export class AssignStatementContext extends ParserRuleContext { public _op!: Token; constructor(parser?: CashScriptParser, parent?: ParserRuleContext, invokingState?: number) { diff --git a/packages/cashc/src/grammar/CashScriptVisitor.ts b/packages/cashc/src/grammar/CashScriptVisitor.ts index 187bf8c79..3c4d117bc 100644 --- a/packages/cashc/src/grammar/CashScriptVisitor.ts +++ b/packages/cashc/src/grammar/CashScriptVisitor.ts @@ -26,6 +26,7 @@ import { ReturnStatementContext } from "./CashScriptParser.js"; import { ControlStatementContext } from "./CashScriptParser.js"; import { VariableDefinitionContext } from "./CashScriptParser.js"; import { TupleAssignmentContext } from "./CashScriptParser.js"; +import { TupleTargetContext } from "./CashScriptParser.js"; import { AssignStatementContext } from "./CashScriptParser.js"; import { TimeOpStatementContext } from "./CashScriptParser.js"; import { RequireStatementContext } from "./CashScriptParser.js"; @@ -207,6 +208,12 @@ export default class CashScriptVisitor extends ParseTreeVisitor * @return the visitor result */ visitTupleAssignment?: (ctx: TupleAssignmentContext) => Result; + /** + * Visit a parse tree produced by `CashScriptParser.tupleTarget`. + * @param ctx the parse tree + * @return the visitor result + */ + visitTupleTarget?: (ctx: TupleTargetContext) => Result; /** * Visit a parse tree produced by `CashScriptParser.assignStatement`. * @param ctx the parse tree diff --git a/packages/cashc/src/print/OutputSourceCodeTraversal.ts b/packages/cashc/src/print/OutputSourceCodeTraversal.ts index b6921d3ba..851ae88ec 100644 --- a/packages/cashc/src/print/OutputSourceCodeTraversal.ts +++ b/packages/cashc/src/print/OutputSourceCodeTraversal.ts @@ -141,7 +141,9 @@ export default class OutputSourceCodeTraversal extends AstTraversal { } visitTupleAssignment(node: TupleAssignmentNode): Node { - const targets = node.targets.map((target) => `${target.type} ${target.name}`).join(', '); + const targets = node.targets + .map((target) => (target.isReassignment ? target.identifier.name : `${target.type} ${target.identifier.name}`)) + .join(', '); this.addOutput(`${targets} = `, true); this.visit(node.tuple); diff --git a/packages/cashc/src/semantic/SymbolTableTraversal.ts b/packages/cashc/src/semantic/SymbolTableTraversal.ts index 11c380a02..b27b2ebf9 100644 --- a/packages/cashc/src/semantic/SymbolTableTraversal.ts +++ b/packages/cashc/src/semantic/SymbolTableTraversal.ts @@ -29,6 +29,7 @@ import { UnusedVariableError, InvalidSymbolTypeError, ConstantModificationError, + DuplicateTupleTargetError, InvalidModifierError, } from '../Errors.js'; @@ -164,7 +165,7 @@ export default class SymbolTableTraversal extends AstTraversal { visitAssign(node: AssignNode): Node { const symbol = this.symbolTables[0].get(node.identifier.name); - if (symbol?.definition === undefined || symbol.definition instanceof FunctionDefinitionNode) { + if (!symbol) { throw new UndefinedReferenceError(node.identifier); } @@ -177,16 +178,29 @@ export default class SymbolTableTraversal extends AstTraversal { } visitTupleAssignment(node: TupleAssignmentNode): Node { - node.targets.forEach((variable) => { - const definition = createTupleVariableDefinition(node, variable); + const seenTargetNames = new Set(); + node.targets.forEach((target) => { + if (seenTargetNames.has(target.identifier.name)) { + throw new DuplicateTupleTargetError(node, target.identifier.name); + } + seenTargetNames.add(target.identifier.name); + + if (target.isReassignment) { + if (this.symbolTables[0].get(target.identifier.name)?.hasModifier(Modifier.CONSTANT)) { + throw new ConstantModificationError(node, target.identifier.name); + } + + target.identifier = this.visit(target.identifier) as IdentifierNode; + target.type = target.identifier.symbol!.type; + } else { + const definition = createTupleVariableDefinition(node, target); + + if (this.symbolTables[0].get(target.identifier.name)) { + throw new RedefinitionError(definition, target.identifier.name); + } - const { name } = variable; - if (this.symbolTables[0].get(name)) { - throw new RedefinitionError(definition, name); + this.symbolTables[0].set(Symbol.variable(definition)); } - this.symbolTables[0].set( - Symbol.variable(definition), - ); }); node.tuple = this.visit(node.tuple); @@ -273,9 +287,9 @@ function validateModifiers( function createTupleVariableDefinition( node: TupleAssignmentNode, - variable: TupleAssignmentTarget, + target: TupleAssignmentTarget, ): VariableDefinitionNode { - const definition = new VariableDefinitionNode(variable.type, [], variable.name, node.tuple); + const definition = new VariableDefinitionNode(target.type!, [], target.identifier.name, node.tuple); definition.location = node.location; return definition; } diff --git a/packages/cashc/src/semantic/TypeCheckTraversal.ts b/packages/cashc/src/semantic/TypeCheckTraversal.ts index 8a5af6637..b76a75db4 100644 --- a/packages/cashc/src/semantic/TypeCheckTraversal.ts +++ b/packages/cashc/src/semantic/TypeCheckTraversal.ts @@ -79,9 +79,9 @@ export default class TypeCheckTraversal extends AstTraversal { visitTupleAssignment(node: TupleAssignmentNode): Node { node.tuple = this.visit(node.tuple); - const targetsType = new TupleType(node.targets.map((target) => target.type)); + const targetsType = new TupleType(node.targets.map((target) => target.type!)); if (!implicitlyCastable(node.tuple.type, targetsType)) { - const targetNames = node.targets.map((target) => target.name).join(', '); + const targetNames = node.targets.map((target) => target.identifier.name).join(', '); const syntheticAssignment = new VariableDefinitionNode(targetsType, [], targetNames, node.tuple); syntheticAssignment.location = node.location; throw new AssignTypeError(syntheticAssignment); diff --git a/packages/cashc/test/ast/fixtures.ts b/packages/cashc/test/ast/fixtures.ts index 9cfd509a0..d3468bd9b 100644 --- a/packages/cashc/test/ast/fixtures.ts +++ b/packages/cashc/test/ast/fixtures.ts @@ -367,8 +367,8 @@ export const fixtures: Fixture[] = [ new BlockNode([ new TupleAssignmentNode( [ - { name: 'blockHeightBin', type: new BytesType(4) }, - { name: 'priceBin', type: new BytesType(4) }, + { identifier: new IdentifierNode('blockHeightBin'), type: new BytesType(4) }, + { identifier: new IdentifierNode('priceBin'), type: new BytesType(4) }, ], new BinaryOpNode( new IdentifierNode('oracleMessage'), diff --git a/packages/cashc/test/compiler/ConstantModificationError/tuple_reassign_constant.cash b/packages/cashc/test/compiler/ConstantModificationError/tuple_reassign_constant.cash new file mode 100644 index 000000000..f439d5641 --- /dev/null +++ b/packages/cashc/test/compiler/ConstantModificationError/tuple_reassign_constant.cash @@ -0,0 +1,11 @@ +function pair(int n) returns (int, int) { + return n + 1, n + 2; +} + +contract Test() { + function spend(int n) { + int constant f = 5; + int q, f = pair(n); + require(q > f); + } +} diff --git a/packages/cashc/test/compiler/DuplicateTupleTargetError/declaration_then_reassignment.cash b/packages/cashc/test/compiler/DuplicateTupleTargetError/declaration_then_reassignment.cash new file mode 100644 index 000000000..b1785eb5f --- /dev/null +++ b/packages/cashc/test/compiler/DuplicateTupleTargetError/declaration_then_reassignment.cash @@ -0,0 +1,10 @@ +function pair(int n) returns (int, int) { + return n + 1, n + 2; +} + +contract Test() { + function spend(int n) { + int a, a = pair(n); + require(a > 0); + } +} diff --git a/packages/cashc/test/compiler/DuplicateTupleTargetError/duplicate_reassignment_targets.cash b/packages/cashc/test/compiler/DuplicateTupleTargetError/duplicate_reassignment_targets.cash new file mode 100644 index 000000000..d4a721253 --- /dev/null +++ b/packages/cashc/test/compiler/DuplicateTupleTargetError/duplicate_reassignment_targets.cash @@ -0,0 +1,11 @@ +function pair(int n) returns (int, int) { + return n + 1, n + 2; +} + +contract Test() { + function spend(int n) { + int a = n; + (a, a) = pair(n); + require(a > 0); + } +} diff --git a/packages/cashc/test/compiler/InvalidModifierError/tuple_reassign_unused.cash b/packages/cashc/test/compiler/InvalidModifierError/tuple_reassign_unused.cash new file mode 100644 index 000000000..37ae74cc0 --- /dev/null +++ b/packages/cashc/test/compiler/InvalidModifierError/tuple_reassign_unused.cash @@ -0,0 +1,13 @@ +function pair(int n) returns (int, int) { + return n + 1, n + 2; +} + +contract Test() { + function spend(int n, int unused pad) { + if (n > 0) { + (int q, pad) = pair(n); + require(q > 0); + } + require(n < 100); + } +} diff --git a/packages/cashc/test/compiler/UndefinedReferenceError/assign_to_builtin_name.cash b/packages/cashc/test/compiler/InvalidSymbolTypeError/assign_to_builtin_name.cash similarity index 100% rename from packages/cashc/test/compiler/UndefinedReferenceError/assign_to_builtin_name.cash rename to packages/cashc/test/compiler/InvalidSymbolTypeError/assign_to_builtin_name.cash diff --git a/packages/cashc/test/compiler/UndefinedReferenceError/assign_to_function_name.cash b/packages/cashc/test/compiler/InvalidSymbolTypeError/assign_to_function_name.cash similarity index 100% rename from packages/cashc/test/compiler/UndefinedReferenceError/assign_to_function_name.cash rename to packages/cashc/test/compiler/InvalidSymbolTypeError/assign_to_function_name.cash diff --git a/packages/cashc/test/compiler/InvalidSymbolTypeError/tuple_reassign_function_name.cash b/packages/cashc/test/compiler/InvalidSymbolTypeError/tuple_reassign_function_name.cash new file mode 100644 index 000000000..572e098eb --- /dev/null +++ b/packages/cashc/test/compiler/InvalidSymbolTypeError/tuple_reassign_function_name.cash @@ -0,0 +1,10 @@ +function pair(int n) returns (int, int) { + return n + 1, n + 2; +} + +contract Test() { + function spend(int n) { + int q, pair = pair(n); + require(q > 0); + } +} diff --git a/packages/cashc/test/compiler/ParseError/single_type_destructuring.cash b/packages/cashc/test/compiler/ParseError/single_type_destructuring.cash deleted file mode 100644 index 89afb1bfe..000000000 --- a/packages/cashc/test/compiler/ParseError/single_type_destructuring.cash +++ /dev/null @@ -1,5 +0,0 @@ -contract Test() { - function test1(string s) { - string x, y = s.split(5); - } -} diff --git a/packages/cashc/test/compiler/UndefinedReferenceError/tuple_reassign_undefined.cash b/packages/cashc/test/compiler/UndefinedReferenceError/tuple_reassign_undefined.cash new file mode 100644 index 000000000..396dcf8ac --- /dev/null +++ b/packages/cashc/test/compiler/UndefinedReferenceError/tuple_reassign_undefined.cash @@ -0,0 +1,12 @@ +function swap(int x, int y) returns (int, int) { + return y, x; +} + +contract Test() { + function spend(int seed) { + int a = seed; + // `b` is never declared, so reassigning it must fail + (a, b) = swap(a, seed); + require(a + b >= 0); + } +} diff --git a/packages/cashc/test/generation/fixtures.ts b/packages/cashc/test/generation/fixtures.ts index 83301fcbf..7157acdc7 100644 --- a/packages/cashc/test/generation/fixtures.ts +++ b/packages/cashc/test/generation/fixtures.ts @@ -1876,4 +1876,138 @@ export const fixtures: Fixture[] = [ fingerprint: '4fcac7e0c885a2d3d6a344866c39c4febdffcaf9bb658ac08a87ed7dea9808b6', }, }, + { + // Tuple destructuring into existing variables inside branches. Scoped reassignment values are + // folded into the existing slots; a declaration value above a reassignment value is parked on + // the altstack while the fold runs (OP_TOALTSTACK ... OP_FROMALTSTACK in reassignmentFirst). + fn: 'tuple_reassignment_branches.cash', + artifact: { + contractName: 'TupleReassignmentBranches', + constructorInputs: [], + abi: [ + { name: 'declarationFirst', inputs: [{ name: 'a', type: 'int' }] }, + { name: 'reassignmentFirst', inputs: [{ name: 'a', type: 'int' }] }, + ], + bytecode: + // OP_DEFINE branchPair (id 0) — called from both functions, too large to inline + '7653957857979378529693768b7c52957b94 OP_0 OP_DEFINE ' + // function declarationFirst + + 'OP_DUP OP_0 OP_NUMEQUAL OP_IF ' + // int total = 0 + + 'OP_0 ' + // if (a > 10) + + 'OP_2 OP_PICK OP_10 OP_GREATERTHAN OP_IF ' + // int d, total = branchPair(a) — call, then fold total's value (top) into its slot; + // d's value stays in place (declarations-first needs no parking) + + 'OP_2 OP_PICK OP_0 OP_INVOKE OP_ROT OP_DROP OP_SWAP ' + // require(d != 0) + + 'OP_DUP OP_0 OP_NUMNOTEQUAL OP_VERIFY ' + // scope cleanup (drop d) + + 'OP_DROP OP_ENDIF ' + // require(total >= 0) + cleanup + + 'OP_0 OP_GREATERTHANOREQUAL OP_NIP OP_NIP ' + // function reassignmentFirst + + 'OP_ELSE OP_1 OP_NUMEQUALVERIFY ' + // int total = 0 + + 'OP_0 ' + // if (a > 10) + + 'OP_OVER OP_10 OP_GREATERTHAN OP_IF ' + // (total, int extra) = branchPair(a + 1) — call, park extra's value on the altstack, + // fold total's value into its slot (OP_NIP), restore extra's value + + 'OP_OVER OP_1ADD OP_0 OP_INVOKE OP_TOALTSTACK OP_NIP OP_FROMALTSTACK ' + // require(extra != 0) + + 'OP_DUP OP_0 OP_NUMNOTEQUAL OP_VERIFY ' + // scope cleanup (drop extra) + + 'OP_DROP OP_ENDIF ' + // require(total >= 0) + cleanup + + 'OP_0 OP_GREATERTHANOREQUAL OP_NIP OP_ENDIF', + debug: { + bytecode: '127653957857979378529693768b7c52957b94008976009c630052795aa0635279008a7b757c76009e69756800a2777767519d00785aa063788b008a6b776c76009e69756800a27768', + sourceMap: '7::10:1;;::::1;14:4:21:5:0;;;;15:20:15:21;16:12:16:13;;:16::18;:12:::1;:20:19:9:0;17:38:17:39;;:27::40:1;;:12::41;;;18:20:18:21:0;:25::26;:20:::1;:12::28;16:20:19:9;;20:25:20:26:0;:8::28:1;14:37:21:5;;:4;25::32::0;;26:20:26:21;27:12:27:13;:16::18;:12:::1;:20:30:9:0;28:44:28:45;:::49:1;:33::50;;:12::51;;;29:20:29:25:0;:29::30;:20:::1;:12::32;27:20:30:9;;31:25:31:26:0;:8::28:1;25:38:32:5;12:0:33:1', + logs: [], + requires: [ + { ip: 23, line: 18 }, + { ip: 28, line: 20 }, + { ip: 48, line: 29 }, + { ip: 53, line: 31 }, + ], + sourceTags: '24:24:sc;28:29:sc;49:49:sc;53:53:sc', + functions: [ + { + id: 0, + name: 'branchPair', + inputs: [{ name: 'x', type: 'int' }], + bytecode: '7653957857979378529693768b7c52957b94', + sourceMap: '8:12:8:13;:16::17;:12:::1;:21::22:0;:25::26;:21:::1;:12::27;:31::32:0;:35::36;:31:::1;:12::37;9:11:9:12:0;:::16:1;:18::19:0;:22::23;:18:::1;:26::27:0;:18:::1', + logs: [], + requires: [], + }, + ], + }, + source: fs.readFileSync(new URL('../valid-contract-files/tuple_reassignment_branches.cash', import.meta.url), { encoding: 'utf-8' }), + compiler: { + name: 'cashc', + version, + options: { + enforceFunctionParameterTypes: true, + enforceLocktimeGuard: true, + }, + }, + updatedAt: '', + fingerprint: 'da4982948327a26f2c708b13af6977715747aa0b5c64bc00b04e3ddbc11ca67d', + }, + }, + { + // Tuple destructuring into existing variables: top-level renames (with the small helpers + // inlined at the call sites), pure and mixed reassignment in loops, and the interleaved + // order that parks a declaration value on the altstack mid-fold. + fn: 'tuple_reassignment.cash', + artifact: { + contractName: 'TupleReassignment', + constructorInputs: [], + abi: [{ name: 'spend', inputs: [{ name: 'seed', type: 'int' }] }], + bytecode: 'OP_DUP OP_1ADD OP_2DUP OP_SWAP OP_2DUP OP_SWAP OP_0 OP_BEGIN OP_DUP OP_4 OP_LESSTHAN OP_DUP OP_TOALTSTACK OP_IF OP_OVER OP_4 OP_PICK OP_SWAP OP_5 OP_ROLL OP_DROP OP_SWAP OP_TOALTSTACK OP_SWAP OP_TOALTSTACK OP_SWAP OP_TOALTSTACK OP_SWAP OP_FROMALTSTACK OP_FROMALTSTACK OP_FROMALTSTACK OP_ROT OP_DROP OP_SWAP OP_DUP OP_1ADD OP_NIP OP_ENDIF OP_FROMALTSTACK OP_NOT OP_UNTIL OP_DROP OP_0 OP_BEGIN OP_DUP OP_4 OP_LESSTHAN OP_DUP OP_TOALTSTACK OP_IF OP_OVER OP_4 OP_PICK OP_OVER OP_2 OP_PICK OP_MUL OP_1ADD OP_SWAP OP_ROT OP_6 OP_ROLL OP_DROP OP_SWAP OP_TOALTSTACK OP_SWAP OP_TOALTSTACK OP_SWAP OP_TOALTSTACK OP_SWAP OP_TOALTSTACK OP_SWAP OP_FROMALTSTACK OP_FROMALTSTACK OP_FROMALTSTACK OP_FROMALTSTACK OP_3 OP_ROLL OP_DROP OP_SWAP OP_TOALTSTACK OP_SWAP OP_FROMALTSTACK OP_DUP OP_0 OP_GREATERTHANOREQUAL OP_VERIFY OP_OVER OP_1ADD OP_ROT OP_DROP OP_NIP OP_ENDIF OP_FROMALTSTACK OP_NOT OP_UNTIL OP_DROP OP_0 OP_BEGIN OP_DUP OP_2 OP_LESSTHAN OP_DUP OP_TOALTSTACK OP_IF OP_OVER OP_4 OP_PICK OP_OVER OP_2 OP_PICK OP_MUL OP_1ADD OP_SWAP OP_ROT OP_6 OP_ROLL OP_DROP OP_SWAP OP_TOALTSTACK OP_SWAP OP_TOALTSTACK OP_SWAP OP_TOALTSTACK OP_SWAP OP_TOALTSTACK OP_SWAP OP_FROMALTSTACK OP_FROMALTSTACK OP_FROMALTSTACK OP_FROMALTSTACK OP_TOALTSTACK OP_ROT OP_DROP OP_SWAP OP_FROMALTSTACK OP_DUP OP_0 OP_GREATERTHANOREQUAL OP_VERIFY OP_OVER OP_1ADD OP_ROT OP_DROP OP_NIP OP_ENDIF OP_FROMALTSTACK OP_NOT OP_UNTIL OP_DROP OP_2DUP OP_ROT OP_ROT OP_ADD OP_ROT OP_ADD OP_ADD OP_0 OP_GREATERTHANOREQUAL OP_VERIFY OP_2DROP OP_2DROP OP_1', + debug: { + bytecode: '768b6e7c6e7c006576549f766b637854797c557a757c6b7c6b7c6b7c6c6c6c7b757c768b77686c916675006576549f766b63785479785279958b7c7b567a757c6b7c6b7c6b7c6b7c6c6c6c6c537a757c6b7c6c7600a269788b7b7577686c916675006576529f766b63785479785279958b7c7b567a757c6b7c6b7c6b7c6b7c6c6c6c6c6b7b757c6c7600a269788b7b7577686c9166756e7b7b937b939300a2696d6d51', + sourceMap: '17:16:18:20;18:::24:1;21:22:21:26:0;:17::27:1;24:26:24:30:0;:21::31:1;27::27:22:0;:8:29:9;:24:27:25;:28::29;:24:::1;;;:42:29:9:0;28:26:28:27;:29::30;;:21::31:1;:12::32;;;;;;;;;;;;;;;;27:35:27:36:0;:::40:1;:31;:42:29:9;;:8;;;33:21:33:22:0;:8:36:9;:24:33:25;:28::29;:24:::1;;;:42:36:9:0;34:34:34:35;:37::38;;:29::39:1;;;;;;;:12::40;;;;;;;;;;;;;;;;;;;;;;;35:20:35:22:0;:26::27;:20:::1;:12::29;33:35:33:36:0;:::40:1;:31;;::36:9;:42;;:8;;;40:21:40:22:0;:8:43:9;:24:40:25;:28::29;:24:::1;;;:42:43:9:0;41:34:41:35;:37::38;;:29::39:1;;;;;;;:12::40;;;;;;;;;;;;;;;;;;;;;42:20:42:22:0;:26::27;:20:::1;:12::29;40:35:40:36:0;:::40:1;:31;;::43:9;:42;;:8;;;46:24:46:28:0;48:16:48:17;:20::21;:16:::1;:24::25:0;:16:::1;:::29;:33::34:0;:16:::1;:8::36;16:29:49:5;;', + logs: [], + requires: [ + { ip: 86, line: 35 }, + { ip: 139, line: 42 }, + { ip: 159, line: 48 }, + ], + sourceTags: '34:36:fu;37:40:lc;41:41:sc;87:91:fu;92:95:lc;96:96:sc;140:144:fu;145:148:lc;149:149:sc', + functions: [ + { + name: 'swap', + inputs: [{ name: 'x', type: 'int' }, { name: 'y', type: 'int' }], + bytecode: '7c', + sourceMap: '7:14:7:15', + logs: [], + requires: [], + }, + { + name: 'step', + inputs: [{ name: 'x', type: 'int' }, { name: 'y', type: 'int' }], + bytecode: '785279958b7c7b', + sourceMap: '12:11:12:12;:15::16;;:11:::1;:::20;:22::23:0;:25::26', + logs: [], + requires: [], + }, + ], + inlineRanges: '3:3:swap;5:5:swap;17:17:swap;53:59:step;108:114:step;151:151:swap', + }, + source: fs.readFileSync(new URL('../valid-contract-files/tuple_reassignment.cash', import.meta.url), { encoding: 'utf-8' }), + compiler: { + name: 'cashc', + version, + options: { + enforceFunctionParameterTypes: true, + enforceLocktimeGuard: true, + }, + }, + updatedAt: '', + fingerprint: '3ab69a954ec4bf9ceeb58eceb8ead206195032edf6627155eb82f528403c94dd', + }, + }, ]; diff --git a/packages/cashc/test/valid-contract-files/tuple_reassignment.cash b/packages/cashc/test/valid-contract-files/tuple_reassignment.cash new file mode 100644 index 000000000..a1a80ffd1 --- /dev/null +++ b/packages/cashc/test/valid-contract-files/tuple_reassignment.cash @@ -0,0 +1,50 @@ +// Destructuring into existing variables: a target without a type reassigns an already-declared +// variable instead of declaring a fresh one. Covers straight-line reassignment, mixed +// declaration+reassignment, and in-loop reassignment of loop-carried state (the case that previously +// needed a fresh-temp + per-element rebind workaround). + +function swap(int x, int y) returns (int, int) { + return y, x; +} + +// returns a fresh scalar followed by the two updated accumulators +function step(int x, int y) returns (int, int, int) { + return x * x + 1, y, x; +} + +contract TupleReassignment() { + function spend(int seed) { + int a = seed; + int b = seed + 1; + + // straight-line reassignment of both existing variables + (a, b) = swap(a, b); + + // mixed: declare c fresh, reassign a + (int c, a) = swap(a, b); + + // loop-carried state reassigned in place each iteration + for (int i = 0; i < 4; i = i + 1) { + (a, b) = swap(a, b); + } + + // mixed declaration + reassignment IN A LOOP: declarations-first compiles smallest + // (the reassignment values fold straight off the top of the stack) + for (int j = 0; j < 4; j = j + 1) { + (int lo, a, b) = step(a, b); + require(lo >= 0); + } + + // interleaved order works too: the declaration value is parked on the altstack while the + // reassignment value below it folds into its slot + for (int k = 0; k < 2; k = k + 1) { + (a, int hi, b) = step(a, b); + require(hi >= 0); + } + + // reassignment before declaration, in the bare (unparenthesized) form + b, int d = swap(a, c); + + require(a + b + c + d >= 0); + } +} diff --git a/packages/cashc/test/valid-contract-files/tuple_reassignment_after_final_read.cash b/packages/cashc/test/valid-contract-files/tuple_reassignment_after_final_read.cash new file mode 100644 index 000000000..15a643f64 --- /dev/null +++ b/packages/cashc/test/valid-contract-files/tuple_reassignment_after_final_read.cash @@ -0,0 +1,31 @@ +// Regression coverage: a scoped tuple reassignment is itself the variable's latest use, so the +// symbol pass must move the opRolls entry to it. Previously the last plain read kept the roll, +// codegen rolled the variable off the stack model at that read, and the reassignment crashed with +// a raw "Expected variable ... does not exist on the stack". + +function pair(int n) returns (int, int) { + return n * 2, n + 1; +} + +contract ReassignAfterFinalRead() { + function ifBranch(int x) { + int p = 10; + int q = 0; + require(p == 10); + if (x == 1) { + (p, q) = pair(x); + } + require(q == 0 || q == 2); + } + + function whileLoop(int x) { + int p = 10; + int q = 0; + require(p == 10); + while (x == 1) { + (p, q) = pair(x); + x = x + 1; + } + require(q == 0 || q == 2); + } +} diff --git a/packages/cashc/test/valid-contract-files/tuple_reassignment_branches.cash b/packages/cashc/test/valid-contract-files/tuple_reassignment_branches.cash new file mode 100644 index 000000000..f19f83281 --- /dev/null +++ b/packages/cashc/test/valid-contract-files/tuple_reassignment_branches.cash @@ -0,0 +1,33 @@ +// Scoped tuple reassignment inside if-branches: the stack layout must be preserved, so +// reassignment values are folded into the existing variable slots (with altstack parking when a +// declaration value sits above a reassignment value). + +// Called from both contract functions and large enough that it is NOT inlined, so destructuring +// also covers results produced by an OP_INVOKE call (single-call functions are always inlined). +function branchPair(int x) returns (int, int) { + int t = x * 3 + (x % 7) + (x / 2); + return t + 1, t * 2 - x; +} + +contract TupleReassignmentBranches() { + // mixed declaration + reassignment inside a branch, declarations first: no parking needed + function declarationFirst(int a) { + int total = 0; + if (a > 10) { + int d, total = branchPair(a); + require(d != 0); + } + require(total >= 0); + } + + // reassignment before declaration inside a branch: the trailing declaration value is parked + // on the altstack while the reassignment value below it folds into its slot + function reassignmentFirst(int a) { + int total = 0; + if (a > 10) { + (total, int extra) = branchPair(a + 1); + require(extra != 0); + } + require(total >= 0); + } +} diff --git a/packages/utils/src/cashproof-optimisations.ts b/packages/utils/src/cashproof-optimisations.ts index 85181ce85..ddb5cf139 100644 --- a/packages/utils/src/cashproof-optimisations.ts +++ b/packages/utils/src/cashproof-optimisations.ts @@ -134,4 +134,6 @@ OP_LESSTHAN OP_NOT <=> OP_GREATERTHANOREQUAL; OP_GREATERTHAN OP_NOT <=> OP_LESSTHANOREQUAL; OP_LESSTHANOREQUAL OP_NOT <=> OP_GREATERTHAN; OP_GREATERTHANOREQUAL OP_NOT <=> OP_LESSTHAN; + +OP_TOALTSTACK OP_FROMALTSTACK <=> ; `; diff --git a/packages/utils/src/optimisations.ts b/packages/utils/src/optimisations.ts index e22e702f0..06d22f2aa 100644 --- a/packages/utils/src/optimisations.ts +++ b/packages/utils/src/optimisations.ts @@ -150,6 +150,9 @@ const unprovableOptimisations = [ ['OP_GREATERTHAN OP_NOT', 'OP_LESSTHANOREQUAL'], ['OP_LESSTHANOREQUAL OP_NOT', 'OP_GREATERTHAN'], ['OP_GREATERTHANOREQUAL OP_NOT', 'OP_LESSTHAN'], + + // This can get emitted by tuple destructuring + ['OP_TOALTSTACK OP_FROMALTSTACK', ''], ] as [string, string][]; // Note: we moved these optimisations into a single file, but kept the exact same order as before, diff --git a/website/docs/compiler/grammar.md b/website/docs/compiler/grammar.md index fa483f8bf..05a4fb8fc 100644 --- a/website/docs/compiler/grammar.md +++ b/website/docs/compiler/grammar.md @@ -103,7 +103,13 @@ variableDefinition ; tupleAssignment - : typeName Identifier ',' typeName Identifier '=' expression + : tupleTarget (',' tupleTarget)+ '=' expression + | '(' tupleTarget (',' tupleTarget)+ ')' '=' expression + ; + +tupleTarget + : typeName Identifier + | Identifier ; assignStatement diff --git a/website/docs/language/contracts.md b/website/docs/language/contracts.md index a60cf8ac6..c2d5c3d2e 100644 --- a/website/docs/language/contracts.md +++ b/website/docs/language/contracts.md @@ -133,6 +133,27 @@ contract Example() { } ``` +You can also desctructure the return value into existing variables instead of declaring new ones: + +```solidity +function nextFib(int a, int b) returns (int, int) { + return b, a + b; +} + +contract Example() { + function spend(int fib5) { + int current = 0; + int next = 1; + for (int i = 0; i < 5; i = i + 1) { + (current, next) = nextFib(current, next); + } + require(current == fib5); + } +} +``` + +Declarations and reassignments can be mixed freely in a single destructuring (e.g. `(int fresh, current, next) = step(current, next);`). Inside loops and branches, listing declarations before reassignments compiles to slightly smaller bytecode. + :::info `checkSig`, `checkMultiSig` and `this.activeBytecode` cannot be used inside a user-defined function, since they would apply to the function body rather than the contract. Use them in a contract function instead (`checkDataSig` is allowed). ::: diff --git a/website/docs/language/types.md b/website/docs/language/types.md index cdcdf61fb..06c42f429 100644 --- a/website/docs/language/types.md +++ b/website/docs/language/types.md @@ -161,13 +161,15 @@ string cash = bitcoinCash.split(8)[1]; It is not supported to use a variable for the tupleIndex. Instead you can assign both sides of the tuple as shown below and use either element conditional on the value of the variable. ::: -It is also possible to assign both sides of the tuple at once with a destructuring syntax: +It is also possible to assign both sides of the tuple at once with a destructuring syntax, allowing both new variable declarations and reassignments: ```solidity string hello, string world = "Hello World".split(6); require(hello + "World" == "Hello " + world); ``` +Declarations and reassignments can be mixed freely in a single destructuring (e.g. `(bytes fresh, existing) = x.split(1);`). The target list may optionally be wrapped in parentheses. + ## Type Casting Type casting can be done both explicitly and implicitly depending on the type. `pubkey`, `sig` and `datasig` can be implicitly cast to `bytes`, meaning they can be used anywhere where you would normally use a `bytes` type. Explicit type casting can be done with a broader range of types, but is still limited. The syntax of this explicit type casting is illustrated below: diff --git a/website/docs/releases/release-notes.md b/website/docs/releases/release-notes.md index 51d504564..92afce18e 100644 --- a/website/docs/releases/release-notes.md +++ b/website/docs/releases/release-notes.md @@ -13,6 +13,8 @@ title: Release Notes - :sparkles: Allow for simple arithmetic / concatenation operations in global constant definitions. - :sparkles: Add `unused` modifier for parameters or variables that are intentionally unused. - :sparkles: Add support for `import` directives to share user-defined functions across files. +- :sparkles: Resolve package imports (e.g. `import "pkg/math.cash"`) from `node_modules`, so contract libraries can be installed as npm packages. +- :sparkles: Add support for reassigning existing variables in tuple destructuring (e.g. `(a, b) = swap(a, b)`), optionally mixed with fresh declarations. - :hammer_and_wrench: Update `compileString` to take an optional `files` object for filesystem-free import resolution. - :racehorse: Inline global functions and constants when this is no larger than `OP_DEFINE`/`OP_INVOKE`. - :racehorse: Add new `OP_SWAP OP_MUL` optimisation.