From 7271fb9de3c76f1fb2d7371d59ff9cdf6b5443ed Mon Sep 17 00:00:00 2001 From: John Kerl Date: Sat, 7 Feb 2026 15:45:48 -0500 Subject: [PATCH] Format Go bits within `mlr.bnf` (#1955) * step * step * step * step * step * step * step * whitespace * programmatic reformat * BNF-formatter automation * run tools/build-dsl --- README-dev.md | 2 +- pkg/parsing/mlr.bnf | 2865 ++++++++++++++---------- pkg/parsing/parser/productionstable.go | 1868 +++++++-------- tools/format-go-in-bnf | 65 + 4 files changed, 2705 insertions(+), 2095 deletions(-) create mode 100755 tools/format-go-in-bnf diff --git a/README-dev.md b/README-dev.md index 6dd708f95..82a8e6aa0 100644 --- a/README-dev.md +++ b/README-dev.md @@ -120,7 +120,7 @@ So, in broad overview, the key packages are: * [pkg/input](./pkg/input) is as above -- one record-reader type per supported input file format, and a factory method. * [pkg/output](./pkg/output) is as above -- one record-writer type per supported output file format, and a factory method. * [pkg/transformers](./pkg/transformers) contains the abstract record-transformer interface datatype, as well as the Go-channel chaining mechanism for piping one transformer into the next. It also contains all the concrete record-transformers such as `cat`, `tac`, `sort`, `put`, and so on. -* [pkg/parsing](./pkg/parsing) contains a single source file, `mlr.bnf`, which is the lexical/semantic grammar file for the Miller `put`/`filter` DSL using the GOCC framework. All subdirectories of `pkg/parsing/` are autogen code created by GOCC's processing of `mlr.bnf`. If you need to edit `mlr.bnf`, please use [tools/build-dsl](./tools/build-dsl) to autogenerate Go code from it (using the GOCC tool). (This takes several minutes to run.) +* [pkg/parsing](./pkg/parsing) contains a single source file, `mlr.bnf`, which is the lexical/semantic grammar file for the Miller `put`/`filter` DSL using the GOCC framework. All subdirectories of `pkg/parsing/` are autogen code created by GOCC's processing of `mlr.bnf`. If you need to edit `mlr.bnf`, please use [tools/build-dsl](./tools/build-dsl) to autogenerate Go code from it (using the GOCC tool). (This takes several minutes to run.) See also [tools/format-go-in-bnf](./tools/format-go-in-bnf) (which reads `stdin` and writes `stdout`) for automated formatting of the Go bits. * [pkg/dsl](./pkg/dsl) contains [`ast_types.go`](pkg/dsl/ast_types.go) which is the abstract syntax tree datatype shared between GOCC and Miller. I didn't use a `pkg/dsl/ast` naming convention, although that would have been nice, in order to avoid a Go package-dependency cycle. * [pkg/dsl/cst](./pkg/dsl/cst) is the concrete syntax tree, constructed from an AST produced by GOCC. The CST is what is actually executed on every input record when you do things like `$z = $x * 0.3 * $y`. Please see the [pkg/dsl/cst/README.md](./pkg/dsl/cst/README.md) for more information. diff --git a/pkg/parsing/mlr.bnf b/pkg/parsing/mlr.bnf index 92fd8ea03..f52ac4616 100644 --- a/pkg/parsing/mlr.bnf +++ b/pkg/parsing/mlr.bnf @@ -1,6 +1,7 @@ // ================================================================ -// If you edit this file, please run tools/build-dsl to autogenerate -// Go code from it, using the GOCC tool. +// If you edit this file, please run tools/build-dsl to autogenerate Go code +// from it, using the GOCC tool. See also tools/format-go-in-bnf (which reads +// `stdin` and writes `stdout`) for automated code formatting of the Go bits. // ================================================================ // ================================================================ @@ -301,7 +302,6 @@ non_sigil_name : _leading_idchar { _idchar } ; // we'll know if we're evaluating something we should not. panic : '%' '%' '%' 'p' 'a' 'n' 'i' 'c' '%' '%' '%' ; - // ================================================================ // SYNTAX ELEMENTS // ================================================================ @@ -355,7 +355,9 @@ panic : '%' '%' '%' 'p' 'a' 'n' 'i' 'c' '%' '%' '%' ; // ---------------------------------------------------------------- Root : StatementBlock - << dsl.NewASTWithErrorReturn($0) >> + << + dsl.NewASTWithErrorReturn($0) + >> ; // ---------------------------------------------------------------- @@ -367,14 +369,19 @@ StatementBlock // Empty statement. This allows for 'mlr put ""', as well as repeated semicolons. : empty - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{}, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeStatementBlock, + []interface{}{}, + ) + >> | NonEmptyStatementBlock - << dsl.WithErrorReturn($0) >> + << + dsl.WithErrorReturn($0) + >> + ; // ---------------------------------------------------------------- @@ -388,37 +395,47 @@ NonEmptyStatementBlock // Things not ending in a curly brace, like assignments -- and also do-while. : BracelessStatement - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeStatementBlock, + []interface{}{ + $0, + }, + ) + >> // Things ending in a curly brace, like for/do/while, begin/end, and pattern-acction blocks | BracefulStatement - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeStatementBlock, + []interface{}{ + $0, + }, + ) + >> // ---------------------- Recursive rules // So statements can start with a semicolon | ";" StatementBlock - << dsl.WithErrorReturn($1) >> + << + dsl.WithErrorReturn($1) + >> // Normal case for sequential statements like '$x=1; $y=2' | BracelessStatement ";" StatementBlock - <> + << + dsl.WithChildPrepended($2, $0) + >> // For 'begin {...} ; $x=1' | BracefulStatement ";" StatementBlock - <> + << + dsl.WithChildPrepended($2, $0) + >> // These are for things like 'begin {...} begin {...} ...' -- where people // shouldn't have to put semicolons after the closing curly braces. @@ -433,32 +450,40 @@ NonEmptyStatementBlock // E.g. 'begin {...} begin {...} $x=1' | BracefulStatement BracefulStatement StatementBlock - <> + << + dsl.WithTwoChildrenPreprended($2, $0, $1) + >> // E.g. 'begin {...} $x=1' | BracefulStatement BracelessStatement - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{ - $0, - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeStatementBlock, + []interface{}{ + $0, + $1, + }, + ) + >> // E.g. 'begin {...} $x=1 ;' | BracefulStatement BracelessStatement ";" - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{ - $0, - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeStatementBlock, + []interface{}{ + $0, + $1, + }, + ) + >> | BracefulStatement BracelessStatement ";" NonEmptyStatementBlock - <> + << + dsl.WithTwoChildrenPreprended($3, $0, $1) + >> ; // ---------------------------------------------------------------- @@ -466,7 +491,9 @@ NonEmptyStatementBlock // which use curly-braced bodies. StatementBlockInBraces : "{" StatementBlock "}" - << dsl.WithErrorReturn($1) >> + << + dsl.WithErrorReturn($1) + >> ; // ================================================================ @@ -502,14 +529,16 @@ BracelessStatement Assignment : Lvalue "=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeAssignment, - []interface{}{ - $0, - $2, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeAssignment, + []interface{}{ + $0, + $2, + }, + ) + >> ; Unset @@ -543,29 +572,35 @@ Unset Lvalue : Rvalue | Typedecl LocalVariable - << dsl.WithChildAppended($1, $0) >> + << + dsl.WithChildAppended($1, $0) + >> ; BareBoolean : Rvalue - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeBareBoolean, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeBareBoolean, + []interface{}{ + $0, + }, + ) + >> ; FilterStatement : filter Rvalue - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeFilterStatement, - []interface{}{ - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeFilterStatement, + []interface{}{ + $1, + }, + ) + >> ; // ---------------------------------------------------------------- @@ -573,44 +608,58 @@ FilterStatement Redirector : ">" RedirectTarget - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeRedirectWrite, - []interface{}{ - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeRedirectWrite, + []interface{}{ + $1, + }, + ) + >> + | ">>" RedirectTarget - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeRedirectAppend, - []interface{}{ - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeRedirectAppend, + []interface{}{ + $1, + }, + ) + >> + | "|" RedirectTarget - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeRedirectPipe, - []interface{}{ - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeRedirectPipe, + []interface{}{ + $1, + }, + ) + >> ; RedirectTarget : stdout - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeRedirectTargetStdout, - []interface{}{}, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeRedirectTargetStdout, + []interface{}{}, + ) + >> + | stderr - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeRedirectTargetStderr, - []interface{}{}, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeRedirectTargetStderr, + []interface{}{}, + ) + >> + | Rvalue ; @@ -662,7 +711,7 @@ PrintStatement << dsl.NewASTNodeWithErrorReturn( $0, - dsl.NodeTypePrintStatement, // redirect + dsl.NodeTypePrintStatement, // redirect []interface{}{ // print $3, @@ -679,7 +728,7 @@ PrintnStatement << dsl.NewASTNodeWithErrorReturn( $0, - dsl.NodeTypePrintnStatement, // no redirect + dsl.NodeTypePrintnStatement, // no redirect []interface{}{ // printn dsl.NewASTNodeTerminal(nil, dsl.NodeTypeNoOp), @@ -707,7 +756,7 @@ PrintnStatement << dsl.NewASTNodeWithErrorReturn( $0, - dsl.NodeTypePrintnStatement, // no redirect + dsl.NodeTypePrintnStatement, // no redirect []interface{}{ // printn $1, @@ -761,6 +810,7 @@ EprintStatement }, ) >> + ; // ---------------------------------------------------------------- @@ -792,6 +842,7 @@ EprintnStatement }, ) >> + ; // ---------------------------------------------------------------- @@ -847,6 +898,7 @@ DumpStatement }, ) >> + ; // ---------------------------------------------------------------- @@ -874,19 +926,23 @@ EdumpStatement }, ) >> + ; // ---------------------------------------------------------------- TeeStatement : tee Redirector "," FullSrec - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeTeeStatement, - []interface{}{ - $3, - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeTeeStatement, + []interface{}{ + $3, + $1, + }, + ) + >> + ; // ---------------------------------------------------------------- @@ -903,7 +959,7 @@ EmitFStatement dsl.NewASTNodeWithErrorReturn( $0, // no redirect - dsl.NodeTypeEmitFStatement, + dsl.NodeTypeEmitFStatement, []interface{}{ // emitf $1, @@ -924,6 +980,7 @@ EmitFStatement }, ) >> + ; // ---------------------------------------------------------------- @@ -955,6 +1012,7 @@ Emit1Statement }, ) >> + ; // ---------------------------------------------------------------- @@ -1029,7 +1087,7 @@ EmitStatement $2, // emit dsl.NewASTNodeTerminal(nil, dsl.NodeTypeNoOp), // emittables dsl.NewASTNodeTerminal(nil, dsl.NodeTypeNoOp), // no keys - }, + }, ) >> @@ -1098,6 +1156,7 @@ EmitStatement }, ) >> + ; // ---------------------------------------------------------------- @@ -1205,6 +1264,7 @@ EmitPStatement }, ) >> + ; // ---------------------------------------------------------------- @@ -1222,22 +1282,28 @@ EmittableList // Allow trailing final comma, especially for multiline statements | Emittable "," EmittableList - << dsl.WithChildPrepended( - $2, - $0, - ) >> + << + dsl.WithChildPrepended( + $2, + $0, + ) + >> + ; // Wraps a single emittable in a list-of-one node. EmittableAsList : Emittable - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeEmittableList, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeEmittableList, + []interface{}{ + $0, + }, + ) + >> + ; Emittable @@ -1260,19 +1326,24 @@ Emittable EmitKeys : Rvalue - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeEmitKeys, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeEmitKeys, + []interface{}{ + $0, + }, + ) + >> | Rvalue "," EmitKeys - << dsl.WithChildPrepended( - $2, - $0, - ) >> + << + dsl.WithChildPrepended( + $2, + $0, + ) + >> + ; // ---------------------------------------------------------------- @@ -1290,18 +1361,24 @@ FieldValue // with at the AST level. Hence the NewASTNodeStripDollarOrAtSign. DirectFieldValue : field_name - << dsl.NewASTNodeStripDollarOrAtSign($0, dsl.NodeTypeDirectFieldValue) >> + << + dsl.NewASTNodeStripDollarOrAtSign($0, dsl.NodeTypeDirectFieldValue) + >> + ; IndirectFieldValue : "$[" Rvalue "]" - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("$[]", $0), - dsl.NodeTypeIndirectFieldValue, - []interface{}{ - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("$[]", $0), + dsl.NodeTypeIndirectFieldValue, + []interface{}{ + $1, + }, + ) + >> + ; // * Direct is '$name' @@ -1310,34 +1387,46 @@ IndirectFieldValue // name has spaces or somesuch in it. BracedFieldValue : braced_field_name - << dsl.NewASTNodeStripDollarOrAtSignAndCurlyBraces($0, dsl.NodeTypeDirectFieldValue) >> + << + dsl.NewASTNodeStripDollarOrAtSignAndCurlyBraces($0, dsl.NodeTypeDirectFieldValue) + >> + ; PositionalFieldName : "$[[" Rvalue "]" "]" // Not "]]" since that would define a token, making '$foo[bar[1]]' a syntax error - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("$[]", $0), - dsl.NodeTypePositionalFieldName, - []interface{}{ - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("$[]", $0), + dsl.NodeTypePositionalFieldName, + []interface{}{ + $1, + }, + ) + >> + ; PositionalFieldValue : "$[[[" Rvalue "]" "]" "]" // Not "]]]" since that would define a token, making '$foo[bar[baz[1]]]' a syntax error - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("$[]", $0), - dsl.NodeTypePositionalFieldValue, - []interface{}{ - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("$[]", $0), + dsl.NodeTypePositionalFieldValue, + []interface{}{ + $1, + }, + ) + >> + ; FullSrec : full_srec - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeFullSrec) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeFullSrec) + >> + ; // ---------------------------------------------------------------- @@ -1353,18 +1442,24 @@ OosvarValue // with at the AST level. Hence the NewASTNodeStripDollarOrAtSign. DirectOosvarValue : oosvar_name - << dsl.NewASTNodeStripDollarOrAtSign($0, dsl.NodeTypeDirectOosvarValue) >> + << + dsl.NewASTNodeStripDollarOrAtSign($0, dsl.NodeTypeDirectOosvarValue) + >> + ; IndirectOosvarValue : "@[" Rvalue "]" - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("@[]", $0), - dsl.NodeTypeIndirectOosvarValue, - []interface{}{ - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("@[]", $0), + dsl.NodeTypeIndirectOosvarValue, + []interface{}{ + $1, + }, + ) + >> + ; // * Direct is '@name' @@ -1373,49 +1468,80 @@ IndirectOosvarValue // name has spaces or somesuch in it. BracedOosvarValue : braced_oosvar_name - << dsl.NewASTNodeStripDollarOrAtSignAndCurlyBraces($0, dsl.NodeTypeDirectOosvarValue) >> + << + dsl.NewASTNodeStripDollarOrAtSignAndCurlyBraces($0, dsl.NodeTypeDirectOosvarValue) + >> + ; FullOosvar : full_oosvar - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeFullOosvar) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeFullOosvar) + >> + | all - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeFullOosvar) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeFullOosvar) + >> + ; // ---------------------------------------------------------------- LocalVariable : non_sigil_name - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeLocalVariable) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeLocalVariable) + >> + ; Typedecl : arr - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) + >> | bool - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) + >> | float - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) + >> | int - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) + >> | map - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) + >> | num - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) + >> | str - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) + >> | var - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) + >> | funct - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeTypedecl) + >> + ; // ---------------------------------------------------------------- @@ -1442,194 +1568,233 @@ Typedecl Assignment : Lvalue "||=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("||", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("||", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "^^=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("^^", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("^^", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "&&=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("&&", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("&&", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "??=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("??", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("??", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "???=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("???", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("???", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "|=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("|", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("|", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "&=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("^", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("^", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "^=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("^", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("^", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "<<=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("<<", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("<<", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue ">>=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken(">"+">", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken(">"+">", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue ">>>=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken(">"+">"+">", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken(">"+">"+">", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "+=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("+", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("+", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue ".=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken(".", $1), dsl.NodeTypeDotOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken(".", $1), dsl.NodeTypeDotOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "-=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("-", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("-", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "*=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("*", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("*", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "/=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("/", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("/", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "//=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("//", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("//", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "%=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("%", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("%", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> | Lvalue "**=" Rvalue - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", $1), - dsl.NodeTypeAssignment, - []interface{}{ - $0, - dsl.NewASTNode(dsl.NewASTToken("**", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("=", $1), + dsl.NodeTypeAssignment, + []interface{}{ + $0, + dsl.NewASTNode(dsl.NewASTToken("**", $1), dsl.NodeTypeOperator, []interface{}{$0, $2}), + }, + ) + >> + ; // ================================================================ @@ -1642,391 +1807,543 @@ PrecedenceChainStart : TernaryTerm ; TernaryTerm : LogicalOrTerm "?" TernaryTerm ":" TernaryTerm - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("?:", $1), - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - $4, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("?:", $1), + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + $4, + }, + ) + >> + | LogicalOrTerm ; LogicalOrTerm : LogicalOrTerm "||" LogicalXORTerm - << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + | LogicalXORTerm ; LogicalXORTerm : LogicalXORTerm "^^" LogicalAndTerm - << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + | LogicalAndTerm ; LogicalAndTerm : LogicalAndTerm "&&" EqneTerm - << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + | EqneTerm ; EqneTerm - : EqneTerm "=~" CmpTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | EqneTerm "!=~" CmpTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | EqneTerm "==" CmpTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | EqneTerm "!=" CmpTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | EqneTerm "<=>" CmpTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> + : EqneTerm "=~" CmpTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | EqneTerm "!=~" CmpTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | EqneTerm "==" CmpTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | EqneTerm "!=" CmpTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | EqneTerm "<=>" CmpTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + | CmpTerm ; CmpTerm - : CmpTerm ">" BitwiseORTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | CmpTerm ">=" BitwiseORTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | CmpTerm "<" BitwiseORTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | CmpTerm "<=" BitwiseORTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> + : CmpTerm ">" BitwiseORTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | CmpTerm ">=" BitwiseORTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | CmpTerm "<" BitwiseORTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | CmpTerm "<=" BitwiseORTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + | BitwiseORTerm ; BitwiseORTerm - : BitwiseORTerm "|" BitwiseXORTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> + : BitwiseORTerm "|" BitwiseXORTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + | BitwiseXORTerm ; BitwiseXORTerm - : BitwiseXORTerm "^" BitwiseANDTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> + : BitwiseXORTerm "^" BitwiseANDTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + | BitwiseANDTerm ; BitwiseANDTerm - : BitwiseANDTerm "&" BitwiseShiftTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> + : BitwiseANDTerm "&" BitwiseShiftTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + | BitwiseShiftTerm ; BitwiseShiftTerm - : BitwiseShiftTerm "<<" AddsubdotTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | BitwiseShiftTerm ">>" AddsubdotTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | BitwiseShiftTerm ">>>" AddsubdotTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> + : BitwiseShiftTerm "<<" AddsubdotTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | BitwiseShiftTerm ">>" AddsubdotTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | BitwiseShiftTerm ">>>" AddsubdotTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + | AddsubdotTerm ; AddsubdotTerm - : AddsubdotTerm "+" MuldivTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | AddsubdotTerm "-" MuldivTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | AddsubdotTerm ".+" MuldivTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | AddsubdotTerm ".-" MuldivTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> + : AddsubdotTerm "+" MuldivTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | AddsubdotTerm "-" MuldivTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | AddsubdotTerm ".+" MuldivTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | AddsubdotTerm ".-" MuldivTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + | MuldivTerm ; MuldivTerm - : MuldivTerm "*" DotTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | MuldivTerm "/" DotTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | MuldivTerm "//" DotTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | MuldivTerm "%" DotTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | MuldivTerm ".*" DotTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | MuldivTerm "./" DotTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> - | MuldivTerm ".//" DotTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> + : MuldivTerm "*" DotTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | MuldivTerm "/" DotTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | MuldivTerm "//" DotTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | MuldivTerm "%" DotTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | MuldivTerm ".*" DotTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | MuldivTerm "./" DotTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + + | MuldivTerm ".//" DotTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + | DotTerm ; DotTerm - : DotTerm "." UnaryOpTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeDotOperator, - []interface{}{ - $0, - $2, - }, - ) >> + : DotTerm "." UnaryOpTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeDotOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + | UnaryOpTerm ; UnaryOpTerm - : "+" UnaryOpTerm << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeOperator, - []interface{}{ - $1, - }, - ) >> - | "-" UnaryOpTerm << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeOperator, - []interface{}{ - $1, - }, - ) >> - | ".+" UnaryOpTerm << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeOperator, - []interface{}{ - $1, - }, - ) >> - | ".-" UnaryOpTerm << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeOperator, - []interface{}{ - $1, - }, - ) >> - | "!" UnaryOpTerm << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeOperator, - []interface{}{ - $1, - }, - ) >> - | "~" UnaryOpTerm << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeOperator, - []interface{}{ - $1, - }, - ) >> + : "+" UnaryOpTerm + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeOperator, + []interface{}{ + $1, + }, + ) + >> + + | "-" UnaryOpTerm + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeOperator, + []interface{}{ + $1, + }, + ) + >> + + | ".+" UnaryOpTerm + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeOperator, + []interface{}{ + $1, + }, + ) + >> + + | ".-" UnaryOpTerm + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeOperator, + []interface{}{ + $1, + }, + ) + >> + + | "!" UnaryOpTerm + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeOperator, + []interface{}{ + $1, + }, + ) + >> + + | "~" UnaryOpTerm + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeOperator, + []interface{}{ + $1, + }, + ) + >> + | AbsentCoalesceTerm ; AbsentCoalesceTerm : AbsentCoalesceTerm "??" EmptyCoalesceTerm - << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + | EmptyCoalesceTerm ; EmptyCoalesceTerm : EmptyCoalesceTerm "???" PowTerm - << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> + | PowTerm ; PowTerm : PrecedenceChainEnd "**" PowTerm - << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - $2, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + $2, + }, + ) + >> // In the Miller-DSL grammar, the leading -/+ isn't part of the int/float token -- it's treated as // a unary operator. (Making it part of the token leads to LR1 conflicts, and is also inelegant.) @@ -2036,29 +2353,31 @@ PowTerm // we need to be explicit about '2 ** -3' in a way that we do not need to for '2 * -3'. Also, we // can't use 'PrecedenceChainEnd "**" UnaryOpTerm', as this also results in LR1 conflicts. - | PrecedenceChainEnd "**" "-" PowTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - dsl.NewASTNode( $2, dsl.NodeTypeOperator, []interface{}{$3}), - }, - ) + | PrecedenceChainEnd "**" "-" PowTerm + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + dsl.NewASTNode($2, dsl.NodeTypeOperator, []interface{}{$3}), + }, + ) >> | PrecedenceChainEnd "**" "+" PowTerm << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeOperator, - []interface{}{ - $0, - dsl.NewASTNode( - $2, - dsl.NodeTypeOperator, - []interface{}{$3}, - ), - }, + $1, + dsl.NodeTypeOperator, + []interface{}{ + $0, + dsl.NewASTNode( + $2, + dsl.NodeTypeOperator, + []interface{}{$3}, + ), + }, ) >> @@ -2070,7 +2389,9 @@ PowTerm PrecedenceChainEnd : "(" Rvalue ")" - << dsl.WithErrorReturn($1) >> + << + dsl.WithErrorReturn($1) + >> ; PrecedenceChainEnd : MlrvalOrFunction ; @@ -2113,43 +2434,65 @@ MlrvalOrFunction MlrvalOrFunction : string_literal - << dsl.NewASTNodeStripDoubleQuotePair($0, dsl.NodeTypeStringLiteral) >> + << + dsl.NewASTNodeStripDoubleQuotePair($0, dsl.NodeTypeStringLiteral) + >> | regex_case_insensitive - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeRegexCaseInsensitive) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeRegexCaseInsensitive) + >> | int_literal - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeIntLiteral) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeIntLiteral) + >> | float_literal - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeFloatLiteral) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeFloatLiteral) + >> | boolean_literal - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeBoolLiteral) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeBoolLiteral) + >> | null_literal - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeNullLiteral) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeNullLiteral) + >> | inf_literal - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeFloatLiteral) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeFloatLiteral) + >> | nan_literal - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeFloatLiteral) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeFloatLiteral) + >> | const_M_PI - << dsl.NewASTNodeTerminalWithErrorReturn( - $0, - dsl.NodeTypeConstant, - ) >> + << + dsl.NewASTNodeTerminalWithErrorReturn( + $0, + dsl.NodeTypeConstant, + ) + >> | const_M_E - << dsl.NewASTNodeTerminalWithErrorReturn( - $0, - dsl.NodeTypeConstant, - ) >> + << + dsl.NewASTNodeTerminalWithErrorReturn( + $0, + dsl.NodeTypeConstant, + ) + >> | panic - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypePanic) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypePanic) + >> ; // ================================================================ @@ -2161,11 +2504,13 @@ MlrvalOrFunction : ArrayLiteral ; ArrayLiteral : "[" "]" - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", $0), - dsl.NodeTypeArrayLiteral, - []interface{}{}, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("[]", $0), + dsl.NodeTypeArrayLiteral, + []interface{}{}, + ) + >> | "[" ArrayLiteralElements "]" // As parsed there's an intermediate node between ArrayLiteral @@ -2189,37 +2534,44 @@ ArrayLiteral ), $1, ) - >> + >> ; // ---------------------------------------------------------------- ArrayLiteralElements : Rvalue - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeArrayLiteral, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeArrayLiteral, + []interface{}{ + $0, + }, + ) + >> // Allow trailing final comma, especially for multiline statements | Rvalue "," - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeArrayLiteral, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeArrayLiteral, + []interface{}{ + $0, + }, + ) + >> // Allow trailing final comma, especially for multiline statements | Rvalue "," ArrayLiteralElements - << dsl.WithChildPrepended( - $2, - $0, - ) >> + << + dsl.WithChildPrepended( + $2, + $0, + ) + >> + ; // ================================================================ @@ -2231,11 +2583,13 @@ MlrvalOrFunction : MapLiteral ; MapLiteral : "{" "}" - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("{}", $0), - dsl.NodeTypeMapLiteral, - []interface{}{}, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("{}", $0), + dsl.NodeTypeMapLiteral, + []interface{}{}, + ) + >> | "{" MapLiteralKeyValuePairs "}" // As parsed there's an intermediate node between MapLiteral @@ -2267,71 +2621,127 @@ MapLiteral ), $1, ) - >> + >> + ; // ---------------------------------------------------------------- MapLiteralKeyValuePairs : MapLiteralKeyValuePair - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeMapLiteral, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeMapLiteral, + []interface{}{ + $0, + }, + ) + >> // Allow trailing final comma, especially for multiline statements | MapLiteralKeyValuePair "," - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeMapLiteral, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeMapLiteral, + []interface{}{ + $0, + }, + ) + >> // Allow trailing final comma, especially for multiline statements | MapLiteralKeyValuePair "," MapLiteralKeyValuePairs - << dsl.WithChildPrepended( - $2, - $0, - ) >> + << + dsl.WithChildPrepended( + $2, + $0, + ) + >> + ; // ---------------------------------------------------------------- MapLiteralKeyValuePair : Rvalue ":" Rvalue - << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeMapLiteralKeyValuePair, - []interface{}{ - $0, - $2, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeMapLiteralKeyValuePair, + []interface{}{ + $0, + $2, + }, + ) + >> + ; // ================================================================ MlrvalOrFunction : ContextVariable ; ContextVariable - : ctx_IPS << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) >> - | ctx_IFS << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) >> - | ctx_IRS << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) >> + : ctx_IPS + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) + >> - | ctx_OPS << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) >> - | ctx_OFS << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) >> - | ctx_ORS << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) >> - | ctx_FLATSEP << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) >> + | ctx_IFS + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) + >> - | ctx_NF << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) >> - | ctx_NR << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) >> - | ctx_FNR << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) >> + | ctx_IRS + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) + >> + + | ctx_OPS + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) + >> + + | ctx_OFS + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) + >> + + | ctx_ORS + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) + >> + + | ctx_FLATSEP + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) + >> + + | ctx_NF + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) + >> + + | ctx_NR + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) + >> + + | ctx_FNR + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) + >> + + | ctx_FILENAME + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) + >> + + | ctx_FILENUM + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) + >> - | ctx_FILENAME << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) >> - | ctx_FILENUM << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeContextVariable) >> ; // ---------------------------------------------------------------- @@ -2342,22 +2752,27 @@ MlrvalOrFunction : ENV ; ENV : env "[" Rvalue "]" - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeEnvironmentVariable, - []interface{}{ - $2, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeEnvironmentVariable, + []interface{}{ + $2, + }, + ) + >> | env "." non_sigil_name - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeEnvironmentVariable, - []interface{}{ - dsl.NewASTNodeTerminal($2, dsl.NodeTypeStringLiteral), - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeEnvironmentVariable, + []interface{}{ + dsl.NewASTNodeTerminal($2, dsl.NodeTypeStringLiteral), + }, + ) + >> + ; // ================================================================ @@ -2374,98 +2789,115 @@ MlrvalOrFunction ArrayOrMapIndexAccess : MlrvalOrFunction "[" Rvalue "]" - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", $1), - dsl.NodeTypeArrayOrMapIndexAccess, - []interface{}{ - $0, - $2, - }, - )>> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("[]", $1), + dsl.NodeTypeArrayOrMapIndexAccess, + []interface{}{ + $0, + $2, + }, + ) + >> + ; ArrayOrMapPositionalNameAccess : MlrvalOrFunction "[[" Rvalue "]" "]" // Not "]]" since that would define a token, making '$foo[bar[1]]' a syntax error - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", $1), - dsl.NodeTypeArrayOrMapPositionalNameAccess, - []interface{}{ - $0, - $2, - }, - )>> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("[]", $1), + dsl.NodeTypeArrayOrMapPositionalNameAccess, + []interface{}{ + $0, + $2, + }, + ) + >> + ; ArrayOrMapPositionalValueAccess : MlrvalOrFunction "[[[" Rvalue "]" "]" "]" // Not "]]]" since that would define a token, making '$foo[bar[baz[1]]]' a syntax error - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", $1), - dsl.NodeTypeArrayOrMapPositionalValueAccess, - []interface{}{ - $0, - $2, - }, - )>> -; + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("[]", $1), + dsl.NodeTypeArrayOrMapPositionalValueAccess, + []interface{}{ + $0, + $2, + }, + ) + >> +; ArraySliceAccess : MlrvalOrFunction "[" Rvalue ":" Rvalue "]" - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", $1), - dsl.NodeTypeArraySliceAccess, - []interface{}{ - $0, - $2, - $4, - }, - )>> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("[]", $1), + dsl.NodeTypeArraySliceAccess, + []interface{}{ + $0, + $2, + $4, + }, + ) + >> | MlrvalOrFunction "[" ":" Rvalue "]" - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", $1), - dsl.NodeTypeArraySliceAccess, - []interface{}{ - $0, - dsl.NewASTNodeTerminal( - $2, - dsl.NodeTypeArraySliceEmptyLowerIndex, - ), - $3, - }, - )>> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("[]", $1), + dsl.NodeTypeArraySliceAccess, + []interface{}{ + $0, + dsl.NewASTNodeTerminal( + $2, + dsl.NodeTypeArraySliceEmptyLowerIndex, + ), + $3, + }, + ) + >> | MlrvalOrFunction "[" Rvalue ":" "]" - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", $1), - dsl.NodeTypeArraySliceAccess, - []interface{}{ - $0, - $2, - dsl.NewASTNodeTerminal( - $3, - dsl.NodeTypeArraySliceEmptyUpperIndex, - ), - }, - )>> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("[]", $1), + dsl.NodeTypeArraySliceAccess, + []interface{}{ + $0, + $2, + dsl.NewASTNodeTerminal( + $3, + dsl.NodeTypeArraySliceEmptyUpperIndex, + ), + }, + ) + >> | MlrvalOrFunction "[" ":" "]" - << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", $1), - dsl.NodeTypeArraySliceAccess, - []interface{}{ - $0, - dsl.NewASTNodeTerminal( - $2, - dsl.NodeTypeArraySliceEmptyLowerIndex, - ), - dsl.NewASTNodeTerminal( - $2, - dsl.NodeTypeArraySliceEmptyUpperIndex, - ), - }, - )>> + << + dsl.NewASTNodeWithErrorReturn( + dsl.NewASTToken("[]", $1), + dsl.NodeTypeArraySliceAccess, + []interface{}{ + $0, + dsl.NewASTNodeTerminal( + $2, + dsl.NodeTypeArraySliceEmptyLowerIndex, + ), + dsl.NewASTNodeTerminal( + $2, + dsl.NodeTypeArraySliceEmptyUpperIndex, + ), + }, + ) + >> + ; // ================================================================ @@ -2478,11 +2910,13 @@ MlrvalOrFunction FunctionCallsite : FunctionName "(" ")" - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeFunctionCallsite, - []interface{}{}, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeFunctionCallsite, + []interface{}{}, + ) + >> | FunctionName "(" FcnArgs ")" // As parsed there's an intermediate node between FunctionCallsite @@ -2506,7 +2940,8 @@ FunctionCallsite ), $2, ) - >> + >> + ; // For most functions it suffices to use the non_sigil_name pattern. @@ -2523,30 +2958,37 @@ FunctionName FcnArgs : Rvalue - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeFunctionCallsite, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeFunctionCallsite, + []interface{}{ + $0, + }, + ) + >> // Allow trailing final comma, especially for multiline statements | Rvalue "," - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeFunctionCallsite, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeFunctionCallsite, + []interface{}{ + $0, + }, + ) + >> // Allow trailing final comma, especially for multiline statements | Rvalue "," FcnArgs - << dsl.WithChildPrepended( - $2, - $0, - ) >> + << + dsl.WithChildPrepended( + $2, + $0, + ) + >> + ; // ---------------------------------------------------------------- @@ -2554,11 +2996,13 @@ FcnArgs SubroutineCallsite : call SubroutineName "(" ")" - << dsl.NewASTNodeWithErrorReturn( - $1, - dsl.NodeTypeSubroutineCallsite, - []interface{}{}, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $1, + dsl.NodeTypeSubroutineCallsite, + []interface{}{}, + ) + >> | call SubroutineName "(" FcnArgs ")" // As parsed there's an intermediate node between SubroutineCallsite @@ -2582,7 +3026,8 @@ SubroutineCallsite ), $3, ) - >> + >> + ; SubroutineName : non_sigil_name; @@ -2603,23 +3048,29 @@ BracefulStatement BeginBlock : begin StatementBlockInBraces - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeBeginBlock, - []interface{}{ - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeBeginBlock, + []interface{}{ + $1, + }, + ) + >> + ; EndBlock : end StatementBlockInBraces - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeEndBlock, - []interface{}{ - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeEndBlock, + []interface{}{ + $1, + }, + ) + >> + ; // ================================================================ // PATTERN-ACTION BLOCKS (AWKISH) @@ -2628,14 +3079,17 @@ EndBlock CondBlock := Rvalue StatementBlockInBraces - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeCondBlock, - []interface{}{ - $0, - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeCondBlock, + []interface{}{ + $0, + $1, + }, + ) + >> + ; // ================================================================ @@ -2648,55 +3102,73 @@ CondBlock IfChain : IfElifStar | IfElifStar ElseBlock - << dsl.WithChildAppended($0, $1) >> + << + dsl.WithChildAppended($0, $1) + >> + ; IfElifStar : IfBlock - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeIfChain, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeIfChain, + []interface{}{ + $0, + }, + ) + >> + | IfElifStar ElifBlock - << dsl.WithChildAppended($0, $1) >> + << + dsl.WithChildAppended($0, $1) + >> + ; IfBlock : if "(" Rvalue ")" StatementBlockInBraces - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeIfItem, - []interface{}{ - $2, - $4, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeIfItem, + []interface{}{ + $2, + $4, + }, + ) + >> + ; ElifBlock : elif "(" Rvalue ")" StatementBlockInBraces - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeIfItem, - []interface{}{ - $2, - $4, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeIfItem, + []interface{}{ + $2, + $4, + }, + ) + >> + ; ElseBlock : else StatementBlockInBraces - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeIfItem, - []interface{}{ - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeIfItem, + []interface{}{ + $1, + }, + ) + >> + ; // ================================================================ @@ -2704,26 +3176,30 @@ ElseBlock WhileLoop : while "(" Rvalue ")" StatementBlockInBraces - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeWhileLoop, - []interface{}{ - $2, - $4, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeWhileLoop, + []interface{}{ + $2, + $4, + }, + ) + >> ; DoWhileLoop : do StatementBlockInBraces while "(" Rvalue ")" - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeDoWhileLoop, - []interface{}{ - $1, - $4, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeDoWhileLoop, + []interface{}{ + $1, + $4, + }, + ) + >> ; // ================================================================ @@ -2747,17 +3223,17 @@ ForLoopOneVariable Rvalue ")" StatementBlockInBraces - << - dsl.NewASTNodeWithErrorReturn( - $0, // "for" - dsl.NodeTypeForLoopOneVariable, - []interface{}{ - $2, // k, etc. - $4, // $*, etc. - $6, // { ... } - }, - ); - >> + << + dsl.NewASTNodeWithErrorReturn( + $0, // "for" + dsl.NodeTypeForLoopOneVariable, + []interface{}{ + $2, // k, etc. + $4, // $*, etc. + $6, // { ... } + }, + ) + >> ; // ---------------------------------------------------------------- @@ -2772,18 +3248,19 @@ ForLoopTwoVariable Rvalue ")" StatementBlockInBraces - << - dsl.NewASTNodeWithErrorReturn( - $0, // "for" - dsl.NodeTypeForLoopTwoVariable, - []interface{} { - $2, // k, etc. - $4, // v, etc. - $6, // $*, etc. - $8, // { ... } - }, - ); - >> + << + dsl.NewASTNodeWithErrorReturn( + $0, // "for" + dsl.NodeTypeForLoopTwoVariable, + []interface{}{ + $2, // k, etc. + $4, // v, etc. + $6, // $*, etc. + $8, // { ... } + }, + ) + >> + ; // ---------------------------------------------------------------- @@ -2801,37 +3278,43 @@ ForLoopMultivariable Rvalue ")" StatementBlockInBraces - << - dsl.NewASTNodeWithErrorReturn( - $0, // "for" - dsl.NodeTypeForLoopMultivariable, - []interface{} { - $3, // (k1, k2), etc. - $6, // v, etc. - $8, // $*, etc. - $10, // { ... } - }, - ); - >> + << + dsl.NewASTNodeWithErrorReturn( + $0, // "for" + dsl.NodeTypeForLoopMultivariable, + []interface{}{ + $3, // (k1, k2), etc. + $6, // v, etc. + $8, // $*, etc. + $10, // { ... } + }, + ) + >> + ; MultiIndex : LocalVariable "," LocalVariable - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeParameterList, - []interface{}{ - $0, - $2, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeParameterList, + []interface{}{ + $0, + $2, + }, + ) + >> | MultiIndex "," LocalVariable - << dsl.WithChildAppended( - $0, - $2, - ) >> + << + dsl.WithChildAppended( + $0, + $2, + ) + >> + ; // ---------------------------------------------------------------- @@ -2846,58 +3329,77 @@ TripleForLoop TripleForUpdate ")" StatementBlockInBraces - << - dsl.NewASTNodeWithErrorReturn( - $0, // for - dsl.NodeTypeTripleForLoop, - []interface{} { - $2, // start - $4, // continuation - $6, // update - $8, // body - }, - ); - >> + << + dsl.NewASTNodeWithErrorReturn( + $0, // for + dsl.NodeTypeTripleForLoop, + []interface{}{ + $2, // start + $4, // continuation + $6, // update + $8, // body + }, + ) + >> + ; TripleForStart : empty - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{}, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeStatementBlock, + []interface{}{}, + ) + >> + | Assignment - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeStatementBlock, + []interface{}{ + $0, + }, + ) + >> + | TripleForStart "," Assignment - <> + << + dsl.WithChildAppended($0, $2) + >> + ; // Enforced in the CST, not here: the last must be a bare boolean; the ones // before must be assignments. TripleForContinuation : empty - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{}, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeStatementBlock, + []interface{}{}, + ) + >> + | TripleForContinuationItem - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeStatementBlock, + []interface{}{ + $0, + }, + ) + >> + | TripleForContinuation "," TripleForContinuationItem - <> + << + dsl.WithChildAppended($0, $2) + >> + ; TripleForContinuationItem @@ -2907,40 +3409,52 @@ TripleForContinuationItem TripleForUpdate : empty - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{}, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeStatementBlock, + []interface{}{}, + ) + >> + | Assignment - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeStatementBlock, + []interface{}{ + $0, + }, + ) + >> + | TripleForUpdate "," Assignment - <> + << + dsl.WithChildAppended($0, $2) + >> ; // ---------------------------------------------------------------- BreakStatement : break - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeBreak, - []interface{}{}, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeBreak, + []interface{}{}, + ) + >> ; ContinueStatement : continue - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeContinue, - []interface{}{}, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeContinue, + []interface{}{}, + ) + >> ; // ================================================================ @@ -2956,18 +3470,18 @@ NamedFunctionDefinition FuncOrSubrParameterList ")" StatementBlockInBraces - << - dsl.NewASTNodeWithErrorReturn( - $1, - // { ... } - dsl.NodeTypeNamedFunctionDefinition, - []interface{}{ - $3, - // parameter list - $5, - }, - ); - >> + << + dsl.NewASTNodeWithErrorReturn( + $1, + // { ... } + dsl.NodeTypeNamedFunctionDefinition, + []interface{}{ + $3, + // parameter list + $5, + }, + ) + >> // With return-type annotation | func @@ -2978,21 +3492,20 @@ NamedFunctionDefinition ":" Typedecl StatementBlockInBraces - << - dsl.NewASTNodeWithErrorReturn( - $1, - // return type - dsl.NodeTypeNamedFunctionDefinition, - []interface{}{ - $3, - // parameter list - $7, - // {...} - $6, - }, - ); - >> - + << + dsl.NewASTNodeWithErrorReturn( + $1, + // return type + dsl.NodeTypeNamedFunctionDefinition, + []interface{}{ + $3, + // parameter list + $7, + // {...} + $6, + }, + ) + >> ; // Example: RHS of 'f = func (a, b) { return b - a }' @@ -3004,18 +3517,18 @@ UnnamedFunctionDefinition FuncOrSubrParameterList ")" StatementBlockInBraces - << - dsl.NewASTNodeWithErrorReturn( - $0, - // { ... } - dsl.NodeTypeUnnamedFunctionDefinition, - []interface{}{ - $2, - // parameter list - $4, - }, - ); - >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + // { ... } + dsl.NodeTypeUnnamedFunctionDefinition, + []interface{}{ + $2, + // parameter list + $4, + }, + ) + >> // With return-type annotation | func @@ -3025,20 +3538,20 @@ UnnamedFunctionDefinition ":" Typedecl StatementBlockInBraces - << - dsl.NewASTNodeWithErrorReturn( - $0, - // return type - dsl.NodeTypeUnnamedFunctionDefinition, - []interface{}{ - $2, - // parameter list - $6, - // {...} - $5, - }, - ); - >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + // return type + dsl.NodeTypeUnnamedFunctionDefinition, + []interface{}{ + $2, + // parameter list + $6, + // {...} + $5, + }, + ) + >> ; @@ -3049,51 +3562,67 @@ SubroutineDefinition FuncOrSubrParameterList ")" StatementBlockInBraces - << - dsl.NewASTNodeWithErrorReturn( - $1, - // { ... } - dsl.NodeTypeSubroutineDefinition, - []interface{}{ - $3, - // parameter list - $5, - }, - ); - >> + << + dsl.NewASTNodeWithErrorReturn( + $1, + // { ... } + dsl.NodeTypeSubroutineDefinition, + []interface{}{ + $3, + // parameter list + $5, + }, + ) + >> + ; // ---------------------------------------------------------------- FuncOrSubrParameterList : empty - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeParameterList, - []interface{}{}, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeParameterList, + []interface{}{}, + ) + >> + | FuncOrSubrNonEmptyParameterList - << dsl.WithErrorReturn($0) >> + << + dsl.WithErrorReturn($0) + >> + ; FuncOrSubrNonEmptyParameterList : FuncOrSubrParameter - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeParameterList, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeParameterList, + []interface{}{ + $0, + }, + ) + >> + | FuncOrSubrParameter "," - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeParameterList, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeParameterList, + []interface{}{ + $0, + }, + ) + >> + | FuncOrSubrParameter "," FuncOrSubrNonEmptyParameterList - << dsl.WithChildPrepended($2, $0) >> + << + dsl.WithChildPrepended($2, $0) + >> + ; FuncOrSubrParameter @@ -3101,36 +3630,47 @@ FuncOrSubrParameter // Parameter // -> ParameterName "x" : UntypedFuncOrSubrParameterName - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeParameter, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeParameter, + []interface{}{ + $0, + }, + ) + >> // Typed parameter, e.g. "num x". Produce this AST: // Parameter // -> ParameterName "x" // -> Typedecl "num" | TypedFuncOrSubrParameterName - << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeParameter, - []interface{}{ - $0, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + nil, + dsl.NodeTypeParameter, + []interface{}{ + $0, + }, + ) + >> + ; UntypedFuncOrSubrParameterName : non_sigil_name - << dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeParameterName) >> + << + dsl.NewASTNodeTerminalWithErrorReturn($0, dsl.NodeTypeParameterName) + >> + ; TypedFuncOrSubrParameterName : Typedecl UntypedFuncOrSubrParameterName - << dsl.WithChildAppended($1, $0) >> + << + dsl.WithChildAppended($1, $0) + >> + ; // ---------------------------------------------------------------- @@ -3139,19 +3679,24 @@ TypedFuncOrSubrParameterName ReturnStatement // For user-defined functions: return a value : return Rvalue - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeReturn, - []interface{}{ - $1, - }, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeReturn, + []interface{}{ + $1, + }, + ) + >> // For user-defined subroutines | return - << dsl.NewASTNodeWithErrorReturn( - $0, - dsl.NodeTypeReturn, - []interface{}{}, - ) >> + << + dsl.NewASTNodeWithErrorReturn( + $0, + dsl.NodeTypeReturn, + []interface{}{}, + ) + >> + ; diff --git a/pkg/parsing/parser/productionstable.go b/pkg/parsing/parser/productionstable.go index 57ed50c83..96dc99e0b 100644 --- a/pkg/parsing/parser/productionstable.go +++ b/pkg/parsing/parser/productionstable.go @@ -41,10 +41,10 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `StatementBlock : empty << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{}, - ) >>`, + nil, + dsl.NodeTypeStatementBlock, + []interface{}{}, + ) >>`, Id: "StatementBlock", NTType: 2, Index: 2, @@ -69,12 +69,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `NonEmptyStatementBlock : BracelessStatement << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeStatementBlock, + []interface{}{ + X[0], + }, + ) >>`, Id: "NonEmptyStatementBlock", NTType: 3, Index: 4, @@ -91,12 +91,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `NonEmptyStatementBlock : BracefulStatement << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeStatementBlock, + []interface{}{ + X[0], + }, + ) >>`, Id: "NonEmptyStatementBlock", NTType: 3, Index: 5, @@ -153,13 +153,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `NonEmptyStatementBlock : BracefulStatement BracelessStatement << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{ - X[0], - X[1], - }, - ) >>`, + nil, + dsl.NodeTypeStatementBlock, + []interface{}{ + X[0], + X[1], + }, + ) >>`, Id: "NonEmptyStatementBlock", NTType: 3, Index: 10, @@ -177,13 +177,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `NonEmptyStatementBlock : BracefulStatement BracelessStatement ";" << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{ - X[0], - X[1], - }, - ) >>`, + nil, + dsl.NodeTypeStatementBlock, + []interface{}{ + X[0], + X[1], + }, + ) >>`, Id: "NonEmptyStatementBlock", NTType: 3, Index: 11, @@ -421,13 +421,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "=" Rvalue << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 34, @@ -487,12 +487,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `BareBoolean : Rvalue << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeBareBoolean, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeBareBoolean, + []interface{}{ + X[0], + }, + ) >>`, Id: "BareBoolean", NTType: 9, Index: 38, @@ -509,12 +509,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `FilterStatement : filter Rvalue << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeFilterStatement, - []interface{}{ - X[1], - }, - ) >>`, + X[0], + dsl.NodeTypeFilterStatement, + []interface{}{ + X[1], + }, + ) >>`, Id: "FilterStatement", NTType: 10, Index: 39, @@ -531,12 +531,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Redirector : ">" RedirectTarget << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeRedirectWrite, - []interface{}{ - X[1], - }, - ) >>`, + X[0], + dsl.NodeTypeRedirectWrite, + []interface{}{ + X[1], + }, + ) >>`, Id: "Redirector", NTType: 11, Index: 40, @@ -553,12 +553,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Redirector : ">>" RedirectTarget << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeRedirectAppend, - []interface{}{ - X[1], - }, - ) >>`, + X[0], + dsl.NodeTypeRedirectAppend, + []interface{}{ + X[1], + }, + ) >>`, Id: "Redirector", NTType: 11, Index: 41, @@ -575,12 +575,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Redirector : "|" RedirectTarget << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeRedirectPipe, - []interface{}{ - X[1], - }, - ) >>`, + X[0], + dsl.NodeTypeRedirectPipe, + []interface{}{ + X[1], + }, + ) >>`, Id: "Redirector", NTType: 11, Index: 42, @@ -597,10 +597,10 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `RedirectTarget : stdout << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeRedirectTargetStdout, - []interface{}{}, - ) >>`, + X[0], + dsl.NodeTypeRedirectTargetStdout, + []interface{}{}, + ) >>`, Id: "RedirectTarget", NTType: 12, Index: 43, @@ -615,10 +615,10 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `RedirectTarget : stderr << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeRedirectTargetStderr, - []interface{}{}, - ) >>`, + X[0], + dsl.NodeTypeRedirectTargetStderr, + []interface{}{}, + ) >>`, Id: "RedirectTarget", NTType: 12, Index: 44, @@ -728,7 +728,7 @@ var productionsTable = ProdTab{ ProdTabEntry{ String: `PrintStatement : print Redirector "," FcnArgs << dsl.NewASTNodeWithErrorReturn( X[0], - dsl.NodeTypePrintStatement, // redirect + dsl.NodeTypePrintStatement, // redirect []interface{}{ // print X[3], @@ -756,7 +756,7 @@ var productionsTable = ProdTab{ ProdTabEntry{ String: `PrintnStatement : printn << dsl.NewASTNodeWithErrorReturn( X[0], - dsl.NodeTypePrintnStatement, // no redirect + dsl.NodeTypePrintnStatement, // no redirect []interface{}{ // printn dsl.NewASTNodeTerminal(nil, dsl.NodeTypeNoOp), @@ -812,7 +812,7 @@ var productionsTable = ProdTab{ ProdTabEntry{ String: `PrintnStatement : printn FcnArgs << dsl.NewASTNodeWithErrorReturn( X[0], - dsl.NodeTypePrintnStatement, // no redirect + dsl.NodeTypePrintnStatement, // no redirect []interface{}{ // printn X[1], @@ -1131,13 +1131,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `TeeStatement : tee Redirector "," FullSrec << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeTeeStatement, - []interface{}{ - X[3], - X[1], - }, - ) >>`, + X[0], + dsl.NodeTypeTeeStatement, + []interface{}{ + X[3], + X[1], + }, + ) >>`, Id: "TeeStatement", NTType: 19, Index: 64, @@ -1157,7 +1157,7 @@ var productionsTable = ProdTab{ String: `EmitFStatement : emitf EmittableList << dsl.NewASTNodeWithErrorReturn( X[0], // no redirect - dsl.NodeTypeEmitFStatement, + dsl.NodeTypeEmitFStatement, []interface{}{ // emitf X[1], @@ -1289,7 +1289,7 @@ var productionsTable = ProdTab{ X[2], // emit dsl.NewASTNodeTerminal(nil, dsl.NodeTypeNoOp), // emittables dsl.NewASTNodeTerminal(nil, dsl.NodeTypeNoOp), // no keys - }, + }, ) >>`, Id: "EmitStatement", NTType: 22, @@ -1671,9 +1671,9 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `EmittableList : Emittable "," EmittableList << dsl.WithChildPrepended( - X[2], - X[0], - ) >>`, + X[2], + X[0], + ) >>`, Id: "EmittableList", NTType: 24, Index: 85, @@ -1687,12 +1687,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `EmittableAsList : Emittable << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeEmittableList, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeEmittableList, + []interface{}{ + X[0], + }, + ) >>`, Id: "EmittableAsList", NTType: 25, Index: 86, @@ -1809,12 +1809,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `EmitKeys : Rvalue << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeEmitKeys, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeEmitKeys, + []interface{}{ + X[0], + }, + ) >>`, Id: "EmitKeys", NTType: 27, Index: 97, @@ -1831,9 +1831,9 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `EmitKeys : Rvalue "," EmitKeys << dsl.WithChildPrepended( - X[2], - X[0], - ) >>`, + X[2], + X[0], + ) >>`, Id: "EmitKeys", NTType: 27, Index: 98, @@ -1907,12 +1907,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `IndirectFieldValue : "$[" Rvalue "]" << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("$[]", X[0]), - dsl.NodeTypeIndirectFieldValue, - []interface{}{ - X[1], - }, - ) >>`, + dsl.NewASTToken("$[]", X[0]), + dsl.NodeTypeIndirectFieldValue, + []interface{}{ + X[1], + }, + ) >>`, Id: "IndirectFieldValue", NTType: 30, Index: 105, @@ -1939,12 +1939,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `PositionalFieldName : "$[[" Rvalue "]" "]" << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("$[]", X[0]), - dsl.NodeTypePositionalFieldName, - []interface{}{ - X[1], - }, - ) >>`, + dsl.NewASTToken("$[]", X[0]), + dsl.NodeTypePositionalFieldName, + []interface{}{ + X[1], + }, + ) >>`, Id: "PositionalFieldName", NTType: 32, Index: 107, @@ -1961,12 +1961,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `PositionalFieldValue : "$[[[" Rvalue "]" "]" "]" << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("$[]", X[0]), - dsl.NodeTypePositionalFieldValue, - []interface{}{ - X[1], - }, - ) >>`, + dsl.NewASTToken("$[]", X[0]), + dsl.NodeTypePositionalFieldValue, + []interface{}{ + X[1], + }, + ) >>`, Id: "PositionalFieldValue", NTType: 33, Index: 108, @@ -2033,12 +2033,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `IndirectOosvarValue : "@[" Rvalue "]" << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("@[]", X[0]), - dsl.NodeTypeIndirectOosvarValue, - []interface{}{ - X[1], - }, - ) >>`, + dsl.NewASTToken("@[]", X[0]), + dsl.NodeTypeIndirectOosvarValue, + []interface{}{ + X[1], + }, + ) >>`, Id: "IndirectOosvarValue", NTType: 37, Index: 114, @@ -2185,13 +2185,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "||=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("||", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("||", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 128, @@ -2209,13 +2209,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "^^=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("^^", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("^^", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 129, @@ -2233,13 +2233,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "&&=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("&&", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("&&", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 130, @@ -2257,13 +2257,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "??=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("??", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("??", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 131, @@ -2281,13 +2281,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "???=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("???", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("???", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 132, @@ -2305,13 +2305,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "|=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("|", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("|", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 133, @@ -2329,13 +2329,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "&=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("^", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("^", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 134, @@ -2353,13 +2353,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "^=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("^", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("^", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 135, @@ -2377,13 +2377,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "<<=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("<<", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("<<", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 136, @@ -2401,13 +2401,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue ">>=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken(">"+">", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken(">"+">", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 137, @@ -2425,13 +2425,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue ">>>=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken(">"+">"+">", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken(">"+">"+">", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 138, @@ -2449,13 +2449,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "+=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("+", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("+", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 139, @@ -2473,13 +2473,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue ".=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken(".", X[1]), dsl.NodeTypeDotOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken(".", X[1]), dsl.NodeTypeDotOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 140, @@ -2497,13 +2497,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "-=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("-", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("-", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 141, @@ -2521,13 +2521,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "*=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("*", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("*", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 142, @@ -2545,13 +2545,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "/=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("/", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("/", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 143, @@ -2569,13 +2569,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "//=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("//", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("//", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 144, @@ -2593,13 +2593,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "%=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("%", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("%", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 145, @@ -2617,13 +2617,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Assignment : Lvalue "**=" Rvalue << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("=", X[1]), - dsl.NodeTypeAssignment, - []interface{}{ - X[0], - dsl.NewASTNode(dsl.NewASTToken("**", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), - }, - ) >>`, + dsl.NewASTToken("=", X[1]), + dsl.NodeTypeAssignment, + []interface{}{ + X[0], + dsl.NewASTNode(dsl.NewASTToken("**", X[1]), dsl.NodeTypeOperator, []interface{}{X[0], X[2]}), + }, + ) >>`, Id: "Assignment", NTType: 6, Index: 146, @@ -2661,14 +2661,14 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `TernaryTerm : LogicalOrTerm "?" TernaryTerm ":" TernaryTerm << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("?:", X[1]), - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - X[4], - }, - ) >>`, + dsl.NewASTToken("?:", X[1]), + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + X[4], + }, + ) >>`, Id: "TernaryTerm", NTType: 44, Index: 149, @@ -2697,13 +2697,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `LogicalOrTerm : LogicalOrTerm "||" LogicalXORTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "LogicalOrTerm", NTType: 45, Index: 151, @@ -2731,13 +2731,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `LogicalXORTerm : LogicalXORTerm "^^" LogicalAndTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "LogicalXORTerm", NTType: 46, Index: 153, @@ -2765,13 +2765,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `LogicalAndTerm : LogicalAndTerm "&&" EqneTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "LogicalAndTerm", NTType: 47, Index: 155, @@ -2799,13 +2799,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `EqneTerm : EqneTerm "=~" CmpTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "EqneTerm", NTType: 48, Index: 157, @@ -2823,13 +2823,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `EqneTerm : EqneTerm "!=~" CmpTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "EqneTerm", NTType: 48, Index: 158, @@ -2847,13 +2847,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `EqneTerm : EqneTerm "==" CmpTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "EqneTerm", NTType: 48, Index: 159, @@ -2871,13 +2871,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `EqneTerm : EqneTerm "!=" CmpTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "EqneTerm", NTType: 48, Index: 160, @@ -2895,13 +2895,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `EqneTerm : EqneTerm "<=>" CmpTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "EqneTerm", NTType: 48, Index: 161, @@ -2929,13 +2929,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `CmpTerm : CmpTerm ">" BitwiseORTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "CmpTerm", NTType: 49, Index: 163, @@ -2953,13 +2953,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `CmpTerm : CmpTerm ">=" BitwiseORTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "CmpTerm", NTType: 49, Index: 164, @@ -2977,13 +2977,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `CmpTerm : CmpTerm "<" BitwiseORTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "CmpTerm", NTType: 49, Index: 165, @@ -3001,13 +3001,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `CmpTerm : CmpTerm "<=" BitwiseORTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "CmpTerm", NTType: 49, Index: 166, @@ -3035,13 +3035,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `BitwiseORTerm : BitwiseORTerm "|" BitwiseXORTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "BitwiseORTerm", NTType: 50, Index: 168, @@ -3069,13 +3069,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `BitwiseXORTerm : BitwiseXORTerm "^" BitwiseANDTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "BitwiseXORTerm", NTType: 51, Index: 170, @@ -3103,13 +3103,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `BitwiseANDTerm : BitwiseANDTerm "&" BitwiseShiftTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "BitwiseANDTerm", NTType: 52, Index: 172, @@ -3137,13 +3137,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `BitwiseShiftTerm : BitwiseShiftTerm "<<" AddsubdotTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "BitwiseShiftTerm", NTType: 53, Index: 174, @@ -3161,13 +3161,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `BitwiseShiftTerm : BitwiseShiftTerm ">>" AddsubdotTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "BitwiseShiftTerm", NTType: 53, Index: 175, @@ -3185,13 +3185,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `BitwiseShiftTerm : BitwiseShiftTerm ">>>" AddsubdotTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "BitwiseShiftTerm", NTType: 53, Index: 176, @@ -3219,13 +3219,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `AddsubdotTerm : AddsubdotTerm "+" MuldivTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "AddsubdotTerm", NTType: 54, Index: 178, @@ -3243,13 +3243,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `AddsubdotTerm : AddsubdotTerm "-" MuldivTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "AddsubdotTerm", NTType: 54, Index: 179, @@ -3267,13 +3267,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `AddsubdotTerm : AddsubdotTerm ".+" MuldivTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "AddsubdotTerm", NTType: 54, Index: 180, @@ -3291,13 +3291,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `AddsubdotTerm : AddsubdotTerm ".-" MuldivTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "AddsubdotTerm", NTType: 54, Index: 181, @@ -3325,13 +3325,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MuldivTerm : MuldivTerm "*" DotTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "MuldivTerm", NTType: 55, Index: 183, @@ -3349,13 +3349,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MuldivTerm : MuldivTerm "/" DotTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "MuldivTerm", NTType: 55, Index: 184, @@ -3373,13 +3373,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MuldivTerm : MuldivTerm "//" DotTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "MuldivTerm", NTType: 55, Index: 185, @@ -3397,13 +3397,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MuldivTerm : MuldivTerm "%" DotTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "MuldivTerm", NTType: 55, Index: 186, @@ -3421,13 +3421,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MuldivTerm : MuldivTerm ".*" DotTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "MuldivTerm", NTType: 55, Index: 187, @@ -3445,13 +3445,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MuldivTerm : MuldivTerm "./" DotTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "MuldivTerm", NTType: 55, Index: 188, @@ -3469,13 +3469,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MuldivTerm : MuldivTerm ".//" DotTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "MuldivTerm", NTType: 55, Index: 189, @@ -3503,13 +3503,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `DotTerm : DotTerm "." UnaryOpTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeDotOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeDotOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "DotTerm", NTType: 56, Index: 191, @@ -3537,12 +3537,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `UnaryOpTerm : "+" UnaryOpTerm << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeOperator, - []interface{}{ - X[1], - }, - ) >>`, + X[0], + dsl.NodeTypeOperator, + []interface{}{ + X[1], + }, + ) >>`, Id: "UnaryOpTerm", NTType: 57, Index: 193, @@ -3559,12 +3559,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `UnaryOpTerm : "-" UnaryOpTerm << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeOperator, - []interface{}{ - X[1], - }, - ) >>`, + X[0], + dsl.NodeTypeOperator, + []interface{}{ + X[1], + }, + ) >>`, Id: "UnaryOpTerm", NTType: 57, Index: 194, @@ -3581,12 +3581,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `UnaryOpTerm : ".+" UnaryOpTerm << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeOperator, - []interface{}{ - X[1], - }, - ) >>`, + X[0], + dsl.NodeTypeOperator, + []interface{}{ + X[1], + }, + ) >>`, Id: "UnaryOpTerm", NTType: 57, Index: 195, @@ -3603,12 +3603,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `UnaryOpTerm : ".-" UnaryOpTerm << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeOperator, - []interface{}{ - X[1], - }, - ) >>`, + X[0], + dsl.NodeTypeOperator, + []interface{}{ + X[1], + }, + ) >>`, Id: "UnaryOpTerm", NTType: 57, Index: 196, @@ -3625,12 +3625,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `UnaryOpTerm : "!" UnaryOpTerm << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeOperator, - []interface{}{ - X[1], - }, - ) >>`, + X[0], + dsl.NodeTypeOperator, + []interface{}{ + X[1], + }, + ) >>`, Id: "UnaryOpTerm", NTType: 57, Index: 197, @@ -3647,12 +3647,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `UnaryOpTerm : "~" UnaryOpTerm << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeOperator, - []interface{}{ - X[1], - }, - ) >>`, + X[0], + dsl.NodeTypeOperator, + []interface{}{ + X[1], + }, + ) >>`, Id: "UnaryOpTerm", NTType: 57, Index: 198, @@ -3679,13 +3679,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `AbsentCoalesceTerm : AbsentCoalesceTerm "??" EmptyCoalesceTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "AbsentCoalesceTerm", NTType: 58, Index: 200, @@ -3713,13 +3713,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `EmptyCoalesceTerm : EmptyCoalesceTerm "???" PowTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "EmptyCoalesceTerm", NTType: 59, Index: 202, @@ -3747,13 +3747,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `PowTerm : PrecedenceChainEnd "**" PowTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "PowTerm", NTType: 60, Index: 204, @@ -3771,13 +3771,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `PowTerm : PrecedenceChainEnd "**" "-" PowTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - dsl.NewASTNode( X[2], dsl.NodeTypeOperator, []interface{}{X[3]}), - }, - ) >>`, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + dsl.NewASTNode(X[2], dsl.NodeTypeOperator, []interface{}{X[3]}), + }, + ) >>`, Id: "PowTerm", NTType: 60, Index: 205, @@ -3795,16 +3795,16 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `PowTerm : PrecedenceChainEnd "**" "+" PowTerm << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeOperator, - []interface{}{ - X[0], - dsl.NewASTNode( - X[2], - dsl.NodeTypeOperator, - []interface{}{X[3]}, - ), - }, + X[1], + dsl.NodeTypeOperator, + []interface{}{ + X[0], + dsl.NewASTNode( + X[2], + dsl.NodeTypeOperator, + []interface{}{X[3]}, + ), + }, ) >>`, Id: "PowTerm", NTType: 60, @@ -3997,9 +3997,9 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MlrvalOrFunction : const_M_PI << dsl.NewASTNodeTerminalWithErrorReturn( - X[0], - dsl.NodeTypeConstant, - ) >>`, + X[0], + dsl.NodeTypeConstant, + ) >>`, Id: "MlrvalOrFunction", NTType: 62, Index: 224, @@ -4013,9 +4013,9 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MlrvalOrFunction : const_M_E << dsl.NewASTNodeTerminalWithErrorReturn( - X[0], - dsl.NodeTypeConstant, - ) >>`, + X[0], + dsl.NodeTypeConstant, + ) >>`, Id: "MlrvalOrFunction", NTType: 62, Index: 225, @@ -4049,10 +4049,10 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ArrayLiteral : "[" "]" << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", X[0]), - dsl.NodeTypeArrayLiteral, - []interface{}{}, - ) >>`, + dsl.NewASTToken("[]", X[0]), + dsl.NodeTypeArrayLiteral, + []interface{}{}, + ) >>`, Id: "ArrayLiteral", NTType: 63, Index: 228, @@ -4089,12 +4089,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ArrayLiteralElements : Rvalue << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeArrayLiteral, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeArrayLiteral, + []interface{}{ + X[0], + }, + ) >>`, Id: "ArrayLiteralElements", NTType: 64, Index: 230, @@ -4111,12 +4111,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ArrayLiteralElements : Rvalue "," << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeArrayLiteral, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeArrayLiteral, + []interface{}{ + X[0], + }, + ) >>`, Id: "ArrayLiteralElements", NTType: 64, Index: 231, @@ -4133,9 +4133,9 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ArrayLiteralElements : Rvalue "," ArrayLiteralElements << dsl.WithChildPrepended( - X[2], - X[0], - ) >>`, + X[2], + X[0], + ) >>`, Id: "ArrayLiteralElements", NTType: 64, Index: 232, @@ -4159,10 +4159,10 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MapLiteral : "{" "}" << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("{}", X[0]), - dsl.NodeTypeMapLiteral, - []interface{}{}, - ) >>`, + dsl.NewASTToken("{}", X[0]), + dsl.NodeTypeMapLiteral, + []interface{}{}, + ) >>`, Id: "MapLiteral", NTType: 65, Index: 234, @@ -4199,12 +4199,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MapLiteralKeyValuePairs : MapLiteralKeyValuePair << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeMapLiteral, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeMapLiteral, + []interface{}{ + X[0], + }, + ) >>`, Id: "MapLiteralKeyValuePairs", NTType: 66, Index: 236, @@ -4221,12 +4221,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MapLiteralKeyValuePairs : MapLiteralKeyValuePair "," << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeMapLiteral, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeMapLiteral, + []interface{}{ + X[0], + }, + ) >>`, Id: "MapLiteralKeyValuePairs", NTType: 66, Index: 237, @@ -4243,9 +4243,9 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MapLiteralKeyValuePairs : MapLiteralKeyValuePair "," MapLiteralKeyValuePairs << dsl.WithChildPrepended( - X[2], - X[0], - ) >>`, + X[2], + X[0], + ) >>`, Id: "MapLiteralKeyValuePairs", NTType: 66, Index: 238, @@ -4259,13 +4259,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MapLiteralKeyValuePair : Rvalue ":" Rvalue << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeMapLiteralKeyValuePair, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + X[1], + dsl.NodeTypeMapLiteralKeyValuePair, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "MapLiteralKeyValuePair", NTType: 67, Index: 239, @@ -4423,12 +4423,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ENV : env "[" Rvalue "]" << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeEnvironmentVariable, - []interface{}{ - X[2], - }, - ) >>`, + X[0], + dsl.NodeTypeEnvironmentVariable, + []interface{}{ + X[2], + }, + ) >>`, Id: "ENV", NTType: 69, Index: 254, @@ -4445,12 +4445,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ENV : env "." non_sigil_name << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeEnvironmentVariable, - []interface{}{ - dsl.NewASTNodeTerminal(X[2], dsl.NodeTypeStringLiteral), - }, - ) >>`, + X[0], + dsl.NodeTypeEnvironmentVariable, + []interface{}{ + dsl.NewASTNodeTerminal(X[2], dsl.NodeTypeStringLiteral), + }, + ) >>`, Id: "ENV", NTType: 69, Index: 255, @@ -4507,13 +4507,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ArrayOrMapIndexAccess : MlrvalOrFunction "[" Rvalue "]" << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", X[1]), - dsl.NodeTypeArrayOrMapIndexAccess, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + dsl.NewASTToken("[]", X[1]), + dsl.NodeTypeArrayOrMapIndexAccess, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "ArrayOrMapIndexAccess", NTType: 70, Index: 260, @@ -4531,13 +4531,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ArrayOrMapPositionalNameAccess : MlrvalOrFunction "[[" Rvalue "]" "]" << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", X[1]), - dsl.NodeTypeArrayOrMapPositionalNameAccess, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + dsl.NewASTToken("[]", X[1]), + dsl.NodeTypeArrayOrMapPositionalNameAccess, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "ArrayOrMapPositionalNameAccess", NTType: 71, Index: 261, @@ -4555,13 +4555,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ArrayOrMapPositionalValueAccess : MlrvalOrFunction "[[[" Rvalue "]" "]" "]" << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", X[1]), - dsl.NodeTypeArrayOrMapPositionalValueAccess, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + dsl.NewASTToken("[]", X[1]), + dsl.NodeTypeArrayOrMapPositionalValueAccess, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "ArrayOrMapPositionalValueAccess", NTType: 72, Index: 262, @@ -4579,14 +4579,14 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ArraySliceAccess : MlrvalOrFunction "[" Rvalue ":" Rvalue "]" << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", X[1]), - dsl.NodeTypeArraySliceAccess, - []interface{}{ - X[0], - X[2], - X[4], - }, - ) >>`, + dsl.NewASTToken("[]", X[1]), + dsl.NodeTypeArraySliceAccess, + []interface{}{ + X[0], + X[2], + X[4], + }, + ) >>`, Id: "ArraySliceAccess", NTType: 73, Index: 263, @@ -4605,17 +4605,17 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ArraySliceAccess : MlrvalOrFunction "[" ":" Rvalue "]" << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", X[1]), - dsl.NodeTypeArraySliceAccess, - []interface{}{ - X[0], - dsl.NewASTNodeTerminal( - X[2], - dsl.NodeTypeArraySliceEmptyLowerIndex, - ), - X[3], - }, - ) >>`, + dsl.NewASTToken("[]", X[1]), + dsl.NodeTypeArraySliceAccess, + []interface{}{ + X[0], + dsl.NewASTNodeTerminal( + X[2], + dsl.NodeTypeArraySliceEmptyLowerIndex, + ), + X[3], + }, + ) >>`, Id: "ArraySliceAccess", NTType: 73, Index: 264, @@ -4637,17 +4637,17 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ArraySliceAccess : MlrvalOrFunction "[" Rvalue ":" "]" << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", X[1]), - dsl.NodeTypeArraySliceAccess, - []interface{}{ - X[0], - X[2], - dsl.NewASTNodeTerminal( - X[3], - dsl.NodeTypeArraySliceEmptyUpperIndex, - ), - }, - ) >>`, + dsl.NewASTToken("[]", X[1]), + dsl.NodeTypeArraySliceAccess, + []interface{}{ + X[0], + X[2], + dsl.NewASTNodeTerminal( + X[3], + dsl.NodeTypeArraySliceEmptyUpperIndex, + ), + }, + ) >>`, Id: "ArraySliceAccess", NTType: 73, Index: 265, @@ -4669,20 +4669,20 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ArraySliceAccess : MlrvalOrFunction "[" ":" "]" << dsl.NewASTNodeWithErrorReturn( - dsl.NewASTToken("[]", X[1]), - dsl.NodeTypeArraySliceAccess, - []interface{}{ - X[0], - dsl.NewASTNodeTerminal( - X[2], - dsl.NodeTypeArraySliceEmptyLowerIndex, - ), - dsl.NewASTNodeTerminal( - X[2], - dsl.NodeTypeArraySliceEmptyUpperIndex, - ), - }, - ) >>`, + dsl.NewASTToken("[]", X[1]), + dsl.NodeTypeArraySliceAccess, + []interface{}{ + X[0], + dsl.NewASTNodeTerminal( + X[2], + dsl.NodeTypeArraySliceEmptyLowerIndex, + ), + dsl.NewASTNodeTerminal( + X[2], + dsl.NodeTypeArraySliceEmptyUpperIndex, + ), + }, + ) >>`, Id: "ArraySliceAccess", NTType: 73, Index: 266, @@ -4717,10 +4717,10 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `FunctionCallsite : FunctionName "(" ")" << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeFunctionCallsite, - []interface{}{}, - ) >>`, + X[0], + dsl.NodeTypeFunctionCallsite, + []interface{}{}, + ) >>`, Id: "FunctionCallsite", NTType: 74, Index: 268, @@ -4787,12 +4787,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `FcnArgs : Rvalue << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeFunctionCallsite, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeFunctionCallsite, + []interface{}{ + X[0], + }, + ) >>`, Id: "FcnArgs", NTType: 76, Index: 273, @@ -4809,12 +4809,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `FcnArgs : Rvalue "," << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeFunctionCallsite, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeFunctionCallsite, + []interface{}{ + X[0], + }, + ) >>`, Id: "FcnArgs", NTType: 76, Index: 274, @@ -4831,9 +4831,9 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `FcnArgs : Rvalue "," FcnArgs << dsl.WithChildPrepended( - X[2], - X[0], - ) >>`, + X[2], + X[0], + ) >>`, Id: "FcnArgs", NTType: 76, Index: 275, @@ -4847,10 +4847,10 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `SubroutineCallsite : call SubroutineName "(" ")" << dsl.NewASTNodeWithErrorReturn( - X[1], - dsl.NodeTypeSubroutineCallsite, - []interface{}{}, - ) >>`, + X[1], + dsl.NodeTypeSubroutineCallsite, + []interface{}{}, + ) >>`, Id: "SubroutineCallsite", NTType: 77, Index: 276, @@ -4977,12 +4977,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `BeginBlock : begin StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeBeginBlock, - []interface{}{ - X[1], - }, - ) >>`, + nil, + dsl.NodeTypeBeginBlock, + []interface{}{ + X[1], + }, + ) >>`, Id: "BeginBlock", NTType: 80, Index: 287, @@ -4999,12 +4999,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `EndBlock : end StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeEndBlock, - []interface{}{ - X[1], - }, - ) >>`, + nil, + dsl.NodeTypeEndBlock, + []interface{}{ + X[1], + }, + ) >>`, Id: "EndBlock", NTType: 81, Index: 288, @@ -5021,13 +5021,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `CondBlock : Rvalue StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeCondBlock, - []interface{}{ - X[0], - X[1], - }, - ) >>`, + nil, + dsl.NodeTypeCondBlock, + []interface{}{ + X[0], + X[1], + }, + ) >>`, Id: "CondBlock", NTType: 82, Index: 289, @@ -5065,12 +5065,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `IfElifStar : IfBlock << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeIfChain, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeIfChain, + []interface{}{ + X[0], + }, + ) >>`, Id: "IfElifStar", NTType: 84, Index: 292, @@ -5097,13 +5097,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `IfBlock : if "(" Rvalue ")" StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeIfItem, - []interface{}{ - X[2], - X[4], - }, - ) >>`, + X[0], + dsl.NodeTypeIfItem, + []interface{}{ + X[2], + X[4], + }, + ) >>`, Id: "IfBlock", NTType: 85, Index: 294, @@ -5121,13 +5121,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ElifBlock : elif "(" Rvalue ")" StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeIfItem, - []interface{}{ - X[2], - X[4], - }, - ) >>`, + X[0], + dsl.NodeTypeIfItem, + []interface{}{ + X[2], + X[4], + }, + ) >>`, Id: "ElifBlock", NTType: 86, Index: 295, @@ -5145,12 +5145,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ElseBlock : else StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeIfItem, - []interface{}{ - X[1], - }, - ) >>`, + X[0], + dsl.NodeTypeIfItem, + []interface{}{ + X[1], + }, + ) >>`, Id: "ElseBlock", NTType: 87, Index: 296, @@ -5167,13 +5167,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `WhileLoop : while "(" Rvalue ")" StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeWhileLoop, - []interface{}{ - X[2], - X[4], - }, - ) >>`, + X[0], + dsl.NodeTypeWhileLoop, + []interface{}{ + X[2], + X[4], + }, + ) >>`, Id: "WhileLoop", NTType: 88, Index: 297, @@ -5191,13 +5191,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `DoWhileLoop : do StatementBlockInBraces while "(" Rvalue ")" << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeDoWhileLoop, - []interface{}{ - X[1], - X[4], - }, - ) >>`, + X[0], + dsl.NodeTypeDoWhileLoop, + []interface{}{ + X[1], + X[4], + }, + ) >>`, Id: "DoWhileLoop", NTType: 89, Index: 298, @@ -5255,14 +5255,14 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ForLoopOneVariable : for "(" LocalVariable in Rvalue ")" StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - X[0], // "for" - dsl.NodeTypeForLoopOneVariable, - []interface{}{ - X[2], // k, etc. - X[4], // $*, etc. - X[6], // { ... } - }, - ); >>`, + X[0], // "for" + dsl.NodeTypeForLoopOneVariable, + []interface{}{ + X[2], // k, etc. + X[4], // $*, etc. + X[6], // { ... } + }, + ) >>`, Id: "ForLoopOneVariable", NTType: 91, Index: 303, @@ -5281,15 +5281,15 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ForLoopTwoVariable : for "(" LocalVariable "," LocalVariable in Rvalue ")" StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - X[0], // "for" - dsl.NodeTypeForLoopTwoVariable, - []interface{} { - X[2], // k, etc. - X[4], // v, etc. - X[6], // $*, etc. - X[8], // { ... } - }, - ); >>`, + X[0], // "for" + dsl.NodeTypeForLoopTwoVariable, + []interface{}{ + X[2], // k, etc. + X[4], // v, etc. + X[6], // $*, etc. + X[8], // { ... } + }, + ) >>`, Id: "ForLoopTwoVariable", NTType: 92, Index: 304, @@ -5309,15 +5309,15 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ForLoopMultivariable : for "(" "(" MultiIndex ")" "," LocalVariable in Rvalue ")" StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - X[0], // "for" - dsl.NodeTypeForLoopMultivariable, - []interface{} { - X[3], // (k1, k2), etc. - X[6], // v, etc. - X[8], // $*, etc. - X[10], // { ... } - }, - ); >>`, + X[0], // "for" + dsl.NodeTypeForLoopMultivariable, + []interface{}{ + X[3], // (k1, k2), etc. + X[6], // v, etc. + X[8], // $*, etc. + X[10], // { ... } + }, + ) >>`, Id: "ForLoopMultivariable", NTType: 93, Index: 305, @@ -5337,13 +5337,13 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MultiIndex : LocalVariable "," LocalVariable << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeParameterList, - []interface{}{ - X[0], - X[2], - }, - ) >>`, + nil, + dsl.NodeTypeParameterList, + []interface{}{ + X[0], + X[2], + }, + ) >>`, Id: "MultiIndex", NTType: 94, Index: 306, @@ -5361,9 +5361,9 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `MultiIndex : MultiIndex "," LocalVariable << dsl.WithChildAppended( - X[0], - X[2], - ) >>`, + X[0], + X[2], + ) >>`, Id: "MultiIndex", NTType: 94, Index: 307, @@ -5377,15 +5377,15 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `TripleForLoop : for "(" TripleForStart ";" TripleForContinuation ";" TripleForUpdate ")" StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - X[0], // for - dsl.NodeTypeTripleForLoop, - []interface{} { - X[2], // start - X[4], // continuation - X[6], // update - X[8], // body - }, - ); >>`, + X[0], // for + dsl.NodeTypeTripleForLoop, + []interface{}{ + X[2], // start + X[4], // continuation + X[6], // update + X[8], // body + }, + ) >>`, Id: "TripleForLoop", NTType: 95, Index: 308, @@ -5405,10 +5405,10 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `TripleForStart : empty << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{}, - ) >>`, + nil, + dsl.NodeTypeStatementBlock, + []interface{}{}, + ) >>`, Id: "TripleForStart", NTType: 96, Index: 309, @@ -5423,12 +5423,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `TripleForStart : Assignment << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeStatementBlock, + []interface{}{ + X[0], + }, + ) >>`, Id: "TripleForStart", NTType: 96, Index: 310, @@ -5455,10 +5455,10 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `TripleForContinuation : empty << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{}, - ) >>`, + nil, + dsl.NodeTypeStatementBlock, + []interface{}{}, + ) >>`, Id: "TripleForContinuation", NTType: 97, Index: 312, @@ -5473,12 +5473,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `TripleForContinuation : TripleForContinuationItem << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeStatementBlock, + []interface{}{ + X[0], + }, + ) >>`, Id: "TripleForContinuation", NTType: 97, Index: 313, @@ -5525,10 +5525,10 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `TripleForUpdate : empty << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{}, - ) >>`, + nil, + dsl.NodeTypeStatementBlock, + []interface{}{}, + ) >>`, Id: "TripleForUpdate", NTType: 99, Index: 317, @@ -5543,12 +5543,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `TripleForUpdate : Assignment << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeStatementBlock, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeStatementBlock, + []interface{}{ + X[0], + }, + ) >>`, Id: "TripleForUpdate", NTType: 99, Index: 318, @@ -5575,10 +5575,10 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `BreakStatement : break << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeBreak, - []interface{}{}, - ) >>`, + X[0], + dsl.NodeTypeBreak, + []interface{}{}, + ) >>`, Id: "BreakStatement", NTType: 100, Index: 320, @@ -5593,10 +5593,10 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ContinueStatement : continue << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeContinue, - []interface{}{}, - ) >>`, + X[0], + dsl.NodeTypeContinue, + []interface{}{}, + ) >>`, Id: "ContinueStatement", NTType: 101, Index: 321, @@ -5611,15 +5611,15 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `NamedFunctionDefinition : func non_sigil_name "(" FuncOrSubrParameterList ")" StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - X[1], - // { ... } - dsl.NodeTypeNamedFunctionDefinition, - []interface{}{ - X[3], - // parameter list - X[5], - }, - ); >>`, + X[1], + // { ... } + dsl.NodeTypeNamedFunctionDefinition, + []interface{}{ + X[3], + // parameter list + X[5], + }, + ) >>`, Id: "NamedFunctionDefinition", NTType: 102, Index: 322, @@ -5639,17 +5639,17 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `NamedFunctionDefinition : func non_sigil_name "(" FuncOrSubrParameterList ")" ":" Typedecl StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - X[1], - // return type - dsl.NodeTypeNamedFunctionDefinition, - []interface{}{ - X[3], - // parameter list - X[7], - // {...} - X[6], - }, - ); >>`, + X[1], + // return type + dsl.NodeTypeNamedFunctionDefinition, + []interface{}{ + X[3], + // parameter list + X[7], + // {...} + X[6], + }, + ) >>`, Id: "NamedFunctionDefinition", NTType: 102, Index: 323, @@ -5671,15 +5671,15 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `UnnamedFunctionDefinition : func "(" FuncOrSubrParameterList ")" StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - X[0], - // { ... } - dsl.NodeTypeUnnamedFunctionDefinition, - []interface{}{ - X[2], - // parameter list - X[4], - }, - ); >>`, + X[0], + // { ... } + dsl.NodeTypeUnnamedFunctionDefinition, + []interface{}{ + X[2], + // parameter list + X[4], + }, + ) >>`, Id: "UnnamedFunctionDefinition", NTType: 103, Index: 324, @@ -5699,17 +5699,17 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `UnnamedFunctionDefinition : func "(" FuncOrSubrParameterList ")" ":" Typedecl StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - X[0], - // return type - dsl.NodeTypeUnnamedFunctionDefinition, - []interface{}{ - X[2], - // parameter list - X[6], - // {...} - X[5], - }, - ); >>`, + X[0], + // return type + dsl.NodeTypeUnnamedFunctionDefinition, + []interface{}{ + X[2], + // parameter list + X[6], + // {...} + X[5], + }, + ) >>`, Id: "UnnamedFunctionDefinition", NTType: 103, Index: 325, @@ -5731,15 +5731,15 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `SubroutineDefinition : subr non_sigil_name "(" FuncOrSubrParameterList ")" StatementBlockInBraces << dsl.NewASTNodeWithErrorReturn( - X[1], - // { ... } - dsl.NodeTypeSubroutineDefinition, - []interface{}{ - X[3], - // parameter list - X[5], - }, - ); >>`, + X[1], + // { ... } + dsl.NodeTypeSubroutineDefinition, + []interface{}{ + X[3], + // parameter list + X[5], + }, + ) >>`, Id: "SubroutineDefinition", NTType: 104, Index: 326, @@ -5759,10 +5759,10 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `FuncOrSubrParameterList : empty << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeParameterList, - []interface{}{}, - ) >>`, + nil, + dsl.NodeTypeParameterList, + []interface{}{}, + ) >>`, Id: "FuncOrSubrParameterList", NTType: 105, Index: 327, @@ -5787,12 +5787,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `FuncOrSubrNonEmptyParameterList : FuncOrSubrParameter << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeParameterList, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeParameterList, + []interface{}{ + X[0], + }, + ) >>`, Id: "FuncOrSubrNonEmptyParameterList", NTType: 106, Index: 329, @@ -5809,12 +5809,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `FuncOrSubrNonEmptyParameterList : FuncOrSubrParameter "," << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeParameterList, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeParameterList, + []interface{}{ + X[0], + }, + ) >>`, Id: "FuncOrSubrNonEmptyParameterList", NTType: 106, Index: 330, @@ -5841,12 +5841,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `FuncOrSubrParameter : UntypedFuncOrSubrParameterName << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeParameter, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeParameter, + []interface{}{ + X[0], + }, + ) >>`, Id: "FuncOrSubrParameter", NTType: 107, Index: 332, @@ -5863,12 +5863,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `FuncOrSubrParameter : TypedFuncOrSubrParameterName << dsl.NewASTNodeWithErrorReturn( - nil, - dsl.NodeTypeParameter, - []interface{}{ - X[0], - }, - ) >>`, + nil, + dsl.NodeTypeParameter, + []interface{}{ + X[0], + }, + ) >>`, Id: "FuncOrSubrParameter", NTType: 107, Index: 333, @@ -5905,12 +5905,12 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ReturnStatement : return Rvalue << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeReturn, - []interface{}{ - X[1], - }, - ) >>`, + X[0], + dsl.NodeTypeReturn, + []interface{}{ + X[1], + }, + ) >>`, Id: "ReturnStatement", NTType: 110, Index: 336, @@ -5927,10 +5927,10 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `ReturnStatement : return << dsl.NewASTNodeWithErrorReturn( - X[0], - dsl.NodeTypeReturn, - []interface{}{}, - ) >>`, + X[0], + dsl.NodeTypeReturn, + []interface{}{}, + ) >>`, Id: "ReturnStatement", NTType: 110, Index: 337, diff --git a/tools/format-go-in-bnf b/tools/format-go-in-bnf new file mode 100755 index 000000000..66df14686 --- /dev/null +++ b/tools/format-go-in-bnf @@ -0,0 +1,65 @@ +#!/usr/bin/env python + +# ================================================================ +# Run pkg/parsing/mlr.bnf through this filter to reformat the Go code. +# This only finds the Go code if the "<<" and the ">>" are on blank +# lines before and after. +# ================================================================ + +import sys +import re +import subprocess + +in_dsl = False +dsl_lines = [] + +while True: + line = sys.stdin.readline() + if line == '': + break + line = line.rstrip() + + if re.match("^ *<<$", line): + in_dsl = True + print(line) + + elif re.match("^ *>>$", line): + in_dsl = False + + in_block = "\n".join(dsl_lines) + in_block = re.sub(r'\$', 'DOLLAR_', in_block) + + result = subprocess.run( + ['gofmt'], + input=in_block, + capture_output=True, + text=True, + ) + + if result.returncode == 0: + out_block = result.stdout + out_block = re.sub('DOLLAR_', '$', out_block) + out_block = re.sub('\t',' ', out_block) + out_lines = out_block.split("\n") + for out_line in out_lines: + out_line = re.sub(r"\s*$", "", out_line) + if out_line != "": + print(" " + out_line) + else: + print() + print(result.stdout) + print(result.stderr) + print() + print("Exiting!") + print() + sys.exit(1) + + print(line) + dsl_lines = [] + + elif in_dsl: + dsl_lines.append(line) + + else: + #print("OUTSIDE") + print(line)