name-neatens

This commit is contained in:
John Kerl 2020-09-08 16:04:33 -04:00
parent 473d761f1d
commit efe38b65c9
11 changed files with 4354 additions and 4364 deletions

View file

@ -25,10 +25,10 @@ const (
NodeTypeArraySliceEmptyLowerIndex = "ArraySliceEmptyLowerIndex"
NodeTypeArraySliceEmptyUpperIndex = "ArraySliceEmptyUpperIndex"
NodeTypeDirectFieldName = "DirectFieldName"
NodeTypeIndirectFieldName = "IndirectFieldName"
NodeTypeFullSrec = "FullSrec"
NodeTypeIndexedLvalue = "IndexedLvalue"
NodeTypeDirectFieldValue = "DirectFieldValue"
NodeTypeIndirectFieldValue = "IndirectFieldValue"
NodeTypeFullSrec = "FullSrec"
NodeTypeIndexedLvalue = "IndexedLvalue"
NodeTypeStatementBlock = "StatementBlock"
NodeTypeAssignment = "Assignment"

View file

@ -37,8 +37,8 @@ func BuildEvaluableNode(astNode *dsl.ASTNode) (IEvaluable, error) {
case dsl.NodeTypeArraySliceAccess:
return BuildArraySliceAccessNode(astNode)
case dsl.NodeTypeIndirectFieldName:
return BuildIndirectFieldNameNode(astNode)
case dsl.NodeTypeIndirectFieldValue:
return BuildIndirectFieldValueNode(astNode)
}
// xxx if/while/etc
@ -51,23 +51,23 @@ func BuildEvaluableNode(astNode *dsl.ASTNode) (IEvaluable, error) {
}
// ----------------------------------------------------------------
type IndirectFieldNameNode struct {
type IndirectFieldValueNode struct {
fieldNameEvaluable IEvaluable
}
func BuildIndirectFieldNameNode(astNode *dsl.ASTNode) (*IndirectFieldNameNode, error) {
lib.InternalCodingErrorIf(astNode.Type != dsl.NodeTypeIndirectFieldName)
func BuildIndirectFieldValueNode(astNode *dsl.ASTNode) (*IndirectFieldValueNode, error) {
lib.InternalCodingErrorIf(astNode.Type != dsl.NodeTypeIndirectFieldValue)
lib.InternalCodingErrorIf(astNode.Children == nil)
lib.InternalCodingErrorIf(len(astNode.Children) != 1)
fieldNameEvaluable, err := BuildEvaluableNode(astNode.Children[0])
if err != nil {
return nil, err
}
return &IndirectFieldNameNode{
return &IndirectFieldValueNode{
fieldNameEvaluable: fieldNameEvaluable,
}, nil
}
func (this *IndirectFieldNameNode) Evaluate(state *State) lib.Mlrval { // xxx err
func (this *IndirectFieldValueNode) Evaluate(state *State) lib.Mlrval { // xxx err
fieldName := this.fieldNameEvaluable.Evaluate(state)
// xxx handle int-index too. needs a centralized place for that.
if fieldName.IsAbsent() {

View file

@ -20,8 +20,8 @@ func BuildLeafNode(
switch astNode.Type {
case dsl.NodeTypeDirectFieldName:
return BuildSrecDirectFieldRvalueNode(sval), nil
case dsl.NodeTypeDirectFieldValue:
return BuildDirectFieldRvalueNode(sval), nil
break
case dsl.NodeTypeFullSrec:
return BuildFullSrecRvalueNode(sval), nil
@ -54,16 +54,16 @@ func BuildLeafNode(
}
// ----------------------------------------------------------------
type SrecDirectFieldRvalueNode struct {
type DirectFieldRvalueNode struct {
fieldName string
}
func BuildSrecDirectFieldRvalueNode(fieldName string) *SrecDirectFieldRvalueNode {
return &SrecDirectFieldRvalueNode{
func BuildDirectFieldRvalueNode(fieldName string) *DirectFieldRvalueNode {
return &DirectFieldRvalueNode{
fieldName: fieldName,
}
}
func (this *SrecDirectFieldRvalueNode) Evaluate(state *State) lib.Mlrval {
func (this *DirectFieldRvalueNode) Evaluate(state *State) lib.Mlrval {
value := state.Inrec.Get(&this.fieldName)
if value == nil {
return lib.MlrvalFromAbsent()

View file

@ -16,11 +16,11 @@ func BuildAssignableNode(
) (IAssignable, error) {
switch astNode.Type {
case dsl.NodeTypeDirectFieldName:
return BuildDirectFieldNameLvalueNode(astNode)
case dsl.NodeTypeDirectFieldValue:
return BuildDirectFieldValueLvalueNode(astNode)
break
case dsl.NodeTypeIndirectFieldName:
return BuildIndirectFieldNameLvalueNode(astNode)
case dsl.NodeTypeIndirectFieldValue:
return BuildIndirectFieldValueLvalueNode(astNode)
break
case dsl.NodeTypeFullSrec:
return BuildFullSrecLvalueNode(astNode)
@ -36,31 +36,31 @@ func BuildAssignableNode(
}
// ----------------------------------------------------------------
type DirectFieldNameLvalueNode struct {
type DirectFieldValueLvalueNode struct {
lhsFieldName string
}
func BuildDirectFieldNameLvalueNode(astNode *dsl.ASTNode) (IAssignable, error) {
lib.InternalCodingErrorIf(astNode.Type != dsl.NodeTypeDirectFieldName)
func BuildDirectFieldValueLvalueNode(astNode *dsl.ASTNode) (IAssignable, error) {
lib.InternalCodingErrorIf(astNode.Type != dsl.NodeTypeDirectFieldValue)
lhsFieldName := string(astNode.Token.Lit)
return NewDirectFieldNameLvalueNode(lhsFieldName), nil
return NewDirectFieldValueLvalueNode(lhsFieldName), nil
}
func NewDirectFieldNameLvalueNode(lhsFieldName string) *DirectFieldNameLvalueNode {
return &DirectFieldNameLvalueNode{
func NewDirectFieldValueLvalueNode(lhsFieldName string) *DirectFieldValueLvalueNode {
return &DirectFieldValueLvalueNode{
lhsFieldName: lhsFieldName,
}
}
func (this *DirectFieldNameLvalueNode) Assign(
func (this *DirectFieldValueLvalueNode) Assign(
rvalue *lib.Mlrval,
state *State,
) error {
return this.AssignIndexed(rvalue, nil, state)
}
func (this *DirectFieldNameLvalueNode) AssignIndexed(
func (this *DirectFieldValueLvalueNode) AssignIndexed(
rvalue *lib.Mlrval,
indices []*lib.Mlrval,
state *State,
@ -76,12 +76,12 @@ func (this *DirectFieldNameLvalueNode) AssignIndexed(
}
// ----------------------------------------------------------------
type IndirectFieldNameLvalueNode struct {
type IndirectFieldValueLvalueNode struct {
lhsFieldNameExpression IEvaluable
}
func BuildIndirectFieldNameLvalueNode(astNode *dsl.ASTNode) (IAssignable, error) {
lib.InternalCodingErrorIf(astNode.Type != dsl.NodeTypeIndirectFieldName)
func BuildIndirectFieldValueLvalueNode(astNode *dsl.ASTNode) (IAssignable, error) {
lib.InternalCodingErrorIf(astNode.Type != dsl.NodeTypeIndirectFieldValue)
lib.InternalCodingErrorIf(astNode == nil)
lib.InternalCodingErrorIf(len(astNode.Children) != 1)
@ -90,25 +90,25 @@ func BuildIndirectFieldNameLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
return nil, err
}
return NewIndirectFieldNameLvalueNode(lhsFieldNameExpression), nil
return NewIndirectFieldValueLvalueNode(lhsFieldNameExpression), nil
}
func NewIndirectFieldNameLvalueNode(
func NewIndirectFieldValueLvalueNode(
lhsFieldNameExpression IEvaluable,
) *IndirectFieldNameLvalueNode {
return &IndirectFieldNameLvalueNode{
) *IndirectFieldValueLvalueNode {
return &IndirectFieldValueLvalueNode{
lhsFieldNameExpression: lhsFieldNameExpression,
}
}
func (this *IndirectFieldNameLvalueNode) Assign(
func (this *IndirectFieldValueLvalueNode) Assign(
rvalue *lib.Mlrval,
state *State,
) error {
return this.AssignIndexed(rvalue, nil, state)
}
func (this *IndirectFieldNameLvalueNode) AssignIndexed(
func (this *IndirectFieldValueLvalueNode) AssignIndexed(
rvalue *lib.Mlrval,
indices []*lib.Mlrval,
state *State,
@ -207,7 +207,7 @@ func BuildIndexedLvalueNode(astNode *dsl.ASTNode) (IAssignable, error) {
// * Assignment "="
// * IndexedLvalue "[]"
// * IndexedLvalue "[]"
// * DirectFieldName "x"
// * DirectFieldValue "x"
// * IntLiteral "1"
// * IntLiteral "2"
// * IntLiteral "3"

View file

@ -21,23 +21,6 @@ import (
// * statement block (if-body, for-body, etc)
// ----------------------------------------------------------------
// ----------------------------------------------------------------
// AST nodes (TNodeType) at the moment:
//
// NodeTypeStringLiteral
// NodeTypeIntLiteral
// NodeTypeFloatLiteral
// NodeTypeBoolLiteral
//
// NodeTypeDirectFieldName
// NodeTypeIndirectFieldName
//
// NodeTypeStatementBlock
// NodeTypeAssignment
// NodeTypeOperator
// NodeTypeContextVariable
// ----------------------------------------------------------------
// ----------------------------------------------------------------
// When we do mlr put '...DSL expression here...', this state is what is needed
// to execute the expression. That includes the current record, AWK-like variables

View file

@ -312,9 +312,9 @@ Lvalue
;
BaseLvalue
: FieldName
// computed field name $[...]
// braced field name ${...}
: FieldValue
// computed field value $[...]
// braced field value ${...}
// positional field name $[[3]]
// positional field value $[[[3]]]
| FullSrec
@ -336,11 +336,12 @@ IndexedLvalue
;
// ----------------------------------------------------------------
FieldName
: DirectFieldName
| IndirectFieldName
//| BracedFieldName
FieldValue
: DirectFieldValue
| IndirectFieldValue
// | BracedFieldValue
//| PositionalFieldName
//| PositionalFieldValue
// ...
;
@ -348,22 +349,28 @@ FieldName
// includes the '$'. If we omit the '$' there and include it in the parser
// section here as "$", then we get an LR-1 conflict. So this must be dealt
// with at the AST level. Hence the NewASTNodeStripDollarPlease.
DirectFieldName
DirectFieldValue
: md_token_field_name
<< dsl.NewASTNodeStripDollarPlease($0, dsl.NodeTypeDirectFieldName) >>
<< dsl.NewASTNodeStripDollarPlease($0, dsl.NodeTypeDirectFieldValue) >>
;
IndirectFieldName
IndirectFieldValue
: "$[" Rvalue "]"
<< dsl.NewASTNodeUnary($0, $1, dsl.NodeTypeIndirectFieldName) >>
<< dsl.NewASTNodeUnary($0, $1, dsl.NodeTypeIndirectFieldValue) >>
;
//BracedFieldName
// : "${" md_token_id "}"
// * Direct is '$name'
// * Indirect is '$["name"]'
// * Braced is '${name}' -- note no double-quotes. This is for when the field
// name has spaces or somesuch in it.
// TODO: needs no "..." -- just ...
//BracedFieldValue
// : "${" md_token_string_literal "}"
// << dsl.NewASTNodeUnary(
// $0,
// dsl.NewASTNodeNestable($1, dsl.NodeTypeFieldName),
// dsl.NodeTypeToken,
// dsl.NewASTNodeNestable($1, dsl.NodeTypeDirectFieldValue),
// $1,
// dsl.NodeTypeDirectFieldValue,
// ) >>
//;
@ -654,7 +661,7 @@ PrecedenceChainEnd : MlrvalOrFunction ;
// ----------------------------------------------------------------
MlrvalOrFunction
: FieldName
: FieldValue
| FullSrec
// oosvar
// computed oosvar @[...]
@ -1826,13 +1833,13 @@ ArraySliceAccess
// A = mlr_dsl_ast_node_alloc_zary("temp", MD_AST_NODE_TYPE_UNSET);
//}
//UnsetArgs(A) ::= DirectFieldName(B). {
//UnsetArgs(A) ::= DirectFieldValue(B). {
// A = mlr_dsl_ast_node_alloc_unary("temp", MD_AST_NODE_TYPE_UNSET, B);
//}
//UnsetArgs(A) ::= IndirectFieldName(B). {
//UnsetArgs(A) ::= IndirectFieldValue(B). {
// A = mlr_dsl_ast_node_alloc_unary("temp", MD_AST_NODE_TYPE_UNSET, B);
//}
//UnsetArgs(A) ::= PositionalSrecName(B). {
//UnsetArgs(A) ::= PositionalSrecValue(B). {
// A = mlr_dsl_ast_node_alloc_unary("temp", MD_AST_NODE_TYPE_UNSET, B);
//}
//UnsetArgs(A) ::= md_token_full_srec(B). {
@ -1848,7 +1855,7 @@ ArraySliceAccess
// A = mlr_dsl_ast_node_alloc_unary("temp", MD_AST_NODE_TYPE_UNSET, B);
//}
//UnsetArgs(A) ::= UnsetArgs(B) "," DirectFieldName(C). {
//UnsetArgs(A) ::= UnsetArgs(B) "," DirectFieldValue(C). {
// A = mlr_dsl_ast_node_append_arg(B, C);
//}
//UnsetArgs(A) ::= UnsetArgs(B) "," OosvarKeylist(C). {

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -121,7 +121,7 @@ var productionsTable = ProdTab{
},
},
ProdTabEntry{
String: `BaseLvalue : FieldName << >>`,
String: `BaseLvalue : FieldValue << >>`,
Id: "BaseLvalue",
NTType: 6,
Index: 10,
@ -161,8 +161,8 @@ var productionsTable = ProdTab{
},
},
ProdTabEntry{
String: `FieldName : DirectFieldName << >>`,
Id: "FieldName",
String: `FieldValue : DirectFieldValue << >>`,
Id: "FieldValue",
NTType: 8,
Index: 13,
NumSymbols: 1,
@ -171,8 +171,8 @@ var productionsTable = ProdTab{
},
},
ProdTabEntry{
String: `FieldName : IndirectFieldName << >>`,
Id: "FieldName",
String: `FieldValue : IndirectFieldValue << >>`,
Id: "FieldValue",
NTType: 8,
Index: 14,
NumSymbols: 1,
@ -181,23 +181,23 @@ var productionsTable = ProdTab{
},
},
ProdTabEntry{
String: `DirectFieldName : md_token_field_name << dsl.NewASTNodeStripDollarPlease(X[0], dsl.NodeTypeDirectFieldName) >>`,
Id: "DirectFieldName",
String: `DirectFieldValue : md_token_field_name << dsl.NewASTNodeStripDollarPlease(X[0], dsl.NodeTypeDirectFieldValue) >>`,
Id: "DirectFieldValue",
NTType: 9,
Index: 15,
NumSymbols: 1,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeStripDollarPlease(X[0], dsl.NodeTypeDirectFieldName)
return dsl.NewASTNodeStripDollarPlease(X[0], dsl.NodeTypeDirectFieldValue)
},
},
ProdTabEntry{
String: `IndirectFieldName : "$[" Rvalue "]" << dsl.NewASTNodeUnary(X[0], X[1], dsl.NodeTypeIndirectFieldName) >>`,
Id: "IndirectFieldName",
String: `IndirectFieldValue : "$[" Rvalue "]" << dsl.NewASTNodeUnary(X[0], X[1], dsl.NodeTypeIndirectFieldValue) >>`,
Id: "IndirectFieldValue",
NTType: 10,
Index: 16,
NumSymbols: 3,
ReduceFunc: func(X []Attrib) (Attrib, error) {
return dsl.NewASTNodeUnary(X[0], X[1], dsl.NodeTypeIndirectFieldName)
return dsl.NewASTNodeUnary(X[0], X[1], dsl.NodeTypeIndirectFieldValue)
},
},
ProdTabEntry{
@ -1071,7 +1071,7 @@ var productionsTable = ProdTab{
},
},
ProdTabEntry{
String: `MlrvalOrFunction : FieldName << >>`,
String: `MlrvalOrFunction : FieldValue << >>`,
Id: "MlrvalOrFunction",
NTType: 29,
Index: 88,

View file

@ -790,9 +790,9 @@ $i += 2
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "i"
* DirectFieldValue "i"
* Operator "+"
* DirectFieldName "i"
* DirectFieldValue "i"
* IntLiteral "2"
a b i x y
@ -809,9 +809,9 @@ $i *= 2
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "i"
* DirectFieldValue "i"
* Operator "*"
* DirectFieldName "i"
* DirectFieldValue "i"
* IntLiteral "2"
a b i x y
@ -828,9 +828,9 @@ $i /= 2
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "i"
* DirectFieldValue "i"
* Operator "/"
* DirectFieldName "i"
* DirectFieldValue "i"
* IntLiteral "2"
a b i x y
@ -847,9 +847,9 @@ $i |= 2
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "i"
* DirectFieldValue "i"
* Operator "|"
* DirectFieldName "i"
* DirectFieldValue "i"
* IntLiteral "2"
a b i x y
@ -866,14 +866,14 @@ $j = true; $j &&= $i < 2
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "j"
* DirectFieldValue "j"
* BoolLiteral "true"
* Assignment "="
* DirectFieldName "j"
* DirectFieldValue "j"
* Operator "&&"
* DirectFieldName "j"
* DirectFieldValue "j"
* Operator "<"
* DirectFieldName "i"
* DirectFieldValue "i"
* IntLiteral "2"
a b i x y j
@ -1426,8 +1426,8 @@ $new = $["a"]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "new"
* IndirectFieldName "$["
* DirectFieldValue "new"
* IndirectFieldValue "$["
* StringLiteral "a"
a b i x y new
@ -1444,9 +1444,9 @@ $["new"] = $a
RAW AST:
* StatementBlock
* Assignment "="
* IndirectFieldName "$["
* IndirectFieldValue "$["
* StringLiteral "new"
* DirectFieldName "a"
* DirectFieldValue "a"
a b i x y new
pan pan 1 0.3467901443380824 0.7268028627434533 pan

View file

@ -7,7 +7,7 @@ $y = 1 || 2
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "y"
* DirectFieldValue "y"
* Operator "||"
* IntLiteral "1"
* IntLiteral "2"
@ -21,7 +21,7 @@ $y = 1 || 2 || 3
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "y"
* DirectFieldValue "y"
* Operator "||"
* Operator "||"
* IntLiteral "1"
@ -37,7 +37,7 @@ $y = 1 || 2 && 3
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "y"
* DirectFieldValue "y"
* Operator "||"
* IntLiteral "1"
* Operator "&&"
@ -53,7 +53,7 @@ $y = 1 && 2 || 3
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "y"
* DirectFieldValue "y"
* Operator "||"
* Operator "&&"
* IntLiteral "1"
@ -69,7 +69,7 @@ $y = 1 ? 2 : 3
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "y"
* DirectFieldValue "y"
* Operator "?:"
* IntLiteral "1"
* IntLiteral "2"
@ -84,12 +84,12 @@ $y = $a + $b * $c
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "y"
* DirectFieldValue "y"
* Operator "+"
* DirectFieldName "a"
* DirectFieldValue "a"
* Operator "*"
* DirectFieldName "b"
* DirectFieldName "c"
* DirectFieldValue "b"
* DirectFieldValue "c"
@ -100,12 +100,12 @@ $y = $a * $b * $c
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "y"
* DirectFieldValue "y"
* Operator "*"
* Operator "*"
* DirectFieldName "a"
* DirectFieldName "b"
* DirectFieldName "c"
* DirectFieldValue "a"
* DirectFieldValue "b"
* DirectFieldValue "c"
@ -116,12 +116,12 @@ $y = $a ** $b ** $c
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "y"
* DirectFieldValue "y"
* Operator "**"
* DirectFieldName "a"
* DirectFieldValue "a"
* Operator "**"
* DirectFieldName "b"
* DirectFieldName "c"
* DirectFieldValue "b"
* DirectFieldValue "c"
@ -132,7 +132,7 @@ $[2] = 3
RAW AST:
* StatementBlock
* Assignment "="
* IndirectFieldName "$["
* IndirectFieldValue "$["
* IntLiteral "2"
* IntLiteral "3"
@ -145,8 +145,8 @@ $[$y] = 4
RAW AST:
* StatementBlock
* Assignment "="
* IndirectFieldName "$["
* DirectFieldName "y"
* IndirectFieldValue "$["
* DirectFieldValue "y"
* IntLiteral "4"
@ -158,7 +158,7 @@ $x = "abc"
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "x"
* DirectFieldValue "x"
* StringLiteral "abc"
@ -170,7 +170,7 @@ $["abc"] = "def"
RAW AST:
* StatementBlock
* Assignment "="
* IndirectFieldName "$["
* IndirectFieldValue "$["
* StringLiteral "abc"
* StringLiteral "def"
@ -183,7 +183,7 @@ $[FILENAME] = FNR
RAW AST:
* StatementBlock
* Assignment "="
* IndirectFieldName "$["
* IndirectFieldValue "$["
* ContextVariable "FILENAME"
* ContextVariable "FNR"
@ -196,12 +196,12 @@ $x = $a + $b + $c
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "x"
* DirectFieldValue "x"
* Operator "+"
* Operator "+"
* DirectFieldName "a"
* DirectFieldName "b"
* DirectFieldName "c"
* DirectFieldValue "a"
* DirectFieldValue "b"
* DirectFieldValue "c"
@ -212,26 +212,26 @@ $x = ($a + $b) + $c; $y = $a + ($b + $c); $z = $a + ($b)+ $c
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "x"
* DirectFieldValue "x"
* Operator "+"
* Operator "+"
* DirectFieldName "a"
* DirectFieldName "b"
* DirectFieldName "c"
* DirectFieldValue "a"
* DirectFieldValue "b"
* DirectFieldValue "c"
* Assignment "="
* DirectFieldName "y"
* DirectFieldValue "y"
* Operator "+"
* DirectFieldName "a"
* DirectFieldValue "a"
* Operator "+"
* DirectFieldName "b"
* DirectFieldName "c"
* DirectFieldValue "b"
* DirectFieldValue "c"
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* Operator "+"
* Operator "+"
* DirectFieldName "a"
* DirectFieldName "b"
* DirectFieldName "c"
* DirectFieldValue "a"
* DirectFieldValue "b"
* DirectFieldValue "c"
@ -242,14 +242,14 @@ $x = 2 * $a + $b . $c
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "x"
* DirectFieldValue "x"
* Operator "."
* Operator "+"
* Operator "*"
* IntLiteral "2"
* DirectFieldName "a"
* DirectFieldName "b"
* DirectFieldName "c"
* DirectFieldValue "a"
* DirectFieldValue "b"
* DirectFieldValue "c"
@ -260,14 +260,14 @@ $x = 2 * $a + ($b . $c)
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "x"
* DirectFieldValue "x"
* Operator "+"
* Operator "*"
* IntLiteral "2"
* DirectFieldName "a"
* DirectFieldValue "a"
* Operator "."
* DirectFieldName "b"
* DirectFieldName "c"
* DirectFieldValue "b"
* DirectFieldValue "c"
@ -278,18 +278,18 @@ $x = (NF + NR) * 7; $y = OFS . $y . "hello"
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "x"
* DirectFieldValue "x"
* Operator "*"
* Operator "+"
* ContextVariable "NF"
* ContextVariable "NR"
* IntLiteral "7"
* Assignment "="
* DirectFieldName "y"
* DirectFieldValue "y"
* Operator "."
* Operator "."
* ContextVariable "OFS"
* DirectFieldName "y"
* DirectFieldValue "y"
* StringLiteral "hello"
@ -301,7 +301,7 @@ $x = 123. + 1e-2 / .2e3 + 1.e-3
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "x"
* DirectFieldValue "x"
* Operator "+"
* Operator "+"
* FloatLiteral "123."
@ -319,7 +319,7 @@ $z=0x7fffffffffffffff + 0x7fffffffffffffff
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* Operator "+"
* IntLiteral "0x7fffffffffffffff"
* IntLiteral "0x7fffffffffffffff"
@ -333,7 +333,7 @@ $z=0x7fffffffffffffff .+ 0x7fffffffffffffff
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* Operator ".+"
* IntLiteral "0x7fffffffffffffff"
* IntLiteral "0x7fffffffffffffff"
@ -347,7 +347,7 @@ $z=0x7fffffffffffffff * 0x7fffffffffffffff
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* Operator "*"
* IntLiteral "0x7fffffffffffffff"
* IntLiteral "0x7fffffffffffffff"
@ -361,7 +361,7 @@ $z=0x7fffffffffffffff .* 0x7fffffffffffffff
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* Operator ".*"
* IntLiteral "0x7fffffffffffffff"
* IntLiteral "0x7fffffffffffffff"
@ -375,7 +375,7 @@ $z = []
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArrayLiteral "[]"
@ -387,7 +387,7 @@ $z = [1,]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArrayLiteral "[]"
* IntLiteral "1"
@ -400,7 +400,7 @@ $z = [1,2]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArrayLiteral "[]"
* IntLiteral "1"
* IntLiteral "2"
@ -414,7 +414,7 @@ $z = [1,2,]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArrayLiteral "[]"
* IntLiteral "1"
* IntLiteral "2"
@ -428,7 +428,7 @@ $z = [1,2,3]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArrayLiteral "[]"
* IntLiteral "1"
* IntLiteral "2"
@ -443,7 +443,7 @@ $z = [1,2,3,]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArrayLiteral "[]"
* IntLiteral "1"
* IntLiteral "2"
@ -458,7 +458,7 @@ $z = {}
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* MapLiteral "{}"
@ -470,7 +470,7 @@ $z = {"a":"1"}
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* MapLiteral "{}"
* MapLiteralKeyValuePair ":"
* StringLiteral "a"
@ -485,7 +485,7 @@ $z = {"a":"1",}
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* MapLiteral "{}"
* MapLiteralKeyValuePair ":"
* StringLiteral "a"
@ -500,7 +500,7 @@ $z = {"a":"1", "b":2}
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* MapLiteral "{}"
* MapLiteralKeyValuePair ":"
* StringLiteral "a"
@ -518,7 +518,7 @@ $z = {"a":"1", "b":2,}
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* MapLiteral "{}"
* MapLiteralKeyValuePair ":"
* StringLiteral "a"
@ -536,7 +536,7 @@ $z = {"a":"1", "b":2, "c":3}
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* MapLiteral "{}"
* MapLiteralKeyValuePair ":"
* StringLiteral "a"
@ -557,7 +557,7 @@ $z = {"a":"1", "b":2, "c":3,}
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* MapLiteral "{}"
* MapLiteralKeyValuePair ":"
* StringLiteral "a"
@ -578,9 +578,9 @@ $z = $a[1]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArrayOrMapIndexAccess "[]"
* DirectFieldName "a"
* DirectFieldValue "a"
* IntLiteral "1"
@ -592,9 +592,9 @@ $z = $a["index"]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArrayOrMapIndexAccess "[]"
* DirectFieldName "a"
* DirectFieldValue "a"
* StringLiteral "index"
@ -606,7 +606,7 @@ $z = "abcde"[1]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArrayOrMapIndexAccess "[]"
* StringLiteral "abcde"
* IntLiteral "1"
@ -620,7 +620,7 @@ $z = "abcde"["index"]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArrayOrMapIndexAccess "[]"
* StringLiteral "abcde"
* StringLiteral "index"
@ -634,9 +634,9 @@ $z = $a[1:2]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArraySliceAccess "[]"
* DirectFieldName "a"
* DirectFieldValue "a"
* IntLiteral "1"
* IntLiteral "2"
@ -649,9 +649,9 @@ $z = $a[:2]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArraySliceAccess "[]"
* DirectFieldName "a"
* DirectFieldValue "a"
* ArraySliceEmptyLowerIndex ":"
* IntLiteral "2"
@ -664,9 +664,9 @@ $z = $a[1:]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArraySliceAccess "[]"
* DirectFieldName "a"
* DirectFieldValue "a"
* IntLiteral "1"
* ArraySliceEmptyUpperIndex ":"
@ -679,9 +679,9 @@ $z = $a[:]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArraySliceAccess "[]"
* DirectFieldName "a"
* DirectFieldValue "a"
* ArraySliceEmptyLowerIndex ":"
* ArraySliceEmptyUpperIndex ":"
@ -694,7 +694,7 @@ $z = [5,6,7,8,9][1]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArrayOrMapIndexAccess "[]"
* ArrayLiteral "[]"
* IntLiteral "5"
@ -713,7 +713,7 @@ $z = {"a":1, "b":2, "c":3}["b"]
RAW AST:
* StatementBlock
* Assignment "="
* DirectFieldName "z"
* DirectFieldValue "z"
* ArrayOrMapIndexAccess "[]"
* MapLiteral "{}"
* MapLiteralKeyValuePair ":"