Examples of SyntaxException


Examples of Exceptions.Syntax.SyntaxException

            Match(new VT("TK_IR_A"));
            int valor = (int) E();
            saltar(valor);
            return;
        }
        throw new SyntaxException("Esperaba pinta, casa, avanza, giro, identificador, color, condicional (SI) o salto (ir_a).");
    }
View Full Code Here

Examples of com.sun.jsftemplating.layout.SyntaxException

      element = processComposition(parent, "src", attrs, id, false);
  } else if ("ui:param".equals(nodeName)) {
      // Handle "param"
      Node nameAttNode = attrs.getNamedItem("name");
      if (nameAttNode == null) {
    throw new SyntaxException("The 'name' attribute is required on 'param'.");
      }
      Node valueNode = attrs.getNamedItem("value");
      if (valueNode == null) {
    throw new SyntaxException("The 'value' attribute is required on 'param'.");
      }

      // For now only handle cases where the parent is a LayoutComposition
      if (!(parent instanceof LayoutComposition)) {
    throw new SyntaxException("<" + nodeName
        + " name='" + nameAttNode.getNodeValue()
        + "' value='" + valueNode.getNodeValue()
        + "'> must be child of a 'composition' element!");
      }
      // Set the name=value on the parent LayoutComposition
      ((LayoutComposition) parent).setParameter(
    nameAttNode.getNodeValue(), valueNode.getNodeValue());
  } else if ("ui:remove".equals(nodeName)) {
      // Let the element remain null
  } else if ("ui:repeat".equals(nodeName)) {
  } else if ("ui:event".equals(nodeName)) {
      // per Ken, we need to append "/>" to allow the handler parser code
      // to end correctly
      String body = node.getTextContent();
      body = (body == null) ? "/>" : (body.trim() + "/>");
      Node type = node.getAttributes().getNamedItem("type");
      if (type == null) {
    // Ensure type != null
    throw new SyntaxException(
        "The 'type' attribute is required on 'ui:event'!");
      }
      String eventName = type.getNodeValue();
      InputStream is = new ByteArrayInputStream(body.getBytes());
      EventParserCommand command = new EventParserCommand();
      try {
    TemplateParser parser = new TemplateParser(is);
    parser.open()// Needed to initialize things.
    // Setup the reader...
    TemplateReader reader = new TemplateReader("foo", parser); // TODO: get a real ID
    reader.pushTag("event"); // The tag will be popped at the end
    // Read the handlers...
    command.process(new BaseProcessingContext(),
      new ProcessingContextEnvironment(reader, parent, true), eventName);
    // Clean up
    parser.close();
      } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
      } finally {
    if (is != null) {
        try {
      is.close();
        } catch (Exception e) {
      // ignore
        }
    }
      }
  } else if ("ui:if".equals(nodeName)) {
      // Handle "if" conditions
      String condition = attrs.getNamedItem("condition").getNodeValue();
      element = new LayoutIf(parent, condition);
  } else if ("ui:foreach".equals(nodeName)) {
      // Handle "foreach" conditions
      Node valueNode = attrs.getNamedItem("value");
      if (valueNode == null) {
    throw new SyntaxException("The 'value' property is required on 'foreach'.");
      }
      Node varNode = attrs.getNamedItem("var");
      if (varNode == null) {
    throw new SyntaxException("The 'var' property is required on 'foreach'.");
      }

      element = new LayoutForEach(parent, valueNode.getNodeValue(), varNode.getNodeValue());
  } else if ("f:facet".equals(nodeName)) {
      // FIXME: Need to take NameSpace into account
View Full Code Here

Examples of jp.ac.kobe_u.cs.prolog.lang.SyntaxException

    a2 = arg2;

    a1 = a1.dereference();
    a2 = a2.dereference();
    if (a2.isNil()) {
      throw new SyntaxException(this, 2, "character_code_list", a2, "");
    }
    if (a1.isVariable()) { // number_codes(-Number, +CharCodeList)
      StringBuffer sb = new StringBuffer();
      Term x = a2;
      while (!x.isNil()) {
        if (x.isVariable()) {
          throw new PInstantiationException(this, 2);
        }
        if (!x.isList()) {
          throw new IllegalTypeException(this, 2, "list", a2);
        }
        Term car = ((ListTerm) x).car().dereference();
        if (car.isVariable()) {
          throw new PInstantiationException(this, 2);
        }
        if (!car.isInteger()) {
          throw new RepresentationException(this, 2, "character_code");
        }
        // car is an integer
        int i = ((IntegerTerm) car).intValue();
        if (!Character.isDefined((char) i)) {
          throw new RepresentationException(this, 2, "character_code");
        }
        sb.append((char) i);
        x = ((ListTerm) x).cdr().dereference();
      }
      try {
        if (!a1.unify(new IntegerTerm(Integer.parseInt(sb.toString())),
            engine.trail)) {
          return engine.fail();
        }
        return cont;
      } catch (NumberFormatException e) {
      }
      try {
        if (!a1.unify(
            new DoubleTerm(Double.parseDouble(sb.toString())),
            engine.trail)) {
          return engine.fail();
        }
        return cont;
      } catch (NumberFormatException e) {
        throw new SyntaxException(this, 2, "character_code_list", a2,
            "");
      }
    } else if (a1.isNumber()) { // number_codes(+Number, ?CharCodeList)
      char[] chars = a1.toString().toCharArray();
      Term y = Nil;
View Full Code Here

Examples of jp.ac.kobe_u.cs.prolog.lang.SyntaxException

    a2 = arg2;

    a1 = a1.dereference();
    a2 = a2.dereference();
    if (a2.isNil()) {
      throw new SyntaxException(this, 2, "character_code_list", a2, "");
    }
    if (a1.isVariable()) { // number_chars(-Number, +CharList)
      if (a2.isVariable()) {
        throw new PInstantiationException(this, 2);
      } else if (!a2.isList()) {
        throw new IllegalTypeException(this, 2, "list", a2);
      }
      StringBuffer sb = new StringBuffer();
      Term x = a2;
      while (!x.isNil()) {
        if (x.isVariable()) {
          throw new PInstantiationException(this, 2);
        }
        if (!x.isList()) {
          throw new IllegalTypeException(this, 2, "list", a2);
        }
        Term car = ((ListTerm) x).car().dereference();
        if (car.isVariable()) {
          throw new PInstantiationException(this, 2);
        }
        if (!car.isSymbol() || ((SymbolTerm) car).name().length() != 1) {
          throw new IllegalTypeException(this, 2, "character", a2);
        }
        sb.append(((SymbolTerm) car).name());
        x = ((ListTerm) x).cdr().dereference();
      }
      try {
        if (!a1.unify(new IntegerTerm(Integer.parseInt(sb.toString())),
            engine.trail)) {
          return engine.fail();
        }
        return cont;
      } catch (NumberFormatException e) {
      }
      try {
        if (!a1.unify(
            new DoubleTerm(Double.parseDouble(sb.toString())),
            engine.trail)) {
          return engine.fail();
        }
        return cont;
      } catch (NumberFormatException e) {
        throw new SyntaxException(this, 2, "character_code_list", a2,
            "");
      }
    } else if (a1.isNumber()) { // number_chars(+Number, ?CharList)
      String s = a1.toString();
      Term y = Nil;
View Full Code Here

Examples of juzu.impl.router.regex.SyntaxException

      switch (status) {
        case EXPR_BEGIN: {
          if (from < to) {
            char c = s.charAt(from);
            if (c == '}') {
              throw new SyntaxException(CODE_MISSING_EXPR_IDENT, "Missing expression identifier at " + from, Location.at(1 + from));
            } else {
              status = EXPR_IDENT;
              break;
            }
          } else {
            throw new SyntaxException(CODE_UNCLOSED_EXPR, "Unclosed expression at " + from, Location.at(1 + from));
          }
        }
        case EXPR_IDENT: {
          if (from < to) {
            char c = s.charAt(from);
            if (c == '}') {
              handler.exprIdent(s, pos, from);
              return ++from;
            } else {
              ++from;
              break;
            }
          } else {
            throw new SyntaxException(CODE_UNCLOSED_EXPR, "Unclosed expression at " + from, Location.at(1 + from));
          }
        }
        default:
          throw new UnsupportedOperationException("todo");
      }
View Full Code Here

Examples of lipstone.joshua.parser.exceptions.SyntaxException

        found = true;
      }
     
      //If there aren't any matches
      if (!found)
        throw new SyntaxException(input, null);
    }
    if (!parenStack.isEmpty())
      throw new UnbalancedParenthesesException(parens.peek(), input, null);
    return result;
  }
View Full Code Here

Examples of net.mindengine.galen.parser.SyntaxException

    }

    @Override
    public Spec processSpec(String specName, String paramsText, String contextPath) {
        if (paramsText == null || paramsText.isEmpty()) {
            throw new SyntaxException(UNKNOWN_LINE, "Missing parameters for spec");
        }
        else {
           
            String []arr = paramsText.split(",");
            List<String> childObjectList = new LinkedList<String>();
View Full Code Here

Examples of org.apache.cassandra.exceptions.SyntaxException

    protected final Map<String, Object> properties = new HashMap<String, Object>();

    public void addProperty(String name, String value) throws SyntaxException
    {
        if (properties.put(name, value) != null)
            throw new SyntaxException(String.format("Multiple definition for property '%s'", name));
    }
View Full Code Here

Examples of org.apache.cassandra.exceptions.SyntaxException

        Map<String, String> lowerCased = new HashMap<String, String>(value.size());
        for (Map.Entry<String, String> entry : value.entrySet())
            lowerCased.put(entry.getKey().toLowerCase(), entry.getValue());

        if (properties.put(name, lowerCased) != null)
            throw new SyntaxException(String.format("Multiple definition for property '%s'", name));
    }
View Full Code Here

Examples of org.apache.cassandra.exceptions.SyntaxException

                continue;

            if (obsolete.contains(name))
                logger.warn("Ignoring obsolete property {}", name);
            else
                throw new SyntaxException(String.format("Unknown property '%s'", name));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.