/** * Creates a {@link CommentNode} node and returns the same builder. * * @param value The comment value. * @return Returns this for method chaining. */ public GenericBuilder<P> comment(final String value) { parentNode.addChild(CommentNode.newInstance(parentNode, value)); return this; }
/** * Creates a {@link ChoiceNode} node and returns a sub builder for adding nodes to the {@link * ChoiceNode} node. * * @return Returns a new generic builder for a choice node. */ public GenericBuilder<GenericBuilder<P>> choice() { final ChoiceNode choice = ChoiceNode.newInstance(parentNode); parentNode.addChild(choice); return new GenericBuilder<GenericBuilder<P>>(this, choice); }
/** * Creates a {@link TerminalNode} node and returns the same builder. * * @param value The terminal value. * @return Returns this for method chaining. */ public GenericBuilder<P> terminal(final String value) { parentNode.addChild(TerminalNode.newInstance(parentNode, value)); return this; }
/** * Creates an {@link IdentifierNode} node and returns the same builder. * * @param value The identifier value. * @return Returns this for method chaining. */ public GenericBuilder<P> identifier(final String value) { parentNode.addChild(IdentifierNode.newInstance(parentNode, value)); return this; }
/** * Creates a {@link SequenceNode} node and returns a sub builder for adding nodes to the {@link * SequenceNode} node. * * @return Returns a new generic builder for a sequence node. */ public GenericBuilder<GenericBuilder<P>> sequence() { final SequenceNode seq = SequenceNode.newInstance(parentNode); parentNode.addChild(seq); return new GenericBuilder<GenericBuilder<P>>(this, seq); }
/** * Creates a {@link Option} node and returns a sub builder for adding nodes to the {@link Option} * node. * * @return Returns a new generic builder for a option node. */ public GenericBuilder<GenericBuilder<P>> option() { final Option option = Option.newInstance(parentNode); parentNode.addChild(option); return new GenericBuilder<GenericBuilder<P>>(this, option); }
/** * Creates a {@link LoopNode} node and returns a sub builder for adding nodes to the {@link * LoopNode} node. * * @return Returns a new generic builder for a loop node. */ public GenericBuilder<GenericBuilder<P>> loop() { final LoopNode loop = LoopNode.newInstance(parentNode); parentNode.addChild(loop); return new GenericBuilder<GenericBuilder<P>>(this, loop); }