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

Help needed: matching Python-like multiline strings #330

Open
elenakrittik opened this issue Jul 28, 2023 · 4 comments
Open

Help needed: matching Python-like multiline strings #330

elenakrittik opened this issue Jul 28, 2023 · 4 comments

Comments

@elenakrittik
Copy link

Every single regex i could find uses either globals flags or lookaround, neither of which are supported by logos (to my knowledge, at least). Syntax like [^(""")] (NOT group of symbols) is not supported by regex itself, though even if it was i'm pretty sure it'll fall into the lookahead category and therefore would still not be supported by logos. CAD97's C-style block comment regex is pretty much incompatible with Python-like block comments, where comment start and comment end are all the same characters. I imagine this can be possible with a lot of boilerplate around extras, or via postprocessing, but before going with these i'd like to ask if anyone encountered the same problem and got a solution. Any help is greatly appreciated!

@jeertmans
Copy link
Collaborator

Hello! I am afraid it is not possible by just using regexes. This is a bit the limitation of not using look-around and so on: you gain performances at the cost of fewer features. But I think it's relatively easy to implement a callback function with Extras that handle triple quotes.

@hyperswine
Copy link

Hello! I am afraid it is not possible by just using regexes. This is a bit the limitation of not using look-around and so on: you gain performances at the cost of fewer features. But I think it's relatively easy to implement a callback function with Extras that handle triple quotes.

can you give an example?

@jeertmans
Copy link
Collaborator

I think there are some examples if you search the issues or the examples directory… but I don’t have one example to show right now unfortunately :/

@elenakrittik
Copy link
Author

I haven't done that yet, but it seems like using a sublexer (see #61) for this would be the best way.

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

3 participants