Package net.sf.laja.parser.engine2

Examples of net.sf.laja.parser.engine2.ParsingResult


      element = getGrammar2();
      match = element.parse(0, source, false, true, true);
      if (!match) {
        throw new IllegalStateException("The parsing result was true in phase 1, but false in phase 2.");
      }
      return new ParsingResult(true, source, syntaxErrorHandler);
    } else if (sourceRecorderLogWriter != null) {
      source.reset();
      source.getRecorder().setLogging(sourceRecorderLogWriter, bestIndex);
      element.parse(0, source, false, true, false);
    }

    return new ParsingResult(false, source, element, syntaxErrorHandler);
  }
View Full Code Here


            element = getGrammar2();
            match = element.parse(0, source, false, true, true);
            if (!match) {
                throw new IllegalStateException("The parsing result was true in phase 1, but false in phase 2.");
            }
            return new ParsingResult(true, source, syntaxErrorHandler);
        } else if (sourceRecorderLogWriter != null) {
            source.reset();
            source.getRecorder().setLogging(sourceRecorderLogWriter, bestIndex);
            element.parse(0, source, false, true, false);
        }

        return new ParsingResult(false, source, element, syntaxErrorHandler);
    }
View Full Code Here

      element = getGrammar2();
      match = element.parse(0, source, false, true, true);
      if (!match) {
        throw new IllegalStateException("The parsing result was true in phase 1, but false in phase 2.");
      }
      return new ParsingResult(true, source, syntaxErrorHandler);
    } else if (sourceRecorderLogWriter != null) {
      source.reset();
      source.getRecorder().setLogging(sourceRecorderLogWriter, bestIndex);
      element.parse(0, source, false, true, false);
    }

    return new ParsingResult(false, source, element, syntaxErrorHandler);
  }
View Full Code Here

        return new TemplateFactory(sourceString, templateTextWriter, namespaces, classes, groovyClassLoader);
      }
    });
   
    StringSource source = new StringSource(statement);
    ParsingResult result = parser.parse(source);

    if (!result.success()) {
      throw new LajaException("Could not parse statement \"" + statement + "\"");
    }

    TemplateFactory templateFactory = (TemplateFactory)parser.getFactory();
    return templateFactory.getBaseTemplate();
View Full Code Here

      public ITemplateFactory getFactory(int phase) {
        return new TemplateFactory(sourceFile, templateTextWriter, namespaces, classes, groovyClassLoader);
      }
    });

    ParsingResult result = parser.parseFile(filename);

    if (!result.success()) {
      throw new LajaException("Could not parse template  \"" + filename + "\"");
    }

    TemplateFactory templateFactory = (TemplateFactory)parser.getFactory();
    return templateFactory.getBaseTemplate();
View Full Code Here

   *
   * @param context
   * @return
   */
  private static GeneratorResult execute(String grammarFile, final boolean forwardRef) {
    final Writer writer = new PrintWriter();
   
    // TODO: Fix this!
    ParsingSettings parsingSettings = new ParsingSettings() {
      @Override
      public boolean isForwardRef() {
        return forwardRef;
      }
    };
    grammarFile = Util.replaceSlash(grammarFile);
   
    writer.writeln("  Reading grammar \"" + grammarFile + "\"");
   
    GrammarParser parser = new GrammarParser(new IGrammarFactoryFactory() {
      public IGrammarFactory getFactory(int phase) {
        return new ParserFactory(writer);
      }}
View Full Code Here

   *
   * @param context
   * @return
   */
  private static GeneratorResult execute(String grammarFile, final boolean forwardRef) {
    final Writer writer = new PrintWriter();
   
    // TODO: Fix this!
    ParsingSettings parsingSettings = new ParsingSettings() {
      @Override
      public boolean isForwardRef() {
        return forwardRef;
      }
    };
    grammarFile = Util.replaceSlash(grammarFile);
   
    writer.writeln("  Reading grammar \"" + grammarFile + "\"");
   
    GrammarParser parser = new GrammarParser(new IGrammarFactoryFactory() {
      public IGrammarFactory getFactory(int phase) {
        return new ParserFactory(writer);
      }}
View Full Code Here

        conditionElement.add(468, conditionElement_1);
        conditionElement.add(469, s);
        OrList conditionElement_2 = new OrList(470, "conditionElement_2");
        conditionElement_2.add(471, comparition, conditionElementConditionElementComparition);
        ElementList conditionElement_2_1 = new ElementList(472, "conditionElement_2_1");
        AndList conditionElement_2_1_1 = new AndList(473, "conditionElement_2_1_1");
        conditionElement_2_1_1.mainAnd(474, reference, conditionElementConditionElementReference);
        ElementList conditionElement_2_1_1_1 = new ElementList(475, "conditionElement_2_1_1_1");
        conditionElement_2_1_1_1.add(476, booleanData, NOT, conditionElementConditionElementBooleanData);
        conditionElement_2_1_1_1.add(478, new Complete(477, "conditionElement_2_1_1_1"));
        conditionElement_2_1_1.and(479, conditionElement_2_1_1_1);
        conditionElement_2_1.add(480, conditionElement_2_1_1);
        conditionElement_2.add(481, conditionElement_2_1);
        conditionElement_2.add(482, booleanData, conditionElementConditionElementBooleanCondition);
        conditionElement.add(483, conditionElement_2);
View Full Code Here

        Optional behaviour_4_1_2 = new Optional(277, "behaviour_4_1_2");
        behaviour_4_1_2.add(278, behaviourMethod);
        behaviour_4_1.add(279, behaviour_4_1_2);
        behaviour_4.add(280, behaviour_4_1);
        behaviour.add(281, behaviour_4);
        behaviour.add(283, new Complete(282, "behaviour"));

        return new TopElement(data2, behaviour);
    }
View Full Code Here

        Optional behaviour_4_1_2 = new Optional(277, "behaviour_4_1_2");
        behaviour_4_1_2.add(278, behaviourMethod);
        behaviour_4_1.add(279, behaviour_4_1_2);
        behaviour_4.add(280, behaviour_4_1);
        behaviour.add(281, behaviour_4);
        behaviour.add(283, new Complete(282, "behaviour"));

        return new TopElement(data1, behaviour);
    }
View Full Code Here

TOP

Related Classes of net.sf.laja.parser.engine2.ParsingResult

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.