mirror of
https://github.com/johnkerl/miller.git
synced 2026-08-04 13:33:18 +00:00
braced srecs at LHS and RHS
This commit is contained in:
parent
efe38b65c9
commit
d9d746f614
14 changed files with 67327 additions and 62749 deletions
|
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"miller/lib"
|
||||
"miller/parsing/token"
|
||||
)
|
||||
|
||||
|
|
@ -129,8 +130,10 @@ func NewASTNodeEmpty(nodeType TNodeType) (*ASTNode, error) {
|
|||
|
||||
// Strips the leading '$' from field names. Not done in the parser itself due
|
||||
// to LR-1 conflicts.
|
||||
func NewASTNodeStripDollarPlease(itok interface{}, nodeType TNodeType) (*ASTNode, error) {
|
||||
func NewASTNodeStripDollarSign(itok interface{}, nodeType TNodeType) (*ASTNode, error) {
|
||||
oldToken := itok.(*token.Token)
|
||||
lib.InternalCodingErrorIf(len(oldToken.Lit) < 2)
|
||||
lib.InternalCodingErrorIf(oldToken.Lit[0] != '$')
|
||||
newToken := &token.Token{
|
||||
Type: oldToken.Type,
|
||||
Lit: oldToken.Lit[1:],
|
||||
|
|
@ -139,10 +142,30 @@ func NewASTNodeStripDollarPlease(itok interface{}, nodeType TNodeType) (*ASTNode
|
|||
return NewASTNodeNestable(newToken, nodeType), nil
|
||||
}
|
||||
|
||||
// Strips the leading '${' and trailing '}' from braced field names. Not done
|
||||
// in the parser itself due to LR-1 conflicts.
|
||||
func NewASTNodeStripDollarSignAndCurlyBraces(
|
||||
itok interface{},
|
||||
nodeType TNodeType,
|
||||
) (*ASTNode, error) {
|
||||
oldToken := itok.(*token.Token)
|
||||
n := len(oldToken.Lit)
|
||||
lib.InternalCodingErrorIf(n < 4)
|
||||
lib.InternalCodingErrorIf(oldToken.Lit[0] != '$')
|
||||
lib.InternalCodingErrorIf(oldToken.Lit[1] != '{')
|
||||
lib.InternalCodingErrorIf(oldToken.Lit[n-1] != '}')
|
||||
newToken := &token.Token{
|
||||
Type: oldToken.Type,
|
||||
Lit: oldToken.Lit[2 : n-1],
|
||||
Pos: oldToken.Pos,
|
||||
}
|
||||
return NewASTNodeNestable(newToken, nodeType), nil
|
||||
}
|
||||
|
||||
// Likewise for the leading/trailing double quotes on string literals. Also,
|
||||
// since string literals can have backslash-escaped double-quotes like
|
||||
// "...\"...\"...", we also unbackslash here.
|
||||
func NewASTNodeStripDoubleQuotePairPlease(
|
||||
func NewASTNodeStripDoubleQuotePair(
|
||||
itok interface{},
|
||||
nodeType TNodeType,
|
||||
) (*ASTNode, error) {
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ func (this *Mlrval) PutIndexed(indices []*Mlrval, rvalue *Mlrval) error {
|
|||
nextLevelMlrval := levelMlrmap.Get(&key)
|
||||
if nextLevelMlrval == nil {
|
||||
if i < n-1 {
|
||||
*nextLevelMlrval = MlrvalEmptyMap()
|
||||
levelMlrmap.Put(&key, nextLevelMlrval)
|
||||
newmap := MlrvalEmptyMap()
|
||||
levelMlrmap.Put(&key, &newmap)
|
||||
} else {
|
||||
levelMlrmap.Put(&key, rvalue)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ var ActTab = ActionTable{
|
|||
Ignore: "!whitespace",
|
||||
},
|
||||
ActionRow{ // S2
|
||||
Accept: 55,
|
||||
Accept: 56,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S3
|
||||
|
|
@ -41,55 +41,55 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S5
|
||||
Accept: 51,
|
||||
Accept: 52,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S6
|
||||
Accept: 40,
|
||||
Accept: 41,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S7
|
||||
Accept: 58,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S8
|
||||
Accept: 59,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S8
|
||||
Accept: 60,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S9
|
||||
Accept: 48,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S10
|
||||
Accept: 43,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S11
|
||||
Accept: 65,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S12
|
||||
Accept: 44,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S13
|
||||
Accept: 47,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S14
|
||||
Accept: 49,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S10
|
||||
Accept: 44,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S11
|
||||
Accept: 66,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S12
|
||||
Accept: 45,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S13
|
||||
Accept: 48,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S14
|
||||
Accept: 50,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S15
|
||||
Accept: 61,
|
||||
Accept: 62,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S16
|
||||
Accept: 61,
|
||||
Accept: 62,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S17
|
||||
Accept: 26,
|
||||
Accept: 27,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S18
|
||||
|
|
@ -97,7 +97,7 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S19
|
||||
Accept: 36,
|
||||
Accept: 37,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S20
|
||||
|
|
@ -105,11 +105,11 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S21
|
||||
Accept: 34,
|
||||
Accept: 35,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S22
|
||||
Accept: 25,
|
||||
Accept: 26,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S23
|
||||
|
|
@ -137,7 +137,7 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S29
|
||||
Accept: 39,
|
||||
Accept: 40,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S30
|
||||
|
|
@ -149,23 +149,23 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S32
|
||||
Accept: 66,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S33
|
||||
Accept: 38,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S34
|
||||
Accept: 67,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S33
|
||||
Accept: 39,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S34
|
||||
Accept: 68,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S35
|
||||
Accept: 56,
|
||||
Accept: 57,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S36
|
||||
Accept: 33,
|
||||
Accept: 34,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S37
|
||||
|
|
@ -173,7 +173,7 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S38
|
||||
Accept: 60,
|
||||
Accept: 61,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S39
|
||||
|
|
@ -181,7 +181,7 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S40
|
||||
Accept: 9,
|
||||
Accept: 10,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S41
|
||||
|
|
@ -205,35 +205,35 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S46
|
||||
Accept: 23,
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S47
|
||||
Accept: 29,
|
||||
Accept: 24,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S48
|
||||
Accept: 57,
|
||||
Accept: 30,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S49
|
||||
Accept: 20,
|
||||
Accept: 58,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S50
|
||||
Accept: 17,
|
||||
Accept: 21,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S51
|
||||
Accept: 19,
|
||||
Accept: 18,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S52
|
||||
Accept: 52,
|
||||
Accept: 20,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S53
|
||||
Accept: 45,
|
||||
Accept: 53,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S54
|
||||
|
|
@ -241,31 +241,31 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S55
|
||||
Accept: 53,
|
||||
Accept: 47,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S56
|
||||
Accept: 0,
|
||||
Accept: 54,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S57
|
||||
Accept: 18,
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S58
|
||||
Accept: 50,
|
||||
Accept: 19,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S59
|
||||
Accept: 21,
|
||||
Accept: 51,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S60
|
||||
Accept: 62,
|
||||
Accept: 22,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S61
|
||||
Accept: 0,
|
||||
Accept: 63,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S62
|
||||
|
|
@ -273,31 +273,31 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S63
|
||||
Accept: 41,
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S64
|
||||
Accept: 37,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S65
|
||||
Accept: 32,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S66
|
||||
Accept: 30,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S67
|
||||
Accept: 35,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S68
|
||||
Accept: 42,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S65
|
||||
Accept: 38,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S66
|
||||
Accept: 33,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S67
|
||||
Accept: 31,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S68
|
||||
Accept: 36,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S69
|
||||
Accept: 0,
|
||||
Accept: 43,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S70
|
||||
|
|
@ -317,7 +317,7 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S74
|
||||
Accept: 74,
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S75
|
||||
|
|
@ -325,7 +325,7 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S76
|
||||
Accept: 0,
|
||||
Accept: 76,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S77
|
||||
|
|
@ -337,15 +337,15 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S79
|
||||
Accept: 14,
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S80
|
||||
Accept: 28,
|
||||
Accept: 15,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S81
|
||||
Accept: 0,
|
||||
Accept: 29,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S82
|
||||
|
|
@ -353,47 +353,47 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S83
|
||||
Accept: 13,
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S84
|
||||
Accept: 27,
|
||||
Accept: 14,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S85
|
||||
Accept: 31,
|
||||
Accept: 28,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S86
|
||||
Accept: 60,
|
||||
Accept: 32,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S87
|
||||
Accept: 0,
|
||||
Accept: 61,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S88
|
||||
Accept: 12,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S89
|
||||
Accept: 24,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S90
|
||||
Accept: 54,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S91
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S89
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S90
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S91
|
||||
Accept: 13,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S92
|
||||
Accept: 22,
|
||||
Accept: 25,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S93
|
||||
Accept: 62,
|
||||
Accept: 55,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S94
|
||||
|
|
@ -401,71 +401,71 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S95
|
||||
Accept: 0,
|
||||
Accept: 23,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S96
|
||||
Accept: 62,
|
||||
Accept: 63,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S97
|
||||
Accept: 61,
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S98
|
||||
Accept: 15,
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S99
|
||||
Accept: 16,
|
||||
Accept: 63,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S100
|
||||
Accept: 0,
|
||||
Accept: 62,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S101
|
||||
Accept: 76,
|
||||
Accept: 16,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S102
|
||||
Accept: 69,
|
||||
Accept: 17,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S103
|
||||
Accept: 68,
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S104
|
||||
Accept: 70,
|
||||
Accept: 77,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S105
|
||||
Accept: 72,
|
||||
Accept: 70,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S106
|
||||
Accept: 71,
|
||||
Accept: 69,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S107
|
||||
Accept: 73,
|
||||
Accept: 71,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S108
|
||||
Accept: 11,
|
||||
Accept: 73,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S109
|
||||
Accept: 0,
|
||||
Accept: 72,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S110
|
||||
Accept: 0,
|
||||
Accept: 74,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S111
|
||||
Accept: 10,
|
||||
Accept: 12,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S112
|
||||
|
|
@ -477,7 +477,7 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S114
|
||||
Accept: 62,
|
||||
Accept: 11,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S115
|
||||
|
|
@ -485,15 +485,15 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S116
|
||||
Accept: 0,
|
||||
Accept: 9,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S117
|
||||
Accept: 62,
|
||||
Accept: 9,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S118
|
||||
Accept: 62,
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S119
|
||||
|
|
@ -501,11 +501,11 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S120
|
||||
Accept: 0,
|
||||
Accept: 63,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S121
|
||||
Accept: 63,
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S122
|
||||
|
|
@ -513,43 +513,43 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S123
|
||||
Accept: 62,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S124
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S125
|
||||
Accept: 62,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S126
|
||||
Accept: 62,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S127
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S128
|
||||
Accept: 63,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S129
|
||||
ActionRow{ // S124
|
||||
Accept: 63,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S125
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S126
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S127
|
||||
Accept: 64,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S128
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S129
|
||||
Accept: 63,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S130
|
||||
Accept: 62,
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S131
|
||||
Accept: 0,
|
||||
Accept: 63,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S132
|
||||
Accept: 0,
|
||||
Accept: 63,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S133
|
||||
|
|
@ -557,19 +557,19 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S134
|
||||
Accept: 0,
|
||||
Accept: 64,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S135
|
||||
Accept: 78,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S136
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S136
|
||||
Accept: 63,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S137
|
||||
Accept: 77,
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S138
|
||||
|
|
@ -581,7 +581,31 @@ var ActTab = ActionTable{
|
|||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S140
|
||||
Accept: 64,
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S141
|
||||
Accept: 79,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S142
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S143
|
||||
Accept: 78,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S144
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S145
|
||||
Accept: 0,
|
||||
Ignore: "",
|
||||
},
|
||||
ActionRow{ // S146
|
||||
Accept: 65,
|
||||
Ignore: "",
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import (
|
|||
|
||||
const (
|
||||
NoState = -1
|
||||
NumStates = 141
|
||||
NumSymbols = 228
|
||||
NumStates = 147
|
||||
NumSymbols = 269
|
||||
)
|
||||
|
||||
type Lexer struct {
|
||||
|
|
@ -167,178 +167,219 @@ Lexer symbols:
|
|||
51: 'M'
|
||||
52: '$'
|
||||
53: '$'
|
||||
54: '*'
|
||||
55: '%'
|
||||
56: '%'
|
||||
57: '%'
|
||||
58: 'p'
|
||||
59: 'a'
|
||||
60: 'n'
|
||||
61: 'i'
|
||||
62: 'c'
|
||||
63: '%'
|
||||
64: '%'
|
||||
65: '%'
|
||||
66: ';'
|
||||
67: '='
|
||||
68: '['
|
||||
69: ']'
|
||||
70: '$'
|
||||
54: '{'
|
||||
55: '}'
|
||||
56: '$'
|
||||
57: '*'
|
||||
58: '%'
|
||||
59: '%'
|
||||
60: '%'
|
||||
61: 'p'
|
||||
62: 'a'
|
||||
63: 'n'
|
||||
64: 'i'
|
||||
65: 'c'
|
||||
66: '%'
|
||||
67: '%'
|
||||
68: '%'
|
||||
69: ';'
|
||||
70: '='
|
||||
71: '['
|
||||
72: '|'
|
||||
73: '|'
|
||||
74: '='
|
||||
75: '^'
|
||||
76: '^'
|
||||
72: ']'
|
||||
73: '$'
|
||||
74: '['
|
||||
75: '|'
|
||||
76: '|'
|
||||
77: '='
|
||||
78: '&'
|
||||
79: '&'
|
||||
78: '^'
|
||||
79: '^'
|
||||
80: '='
|
||||
81: '|'
|
||||
82: '='
|
||||
83: '^'
|
||||
84: '='
|
||||
85: '<'
|
||||
86: '<'
|
||||
81: '&'
|
||||
82: '&'
|
||||
83: '='
|
||||
84: '|'
|
||||
85: '='
|
||||
86: '^'
|
||||
87: '='
|
||||
88: '>'
|
||||
89: '>'
|
||||
88: '<'
|
||||
89: '<'
|
||||
90: '='
|
||||
91: '+'
|
||||
92: '='
|
||||
93: '.'
|
||||
94: '='
|
||||
95: '-'
|
||||
96: '='
|
||||
97: '*'
|
||||
98: '='
|
||||
99: '/'
|
||||
100: '='
|
||||
101: '/'
|
||||
91: '>'
|
||||
92: '>'
|
||||
93: '='
|
||||
94: '+'
|
||||
95: '='
|
||||
96: '.'
|
||||
97: '='
|
||||
98: '-'
|
||||
99: '='
|
||||
100: '*'
|
||||
101: '='
|
||||
102: '/'
|
||||
103: '='
|
||||
104: '%'
|
||||
105: '='
|
||||
106: '*'
|
||||
107: '*'
|
||||
104: '/'
|
||||
105: '/'
|
||||
106: '='
|
||||
107: '%'
|
||||
108: '='
|
||||
109: '?'
|
||||
110: ':'
|
||||
111: '|'
|
||||
112: '|'
|
||||
113: '^'
|
||||
114: '^'
|
||||
115: '&'
|
||||
116: '&'
|
||||
117: '='
|
||||
118: '~'
|
||||
119: '!'
|
||||
109: '*'
|
||||
110: '*'
|
||||
111: '='
|
||||
112: '?'
|
||||
113: ':'
|
||||
114: '|'
|
||||
115: '|'
|
||||
116: '^'
|
||||
117: '^'
|
||||
118: '&'
|
||||
119: '&'
|
||||
120: '='
|
||||
121: '~'
|
||||
122: '='
|
||||
122: '!'
|
||||
123: '='
|
||||
124: '!'
|
||||
124: '~'
|
||||
125: '='
|
||||
126: '>'
|
||||
127: '>'
|
||||
126: '='
|
||||
127: '!'
|
||||
128: '='
|
||||
129: '<'
|
||||
130: '<'
|
||||
129: '>'
|
||||
130: '>'
|
||||
131: '='
|
||||
132: '|'
|
||||
133: '^'
|
||||
134: '&'
|
||||
135: '<'
|
||||
136: '<'
|
||||
137: '>'
|
||||
138: '>'
|
||||
139: '+'
|
||||
140: '-'
|
||||
141: '.'
|
||||
132: '<'
|
||||
133: '<'
|
||||
134: '='
|
||||
135: '|'
|
||||
136: '^'
|
||||
137: '&'
|
||||
138: '<'
|
||||
139: '<'
|
||||
140: '>'
|
||||
141: '>'
|
||||
142: '+'
|
||||
143: '.'
|
||||
144: '-'
|
||||
145: '.'
|
||||
146: '*'
|
||||
147: '/'
|
||||
148: '/'
|
||||
149: '/'
|
||||
150: '%'
|
||||
151: '.'
|
||||
152: '*'
|
||||
153: '.'
|
||||
154: '/'
|
||||
155: '.'
|
||||
156: '/'
|
||||
143: '-'
|
||||
144: '.'
|
||||
145: '+'
|
||||
146: '.'
|
||||
147: '-'
|
||||
148: '.'
|
||||
149: '*'
|
||||
150: '/'
|
||||
151: '/'
|
||||
152: '/'
|
||||
153: '%'
|
||||
154: '.'
|
||||
155: '*'
|
||||
156: '.'
|
||||
157: '/'
|
||||
158: '!'
|
||||
159: '~'
|
||||
160: '*'
|
||||
161: '*'
|
||||
162: '('
|
||||
163: ')'
|
||||
164: ','
|
||||
165: '{'
|
||||
166: '}'
|
||||
167: '_'
|
||||
168: ' '
|
||||
169: '!'
|
||||
170: '#'
|
||||
171: '$'
|
||||
172: '%'
|
||||
173: '&'
|
||||
174: '''
|
||||
175: '\'
|
||||
176: '('
|
||||
177: ')'
|
||||
178: '*'
|
||||
179: '+'
|
||||
180: ','
|
||||
181: '-'
|
||||
182: '.'
|
||||
183: '/'
|
||||
184: ':'
|
||||
185: ';'
|
||||
186: '<'
|
||||
187: '='
|
||||
188: '>'
|
||||
189: '?'
|
||||
190: '@'
|
||||
191: '['
|
||||
192: ']'
|
||||
193: '^'
|
||||
194: '_'
|
||||
195: '`'
|
||||
196: '{'
|
||||
197: '|'
|
||||
198: '}'
|
||||
199: '~'
|
||||
200: '\'
|
||||
201: '"'
|
||||
202: 'e'
|
||||
203: 'E'
|
||||
204: 't'
|
||||
205: 'r'
|
||||
206: 'u'
|
||||
207: 'e'
|
||||
208: 'f'
|
||||
209: 'a'
|
||||
210: 'l'
|
||||
211: 's'
|
||||
212: 'e'
|
||||
213: ' '
|
||||
214: '\t'
|
||||
215: '\n'
|
||||
216: '\r'
|
||||
217: 'a'-'z'
|
||||
218: 'A'-'Z'
|
||||
219: '0'-'9'
|
||||
220: '0'-'9'
|
||||
221: 'a'-'f'
|
||||
222: 'A'-'F'
|
||||
223: 'A'-'Z'
|
||||
224: 'a'-'z'
|
||||
225: '0'-'9'
|
||||
226: \u0100-\U0010ffff
|
||||
227: .
|
||||
158: '.'
|
||||
159: '/'
|
||||
160: '/'
|
||||
161: '!'
|
||||
162: '~'
|
||||
163: '*'
|
||||
164: '*'
|
||||
165: '('
|
||||
166: ')'
|
||||
167: ','
|
||||
168: '{'
|
||||
169: '}'
|
||||
170: '_'
|
||||
171: ' '
|
||||
172: '!'
|
||||
173: '#'
|
||||
174: '$'
|
||||
175: '%'
|
||||
176: '&'
|
||||
177: '''
|
||||
178: '\'
|
||||
179: '('
|
||||
180: ')'
|
||||
181: '*'
|
||||
182: '+'
|
||||
183: ','
|
||||
184: '-'
|
||||
185: '.'
|
||||
186: '/'
|
||||
187: ':'
|
||||
188: ';'
|
||||
189: '<'
|
||||
190: '='
|
||||
191: '>'
|
||||
192: '?'
|
||||
193: '@'
|
||||
194: '['
|
||||
195: ']'
|
||||
196: '^'
|
||||
197: '_'
|
||||
198: '`'
|
||||
199: '{'
|
||||
200: '|'
|
||||
201: '}'
|
||||
202: '~'
|
||||
203: '\'
|
||||
204: '"'
|
||||
205: 'e'
|
||||
206: 'E'
|
||||
207: 't'
|
||||
208: 'r'
|
||||
209: 'u'
|
||||
210: 'e'
|
||||
211: 'f'
|
||||
212: 'a'
|
||||
213: 'l'
|
||||
214: 's'
|
||||
215: 'e'
|
||||
216: ' '
|
||||
217: '!'
|
||||
218: '#'
|
||||
219: '$'
|
||||
220: '%'
|
||||
221: '&'
|
||||
222: '''
|
||||
223: '\'
|
||||
224: '('
|
||||
225: ')'
|
||||
226: '*'
|
||||
227: '+'
|
||||
228: ','
|
||||
229: '-'
|
||||
230: '.'
|
||||
231: '/'
|
||||
232: ':'
|
||||
233: ';'
|
||||
234: '<'
|
||||
235: '='
|
||||
236: '>'
|
||||
237: '?'
|
||||
238: '@'
|
||||
239: '['
|
||||
240: ']'
|
||||
241: '^'
|
||||
242: '_'
|
||||
243: '`'
|
||||
244: '|'
|
||||
245: '~'
|
||||
246: '\'
|
||||
247: '{'
|
||||
248: '\'
|
||||
249: '}'
|
||||
250: ' '
|
||||
251: '\t'
|
||||
252: '\n'
|
||||
253: '\r'
|
||||
254: 'a'-'z'
|
||||
255: 'A'-'Z'
|
||||
256: '0'-'9'
|
||||
257: '0'-'9'
|
||||
258: 'a'-'f'
|
||||
259: 'A'-'F'
|
||||
260: 'A'-'Z'
|
||||
261: 'a'-'z'
|
||||
262: '0'-'9'
|
||||
263: \u0100-\U0010ffff
|
||||
264: 'A'-'Z'
|
||||
265: 'a'-'z'
|
||||
266: '0'-'9'
|
||||
267: \u0100-\U0010ffff
|
||||
268: .
|
||||
*/
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -198,7 +198,16 @@ md_token_field_name : '$' _idchar { _idchar } ;
|
|||
|
||||
// This is for literal strings but where the field name might have spaces in it
|
||||
// or somesuch.
|
||||
// md_token_braced_field_name: \$\{([^\}]|\\.)*\}
|
||||
_braced_char
|
||||
: 'A'-'Z' | 'a'-'z' | '0'-'9'
|
||||
| ' ' | '!' | '#' | '$' | '%' | '&' | '\'' | '\\'
|
||||
| '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/'
|
||||
| ':' | ';' | '<' | '=' | '>' | '?' | '@' | '['
|
||||
| ']' | '^' | '_' | '`' | '|' | '~'
|
||||
| ( '\\' '{' ) | ( '\\' '}' )
|
||||
| '\u0100'-'\U0010FFFF'
|
||||
;
|
||||
md_token_braced_field_name: '$' '{' _braced_char { _braced_char } '}' ;
|
||||
|
||||
md_token_full_srec : '$' '*' ;
|
||||
|
||||
|
|
@ -339,7 +348,7 @@ IndexedLvalue
|
|||
FieldValue
|
||||
: DirectFieldValue
|
||||
| IndirectFieldValue
|
||||
// | BracedFieldValue
|
||||
| BracedFieldValue
|
||||
//| PositionalFieldName
|
||||
//| PositionalFieldValue
|
||||
// ...
|
||||
|
|
@ -348,10 +357,10 @@ FieldValue
|
|||
// Note: the field name is "$field" not "field" since md_token_field_name
|
||||
// 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.
|
||||
// with at the AST level. Hence the NewASTNodeStripDollarSign.
|
||||
DirectFieldValue
|
||||
: md_token_field_name
|
||||
<< dsl.NewASTNodeStripDollarPlease($0, dsl.NodeTypeDirectFieldValue) >>
|
||||
<< dsl.NewASTNodeStripDollarSign($0, dsl.NodeTypeDirectFieldValue) >>
|
||||
;
|
||||
|
||||
IndirectFieldValue
|
||||
|
|
@ -363,6 +372,10 @@ IndirectFieldValue
|
|||
// * Indirect is '$["name"]'
|
||||
// * Braced is '${name}' -- note no double-quotes. This is for when the field
|
||||
// name has spaces or somesuch in it.
|
||||
BracedFieldValue
|
||||
: md_token_braced_field_name
|
||||
<< dsl.NewASTNodeStripDollarSignAndCurlyBraces($0, dsl.NodeTypeDirectFieldValue) >>
|
||||
;
|
||||
|
||||
// TODO: needs no "..." -- just ...
|
||||
//BracedFieldValue
|
||||
|
|
@ -680,7 +693,7 @@ MlrvalOrFunction
|
|||
// backslash-escaped double-quotes like "...\"...\"...", we also unbackslash
|
||||
// in the same method.
|
||||
MlrvalOrFunction
|
||||
: md_token_string_literal << dsl.NewASTNodeStripDoubleQuotePairPlease(
|
||||
: md_token_string_literal << dsl.NewASTNodeStripDoubleQuotePair(
|
||||
$0,
|
||||
dsl.NodeTypeStringLiteral,
|
||||
) >>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -11,9 +11,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
numProductions = 128
|
||||
numStates = 1065
|
||||
numSymbols = 118
|
||||
numProductions = 130
|
||||
numStates = 1081
|
||||
numSymbols = 120
|
||||
)
|
||||
|
||||
// Stack
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -128,6 +128,7 @@ var TokMap = TokenMap{
|
|||
"]",
|
||||
"md_token_field_name",
|
||||
"$[",
|
||||
"md_token_braced_field_name",
|
||||
"md_token_full_srec",
|
||||
"||=",
|
||||
"^^=",
|
||||
|
|
@ -201,84 +202,85 @@ var TokMap = TokenMap{
|
|||
},
|
||||
|
||||
idMap: map[string]Type{
|
||||
"INVALID": 0,
|
||||
"$": 1,
|
||||
"empty": 2,
|
||||
";": 3,
|
||||
"=": 4,
|
||||
"[": 5,
|
||||
"]": 6,
|
||||
"md_token_field_name": 7,
|
||||
"$[": 8,
|
||||
"md_token_full_srec": 9,
|
||||
"||=": 10,
|
||||
"^^=": 11,
|
||||
"&&=": 12,
|
||||
"|=": 13,
|
||||
"^=": 14,
|
||||
"<<=": 15,
|
||||
">>=": 16,
|
||||
"+=": 17,
|
||||
".=": 18,
|
||||
"-=": 19,
|
||||
"*=": 20,
|
||||
"/=": 21,
|
||||
"//=": 22,
|
||||
"%=": 23,
|
||||
"**=": 24,
|
||||
"?": 25,
|
||||
":": 26,
|
||||
"||": 27,
|
||||
"^^": 28,
|
||||
"&&": 29,
|
||||
"=~": 30,
|
||||
"!=~": 31,
|
||||
"==": 32,
|
||||
"!=": 33,
|
||||
">": 34,
|
||||
">=": 35,
|
||||
"<": 36,
|
||||
"<=": 37,
|
||||
"|": 38,
|
||||
"^": 39,
|
||||
"&": 40,
|
||||
"<<": 41,
|
||||
">>": 42,
|
||||
"+": 43,
|
||||
"-": 44,
|
||||
".+": 45,
|
||||
".-": 46,
|
||||
".": 47,
|
||||
"*": 48,
|
||||
"/": 49,
|
||||
"//": 50,
|
||||
"%": 51,
|
||||
".*": 52,
|
||||
"./": 53,
|
||||
".//": 54,
|
||||
"!": 55,
|
||||
"~": 56,
|
||||
"**": 57,
|
||||
"(": 58,
|
||||
")": 59,
|
||||
"md_token_string_literal": 60,
|
||||
"md_token_int_literal": 61,
|
||||
"md_token_float_literal": 62,
|
||||
"md_token_boolean_literal": 63,
|
||||
"md_token_panic": 64,
|
||||
",": 65,
|
||||
"{": 66,
|
||||
"}": 67,
|
||||
"md_token_IPS": 68,
|
||||
"md_token_IFS": 69,
|
||||
"md_token_IRS": 70,
|
||||
"md_token_OPS": 71,
|
||||
"md_token_OFS": 72,
|
||||
"md_token_ORS": 73,
|
||||
"md_token_NF": 74,
|
||||
"md_token_NR": 75,
|
||||
"md_token_FNR": 76,
|
||||
"md_token_FILENAME": 77,
|
||||
"md_token_FILENUM": 78,
|
||||
"INVALID": 0,
|
||||
"$": 1,
|
||||
"empty": 2,
|
||||
";": 3,
|
||||
"=": 4,
|
||||
"[": 5,
|
||||
"]": 6,
|
||||
"md_token_field_name": 7,
|
||||
"$[": 8,
|
||||
"md_token_braced_field_name": 9,
|
||||
"md_token_full_srec": 10,
|
||||
"||=": 11,
|
||||
"^^=": 12,
|
||||
"&&=": 13,
|
||||
"|=": 14,
|
||||
"^=": 15,
|
||||
"<<=": 16,
|
||||
">>=": 17,
|
||||
"+=": 18,
|
||||
".=": 19,
|
||||
"-=": 20,
|
||||
"*=": 21,
|
||||
"/=": 22,
|
||||
"//=": 23,
|
||||
"%=": 24,
|
||||
"**=": 25,
|
||||
"?": 26,
|
||||
":": 27,
|
||||
"||": 28,
|
||||
"^^": 29,
|
||||
"&&": 30,
|
||||
"=~": 31,
|
||||
"!=~": 32,
|
||||
"==": 33,
|
||||
"!=": 34,
|
||||
">": 35,
|
||||
">=": 36,
|
||||
"<": 37,
|
||||
"<=": 38,
|
||||
"|": 39,
|
||||
"^": 40,
|
||||
"&": 41,
|
||||
"<<": 42,
|
||||
">>": 43,
|
||||
"+": 44,
|
||||
"-": 45,
|
||||
".+": 46,
|
||||
".-": 47,
|
||||
".": 48,
|
||||
"*": 49,
|
||||
"/": 50,
|
||||
"//": 51,
|
||||
"%": 52,
|
||||
".*": 53,
|
||||
"./": 54,
|
||||
".//": 55,
|
||||
"!": 56,
|
||||
"~": 57,
|
||||
"**": 58,
|
||||
"(": 59,
|
||||
")": 60,
|
||||
"md_token_string_literal": 61,
|
||||
"md_token_int_literal": 62,
|
||||
"md_token_float_literal": 63,
|
||||
"md_token_boolean_literal": 64,
|
||||
"md_token_panic": 65,
|
||||
",": 66,
|
||||
"{": 67,
|
||||
"}": 68,
|
||||
"md_token_IPS": 69,
|
||||
"md_token_IFS": 70,
|
||||
"md_token_IRS": 71,
|
||||
"md_token_OPS": 72,
|
||||
"md_token_OFS": 73,
|
||||
"md_token_ORS": 74,
|
||||
"md_token_NF": 75,
|
||||
"md_token_NR": 76,
|
||||
"md_token_FNR": 77,
|
||||
"md_token_FILENAME": 78,
|
||||
"md_token_FILENUM": 79,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,10 @@
|
|||
TOP OF LIST:
|
||||
|
||||
* tuesday:
|
||||
o computed/braced srec on both sides
|
||||
o indexed-lvalue assignment ops -- need ints too
|
||||
o oosvars at state -- easy mlrmap now
|
||||
o $[1] is easier now; needn't $[[1]]
|
||||
o $[[[ ]]] ... ?
|
||||
o indexed-lvalue assignment ops -- need ints too
|
||||
o $[1] is easier now; needn't $[[[1]]]
|
||||
- keep or get rid of $[[[ ]]] ... ?
|
||||
o functions?!?
|
||||
|
||||
* array/map
|
||||
|
|
|
|||
|
|
@ -147,3 +147,5 @@ echo; run_mlr --from u/s.dkvp --idkvp --ojson put '$*["a"] = 78'
|
|||
echo; run_mlr --from u/s.dkvp --idkvp --ojson put '$*["a"] = {}'
|
||||
echo; run_mlr --from u/s.dkvp --idkvp --opprint put -v '$new = $["a"]'
|
||||
echo; run_mlr --from u/s.dkvp --idkvp --opprint put -v '$["new"] = $a'
|
||||
echo; run_mlr --from u/s.dkvp --idkvp --opprint put -v '${new} = $a . $b'
|
||||
echo; run_mlr --from u/s.dkvp --idkvp --opprint put -v '$new = ${a} . ${b}'
|
||||
|
|
|
|||
|
|
@ -1453,3 +1453,41 @@ pan pan 1 0.3467901443380824 0.7268028627434533 pan
|
|||
eks pan 2 0.7586799647899636 0.5221511083334797 eks
|
||||
wye wye 3 0.20460330576630303 0.33831852551664776 wye
|
||||
eks wye 4 0.38139939387114097 0.13418874328430463 eks
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
mlr --from u/s.dkvp --idkvp --opprint put -v ${new} = $a . $b
|
||||
DSL EXPRESSION:
|
||||
${new} = $a . $b
|
||||
RAW AST:
|
||||
* StatementBlock
|
||||
* Assignment "="
|
||||
* DirectFieldValue "new"
|
||||
* Operator "."
|
||||
* DirectFieldValue "a"
|
||||
* DirectFieldValue "b"
|
||||
|
||||
a b i x y new
|
||||
pan pan 1 0.3467901443380824 0.7268028627434533 panpan
|
||||
eks pan 2 0.7586799647899636 0.5221511083334797 ekspan
|
||||
wye wye 3 0.20460330576630303 0.33831852551664776 wyewye
|
||||
eks wye 4 0.38139939387114097 0.13418874328430463 ekswye
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
mlr --from u/s.dkvp --idkvp --opprint put -v $new = ${a} . ${b}
|
||||
DSL EXPRESSION:
|
||||
$new = ${a} . ${b}
|
||||
RAW AST:
|
||||
* StatementBlock
|
||||
* Assignment "="
|
||||
* DirectFieldValue "new"
|
||||
* Operator "."
|
||||
* DirectFieldValue "a"
|
||||
* DirectFieldValue "b"
|
||||
|
||||
a b i x y new
|
||||
pan pan 1 0.3467901443380824 0.7268028627434533 panpan
|
||||
eks pan 2 0.7586799647899636 0.5221511083334797 ekspan
|
||||
wye wye 3 0.20460330576630303 0.33831852551664776 wyewye
|
||||
eks wye 4 0.38139939387114097 0.13418874328430463 ekswye
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue