]> granicus.if.org Git - re2c/commit
Added test for '--posix-captures': implicit grouping is forbidden.
authorUlya Trofimovich <skvadrik@gmail.com>
Sat, 4 Mar 2017 11:58:55 +0000 (11:58 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Sat, 4 Mar 2017 12:09:40 +0000 (12:09 +0000)
commit0c1e034856231e0c38b1ffa7cf43a035a789bbd1
tree59a7c6f44ce69a1942b4cd75940ba9af13f61d19
parent0b962be8588d701f4729926501b1c93dd9eb4dca
Added test for '--posix-captures': implicit grouping is forbidden.

RE2C has named definitions, which allow to override operator precedence
without grouping parenthesis. However, in POSIX all parenthesis are
capturing: allowing some of them to be non-capturing would affect
disambiguation and might result in a different parse.

For now RE2C uses a crude criterion to determine if the given named
definition needs to be explicitely wrapped in parenthesis: if the topmost
constructor of the subexpression is either alternative, or catenation, or
another reference to another named definition, then wrapping is required.
This is an overapproximation, because it doesn't take the surrounding context
into account (e.g. catenation inside of an alternative doesn't need wrapping,
but catenation inside of an iteration does).
re2c/test/posix_captures/implicit_grouping1.i--posix-captures.c [new file with mode: 0644]
re2c/test/posix_captures/implicit_grouping1.i--posix-captures.re [new file with mode: 0644]
re2c/test/posix_captures/implicit_grouping2.i--posix-captures.c [new file with mode: 0644]
re2c/test/posix_captures/implicit_grouping2.i--posix-captures.re [new file with mode: 0644]
re2c/test/posix_captures/implicit_grouping3.i--posix-captures.c [new file with mode: 0644]
re2c/test/posix_captures/implicit_grouping3.i--posix-captures.re [new file with mode: 0644]