Skip to content

Commit

Permalink
Fix an issue that guards (look-behind condition to match layouts) wer…
Browse files Browse the repository at this point in the history
…e added to too many patterns
  • Loading branch information
sungshik committed Sep 16, 2024
1 parent 7cefa0a commit 9e4a229
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ private list[ConversionUnit] addInnerRules(list[ConversionUnit] units) {
// Convert all units in the group to match patterns (including,
// optimistically, multi-line units as-if they are single-line)
for (u <- group, !u.recursive) {
TmRule r = toTmRule(toRegExp(u.rsc, u.prod, guard = true))
// Add the guard (i.e., look-behind condition to match layout) only
// when the units in the group don't begin with a delimiter
bool guard = nothing() := u.innerDelimiters.begin;
TmRule r = toTmRule(toRegExp(u.rsc, u.prod, guard = guard))
[name = "/inner/single/<u.name>"];
rules = insertIn(rules, (u: r));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"foo bar"
# ^^^^^^^^^ Constant

"foo<x + 1>bar"
# ^^^^^ ^^^^^ Constant
# ^^^^^ -Constant

### TODO: The following test shows that, currently, multi-line strings are
### disabled. This is because the converter determines that:
### - `>` doesn't uniquely delineate interpolation (it could also be
Expand Down

0 comments on commit 9e4a229

Please sign in to comment.