Search in sources :

Example 6 with Pipeline

use of org.apache.felix.gogo.runtime.Parser.Pipeline 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)6 Statement (org.apache.felix.gogo.runtime.Parser.Statement)6 Program (org.apache.felix.gogo.runtime.Parser.Program)5 Test (org.junit.Test)5 PipedInputStream (java.io.PipedInputStream)1 PipedOutputStream (java.io.PipedOutputStream)1 Channel (java.nio.channels.Channel)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Executable (org.apache.felix.gogo.runtime.Parser.Executable)1 Operator (org.apache.felix.gogo.runtime.Parser.Operator)1 Sequence (org.apache.felix.gogo.runtime.Parser.Sequence)1 Result (org.apache.felix.gogo.runtime.Pipe.Result)1