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

Parameterized enclosing for char and string literals #170

Open
bogo8liuk opened this issue Aug 20, 2023 · 1 comment
Open

Parameterized enclosing for char and string literals #170

bogo8liuk opened this issue Aug 20, 2023 · 1 comment

Comments

@bogo8liuk
Copy link

charLiteral and stringLiteral lexemes encloses literals, respectively, with characters ' and " (both at the beginning and at the end of a literal) by default. There should be lexemes (one for characters and one for strings) which makes parametric literals enclosing, for instance by taking as arguments a string (not a single character) which encloses a literal at the beginning of it and a string which encloses the literal at the end of it, something like charLiteral :: String -> String -> ParsecT s u m Char. Thus:
charLiteral "<<" ">>" would parse <<c>>, where c is a single character, valid to be a literal character.
This is just an example, before opening a pull request there should be a reasoning about not to make a breaking change (if it's possible).

Anyway, actually, I don't know a clean way to do what I just explained with the actual API.

@phadej
Copy link
Collaborator

phadej commented Aug 21, 2023

Both charLiteral and stringLiteral say

The literal character is parsed according to the grammar rules defined in the Haskell report

Breaking change to parsec are not really welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants