Examples of buildSets()


Examples of net.sf.lapg.lex.RegexpParser.buildSets()

      Assert.assertEquals("[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1]", Arrays.toString(rp.getCharacterMap()));

      rp = new RegexpParser();
      rp.compile(0, "string", "[a-zA-Z_][a-zA-Z0-9_]*");
      rp.compile(1, "keyw", "do");
      rp.buildSets();
      Assert.assertEquals("[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1]", Arrays.toString(rp.getCharacterMap()));

      rp = new RegexpParser();
      rp.compile(0, "string", "[a-w][p-z]");
      rp.compile(1, "string2", "[b-c][y-z]");
View Full Code Here

Examples of net.sf.lapg.lex.RegexpParser.buildSets()

      Assert.assertEquals("[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1]", Arrays.toString(rp.getCharacterMap()));

      rp = new RegexpParser();
      rp.compile(0, "string", "[a-w][p-z]");
      rp.compile(1, "string2", "[b-c][y-z]");
      rp.buildSets();
      Assert.assertEquals("[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 3, 6, 6, 1, 1, 1, 1, 1]", Arrays.toString(rp.getCharacterMap()));
      int[][] p = rp.getSetToSymbolsMap();
      Assert.assertEquals("[2, 4, 5]", Arrays.toString(p[0]));
      Assert.assertEquals("[3, 4, 6]", Arrays.toString(p[1]));
      Assert.assertEquals("[5]", Arrays.toString(p[2]));
View Full Code Here

Examples of net.sf.lapg.lex.RegexpParser.buildSets()

    int[] expected = new int[0x8000];
    Arrays.fill(expected, 1);
    Arrays.fill(expected, 0x5151, 0x5252+1, 2);
    Arrays.fill(expected, 0x1000, 0x2000+1, 3);
    expected[0] = 0;
    rp.buildSets();
    Assert.assertEquals(Arrays.toString(expected), Arrays.toString(rp.getCharacterMap()));
  }

  public void testHexConverter() {
    Assert.assertEquals(0, RegexpParser.parseHex("0"));
View Full Code Here

Examples of net.sf.lapg.lex.RegexpParser.buildSets()

        rp.compile(i, "nb"+i, "[\\x"+toHex4(i*10+3)+"-\\x"+toHex4(i*10+8)+"]");
      }
    } catch(RegexpParseException ex) {
      Assert.fail("parse failed: " + ex.getMessage());
    }
    rp.buildSets();

    Assert.assertEquals(6002, rp.getSymbolCount());
  }

  public void testRegexpParserInvertedSet() {
View Full Code Here

Examples of net.sf.lapg.lex.RegexpParser.buildSets()

      rp.compile(0, "string", "'[^'\n]+'");
      rp.compile(1, "percent", "%");
    } catch(RegexpParseException ex) {
      Assert.fail("parse failed: " + ex.getMessage());
    }
    rp.buildSets();
    Assert.assertEquals("[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]", Arrays.toString(rp.getCharacterMap()));

    int[] character2sym = rp.getCharacterMap();
    Assert.assertEquals(character2sym['%'], 3);
    Assert.assertEquals(character2sym['\''], 2);
View Full Code Here

Examples of net.sf.lapg.lex.RegexpParser.buildSets()

  public void testRegexpParser() {
    RegexpParser rp = new RegexpParser();
    try {
      rp.compile(0, "string", "[a-zA-Z_][a-zA-Z0-9_]*");
      rp.buildSets();
      Assert.assertEquals("[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1]", Arrays.toString(rp.getCharacterMap()));

      rp = new RegexpParser();
      rp.compile(0, "string", "[a-zA-Z_][a-zA-Z0-9_]*");
      rp.compile(1, "keyw", "do");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.