From 416bc7d8e5c56f784e952486161ab47460b69fec Mon Sep 17 00:00:00 2001 From: Sung-Shik Jongmans Date: Mon, 23 Sep 2024 12:04:17 +0200 Subject: [PATCH] Improve comments --- .../src/main/rascal/lang/textmate/Conversion.rsc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rascal-textmate-core/src/main/rascal/lang/textmate/Conversion.rsc b/rascal-textmate-core/src/main/rascal/lang/textmate/Conversion.rsc index a48d8da..ab36aa2 100644 --- a/rascal-textmate-core/src/main/rascal/lang/textmate/Conversion.rsc +++ b/rascal-textmate-core/src/main/rascal/lang/textmate/Conversion.rsc @@ -201,7 +201,12 @@ private list[ConversionUnit] addInnerRules(list[ConversionUnit] units) { for (u <- group, !u.recursive) { // Add the guard (i.e., look-behind condition to match layout) only - // when the units in the group don't begin with a delimiter + // when the units in the group don't begin with a delimiter. Why is + // is this? We *don't* want `32` to be highlighted as a number in + // `int aer32 = 34`. However, we *do* want `>bar"` to be highlighted + // as a string in `"foobar"`. As a heuristic, if the token + // starts with a delimiter (e.g., `>`), then it should be allowed + // for its occurrence to not be preceded by layout. bool guard = nothing() := u.innerDelimiters.begin; TmRule r = toTmRule(toRegExp(u.rsc, u.prod, guard = guard)) [name = "/inner/single/"];