Skip to content

Commit

Permalink
Allow comma characters in parser
Browse files Browse the repository at this point in the history
  • Loading branch information
oakmac authored and tonsky committed Aug 30, 2024
1 parent c04ca6b commit ee28d17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cs_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def parse(self, string, pos):
name = "wrap")

token = '[^' + r'()\[\]{}\"@~^;`#\'' + ws + '][^' + r'()\[\]{}\"@^;`' + ws + ']*'
parsers['token'] = Regex(r'(##)?(\\[()\[\]{}\"@^;`]|' + token + ")", name = "token")
parsers['token'] = Regex(r'(##)?(\\[()\[\]{}\"@^;`,]|' + token + ")", name = "token")

parsers['string'] = Seq(Regex(r'#?"', name=".open"),
Optional(Regex(r'([^"\\]+|\\.)+', name = ".body")),
Expand Down
7 changes: 4 additions & 3 deletions test_parser/token.txt
Original file line number Diff line number Diff line change
Expand Up @@ -640,19 +640,20 @@ Simple Char
Special Chars
================================================================================

\( \) \[ \] \{ \} \@ \"
\( \) \[ \] \{ \} \@ \" \,

--------------------------------------------------------------------------------

(source 0..23
(source 0..26
(token 0..2 '\(')
(token 3..5 '\)')
(token 6..8 '\[')
(token 9..11 '\]')
(token 12..14 '\{')
(token 15..17 '\}')
(token 18..20 '\@')
(token 21..23 '\"'))
(token 21..23 '\"')
(token 24..26 '\,'))

================================================================================
Octal Char
Expand Down

0 comments on commit ee28d17

Please sign in to comment.