Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support trailing commas in CreateMessage and CreateStruct expressions #416

Merged
merged 1 commit into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions parser/gen/CEL.g4
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ member
: primary # PrimaryExpr
| member op='.' id=IDENTIFIER (open='(' args=exprList? ')')? # SelectOrCall
| member op='[' index=expr ']' # Index
| member op='{' entries=fieldInitializerList? '}' # CreateMessage
| member op='{' entries=fieldInitializerList? ','? '}' # CreateMessage
;

primary
: leadingDot='.'? id=IDENTIFIER (op='(' args=exprList? ')')? # IdentOrGlobalCall
| '(' e=expr ')' # Nested
| op='[' elems=exprList? ','? ']' # CreateList
| op='{' entries=mapInitializerList? '}' # CreateStruct
| op='{' entries=mapInitializerList? ','? '}' # CreateStruct
| literal # ConstantLiteral
;

Expand Down
12 changes: 6 additions & 6 deletions parser/gen/CEL.tokens
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
T__0=1
EQUALS=2
NOT_EQUALS=3
EQUALS=1
NOT_EQUALS=2
IN=3
LESS=4
LESS_EQUALS=5
GREATER_EQUALS=6
Expand Down Expand Up @@ -34,9 +34,9 @@ NUM_UINT=33
STRING=34
BYTES=35
IDENTIFIER=36
'in'=1
'=='=2
'!='=3
'=='=1
'!='=2
'in'=3
'<'=4
'<='=5
'>='=6
Expand Down
12 changes: 6 additions & 6 deletions parser/gen/CELLexer.tokens
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
T__0=1
EQUALS=2
NOT_EQUALS=3
EQUALS=1
NOT_EQUALS=2
IN=3
LESS=4
LESS_EQUALS=5
GREATER_EQUALS=6
Expand Down Expand Up @@ -34,9 +34,9 @@ NUM_UINT=33
STRING=34
BYTES=35
IDENTIFIER=36
'in'=1
'=='=2
'!='=3
'=='=1
'!='=2
'in'=3
'<'=4
'<='=5
'>='=6
Expand Down
2 changes: 1 addition & 1 deletion parser/gen/cel_base_listener.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from /Users/tswadell/lace/go/src/github.com/google/cel-go/bin/../parser/gen/CEL.g4 by ANTLR 4.7.
// Generated from /Users/tswadell/go/src/github.com/google/cel-go/bin/../parser/gen/CEL.g4 by ANTLR 4.7.

package gen // CEL
import "github.com/antlr/antlr4/runtime/Go/antlr"
Expand Down
2 changes: 1 addition & 1 deletion parser/gen/cel_base_visitor.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from /Users/tswadell/lace/go/src/github.com/google/cel-go/bin/../parser/gen/CEL.g4 by ANTLR 4.7.
// Generated from /Users/tswadell/go/src/github.com/google/cel-go/bin/../parser/gen/CEL.g4 by ANTLR 4.7.

package gen // CEL
import "github.com/antlr/antlr4/runtime/Go/antlr"
Expand Down
20 changes: 10 additions & 10 deletions parser/gen/cel_lexer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from /Users/tswadell/lace/go/src/github.com/google/cel-go/bin/../parser/gen/CEL.g4 by ANTLR 4.7.
// Generated from /Users/tswadell/go/src/github.com/google/cel-go/bin/../parser/gen/CEL.g4 by ANTLR 4.7.

package gen

Expand Down Expand Up @@ -94,9 +94,9 @@ var serializedLexerAtn = []uint16{
3, 2, 2, 2, 73, 195, 3, 2, 2, 2, 75, 198, 3, 2, 2, 2, 77, 203, 3, 2, 2,
2, 79, 226, 3, 2, 2, 2, 81, 229, 3, 2, 2, 2, 83, 235, 3, 2, 2, 2, 85, 276,
3, 2, 2, 2, 87, 291, 3, 2, 2, 2, 89, 310, 3, 2, 2, 2, 91, 408, 3, 2, 2,
2, 93, 410, 3, 2, 2, 2, 95, 415, 3, 2, 2, 2, 97, 98, 7, 107, 2, 2, 98,
99, 7, 112, 2, 2, 99, 4, 3, 2, 2, 2, 100, 101, 7, 63, 2, 2, 101, 102, 7,
63, 2, 2, 102, 6, 3, 2, 2, 2, 103, 104, 7, 35, 2, 2, 104, 105, 7, 63, 2,
2, 93, 410, 3, 2, 2, 2, 95, 415, 3, 2, 2, 2, 97, 98, 7, 63, 2, 2, 98, 99,
7, 63, 2, 2, 99, 4, 3, 2, 2, 2, 100, 101, 7, 35, 2, 2, 101, 102, 7, 63,
2, 2, 102, 6, 3, 2, 2, 2, 103, 104, 7, 107, 2, 2, 104, 105, 7, 112, 2,
2, 105, 8, 3, 2, 2, 2, 106, 107, 7, 62, 2, 2, 107, 10, 3, 2, 2, 2, 108,
109, 7, 62, 2, 2, 109, 110, 7, 63, 2, 2, 110, 12, 3, 2, 2, 2, 111, 112,
7, 64, 2, 2, 112, 113, 7, 63, 2, 2, 113, 14, 3, 2, 2, 2, 114, 115, 7, 64,
Expand Down Expand Up @@ -224,21 +224,21 @@ var lexerModeNames = []string{
}

var lexerLiteralNames = []string{
"", "'in'", "'=='", "'!='", "'<'", "'<='", "'>='", "'>'", "'&&'", "'||'",
"", "'=='", "'!='", "'in'", "'<'", "'<='", "'>='", "'>'", "'&&'", "'||'",
"'['", "']'", "'{'", "'}'", "'('", "')'", "'.'", "','", "'-'", "'!'", "'?'",
"':'", "'+'", "'*'", "'/'", "'%'", "'true'", "'false'", "'null'",
}

var lexerSymbolicNames = []string{
"", "", "EQUALS", "NOT_EQUALS", "LESS", "LESS_EQUALS", "GREATER_EQUALS",
"", "EQUALS", "NOT_EQUALS", "IN", "LESS", "LESS_EQUALS", "GREATER_EQUALS",
"GREATER", "LOGICAL_AND", "LOGICAL_OR", "LBRACKET", "RPRACKET", "LBRACE",
"RBRACE", "LPAREN", "RPAREN", "DOT", "COMMA", "MINUS", "EXCLAM", "QUESTIONMARK",
"COLON", "PLUS", "STAR", "SLASH", "PERCENT", "TRUE", "FALSE", "NULL", "WHITESPACE",
"COMMENT", "NUM_FLOAT", "NUM_INT", "NUM_UINT", "STRING", "BYTES", "IDENTIFIER",
}

var lexerRuleNames = []string{
"T__0", "EQUALS", "NOT_EQUALS", "LESS", "LESS_EQUALS", "GREATER_EQUALS",
"EQUALS", "NOT_EQUALS", "IN", "LESS", "LESS_EQUALS", "GREATER_EQUALS",
"GREATER", "LOGICAL_AND", "LOGICAL_OR", "LBRACKET", "RPRACKET", "LBRACE",
"RBRACE", "LPAREN", "RPAREN", "DOT", "COMMA", "MINUS", "EXCLAM", "QUESTIONMARK",
"COLON", "PLUS", "STAR", "SLASH", "PERCENT", "TRUE", "FALSE", "NULL", "BACKSLASH",
Expand Down Expand Up @@ -280,9 +280,9 @@ func NewCELLexer(input antlr.CharStream) *CELLexer {

// CELLexer tokens.
const (
CELLexerT__0 = 1
CELLexerEQUALS = 2
CELLexerNOT_EQUALS = 3
CELLexerEQUALS = 1
CELLexerNOT_EQUALS = 2
CELLexerIN = 3
CELLexerLESS = 4
CELLexerLESS_EQUALS = 5
CELLexerGREATER_EQUALS = 6
Expand Down
2 changes: 1 addition & 1 deletion parser/gen/cel_listener.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from /Users/tswadell/lace/go/src/github.com/google/cel-go/bin/../parser/gen/CEL.g4 by ANTLR 4.7.
// Generated from /Users/tswadell/go/src/github.com/google/cel-go/bin/../parser/gen/CEL.g4 by ANTLR 4.7.

package gen // CEL
import "github.com/antlr/antlr4/runtime/Go/antlr"
Expand Down
Loading