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

Predicates works in a very weird manner #7

Open
ksmolyanin opened this issue Jul 28, 2011 · 1 comment
Open

Predicates works in a very weird manner #7

ksmolyanin opened this issue Jul 28, 2011 · 1 comment

Comments

@ksmolyanin
Copy link

Predicates works in a very weird manner. For example this doesn't work as expected:
static_content_symbol: ( / [^\{] / | "{" !"{" | "{" !"*" )+
but this (which is logically equivalent) works fine:
static_content_symbol: ( / [^\{] / | "{" !( "{" | "*" ) )+
and this is not because of several predicates in the same rule, because this one works ok:
comment_content: ( / [^\*\{] / | "*" !"}" | "{" !"*" ) comment_content | comment comment_content | ""
Maybe this is because of the same start "{" of both alternatives in the first (nonworking) example?
Full grammar and test sample see in description of bug #6.

@mzolus
Copy link

mzolus commented Oct 24, 2018

The subexpression "{" !"{" | "{" !"*" isn't equivalent to "{" !( "{" | "*") in the general case. The first reads, "accept { if it is not followed by {, or else accept { if it is not followed by *". The string "{{" would fail the first branch, but succeed the second ( "{{" is a { not followed by a *).

The second variant effectively reads, "accept { if it is not followed by either { or *" -- a clearly different expression.

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