From 205b7620bde709ec78117bcb3ff5901895443c7c Mon Sep 17 00:00:00 2001 From: Matt Jaffee Date: Wed, 20 Jun 2018 09:31:20 -0500 Subject: [PATCH] update SetColumnAttrs name --- pql/pql.peg | 4 ++-- pql/pql.peg.go | 32 ++++++++++++++++++++++++++++---- pql/pqlpeg_test.go | 18 +++++++++--------- 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/pql/pql.peg b/pql/pql.peg index d5f82f49c..a094aa663 100644 --- a/pql/pql.peg +++ b/pql/pql.peg @@ -8,7 +8,7 @@ type PQL Peg { Calls <- whitesp (Call whitesp)* !. Call <- 'Set' {p.startCall("Set")} open uintcol comma args (comma timestamp)? close {p.endCall()} / 'SetRowAttrs' {p.startCall("SetRowAttrs")} open posfield comma uintrow comma args close {p.endCall()} - / 'SetColAttrs' {p.startCall("SetColAttrs")} open posfield comma uintcol comma args close {p.endCall()} + / 'SetColumnAttrs' {p.startCall("SetColumnAttrs")} open posfield comma uintcol comma args close {p.endCall()} / 'Clear' {p.startCall("Clear")} open uintcol comma args close {p.endCall()} / 'TopN' {p.startCall("TopN")} open posfield (comma allargs)? close {p.endCall()} / 'Range' {p.startCall("Range")} open (timerange / conditional / arg) close {p.endCall()} @@ -64,7 +64,7 @@ comma <- sp ',' whitesp lbrack <- '[' sp rbrack <- sp ']' sp whitesp <- ( ' ' / '\t' / '\n' )* -IDENT <- !('Set(' / 'SetRowAttrs(' / 'SetColAttrs(' / 'Clear(' / 'TopN(' / 'Range(') [[A-Z]] ([[A-Z]] / [0-9])* +IDENT <- !('Set(' / 'SetRowAttrs(' / 'SetColumnAttrs(' / 'Clear(' / 'TopN(' / 'Range(') [[A-Z]] ([[A-Z]] / [0-9])* timestampbasicfmt <- [0-9][0-9][0-9][0-9]'-'[01][0-9]'-'[0-3][0-9]'T'[0-9][0-9]':'[0-9][0-9] diff --git a/pql/pql.peg.go b/pql/pql.peg.go index 467c14883..f62f21552 100644 --- a/pql/pql.peg.go +++ b/pql/pql.peg.go @@ -391,7 +391,7 @@ func (p *PQL) Execute() { case ruleAction3: p.endCall() case ruleAction4: - p.startCall("SetColAttrs") + p.startCall("SetColumnAttrs") case ruleAction5: p.endCall() case ruleAction6: @@ -579,7 +579,7 @@ func (p *PQL) Init() { position, tokenIndex = position0, tokenIndex0 return false }, - /* 1 Call <- <(('S' 'e' 't' Action0 open uintcol comma args (comma timestamp)? close Action1) / ('S' 'e' 't' 'R' 'o' 'w' 'A' 't' 't' 'r' 's' Action2 open posfield comma uintrow comma args close Action3) / ('S' 'e' 't' 'C' 'o' 'l' 'A' 't' 't' 'r' 's' Action4 open posfield comma uintcol comma args close Action5) / ('C' 'l' 'e' 'a' 'r' Action6 open uintcol comma args close Action7) / ('T' 'o' 'p' 'N' Action8 open posfield (comma allargs)? close Action9) / ('R' 'a' 'n' 'g' 'e' Action10 open (timerange / conditional / arg) close Action11) / ( Action12 open allargs comma? close Action13))> */ + /* 1 Call <- <(('S' 'e' 't' Action0 open uintcol comma args (comma timestamp)? close Action1) / ('S' 'e' 't' 'R' 'o' 'w' 'A' 't' 't' 'r' 's' Action2 open posfield comma uintrow comma args close Action3) / ('S' 'e' 't' 'C' 'o' 'l' 'u' 'm' 'n' 'A' 't' 't' 'r' 's' Action4 open posfield comma uintcol comma args close Action5) / ('C' 'l' 'e' 'a' 'r' Action6 open uintcol comma args close Action7) / ('T' 'o' 'p' 'N' Action8 open posfield (comma allargs)? close Action9) / ('R' 'a' 'n' 'g' 'e' Action10 open (timerange / conditional / arg) close Action11) / ( Action12 open allargs comma? close Action13))> */ func() bool { position5, tokenIndex5 := position, tokenIndex { @@ -755,6 +755,18 @@ func (p *PQL) Init() { goto l22 } position++ + if buffer[position] != rune('u') { + goto l22 + } + position++ + if buffer[position] != rune('m') { + goto l22 + } + position++ + if buffer[position] != rune('n') { + goto l22 + } + position++ if buffer[position] != rune('A') { goto l22 } @@ -1131,6 +1143,18 @@ func (p *PQL) Init() { goto l56 } position++ + if buffer[position] != rune('u') { + goto l56 + } + position++ + if buffer[position] != rune('m') { + goto l56 + } + position++ + if buffer[position] != rune('n') { + goto l56 + } + position++ if buffer[position] != rune('A') { goto l56 } @@ -2606,7 +2630,7 @@ func (p *PQL) Init() { } return true }, - /* 29 IDENT <- <(!(('S' 'e' 't' '(') / ('S' 'e' 't' 'R' 'o' 'w' 'A' 't' 't' 'r' 's' '(') / ('S' 'e' 't' 'C' 'o' 'l' 'A' 't' 't' 'r' 's' '(') / ('C' 'l' 'e' 'a' 'r' '(') / ('T' 'o' 'p' 'N' '(') / ('R' 'a' 'n' 'g' 'e' '(')) ([a-z] / [A-Z]) ([a-z] / [A-Z] / [0-9])*)> */ + /* 29 IDENT <- <(!(('S' 'e' 't' '(') / ('S' 'e' 't' 'R' 'o' 'w' 'A' 't' 't' 'r' 's' '(') / ('S' 'e' 't' 'C' 'o' 'l' 'u' 'm' 'n' 'A' 't' 't' 'r' 's' '(') / ('C' 'l' 'e' 'a' 'r' '(') / ('T' 'o' 'p' 'N' '(') / ('R' 'a' 'n' 'g' 'e' '(')) ([a-z] / [A-Z]) ([a-z] / [A-Z] / [0-9])*)> */ nil, /* 30 timestampbasicfmt <- <([0-9] [0-9] [0-9] [0-9] '-' ('0' / '1') [0-9] '-' [0-3] [0-9] 'T' [0-9] [0-9] ':' [0-9] [0-9])> */ func() bool { @@ -2752,7 +2776,7 @@ func (p *PQL) Init() { nil, /* 37 Action3 <- <{p.endCall()}> */ nil, - /* 38 Action4 <- <{p.startCall("SetColAttrs")}> */ + /* 38 Action4 <- <{p.startCall("SetColumnAttrs")}> */ nil, /* 39 Action5 <- <{p.endCall()}> */ nil, diff --git a/pql/pqlpeg_test.go b/pql/pqlpeg_test.go index 94a670181..023bbc71c 100644 --- a/pql/pqlpeg_test.go +++ b/pql/pqlpeg_test.go @@ -142,12 +142,12 @@ func TestPEGWorking(t *testing.T) { input: "SetRowAttrs(blah, 9, a=47, b=bval)", ncalls: 1}, { - name: "SetColAttrs", - input: "SetColAttrs(blah, 9, a=47)", + name: "SetColumnAttrs", + input: "SetColumnAttrs(blah, 9, a=47)", ncalls: 1}, { - name: "SetColAttrs2args", - input: "SetColAttrs(blah, 9, a=47, b=bval)", + name: "SetColumnAttrs2args", + input: "SetColumnAttrs(blah, 9, a=47, b=bval)", ncalls: 1}, { name: "Clear", @@ -252,8 +252,8 @@ func TestPEGErrors(t *testing.T) { name: "SetRowAttrsNoField", input: "SetRowAttrs(a=4)"}, { - name: "SetColAttrsNoField", - input: "SetColAttrs(a=4)"}, + name: "SetColumnAttrsNoField", + input: "SetColumnAttrs(a=4)"}, { name: "ClearNoCol", input: "Clear(a=4)"}, @@ -319,10 +319,10 @@ func TestPQLDeepEquality(t *testing.T) { }, }}, { - name: "SetColAttrs", - call: "SetColAttrs(myfield, 9, z=4)", + name: "SetColumnAttrs", + call: "SetColumnAttrs(myfield, 9, z=4)", exp: &Call{ - Name: "SetColAttrs", + Name: "SetColumnAttrs", Args: map[string]interface{}{ "z": int64(4), "_field": "myfield",