-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
…ctionary key
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,13 +71,10 @@ QUOTED_VALUE: | |
mode INTERPOLATION_MODE; | ||
|
||
NESTED_INTER_OPEN: INTER_OPEN -> type(INTER_OPEN), pushMode(INTERPOLATION_MODE); | ||
INTER_COLON: ':' WS? -> type(COLON), mode(VALUE_MODE); | ||
INTER_COLON: ':' WS? -> mode(VALUE_MODE); | ||
INTER_CLOSE: '}' -> popMode; | ||
|
||
DOT: '.'; | ||
INTER_ID: ID -> type(ID); | ||
// A special type of `ID` that contains the "@" character. It has to be a different | ||
// lexer token because resolver names must not contain this character. | ||
ID_WITH_AT: (ID|'@')+; | ||
LIST_INDEX: INT_UNSIGNED; | ||
KEY: ~[${}[\]:. \t]+; // interpolation key, may contain any non special character | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
omry
Owner
|
||
INTER_WS: WS -> skip; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,8 +48,8 @@ sequence: element (COMMA element)*; | |
|
||
interpolation: interpolationNode | interpolationResolver; | ||
interpolationNode: INTER_OPEN DOT* configKey (DOT configKey)* INTER_CLOSE; | ||
interpolationResolver: INTER_OPEN (interpolation | ID) COLON sequence? BRACE_CLOSE; | ||
configKey: interpolation | ID | ID_WITH_AT | LIST_INDEX; | ||
interpolationResolver: INTER_OPEN (interpolation | ID) INTER_COLON sequence? BRACE_CLOSE; | ||
configKey: interpolation | ID | KEY; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
odelalleau
Author
Collaborator
|
||
|
||
// Primitive types. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,7 @@ def defaultResult(self) -> List[Any]: | |
def visitConfigKey(self, ctx: OmegaConfGrammarParser.ConfigKeyContext) -> str: | ||
from ._utils import _get_value | ||
|
||
# interpolation | ID | ID_WITH_AT | LIST_INDEX | ||
# interpolation | ID | KEY | ||
assert ctx.getChildCount() == 1 | ||
child = ctx.getChild(0) | ||
if isinstance(child, OmegaConfGrammarParser.InterpolationContext): | ||
|
@@ -168,7 +168,7 @@ def visitInterpolationResolver( | |
) -> Optional["Node"]: | ||
from ._utils import _get_value | ||
|
||
# INTER_OPEN (interpolation | ID) COLON sequence? BRACE_CLOSE; | ||
# INTER_OPEN (interpolation | ID) INTER_COLON sequence? BRACE_CLOSE; | ||
resolver_name = None | ||
inputs = [] | ||
inputs_str = [] | ||
|
@@ -208,7 +208,7 @@ def visitDictKeyValuePair( | |
) -> Tuple[Any, Any]: | ||
from ._utils import _get_value | ||
|
||
assert ctx.getChildCount() == 3 # ID COLON element | ||
assert ctx.getChildCount() == 3 # primitive COLON element | ||
This comment has been minimized.
Sorry, something went wrong.
omry
Owner
|
||
key_node = ctx.getChild(0) | ||
assert ( | ||
isinstance(key_node, TerminalNode) | ||
|
2 comments
on commit 200fef2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are done with this commit, right? (it should be a part of the bigger interpolation diff?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is an interpolation key, let's call it INTER_KEY.
KEY is way too generic.