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

Support string escaping #885

Closed
spoenemann opened this issue Jan 27, 2023 Discussed in #884 · 1 comment · Fixed by #888
Closed

Support string escaping #885

spoenemann opened this issue Jan 27, 2023 Discussed in #884 · 1 comment · Fixed by #888
Assignees
Labels
grammar Grammar language related issue
Milestone

Comments

@spoenemann
Copy link
Contributor

We should support string escaping in the grammar language:

  • Add \ escaping to the STRING rule in langium-grammar.langium
  • Process escaped characters in the convertString method of DefaultValueConverter
  • Adapt the syntax highlighting config of the grammar language to support escaped characters

Discussed in #884

Originally posted by ballcoach12 January 26, 2023
The following rule generates an error in the grammar editor:

terminal S_BYTE_CHAR_STR returns string:
 	'\'' S_BYTE_CHAR_VALUE* '\''
 ;

The second backslash causes the following error: Unexpected character value: ->\<-. Do I need to escape this character somehow?

@spoenemann spoenemann added the grammar Grammar language related issue label Jan 27, 2023
@spoenemann
Copy link
Contributor Author

See also #797, which is about including escaped characters in the generated syntax highlighting. Shall we try to detect whether the terminal rule supports escaped characters? Or add that to syntax highlighting without checking?

@spoenemann spoenemann self-assigned this Jan 27, 2023
spoenemann added a commit that referenced this issue Jan 27, 2023
@spoenemann spoenemann added this to the v1.1.0 milestone Jan 27, 2023
spoenemann added a commit that referenced this issue Jan 27, 2023
spoenemann added a commit that referenced this issue Jan 30, 2023
spoenemann added a commit that referenced this issue Jan 30, 2023
spoenemann added a commit that referenced this issue Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grammar Grammar language related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant