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

the 'token' rule appears to be broken #21

Closed
dustyleary opened this issue Jul 15, 2013 · 2 comments
Closed

the 'token' rule appears to be broken #21

dustyleary opened this issue Jul 15, 2013 · 2 comments

Comments

@dustyleary
Copy link

I am just looking into OMeta, and ometa-js... I don't have enough experience to debug the issue, but I've made a pretty simple test case:

ometa Simple {
  top = cat:c mouse*:ms end -> [#top, c, ms],

  identifier = letter*:chars -> chars.join(''),

  cat = "cat" space* identifier:id -> [#cat, id],
  mouse = "mouse" space* identifier:id -> [#mouse, id]
}
console.log(Simple.matchAll('cat fluffy mouse mickey', 'top'));

The parse fails here on the space after 'fluffy'.
I would have expected it to succeed, based on the description of the 'token' rule (invoked with the double-quotes around 'cat', 'mouse'): eat spaces, and then match the text.

so, after matching the rule cat (consuming text "cat fluffy"), the next rule to match should be mouse, whose first rule is a 'token' rule, so the whitespace after 'fluffy' should be eaten, and then the text 'mouse' should be consumed.

The code works on @alexwarth playground: http://tinlizzie.org/ometa-js/#token_test

If I put space* in front of "mouse" (ie 'manually' making the token rule), then it works here in ometa-js.

@indutny
Copy link
Collaborator

indutny commented Jul 24, 2013

Sadly, it matches spaces after token and not before it... I'll try to figure out if the fix is possible and won't break existing users' code.

@indutny
Copy link
Collaborator

indutny commented Jul 24, 2013

Whatever, fixed in 3.3.0.

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