Package org.apache.felix.gogo.runtime

Examples of org.apache.felix.gogo.runtime.Parser


        assertEquals(5, c.execute("[1 2 [3 4] 5 6] size"));
    }

    public void testParentheses()
    {
        Parser parser = new Parser("(a|b)|(d|f)");
        List<List<List<Token>>> p = parser.program();
        assertEquals("a|b", p.get(0).get(0).get(0).toString());

        parser = new Parser("grep (d.*)|grep (d|f)");
        p = parser.program();
        assertEquals("d.*", p.get(0).get(0).get(1).toString());
    }
View Full Code Here


        System.out.println("]");
    }

    public void testProgram()
    {
        List<List<List<Token>>> x = new Parser("abc def|ghi jkl;mno pqr|stu vwx").program();
        assertEquals("abc", x.get(0).get(0).get(0).toString());
        assertEquals("def", x.get(0).get(0).get(1).toString());
        assertEquals("ghi", x.get(0).get(1).get(0).toString());
        assertEquals("jkl", x.get(0).get(1).get(1).toString());
        assertEquals("mno", x.get(1).get(0).get(0).toString());
View Full Code Here

        assertEquals("vwx", x.get(1).get(1).get(1).toString());
    }

    public void testStatements()
    {
        List<List<Token>> x = new Parser("abc def|ghi jkl|mno pqr").program().get(0);
        assertEquals("abc", x.get(0).get(0).toString());
        assertEquals("def", x.get(0).get(1).toString());
        assertEquals("ghi", x.get(1).get(0).toString());
        assertEquals("jkl", x.get(1).get(1).toString());
        assertEquals("mno", x.get(2).get(0).toString());
View Full Code Here

        assertEquals("pqr", x.get(2).get(1).toString());
    }

    public void testSimpleValue()
    {
        List<Token> x = new Parser(
            "abc def.ghi http://www.osgi.org?abc=&x=1 [1,2,3] {{{{{{{xyz}}}}}}} (immediate) {'{{{{{'} {\\{} 'abc{}'")
            .program().get(0).get(0);
        assertEquals("abc", x.get(0).toString());
        assertEquals("def.ghi", x.get(1).toString());
        assertEquals("http://www.osgi.org?abc=&x=1", x.get(2).toString());
View Full Code Here

        return Tokenizer.expand(word, evaluate);
    }

    public void testParser() throws Exception
    {
        new Parser("// comment\n" + "a=\"who's there?\"; ps -ef;\n" + "ls | \n grep y\n").program();
        String p1 = "a=1 \\$b=2 c={closure}\n";
        new Parser(p1).program();
        new Parser(new Token(Type.ARRAY, p1, (short) 0, (short) 0)).program();
    }
View Full Code Here

                if (command.length() > 0 && !" ".equals(command)) {
                    reader.getHistory().replace(command);   
                }                               
            }
            try {
                new Parser(command).program();
                loop = false;
            } catch (Exception e) {
                loop = true;
                first = false;
            }
View Full Code Here

                reader.getHistory().add(command);
            } else {
                reader.getHistory().replace(command);
            }
            try {
                new Parser(command).program();
                loop = false;
            } catch (Exception e) {
                loop = true;
                first = false;
            }
View Full Code Here

                reader.getHistory().add(command);
            } else {
                reader.getHistory().replace(command);
            }
            try {
                new Parser(command).program();
                loop = false;
            } catch (Exception e) {
                loop = true;
                first = false;
            }
View Full Code Here

                reader.getHistory().add(command);
            } else {
                reader.getHistory().replace(command);
            }
            try {
                new Parser(command).program();
                loop = false;
            } catch (Exception e) {
                loop = true;
                first = false;
            }
View Full Code Here

                if (command.length() > 0 && !" ".equals(command)) {
                    reader.getHistory().replace(command);   
                }                               
            }
            try {
                new Parser(command).program();
                loop = false;
            } catch (Exception e) {
                loop = true;
                first = false;
            }
View Full Code Here

TOP

Related Classes of org.apache.felix.gogo.runtime.Parser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.