Skip to content

Commit a1f51c6

Browse files
committed
Fix TerminalGenerator.cs
1 parent 263207e commit a1f51c6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

TerminalGenerator/TerminalGenerator.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,12 @@ static string generateTransitionCondition(RegexNode node)
244244
RegexChar rc => $"""c == '{EscapeChar(rc.Value)}' /* {rc} */""",
245245
RegexAnyChar => "true /* RegexAnyChar */",
246246
NegatedCharClassGroup rcc when rcc.ToString() == $@"[^[\n]]" => $@"c is not '\n' and not '\0' /* {rcc} */",
247-
NegatedCharClassGroup x when x.Classes.Any(x => x is RangesCharClass) => $@"!({string.Join(" && ", x.Classes.Select(generateTransitionCondition))}) && c != '\0'",
248247
RangesCharClass rcc => GenerateRangeCondition(rcc),
249248
WordCharClass wcc => $"""{(wcc.Negated ? "!" : "")}(char.IsLetterOrDigit(c) || c == '_')""",
250249
DigitCharClass dcc => $"""{(dcc.Negated ? "!" : "")}char.IsDigit(c)""",
251250
WhitespaceCharClass scc => $"""{(scc.Negated ? "!" : "")}char.IsWhiteSpace(c)""",
252251
LetterCharClass lcc => $"""{(lcc.Negated ? "!" : "")}char.IsLetter(c)""",
253-
NegatedCharClassGroup x => $@"false /* {x} ({x.GetType().Name}) {string.Join(" && ", x.Classes.Select(x => $"{x} ({x.GetType().Name})"))} */",
252+
NegatedCharClassGroup x => $@"!({string.Join(" || ", x.Classes.Select(generateTransitionCondition))}) && c != '\0'",
254253
_ => $"false /* {node} ({node.GetType().Name}) */"
255254
};
256255
}

0 commit comments

Comments
 (0)