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

Is the exit transition being dropped correctly? #2

Open
ioquatix opened this issue Feb 17, 2020 · 0 comments
Open

Is the exit transition being dropped correctly? #2

ioquatix opened this issue Feb 17, 2020 · 0 comments

Comments

@ioquatix
Copy link

I am trying to resolve a simple non-determinism.

%%{
  machine query;

  # An application/x-www-form-urlencoded parser based on the
definition by WhatWG.
  # Based on https://url.spec.whatwg.org/#application/x-www-form-urlencoded
  pchar = any - [&=\[\]];

  # All transitions default to priority 0. We set the integer exit
priority to 1, which ensures a transition to the next state will only
invoke %integer_end (the lower priority %string_end transition is
discarded).
  integer = ([0-9]+) %(index, 1) >integer_begin %integer_end;
  string = (pchar+) $(index, 0) >string_begin %string_end;

  value = (pchar*) >value_begin %value_end;

  index = string (
    '[' (integer | string) ']'
  )* ('[]' %append)?;

  pair = (
    index ('=' value)?
  ) %pair;

  main := ((pair '&')* pair)?;
}%%

When parsing the following input: q[0]=0

I see that on the transition for ] it will invoke both %integer_end as well as %string_end. But I was under the impression the lower priority transition would be dropped.

Thanks for any advice you can give me.

@adrian-thurston adrian-thurston transferred this issue from adrian-thurston/colm Mar 7, 2020
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

1 participant