From 60f7a7531328b396d681c7fa188d21740d64da86 Mon Sep 17 00:00:00 2001 From: b3b00 Date: Sun, 3 Nov 2024 19:15:28 +0200 Subject: [PATCH] fix #495 --- src/sly/lexer/LexerBuilder.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/sly/lexer/LexerBuilder.cs b/src/sly/lexer/LexerBuilder.cs index d6946279..7c4514f1 100644 --- a/src/sly/lexer/LexerBuilder.cs +++ b/src/sly/lexer/LexerBuilder.cs @@ -446,8 +446,17 @@ private static BuildResult> BuildGenericSubLexers( var subLexers = GetSubLexers(attributes); foreach (var subLexer in subLexers) { - var x = BuildGenericLexer(subLexer.Value, extensionBuilder, result, lang, explicitTokens); - var currentGenericLexer = x.Result as GenericLexer; + BuildResult> b = null; + if (subLexer.Key == ModeAttribute.DefaultLexerMode) + { + b = BuildGenericLexer(subLexer.Value, extensionBuilder, result, lang, explicitTokens); + } + else + { + b = BuildGenericLexer(subLexer.Value, extensionBuilder, result, lang, null); + } + + var currentGenericLexer = b.Result as GenericLexer; if (genLexer == null) { genLexer = currentGenericLexer;