Search in sources :

Example 1 with Sequence

use of org.apache.felix.gogo.runtime.Parser.Sequence in project felix by apache.

the class TestParser method testParentheses.

@Test
public void testParentheses() {
    Parser parser = new Parser("(a|b)|(d|f)");
    Program p = parser.program();
    assertEquals("a|b", ((Sequence) ((Statement) ((Pipeline) p.tokens().get(0)).tokens().get(0)).tokens().get(0)).program().toString());
    parser = new Parser("grep (d.*)|grep (d|f)");
    p = parser.program();
    assertEquals("d.*", ((Sequence) ((Statement) ((Pipeline) p.tokens().get(0)).tokens().get(0)).tokens().get(1)).program().toString());
}
Also used : Program(org.apache.felix.gogo.runtime.Parser.Program) Statement(org.apache.felix.gogo.runtime.Parser.Statement) Sequence(org.apache.felix.gogo.runtime.Parser.Sequence) Pipeline(org.apache.felix.gogo.runtime.Parser.Pipeline) Test(org.junit.Test)

Aggregations

Pipeline (org.apache.felix.gogo.runtime.Parser.Pipeline)1 Program (org.apache.felix.gogo.runtime.Parser.Program)1 Sequence (org.apache.felix.gogo.runtime.Parser.Sequence)1 Statement (org.apache.felix.gogo.runtime.Parser.Statement)1 Test (org.junit.Test)1