Package net.sf.lapg.templates.ast

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


    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

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.