Package xtc.tree

Examples of xtc.tree.Node


  }

  /** Actually parse org.netbeans.modules.scala.core.rats.ParserScala.XmlElementP. */
  private Result pXmlElementP$1(final int yyStart) throws IOException {
    Result     yyResult;
    Node       yyValue;
    ParseError yyError = ParseError.DUMMY;

    // Alternative 1.

    yyResult = pXmlEmptyElemTagP(yyStart);
    yyError  = yyResult.select(yyError);
    if (yyResult.hasValue()) {
      Node v$g$1 = yyResult.semanticValue();

      yyValue = GNode.create("XmlElementP", v$g$1);
      yyValue.setLocation(location(yyStart));

      return yyResult.createValue(yyValue, yyError);
    }

    // Alternative 2.

    yyResult = pXmlSTagP(yyStart);
    yyError  = yyResult.select(yyError);
    if (yyResult.hasValue()) {
      Node v$g$2 = yyResult.semanticValue();

      yyResult = pXmlElementP$$Star1(yyResult.index);
      yyError  = yyResult.select(yyError);
      if (yyResult.hasValue()) {
        Pair<Node> v$g$3 = yyResult.semanticValue();

        yyResult = pParserScala$XmlETag(yyResult.index);
        yyError  = yyResult.select(yyError);
        if (yyResult.hasValue()) {
          Node v$g$4 = yyResult.semanticValue();

          yyValue = GNode.create("XmlElementP", v$g$2, v$g$3, v$g$4);
          yyValue.setLocation(location(yyStart));

          return yyResult.createValue(yyValue, yyError);
View Full Code Here


  private Node replaceMatchArg(Node n, String id) {

    for (int i = 0; i < n.size(); i++) {
      Object o = n.get(i);
      if (o instanceof Node) {
        Node node = (Node)o;

        if (node.hasName("PrimaryIdentifier") &&
            node.getString(0).equals(id)) {
          node.set(0, node.getString(0).replace(id,"m"));
        } else if (node.hasName("PrimaryIdentifier") &&
                   node.getString(0).startsWith(id + ".")) {            
          node.set(0, node.getString(0).replace(id + ".", "m."));
        } else {
          replaceMatchArg(node, id);
        }      
      } else if ((o instanceof String) && id.equals(o)) {
        n.set(i, id);
View Full Code Here

    // Alternative 1.

    yyResult = pXmlContentP(yyStart);
    yyError  = yyResult.select(yyError);
    if (yyResult.hasValue()) {
      Node v$el$1 = yyResult.semanticValue();

      yyResult = pXmlElementP$$Star1(yyResult.index);
      yyError  = yyResult.select(yyError);
      if (yyResult.hasValue()) {
        Pair<Node> v$2 = yyResult.semanticValue();
View Full Code Here

   */
  private Result pXmlEmptyElemTagP(final int yyStart) throws IOException {
    Result     yyResult;
    int        yyOption1;
    String     yyOpValue1;
    Node       yyValue;
    ParseError yyError = ParseError.DUMMY;

    // Alternative 1.

    yyResult = pParserScala$XmlLt(yyStart);
    yyError  = yyResult.select(yyError);
    if (yyResult.hasValue()) {
      Node v$g$1 = yyResult.semanticValue();

      yyResult = pParserScala$XmlEmptyTagName(yyResult.index);
      yyError  = yyResult.select(yyError);
      if (yyResult.hasValue()) {
        Node v$g$2 = yyResult.semanticValue();

        yyOption1  = yyResult.index;
        yyOpValue1 = null;

        yyResult = pParserScala$xmlWs(yyOption1);
        yyError  = yyResult.select(yyError, yyOption1);
        if (yyResult.hasValue()) {
          String v$el$1 = yyResult.semanticValue();

          yyOption1  = yyResult.index;
          yyOpValue1 = v$el$1;
        }
        { // Start scope for v$g$3.
          String v$g$3 = yyOpValue1;

          yyResult = pParserScala$XmlSlashGt(yyOption1);
          yyError  = yyResult.select(yyError);
          if (yyResult.hasValue()) {
            Node v$g$4 = yyResult.semanticValue();

            yyValue = GNode.create("XmlEmptyElemTagP", v$g$1, v$g$2, v$g$3, v$g$4);
            yyValue.setLocation(location(yyStart));

            return yyResult.createValue(yyValue, yyError);
View Full Code Here

   */
  private Result pXmlSTagP(final int yyStart) throws IOException {
    Result     yyResult;
    int        yyOption1;
    String     yyOpValue1;
    Node       yyValue;
    ParseError yyError = ParseError.DUMMY;

    // Alternative 1.

    yyResult = pParserScala$XmlLt(yyStart);
    yyError  = yyResult.select(yyError);
    if (yyResult.hasValue()) {
      Node v$g$1 = yyResult.semanticValue();

      yyResult = pParserScala$XmlSTagName(yyResult.index);
      yyError  = yyResult.select(yyError);
      if (yyResult.hasValue()) {
        Node v$g$2 = yyResult.semanticValue();

        yyOption1  = yyResult.index;
        yyOpValue1 = null;

        yyResult = pParserScala$xmlWs(yyOption1);
        yyError  = yyResult.select(yyError, yyOption1);
        if (yyResult.hasValue()) {
          String v$el$1 = yyResult.semanticValue();

          yyOption1  = yyResult.index;
          yyOpValue1 = v$el$1;
        }
        { // Start scope for v$g$3.
          String v$g$3 = yyOpValue1;

          yyResult = pParserScala$XmlGt(yyOption1);
          yyError  = yyResult.select(yyError);
          if (yyResult.hasValue()) {
            Node v$g$4 = yyResult.semanticValue();

            yyValue = GNode.create("XmlSTagP", v$g$1, v$g$2, v$g$3, v$g$4);
            yyValue.setLocation(location(yyStart));

            return yyResult.createValue(yyValue, yyError);
View Full Code Here

  private Result pScalaExpr(final int yyStart) throws IOException {
    Result     yyResult;
    Result     yyPredResult;
    boolean    yyPredMatched;
    int        yyBase;
    Node       yyValue;
    ParseError yyError = ParseError.DUMMY;

    // Alternative 1.

    yyResult = psep(yyStart);
    if (yyResult.hasValue("{")) {

      yyPredMatched = false;

      yyPredResult = psep(yyResult.index);
      if (yyPredResult.hasValue("{")) {

        yyPredMatched = true;
      }

      if (! yyPredMatched) {

        yyResult = pBlock(yyResult.index);
        yyError  = yyResult.select(yyError);
        if (yyResult.hasValue()) {
          Node v$g$1 = yyResult.semanticValue();

          yyBase   = yyResult.index;
          yyResult = psep(yyBase);
          if (yyResult.hasValue("}")) {
View Full Code Here

  private Result pScalaPatterns(final int yyStart) throws IOException {
    Result     yyResult;
    Result     yyPredResult;
    boolean    yyPredMatched;
    int        yyBase;
    Node       yyValue;
    ParseError yyError = ParseError.DUMMY;

    // Alternative 1.

    yyResult = psep(yyStart);
    if (yyResult.hasValue("{")) {

      yyPredMatched = false;

      yyPredResult = psep(yyResult.index);
      if (yyPredResult.hasValue("{")) {

        yyPredMatched = true;
      }

      if (! yyPredMatched) {

        yyResult = pPatterns(yyResult.index);
        yyError  = yyResult.select(yyError);
        if (yyResult.hasValue()) {
          Node v$g$1 = yyResult.semanticValue();

          yyBase   = yyResult.index;
          yyResult = psep(yyBase);
          if (yyResult.hasValue("}")) {
View Full Code Here

  public Node visitListPattern(GNode n) {
    checkTypeAnnotation(n);
  
    String matchArg = (String)n.getProperty(MATCHARG);
   
    Node condition = (0 == n.size())
      ? factory.isEmptyCall(toIdentifier(matchArg))
      : factory.sizeEqual(toIdentifier(matchArg),
          toLiteral("IntegerLiteral", Integer.toString(n.size())));
   
    for (int i = 0; i < n.size(); i++) {
      Node node = n.getGeneric(i);
     
      if (node.hasName("WildCard")) continue;
     
      if (node.hasName("Variable")) {
        // fix cast here
        Object t = n.getProperty(TYPE);
        if (mapper.hasTypeVariables(t)) {
          ((Node)n.getProperty(BINDINGS)).add(makeVarDec2(node.getString(0),
          mapper.toTypeNode(mapper.getBase(t), false),
          toIdentifier(matchArg + ".get(" + i + ")")));
        } else {
          ((Node)n.getProperty(BINDINGS)).add(makeVarDec2(node.getString(0),
          mapper.toTypeNode(mapper.getBase(t), false),
          factory.cast(toIdentifier(matchArg + ".get(" + i + ")"))));
        }
        continue;
      }
     
      if (isLiteral(node)) {
        condition = factory.jand(condition,
         factory.jequals2((Node)dispatch(node),
                          toIdentifier(matchArg + ".get(" + i + ")")));
        continue;
      }

      node.setProperty(BINDINGS, n.getProperty(BINDINGS));
      node.setProperty(MATCHARG, matchArg + ".get(" + i + ")");
      condition = factory.jand(condition, (Node)dispatch(node));
    }

    if (n.hasProperty(TOP)) {
      Object t = n.getProperty(TYPE);
      Node listTypeNode = null;
      if (mapper.hasTypeVariables(t)) {
        listTypeNode = mapper.toTypeNode(t, true);
      } else {
        listTypeNode = mapper.toTypeNode(t, false);
     

      condition = replaceMatchArg(condition, matchArg);
     
      String matchName = table.freshJavaId("match");
      Match ms = null;
     
      ms = new Match(listTypeNode, condition);
           
      if (matches.containsKey(ms)) {
        matchName = matches.get(ms);       
      } else {
        matches.put(ms, matchName);
        Node matchFunction =
          factory.matchFunction(matchName, listTypeNode, condition);
    
        matchFunction.getGeneric(4).getGeneric(0).set(3, "m");
        staticFields.add(matchFunction);
      }
     
      return factory.matchCall(toIdentifier(output + "Support"), matchName,
        toIdentifier((String)n.getProperty(MATCHARG)));
View Full Code Here

  private Result pLiteral$1(final int yyStart) throws IOException {
    Result     yyResult;
    int        yyBase;
    int        yyOption1;
    String     yyOpValue1;
    Node       yyValue;
    ParseError yyError = ParseError.DUMMY;

    // Alternative 1.

    yyResult = pSKIP(yyStart);
    yyError  = yyResult.select(yyError);
    if (yyResult.hasValue()) {

      final int yyChoice1 = yyResult.index;

      // Nested alternative 1.

      yyOption1  = yyChoice1;
      yyOpValue1 = null;

      yyBase   = yyOption1;
      yyResult = pop(yyBase);
      if (yyResult.hasValue("-")) {
        String v$el$1 = "-";

        yyOption1  = yyResult.index;
        yyOpValue1 = v$el$1;
      } else {
        yyError = yyError.select("'-' expected", yyBase);
      }
      { // Start scope for v$g$1.
        String v$g$1 = yyOpValue1;

        final int yyChoice2 = yyOption1;

        // Nested alternative 1.

        yyResult = pFloatingPointLiteral(yyChoice2);
        yyError  = yyResult.select(yyError);
        if (yyResult.hasValue()) {
          Node v$g$2 = yyResult.semanticValue();

          yyValue = GNode.create("Literal", v$g$1, v$g$2);
          yyValue.setLocation(location(yyStart));

          return yyResult.createValue(yyValue, yyError);
        }

        // Nested alternative 2.

        yyResult = pIntegerLiteral(yyChoice2);
        yyError  = yyResult.select(yyError);
        if (yyResult.hasValue()) {
          Node v$g$3 = yyResult.semanticValue();

          yyValue = GNode.create("Literal", v$g$1, v$g$3);
          yyValue.setLocation(location(yyStart));

          return yyResult.createValue(yyValue, yyError);
        }
      } // End scope for v$g$1.

      // Nested alternative 2.

      yyResult = pBooleanLiteral(yyChoice1);
      yyError  = yyResult.select(yyError);
      if (yyResult.hasValue()) {
        Node v$g$4 = yyResult.semanticValue();

        yyValue = GNode.create("Literal", v$g$4);
        yyValue.setLocation(location(yyStart));

        return yyResult.createValue(yyValue, yyError);
      }

      // Nested alternative 3.

      yyResult = pNullLiteral(yyChoice1);
      yyError  = yyResult.select(yyError);
      if (yyResult.hasValue()) {
        Node v$g$5 = yyResult.semanticValue();

        yyValue = GNode.create("Literal", v$g$5);
        yyValue.setLocation(location(yyStart));

        return yyResult.createValue(yyValue, yyError);
      }

      // Nested alternative 4.

      yyResult = pCharacterLiteral(yyChoice1);
      yyError  = yyResult.select(yyError);
      if (yyResult.hasValue()) {
        Node v$g$6 = yyResult.semanticValue();

        yyValue = GNode.create("Literal", v$g$6);
        yyValue.setLocation(location(yyStart));

        return yyResult.createValue(yyValue, yyError);
      }

      // Nested alternative 5.

      yyResult = pStringLiteral(yyChoice1);
      yyError  = yyResult.select(yyError);
      if (yyResult.hasValue()) {
        Node v$g$7 = yyResult.semanticValue();

        yyValue = GNode.create("Literal", v$g$7);
        yyValue.setLocation(location(yyStart));

        return yyResult.createValue(yyValue, yyError);
      }

      // Nested alternative 6.

      yyResult = pSymbolLiteral(yyChoice1);
      yyError  = yyResult.select(yyError);
      if (yyResult.hasValue()) {
        Node v$g$8 = yyResult.semanticValue();

        yyValue = GNode.create("Literal", v$g$8);
        yyValue.setLocation(location(yyStart));

        return yyResult.createValue(yyValue, yyError);
View Full Code Here

   * @return The result.
   * @throws IOException Signals an I/O error.
   */
  private Result pBooleanLiteral(final int yyStart) throws IOException {
    Result     yyResult;
    Node       yyValue;
    ParseError yyError = ParseError.DUMMY;

    // Alternative 1.

    yyResult = pkey(yyStart);
    if (yyResult.hasValue("true")) {
      String v$g$1 = "true";

      yyValue = GNode.create("BooleanLiteral", v$g$1);
      yyValue.setLocation(location(yyStart));

      return yyResult.createValue(yyValue, yyError);
    }

    // Alternative 2.

    yyResult = pkey(yyStart);
    if (yyResult.hasValue("false")) {
      String v$g$2 = "false";

      yyValue = GNode.create("BooleanLiteral", v$g$2);
      yyValue.setLocation(location(yyStart));

      return yyResult.createValue(yyValue, yyError);
    }

    // Done.
View Full Code Here

TOP

Related Classes of xtc.tree.Node

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.