Thanks to visit codestin.com
Credit goes to github.com

Skip to content

an alternative list starting with a predicate will never pass predicate #1

@onnlucky

Description

@onnlucky

example:
rule: xs=something* ( ?{ xs.length == 0 } simple | complex) ;
will always do complex
(caveat, the predicate needs to be written like such: return ((ArrayList)xs).size() == 0;)

_t=ERROR; do{ //or
  { int _p108=_pos; _t=ERROR; do { //and
    if (!__pred107(ps,xs)) _t=ERROR;

since _t is set to ERROR at start of alternative list, and a predicate does not reset _t only set it to error if needed, this will fail

workaround: place an empty before the first predicate:
rule: xs=something* ( empty ?{ xs.length == 0 } simple | complex) ;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions