Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse error on \n -> #1894

Closed
qsctr opened this issue Jul 13, 2023 · 1 comment · Fixed by #1922
Closed

Parse error on \n -> #1894

qsctr opened this issue Jul 13, 2023 · 1 comment · Fixed by #1922
Assignees
Labels
type: bug Issues reporting bugs or unexpected/unwanted behavior

Comments

@qsctr
Copy link
Contributor

qsctr commented Jul 13, 2023

The specific sequence of characters \n -> fails to parse:

sawscript> (\n -> n) 1
Parse error at <stdin>:1:5-1:7: Unexpected `->'

however, the following works:

sawscript> (\x -> x) 1
[17:16:43.448] 1
sawscript> (\ n -> n) 1
[17:16:50.798] 1

Since only \n triggers this, I suspect the parser might be inappropriately recognizing the \n string escape sequence outside of a string literal.

@qsctr qsctr added the type: bug Issues reporting bugs or unexpected/unwanted behavior label Jul 13, 2023
@RyanGlScott
Copy link
Contributor

@yav notes that this part of SAWScript's lexer looks very suspicious:

Due to the double quotes, this indicates a literal string match, and no escaping is done. In fact, we could probably delete this line, since \n is already included as a part of $whitechar:

$whitechar = [\ \t\n\r\f\v]

(I'm unclear if that is sufficient to fix the bug at hand, but it definitely seems related.)

@qsctr qsctr self-assigned this Aug 29, 2023
qsctr added a commit that referenced this issue Aug 29, 2023
@mergify mergify bot closed this as completed in #1922 Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Issues reporting bugs or unexpected/unwanted behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants