/** Suppress node of r rule */ Rule suppr(Rule r) { return r.suppressNode(); } /** OneOrMore(DIGIT()), suppress sub nodes */
public Rule suppressNode() { if (target == null) { // if we have no target yet we need to save the marker and "apply" it later setNodeSuppressed(true); return this; } // we already have a target to which we can directly apply the marker Rule inner = unwrap(target); target = (Matcher) inner.suppressNode(); // since this might change the instance we have to update it setNodeSuppressed(false); return target; }
/** * VCHAR ::= %x21-7e * <p>printing chars */ Rule VCHAR() { return FirstOf(CharRange('!', '~'), LatinExtendedAndOtherAlphabet() ).label(VCHAR).suppressNode(); } /**
/** * xcom-multicol ::= "multicol" 1*WSP ("start" / "new" / "end") */ Rule XcomMulticol() { return Sequence("multicol", OneOrMore(WSP()).suppressNode(), FirstOf("start", "new", "end")) .label(XcomMulticol); } /**
/** * field-composer ::= %x43.3A *WSP tex-text header-eol<p> * <tt>C:</tt> */ Rule FieldComposer() { return Sequence(String("C:"), ZeroOrMore(WSP()).suppressNode(), TexText(), HeaderEol()).label(FieldComposer); } /**
Rule FieldInstruction() { return Sequence(String("I:"), ZeroOrMore(WSP()).suppressNode(), Xcom(), HeaderEol() ).label(FieldInstruction); } /**
/** * field-key ::= %x4B.3A *WSP key header-eol<p> * <tt>K:</tt> */ Rule FieldKey() { return Sequence(String("K:"), ZeroOrMore(WSP()).suppressNode(), Key(), HeaderEol()).label(FieldKey); } /**
/** * ifield-group ::= %5B.%47.%3A *WSP tex-text-ifield %5D<p> * <tt>[G:..]</tt> */ Rule IfieldGroup() { return Sequence(String("[G:"), ZeroOrMore(WSP()).suppressNode(), TexTextIfield(), String("]")) .label(IfieldGroup); } /**
/** * ifield-title ::= %5B.%54.%3A *WSP tex-text-ifield %5D<p> * <tt>[T:second version]</tt> */ Rule IfieldTitle() { return Sequence(String("[T:"), ZeroOrMore(WSP()).suppressNode(), TexTextIfield(), String("]")) .label(IfieldTitle); } Rule IfieldUserdefPlay() {
/** * ifield-key ::= %5B.4B.3A *WSP key %5D<p> * e.g. <tt>[K:Ador] [K: Bphr ^d]</tt> */ Rule IfieldKey() { return Sequence(String("[K:"), ZeroOrMore(WSP()).suppressNode(), Key(), String("]")) .label(IfieldKey); } /**
/** * field-book ::= %x42.3A *WSP tex-text header-eol<p> * <tt>B:</tt> */ Rule FieldBook() { return Sequence(String("B:"), ZeroOrMore(WSP()).suppressNode(), TexText(), HeaderEol()).label(FieldBook); } /**
/** * field-history ::= %x48.3A *WSP 1*(tex-text header-eol)<p> * <tt>H:</tt> * field contents may extend over many lines, which is deprecated (maybe not allowed any longer?) */ Rule FieldHistory() { return Sequence(String("H:"), ZeroOrMore(WSP()).suppressNode(), /*OneOrMoreS(*/TexText(), HeaderEol()/*)*/ ).label(FieldHistory); } Rule FieldInstruction() {
/** * In header defines in which order parts should be played * * field-parts ::= %x50.3A *WSP parts-play-order header-eol<p> * <tt>P:</tt> */ Rule FieldParts() { return Sequence(String("P:"), ZeroOrMore(WSP()).suppressNode(), PartsPlayOrder(), HeaderEol()).label(FieldParts); } /**
/** * nth-repeat-num ::= 1*DIGIT *(("," / "-") 1*DIGIT) */ Rule NthRepeatNum() { return Sequence( DIGITS(), ZeroOrMoreS(SequenceS(FirstOf(',', '-').suppressNode(), DIGITS())) ).label(NthRepeatNum); } /**
/** * ifield-composer ::= %5B.%43.%3A *WSP tex-text-ifield %5D<p> * <tt>[C:..]</tt> */ Rule IfieldComposer() { return Sequence(String("[C:"), ZeroOrMore(WSP()).suppressNode(), TexTextIfield(), String("]")) .label(IfieldComposer); } /**
/** * ifield-source ::= %5B.%53.%3A *WSP tex-text-ifield %5D<p> * <tt>[S:..]</tt> */ Rule IfieldSource() { return Sequence(String("[S:"), ZeroOrMore(WSP()).suppressNode(), TexTextIfield(), String("]")) .label(IfieldSource); } /**
/** * field-lyrics ::= %x56.3A *WSP lyrics header-eol * <p><tt>w:</tt> formatted lyrics printed under staff */ Rule FieldLyrics() { return Sequence( String("w:"), ZeroOrMore(WSP()).suppressNode(), Lyrics(), HeaderEol()) .label(FieldLyrics); }
/** * xcom-indent ::= "indent" 1*WSP xcom-number xcom-unit */ Rule XcomIndent() { return Sequence(String("indent"), OneOrMore(WSP()).suppressNode(), XcomNumber(), XcomUnit()) .label(XcomIndent); } /**
Rule IUnusedField() { return Sequence(String("["), AnyOf("EIJYabcdefghijklnopqrstvxyz") .label(UnusedFieldLetter).suppressSubnodes(), String(":"), ZeroOrMore(WSP()).suppressNode(), TexTextIfield(), String("]")) .label(IUnusedField); } /**
public Rule JsonObject() { return Sequence( ZeroOrMore( WhiteSpace() ).skipNode(), "{ ", FirstOf( Sequence( Pair(), ZeroOrMore( Sequence( ", ", Pair() ) ) ), Optional( Pair() ) ).suppressNode(), "} " ); }