Skip to content

Commit

Permalink
Add dash character to ID token.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Gleize authored and Jasha10 committed Sep 29, 2022
1 parent 4405e58 commit e4eb15a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion omegaconf/grammar/OmegaConfGrammarLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ BOOL:
NULL: [Nn][Uu][Ll][Ll];

UNQUOTED_CHAR: [/\-\\+.$%*@?|]; // other characters allowed in unquoted strings
ID: (CHAR|'_') (CHAR|DIGIT|'_')*;
ID: (CHAR|'_') (CHAR|DIGIT|'_'|'-')*;
ESC: (ESC_BACKSLASH | '\\(' | '\\)' | '\\[' | '\\]' | '\\{' | '\\}' |
'\\:' | '\\=' | '\\,' | '\\ ' | '\\\t')+;
WS: [ \t]+;
Expand Down
2 changes: 1 addition & 1 deletion omegaconf/grammar_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
_node_access = f"\\.{_key_maybe_brackets}" # .foo, [foo], [$bar]
_node_path = f"(\\.)*({_key_maybe_brackets})({_node_access})*" # [foo].bar, .foo[bar]
_node_inter = f"\\${{\\s*{_node_path}\\s*}}" # node interpolation ${foo.bar}
_id = "[a-zA-Z_]\\w*" # foo, foo_bar, abc123
_id = "[a-zA-Z_][\\w\\-]*" # foo, foo_bar, foo-bar, abc123
_resolver_name = f"({_id}(\\.{_id})*)?" # foo, ns.bar3, ns_1.ns_2.b0z
_arg = r"[a-zA-Z_0-9/\-\+.$%*@?|]+" # string representing a resolver argument
_args = f"{_arg}(\\s*,\\s*{_arg})*" # list of resolver arguments
Expand Down
1 change: 1 addition & 0 deletions tests/test_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ def visit() -> Any:
"x ${ab.cd.ef.gh} y",
"$ ${foo} ${bar} ${boz} $",
"${foo:bar}",
"${foo-bar:bar-foo}",
"${foo : bar, baz, boz}",
"${foo:bar,0,a-b+c*d/$.%@?|}",
r"\${foo}",
Expand Down

0 comments on commit e4eb15a

Please sign in to comment.