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

lexing rune cant handle backslash and newline #19363

Closed
SurmanPP opened this issue Sep 15, 2023 · 0 comments · Fixed by #19369
Closed

lexing rune cant handle backslash and newline #19363

SurmanPP opened this issue Sep 15, 2023 · 0 comments · Fixed by #19369
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Nicer V Errors Bugs/feature requests, related to improving V error messages. Unit: Parser Bugs/feature requests, that are related to the V parser or syntax (*not* semantic ones). Unit: Scanner Bugs/feature requests, that are related to the V scanner/lexer.

Comments

@SurmanPP
Copy link
Contributor

SurmanPP commented Sep 15, 2023

Describe the bug

The lexing of the backtick syntax for runes breaks with a single backslash or a backslash and a newline.

Reproduction Steps

case 1.

a :=  `\
`

case 2.

a := `\`

case 3.

a := `\` foo bar

Expected Behavior

Case 1 and 2 should be caught in the lexer.
Case 3 should have a nicer error message. Maybe with details about escaping and telling that it can only be one rune.

Current Behavior

  1. outputs C error: empty character constant
  2. outputs a C error: missing terminating ' character
  3. outputs V error:

invalid character literal \ foo bar
=>` foo bar
([`, ```, , `f`, `o`, `o`, ` `, `b`, `a`, `r`, `
`]) (more than one character)
1 | a := `` foo bar
| ^

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.1 24cb98d

Environment details (OS name and version, etc.)

V full version: V 0.4.1 c85232e.24cb98d
OS: linux, Pop!_OS 22.04 LTS

Important

You can vote for this issue using the 👍 reaction. More votes increase the issue's priority
for developers.

Take into account that only the 👍 reaction counts as a vote.
Only reactions to the issue itself will be counted as votes, not comments.

@SurmanPP SurmanPP added the Bug This tag is applied to issues which reports bugs. label Sep 15, 2023
@ArtemkaKun ArtemkaKun added Nicer V Errors Bugs/feature requests, related to improving V error messages. Unit: Checker Bugs/feature requests, that are related to the type checker. Unit: Parser Bugs/feature requests, that are related to the V parser or syntax (*not* semantic ones). Unit: Scanner Bugs/feature requests, that are related to the V scanner/lexer. and removed Unit: Checker Bugs/feature requests, that are related to the type checker. labels Sep 15, 2023
@shove70 shove70 self-assigned this Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Nicer V Errors Bugs/feature requests, related to improving V error messages. Unit: Parser Bugs/feature requests, that are related to the V parser or syntax (*not* semantic ones). Unit: Scanner Bugs/feature requests, that are related to the V scanner/lexer.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants