@Test @DisplayName("chained modifiers are okay and are optimized") void syntaxChainedModifier() { final Map<String,String> modifierPairs = JVM8Tools.asMap( "**", "*", "*?", "*", "*+", "*", "+*", "*", "+?", "*", "++", "+", "?*", "*", "??", "?", "?+", "*" ); for (final var entry : modifierPairs.entrySet()) { final var key = entry.getKey(); final var value = entry.getValue(); terminal: { var klass = FluentBuilder.from(MyClass.class); final var sut = klass.syntax(String.format("(parameter%s)%s", key.substring(0, 1), key.substring(1))); sut.optimize(); if (value.equals("+")) { Assertions.assertEquals("parameter parameter*", sut.toString(), " for " + key); } else { Assertions.assertEquals(String.format("parameter%s", value), sut.toString(), " for " + key); } } complex: { var klass = FluentBuilder.from(MyClass.class); final var sut = klass.syntax(String.format("((parameter kw)%s)%s", key.substring(0, 1), key.substring(1))); sut.optimize(); if (value.equals("+")) { Assertions.assertEquals("parameter kw (parameter kw)*", sut.toString(), " for " + key); } else { Assertions.assertEquals(String.format("(parameter kw)%s", value), sut.toString(), " for " + key); } } } }
public Syntax(Lexer lexer, FluentNodeCreator nodeCreator) { this.lexer = lexer; this.nodeCreator = nodeCreator; }
Syntax { public Syntax(Lexer lexer, FluentNodeCreator nodeCreator) { this.lexer = lexer; this.nodeCreator = nodeCreator; } }
Syntax { public Syntax(Lexer lexer, FluentNodeCreator nodeCreator) { this.lexer = lexer; this.nodeCreator = nodeCreator; } Syntax(Lexer lexer, FluentNodeCreator nodeCreator); }
Syntax { public Syntax(Lexer lexer, FluentNodeCreator nodeCreator) { this.lexer = lexer; this.nodeCreator = nodeCreator; } Syntax(Lexer lexer, FluentNodeCreator nodeCreator); List<Node> expression(); List<Node> subExpression(); List<Node> alternate(); List<Node> simple(); List<Node> terminal(); }
Syntax { public Syntax(Lexer lexer, FluentNodeCreator nodeCreator) { this.lexer = lexer; this.nodeCreator = nodeCreator; } Syntax(Lexer lexer, FluentNodeCreator nodeCreator); List<Node> expression(); List<Node> subExpression(); List<Node> alternate(); List<Node> simple(); List<Node> terminal();  }