Package net.sf.lapg.templates.ast

Examples of net.sf.lapg.templates.ast.AstParser$ParseException


      if (mode == EvaluationMode.DEMO) {
        this.enableOrDisableButtons(queryOrRif);
      }
      return true;
    } else if (e instanceof ParseException) {
      final ParseException pe = (ParseException) e;
      this.displayErrorMessage(pe.getMessage(), false, queryOrRif);

      int line;
      int column;

      // get precise line and column...
      if (pe.currentToken.next == null) {
        line = pe.currentToken.beginLine;
        column = pe.currentToken.beginColumn;
      } else {
        line = pe.currentToken.next.beginLine;
        column = pe.currentToken.next.beginColumn;
      }

      this.setErrorPosition(line, column, queryOrRif);
      if (mode == EvaluationMode.DEMO) {
        this.enableOrDisableButtons(queryOrRif);
      }
      return true;
    } else if(e instanceof lupos.rif.generated.parser.ParseException){
      final lupos.rif.generated.parser.ParseException pe = (lupos.rif.generated.parser.ParseException) e;
      this.displayErrorMessage(pe.getMessage(), false, queryOrRif);

      int line;
      int column;

      // get precise line and column...
View Full Code Here


  public void handleParseError(Throwable t) throws ModificationException {
    int line = 0;
    int column = 0;

    if(t instanceof ParseException) {
      ParseException pe = (ParseException) t;

      // get precise line and column...
      if(pe.currentToken.next == null) {
        line = pe.currentToken.beginLine;
        column = pe.currentToken.beginColumn;
View Full Code Here

    return t.invoke(new EvaluationContext(context != null ? context.getThisObject() : null, context, t), this, arguments);
  }

  public String eval(ILocatedEntity referer, String template, String templateId, EvaluationContext context) {
    final String inputName = templateId != null ? templateId : referer.getLocation();
    AstParser p = new AstParser(new ErrorReporter() {
      public void error(int start, int end, int line, String s) {
        DefaultEvaluationStrategy.this.fireError(null, inputName + ":" + s);
      }
    });
    IBundleEntity[] loaded = null;
    if (!p.parseBody(template, "syntax", inputName)) {
      loaded = new ITemplate[0];
    } else {
      loaded = p.getResult();
    }

    ITemplate t = loaded != null && loaded.length == 1
        && loaded[0].getKind() == IBundleEntity.KIND_TEMPLATE
        && loaded[0].getName().equals("inline")
View Full Code Here

    return entities;
  }

  public static TemplatesBundle parse(final String sourceName, String contents, String templatePackage,
      final IProblemCollector collector) {
    AstParser p = new AstParser(new ErrorReporter() {
      public void error(int start, int end, int line, String s) {
        collector.fireError(null, sourceName + ":" + s);
      }
    });
    IBundleEntity[] entities;
    if (!p.parse(contents, templatePackage, sourceName)) {
      entities = new IBundleEntity[0];
    } else {
      entities = p.getResult();
    }
    return new TemplatesBundle(sourceName, entities);
  }
View Full Code Here

TOP

Related Classes of net.sf.lapg.templates.ast.AstParser$ParseException

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.