Package com.google.clearsilver.jsilver.exceptions

Examples of com.google.clearsilver.jsilver.exceptions.JSilverInterpreterException


    // Intepret new template.
    try {
      template.render(context);
    } catch (IOException e) {
      throw new JSilverInterpreterException(e.getMessage());
    }
  }
View Full Code Here


    LinkedList<PVariable> arguments = node.getArguments();
    String[] argumentNames = new String[arguments.size()];
    int i = 0;
    for (PVariable argument : arguments) {
      if (!(argument instanceof ANameVariable)) {
        throw new JSilverInterpreterException("Invalid name for macro '" + macroName
            + "' argument " + i + " : " + argument);
      }
      argumentNames[i++] = ((ANameVariable) argument).getWord().getText();
    }
    // TODO: Should we enforce that macro args can't repeat the same
View Full Code Here

    Macro macro = context.findMacro(macroName);

    // Make sure that the number of arguments passed to the macro match the
    // number expected.
    if (node.getArguments().size() != macro.getArgumentCount()) {
      throw new JSilverInterpreterException("Number of arguments to macro " + macroName + " ("
          + node.getArguments().size() + ") does not match " + "number of expected arguments ("
          + macro.getArgumentCount() + ")");
    }

    int numArgs = node.getArguments().size();
View Full Code Here

    // Evaluate expression.
    Value path = expressionEvaluator.evaluate(expression);

    String templateName = path.asString();
    if (!context.pushIncludeStackEntry(templateName)) {
      throw new JSilverInterpreterException(createIncludeLoopErrorMessage(templateName, context
          .getIncludedTemplateNames()));
    }

    loadAndRenderIncludedTemplate(templateName, ignoreMissingFile);
View Full Code Here

    try {
      // TODO: Execute lincludes (but not includes) in a separate
      // context.
      template.render(context);
    } catch (IOException e) {
      throw new JSilverInterpreterException(e.getMessage());
    }
  }
View Full Code Here

  @Override
  public String getArgumentName(int index) {
    if (index >= argumentNames.length) {
      // TODO: Make sure this behavior of failing if too many
      // arguments are passed to a macro is consistent with JNI / interpreter.
      throw new JSilverInterpreterException("Too many arguments supplied to macro " + macroName);
    }
    return argumentNames[index];
  }
View Full Code Here

TOP

Related Classes of com.google.clearsilver.jsilver.exceptions.JSilverInterpreterException

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.