-
Notifications
You must be signed in to change notification settings - Fork 58
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
C language is including ';' in expression syntax #380
Comments
Hi @charles-gray! The explanation is that this really is expression-like and not strictly that expected C-expression matching. Comby is not smart enough to tell the difference. The examples that "break" that matching are what are considered non-expression tokens (spaces at the top-level, i.e., not inside Note that in many languages (and I think C is included here), a syntactic statement ending in a semicolon is considered an expression. So in the strictly C-expression matching of your examples, I would expect the behavior to always match the trailing As a workaround, you can look at stripping or fine-tuning matching the Feel free to close if this answers your question :-) |
Thanks for the prompt response! I've always assumed the I guess my question then is, I see that comby supports custom language definitions. I'd love to tweak the C definition to see if I can bend it to my current use case (I've encountered this semicolon problem before!). The C definition in the comby source seems to be hard-coded in ML. I was wondering if there's a way to spit out the definition for C in JSON, or there's a reference example somewhere I can adapt? |
Describe the bug
When I try to use a hole with expression-like syntax (
:[foo:e]
) in C code, I see the;
semicolon character included in the expression.;
isn't a valid expression token in C.Reproducing
This link showcases some examples of it matching the
;
and some ways to break it.bit.ly/3UNAuki
Expected behavior
I expect to be able to match an expression without the trailing semicolon.
Additional context
The same is true for the comma (
,
) token. Though that can be part of an expression depending on context. I'm not sure if I expect comby to be smart enough to tell the difference, so I'm not sure that's included in this bug report.The text was updated successfully, but these errors were encountered: