Commit 20a61b4
authored
Disallow whitespace as the first character of a reserved-body in a reserved-statement. (#731)
In the 'reserved-statement' nonterminal, there is an ambiguity if there is more
than one whitespace character between the 'reserved-keyword' and the first
non-whitespace character of the 'reserved-body', because these whitespace
characters can be seen as part of the 's' nonterminal or as part of the
'reserved-body' nonterminal.
According to the principles explained in #725 and the proposed resolution
of #721, it is not desired that a 'reserved-body' starts with a whitespace
character; rather, such a whitespace character is meant to be interpreted
as part of the preceding 's' nonterminal.
Test case:
```
.regex /foo/{xyz}{{hello}}
```
This patch removes this ambiguity, by disallowing whitespace as the first
character of a 'reserved-body' in a reserved-statement.
It thus fixes the first part of #721.
Details:
- In the other occurrences of 'resolved-body' as well (in a
'reserved-annotation' or 'private-use-annotation') the leading
whitespace is separated as well. This has no influence on the set
of inputs that the 'reserved-annotation' and 'private-use-annotation'
nonterminals can match, but highlights that the parser should better
trim off this leading whitespace in these places before entering the
resolved-body into the data model.
- A nonterminal 'resolved-body-part' is introduced.1 parent 6d7b4ba commit 20a61b4
2 files changed
+8
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
613 | | - | |
| 613 | + | |
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
656 | | - | |
| 656 | + | |
657 | 657 | | |
658 | 658 | | |
659 | | - | |
| 659 | + | |
| 660 | + | |
660 | 661 | | |
661 | 662 | | |
662 | 663 | | |
| |||
0 commit comments