Skip to content

Commit

Permalink
Allow double quotes in string expressions
Browse files Browse the repository at this point in the history
Passing tool arguments such as -CFLAGS "blah blah" requires '"'.
  • Loading branch information
sjalloq authored and olofk committed Mar 6, 2023
1 parent 9395056 commit e75364d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fusesoc/capi2/exprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
expr ::= word
| conditional
word ::= [a-zA-Z0-9:<>.\[\]_-,=~/^+]+ (one or more alphanum/special chars)
word ::= [a-zA-Z0-9:<>.\[\]_-,=~/^+"]+ (one or more alphanum/special chars)
conditional ::= condition "?" "(" exprs ")"
Expand Down Expand Up @@ -75,7 +75,7 @@ def _get_parser():
if _PARSER is not None:
return _PARSER

word = Word(alphanums + "`:<>.[]_-,=~/^+")
word = Word(alphanums + '`:<>.[]_-,=~/^+"')
exprs = Forward()

conditional = (
Expand Down
1 change: 1 addition & 0 deletions tests/test_exprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def test_exprs():
check_parses_to("a ? (b ? (c))", [(False, "a", [(False, "b", ["c"])])])
check_parses_to("!a ? (b)", [(True, "a", ["b"])])
check_parses_to("a b ? (c)", ["a", (False, "b", ["c"])])
check_parses_to('a"b"', ['a"b"'])

check_parse_error("!a")
check_parse_error("a ? b")
Expand Down

0 comments on commit e75364d

Please sign in to comment.