Allow ENV.NAME as an alternative to ENV["NAME"] (#583)

* Allow ENV.NAME as an alternative to ENV["NAME"]

* regtest
This commit is contained in:
John Kerl 2021-06-26 03:50:33 +00:00 committed by GitHub
parent 2a99e521a4
commit 5b3ec7ee0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 515244 additions and 506542 deletions

View file

@ -0,0 +1 @@
mlr --from regtest/input/s.dkvp --opprint head -n 2 then put -f ${CASEDIR}/mlr

View file

@ -0,0 +1 @@
FOO=BAR

View file

View file

@ -0,0 +1,3 @@
a b i x y
pan pan 1 0.3467901443380824 0.7268028627434533
eks pan 2 0.7586799647899636 0.5221511083334797

View file

@ -0,0 +1 @@
ENV.FOO = "bar"

View file

@ -104,8 +104,8 @@ var keyColorString = make256ColorString(208) // orange
var valueColorString = make256ColorString(33) // blue
var passColorString = make16ColorString(10) // bold green
var failColorString = make16ColorString(9) // bold red
var replPS1ColorString = make16ColorString(9) // bold red
var replPS2ColorString = make16ColorString(1) // red
var replPS1ColorString = make16ColorString(9) // bold red
var replPS2ColorString = make16ColorString(1) // red
var helpColorString = make16ColorString(9) // bold red
// Used to switch back to default color

View file

@ -1672,7 +1672,8 @@ ContextVariable
// ----------------------------------------------------------------
MlrvalOrFunction : ENV ;
// Only ENV["foo"]; not arbitrarily indexable like maps are
// Only ENV["FOO"]; not arbitrarily indexable like maps are.
// Alternate syntax: ENV.FOO.
ENV
: env "[" Rvalue "]"
@ -1681,6 +1682,13 @@ ENV
$2,
dsl.NodeTypeEnvironmentVariable,
) >>
| env "." non_sigil_name
<< dsl.NewASTNodeUnary(
$0,
dsl.NewASTNodeNestable($2, dsl.NodeTypeStringLiteral),
dsl.NodeTypeEnvironmentVariable,
) >>
;
// ================================================================

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -11,8 +11,8 @@ import (
)
const (
numProductions = 325
numStates = 4276
numProductions = 326
numStates = 4310
numSymbols = 248
)

View file

@ -3210,17 +3210,25 @@ var productionsTable = ProdTab{
},
},
ProdTabEntry{
String: `MlrvalOrFunction : ArrayOrMapIndexAccess << >>`,
Id: "MlrvalOrFunction",
NTType: 60,
String: `ENV : env "." non_sigil_name << dsl.NewASTNodeUnary(
X[0],
dsl.NewASTNodeNestable(X[2], dsl.NodeTypeStringLiteral),
dsl.NodeTypeEnvironmentVariable,
) >>`,
Id: "ENV",
NTType: 67,
Index: 245,
NumSymbols: 1,
NumSymbols: 3,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
return dsl.NewASTNodeUnary(
X[0],
dsl.NewASTNodeNestable(X[2], dsl.NodeTypeStringLiteral),
dsl.NodeTypeEnvironmentVariable,
)
},
},
ProdTabEntry{
String: `MlrvalOrFunction : ArrayOrMapPositionalNameAccess << >>`,
String: `MlrvalOrFunction : ArrayOrMapIndexAccess << >>`,
Id: "MlrvalOrFunction",
NTType: 60,
Index: 246,
@ -3230,7 +3238,7 @@ var productionsTable = ProdTab{
},
},
ProdTabEntry{
String: `MlrvalOrFunction : ArrayOrMapPositionalValueAccess << >>`,
String: `MlrvalOrFunction : ArrayOrMapPositionalNameAccess << >>`,
Id: "MlrvalOrFunction",
NTType: 60,
Index: 247,
@ -3240,7 +3248,7 @@ var productionsTable = ProdTab{
},
},
ProdTabEntry{
String: `MlrvalOrFunction : ArraySliceAccess << >>`,
String: `MlrvalOrFunction : ArrayOrMapPositionalValueAccess << >>`,
Id: "MlrvalOrFunction",
NTType: 60,
Index: 248,
@ -3249,6 +3257,16 @@ var productionsTable = ProdTab{
return X[0], nil
},
},
ProdTabEntry{
String: `MlrvalOrFunction : ArraySliceAccess << >>`,
Id: "MlrvalOrFunction",
NTType: 60,
Index: 249,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
},
},
ProdTabEntry{
String: `ArrayOrMapIndexAccess : MlrvalOrFunction "[" Rvalue "]" << dsl.NewASTNodeBinary(
dsl.NewASTToken("[]", X[1]),
@ -3258,7 +3276,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "ArrayOrMapIndexAccess",
NTType: 68,
Index: 249,
Index: 250,
NumSymbols: 4,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeBinary(
@ -3278,7 +3296,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "ArrayOrMapPositionalNameAccess",
NTType: 69,
Index: 250,
Index: 251,
NumSymbols: 5,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeBinary(
@ -3298,7 +3316,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "ArrayOrMapPositionalValueAccess",
NTType: 70,
Index: 251,
Index: 252,
NumSymbols: 6,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeBinary(
@ -3319,7 +3337,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "ArraySliceAccess",
NTType: 71,
Index: 252,
Index: 253,
NumSymbols: 6,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeTernary(
@ -3344,7 +3362,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "ArraySliceAccess",
NTType: 71,
Index: 253,
Index: 254,
NumSymbols: 5,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeTernary(
@ -3372,7 +3390,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "ArraySliceAccess",
NTType: 71,
Index: 254,
Index: 255,
NumSymbols: 5,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeTernary(
@ -3403,7 +3421,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "ArraySliceAccess",
NTType: 71,
Index: 255,
Index: 256,
NumSymbols: 4,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeTernary(
@ -3425,7 +3443,7 @@ var productionsTable = ProdTab{
String: `MlrvalOrFunction : FunctionCallsite << >>`,
Id: "MlrvalOrFunction",
NTType: 60,
Index: 256,
Index: 257,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3438,7 +3456,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "FunctionCallsite",
NTType: 72,
Index: 257,
Index: 258,
NumSymbols: 3,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeZary(
@ -3457,7 +3475,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "FunctionCallsite",
NTType: 72,
Index: 258,
Index: 259,
NumSymbols: 4,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.AdoptChildren(
@ -3473,7 +3491,7 @@ var productionsTable = ProdTab{
String: `FunctionName : non_sigil_name << >>`,
Id: "FunctionName",
NTType: 73,
Index: 259,
Index: 260,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3483,7 +3501,7 @@ var productionsTable = ProdTab{
String: `FunctionName : int << >>`,
Id: "FunctionName",
NTType: 73,
Index: 260,
Index: 261,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3493,7 +3511,7 @@ var productionsTable = ProdTab{
String: `FunctionName : float << >>`,
Id: "FunctionName",
NTType: 73,
Index: 261,
Index: 262,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3507,7 +3525,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "FcnArgs",
NTType: 74,
Index: 262,
Index: 263,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(
@ -3525,7 +3543,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "FcnArgs",
NTType: 74,
Index: 263,
Index: 264,
NumSymbols: 2,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(
@ -3542,7 +3560,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "FcnArgs",
NTType: 74,
Index: 264,
Index: 265,
NumSymbols: 3,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.PrependChild(
@ -3558,7 +3576,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "SubroutineCallsite",
NTType: 75,
Index: 265,
Index: 266,
NumSymbols: 4,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeZary(
@ -3577,7 +3595,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "SubroutineCallsite",
NTType: 75,
Index: 266,
Index: 267,
NumSymbols: 5,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.AdoptChildren(
@ -3593,7 +3611,7 @@ var productionsTable = ProdTab{
String: `SubroutineName : non_sigil_name << >>`,
Id: "SubroutineName",
NTType: 76,
Index: 267,
Index: 268,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3603,7 +3621,7 @@ var productionsTable = ProdTab{
String: `BracefulStatement : BeginBlock << >>`,
Id: "BracefulStatement",
NTType: 77,
Index: 268,
Index: 269,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3613,7 +3631,7 @@ var productionsTable = ProdTab{
String: `BracefulStatement : EndBlock << >>`,
Id: "BracefulStatement",
NTType: 77,
Index: 269,
Index: 270,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3623,7 +3641,7 @@ var productionsTable = ProdTab{
String: `BracefulStatement : CondBlock << >>`,
Id: "BracefulStatement",
NTType: 77,
Index: 270,
Index: 271,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3633,7 +3651,7 @@ var productionsTable = ProdTab{
String: `BracefulStatement : IfChain << >>`,
Id: "BracefulStatement",
NTType: 77,
Index: 271,
Index: 272,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3643,7 +3661,7 @@ var productionsTable = ProdTab{
String: `BracefulStatement : WhileLoop << >>`,
Id: "BracefulStatement",
NTType: 77,
Index: 272,
Index: 273,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3653,7 +3671,7 @@ var productionsTable = ProdTab{
String: `BracefulStatement : ForLoop << >>`,
Id: "BracefulStatement",
NTType: 77,
Index: 273,
Index: 274,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3663,7 +3681,7 @@ var productionsTable = ProdTab{
String: `BracefulStatement : FunctionDefinition << >>`,
Id: "BracefulStatement",
NTType: 77,
Index: 274,
Index: 275,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3673,7 +3691,7 @@ var productionsTable = ProdTab{
String: `BracefulStatement : SubroutineDefinition << >>`,
Id: "BracefulStatement",
NTType: 77,
Index: 275,
Index: 276,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3683,7 +3701,7 @@ var productionsTable = ProdTab{
String: `BeginBlock : begin StatementBlockInBraces << dsl.NewASTNodeUnary(nil, X[1], dsl.NodeTypeBeginBlock) >>`,
Id: "BeginBlock",
NTType: 78,
Index: 276,
Index: 277,
NumSymbols: 2,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(nil, X[1], dsl.NodeTypeBeginBlock)
@ -3693,7 +3711,7 @@ var productionsTable = ProdTab{
String: `EndBlock : end StatementBlockInBraces << dsl.NewASTNodeUnary(nil, X[1], dsl.NodeTypeEndBlock) >>`,
Id: "EndBlock",
NTType: 79,
Index: 277,
Index: 278,
NumSymbols: 2,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(nil, X[1], dsl.NodeTypeEndBlock)
@ -3703,7 +3721,7 @@ var productionsTable = ProdTab{
String: `CondBlock : Rvalue StatementBlockInBraces << dsl.NewASTNodeBinary(nil, X[0], X[1], dsl.NodeTypeCondBlock) >>`,
Id: "CondBlock",
NTType: 80,
Index: 278,
Index: 279,
NumSymbols: 2,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeBinary(nil, X[0], X[1], dsl.NodeTypeCondBlock)
@ -3713,7 +3731,7 @@ var productionsTable = ProdTab{
String: `IfChain : IfElifStar << >>`,
Id: "IfChain",
NTType: 81,
Index: 279,
Index: 280,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3723,7 +3741,7 @@ var productionsTable = ProdTab{
String: `IfChain : IfElifStar ElseBlock << dsl.AppendChild(X[0], X[1]) >>`,
Id: "IfChain",
NTType: 81,
Index: 280,
Index: 281,
NumSymbols: 2,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.AppendChild(X[0], X[1])
@ -3733,7 +3751,7 @@ var productionsTable = ProdTab{
String: `IfElifStar : IfBlock << dsl.NewASTNodeUnary(nil, X[0], dsl.NodeTypeIfChain) >>`,
Id: "IfElifStar",
NTType: 82,
Index: 281,
Index: 282,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(nil, X[0], dsl.NodeTypeIfChain)
@ -3743,7 +3761,7 @@ var productionsTable = ProdTab{
String: `IfElifStar : IfElifStar ElifBlock << dsl.AppendChild(X[0], X[1]) >>`,
Id: "IfElifStar",
NTType: 82,
Index: 282,
Index: 283,
NumSymbols: 2,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.AppendChild(X[0], X[1])
@ -3753,7 +3771,7 @@ var productionsTable = ProdTab{
String: `IfBlock : if "(" Rvalue ")" StatementBlockInBraces << dsl.NewASTNodeBinary(X[0], X[2], X[4], dsl.NodeTypeIfItem) >>`,
Id: "IfBlock",
NTType: 83,
Index: 283,
Index: 284,
NumSymbols: 5,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeBinary(X[0], X[2], X[4], dsl.NodeTypeIfItem)
@ -3763,7 +3781,7 @@ var productionsTable = ProdTab{
String: `ElifBlock : elif "(" Rvalue ")" StatementBlockInBraces << dsl.NewASTNodeBinary(X[0], X[2], X[4], dsl.NodeTypeIfItem) >>`,
Id: "ElifBlock",
NTType: 84,
Index: 284,
Index: 285,
NumSymbols: 5,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeBinary(X[0], X[2], X[4], dsl.NodeTypeIfItem)
@ -3773,7 +3791,7 @@ var productionsTable = ProdTab{
String: `ElseBlock : else StatementBlockInBraces << dsl.NewASTNodeUnary(X[0], X[1], dsl.NodeTypeIfItem) >>`,
Id: "ElseBlock",
NTType: 85,
Index: 285,
Index: 286,
NumSymbols: 2,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(X[0], X[1], dsl.NodeTypeIfItem)
@ -3783,7 +3801,7 @@ var productionsTable = ProdTab{
String: `WhileLoop : while "(" Rvalue ")" StatementBlockInBraces << dsl.NewASTNodeBinary(X[0], X[2], X[4], dsl.NodeTypeWhileLoop) >>`,
Id: "WhileLoop",
NTType: 86,
Index: 286,
Index: 287,
NumSymbols: 5,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeBinary(X[0], X[2], X[4], dsl.NodeTypeWhileLoop)
@ -3793,7 +3811,7 @@ var productionsTable = ProdTab{
String: `DoWhileLoop : do StatementBlockInBraces while "(" Rvalue ")" << dsl.NewASTNodeBinary(X[0], X[1], X[4], dsl.NodeTypeDoWhileLoop) >>`,
Id: "DoWhileLoop",
NTType: 87,
Index: 287,
Index: 288,
NumSymbols: 6,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeBinary(X[0], X[1], X[4], dsl.NodeTypeDoWhileLoop)
@ -3803,7 +3821,7 @@ var productionsTable = ProdTab{
String: `ForLoop : ForLoopOneVariable << >>`,
Id: "ForLoop",
NTType: 88,
Index: 288,
Index: 289,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3813,7 +3831,7 @@ var productionsTable = ProdTab{
String: `ForLoop : ForLoopTwoVariable << >>`,
Id: "ForLoop",
NTType: 88,
Index: 289,
Index: 290,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3823,7 +3841,7 @@ var productionsTable = ProdTab{
String: `ForLoop : ForLoopMultivariable << >>`,
Id: "ForLoop",
NTType: 88,
Index: 290,
Index: 291,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3833,7 +3851,7 @@ var productionsTable = ProdTab{
String: `ForLoop : TripleForLoop << >>`,
Id: "ForLoop",
NTType: 88,
Index: 291,
Index: 292,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -3849,7 +3867,7 @@ var productionsTable = ProdTab{
); >>`,
Id: "ForLoopOneVariable",
NTType: 89,
Index: 292,
Index: 293,
NumSymbols: 7,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeTernary(
@ -3872,7 +3890,7 @@ var productionsTable = ProdTab{
); >>`,
Id: "ForLoopTwoVariable",
NTType: 90,
Index: 293,
Index: 294,
NumSymbols: 9,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeQuaternary(
@ -3896,7 +3914,7 @@ var productionsTable = ProdTab{
); >>`,
Id: "ForLoopMultivariable",
NTType: 91,
Index: 294,
Index: 295,
NumSymbols: 11,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeQuaternary(
@ -3918,7 +3936,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "MultiIndex",
NTType: 92,
Index: 295,
Index: 296,
NumSymbols: 3,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeBinary(
@ -3936,7 +3954,7 @@ var productionsTable = ProdTab{
) >>`,
Id: "MultiIndex",
NTType: 92,
Index: 296,
Index: 297,
NumSymbols: 3,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.AppendChild(
@ -3956,7 +3974,7 @@ var productionsTable = ProdTab{
); >>`,
Id: "TripleForLoop",
NTType: 93,
Index: 297,
Index: 298,
NumSymbols: 9,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeQuaternary(
@ -3973,7 +3991,7 @@ var productionsTable = ProdTab{
String: `TripleForStart : empty << dsl.NewASTNodeZary(nil, dsl.NodeTypeStatementBlock) >>`,
Id: "TripleForStart",
NTType: 94,
Index: 298,
Index: 299,
NumSymbols: 0,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeZary(nil, dsl.NodeTypeStatementBlock)
@ -3983,7 +4001,7 @@ var productionsTable = ProdTab{
String: `TripleForStart : Assignment << dsl.NewASTNodeUnary(nil, X[0], dsl.NodeTypeStatementBlock) >>`,
Id: "TripleForStart",
NTType: 94,
Index: 299,
Index: 300,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(nil, X[0], dsl.NodeTypeStatementBlock)
@ -3993,7 +4011,7 @@ var productionsTable = ProdTab{
String: `TripleForStart : TripleForStart "," Assignment << dsl.AppendChild(X[0], X[2]) >>`,
Id: "TripleForStart",
NTType: 94,
Index: 300,
Index: 301,
NumSymbols: 3,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.AppendChild(X[0], X[2])
@ -4003,7 +4021,7 @@ var productionsTable = ProdTab{
String: `TripleForContinuation : empty << dsl.NewASTNodeZary(nil, dsl.NodeTypeStatementBlock) >>`,
Id: "TripleForContinuation",
NTType: 95,
Index: 301,
Index: 302,
NumSymbols: 0,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeZary(nil, dsl.NodeTypeStatementBlock)
@ -4013,7 +4031,7 @@ var productionsTable = ProdTab{
String: `TripleForContinuation : TripleForContinuationItem << dsl.NewASTNodeUnary(nil, X[0], dsl.NodeTypeStatementBlock) >>`,
Id: "TripleForContinuation",
NTType: 95,
Index: 302,
Index: 303,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(nil, X[0], dsl.NodeTypeStatementBlock)
@ -4023,7 +4041,7 @@ var productionsTable = ProdTab{
String: `TripleForContinuation : TripleForContinuation "," TripleForContinuationItem << dsl.AppendChild(X[0], X[2]) >>`,
Id: "TripleForContinuation",
NTType: 95,
Index: 303,
Index: 304,
NumSymbols: 3,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.AppendChild(X[0], X[2])
@ -4033,7 +4051,7 @@ var productionsTable = ProdTab{
String: `TripleForContinuationItem : Assignment << >>`,
Id: "TripleForContinuationItem",
NTType: 96,
Index: 304,
Index: 305,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -4043,7 +4061,7 @@ var productionsTable = ProdTab{
String: `TripleForContinuationItem : BareBoolean << >>`,
Id: "TripleForContinuationItem",
NTType: 96,
Index: 305,
Index: 306,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return X[0], nil
@ -4053,7 +4071,7 @@ var productionsTable = ProdTab{
String: `TripleForUpdate : empty << dsl.NewASTNodeZary(nil, dsl.NodeTypeStatementBlock) >>`,
Id: "TripleForUpdate",
NTType: 97,
Index: 306,
Index: 307,
NumSymbols: 0,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeZary(nil, dsl.NodeTypeStatementBlock)
@ -4063,7 +4081,7 @@ var productionsTable = ProdTab{
String: `TripleForUpdate : Assignment << dsl.NewASTNodeUnary(nil, X[0], dsl.NodeTypeStatementBlock) >>`,
Id: "TripleForUpdate",
NTType: 97,
Index: 307,
Index: 308,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(nil, X[0], dsl.NodeTypeStatementBlock)
@ -4073,7 +4091,7 @@ var productionsTable = ProdTab{
String: `TripleForUpdate : TripleForUpdate "," Assignment << dsl.AppendChild(X[0], X[2]) >>`,
Id: "TripleForUpdate",
NTType: 97,
Index: 308,
Index: 309,
NumSymbols: 3,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.AppendChild(X[0], X[2])
@ -4083,7 +4101,7 @@ var productionsTable = ProdTab{
String: `BreakStatement : break << dsl.NewASTNodeZary(X[0], dsl.NodeTypeBreak) >>`,
Id: "BreakStatement",
NTType: 98,
Index: 309,
Index: 310,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeZary(X[0], dsl.NodeTypeBreak)
@ -4093,7 +4111,7 @@ var productionsTable = ProdTab{
String: `ContinueStatement : continue << dsl.NewASTNodeZary(X[0], dsl.NodeTypeContinue) >>`,
Id: "ContinueStatement",
NTType: 99,
Index: 310,
Index: 311,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeZary(X[0], dsl.NodeTypeContinue)
@ -4108,7 +4126,7 @@ var productionsTable = ProdTab{
); >>`,
Id: "FunctionDefinition",
NTType: 100,
Index: 311,
Index: 312,
NumSymbols: 6,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeBinary(
@ -4129,7 +4147,7 @@ var productionsTable = ProdTab{
); >>`,
Id: "FunctionDefinition",
NTType: 100,
Index: 312,
Index: 313,
NumSymbols: 8,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeTernary(
@ -4150,7 +4168,7 @@ var productionsTable = ProdTab{
); >>`,
Id: "SubroutineDefinition",
NTType: 101,
Index: 313,
Index: 314,
NumSymbols: 6,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeBinary(
@ -4165,7 +4183,7 @@ var productionsTable = ProdTab{
String: `FuncOrSubrParameterList : empty << dsl.NewASTNodeZary(nil, dsl.NodeTypeParameterList) >>`,
Id: "FuncOrSubrParameterList",
NTType: 102,
Index: 314,
Index: 315,
NumSymbols: 0,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeZary(nil, dsl.NodeTypeParameterList)
@ -4175,7 +4193,7 @@ var productionsTable = ProdTab{
String: `FuncOrSubrParameterList : FuncOrSubrNonEmptyParameterList << dsl.Wrap(X[0]) >>`,
Id: "FuncOrSubrParameterList",
NTType: 102,
Index: 315,
Index: 316,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.Wrap(X[0])
@ -4185,7 +4203,7 @@ var productionsTable = ProdTab{
String: `FuncOrSubrNonEmptyParameterList : FuncOrSubrParameter << dsl.NewASTNodeUnary(nil, X[0], dsl.NodeTypeParameterList) >>`,
Id: "FuncOrSubrNonEmptyParameterList",
NTType: 103,
Index: 316,
Index: 317,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(nil, X[0], dsl.NodeTypeParameterList)
@ -4195,7 +4213,7 @@ var productionsTable = ProdTab{
String: `FuncOrSubrNonEmptyParameterList : FuncOrSubrParameter "," << dsl.NewASTNodeUnary(nil, X[0], dsl.NodeTypeParameterList) >>`,
Id: "FuncOrSubrNonEmptyParameterList",
NTType: 103,
Index: 317,
Index: 318,
NumSymbols: 2,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(nil, X[0], dsl.NodeTypeParameterList)
@ -4205,7 +4223,7 @@ var productionsTable = ProdTab{
String: `FuncOrSubrNonEmptyParameterList : FuncOrSubrParameter "," FuncOrSubrNonEmptyParameterList << dsl.PrependChild(X[2], X[0]) >>`,
Id: "FuncOrSubrNonEmptyParameterList",
NTType: 103,
Index: 318,
Index: 319,
NumSymbols: 3,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.PrependChild(X[2], X[0])
@ -4216,24 +4234,6 @@ var productionsTable = ProdTab{
nil,
X[0],
dsl.NodeTypeParameter,
) >>`,
Id: "FuncOrSubrParameter",
NTType: 104,
Index: 319,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(
nil,
X[0],
dsl.NodeTypeParameter,
)
},
},
ProdTabEntry{
String: `FuncOrSubrParameter : TypedFuncOrSubrParameterName << dsl.NewASTNodeUnary(
nil,
X[0],
dsl.NodeTypeParameter,
) >>`,
Id: "FuncOrSubrParameter",
NTType: 104,
@ -4247,11 +4247,29 @@ var productionsTable = ProdTab{
)
},
},
ProdTabEntry{
String: `FuncOrSubrParameter : TypedFuncOrSubrParameterName << dsl.NewASTNodeUnary(
nil,
X[0],
dsl.NodeTypeParameter,
) >>`,
Id: "FuncOrSubrParameter",
NTType: 104,
Index: 321,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(
nil,
X[0],
dsl.NodeTypeParameter,
)
},
},
ProdTabEntry{
String: `UntypedFuncOrSubrParameterName : non_sigil_name << dsl.NewASTNode(X[0], dsl.NodeTypeParameterName) >>`,
Id: "UntypedFuncOrSubrParameterName",
NTType: 105,
Index: 321,
Index: 322,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNode(X[0], dsl.NodeTypeParameterName)
@ -4261,7 +4279,7 @@ var productionsTable = ProdTab{
String: `TypedFuncOrSubrParameterName : Typedecl UntypedFuncOrSubrParameterName << dsl.AppendChild(X[1], X[0]) >>`,
Id: "TypedFuncOrSubrParameterName",
NTType: 106,
Index: 322,
Index: 323,
NumSymbols: 2,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.AppendChild(X[1], X[0])
@ -4271,7 +4289,7 @@ var productionsTable = ProdTab{
String: `ReturnStatement : return Rvalue << dsl.NewASTNodeUnary(X[0], X[1], dsl.NodeTypeReturn) >>`,
Id: "ReturnStatement",
NTType: 107,
Index: 323,
Index: 324,
NumSymbols: 2,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(X[0], X[1], dsl.NodeTypeReturn)
@ -4281,7 +4299,7 @@ var productionsTable = ProdTab{
String: `ReturnStatement : return << dsl.NewASTNodeZary(X[0], dsl.NodeTypeReturn) >>`,
Id: "ReturnStatement",
NTType: 107,
Index: 324,
Index: 325,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeZary(X[0], dsl.NodeTypeReturn)