From ab392b803ace104669036b93480402013d31229f Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Tue, 8 Oct 2024 19:06:15 -0500 Subject: [PATCH] Fix partial parsing errors with heredoc bodies. --- src/index.ts | 2 +- src/pg.grammar | 13 +- src/pg.grammar.terms.d.ts | 1 + src/tokens.ts | 14 +- test/latex-image.txt | 4 +- test/perl-basic-operations.txt | 142 +++--- test/perl-functions.txt | 96 ++-- test/perl-heredocs.txt | 457 ++++++++++--------- test/perl-misc.txt | 10 +- test/perl-pod-and-end.txt | 12 +- test/perl-quote-and-quote-like-operators.txt | 120 ++--- test/perl-variables.txt | 132 +++--- test/pgml-substitutions.txt | 11 +- 13 files changed, 568 insertions(+), 446 deletions(-) diff --git a/src/index.ts b/src/index.ts index 5d75fe6..d5bcf10 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,7 +36,7 @@ export const pgLanguage = LRLanguage.define({ IfStatement: continuedIndent({ except: /^\s*({|else\b|elsif\b)/ }), Block: delimitedIndent({ closing: '}' }), 'StringSingleQuoted StringQQuoted StringDoubleQuoted StringQqQuoted': () => null, - 'InterpolatedHeredocBody UninterpolatedHeredocBody': () => null, + 'StatementEnd InterpolatedHeredocBody UninterpolatedHeredocBody': () => null, Statement: continuedIndent(), 'PGMLBlock PGTextBlock LaTeXImageCode': flatIndent }), diff --git a/src/pg.grammar b/src/pg.grammar index f9ab970..f154294 100644 --- a/src/pg.grammar +++ b/src/pg.grammar @@ -65,10 +65,7 @@ statement[@isGroup=Statement] { (scope)? kw<"sub"> FunctionName { !bareword Identifier } - ( - FunctionPrototype FunctionAttribute* | - FunctionAttribute* FunctionPrototypeAttribute FunctionAttribute* - )? + (FunctionPrototype FunctionAttribute* | FunctionAttribute* FunctionPrototypeAttribute FunctionAttribute*)? (semicolon | Block) } | SingleLineStatement { (expression | ReturnExpression) statementModifier semicolon } | @@ -338,7 +335,11 @@ builtinArrayFunction { (kw<"grep"> | kw<"map"> | kw<"join"> | kw<"sort"> | kw<"u scope { kw<"our"> | kw<"state"> | kw<"my"> | kw<"local"> } -semicolon { ";" | automaticSemicolon } +// This makes it so that a heredoc body is placed inside the ExpressionStatement containing the HeredocInitializer that +// starts it. This is important because when a partial parse occurs this ensures the partial parse goes back far enough +// to see the HeredocInitializer and correctly parses the heredoc body. +@skip {} { StatementEnd { ";" (InterpolatedHeredocBody | UninterpolatedHeredocBody)* statementEnd } } +semicolon { StatementEnd | automaticSemicolon } @skip {} { StringDoubleQuoted { '"' interpolationContent* '"' } @@ -460,7 +461,7 @@ commaSep1 { !atLeastOne content (commaOperator content?)* } maybeParens { !noParens content | "(" !parens content ")" } @context contextTracker from "./tokens.js" -@external tokens semicolon from "./tokens" { automaticSemicolon } +@external tokens semicolon from "./tokens" { automaticSemicolon, statementEnd } @external tokens unrestrictedIdentifier from "./tokens" { UnrestrictedIdentifier } @external tokens specialScalarVariable from "./tokens" { SpecialScalarVariable } @external tokens builtinOperator from "./tokens" { NamedUnaryOperator, ListOperator, PGOperator } diff --git a/src/pg.grammar.terms.d.ts b/src/pg.grammar.terms.d.ts index f00d289..f8f55f0 100644 --- a/src/pg.grammar.terms.d.ts +++ b/src/pg.grammar.terms.d.ts @@ -1,4 +1,5 @@ export declare const automaticSemicolon: number, + statementEnd: number, UnrestrictedIdentifier: number, SpecialScalarVariable: number, NamedUnaryOperator: number, diff --git a/src/tokens.ts b/src/tokens.ts index 7c0ede0..05ed926 100644 --- a/src/tokens.ts +++ b/src/tokens.ts @@ -4,6 +4,7 @@ import { namedUnaryOperators, listOperators } from './perl-operators'; import { pgOperators } from './pg-variables'; import { automaticSemicolon, + statementEnd, UnrestrictedIdentifier, SpecialScalarVariable, NamedUnaryOperator, @@ -337,7 +338,18 @@ export const contextTracker = new ContextTracker({ }); export const semicolon = new ExternalTokenizer((input, stack) => { - if (stack.canShift(automaticSemicolon) && input.next != 59 /* ; */ && (input.next < 0 || input.next == 125) /* } */) + if ( + stack.canShift(statementEnd) && + !heredocQueue.length && + (input.peek(-1) == 59 /* ; */ || + (input.peek(-1) != 59 /* ; */ && (input.next < 0 || input.next == 10))) /* \n */ + ) { + input.acceptToken(statementEnd, 0); + } else if ( + stack.canShift(automaticSemicolon) && + input.next != 59 /* ; */ && + (input.next < 0 || input.next == 125) /* } */ + ) input.acceptToken(automaticSemicolon); }); diff --git a/test/latex-image.txt b/test/latex-image.txt index be1475b..dd3acaa 100644 --- a/test/latex-image.txt +++ b/test/latex-image.txt @@ -12,7 +12,7 @@ END_TIKZ Program( ExpressionStatement( Assignment(ScalarVariable, "=", CallExpression(FunctionName(Identifier), ParenthesizedArguments("(", ")"))), - ";" + StatementEnd(";") ), LaTeXImageCode( ScalarVariable, @@ -38,7 +38,7 @@ END_LATEX_IMAGE Program( ExpressionStatement( Assignment(ScalarVariable, "=", CallExpression(FunctionName(Identifier), ParenthesizedArguments("(", ")"))), - ";" + StatementEnd(";") ), LaTeXImageCode( ScalarVariable, diff --git a/test/perl-basic-operations.txt b/test/perl-basic-operations.txt index 0938774..6d8434f 100644 --- a/test/perl-basic-operations.txt +++ b/test/perl-basic-operations.txt @@ -21,25 +21,34 @@ $var--; ==> Program( - ExpressionStatement(BinaryExpression(BinaryExpression(Integer, ArithOp, Integer), ArithOp, Integer), ";"), - ExpressionStatement(BinaryExpression(BinaryExpression(Integer, ArithOp, Integer), ArithOp, Integer), ";"), - ExpressionStatement(BinaryExpression(BinaryExpression(Integer, "*", Integer), "*", Integer), ";"), - ExpressionStatement(BinaryExpression(BinaryExpression(Integer, "/", Integer), "/", Integer), ";"), - ExpressionStatement(BinaryExpression(BinaryExpression(Integer, "%", Integer), "%", Integer), ";"), - ExpressionStatement(BinaryExpression(Integer, ArithOp, BinaryExpression(Integer, ArithOp, Integer)), ";"), - ExpressionStatement(BinaryExpression(List("(", Integer, ")"), x, Integer), ";"), - ExpressionStatement(BinaryExpression(Integer, ArithOp, BinaryExpression(Integer, "*", Integer)), ";"), - ExpressionStatement(BinaryExpression(Integer, ArithOp, BinaryExpression(Integer, "/", Integer)), ";"), - ExpressionStatement(UnaryExpression(ArithOp, Integer), ";"), - ExpressionStatement(UnaryExpression(ArithOp, Integer), ";"), - ExpressionStatement(UnaryExpression(LogicOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ArithOp, ScalarVariable), ";"), - ExpressionStatement(UpdateExpression(ArithOp, ScalarVariable), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, ArithOp), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, ArithOp), ";"), + ExpressionStatement( + BinaryExpression(BinaryExpression(Integer, ArithOp, Integer), ArithOp, Integer), + StatementEnd(";") + ), + ExpressionStatement( + BinaryExpression(BinaryExpression(Integer, ArithOp, Integer), ArithOp, Integer), + StatementEnd(";") + ), + ExpressionStatement(BinaryExpression(BinaryExpression(Integer, "*", Integer), "*", Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(BinaryExpression(Integer, "/", Integer), "/", Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(BinaryExpression(Integer, "%", Integer), "%", Integer), StatementEnd(";")), + ExpressionStatement( + BinaryExpression(Integer, ArithOp, BinaryExpression(Integer, ArithOp, Integer)), + StatementEnd(";") + ), + ExpressionStatement(BinaryExpression(List("(", Integer, ")"), x, Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(Integer, ArithOp, BinaryExpression(Integer, "*", Integer)), StatementEnd(";")), + ExpressionStatement(BinaryExpression(Integer, ArithOp, BinaryExpression(Integer, "/", Integer)), StatementEnd(";")), + ExpressionStatement(UnaryExpression(ArithOp, Integer), StatementEnd(";")), + ExpressionStatement(UnaryExpression(ArithOp, Integer), StatementEnd(";")), + ExpressionStatement(UnaryExpression(LogicOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ArithOp, ScalarVariable), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ArithOp, ScalarVariable), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, ArithOp), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, ArithOp), StatementEnd(";")), ExpressionStatement( BinaryExpression(List("(", BinaryExpression(Float, ArithOp, Float), ")"), "*", Integer), - ";" + StatementEnd(";") ) ) @@ -62,19 +71,19 @@ Program( ==> Program( - ExpressionStatement(BinaryExpression(Integer, CompareOp, Integer), ";"), - ExpressionStatement(BinaryExpression(Integer, CompareOp, Integer), ";"), - ExpressionStatement(BinaryExpression(Integer, CompareOp, Integer), ";"), - ExpressionStatement(BinaryExpression(Integer, CompareOp, Integer), ";"), - ExpressionStatement(BinaryExpression(StringSingleQuoted, lt, StringSingleQuoted), ";"), - ExpressionStatement(BinaryExpression(StringSingleQuoted, gt, StringSingleQuoted), ";"), - ExpressionStatement(BinaryExpression(StringSingleQuoted, le, StringSingleQuoted), ";"), - ExpressionStatement(BinaryExpression(Integer, CompareOp, Integer), ";"), - ExpressionStatement(BinaryExpression(Integer, CompareOp, Integer), ";"), - ExpressionStatement(BinaryExpression(Integer, CompareOp, Integer), ";"), - ExpressionStatement(BinaryExpression(StringSingleQuoted, eq, StringSingleQuoted), ";"), - ExpressionStatement(BinaryExpression(StringSingleQuoted, ne, StringSingleQuoted), ";"), - ExpressionStatement(BinaryExpression(StringSingleQuoted, cmp, StringSingleQuoted), ";") + ExpressionStatement(BinaryExpression(Integer, CompareOp, Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(Integer, CompareOp, Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(Integer, CompareOp, Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(Integer, CompareOp, Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(StringSingleQuoted, lt, StringSingleQuoted), StatementEnd(";")), + ExpressionStatement(BinaryExpression(StringSingleQuoted, gt, StringSingleQuoted), StatementEnd(";")), + ExpressionStatement(BinaryExpression(StringSingleQuoted, le, StringSingleQuoted), StatementEnd(";")), + ExpressionStatement(BinaryExpression(Integer, CompareOp, Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(Integer, CompareOp, Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(Integer, CompareOp, Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(StringSingleQuoted, eq, StringSingleQuoted), StatementEnd(";")), + ExpressionStatement(BinaryExpression(StringSingleQuoted, ne, StringSingleQuoted), StatementEnd(";")), + ExpressionStatement(BinaryExpression(StringSingleQuoted, cmp, StringSingleQuoted), StatementEnd(";")) ) # logic operations @@ -101,57 +110,60 @@ $a or $b or $c; ==> Program( - ExpressionStatement(BinaryExpression(ScalarVariable, LogicOp, ScalarVariable), ";"), - ExpressionStatement(BinaryExpression(ScalarVariable, LogicOp, ScalarVariable), ";"), - ExpressionStatement(BinaryExpression(ScalarVariable, LogicOp, ScalarVariable), ";"), + ExpressionStatement(BinaryExpression(ScalarVariable, LogicOp, ScalarVariable), StatementEnd(";")), + ExpressionStatement(BinaryExpression(ScalarVariable, LogicOp, ScalarVariable), StatementEnd(";")), + ExpressionStatement(BinaryExpression(ScalarVariable, LogicOp, ScalarVariable), StatementEnd(";")), ExpressionStatement( BinaryExpression(BinaryExpression(ScalarVariable, LogicOp, ScalarVariable), LogicOp, ScalarVariable), - ";" + StatementEnd(";") ), ExpressionStatement( BinaryExpression(ScalarVariable, LogicOp, BinaryExpression(ScalarVariable, LogicOp, ScalarVariable)), - ";" + StatementEnd(";") ), ExpressionStatement( BinaryExpression(ScalarVariable, LogicOp, BinaryExpression(ScalarVariable, LogicOp, ScalarVariable)), - ";" + StatementEnd(";") ), ExpressionStatement( BinaryExpression(BinaryExpression(ScalarVariable, LogicOp, ScalarVariable), LogicOp, ScalarVariable), - ";" + StatementEnd(";") ), ExpressionStatement( BinaryExpression(BinaryExpression(ScalarVariable, LogicOp, ScalarVariable), LogicOp, ScalarVariable), - ";" + StatementEnd(";") ), ExpressionStatement( BinaryExpression(BinaryExpression(ScalarVariable, LogicOp, ScalarVariable), LogicOp, ScalarVariable), - ";" + StatementEnd(";") ), - ExpressionStatement(BinaryExpression(ScalarVariable, and, ScalarVariable), ";"), - ExpressionStatement(BinaryExpression(ScalarVariable, or, ScalarVariable), ";"), - ExpressionStatement(BinaryExpression(ScalarVariable, xor, ScalarVariable), ";"), + ExpressionStatement(BinaryExpression(ScalarVariable, and, ScalarVariable), StatementEnd(";")), + ExpressionStatement(BinaryExpression(ScalarVariable, or, ScalarVariable), StatementEnd(";")), + ExpressionStatement(BinaryExpression(ScalarVariable, xor, ScalarVariable), StatementEnd(";")), ExpressionStatement( BinaryExpression(BinaryExpression(ScalarVariable, and, ScalarVariable), or, ScalarVariable), - ";" + StatementEnd(";") ), ExpressionStatement( BinaryExpression(ScalarVariable, or, BinaryExpression(ScalarVariable, and, ScalarVariable)), - ";" + StatementEnd(";") ), ExpressionStatement( BinaryExpression(BinaryExpression(ScalarVariable, and, ScalarVariable), xor, ScalarVariable), - ";" + StatementEnd(";") ), ExpressionStatement( BinaryExpression(ScalarVariable, xor, BinaryExpression(ScalarVariable, and, ScalarVariable)), - ";" + StatementEnd(";") ), ExpressionStatement( BinaryExpression(BinaryExpression(ScalarVariable, and, ScalarVariable), and, ScalarVariable), - ";" + StatementEnd(";") ), - ExpressionStatement(BinaryExpression(BinaryExpression(ScalarVariable, or, ScalarVariable), or, ScalarVariable), ";") + ExpressionStatement( + BinaryExpression(BinaryExpression(ScalarVariable, or, ScalarVariable), or, ScalarVariable), + StatementEnd(";") + ) ) # bitwise operations @@ -171,15 +183,27 @@ Program( ==> Program( - ExpressionStatement(BinaryExpression(Integer, BitOp, Integer), ";"), - ExpressionStatement(BinaryExpression(Integer, BitOp("&"), Integer), ";"), - ExpressionStatement(BinaryExpression(Integer, BitOp, Integer), ";"), - ExpressionStatement(BinaryExpression(Integer, BitOp, Integer), ";"), - ExpressionStatement(BinaryExpression(Integer, "<<", Integer), ";"), - ExpressionStatement(BinaryExpression(BinaryExpression(Integer, BitOp("&"), Integer), BitOp, Integer), ";"), - ExpressionStatement(BinaryExpression(Integer, BitOp, BinaryExpression(Integer, BitOp("&"), Integer)), ";"), - ExpressionStatement(BinaryExpression(BinaryExpression(Integer, BitOp("&"), Integer), BitOp, Integer), ";"), - ExpressionStatement(BinaryExpression(Integer, BitOp, BinaryExpression(Integer, BitOp("&"), Integer)), ";"), - ExpressionStatement(BinaryExpression(BinaryExpression(Integer, BitOp, Integer), BitOp, Integer), ";"), - ExpressionStatement(BinaryExpression(BinaryExpression(Integer, BitOp, Integer), BitOp, Integer), ";") + ExpressionStatement(BinaryExpression(Integer, BitOp, Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(Integer, BitOp("&"), Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(Integer, BitOp, Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(Integer, BitOp, Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(Integer, "<<", Integer), StatementEnd(";")), + ExpressionStatement( + BinaryExpression(BinaryExpression(Integer, BitOp("&"), Integer), BitOp, Integer), + StatementEnd(";") + ), + ExpressionStatement( + BinaryExpression(Integer, BitOp, BinaryExpression(Integer, BitOp("&"), Integer)), + StatementEnd(";") + ), + ExpressionStatement( + BinaryExpression(BinaryExpression(Integer, BitOp("&"), Integer), BitOp, Integer), + StatementEnd(";") + ), + ExpressionStatement( + BinaryExpression(Integer, BitOp, BinaryExpression(Integer, BitOp("&"), Integer)), + StatementEnd(";") + ), + ExpressionStatement(BinaryExpression(BinaryExpression(Integer, BitOp, Integer), BitOp, Integer), StatementEnd(";")), + ExpressionStatement(BinaryExpression(BinaryExpression(Integer, BitOp, Integer), BitOp, Integer), StatementEnd(";")) ) diff --git a/test/perl-functions.txt b/test/perl-functions.txt index df937fd..9c75f91 100644 --- a/test/perl-functions.txt +++ b/test/perl-functions.txt @@ -16,7 +16,7 @@ Program( ArrayVariable ) ), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -28,7 +28,7 @@ Program( ArrayVariable ) ), - ";" + StatementEnd(";") ) ) @@ -52,41 +52,41 @@ Program( FunctionName(Identifier), ParenthesizedArguments("(", ScalarVariable, Comma, ScalarVariable, ")") ), - ";" + StatementEnd(";") ), - ExpressionStatement(CallExpression(FunctionName(Identifier), ParenthesizedArguments("(", ")")), ";"), + ExpressionStatement(CallExpression(FunctionName(Identifier), ParenthesizedArguments("(", ")")), StatementEnd(";")), ExpressionStatement( CallExpression( FunctionName(PackageName(Identifier, "::", Identifier, "::", Identifier)), ParenthesizedArguments("(", Integer, ")") ), - ";" + StatementEnd(";") ), ExpressionStatement( CallExpression(FunctionName("&", Identifier), ParenthesizedArguments("(", Integer, Comma, Integer, ")")), - ";" + StatementEnd(";") ), - ExpressionStatement(CallExpressionWithBareword(FunctionName("&", Identifier)), ";"), + ExpressionStatement(CallExpressionWithBareword(FunctionName("&", Identifier)), StatementEnd(";")), ExpressionStatement( ListOperatorExpression( grep, Arguments(BinaryExpression(ScalarVariable, eq, StringSingleQuoted), Comma, ArrayVariable) ), - ";" + StatementEnd(";") ), ExpressionStatement( EvalExpression( Eval, Block("{", ExpressionStatement(ListOperatorExpression(ListOperator, Arguments(StringSingleQuoted))), "}") ), - ";" + StatementEnd(";") ), - ExpressionStatement(EvalExpression(Eval, StringDoubleQuoted(InterpolatedStringContent)), ";"), + ExpressionStatement(EvalExpression(Eval, StringDoubleQuoted(InterpolatedStringContent)), StatementEnd(";")), SingleLineStatement( DoExpression(do, Block("{", ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer)), "}")), until, Arguments(BinaryExpression(ScalarVariable, CompareOp, Integer)), - ";" + StatementEnd(";") ) ) @@ -112,15 +112,15 @@ Program( "=", ArrayVariable ), - ";" + StatementEnd(";") ), ReturnExpression(return, BinaryExpression(ScalarVariable, ArithOp, ScalarVariable)), - ";", + StatementEnd(";"), "}" ) ) ), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -137,15 +137,15 @@ Program( "=", ArrayVariable ), - ";" + StatementEnd(";") ), ReturnExpression(return, BinaryExpression(ScalarVariable, ArithOp, ScalarVariable)), - ";", + StatementEnd(";"), "}" ) ) ), - ";" + StatementEnd(";") ) ) @@ -171,7 +171,7 @@ Program( ParenthesizedArguments("(", ScalarVariable, Comma, ScalarVariable, ")") ) ), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -179,7 +179,7 @@ Program( "=", MethodInvocation(PackageName(Identifier, "::", Identifier), ArrowOperator, FunctionName(Identifier)) ), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -192,7 +192,7 @@ Program( ParenthesizedArguments("(", Integer, ")") ) ), - ";" + StatementEnd(";") ), ExpressionStatement( MethodInvocation( @@ -201,7 +201,7 @@ Program( FunctionName(Identifier), ParenthesizedArguments("(", StringSingleQuoted, ")") ), - ";" + StatementEnd(";") ), ExpressionStatement( MethodInvocation( @@ -209,7 +209,7 @@ Program( ArrowOperator, ParenthesizedArguments("(", ScalarVariable, Comma, ArrayVariable, ")") ), - ";" + StatementEnd(";") ) ) @@ -233,7 +233,7 @@ Program( ParenthesizedArguments("(", ScalarVariable, Comma, ScalarVariable, ")") ) ), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -241,7 +241,7 @@ Program( "=", IndirectMethodInvocation(FunctionName(Identifier), PackageName(Identifier, "::", Identifier)) ), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -253,7 +253,7 @@ Program( ParenthesizedArguments("(", Integer, ")") ) ), - ";" + StatementEnd(";") ), ExpressionStatement( IndirectMethodInvocation( @@ -261,7 +261,7 @@ Program( ScalarVariable, ParenthesizedArguments("(", StringSingleQuoted, ")") ), - ";" + StatementEnd(";") ) ) @@ -286,14 +286,17 @@ pop; Program( ExpressionStatement( ArrayModifierFunction(push, "(", ArrayVariable, Comma, Arguments(Integer, Comma, Integer, Comma, Integer), ")"), - ";" + StatementEnd(";") ), ExpressionStatement( ArrayModifierFunction(push, ArrayVariable, Comma, Arguments(Integer, Comma, Integer, Comma, Integer)), - ";" + StatementEnd(";") + ), + ExpressionStatement(ArrayModifierFunction(unshift, ArrayVariable, Comma, Arguments(Integer)), StatementEnd(";")), + ExpressionStatement( + ArrayModifierFunction(unshift, "(", ArrayVariable, Comma, Arguments(Integer), ")"), + StatementEnd(";") ), - ExpressionStatement(ArrayModifierFunction(unshift, ArrayVariable, Comma, Arguments(Integer)), ";"), - ExpressionStatement(ArrayModifierFunction(unshift, "(", ArrayVariable, Comma, Arguments(Integer), ")"), ";"), ExpressionStatement( ArrayModifierFunction( push, @@ -303,7 +306,7 @@ Program( Arguments(Integer, Comma, Integer, Comma, Integer), ")" ), - ";" + StatementEnd(";") ), ExpressionStatement( HashOrArrayDestructureFunction( @@ -315,15 +318,15 @@ Program( "}" ) ), - ";" + StatementEnd(";") ), - ExpressionStatement(HashOrArrayDestructureFunction(values, HashVariable), ";"), - ExpressionStatement(HashOrArrayDestructureFunction(each, ArrayVariable), ";"), - ExpressionStatement(ListOperatorExpression(ListOperator, Arguments(ArrayVariable)), ";"), - ExpressionStatement(ArrayPopOrShift(shift, ArrayVariable), ";"), - ExpressionStatement(ArrayPopOrShift(shift), ";"), - ExpressionStatement(ArrayPopOrShift(pop, ArrayVariable), ";"), - ExpressionStatement(ArrayPopOrShift(pop), ";") + ExpressionStatement(HashOrArrayDestructureFunction(values, HashVariable), StatementEnd(";")), + ExpressionStatement(HashOrArrayDestructureFunction(each, ArrayVariable), StatementEnd(";")), + ExpressionStatement(ListOperatorExpression(ListOperator, Arguments(ArrayVariable)), StatementEnd(";")), + ExpressionStatement(ArrayPopOrShift(shift, ArrayVariable), StatementEnd(";")), + ExpressionStatement(ArrayPopOrShift(shift), StatementEnd(";")), + ExpressionStatement(ArrayPopOrShift(pop, ArrayVariable), StatementEnd(";")), + ExpressionStatement(ArrayPopOrShift(pop), StatementEnd(";")) ) # named unary operators @@ -346,7 +349,7 @@ Program( "}" ) ), - ";" + StatementEnd(";") ), ExpressionStatement( NamedUnaryExpression( @@ -359,7 +362,7 @@ Program( "]" ) ), - ";" + StatementEnd(";") ), ExpressionStatement( BinaryExpression( @@ -367,7 +370,7 @@ Program( LogicOp, BinaryExpression(ScalarVariable, CompareOp, Integer) ), - ";" + StatementEnd(";") ) ) @@ -387,7 +390,10 @@ Program( FunctionName(Identifier), Block( "{", - ExpressionStatement(Assignment(VariableDeclaration(my, ScalarVariable), "=", ArrayPopOrShift(shift)), ";"), + ExpressionStatement( + Assignment(VariableDeclaration(my, ScalarVariable), "=", ArrayPopOrShift(shift)), + StatementEnd(";") + ), SingleLineStatement( ReturnExpression(return, Integer), if, @@ -398,7 +404,7 @@ Program( BinaryExpression(ScalarVariable, CompareOp, Integer) ) ), - ";" + StatementEnd(";") ), ReturnExpression( return, @@ -411,7 +417,7 @@ Program( ) ) ), - ";", + StatementEnd(";"), "}" ) ) diff --git a/test/perl-heredocs.txt b/test/perl-heredocs.txt index 116e42d..8116996 100644 --- a/test/perl-heredocs.txt +++ b/test/perl-heredocs.txt @@ -9,9 +9,8 @@ END Program( ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", HeredocInitializer("<<", HeredocStartIdentifier)), - ";" - ), - UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier) + StatementEnd(";", UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier)) + ) ) # doubled quoted tag @@ -28,44 +27,46 @@ END Program( ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", HeredocInitializer("<<", HeredocStartIdentifier)), - ";" - ), - InterpolatedHeredocBody( - InterpolatedStringContent, - HashAccessVariable(ScalarVariable, ArrowOperator, "{", Identifier, "}"), - InterpolatedStringContent, - HashAccessVariable( - HashAccessVariable(ScalarVariable, ArrowOperator, "{", Identifier, "}"), - "{", - Identifier, - "}" - ), - InterpolatedStringContent, - HashAccessVariable( - HashAccessVariable(ScalarVariable, ArrowOperator, "{", Identifier, "}"), - ArrowOperator, - "{", - Identifier, - "}" - ), - InterpolatedStringContent, - ScalarDereference( - "$", - "{", - UnaryExpression(RefOp, List("(", BinaryExpression(ScalarVariable, ArithOp, Integer), ")")), - "}" - ), - InterpolatedStringContent, - ArrayDereference( - "@", - "{", - ArrayRef("[", BinaryExpression(StringSingleQuoted, ConcatOp, StringSingleQuoted), "]"), - "}" - ), - InterpolatedStringContent, - PackageVariable(PackageName(ScalarVariable, "::", Identifier), "::", PackageVariableName(Identifier)), - InterpolatedStringContent, - HeredocEndIdentifier + StatementEnd( + ";", + InterpolatedHeredocBody( + InterpolatedStringContent, + HashAccessVariable(ScalarVariable, ArrowOperator, "{", Identifier, "}"), + InterpolatedStringContent, + HashAccessVariable( + HashAccessVariable(ScalarVariable, ArrowOperator, "{", Identifier, "}"), + "{", + Identifier, + "}" + ), + InterpolatedStringContent, + HashAccessVariable( + HashAccessVariable(ScalarVariable, ArrowOperator, "{", Identifier, "}"), + ArrowOperator, + "{", + Identifier, + "}" + ), + InterpolatedStringContent, + ScalarDereference( + "$", + "{", + UnaryExpression(RefOp, List("(", BinaryExpression(ScalarVariable, ArithOp, Integer), ")")), + "}" + ), + InterpolatedStringContent, + ArrayDereference( + "@", + "{", + ArrayRef("[", BinaryExpression(StringSingleQuoted, ConcatOp, StringSingleQuoted), "]"), + "}" + ), + InterpolatedStringContent, + PackageVariable(PackageName(ScalarVariable, "::", Identifier), "::", PackageVariableName(Identifier)), + InterpolatedStringContent, + HeredocEndIdentifier + ) + ) ) ) @@ -83,31 +84,38 @@ END Program( ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", HeredocInitializer("<<", HeredocStartIdentifier)), - ";" - ), - InterpolatedHeredocBody( - InterpolatedStringContent, - ScalarVariable, - InterpolatedStringContent, - ArrayAccessVariable(ScalarVariable, "[", Integer, "]"), - InterpolatedStringContent, - ArrayAccessVariable(ScalarVariable, ArrowOperator, "[", Integer, "]"), - InterpolatedStringContent, - ArrayAccessVariable(ScalarVariable, ArrowOperator, "[", ArithOp, Integer, "]"), - InterpolatedStringContent, - ArrayAccessVariable(ArrayAccessVariable(ScalarVariable, ArrowOperator, "[", Integer, "]"), "[", Integer, "]"), - InterpolatedStringContent, - ArrayAccessVariable( - ArrayAccessVariable(ScalarVariable, ArrowOperator, "[", Integer, "]"), - ArrowOperator, - "[", - Integer, - "]" - ), - InterpolatedStringContent, - HashAccessVariable(ScalarVariable, "{", Identifier, "}"), - InterpolatedStringContent, - HeredocEndIdentifier + StatementEnd( + ";", + InterpolatedHeredocBody( + InterpolatedStringContent, + ScalarVariable, + InterpolatedStringContent, + ArrayAccessVariable(ScalarVariable, "[", Integer, "]"), + InterpolatedStringContent, + ArrayAccessVariable(ScalarVariable, ArrowOperator, "[", Integer, "]"), + InterpolatedStringContent, + ArrayAccessVariable(ScalarVariable, ArrowOperator, "[", ArithOp, Integer, "]"), + InterpolatedStringContent, + ArrayAccessVariable( + ArrayAccessVariable(ScalarVariable, ArrowOperator, "[", Integer, "]"), + "[", + Integer, + "]" + ), + InterpolatedStringContent, + ArrayAccessVariable( + ArrayAccessVariable(ScalarVariable, ArrowOperator, "[", Integer, "]"), + ArrowOperator, + "[", + Integer, + "]" + ), + InterpolatedStringContent, + HashAccessVariable(ScalarVariable, "{", Identifier, "}"), + InterpolatedStringContent, + HeredocEndIdentifier + ) + ) ) ) @@ -122,9 +130,8 @@ END Program( ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", HeredocInitializer("<<", HeredocStartIdentifier)), - ";" - ), - UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier) + StatementEnd(";", UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier)) + ) ) # tag with space at end consumed @@ -144,14 +151,12 @@ END Program( ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", HeredocInitializer("<<", HeredocStartIdentifier)), - ";" + StatementEnd(";", UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier)) ), - UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier), ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", HeredocInitializer("<<", HeredocStartIdentifier)), - ";" - ), - InterpolatedHeredocBody(InterpolatedStringContent, HeredocEndIdentifier) + StatementEnd(";", InterpolatedHeredocBody(InterpolatedStringContent, HeredocEndIdentifier)) + ) ) # indented tag is consumed @@ -171,14 +176,12 @@ END Program( ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", HeredocInitializer("<<", HeredocStartIdentifier)), - ";" + StatementEnd(";", UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier)) ), - UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier), ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", HeredocInitializer("<<", HeredocStartIdentifier)), - ";" - ), - InterpolatedHeredocBody(InterpolatedStringContent, HeredocEndIdentifier) + StatementEnd(";", InterpolatedHeredocBody(InterpolatedStringContent, HeredocEndIdentifier)) + ) ) # indented heredoc @@ -196,14 +199,20 @@ my $N = <<~ "EOF"; Program( ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", HeredocInitializer("<<", HeredocStartIdentifier)), - ";" + StatementEnd(";", UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier)) ), - UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier), ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", HeredocInitializer("<<", HeredocStartIdentifier)), - ";" - ), - InterpolatedHeredocBody(InterpolatedStringContent, ScalarVariable, InterpolatedStringContent, HeredocEndIdentifier) + StatementEnd( + ";", + InterpolatedHeredocBody( + InterpolatedStringContent, + ScalarVariable, + InterpolatedStringContent, + HeredocEndIdentifier + ) + ) + ) ) # multiple heredocs @@ -235,10 +244,17 @@ Program( HeredocInitializer("<<", HeredocStartIdentifier) ) ), - ";" + StatementEnd( + ";", + UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier), + InterpolatedHeredocBody( + InterpolatedStringContent, + ScalarVariable, + InterpolatedStringContent, + HeredocEndIdentifier + ) + ) ), - UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier), - InterpolatedHeredocBody(InterpolatedStringContent, ScalarVariable, InterpolatedStringContent, HeredocEndIdentifier), ExpressionStatement( Assignment( VariableDeclaration(my, ScalarVariable), @@ -253,11 +269,23 @@ Program( HeredocInitializer("<<", HeredocStartIdentifier) ) ), - ";" - ), - InterpolatedHeredocBody(InterpolatedStringContent, ScalarVariable, InterpolatedStringContent, HeredocEndIdentifier), - UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier), - InterpolatedHeredocBody(InterpolatedStringContent, ScalarVariable, InterpolatedStringContent, HeredocEndIdentifier) + StatementEnd( + ";", + InterpolatedHeredocBody( + InterpolatedStringContent, + ScalarVariable, + InterpolatedStringContent, + HeredocEndIdentifier + ), + UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier), + InterpolatedHeredocBody( + InterpolatedStringContent, + ScalarVariable, + InterpolatedStringContent, + HeredocEndIdentifier + ) + ) + ) ) # heredocs with quote like operator mixed in @@ -285,9 +313,8 @@ Program( StringQQuoted(q, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter) ) ), - ";" + StatementEnd(";", UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier)) ), - UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier), ExpressionStatement( Assignment( VariableDeclaration(my, ScalarVariable), @@ -302,10 +329,17 @@ Program( HeredocInitializer("<<", HeredocStartIdentifier) ) ), - ";" - ), - InterpolatedHeredocBody(InterpolatedStringContent, ScalarVariable, InterpolatedStringContent, HeredocEndIdentifier), - UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier) + StatementEnd( + ";", + InterpolatedHeredocBody( + InterpolatedStringContent, + ScalarVariable, + InterpolatedStringContent, + HeredocEndIdentifier + ), + UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier) + ) + ) ) # quote like operator containing dereferenced quantities with heredoc starts @@ -339,10 +373,17 @@ Program( QuoteLikeEndDelimiter ) ), - ";" - ), - UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier), - InterpolatedHeredocBody(InterpolatedStringContent, ScalarVariable, InterpolatedStringContent, HeredocEndIdentifier) + StatementEnd( + ";", + UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier), + InterpolatedHeredocBody( + InterpolatedStringContent, + ScalarVariable, + InterpolatedStringContent, + HeredocEndIdentifier + ) + ) + ) ) # interpolated heredoc with body containing dereferenced quantity that starts another heredoc @@ -359,20 +400,22 @@ END Program( ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", HeredocInitializer("<<", HeredocStartIdentifier)), - ";" - ), - InterpolatedHeredocBody( - ArrayDereference("@", "{", ArrayRef("[", HeredocInitializer("<<", HeredocStartIdentifier), "]"), "}"), - InterpolatedHeredocBody( - InterpolatedStringContent, - ScalarVariable, - InterpolatedStringContent, - HeredocEndIdentifier - ), - InterpolatedStringContent, - ScalarVariable, - InterpolatedStringContent, - HeredocEndIdentifier + StatementEnd( + ";", + InterpolatedHeredocBody( + ArrayDereference("@", "{", ArrayRef("[", HeredocInitializer("<<", HeredocStartIdentifier), "]"), "}"), + InterpolatedHeredocBody( + InterpolatedStringContent, + ScalarVariable, + InterpolatedStringContent, + HeredocEndIdentifier + ), + InterpolatedStringContent, + ScalarVariable, + InterpolatedStringContent, + HeredocEndIdentifier + ) + ) ) ) @@ -389,37 +432,39 @@ END Program( ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", HeredocInitializer("<<", HeredocStartIdentifier)), - ";" - ), - InterpolatedHeredocBody( - InterpolatedStringContent, - ArrayDereference( - "@", - "{", - ArrayRef( - "[", - StringQqQuoted( - qq, - QuoteLikeStartDelimiter, - InterpolatedStringContent, - ScalarDereference( - "$", - "{", - UnaryExpression( - RefOp, - List("(", StringDoubleQuoted(InterpolatedStringContent, ScalarVariable), ")") + StatementEnd( + ";", + InterpolatedHeredocBody( + InterpolatedStringContent, + ArrayDereference( + "@", + "{", + ArrayRef( + "[", + StringQqQuoted( + qq, + QuoteLikeStartDelimiter, + InterpolatedStringContent, + ScalarDereference( + "$", + "{", + UnaryExpression( + RefOp, + List("(", StringDoubleQuoted(InterpolatedStringContent, ScalarVariable), ")") + ), + "}" + ), + InterpolatedStringContent, + QuoteLikeEndDelimiter ), - "}" + "]" ), - InterpolatedStringContent, - QuoteLikeEndDelimiter + "}" ), - "]" - ), - "}" - ), - InterpolatedStringContent, - HeredocEndIdentifier + InterpolatedStringContent, + HeredocEndIdentifier + ) + ) ) ) @@ -446,7 +491,7 @@ Program( HeredocInitializer("<<", HeredocStartIdentifier), UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier) ), - ";" + StatementEnd(";") ), ExpressionStatement( ListOperatorExpression( @@ -463,7 +508,7 @@ Program( ")" ) ), - ";" + StatementEnd(";") ) ) @@ -491,71 +536,75 @@ END1 Program( ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", HeredocInitializer("<<", HeredocStartIdentifier)), - ";" - ), - InterpolatedHeredocBody( - InterpolatedStringContent, - ArrayDereference( - "@", - "{", - ArrayRef( - "[", - StringQqQuoted( - qq, - QuoteLikeStartDelimiter, - InterpolatedStringContent, - ArrayDereference( - "@", - "{", - ArrayRef("[", HeredocInitializer("<<", HeredocStartIdentifier), "]"), - "}" + StatementEnd( + ";", + InterpolatedHeredocBody( + InterpolatedStringContent, + ArrayDereference( + "@", + "{", + ArrayRef( + "[", + StringQqQuoted( + qq, + QuoteLikeStartDelimiter, + InterpolatedStringContent, + ArrayDereference( + "@", + "{", + ArrayRef("[", HeredocInitializer("<<", HeredocStartIdentifier), "]"), + "}" + ), + InterpolatedStringContent, + QuoteLikeEndDelimiter + ), + "]" ), - InterpolatedStringContent, - QuoteLikeEndDelimiter + "}" ), - "]" - ), - "}" - ), - UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier), - InterpolatedStringContent, - HeredocEndIdentifier + UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier), + InterpolatedStringContent, + HeredocEndIdentifier + ) + ) ), ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", HeredocInitializer("<<", HeredocStartIdentifier)), - ";" - ), - InterpolatedHeredocBody( - InterpolatedStringContent, - ArrayDereference( - "@", - "{", - ArrayRef( - "[", - StringQqQuoted( - qq, - QuoteLikeStartDelimiter, - InterpolatedStringContent, - ArrayDereference( - "@", - "{", - ArrayRef( - "[", - HeredocInitializer("<<", HeredocStartIdentifier), - UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier), - "]" + StatementEnd( + ";", + InterpolatedHeredocBody( + InterpolatedStringContent, + ArrayDereference( + "@", + "{", + ArrayRef( + "[", + StringQqQuoted( + qq, + QuoteLikeStartDelimiter, + InterpolatedStringContent, + ArrayDereference( + "@", + "{", + ArrayRef( + "[", + HeredocInitializer("<<", HeredocStartIdentifier), + UninterpolatedHeredocBody(StringContent, HeredocEndIdentifier), + "]" + ), + "}" + ), + InterpolatedStringContent, + QuoteLikeEndDelimiter ), - "}" + "]" ), - InterpolatedStringContent, - QuoteLikeEndDelimiter + "}" ), - "]" - ), - "}" - ), - InterpolatedStringContent, - HeredocEndIdentifier + InterpolatedStringContent, + HeredocEndIdentifier + ) + ) ) ) @@ -584,6 +633,6 @@ Program( QuoteLikeEndDelimiter ) ), - ";" + StatementEnd(";") ) ) diff --git a/test/perl-misc.txt b/test/perl-misc.txt index 808c2da..a474223 100644 --- a/test/perl-misc.txt +++ b/test/perl-misc.txt @@ -15,7 +15,7 @@ Program( LogicOp, BinaryExpression(ScalarVariable, CompareOp, Integer) ), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -26,10 +26,10 @@ Program( Pair(Identifier, FatComma, BinaryExpression(NoArgumentNamedUnaryOperator(time), ArithOp, Integer)), Comma, Pair(Identifier, FatComma, Integer), - "}" + "}" ) ), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -42,7 +42,7 @@ Program( ParenthesizedArguments("(", ScalarVariable, ")") ) ), - ";" + StatementEnd(";") ), SingleLineStatement( ListOperatorExpression(ListOperator, Arguments(ScalarVariable)), @@ -54,7 +54,7 @@ Program( ArrayVariable ) ), - ";" + StatementEnd(";") ), EmptyStatement(";") ) diff --git a/test/perl-pod-and-end.txt b/test/perl-pod-and-end.txt index d7675c4..75eac1c 100644 --- a/test/perl-pod-and-end.txt +++ b/test/perl-pod-and-end.txt @@ -15,14 +15,14 @@ sub new { return bless {}, shift } ==> Program( - PackageStatement(package, PackageName(Identifier, "::", Identifier), ";"), + PackageStatement(package, PackageName(Identifier, "::", Identifier), StatementEnd(";")), PodStatement(PodDirective, PodContent, PodCut), FunctionDefinition( sub, FunctionName(Identifier), Block("{", ReturnExpression(return, Bless(bless, HashRef("{", "}")), Comma, ArrayPopOrShift(shift)), "}") ), - ExpressionStatement(Integer, ";") + ExpressionStatement(Integer, StatementEnd(";")) ) # __END__ @@ -44,13 +44,13 @@ $result = $compartment->reval($unsafe_code); ==> Program( - PackageStatement(package, PackageName(Identifier, "::", Identifier), ";"), + PackageStatement(package, PackageName(Identifier, "::", Identifier), StatementEnd(";")), FunctionDefinition( sub, FunctionName(Identifier), Block("{", ReturnExpression(return, Bless(bless, HashRef("{", "}")), Comma, ArrayPopOrShift(shift)), "}") ), - ExpressionStatement(Integer, ";"), + ExpressionStatement(Integer, StatementEnd(";")), EndDataStatement(__END__) ) @@ -73,12 +73,12 @@ $result = $compartment->reval($unsafe_code); ==> Program( - PackageStatement(package, PackageName(Identifier, "::", Identifier), ";"), + PackageStatement(package, PackageName(Identifier, "::", Identifier), StatementEnd(";")), FunctionDefinition( sub, FunctionName(Identifier), Block("{", ReturnExpression(return, Bless(bless, HashRef("{", "}")), Comma, ArrayPopOrShift(shift)), "}") ), - ExpressionStatement(Integer, ";"), + ExpressionStatement(Integer, StatementEnd(";")), EndDataStatement(__DATA__) ) diff --git a/test/perl-quote-and-quote-like-operators.txt b/test/perl-quote-and-quote-like-operators.txt index b09ab12..9a89e90 100644 --- a/test/perl-quote-and-quote-like-operators.txt +++ b/test/perl-quote-and-quote-like-operators.txt @@ -13,10 +13,10 @@ ==> Program( - ExpressionStatement(StringDoubleQuoted(InterpolatedStringContent, ScalarVariable), ";"), + ExpressionStatement(StringDoubleQuoted(InterpolatedStringContent, ScalarVariable), StatementEnd(";")), ExpressionStatement( StringDoubleQuoted(InterpolatedStringContent, ArrayAccessVariable(ScalarVariable, "[", Integer, "]")), - ";" + StatementEnd(";") ), ExpressionStatement( StringDoubleQuoted( @@ -40,11 +40,11 @@ Program( "]" ) ), - ";" + StatementEnd(";") ), ExpressionStatement( StringDoubleQuoted(InterpolatedStringContent, HashAccessVariable(ScalarVariable, "{", Identifier, "}")), - ";" + StatementEnd(";") ), ExpressionStatement( StringDoubleQuoted( @@ -66,7 +66,7 @@ Program( "}" ) ), - ";" + StatementEnd(";") ), ExpressionStatement( StringDoubleQuoted( @@ -101,7 +101,7 @@ Program( "}" ) ), - ";" + StatementEnd(";") ), ExpressionStatement( StringDoubleQuoted( @@ -113,7 +113,7 @@ Program( "}" ) ), - ";" + StatementEnd(";") ), ExpressionStatement( StringDoubleQuoted( @@ -125,14 +125,14 @@ Program( "}" ) ), - ";" + StatementEnd(";") ), ExpressionStatement( StringDoubleQuoted( InterpolatedStringContent, PackageVariable(PackageName(ScalarVariable, "::", Identifier), "::", PackageVariableName(Identifier)) ), - ";" + StatementEnd(";") ) ) @@ -150,14 +150,29 @@ q # this is a comment ==> Program( - ExpressionStatement(StringQQuoted(q, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter), ";"), - ExpressionStatement(StringQQuoted(q, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter), ";"), - ExpressionStatement(StringQQuoted(q, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter), ";"), - ExpressionStatement(StringQQuoted(q, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter), ";"), - ExpressionStatement(StringQQuoted(q, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter), ";"), + ExpressionStatement( + StringQQuoted(q, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter), + StatementEnd(";") + ), + ExpressionStatement( + StringQQuoted(q, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter), + StatementEnd(";") + ), + ExpressionStatement( + StringQQuoted(q, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter), + StatementEnd(";") + ), + ExpressionStatement( + StringQQuoted(q, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter), + StatementEnd(";") + ), + ExpressionStatement( + StringQQuoted(q, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter), + StatementEnd(";") + ), ExpressionStatement( StringQQuoted(q, Comment, Comment, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter), - ";" + StatementEnd(";") ) ) @@ -180,7 +195,7 @@ qq # Comment Program( ExpressionStatement( StringQqQuoted(qq, QuoteLikeStartDelimiter, InterpolatedStringContent, ScalarVariable, QuoteLikeEndDelimiter), - ";" + StatementEnd(";") ), ExpressionStatement( StringQqQuoted( @@ -190,7 +205,7 @@ Program( ArrayAccessVariable(ScalarVariable, "[", Integer, "]"), QuoteLikeEndDelimiter ), - ";" + StatementEnd(";") ), ExpressionStatement( StringQqQuoted( @@ -200,7 +215,7 @@ Program( ArrayAccessVariable(ScalarVariable, ArrowOperator, "[", ArithOp, Integer, "]"), QuoteLikeEndDelimiter ), - ";" + StatementEnd(";") ), ExpressionStatement( StringQqQuoted( @@ -210,7 +225,7 @@ Program( HashAccessVariable(ScalarVariable, "{", Identifier, "}"), QuoteLikeEndDelimiter ), - ";" + StatementEnd(";") ), ExpressionStatement( StringQqQuoted( @@ -221,7 +236,7 @@ Program( InterpolatedStringContent, QuoteLikeEndDelimiter ), - ";" + StatementEnd(";") ), ExpressionStatement( StringQqQuoted( @@ -236,7 +251,7 @@ Program( ), QuoteLikeEndDelimiter ), - ";" + StatementEnd(";") ), ExpressionStatement( StringQqQuoted( @@ -251,11 +266,11 @@ Program( ), QuoteLikeEndDelimiter ), - ";" + StatementEnd(";") ), ExpressionStatement( StringQqQuoted(qq, QuoteLikeStartDelimiter, InterpolatedStringContent, QuoteLikeEndDelimiter), - ";" + StatementEnd(";") ), ExpressionStatement( StringQqQuoted( @@ -268,7 +283,7 @@ Program( InterpolatedStringContent, QuoteLikeEndDelimiter ), - ";" + StatementEnd(";") ) ) @@ -288,15 +303,15 @@ qw # this is a comment Program( ExpressionStatement( QWList(qw, QWListContent(QuoteLikeStartDelimiter, QWElement, QWElement, QWElement, QuoteLikeEndDelimiter)), - ";" + StatementEnd(";") ), ExpressionStatement( QWList(qw, QWListContent(QuoteLikeStartDelimiter, QWElement, QWElement, QWElement, QuoteLikeEndDelimiter)), - ";" + StatementEnd(";") ), ExpressionStatement( QWList(qw, QWListContent(QuoteLikeStartDelimiter, QWElement, QWElement, QWElement, QuoteLikeEndDelimiter)), - ";" + StatementEnd(";") ), ExpressionStatement( QWList( @@ -311,11 +326,11 @@ Program( QuoteLikeEndDelimiter ) ), - ";" + StatementEnd(";") ), ExpressionStatement( QWList(qw, QWListContent(QuoteLikeStartDelimiter, QWElement, QWElement, QWElement, QuoteLikeEndDelimiter)), - ";" + StatementEnd(";") ), ExpressionStatement( QWList( @@ -324,7 +339,7 @@ Program( Comment, QWListContent(QuoteLikeStartDelimiter, QWElement, QWElement, QWElement, QuoteLikeEndDelimiter) ), - ";" + StatementEnd(";") ) ) @@ -353,15 +368,15 @@ Program( QuoteLikeEndDelimiter, RegexOptions ), - ";" + StatementEnd(";") ), ExpressionStatement( PatternMatchM(m, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter, RegexOptions), - ";" + StatementEnd(";") ), ExpressionStatement( PatternMatchM(m, Comment, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter, RegexOptions), - ";" + StatementEnd(";") ), ExpressionStatement( BinaryExpression( @@ -369,23 +384,23 @@ Program( BindingOp, PatternMatch("/", InterpolatedStringContent, EscapeSequence, InterpolatedStringContent, "/") ), - ";" + StatementEnd(";") ), ExpressionStatement( BinaryExpression(ScalarVariable, BindingOp, PatternMatch("/", InterpolatedStringContent, "/", RegexOptions)), - ";" + StatementEnd(";") ), ExpressionStatement( BinaryExpression(ScalarVariable, BindingOp, PatternMatch("/", EscapeSequence, "/", RegexOptions)), - ";" + StatementEnd(";") ), ExpressionStatement( PatternMatchM(m, QuoteLikeStartDelimiter, EscapeSequence, QuoteLikeEndDelimiter, RegexOptions), - ";" + StatementEnd(";") ), ExpressionStatement( PatternMatch("/", InterpolatedStringContent, ScalarVariable, InterpolatedStringContent, "/"), - ";" + StatementEnd(";") ) ) @@ -401,12 +416,15 @@ qr # comment Program( ExpressionStatement( RegexQr(qr, QuoteLikeStartDelimiter, InterpolatedStringContent, QuoteLikeEndDelimiter, RegexOptions), - ";" + StatementEnd(";") + ), + ExpressionStatement( + RegexQr(qr, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter, RegexOptions), + StatementEnd(";") ), - ExpressionStatement(RegexQr(qr, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter, RegexOptions), ";"), ExpressionStatement( RegexQr(qr, Comment, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter, RegexOptions), - ";" + StatementEnd(";") ) ) @@ -437,7 +455,7 @@ Program( EscapeSequence, QuoteLikeEndDelimiter ), - ";" + StatementEnd(";") ), ExpressionStatement( SubstitutionS( @@ -449,7 +467,7 @@ Program( QuoteLikeEndDelimiter, RegexOptions ), - ";" + StatementEnd(";") ), ExpressionStatement( SubstitutionS( @@ -460,7 +478,7 @@ Program( StringContent, QuoteLikeEndDelimiter ), - ";" + StatementEnd(";") ), ExpressionStatement( SubstitutionS( @@ -473,7 +491,7 @@ Program( QuoteLikeEndDelimiter, RegexOptions ), - ";" + StatementEnd(";") ), ExpressionStatement( SubstitutionS( @@ -490,7 +508,7 @@ Program( QuoteLikeEndDelimiter, RegexOptions ), - ";" + StatementEnd(";") ) ) @@ -522,7 +540,7 @@ Program( StringContent, QuoteLikeEndDelimiter ), - ";" + StatementEnd(";") ), ExpressionStatement( TransliterationTrOrY( @@ -533,7 +551,7 @@ Program( StringContent, QuoteLikeEndDelimiter ), - ";" + StatementEnd(";") ), ExpressionStatement( TransliterationTrOrY( @@ -550,7 +568,7 @@ Program( QuoteLikeEndDelimiter, RegexOptions ), - ";" + StatementEnd(";") ), ExpressionStatement( TransliterationTrOrY( @@ -567,7 +585,7 @@ Program( QuoteLikeEndDelimiter, RegexOptions ), - ";" + StatementEnd(";") ) ) @@ -642,6 +660,6 @@ Program( InterpolatedStringContent, QuoteLikeEndDelimiter ), - ";" + StatementEnd(";") ) ) diff --git a/test/perl-variables.txt b/test/perl-variables.txt index 3e76f74..fd20b38 100644 --- a/test/perl-variables.txt +++ b/test/perl-variables.txt @@ -8,9 +8,10 @@ my ($var1, $var2) = (1, 2); ==> Program( - ExpressionStatement(Assignment(VariableDeclaration(my, ScalarVariable), "=", Integer), ";"), + ExpressionStatement(Assignment(VariableDeclaration(my, ScalarVariable), "=", Integer), StatementEnd(";")), ExpressionStatement( - Assignment(VariableDeclaration(my, ArrayVariable), "=", List("(", Integer, Comma, Integer, ")")), ";" + Assignment(VariableDeclaration(my, ArrayVariable), "=", List("(", Integer, Comma, Integer, ")")), + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -18,7 +19,7 @@ Program( "=", List("(", Pair(Identifier, FatComma, Integer), Comma, Pair(Identifier, FatComma, Integer), ")") ), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -26,7 +27,7 @@ Program( "=", List("(", Integer, Comma, Integer, ")") ), - ";" + StatementEnd(";") ) ) @@ -55,25 +56,25 @@ $var x= 2; ==> Program( - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, StringSingleQuoted), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), ";"), - ExpressionStatement(UpdateExpression(ScalarVariable, x, "=", Integer), ";") + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, StringSingleQuoted), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, UpdateOp, Integer), StatementEnd(";")), + ExpressionStatement(UpdateExpression(ScalarVariable, x, "=", Integer), StatementEnd(";")) ) # variable dereferencing @@ -92,14 +93,14 @@ ${$var}; ==> Program( - ExpressionStatement(ScalarDereference("$", ScalarVariable), ";"), - ExpressionStatement(ScalarDereference("$", "{", ScalarVariable, "}"), ";"), - ExpressionStatement(ArrayDereference("@", ScalarVariable), ";"), - ExpressionStatement(ArrayDereference("@" "{", ScalarVariable, "}"), ";"), - ExpressionStatement(HashDereference("%", ScalarVariable), ";"), - ExpressionStatement(HashDereference("%", "{", ScalarVariable, "}"), ";"), - ExpressionStatement(TypeGlobDereference("*", "{", ScalarVariable, "}"), ";"), - ExpressionStatement(TypeGlobDereference("*", ScalarVariable), ";"), + ExpressionStatement(ScalarDereference("$", ScalarVariable), StatementEnd(";")), + ExpressionStatement(ScalarDereference("$", "{", ScalarVariable, "}"), StatementEnd(";")), + ExpressionStatement(ArrayDereference("@", ScalarVariable), StatementEnd(";")), + ExpressionStatement(ArrayDereference("@" "{", ScalarVariable, "}"), StatementEnd(";")), + ExpressionStatement(HashDereference("%", ScalarVariable), StatementEnd(";")), + ExpressionStatement(HashDereference("%", "{", ScalarVariable, "}"), StatementEnd(";")), + ExpressionStatement(TypeGlobDereference("*", "{", ScalarVariable, "}"), StatementEnd(";")), + ExpressionStatement(TypeGlobDereference("*", ScalarVariable), StatementEnd(";")), ExpressionStatement( FunctionDereference( "&", @@ -107,9 +108,9 @@ Program( BinaryExpression(ScalarVariable, ConcatOp, StringDoubleQuoted(InterpolatedStringContent, ScalarVariable)), "}" ), - ";" + StatementEnd(";") ), - ExpressionStatement(FunctionDereference("&", ScalarVariable), ";") + ExpressionStatement(FunctionDereference("&", ScalarVariable), StatementEnd(";")) ) # hash and array references @@ -124,11 +125,11 @@ my $var = +{ a => 1, b => 2 }; Program( ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", UnaryExpression(RefOp, ArrayVariable)), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment(VariableDeclaration(my, ScalarVariable), "=", ArrayRef("[", Integer, Comma, Integer, "]")), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -136,7 +137,7 @@ Program( "=", HashRef("{", Pair(Identifier, FatComma, Integer), Comma, Pair(Identifier, FatComma, Integer), "}") ), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -144,7 +145,7 @@ Program( "=", HashRef(ArithOp, "{", Pair(Identifier, FatComma, Integer), Comma, Pair(Identifier, FatComma, Integer), "}") ), - ";" + StatementEnd(";") ) ) @@ -166,19 +167,19 @@ $var->{a}->{a}; ==> Program( - ExpressionStatement(ArrayAccessVariable(ScalarVariable, "[", Integer, "]"), ";"), + ExpressionStatement(ArrayAccessVariable(ScalarVariable, "[", Integer, "]"), StatementEnd(";")), ExpressionStatement( ArrayAccessVariable(ArrayAccessVariable(ScalarVariable, "[", Integer, "]"), "[", Integer, "]"), - ";" + StatementEnd(";") ), - ExpressionStatement(ArrayAccessVariable(ScalarVariable, ArrowOperator, "[", Integer, "]"), ";"), + ExpressionStatement(ArrayAccessVariable(ScalarVariable, ArrowOperator, "[", Integer, "]"), StatementEnd(";")), ExpressionStatement( ArrayAccessVariable(ScalarVariable, ArrowOperator, "[", UnaryExpression(ArithOp, Integer), "]"), - ";" + StatementEnd(";") ), ExpressionStatement( ArrayAccessVariable(ArrayAccessVariable(ScalarVariable, ArrowOperator, "[", Integer, "]"), "[", Integer, "]"), - ";" + StatementEnd(";") ), ExpressionStatement( ArrayAccessVariable( @@ -188,15 +189,18 @@ Program( Integer, "]" ), - ";" + StatementEnd(";") ), - ExpressionStatement(HashAccessVariable(ScalarVariable, "{", Identifier, "}"), ";"), + ExpressionStatement(HashAccessVariable(ScalarVariable, "{", Identifier, "}"), StatementEnd(";")), ExpressionStatement( HashAccessVariable(HashAccessVariable(ScalarVariable, "{", Identifier, "}"), "{", Identifier, "}"), - ";" + StatementEnd(";") + ), + ExpressionStatement(HashAccessVariable(ScalarVariable, ArrowOperator, "{", Identifier, "}"), StatementEnd(";")), + ExpressionStatement( + HashAccessVariable(ScalarVariable, ArrowOperator, "{", StringSingleQuoted, "}"), + StatementEnd(";") ), - ExpressionStatement(HashAccessVariable(ScalarVariable, ArrowOperator, "{", Identifier, "}"), ";"), - ExpressionStatement(HashAccessVariable(ScalarVariable, ArrowOperator, "{", StringSingleQuoted, "}"), ";"), ExpressionStatement( HashAccessVariable( HashAccessVariable(ScalarVariable, ArrowOperator, "{", Identifier, "}"), @@ -204,7 +208,7 @@ Program( Identifier, "}" ), - ";" + StatementEnd(";") ), ExpressionStatement( HashAccessVariable( @@ -214,7 +218,7 @@ Program( Identifier, "}" ), - ";" + StatementEnd(";") ) ) @@ -229,11 +233,11 @@ ${^CHILD_ERROR_NATIVE}; ==> Program( - ExpressionStatement(SpecialScalarVariable, ";"), - ExpressionStatement(SpecialScalarVariable, ";"), - ExpressionStatement(SpecialScalarVariable, ";"), - ExpressionStatement(SpecialScalarVariable, ";"), - ExpressionStatement(SpecialScalarVariable, ";") + ExpressionStatement(SpecialScalarVariable, StatementEnd(";")), + ExpressionStatement(SpecialScalarVariable, StatementEnd(";")), + ExpressionStatement(SpecialScalarVariable, StatementEnd(";")), + ExpressionStatement(SpecialScalarVariable, StatementEnd(";")), + ExpressionStatement(SpecialScalarVariable, StatementEnd(";")) ) # type globs @@ -248,19 +252,19 @@ local *fh; ==> Program( - ExpressionStatement(Assignment(TypeGlob, "=", TypeGlob), ";"), + ExpressionStatement(Assignment(TypeGlob, "=", TypeGlob), StatementEnd(";")), ExpressionStatement( Assignment( VariableDeclaration(local, TypeGlob), "=", UnaryExpression(RefOp, PackageVariable(PackageName(ScalarVariable), "::", PackageVariableName(Identifier))) ), - ";" + StatementEnd(";") ), - ExpressionStatement(Assignment(ScalarVariable, "=", TypeGlob), ";"), - ExpressionStatement(Assignment(ScalarVariable, "=", UnaryExpression(RefOp, TypeGlob)), ";"), - ExpressionStatement(VariableDeclaration(local, TypeGlob), ";"), - ExpressionStatement(HashAccessVariable(TypeGlob, "{", Identifier, "}"), ";") + ExpressionStatement(Assignment(ScalarVariable, "=", TypeGlob), StatementEnd(";")), + ExpressionStatement(Assignment(ScalarVariable, "=", UnaryExpression(RefOp, TypeGlob)), StatementEnd(";")), + ExpressionStatement(VariableDeclaration(local, TypeGlob), StatementEnd(";")), + ExpressionStatement(HashAccessVariable(TypeGlob, "{", Identifier, "}"), StatementEnd(";")) ) # package variables @@ -279,7 +283,7 @@ Program( "=", StringSingleQuoted ), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -287,7 +291,7 @@ Program( "=", List("(", Integer, Comma, Integer, Comma, Integer, ")") ), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -295,7 +299,7 @@ Program( "=", List("(", Pair(Identifier, FatComma, Integer), Comma, Pair(Identifier, FatComma, Integer), ")") ), - ";" + StatementEnd(";") ), ExpressionStatement( Assignment( @@ -307,6 +311,6 @@ Program( "=", Integer ), - ";" + StatementEnd(";") ) ) diff --git a/test/pgml-substitutions.txt b/test/pgml-substitutions.txt index 9d3781a..1812656 100644 --- a/test/pgml-substitutions.txt +++ b/test/pgml-substitutions.txt @@ -22,7 +22,7 @@ END_PGML "children": [ { "name": "BeginPG", "from": 0, "to": 10 }, { - "name": "PGMLContent", + "name": "PGMLContent", "from": 10, "to": 157, "children": [ @@ -192,7 +192,14 @@ END_PGML } ] }, - { "name": ";", "from": 132, "to": 133 } + { + "name": "StatementEnd", + "from": 132, + "to": 133, + "children": [ + { "name": ";", "from": 132, "to": 133 } + ] + } ] }, {