Package hampi.grammars.parser

Examples of hampi.grammars.parser.Parser


    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "expr", 3, false);
    assertNull(boundedRegexp);
  }

  public void test3() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "test_generate_parent.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "expr", 4, false);
    System.out.println(boundedRegexp);
    assertTrue(!boundedRegexp.matches("()"));
    assertTrue(boundedRegexp.matches("(())"));
View Full Code Here


    assertTrue(!boundedRegexp.matches("(((("));

  }

  public void test4() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "test_generate_parent.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "expr", 5, false);
    assertNull(boundedRegexp);
  }
View Full Code Here

    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "expr", 5, false);
    assertNull(boundedRegexp);
  }

  public void test5() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "test_generate_parent.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "expr", 150, false);
    assertNotNull(boundedRegexp);
  }
View Full Code Here

    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "expr", 150, false);
    assertNotNull(boundedRegexp);
  }

  public void test6() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "test_arithm.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    int bound = 40;
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", bound, false);
    assertNotNull(boundedRegexp);
  }
View Full Code Here

    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", bound, false);
    assertNotNull(boundedRegexp);
  }

  public void testSmallSQL() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "small_sql.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "Select", 20, true);
    assertNotNull(boundedRegexp);
  }
View Full Code Here

    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "Select", 20, true);
    assertNotNull(boundedRegexp);
  }

  public void testEcmascript() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "ecmascript.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "FunctionDeclaration", 27, true);
    assertNotNull(boundedRegexp);
  }
View Full Code Here

    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "FunctionDeclaration", 27, true);
    assertNotNull(boundedRegexp);
  }

  public void testTinySQL() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "tiny_SQL.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "SelectStmt", 26, false);
    //"SELECT" is one terminal and 6 characters
    assertNotNull(boundedRegexp);
    //    System.out.println(boundedRegexp);
View Full Code Here

    }
  }

  //stack overflow because of production T = T;
  public void testUselessProductionCycle1() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "testUselessProductionCycle1.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", 1, false);
    assertNotNull(boundedRegexp);
  }
View Full Code Here

    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", 1, false);
    assertNotNull(boundedRegexp);
  }

  public void testUselessProductionCycle2() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "testUselessProductionCycle2.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", 3, false);
    assertNotNull(boundedRegexp);
  }
View Full Code Here

public class GrammarTests extends TestCase{

  public static final String DIR = "tests/resources/";

  public void testCopy1() throws Exception{
    Grammar g = new Parser(DIR + "test_cyk1.txt").parse();
    Grammar g1 = g.makeCopy();
    assertEquals(g.toString(), g1.toString());
    assertEquals(g, g1);
    assertTrue(g != g1);
  }
View Full Code Here

TOP

Related Classes of hampi.grammars.parser.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.