ISO14977 extends BnfWriter { @Override protected void literal( String value ) { enclose( value ); } private  ISO14977( Output output ); static void write( Grammar grammar, Writer writer ); static void write( Grammar grammar, OutputStream stream ); static void write( Grammar grammar, Output output ); static void main( String... args ); static void append( Grammar.Term term, Output output ); static Output string( Output str, Production production ); static void html( HtmlTag parent, Production production, HtmlLinker linker );  }
@Test public void shouldRenderLiteral() throws Exception { verify( production( "foo", literal( "FOO" ) ), "foo = 'FOO' ;" ); }
@Test public void shouldRenderLiteralContainingMultipleQuotes() throws Exception { verify( production( "literals", literal( "'\"\"'" ) ), "literals = \"'\", '\"\"', \"'\" ;" ); verify( production( "literals", oneOf( literal( "'\"\"'" ), literal( "\"''\"" ) ) ), "literals = (\"'\", '\"\"', \"'\")", " | ('\"', \"''\", '\"')", " ;" ); }
@Test public void shouldRenderAlternativesOfProduction() throws Exception { verify( production( "one", literal( "A" ), literal( "B" ) ), "one = 'A'", " | 'B'", " ;" ); }
@Test public void shouldRenderSequenceWithAlternatives() throws Exception { verify( production( "something", sequence( literal( "A" ), oneOf( literal( "B" ), literal( "C" ) ), literal( "D" ) ) ), "something = 'A', ('B' | 'C'), 'D' ;" ); }
@Test public void shouldRenderAlternativeSequences() throws Exception { verify( production( "alts", sequence( literal( "A" ), literal( "B" ) ), sequence( literal( "C" ), literal( "D" ) ) ), "alts = ('A', 'B')", " | ('C', 'D')", " ;" ); }
@Test public void shouldRenderRepetitionWithMin() throws Exception { verify( production( "repeat", atLeast( 3, literal( "hello" ) ) ), "repeat = 3 * 'hello', { 'hello' } ;" ); }
@Test public void shouldRenderOneOrMore() throws Exception { verify( production( "repeat", oneOrMore( literal( "hello" ) ) ), "repeat = { 'hello' }- ;" ); }
@Test public void shouldRenderZeroOrMore() throws Exception { verify( production( "repeat", zeroOrMore( literal( "hello" ) ) ), "repeat = { 'hello' } ;" ); }
@Test public void shouldRenderOptional() throws Exception { verify( production( "opt", optional( literal( "foo" ) ) ), "opt = ['foo'] ;" ); }