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

Closed
elenakrittik opened this issue Jul 28, 2023 · 5 comments
Closed

Help needed: matching Python-like multiline strings #330

elenakrittik opened this issue Jul 28, 2023 · 5 comments
Labels
question Further information is requested

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.

@jeertmans
Copy link
Collaborator

jeertmans commented Sep 26, 2024

Closing. See #421 (comment) for an example on comments (which is very similar to multiline strings).

@jeertmans jeertmans added the question Further information is requested label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants