diff options
author | Emanuele Torre <torreemanuele6@gmail.com> | 2023-07-09 20:32:51 +0200 |
---|---|---|
committer | Nico Williams <nico@cryptonector.com> | 2023-07-09 17:23:19 -0500 |
commit | 193f432e0849c71d8e34910ba60bdfbd94aa0ba9 (patch) | |
tree | 46566e588d3595e0fe67e65f7bcfcfcf7bb4c227 /.github | |
parent | c08ecbaf239592018a2050b8515040d4a9f2e7aa (diff) |
Lex $foo as a single token, instead of using '$' IDENT
Previously, bindings were parsed as the combination of two tokens:
'$' IDENT
This meant that using a keyword as variable name (e.g. $then, $label)
did not work.
Attempts were made to allow $keyword to work by adding some '$' Keyword
rules in the parser, but this did not allow $keyword in all places:
jq --arg label foo -n '$label' # ok
jq -n '"foo" as $label | .' # error
Treating $foo as a single token is much simpler, in my opinion.
This patch also changes how LOC is lexed: "$__loc__" instead of as
"__loc__" that gets combined with '$' in the parser.
This patch also disallows having spaces after '$' when recalling a
variable `$ foo' since that was probably just an unintentional side
effect of the implementation, and it was not documented.
Fixes #2675
Diffstat (limited to '.github')
0 files changed, 0 insertions, 0 deletions