Package net.sf.lapg.api

Examples of net.sf.lapg.api.Symbol


    public String[] getSamples() {
      return samples;
    }

    public Symbol getSymbol() {
      return new Symbol() {
        public boolean isTerm() {
          throw new NotImplementedException();
        }

        public boolean isDefined() {
View Full Code Here


    Assert.assertNotNull(g);

    Rule[] listItemRules = rulesForName(g.getRules(), "list_item");
    Assert.assertEquals(2, listItemRules.length);

    Symbol s = listItemRules[0].getLeft();
    Assert.assertEquals(5, s.getAnnotation("weight"));
    Assert.assertEquals("wwo", s.getAnnotation("name"));

    Assert.assertEquals("rule1", listItemRules[0].getAnnotation("name"));
    Assert.assertEquals("rule2", listItemRules[1].getAnnotation("name"));

    Object val = listItemRules[0].getRight()[0].getAnnotation("ids");
    Assert.assertTrue(val instanceof List<?>);

    List<?> list = (List<?>) val;
    Assert.assertEquals(3, list.size());
    Assert.assertEquals(4, list.get(0));
    Assert.assertEquals(2, list.get(1));
    Assert.assertEquals(3, list.get(2));

    Rule[] inputRules = rulesForName(g.getRules(), "input");
    Assert.assertEquals(1, inputRules.length);
    Symbol input = inputRules[0].getLeft();

    Assert.assertNotNull(input);
    Object refval = input.getAnnotation("ref");
    Assert.assertNotNull(refval);
    Assert.assertTrue(refval instanceof Symbol);
    Assert.assertTrue(refval == s);
  }
View Full Code Here

TOP

Related Classes of net.sf.lapg.api.Symbol

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.