diff --git a/tests/ParserTests/Discussion468/Discussion468Lexer.cs b/tests/ParserTests/Discussion468/Discussion468Lexer.cs new file mode 100644 index 00000000..2a724d53 --- /dev/null +++ b/tests/ParserTests/Discussion468/Discussion468Lexer.cs @@ -0,0 +1,11 @@ +using sly.lexer; + +namespace ParserTests.Discussion468 +{ + public enum Discussion468Lexer + { + [CustomId("_.:a-zA-Z","_.:0-9a-zA-Z")] + INDENTIFIER + + } +} \ No newline at end of file diff --git a/tests/ParserTests/Discussion468/Discussion468Tests.cs b/tests/ParserTests/Discussion468/Discussion468Tests.cs new file mode 100644 index 00000000..fb74f528 --- /dev/null +++ b/tests/ParserTests/Discussion468/Discussion468Tests.cs @@ -0,0 +1,52 @@ +using System.Linq; +using expressionparser; +using NFluent; +using simpleExpressionParser; +using sly.lexer; +using sly.parser; +using sly.parser.generator; +using Xunit; + +namespace ParserTests.Discussion468 +{ + public class Discussion468Tests + { + + + + private static void CheckId(ILexer lexer,string source, bool isOk) + { + + var lexingResult = lexer.Tokenize(source); + if (isOk) + { + Check.That(lexingResult).IsOkLexing(); + var tokens = lexingResult.Tokens; + Check.That(tokens).IsNotNull(); + Check.That(tokens).CountIs(2); + var idToken = tokens[0]; + Check.That(idToken.TokenID).IsEqualTo(Discussion468Lexer.INDENTIFIER); + Check.That(idToken.Value).IsEqualTo(source); + } + else + { + Check.That(lexingResult).Not.IsOkLexing(); + } + } + + [Fact] + public static void Test468() + { + var buildResult = LexerBuilder.BuildLexer(); + Check.That(buildResult).IsOk(); + var lexer = buildResult.Result; + Check.That(lexer).IsNotNull(); + CheckId(lexer,"_:word1234",true); + CheckId(lexer,"word_1234.otherword",true); + CheckId(lexer,"1_:word1234",false); + + } + + + } +} \ No newline at end of file