Add support dictionary literals to grammar
This also allows dictionary values to be variables instead of just regular identifiers, a change which might be made to other literals such as lists and tuples in the future as we determine what those also support.
This commit is contained in:
parent
826ad27552
commit
650eb73721
15
grammar.ebnf
15
grammar.ebnf
@ -329,10 +329,25 @@ LITERAL
|
||||
| STRING_LITERAL
|
||||
| NUMBER_LITERAL
|
||||
| BOOLEAN_LITERAL
|
||||
| DICTIONARY_LITERAL
|
||||
| LIST_LITERAL
|
||||
| TUPLE_LITERAL
|
||||
;
|
||||
|
||||
DICTIONARY_LITERAL
|
||||
=
|
||||
literal_type:`dictionary`
|
||||
(
|
||||
| ( "{" {SP}* value+:dictionary_key_value { {SP}* "," {SP}* value+:dictionary_key_value } {SP}* "}" )
|
||||
| ( "{" {SP}* "}" )
|
||||
)
|
||||
;
|
||||
|
||||
dictionary_key_value
|
||||
=
|
||||
key:STRING_LITERAL {SP}* ":" {SP}* value:variable_identifier
|
||||
;
|
||||
|
||||
LIST_LITERAL
|
||||
=
|
||||
literal_type:`list`
|
||||
|
||||
Loading…
Reference in New Issue
Block a user