Skip to content

Strange behaviour regular expressions with binding #420

@enieuwen

Description

@enieuwen

When using parantheses around regular expressions in bindings, the binding result sometimes seems incorrect:

// recognize 'something' between X-es
rascal>[ <comment,rest> | /<comment:(X.*X)><rest:.*>/ := "before XcommentX after"]
lrel[str,str]: [<"XcommentX","XcommentX">]

The variables comment and rest should never match the same part of the string.

rascal>[ rest | /<comment:(X.*X)><rest:.*>/ := "before XcommentX after"]
list[str]: ["XcommentX"]

The result above is consistent with the first test but if you remove the first (unused) binding of comment, the result is different:

rascal>[ rest | /(X.*X)<rest:.*>/ := "before XcommentX after"]
list[str]: [" after"]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions