0001: // ===========================================================================
0002: // This file has been generated by
0003: // xtc Factory Factory, version 1.13.2,
0004: // (C) 2004-2007 Robert Grimm,
0005: // on Thursday, November 29, 2007 at 10:09:19 PM.
0006: // Edit at your own risk.
0007: // ===========================================================================
0008:
0009: package xtc.typical;
0010:
0011: import java.util.List;
0012:
0013: import xtc.tree.Node;
0014: import xtc.tree.GNode;
0015:
0016: /**
0017: * Node factory <code>xtc.typical.TreeFactory</code>.
0018: *
0019: * <p />This class has been generated by
0020: * the xtc Factory Factory, version 1.13.2,
0021: * (C) 2004-2007 Robert Grimm.
0022: */
0023: public class TreeFactory {
0024:
0025: /** Create a new node factory. */
0026: public TreeFactory() {
0027: // Nothing to do.
0028: }
0029:
0030: /**
0031: * Create a call expression.
0032: *
0033: * @param argument1 The argument1.
0034: * @param argument2 The argument2.
0035: * @return The generic node.
0036: */
0037: public Node addInt(Node argument1, Node argument2) {
0038: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
0039: Node v$2 = GNode.create("SelectionExpression", v$1, "addInt");
0040: Node v$3 = GNode.create("Arguments", argument1, argument2);
0041: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
0042: v$3);
0043: return v$4;
0044: }
0045:
0046: /**
0047: * Create a call expression.
0048: *
0049: * @param argument1 The argument1.
0050: * @param argument2 The argument2.
0051: * @return The generic node.
0052: */
0053: public Node addFloat64(Node argument1, Node argument2) {
0054: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
0055: Node v$2 = GNode.create("SelectionExpression", v$1,
0056: "addFloat64");
0057: Node v$3 = GNode.create("Arguments", argument1, argument2);
0058: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
0059: v$3);
0060: return v$4;
0061: }
0062:
0063: /**
0064: * Create an expression statement.
0065: *
0066: * @param arg The arg.
0067: * @return The generic node.
0068: */
0069: public Node addScopeNode(Node arg) {
0070: Node v$1 = GNode.create("PrimaryIdentifier",
0071: "processScopeNodes");
0072: Node v$2 = GNode.create("Arguments", arg);
0073: Node v$3 = GNode
0074: .create("CallExpression", v$1, null, "add", v$2);
0075: Node v$4 = GNode.create("ExpressionStatement", v$3);
0076: return v$4;
0077: }
0078:
0079: /**
0080: * Create a new class expression.
0081: *
0082: * @param statement The statement.
0083: * @return The generic node.
0084: */
0085: public Node ancestorExpression(Node statement) {
0086: Node v$1 = GNode.create("QualifiedIdentifier", "Analyzer",
0087: "NodeMatch");
0088: Node v$2 = GNode.create("Arguments", false);
0089: Node v$3 = GNode.create("Modifier", "public");
0090: Node v$4 = GNode.create("Modifiers", v$3);
0091: Node v$5 = GNode.create("QualifiedIdentifier", "Boolean");
0092: Node v$6 = GNode.create("Type", v$5, null);
0093: Node v$7 = GNode.create("Modifiers", false);
0094: Node v$8 = GNode.create("QualifiedIdentifier", "Node");
0095: Node v$9 = GNode.create("Type", v$8, null);
0096: Node v$10 = GNode.create("FormalParameter", v$7, v$9, null,
0097: "m", null);
0098: Node v$11 = GNode.create("FormalParameters", v$10);
0099: Node v$12 = GNode.create("Block", statement);
0100: Node v$13 = GNode.create("MethodDeclaration", v$4, null, v$6,
0101: "apply", v$11, null, null, v$12);
0102: Node v$14 = GNode.create("ClassBody", v$13);
0103: Node v$15 = GNode.create("NewClassExpression", null, null, v$1,
0104: v$2, v$14);
0105: return v$15;
0106: }
0107:
0108: /**
0109: * Create a call expression.
0110: *
0111: * @param argument1 The argument1.
0112: * @param argument2 The argument2.
0113: * @return The generic node.
0114: */
0115: public Node and(Node argument1, Node argument2) {
0116: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
0117: Node v$2 = GNode.create("SelectionExpression", v$1, "and");
0118: Node v$3 = GNode.create("Arguments", argument1, argument2);
0119: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
0120: v$3);
0121: return v$4;
0122: }
0123:
0124: /**
0125: * Create a conditional statement.
0126: *
0127: * @param argument1 The argument1.
0128: * @param argument2 The argument2.
0129: * @return The generic node.
0130: */
0131: public Node annotateType(Node argument1, Node argument2) {
0132: Node v$1 = GNode.create("NullLiteral", false);
0133: Node v$2 = GNode.create("EqualityExpression", v$1, "!=",
0134: argument1);
0135: Node v$3 = GNode.create("StringLiteral", "\"__type\"");
0136: Node v$4 = GNode.create("Arguments", v$3, argument2);
0137: Node v$5 = GNode.create("CallExpression", argument1, null,
0138: "setProperty", v$4);
0139: Node v$6 = GNode.create("ExpressionStatement", v$5);
0140: Node v$7 = GNode.create("Block", v$6);
0141: Node v$8 = GNode.create("ConditionalStatement", v$2, v$7, null);
0142: return v$8;
0143: }
0144:
0145: /**
0146: * Create a call expression.
0147: *
0148: * @param name The name.
0149: * @param argument The argument.
0150: * @return The generic node.
0151: */
0152: public Node appendPair(Node name, Node argument) {
0153: Node v$1 = GNode.create("Arguments", argument);
0154: Node v$2 = GNode.create("CallExpression", name, null, "append",
0155: v$1);
0156: return v$2;
0157: }
0158:
0159: /**
0160: * Create a call expression.
0161: *
0162: * @param first The first.
0163: * @param second The second.
0164: * @return The generic node.
0165: */
0166: public Node appendWrapper(Node first, Node second) {
0167: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
0168: Node v$2 = GNode.create("Arguments", first, second);
0169: Node v$3 = GNode.create("CallExpression", v$1, null,
0170: "wrapAppend", v$2);
0171: return v$3;
0172: }
0173:
0174: /**
0175: * Create a call expression.
0176: *
0177: * @param name The name.
0178: * @param arguments The arguments.
0179: * @return The generic node.
0180: */
0181: public Node apply(Node name, List<Node> arguments) {
0182: Node v$1 = GNode.create("Arguments", arguments.size()).addAll(
0183: arguments);
0184: Node v$2 = GNode.create("CallExpression", name, null, "apply",
0185: v$1);
0186: return v$2;
0187: }
0188:
0189: /**
0190: * Create a call expression.
0191: *
0192: * @param name The name.
0193: * @return The generic node.
0194: */
0195: public Node apply2(Node name) {
0196: Node v$1 = GNode.create("Arguments", false);
0197: Node v$2 = GNode.create("CallExpression", name, null, "apply",
0198: v$1);
0199: return v$2;
0200: }
0201:
0202: /**
0203: * Create a call expression.
0204: *
0205: * @param name The name.
0206: * @param arguments The arguments.
0207: * @return The generic node.
0208: */
0209: public Node applyPrimitive(String name, List<Node> arguments) {
0210: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
0211: Node v$2 = GNode.create("SelectionExpression", v$1, name);
0212: Node v$3 = GNode.create("Arguments", arguments.size()).addAll(
0213: arguments);
0214: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
0215: v$3);
0216: return v$4;
0217: }
0218:
0219: /**
0220: * Create an expression statement.
0221: *
0222: * @param name The name.
0223: * @param value The value.
0224: * @return The generic node.
0225: */
0226: public Node assign(Node name, Node value) {
0227: Node v$1 = GNode.create("Expression", name, "=", value);
0228: Node v$2 = GNode.create("ExpressionStatement", v$1);
0229: return v$2;
0230: }
0231:
0232: /**
0233: * Create an expression statement.
0234: *
0235: * @param name The name.
0236: * @param expression The expression.
0237: * @return The generic node.
0238: */
0239: public Node assignField(Node name, Node expression) {
0240: Node v$1 = GNode.create("Arguments", expression);
0241: Node v$2 = GNode.create("CallExpression", null, null, "cast",
0242: v$1);
0243: Node v$3 = GNode.create("Expression", name, "=", v$2);
0244: Node v$4 = GNode.create("ExpressionStatement", v$3);
0245: return v$4;
0246: }
0247:
0248: /**
0249: * Create a field declaration.
0250: *
0251: * @param name The name.
0252: * @param value The value.
0253: * @return The generic node.
0254: */
0255: public Node boolVar(String name, Node value) {
0256: Node v$1 = GNode.create("Modifier", "final");
0257: Node v$2 = GNode.create("Modifiers", v$1);
0258: Node v$3 = GNode.create("QualifiedIdentifier", "Boolean");
0259: Node v$4 = GNode.create("Type", v$3, null);
0260: Node v$5 = GNode.create("Declarator", name, null, value);
0261: Node v$6 = GNode.create("Declarators", v$5);
0262: Node v$7 = GNode.create("FieldDeclaration", v$2, v$4, v$6);
0263: return v$7;
0264: }
0265:
0266: /**
0267: * Create a block.
0268: *
0269: * @param statments The statments.
0270: * @return The generic node.
0271: */
0272: public Node block(List<Node> statments) {
0273: Node v$1 = GNode.create("Block", statments.size()).addAll(
0274: statments);
0275: return v$1;
0276: }
0277:
0278: /**
0279: * Create a break statement.
0280: *
0281: * @return The generic node.
0282: */
0283: public Node breakStmnt() {
0284: Node v$1 = GNode.create("BreakStatement", null);
0285: return v$1;
0286: }
0287:
0288: /**
0289: * Create a call expression.
0290: *
0291: * @param expression The expression.
0292: * @return The generic node.
0293: */
0294: public Node cast(Node expression) {
0295: Node v$1 = GNode.create("PrimaryIdentifier", "Analyzer");
0296: Node v$2 = GNode.create("Arguments", expression);
0297: Node v$3 = GNode.create("CallExpression", v$1, null, "cast",
0298: v$2);
0299: return v$3;
0300: }
0301:
0302: /**
0303: * Create a call expression.
0304: *
0305: * @param name The name.
0306: * @param function The function.
0307: * @param arguments The arguments.
0308: * @return The generic node.
0309: */
0310: public Node castInvocation(Node name, String function,
0311: List<Node> arguments) {
0312: Node v$1 = GNode.create("PrimaryIdentifier", "Analyzer");
0313: Node v$2 = GNode.create("Arguments", arguments.size()).addAll(
0314: arguments);
0315: Node v$3 = GNode.create("CallExpression", name, null, function,
0316: v$2);
0317: Node v$4 = GNode.create("Arguments", v$3);
0318: Node v$5 = GNode.create("CallExpression", v$1, null, "cast",
0319: v$4);
0320: return v$5;
0321: }
0322:
0323: /**
0324: * Create a return statement.
0325: *
0326: * @param argument The argument.
0327: * @return The generic node.
0328: */
0329: public Node castReturn(Node argument) {
0330: Node v$1 = GNode.create("PrimaryIdentifier", "Analyzer");
0331: Node v$2 = GNode.create("Arguments", argument);
0332: Node v$3 = GNode.create("CallExpression", v$1, null, "cast",
0333: v$2);
0334: Node v$4 = GNode.create("ReturnStatement", v$3);
0335: return v$4;
0336: }
0337:
0338: /**
0339: * Create an expression statement.
0340: *
0341: * @param argument The argument.
0342: * @return The generic node.
0343: */
0344: public Node checkEnterScope(Node argument) {
0345: Node v$1 = GNode.create("Arguments", argument);
0346: Node v$2 = GNode.create("CallExpression", null, null,
0347: "checkEnterScope", v$1);
0348: Node v$3 = GNode.create("ExpressionStatement", v$2);
0349: return v$3;
0350: }
0351:
0352: /**
0353: * Create an expression statement.
0354: *
0355: * @param argument The argument.
0356: * @return The generic node.
0357: */
0358: public Node checkExitScope(Node argument) {
0359: Node v$1 = GNode.create("Arguments", argument);
0360: Node v$2 = GNode.create("CallExpression", null, null,
0361: "checkExitScope", v$1);
0362: Node v$3 = GNode.create("ExpressionStatement", v$2);
0363: return v$3;
0364: }
0365:
0366: /**
0367: * Create a class declaration.
0368: *
0369: * @param name The name.
0370: * @return The generic node.
0371: */
0372: public Node classDecl2(String name) {
0373: Node v$1 = GNode.create("Modifier", "public");
0374: Node v$2 = GNode.create("Modifiers", v$1);
0375: Node v$3 = GNode.create("ClassBody", false);
0376: Node v$4 = GNode.create("ClassDeclaration", v$2, name, null,
0377: null, null, v$3);
0378: return v$4;
0379: }
0380:
0381: /**
0382: * Create a class declaration.
0383: *
0384: * @param name The name.
0385: * @return The generic node.
0386: */
0387: public Node classDecl3(String name) {
0388: Node v$1 = GNode.create("Modifier", "protected");
0389: Node v$2 = GNode.create("Modifiers", v$1);
0390: Node v$3 = GNode.create("ClassBody", false);
0391: Node v$4 = GNode.create("ClassDeclaration", v$2, name, null,
0392: null, null, v$3);
0393: return v$4;
0394: }
0395:
0396: /**
0397: * Create an expression statement.
0398: *
0399: * @return The generic node.
0400: */
0401: public Node compareTypes() {
0402: Node v$1 = GNode.create("PrimaryIdentifier", "res");
0403: Node v$2 = GNode.create("PrimaryIdentifier", "res");
0404: Node v$3 = GNode.create("PrimaryIdentifier", "type");
0405: Node v$4 = GNode.create("PrimaryIdentifier", "other");
0406: Node v$5 = GNode.create("SelectionExpression", v$4, "type");
0407: Node v$6 = GNode.create("Arguments", v$5);
0408: Node v$7 = GNode.create("CallExpression", v$3, null, "equals",
0409: v$6);
0410: Node v$8 = GNode.create("LogicalAndExpression", v$2, v$7);
0411: Node v$9 = GNode.create("Expression", v$1, "=", v$8);
0412: Node v$10 = GNode.create("ExpressionStatement", v$9);
0413: return v$10;
0414: }
0415:
0416: /**
0417: * Create an expression statement.
0418: *
0419: * @param arg The arg.
0420: * @return The generic node.
0421: */
0422: public Node compareAttributes(Object arg) {
0423: Node v$1 = GNode.create("PrimaryIdentifier", "res");
0424: Node v$2 = GNode.create("PrimaryIdentifier", "res");
0425: Node v$3 = GNode.create("PrimaryIdentifier", "other");
0426: Node v$4 = GNode.create("SelectionExpression", v$3, arg);
0427: Node v$5 = GNode.create("Arguments", v$4);
0428: Node v$6 = GNode.create("CallExpression", arg, null, "equals",
0429: v$5);
0430: Node v$7 = GNode.create("LogicalAndExpression", v$2, v$6);
0431: Node v$8 = GNode.create("Expression", v$1, "=", v$7);
0432: Node v$9 = GNode.create("ExpressionStatement", v$8);
0433: return v$9;
0434: }
0435:
0436: /**
0437: * Create an expression statement.
0438: *
0439: * @param arg The arg.
0440: * @return The generic node.
0441: */
0442: public Node compareMembers(String arg) {
0443: Node v$1 = GNode.create("PrimaryIdentifier", "res");
0444: Node v$2 = GNode.create("PrimaryIdentifier", "res");
0445: Node v$3 = GNode.create("PrimaryIdentifier", "Analyzer");
0446: Node v$4 = GNode.create("ThisExpression", null);
0447: Node v$5 = GNode.create("SelectionExpression", v$4, arg);
0448: Node v$6 = GNode.create("PrimaryIdentifier", "other");
0449: Node v$7 = GNode.create("SelectionExpression", v$6, arg);
0450: Node v$8 = GNode.create("Arguments", v$5, v$7);
0451: Node v$9 = GNode.create("CallExpression", v$3, null, "equal",
0452: v$8);
0453: Node v$10 = GNode.create("LogicalAndExpression", v$2, v$9);
0454: Node v$11 = GNode.create("Expression", v$1, "=", v$10);
0455: Node v$12 = GNode.create("ExpressionStatement", v$11);
0456: return v$12;
0457: }
0458:
0459: /**
0460: * Create a call expression.
0461: *
0462: * @param argument1 The argument1.
0463: * @param argument2 The argument2.
0464: * @return The generic node.
0465: */
0466: public Node concatStrings(Node argument1, Node argument2) {
0467: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
0468: Node v$2 = GNode.create("SelectionExpression", v$1, "concat");
0469: Node v$3 = GNode.create("Arguments", argument1, argument2);
0470: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
0471: v$3);
0472: return v$4;
0473: }
0474:
0475: /**
0476: * Create a call expression.
0477: *
0478: * @param argument1 The argument1.
0479: * @param argument2 The argument2.
0480: * @return The generic node.
0481: */
0482: public Node concatLists(Node argument1, Node argument2) {
0483: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
0484: Node v$2 = GNode.create("SelectionExpression", v$1,
0485: "concatList");
0486: Node v$3 = GNode.create("Arguments", argument1, argument2);
0487: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
0488: v$3);
0489: return v$4;
0490: }
0491:
0492: /**
0493: * Create a call expression.
0494: *
0495: * @param head The head.
0496: * @param tail The tail.
0497: * @return The generic node.
0498: */
0499: public Node consWrapper(Node head, Node tail) {
0500: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
0501: Node v$2 = GNode.create("Arguments", head, tail);
0502: Node v$3 = GNode.create("CallExpression", v$1, null,
0503: "wrapCons", v$2);
0504: return v$3;
0505: }
0506:
0507: /**
0508: * Create a constructor declaration.
0509: *
0510: * @param name The name.
0511: * @return The generic node.
0512: */
0513: public Node makeConstructor(String name) {
0514: Node v$1 = GNode.create("Modifier", "public");
0515: Node v$2 = GNode.create("Modifiers", v$1);
0516: Node v$3 = GNode.create("Modifiers", false);
0517: Node v$4 = GNode.create("QualifiedIdentifier", "Runtime");
0518: Node v$5 = GNode.create("Type", v$4, null);
0519: Node v$6 = GNode.create("FormalParameter", v$3, v$5, null,
0520: "runt", null);
0521: Node v$7 = GNode.create("Modifiers", false);
0522: Node v$8 = GNode.create("QualifiedIdentifier", "String");
0523: Node v$9 = GNode.create("Type", v$8, null);
0524: Node v$10 = GNode.create("FormalParameter", v$7, v$9, null,
0525: "nodeType", null);
0526: Node v$11 = GNode.create("FormalParameters", v$6, v$10);
0527: Node v$12 = GNode.create("PrimaryIdentifier", "runt");
0528: Node v$13 = GNode.create("Arguments", v$12);
0529: Node v$14 = GNode.create("CallExpression", null, null, "super",
0530: v$13);
0531: Node v$15 = GNode.create("ExpressionStatement", v$14);
0532: Node v$16 = GNode.create("PrimaryIdentifier", "analyzer");
0533: Node v$17 = GNode.create("PrimaryIdentifier", "analyze");
0534: Node v$18 = GNode.create("Expression", v$16, "=", v$17);
0535: Node v$19 = GNode.create("ExpressionStatement", v$18);
0536: Node v$20 = GNode.create("ThisExpression", null);
0537: Node v$21 = GNode.create("SelectionExpression", v$20,
0538: "nodeType");
0539: Node v$22 = GNode.create("PrimaryIdentifier", "nodeType");
0540: Node v$23 = GNode.create("Expression", v$21, "=", v$22);
0541: Node v$24 = GNode.create("ExpressionStatement", v$23);
0542: Node v$25 = GNode.create("Block", v$15, v$19, v$24);
0543: Node v$26 = GNode.create("ConstructorDeclaration", v$2, null,
0544: name, v$11, null, v$25);
0545: return v$26;
0546: }
0547:
0548: /**
0549: * Create a constructor declaration.
0550: *
0551: * @param name The name.
0552: * @return The generic node.
0553: */
0554: public Node makeConstructor2(String name) {
0555: Node v$1 = GNode.create("Modifier", "public");
0556: Node v$2 = GNode.create("Modifiers", v$1);
0557: Node v$3 = GNode.create("Modifiers", false);
0558: Node v$4 = GNode.create("QualifiedIdentifier", "Runtime");
0559: Node v$5 = GNode.create("Type", v$4, null);
0560: Node v$6 = GNode.create("FormalParameter", v$3, v$5, null,
0561: "runt", null);
0562: Node v$7 = GNode.create("FormalParameters", v$6);
0563: Node v$8 = GNode.create("PrimaryIdentifier", "runt");
0564: Node v$9 = GNode.create("Arguments", v$8);
0565: Node v$10 = GNode.create("CallExpression", null, null, "super",
0566: v$9);
0567: Node v$11 = GNode.create("ExpressionStatement", v$10);
0568: Node v$12 = GNode.create("PrimaryIdentifier", "analyzer");
0569: Node v$13 = GNode.create("PrimaryIdentifier", "analyze");
0570: Node v$14 = GNode.create("Expression", v$12, "=", v$13);
0571: Node v$15 = GNode.create("ExpressionStatement", v$14);
0572: Node v$16 = GNode.create("Block", v$11, v$15);
0573: Node v$17 = GNode.create("ConstructorDeclaration", v$2, null,
0574: name, v$7, null, v$16);
0575: return v$17;
0576: }
0577:
0578: /**
0579: * Create a constructor declaration.
0580: *
0581: * @param name The name.
0582: * @return The generic node.
0583: */
0584: public Node typesConstr(String name) {
0585: Node v$1 = GNode.create("Modifier", "private");
0586: Node v$2 = GNode.create("Modifiers", v$1);
0587: Node v$3 = GNode.create("FormalParameters", false);
0588: Node v$4 = GNode.create("Block", false);
0589: Node v$5 = GNode.create("ConstructorDeclaration", v$2, null,
0590: name, v$3, null, v$4);
0591: return v$5;
0592: }
0593:
0594: /**
0595: * Create a call expression.
0596: *
0597: * @param literal The literal.
0598: * @return The generic node.
0599: */
0600: public Node createInteger(Node literal) {
0601: Node v$1 = GNode.create("PrimaryIdentifier", "BigInteger");
0602: Node v$2 = GNode.create("Arguments", literal);
0603: Node v$3 = GNode.create("CallExpression", v$1, null, "valueOf",
0604: v$2);
0605: return v$3;
0606: }
0607:
0608: /**
0609: * Create a new class expression.
0610: *
0611: * @param text The text.
0612: * @return The generic node.
0613: */
0614: public Node createFloat(Node text) {
0615: Node v$1 = GNode.create("QualifiedIdentifier", "Double");
0616: Node v$2 = GNode.create("Arguments", text);
0617: Node v$3 = GNode.create("NewClassExpression", null, null, v$1,
0618: v$2, null);
0619: return v$3;
0620: }
0621:
0622: /**
0623: * Create a new class expression.
0624: *
0625: * @param arg1 The arg1.
0626: * @param arg2 The arg2.
0627: * @return The generic node.
0628: */
0629: public Node curryingPut(Object arg1, Node arg2) {
0630: Node v$1 = GNode.create("TypeInstantiation", "Function", null);
0631: Node v$2 = GNode.create("QualifiedIdentifier", "Void");
0632: Node v$3 = GNode.create("Type", v$2, null);
0633: Node v$4 = GNode.create("QualifiedIdentifier", "Object");
0634: Node v$5 = GNode.create("Type", v$4, null);
0635: Node v$6 = GNode.create("QualifiedIdentifier", "Object");
0636: Node v$7 = GNode.create("Type", v$6, null);
0637: Node v$8 = GNode.create("QualifiedIdentifier", "Object");
0638: Node v$9 = GNode.create("Type", v$8, null);
0639: Node v$10 = GNode.create("TypeArguments", v$7, v$9);
0640: Node v$11 = GNode
0641: .create("TypeInstantiation", "Hashtable", v$10);
0642: Node v$12 = GNode.create("InstantiatedType", v$11);
0643: Node v$13 = GNode.create("Type", v$12, null);
0644: Node v$14 = GNode.create("TypeArguments", v$3, v$5, v$13);
0645: Node v$15 = GNode.create("TypeInstantiation", "F2", v$14);
0646: Node v$16 = GNode.create("InstantiatedType", v$1, v$15);
0647: Node v$17 = GNode.create("Arguments", false);
0648: Node v$18 = GNode.create("Modifier", "public");
0649: Node v$19 = GNode.create("Modifiers", v$18);
0650: Node v$20 = GNode.create("QualifiedIdentifier", "Void");
0651: Node v$21 = GNode.create("Type", v$20, null);
0652: Node v$22 = GNode.create("Modifiers", false);
0653: Node v$23 = GNode.create("QualifiedIdentifier", "Object");
0654: Node v$24 = GNode.create("Type", v$23, null);
0655: Node v$25 = GNode.create("FormalParameter", v$22, v$24, null,
0656: "o", null);
0657: Node v$26 = GNode.create("Modifiers", false);
0658: Node v$27 = GNode.create("QualifiedIdentifier", "Hashtable");
0659: Node v$28 = GNode.create("Type", v$27, null);
0660: Node v$29 = GNode.create("FormalParameter", v$26, v$28, null,
0661: "table", null);
0662: Node v$30 = GNode.create("FormalParameters", v$25, v$29);
0663: Node v$31 = GNode.create("Modifier", "final");
0664: Node v$32 = GNode.create("Modifiers", v$31);
0665: Node v$33 = GNode.create("QualifiedIdentifier", "Object");
0666: Node v$34 = GNode.create("Type", v$33, null);
0667: Node v$35 = GNode.create("Declarator", arg1, null, arg2);
0668: Node v$36 = GNode.create("Declarators", v$35);
0669: Node v$37 = GNode.create("FieldDeclaration", v$32, v$34, v$36);
0670: Node v$38 = GNode.create("PrimaryIdentifier", "Primitives");
0671: Node v$39 = GNode.create("PrimaryIdentifier", "o");
0672: Node v$40 = GNode.create("PrimaryIdentifier", "table");
0673: Node v$41 = GNode.create("Arguments", arg1, v$39, v$40);
0674: Node v$42 = GNode.create("CallExpression", v$38, null, "put",
0675: v$41);
0676: Node v$43 = GNode.create("ReturnStatement", v$42);
0677: Node v$44 = GNode.create("Block", v$37, v$43);
0678: Node v$45 = GNode.create("MethodDeclaration", v$19, null, v$21,
0679: "apply", v$30, null, null, v$44);
0680: Node v$46 = GNode.create("ClassBody", v$45);
0681: Node v$47 = GNode.create("NewClassExpression", null, null,
0682: v$16, v$17, v$46);
0683: return v$47;
0684: }
0685:
0686: /**
0687: * Create a constructor declaration.
0688: *
0689: * @param name The name.
0690: * @return The generic node.
0691: */
0692: public Node defaultConstr(String name) {
0693: Node v$1 = GNode.create("Modifier", "protected");
0694: Node v$2 = GNode.create("Modifiers", v$1);
0695: Node v$3 = GNode.create("FormalParameters", false);
0696: Node v$4 = GNode.create("Block", false);
0697: Node v$5 = GNode.create("ConstructorDeclaration", v$2, null,
0698: name, v$3, null, v$4);
0699: return v$5;
0700: }
0701:
0702: /**
0703: * Create an expression statement.
0704: *
0705: * @param expression The expression.
0706: * @return The generic node.
0707: */
0708: public Node discard(Node expression) {
0709: Node v$1 = GNode.create("PrimaryIdentifier", "Analyzer");
0710: Node v$2 = GNode.create("Arguments", expression);
0711: Node v$3 = GNode.create("CallExpression", v$1, null, "discard",
0712: v$2);
0713: Node v$4 = GNode.create("ExpressionStatement", v$3);
0714: return v$4;
0715: }
0716:
0717: /**
0718: * Create a call expression.
0719: *
0720: * @param argument1 The argument1.
0721: * @param argument2 The argument2.
0722: * @return The generic node.
0723: */
0724: public Node divideInt(Node argument1, Node argument2) {
0725: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
0726: Node v$2 = GNode
0727: .create("SelectionExpression", v$1, "divideInt");
0728: Node v$3 = GNode.create("Arguments", argument1, argument2);
0729: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
0730: v$3);
0731: return v$4;
0732: }
0733:
0734: /**
0735: * Create a call expression.
0736: *
0737: * @param argument1 The argument1.
0738: * @param argument2 The argument2.
0739: * @return The generic node.
0740: */
0741: public Node divideFloat64(Node argument1, Node argument2) {
0742: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
0743: Node v$2 = GNode.create("SelectionExpression", v$1,
0744: "divideFloat64");
0745: Node v$3 = GNode.create("Arguments", argument1, argument2);
0746: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
0747: v$3);
0748: return v$4;
0749: }
0750:
0751: /**
0752: * Create a call expression.
0753: *
0754: * @param argument1 The argument1.
0755: * @param argument2 The argument2.
0756: * @return The generic node.
0757: */
0758: public Node equal(Node argument1, Node argument2) {
0759: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
0760: Node v$2 = GNode.create("SelectionExpression", v$1, "equal");
0761: Node v$3 = GNode.create("Arguments", argument1, argument2);
0762: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
0763: v$3);
0764: return v$4;
0765: }
0766:
0767: /**
0768: * Create an equality expression.
0769: *
0770: * @param argument1 The argument1.
0771: * @param argument2 The argument2.
0772: * @return The generic node.
0773: */
0774: public Node equality(Node argument1, Node argument2) {
0775: Node v$1 = GNode.create("EqualityExpression", argument1, "==",
0776: argument2);
0777: return v$1;
0778: }
0779:
0780: /**
0781: * Create a method declaration.
0782: *
0783: * @return The generic node.
0784: */
0785: public Node equalsMethod() {
0786: Node v$1 = GNode.create("Modifier", "public");
0787: Node v$2 = GNode.create("Modifiers", v$1);
0788: Node v$3 = GNode.create("PrimitiveType", "boolean");
0789: Node v$4 = GNode.create("Type", v$3, null);
0790: Node v$5 = GNode.create("Modifiers", false);
0791: Node v$6 = GNode.create("QualifiedIdentifier", "Object");
0792: Node v$7 = GNode.create("Type", v$6, null);
0793: Node v$8 = GNode.create("FormalParameter", v$5, v$7, null, "o",
0794: null);
0795: Node v$9 = GNode.create("FormalParameters", v$8);
0796: Node v$10 = GNode.create("Block", false);
0797: Node v$11 = GNode.create("MethodDeclaration", v$2, null, v$4,
0798: "equals", v$9, null, null, v$10);
0799: return v$11;
0800: }
0801:
0802: /**
0803: * Create an equality expression.
0804: *
0805: * @param argument The argument.
0806: * @return The generic node.
0807: */
0808: public Node equalsBottom(Node argument) {
0809: Node v$1 = GNode.create("NullLiteral", false);
0810: Node v$2 = GNode.create("EqualityExpression", v$1, "==",
0811: argument);
0812: return v$2;
0813: }
0814:
0815: /**
0816: * Create a call expression.
0817: *
0818: * @param name The name.
0819: * @param argument1 The argument1.
0820: * @param argument2 The argument2.
0821: * @return The generic node.
0822: */
0823: public Node errorClause(String name, Node argument1, Node argument2) {
0824: Node v$1 = GNode.create("Arguments", argument1, argument2);
0825: Node v$2 = GNode
0826: .create("CallExpression", null, null, name, v$1);
0827: return v$2;
0828: }
0829:
0830: /**
0831: * Create an expression statement.
0832: *
0833: * @param expr The expr.
0834: * @return The generic node.
0835: */
0836: public Node expressionStmnt(Node expr) {
0837: Node v$1 = GNode.create("ExpressionStatement", expr);
0838: return v$1;
0839: }
0840:
0841: /**
0842: * Create a class declaration.
0843: *
0844: * @return The generic node.
0845: */
0846: public Node extendsDecl() {
0847: Node v$1 = GNode.create("Modifier", "public");
0848: Node v$2 = GNode.create("Modifier", "static");
0849: Node v$3 = GNode.create("Modifiers", v$1, v$2);
0850: Node v$4 = GNode.create("QualifiedIdentifier", "Type");
0851: Node v$5 = GNode.create("Type", v$4, null);
0852: Node v$6 = GNode.create("Extension", v$5);
0853: Node v$7 = GNode.create("ClassBody", false);
0854: Node v$8 = GNode.create("ClassDeclaration", v$3, "Name", null,
0855: v$6, null, v$7);
0856: return v$8;
0857: }
0858:
0859: /**
0860: * Create a class declaration.
0861: *
0862: * @return The generic node.
0863: */
0864: public Node extendsDecl2() {
0865: Node v$1 = GNode.create("Modifier", "public");
0866: Node v$2 = GNode.create("Modifier", "static");
0867: Node v$3 = GNode.create("Modifier", "abstract");
0868: Node v$4 = GNode.create("Modifiers", v$1, v$2, v$3);
0869: Node v$5 = GNode.create("QualifiedIdentifier", "Type");
0870: Node v$6 = GNode.create("Type", v$5, null);
0871: Node v$7 = GNode.create("Extension", v$6);
0872: Node v$8 = GNode.create("ClassBody", false);
0873: Node v$9 = GNode.create("ClassDeclaration", v$4, "Name", null,
0874: v$7, null, v$8);
0875: return v$9;
0876: }
0877:
0878: /**
0879: * Create a field declaration.
0880: *
0881: * @param type The type.
0882: * @param value The value.
0883: * @return The generic node.
0884: */
0885: public Node fieldDecl(Node type, Node value) {
0886: Node v$1 = GNode.create("Modifier", "final");
0887: Node v$2 = GNode.create("Modifiers", v$1);
0888: Node v$3 = GNode.create("Type", type, null);
0889: Node v$4 = GNode.create("Declarator", "name", null, value);
0890: Node v$5 = GNode.create("Declarators", v$4);
0891: Node v$6 = GNode.create("FieldDeclaration", v$2, v$3, v$5);
0892: return v$6;
0893: }
0894:
0895: /**
0896: * Create a field declaration.
0897: *
0898: * @param type The type.
0899: * @param value The value.
0900: * @return The generic node.
0901: */
0902: public Node fieldDecl1(Node type, Node value) {
0903: Node v$1 = GNode.create("Modifiers", false);
0904: Node v$2 = GNode.create("Type", type, null);
0905: Node v$3 = GNode.create("Declarator", "name", null, value);
0906: Node v$4 = GNode.create("Declarators", v$3);
0907: Node v$5 = GNode.create("FieldDeclaration", v$1, v$2, v$4);
0908: return v$5;
0909: }
0910:
0911: /**
0912: * Create a field declaration.
0913: *
0914: * @param type The type.
0915: * @param name The name.
0916: * @param value The value.
0917: * @return The generic node.
0918: */
0919: public Node fieldDecl2(Node type, String name, Node value) {
0920: Node v$1 = GNode.create("Modifier", "final");
0921: Node v$2 = GNode.create("Modifiers", v$1);
0922: Node v$3 = GNode.create("Type", type, null);
0923: Node v$4 = GNode.create("Declarator", name, null, value);
0924: Node v$5 = GNode.create("Declarators", v$4);
0925: Node v$6 = GNode.create("FieldDeclaration", v$2, v$3, v$5);
0926: return v$6;
0927: }
0928:
0929: /**
0930: * Create a conditional expression.
0931: *
0932: * @param argument The argument.
0933: * @param tail The tail.
0934: * @return The generic node.
0935: */
0936: public Node fieldExpression(Node argument, String tail) {
0937: Node v$1 = GNode.create("NullLiteral", false);
0938: Node v$2 = GNode.create("EqualityExpression", v$1, "==",
0939: argument);
0940: Node v$3 = GNode.create("NullLiteral", false);
0941: Node v$4 = GNode.create("SelectionExpression", argument, tail);
0942: Node v$5 = GNode.create("ConditionalExpression", v$2, v$3, v$4);
0943: return v$5;
0944: }
0945:
0946: /**
0947: * Create a new class expression.
0948: *
0949: * @param arg1 The arg1.
0950: * @param arg2 The arg2.
0951: * @param arg3 The arg3.
0952: * @return The generic node.
0953: */
0954: public Node functionExpression(Node arg1, Node arg2, Node arg3) {
0955: Node v$1 = GNode.create("TypeInstantiation", "Function", null);
0956: Node v$2 = GNode.create("Type", arg1, null);
0957: Node v$3 = GNode.create("Type", arg2, null);
0958: Node v$4 = GNode.create("TypeArguments", v$2, v$3);
0959: Node v$5 = GNode.create("TypeInstantiation", "F1", v$4);
0960: Node v$6 = GNode.create("InstantiatedType", v$1, v$5);
0961: Node v$7 = GNode.create("Arguments", false);
0962: Node v$8 = GNode.create("Modifier", "public");
0963: Node v$9 = GNode.create("Modifiers", v$8);
0964: Node v$10 = GNode.create("Type", arg1, null);
0965: Node v$11 = GNode.create("Modifier", "final");
0966: Node v$12 = GNode.create("Modifiers", v$11);
0967: Node v$13 = GNode.create("Type", arg2, null);
0968: Node v$14 = GNode.create("FormalParameter", v$12, v$13, null,
0969: "var", null);
0970: Node v$15 = GNode.create("FormalParameters", v$14);
0971: Node v$16 = GNode.create("ReturnStatement", arg3);
0972: Node v$17 = GNode.create("Block", v$16);
0973: Node v$18 = GNode.create("MethodDeclaration", v$9, null, v$10,
0974: "apply", v$15, null, null, v$17);
0975: Node v$19 = GNode.create("ClassBody", v$18);
0976: Node v$20 = GNode.create("NewClassExpression", null, null, v$6,
0977: v$7, v$19);
0978: return v$20;
0979: }
0980:
0981: /**
0982: * Create a conditional expression.
0983: *
0984: * @param argument The argument.
0985: * @return The generic node.
0986: */
0987: public Node getName(Node argument) {
0988: Node v$1 = GNode.create("NullLiteral", false);
0989: Node v$2 = GNode.create("EqualityExpression", v$1, "==",
0990: argument);
0991: Node v$3 = GNode.create("NullLiteral", false);
0992: Node v$4 = GNode.create("Arguments", false);
0993: Node v$5 = GNode.create("CallExpression", argument, null,
0994: "getName", v$4);
0995: Node v$6 = GNode.create("ConditionalExpression", v$2, v$3, v$5);
0996: return v$6;
0997: }
0998:
0999: /**
1000: * Create a method declaration.
1001: *
1002: * @param argument The argument.
1003: * @return The generic node.
1004: */
1005: public Node getNameMethod(Node argument) {
1006: Node v$1 = GNode.create("Modifier", "public");
1007: Node v$2 = GNode.create("Modifiers", v$1);
1008: Node v$3 = GNode.create("QualifiedIdentifier", "String");
1009: Node v$4 = GNode.create("Type", v$3, null);
1010: Node v$5 = GNode.create("FormalParameters", false);
1011: Node v$6 = GNode.create("ReturnStatement", argument);
1012: Node v$7 = GNode.create("Block", v$6);
1013: Node v$8 = GNode.create("MethodDeclaration", v$2, null, v$4,
1014: "getName", v$5, null, null, v$7);
1015: return v$8;
1016: }
1017:
1018: /**
1019: * Create a method declaration.
1020: *
1021: * @return The generic node.
1022: */
1023: public Node getScopeNodesMethod() {
1024: Node v$1 = GNode.create("Modifier", "public");
1025: Node v$2 = GNode.create("Modifiers", v$1);
1026: Node v$3 = GNode.create("VoidType", false);
1027: Node v$4 = GNode.create("FormalParameters", false);
1028: Node v$5 = GNode.create("Block", false);
1029: Node v$6 = GNode.create("MethodDeclaration", v$2, null, v$3,
1030: "getScopeNodes", v$4, null, null, v$5);
1031: return v$6;
1032: }
1033:
1034: /**
1035: * Create a class declaration.
1036: *
1037: * @return The generic node.
1038: */
1039: public Node getScopeClass() {
1040: Node v$1 = GNode.create("Modifiers", false);
1041: Node v$2 = GNode.create("Modifier", "public");
1042: Node v$3 = GNode.create("Modifiers", v$2);
1043: Node v$4 = GNode.create("QualifiedIdentifier", "Scope");
1044: Node v$5 = GNode.create("Type", v$4, null);
1045: Node v$6 = GNode.create("Modifiers", false);
1046: Node v$7 = GNode.create("QualifiedIdentifier", "GNode");
1047: Node v$8 = GNode.create("Type", v$7, null);
1048: Node v$9 = GNode.create("FormalParameter", v$6, v$8, null, "n",
1049: null);
1050: Node v$10 = GNode.create("FormalParameters", v$9);
1051: Node v$11 = GNode.create("NullLiteral", false);
1052: Node v$12 = GNode.create("ReturnStatement", v$11);
1053: Node v$13 = GNode.create("Block", v$12);
1054: Node v$14 = GNode.create("MethodDeclaration", v$3, null, v$5,
1055: "apply", v$10, null, null, v$13);
1056: Node v$15 = GNode.create("ClassBody", v$14);
1057: Node v$16 = GNode.create("ClassDeclaration", v$1, "getScope",
1058: null, null, null, v$15);
1059: return v$16;
1060: }
1061:
1062: /**
1063: * Create a field declaration.
1064: *
1065: * @return The generic node.
1066: */
1067: public Node getScopeObject() {
1068: Node v$1 = GNode.create("Modifier", "final");
1069: Node v$2 = GNode.create("Modifiers", v$1);
1070: Node v$3 = GNode.create("QualifiedIdentifier", "getScope");
1071: Node v$4 = GNode.create("Type", v$3, null);
1072: Node v$5 = GNode.create("QualifiedIdentifier", "getScope");
1073: Node v$6 = GNode.create("Arguments", false);
1074: Node v$7 = GNode.create("NewClassExpression", null, null, v$5,
1075: v$6, null);
1076: Node v$8 = GNode.create("Declarator", "getScope", null, v$7);
1077: Node v$9 = GNode.create("Declarators", v$8);
1078: Node v$10 = GNode.create("FieldDeclaration", v$2, v$4, v$9);
1079: return v$10;
1080: }
1081:
1082: /**
1083: * Create a method declaration.
1084: *
1085: * @return The generic node.
1086: */
1087: public Node getTagAbstract() {
1088: Node v$1 = GNode.create("Modifier", "public");
1089: Node v$2 = GNode.create("Modifier", "abstract");
1090: Node v$3 = GNode.create("Modifiers", v$1, v$2);
1091: Node v$4 = GNode.create("QualifiedIdentifier", "Tag");
1092: Node v$5 = GNode.create("Type", v$4, null);
1093: Node v$6 = GNode.create("FormalParameters", false);
1094: Node v$7 = GNode.create("MethodDeclaration", v$3, null, v$5,
1095: "tag", v$6, null, null, null);
1096: return v$7;
1097: }
1098:
1099: /**
1100: * Create a method declaration.
1101: *
1102: * @param tag The tag.
1103: * @return The generic node.
1104: */
1105: public Node getTag(String tag) {
1106: Node v$1 = GNode.create("Modifier", "public");
1107: Node v$2 = GNode.create("Modifier", "final");
1108: Node v$3 = GNode.create("Modifiers", v$1, v$2);
1109: Node v$4 = GNode.create("QualifiedIdentifier", "Tag");
1110: Node v$5 = GNode.create("Type", v$4, null);
1111: Node v$6 = GNode.create("FormalParameters", false);
1112: Node v$7 = GNode.create("PrimaryIdentifier", "Tag");
1113: Node v$8 = GNode.create("SelectionExpression", v$7, tag);
1114: Node v$9 = GNode.create("ReturnStatement", v$8);
1115: Node v$10 = GNode.create("Block", v$9);
1116: Node v$11 = GNode.create("MethodDeclaration", v$3, null, v$5,
1117: "tag", v$6, null, null, v$10);
1118: return v$11;
1119: }
1120:
1121: /**
1122: * Create a call expression.
1123: *
1124: * @param argument The argument.
1125: * @return The generic node.
1126: */
1127: public Node gnodeCast(Node argument) {
1128: Node v$1 = GNode.create("PrimaryIdentifier", "GNode");
1129: Node v$2 = GNode.create("Arguments", argument);
1130: Node v$3 = GNode.create("CallExpression", v$1, null, "cast",
1131: v$2);
1132: return v$3;
1133: }
1134:
1135: /**
1136: * Create a call expression.
1137: *
1138: * @param arguments The arguments.
1139: * @return The generic node.
1140: */
1141: public Node gnodeCreate(List<Node> arguments) {
1142: Node v$1 = GNode.create("PrimaryIdentifier", "GNode");
1143: Node v$2 = GNode.create("Arguments", arguments.size()).addAll(
1144: arguments);
1145: Node v$3 = GNode.create("CallExpression", v$1, null, "create",
1146: v$2);
1147: return v$3;
1148: }
1149:
1150: /**
1151: * Create a call expression.
1152: *
1153: * @param type The type.
1154: * @param statements The statements.
1155: * @return The generic node.
1156: */
1157: public Node guardExpression(Node type, List<Node> statements) {
1158: Node v$1 = GNode.create("Type", type, null);
1159: Node v$2 = GNode.create("TypeArguments", v$1);
1160: Node v$3 = GNode.create("TypeInstantiation", "Guard", v$2);
1161: Node v$4 = GNode.create("InstantiatedType", v$3);
1162: Node v$5 = GNode.create("Arguments", false);
1163: Node v$6 = GNode.create("Modifier", "public");
1164: Node v$7 = GNode.create("Modifiers", v$6);
1165: Node v$8 = GNode.create("Type", type, null);
1166: Node v$9 = GNode.create("FormalParameters", false);
1167: Node v$10 = GNode.create("Block", statements.size()).addAll(
1168: statements);
1169: Node v$11 = GNode.create("MethodDeclaration", v$7, null, v$8,
1170: "apply", v$9, null, null, v$10);
1171: Node v$12 = GNode.create("ClassBody", v$11);
1172: Node v$13 = GNode.create("NewClassExpression", null, null, v$4,
1173: v$5, v$12);
1174: Node v$14 = GNode.create("Arguments", false);
1175: Node v$15 = GNode.create("CallExpression", v$13, null, "apply",
1176: v$14);
1177: return v$15;
1178: }
1179:
1180: /**
1181: * Create a logical and expression.
1182: *
1183: * @param node The node.
1184: * @param name The name.
1185: * @return The generic node.
1186: */
1187: public Node hasNameCall(Node node, Node name) {
1188: Node v$1 = GNode.create("NullLiteral", false);
1189: Node v$2 = GNode.create("EqualityExpression", v$1, "!=", node);
1190: Node v$3 = GNode.create("Arguments", name);
1191: Node v$4 = GNode.create("CallExpression", node, null,
1192: "hasName", v$3);
1193: Node v$5 = GNode.create("LogicalAndExpression", v$2, v$4);
1194: return v$5;
1195: }
1196:
1197: /**
1198: * Create a call expression.
1199: *
1200: * @param argument The argument.
1201: * @return The generic node.
1202: */
1203: public Node head(Node argument) {
1204: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
1205: Node v$2 = GNode.create("SelectionExpression", v$1, "head");
1206: Node v$3 = GNode.create("Arguments", argument);
1207: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
1208: v$3);
1209: return v$4;
1210: }
1211:
1212: /**
1213: * Create a call expression.
1214: *
1215: * @param argument The argument.
1216: * @return The generic node.
1217: */
1218: public Node headWrapper(Node argument) {
1219: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
1220: Node v$2 = GNode.create("Arguments", argument);
1221: Node v$3 = GNode.create("CallExpression", v$1, null,
1222: "wrapHead", v$2);
1223: return v$3;
1224: }
1225:
1226: /**
1227: * Create a conditional statement.
1228: *
1229: * @param condition The condition.
1230: * @param action The action.
1231: * @return The generic node.
1232: */
1233: public Node ifStatement(Node condition, Node action) {
1234: Node v$1 = GNode.create("Block", action);
1235: Node v$2 = GNode.create("ConditionalStatement", condition, v$1,
1236: null);
1237: return v$2;
1238: }
1239:
1240: /**
1241: * Create a conditional statement.
1242: *
1243: * @param argument The argument.
1244: * @return The generic node.
1245: */
1246: public Node ifStatement1(Node argument) {
1247: Node v$1 = GNode.create("NullLiteral", false);
1248: Node v$2 = GNode.create("EqualityExpression", argument, "==",
1249: v$1);
1250: Node v$3 = GNode.create("BooleanLiteral", "false");
1251: Node v$4 = GNode.create("ReturnStatement", v$3);
1252: Node v$5 = GNode.create("Block", v$4);
1253: Node v$6 = GNode.create("ConditionalStatement", v$2, v$5, null);
1254: return v$6;
1255: }
1256:
1257: /**
1258: * Create a conditional statement.
1259: *
1260: * @param argument The argument.
1261: * @return The generic node.
1262: */
1263: public Node ifStatement2(Node argument) {
1264: Node v$1 = GNode.create("QualifiedIdentifier", "Type");
1265: Node v$2 = GNode.create("Type", v$1, null);
1266: Node v$3 = GNode.create("InstanceOfExpression", argument, v$2);
1267: Node v$4 = GNode.create("LogicalNegationExpression", v$3);
1268: Node v$5 = GNode.create("BooleanLiteral", "false");
1269: Node v$6 = GNode.create("ReturnStatement", v$5);
1270: Node v$7 = GNode.create("Block", v$6);
1271: Node v$8 = GNode.create("ConditionalStatement", v$4, v$7, null);
1272: return v$8;
1273: }
1274:
1275: /**
1276: * Create a conditional statement.
1277: *
1278: * @param arg1 The arg1.
1279: * @param arg2 The arg2.
1280: * @param arg3 The arg3.
1281: * @param arg4 The arg4.
1282: * @return The generic node.
1283: */
1284: public Node ifStatement3(Node arg1, Node arg2, Node arg3, Node arg4) {
1285: Node v$1 = GNode.create("NullLiteral", false);
1286: Node v$2 = GNode.create("EqualityExpression", v$1, "!=", arg1);
1287: Node v$3 = GNode.create("LogicalNegationExpression", arg1);
1288: Node v$4 = GNode.create("LogicalAndExpression", v$2, v$3);
1289: Node v$5 = GNode.create("Arguments", arg2, arg3, arg4);
1290: Node v$6 = GNode.create("CallExpression", null, null,
1291: "showMessage", v$5);
1292: Node v$7 = GNode.create("ExpressionStatement", v$6);
1293: Node v$8 = GNode.create("Block", v$7);
1294: Node v$9 = GNode.create("ConditionalStatement", v$4, v$8, null);
1295: return v$9;
1296: }
1297:
1298: /**
1299: * Create a conditional statement.
1300: *
1301: * @param arg The arg.
1302: * @return The generic node.
1303: */
1304: public Node ifStatement4(Node arg) {
1305: Node v$1 = GNode.create("NullLiteral", false);
1306: Node v$2 = GNode.create("EqualityExpression", v$1, "==", arg);
1307: Node v$3 = GNode.create("NullLiteral", false);
1308: Node v$4 = GNode.create("ReturnStatement", v$3);
1309: Node v$5 = GNode.create("Block", v$4);
1310: Node v$6 = GNode.create("ConditionalStatement", v$2, v$5, null);
1311: return v$6;
1312: }
1313:
1314: /**
1315: * Create a conditional statement.
1316: *
1317: * @param arg The arg.
1318: * @return The generic node.
1319: */
1320: public Node ifStatement5(Node arg) {
1321: Node v$1 = GNode.create("NullLiteral", false);
1322: Node v$2 = GNode.create("ReturnStatement", v$1);
1323: Node v$3 = GNode.create("Block", v$2);
1324: Node v$4 = GNode.create("ConditionalStatement", arg, v$3, null);
1325: return v$4;
1326: }
1327:
1328: /**
1329: * Create a conditional expression.
1330: *
1331: * @param condition The condition.
1332: * @param expression The expression.
1333: * @return The generic node.
1334: */
1335: public Node ifExpression(Node condition, Node expression) {
1336: Node v$1 = GNode.create("NullLiteral", false);
1337: Node v$2 = GNode.create("EqualityExpression", v$1, "==",
1338: condition);
1339: Node v$3 = GNode.create("LogicalNegationExpression", condition);
1340: Node v$4 = GNode.create("LogicalOrExpression", v$2, v$3);
1341: Node v$5 = GNode.create("NullLiteral", false);
1342: Node v$6 = GNode.create("ConditionalExpression", v$4, v$5,
1343: expression);
1344: return v$6;
1345: }
1346:
1347: /**
1348: * Create a conditional expression.
1349: *
1350: * @param condition The condition.
1351: * @param expr1 The expr1.
1352: * @param expr2 The expr2.
1353: * @return The generic node.
1354: */
1355: public Node ifElseExpression(Node condition, Node expr1, Node expr2) {
1356: Node v$1 = GNode.create("NullLiteral", false);
1357: Node v$2 = GNode.create("EqualityExpression", v$1, "==",
1358: condition);
1359: Node v$3 = GNode.create("NullLiteral", false);
1360: Node v$4 = GNode.create("ConditionalExpression", condition,
1361: expr1, expr2);
1362: Node v$5 = GNode.create("ConditionalExpression", v$2, v$3, v$4);
1363: return v$5;
1364: }
1365:
1366: /**
1367: * Create a class declaration.
1368: *
1369: * @return The generic node.
1370: */
1371: public Node implements Decl() {
1372: Node v$1 = GNode.create("Modifier", "public");
1373: Node v$2 = GNode.create("Modifier", "static");
1374: Node v$3 = GNode.create("Modifiers", v$1, v$2);
1375: Node v$4 = GNode.create("QualifiedIdentifier", "Type");
1376: Node v$5 = GNode.create("Type", v$4, null);
1377: Node v$6 = GNode.create("Implementation", v$5);
1378: Node v$7 = GNode.create("ClassBody", false);
1379: Node v$8 = GNode.create("ClassDeclaration", v$3, "Name", null,
1380: null, v$6, v$7);
1381: return v$8;
1382: }
1383:
1384: /**
1385: * Create a call expression.
1386: *
1387: * @param name The name.
1388: * @param function The function.
1389: * @param arguments The arguments.
1390: * @return The generic node.
1391: */
1392: public Node invocation(Node name, String function,
1393: List<Node> arguments) {
1394: Node v$1 = GNode.create("Arguments", arguments.size()).addAll(
1395: arguments);
1396: Node v$2 = GNode.create("CallExpression", name, null, function,
1397: v$1);
1398: return v$2;
1399: }
1400:
1401: /**
1402: * Create a field declaration.
1403: *
1404: * @param type1 The type1.
1405: * @param name The name.
1406: * @param type2 The type2.
1407: * @return The generic node.
1408: */
1409: public Node instanceDecl(Node type1, String name, Node type2) {
1410: Node v$1 = GNode.create("Modifier", "final");
1411: Node v$2 = GNode.create("Modifiers", v$1);
1412: Node v$3 = GNode.create("Type", type1, null);
1413: Node v$4 = GNode.create("Arguments", false);
1414: Node v$5 = GNode.create("NewClassExpression", null, null,
1415: type2, v$4, null);
1416: Node v$6 = GNode.create("Declarator", name, null, v$5);
1417: Node v$7 = GNode.create("Declarators", v$6);
1418: Node v$8 = GNode.create("FieldDeclaration", v$2, v$3, v$7);
1419: return v$8;
1420: }
1421:
1422: /**
1423: * Create a call expression.
1424: *
1425: * @param argument The argument.
1426: * @return The generic node.
1427: */
1428: public Node isBottom(Node argument) {
1429: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
1430: Node v$2 = GNode.create("SelectionExpression", v$1, "isBottom");
1431: Node v$3 = GNode.create("Arguments", argument);
1432: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
1433: v$3);
1434: return v$4;
1435: }
1436:
1437: /**
1438: * Create a logical and expression.
1439: *
1440: * @param argument The argument.
1441: * @return The generic node.
1442: */
1443: public Node isEmptyCall(Node argument) {
1444: Node v$1 = GNode.create("NullLiteral", false);
1445: Node v$2 = GNode.create("EqualityExpression", v$1, "!=",
1446: argument);
1447: Node v$3 = GNode.create("QualifiedIdentifier", "Pair");
1448: Node v$4 = GNode.create("Type", v$3, null);
1449: Node v$5 = GNode.create("CastExpression", v$4, argument);
1450: Node v$6 = GNode.create("Arguments", false);
1451: Node v$7 = GNode.create("CallExpression", v$5, null, "isEmpty",
1452: v$6);
1453: Node v$8 = GNode.create("LogicalAndExpression", v$2, v$7);
1454: return v$8;
1455: }
1456:
1457: /**
1458: * Create a method declaration.
1459: *
1460: * @return The generic node.
1461: */
1462: public Node isMethod() {
1463: Node v$1 = GNode.create("Modifier", "public");
1464: Node v$2 = GNode.create("Modifiers", v$1);
1465: Node v$3 = GNode.create("PrimitiveType", "boolean");
1466: Node v$4 = GNode.create("Type", v$3, null);
1467: Node v$5 = GNode.create("FormalParameters", false);
1468: Node v$6 = GNode.create("BooleanLiteral", "false");
1469: Node v$7 = GNode.create("ReturnStatement", v$6);
1470: Node v$8 = GNode.create("Block", v$7);
1471: Node v$9 = GNode.create("MethodDeclaration", v$2, null, v$4,
1472: "isName", v$5, null, null, v$8);
1473: return v$9;
1474: }
1475:
1476: /**
1477: * Create a logical and expression.
1478: *
1479: * @param argument The argument.
1480: * @param argument2 The argument2.
1481: * @return The generic node.
1482: */
1483: public Node isMethodCall(Node argument, String argument2) {
1484: Node v$1 = GNode.create("NullLiteral", false);
1485: Node v$2 = GNode.create("EqualityExpression", v$1, "!=",
1486: argument);
1487: Node v$3 = GNode.create("Arguments", false);
1488: Node v$4 = GNode.create("CallExpression", argument, null,
1489: argument2, v$3);
1490: Node v$5 = GNode.create("LogicalAndExpression", v$2, v$4);
1491: return v$5;
1492: }
1493:
1494: /**
1495: * Create a logical and expression.
1496: *
1497: * @param argument1 The argument1.
1498: * @param argument2 The argument2.
1499: * @return The generic node.
1500: */
1501: public Node jand(Node argument1, Node argument2) {
1502: Node v$1 = GNode.create("LogicalAndExpression", argument1,
1503: argument2);
1504: return v$1;
1505: }
1506:
1507: /**
1508: * Create a logical and expression.
1509: *
1510: * @param argument1 The argument1.
1511: * @param argument2 The argument2.
1512: * @return The generic node.
1513: */
1514: public Node jequals(Node argument1, Node argument2) {
1515: Node v$1 = GNode.create("NullLiteral", false);
1516: Node v$2 = GNode.create("EqualityExpression", v$1, "!=",
1517: argument1);
1518: Node v$3 = GNode.create("Arguments", argument2);
1519: Node v$4 = GNode.create("CallExpression", argument1, null,
1520: "equals", v$3);
1521: Node v$5 = GNode.create("LogicalAndExpression", v$2, v$4);
1522: return v$5;
1523: }
1524:
1525: /**
1526: * Create a call expression.
1527: *
1528: * @param argument The argument.
1529: * @param argument2 The argument2.
1530: * @return The generic node.
1531: */
1532: public Node jequals2(Node argument, Node argument2) {
1533: Node v$1 = GNode.create("Arguments", argument2);
1534: Node v$2 = GNode.create("CallExpression", argument, null,
1535: "equals", v$1);
1536: return v$2;
1537: }
1538:
1539: /**
1540: * Create a logical negation expression.
1541: *
1542: * @param condition The condition.
1543: * @return The generic node.
1544: */
1545: public Node jnot(Node condition) {
1546: Node v$1 = GNode.create("LogicalNegationExpression", condition);
1547: return v$1;
1548: }
1549:
1550: /**
1551: * Create a logical or expression.
1552: *
1553: * @param condition1 The condition1.
1554: * @param condition2 The condition2.
1555: * @return The generic node.
1556: */
1557: public Node jor(Node condition1, Node condition2) {
1558: Node v$1 = GNode.create("LogicalOrExpression", condition1,
1559: condition2);
1560: return v$1;
1561: }
1562:
1563: /**
1564: * Create an equality expression.
1565: *
1566: * @param arg The arg.
1567: * @return The generic node.
1568: */
1569: public Node isNull(Node arg) {
1570: Node v$1 = GNode.create("NullLiteral", false);
1571: Node v$2 = GNode.create("EqualityExpression", v$1, "==", arg);
1572: return v$2;
1573: }
1574:
1575: /**
1576: * Create a call expression.
1577: *
1578: * @param type The type.
1579: * @return The generic node.
1580: */
1581: public Node letExpression(Node type) {
1582: Node v$1 = GNode.create("Type", type, null);
1583: Node v$2 = GNode.create("TypeArguments", v$1);
1584: Node v$3 = GNode.create("TypeInstantiation", "Let", v$2);
1585: Node v$4 = GNode.create("InstantiatedType", v$3);
1586: Node v$5 = GNode.create("Arguments", false);
1587: Node v$6 = GNode.create("ClassBody", false);
1588: Node v$7 = GNode.create("NewClassExpression", null, null, v$4,
1589: v$5, v$6);
1590: Node v$8 = GNode.create("Arguments", false);
1591: Node v$9 = GNode.create("CallExpression", v$7, null, "apply",
1592: v$8);
1593: return v$9;
1594: }
1595:
1596: /**
1597: * Create a field declaration.
1598: *
1599: * @param name The name.
1600: * @param node The node.
1601: * @param size The size.
1602: * @return The generic node.
1603: */
1604: public Node makeNodeBinding(String name, Node node, Node size) {
1605: Node v$1 = GNode.create("Modifier", "final");
1606: Node v$2 = GNode.create("Modifiers", v$1);
1607: Node v$3 = GNode.create("QualifiedIdentifier", "Node");
1608: Node v$4 = GNode.create("Type", v$3, null);
1609: Node v$5 = GNode.create("Arguments", false);
1610: Node v$6 = GNode.create("CallExpression", node, null, "size",
1611: v$5);
1612: Node v$7 = GNode.create("RelationalExpression", v$6, ">", size);
1613: Node v$8 = GNode.create("Arguments", size);
1614: Node v$9 = GNode.create("CallExpression", node, null,
1615: "getGeneric", v$8);
1616: Node v$10 = GNode.create("NullLiteral", false);
1617: Node v$11 = GNode.create("ConditionalExpression", v$7, v$9,
1618: v$10);
1619: Node v$12 = GNode.create("Declarator", name, null, v$11);
1620: Node v$13 = GNode.create("Declarators", v$12);
1621: Node v$14 = GNode.create("FieldDeclaration", v$2, v$4, v$13);
1622: return v$14;
1623: }
1624:
1625: /**
1626: * Create a field declaration.
1627: *
1628: * @param name The name.
1629: * @param node The node.
1630: * @param size The size.
1631: * @return The generic node.
1632: */
1633: public Node makeNodeBinding2(String name, Node node, Node size) {
1634: Node v$1 = GNode.create("Modifier", "final");
1635: Node v$2 = GNode.create("Modifiers", v$1);
1636: Node v$3 = GNode.create("QualifiedIdentifier", "String");
1637: Node v$4 = GNode.create("Type", v$3, null);
1638: Node v$5 = GNode.create("Arguments", false);
1639: Node v$6 = GNode.create("CallExpression", node, null, "size",
1640: v$5);
1641: Node v$7 = GNode.create("RelationalExpression", v$6, ">", size);
1642: Node v$8 = GNode.create("Arguments", size);
1643: Node v$9 = GNode.create("CallExpression", node, null,
1644: "getString", v$8);
1645: Node v$10 = GNode.create("NullLiteral", false);
1646: Node v$11 = GNode.create("ConditionalExpression", v$7, v$9,
1647: v$10);
1648: Node v$12 = GNode.create("Declarator", name, null, v$11);
1649: Node v$13 = GNode.create("Declarators", v$12);
1650: Node v$14 = GNode.create("FieldDeclaration", v$2, v$4, v$13);
1651: return v$14;
1652: }
1653:
1654: /**
1655: * Create a call expression.
1656: *
1657: * @param qualifier The qualifier.
1658: * @param match The match.
1659: * @param argument The argument.
1660: * @return The generic node.
1661: */
1662: public Node matchCall(Node qualifier, String match, Node argument) {
1663: Node v$1 = GNode.create("Arguments", argument);
1664: Node v$2 = GNode.create("CallExpression", qualifier, null,
1665: match, v$1);
1666: return v$2;
1667: }
1668:
1669: /**
1670: * Create a call expression.
1671: *
1672: * @param type The type.
1673: * @param statements The statements.
1674: * @return The generic node.
1675: */
1676: public Node matchExpression(Node type, List<Node> statements) {
1677: Node v$1 = GNode.create("Type", type, null);
1678: Node v$2 = GNode.create("TypeArguments", v$1);
1679: Node v$3 = GNode.create("TypeInstantiation", "Match", v$2);
1680: Node v$4 = GNode.create("InstantiatedType", v$3);
1681: Node v$5 = GNode.create("Arguments", false);
1682: Node v$6 = GNode.create("Modifier", "public");
1683: Node v$7 = GNode.create("Modifiers", v$6);
1684: Node v$8 = GNode.create("Type", type, null);
1685: Node v$9 = GNode.create("FormalParameters", false);
1686: Node v$10 = GNode.create("Block", statements.size()).addAll(
1687: statements);
1688: Node v$11 = GNode.create("MethodDeclaration", v$7, null, v$8,
1689: "apply", v$9, null, null, v$10);
1690: Node v$12 = GNode.create("ClassBody", v$11);
1691: Node v$13 = GNode.create("NewClassExpression", null, null, v$4,
1692: v$5, v$12);
1693: Node v$14 = GNode.create("Arguments", false);
1694: Node v$15 = GNode.create("CallExpression", v$13, null, "apply",
1695: v$14);
1696: return v$15;
1697: }
1698:
1699: /**
1700: * Create a method declaration.
1701: *
1702: * @param match The match.
1703: * @param type The type.
1704: * @param condition The condition.
1705: * @return The generic node.
1706: */
1707: public Node matchFunction(String match, Node type, Node condition) {
1708: Node v$1 = GNode.create("Modifier", "static");
1709: Node v$2 = GNode.create("Modifier", "final");
1710: Node v$3 = GNode.create("Modifiers", v$1, v$2);
1711: Node v$4 = GNode.create("PrimitiveType", "boolean");
1712: Node v$5 = GNode.create("Type", v$4, null);
1713: Node v$6 = GNode.create("Modifiers", false);
1714: Node v$7 = GNode.create("Type", type, null);
1715: Node v$8 = GNode.create("FormalParameter", v$6, v$7, null,
1716: "argument", null);
1717: Node v$9 = GNode.create("FormalParameters", v$8);
1718: Node v$10 = GNode.create("ReturnStatement", condition);
1719: Node v$11 = GNode.create("Block", v$10);
1720: Node v$12 = GNode.create("MethodDeclaration", v$3, null, v$5,
1721: match, v$9, null, null, v$11);
1722: return v$12;
1723: }
1724:
1725: /**
1726: * Create an expression statement.
1727: *
1728: * @param argument The argument.
1729: * @return The generic node.
1730: */
1731: public Node matchingNodesAdd(Node argument) {
1732: Node v$1 = GNode.create("PrimaryIdentifier", "matching_nodes");
1733: Node v$2 = GNode.create("Arguments", argument);
1734: Node v$3 = GNode
1735: .create("CallExpression", v$1, null, "add", v$2);
1736: Node v$4 = GNode.create("ExpressionStatement", v$3);
1737: return v$4;
1738: }
1739:
1740: /**
1741: * Create an expression statement.
1742: *
1743: * @return The generic node.
1744: */
1745: public Node matchingNodesRemove() {
1746: Node v$1 = GNode.create("PrimaryIdentifier", "matching_nodes");
1747: Node v$2 = GNode.create("PrimaryIdentifier", "matching_nodes");
1748: Node v$3 = GNode.create("Arguments", false);
1749: Node v$4 = GNode.create("CallExpression", v$2, null, "size",
1750: v$3);
1751: Node v$5 = GNode.create("IntegerLiteral", "1");
1752: Node v$6 = GNode.create("AdditiveExpression", v$4, "-", v$5);
1753: Node v$7 = GNode.create("Arguments", v$6);
1754: Node v$8 = GNode.create("CallExpression", v$1, null, "remove",
1755: v$7);
1756: Node v$9 = GNode.create("ExpressionStatement", v$8);
1757: return v$9;
1758: }
1759:
1760: /**
1761: * Create a call expression.
1762: *
1763: * @param argument1 The argument1.
1764: * @param argument2 The argument2.
1765: * @return The generic node.
1766: */
1767: public Node multiplyInt(Node argument1, Node argument2) {
1768: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
1769: Node v$2 = GNode.create("SelectionExpression", v$1,
1770: "multiplyInt");
1771: Node v$3 = GNode.create("Arguments", argument1, argument2);
1772: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
1773: v$3);
1774: return v$4;
1775: }
1776:
1777: /**
1778: * Create a call expression.
1779: *
1780: * @param argument1 The argument1.
1781: * @param argument2 The argument2.
1782: * @return The generic node.
1783: */
1784: public Node multiplyFloat64(Node argument1, Node argument2) {
1785: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
1786: Node v$2 = GNode.create("SelectionExpression", v$1,
1787: "multiplyFloat64");
1788: Node v$3 = GNode.create("Arguments", argument1, argument2);
1789: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
1790: v$3);
1791: return v$4;
1792: }
1793:
1794: /**
1795: * Create a new class expression.
1796: *
1797: * @param type The type.
1798: * @param args The args.
1799: * @return The generic node.
1800: */
1801: public Node newExpr(Node type, List<Node> args) {
1802: Node v$1 = GNode.create("Arguments", args.size()).addAll(args);
1803: Node v$2 = GNode.create("NewClassExpression", null, null, type,
1804: v$1, null);
1805: return v$2;
1806: }
1807:
1808: /**
1809: * Create a new class expression.
1810: *
1811: * @param type The type.
1812: * @param argument The argument.
1813: * @return The generic node.
1814: */
1815: public Node newPair(Node type, Node argument) {
1816: Node v$1 = GNode.create("Arguments", argument);
1817: Node v$2 = GNode.create("NewClassExpression", null, null, type,
1818: v$1, null);
1819: return v$2;
1820: }
1821:
1822: /**
1823: * Create a field declaration.
1824: *
1825: * @param type The type.
1826: * @param name The name.
1827: * @return The generic node.
1828: */
1829: public Node newCons(Node type, String name) {
1830: Node v$1 = GNode.create("Modifier", "static");
1831: Node v$2 = GNode.create("Modifier", "final");
1832: Node v$3 = GNode.create("Modifiers", v$1, v$2);
1833: Node v$4 = GNode
1834: .create("TypeInstantiation", "Primitives", null);
1835: Node v$5 = GNode.create("Type", type, null);
1836: Node v$6 = GNode.create("TypeArguments", v$5);
1837: Node v$7 = GNode.create("TypeInstantiation", "Cons", v$6);
1838: Node v$8 = GNode.create("InstantiatedType", v$4, v$7);
1839: Node v$9 = GNode.create("Type", v$8, null);
1840: Node v$10 = GNode.create("TypeInstantiation", "Primitives",
1841: null);
1842: Node v$11 = GNode.create("Type", type, null);
1843: Node v$12 = GNode.create("TypeArguments", v$11);
1844: Node v$13 = GNode.create("TypeInstantiation", "Cons", v$12);
1845: Node v$14 = GNode.create("InstantiatedType", v$10, v$13);
1846: Node v$15 = GNode.create("Arguments", false);
1847: Node v$16 = GNode.create("NewClassExpression", null, null,
1848: v$14, v$15, null);
1849: Node v$17 = GNode.create("Declarator", name, null, v$16);
1850: Node v$18 = GNode.create("Declarators", v$17);
1851: Node v$19 = GNode.create("FieldDeclaration", v$3, v$9, v$18);
1852: return v$19;
1853: }
1854:
1855: /**
1856: * Create a field declaration.
1857: *
1858: * @param type The type.
1859: * @param name The name.
1860: * @return The generic node.
1861: */
1862: public Node newHead(Node type, String name) {
1863: Node v$1 = GNode.create("Modifier", "static");
1864: Node v$2 = GNode.create("Modifier", "final");
1865: Node v$3 = GNode.create("Modifiers", v$1, v$2);
1866: Node v$4 = GNode
1867: .create("TypeInstantiation", "Primitives", null);
1868: Node v$5 = GNode.create("Type", type, null);
1869: Node v$6 = GNode.create("TypeArguments", v$5);
1870: Node v$7 = GNode.create("TypeInstantiation", "Head", v$6);
1871: Node v$8 = GNode.create("InstantiatedType", v$4, v$7);
1872: Node v$9 = GNode.create("Type", v$8, null);
1873: Node v$10 = GNode.create("TypeInstantiation", "Primitives",
1874: null);
1875: Node v$11 = GNode.create("Type", type, null);
1876: Node v$12 = GNode.create("TypeArguments", v$11);
1877: Node v$13 = GNode.create("TypeInstantiation", "Head", v$12);
1878: Node v$14 = GNode.create("InstantiatedType", v$10, v$13);
1879: Node v$15 = GNode.create("Arguments", false);
1880: Node v$16 = GNode.create("NewClassExpression", null, null,
1881: v$14, v$15, null);
1882: Node v$17 = GNode.create("Declarator", name, null, v$16);
1883: Node v$18 = GNode.create("Declarators", v$17);
1884: Node v$19 = GNode.create("FieldDeclaration", v$3, v$9, v$18);
1885: return v$19;
1886: }
1887:
1888: /**
1889: * Create a field declaration.
1890: *
1891: * @param type The type.
1892: * @param name The name.
1893: * @return The generic node.
1894: */
1895: public Node newTail(Node type, String name) {
1896: Node v$1 = GNode.create("Modifier", "static");
1897: Node v$2 = GNode.create("Modifier", "final");
1898: Node v$3 = GNode.create("Modifiers", v$1, v$2);
1899: Node v$4 = GNode
1900: .create("TypeInstantiation", "Primitives", null);
1901: Node v$5 = GNode.create("Type", type, null);
1902: Node v$6 = GNode.create("TypeArguments", v$5);
1903: Node v$7 = GNode.create("TypeInstantiation", "Tail", v$6);
1904: Node v$8 = GNode.create("InstantiatedType", v$4, v$7);
1905: Node v$9 = GNode.create("Type", v$8, null);
1906: Node v$10 = GNode.create("TypeInstantiation", "Primitives",
1907: null);
1908: Node v$11 = GNode.create("Type", type, null);
1909: Node v$12 = GNode.create("TypeArguments", v$11);
1910: Node v$13 = GNode.create("TypeInstantiation", "Tail", v$12);
1911: Node v$14 = GNode.create("InstantiatedType", v$10, v$13);
1912: Node v$15 = GNode.create("Arguments", false);
1913: Node v$16 = GNode.create("NewClassExpression", null, null,
1914: v$14, v$15, null);
1915: Node v$17 = GNode.create("Declarator", name, null, v$16);
1916: Node v$18 = GNode.create("Declarators", v$17);
1917: Node v$19 = GNode.create("FieldDeclaration", v$3, v$9, v$18);
1918: return v$19;
1919: }
1920:
1921: /**
1922: * Create a field declaration.
1923: *
1924: * @param type The type.
1925: * @param name The name.
1926: * @return The generic node.
1927: */
1928: public Node newNth(Node type, String name) {
1929: Node v$1 = GNode.create("Modifier", "static");
1930: Node v$2 = GNode.create("Modifier", "final");
1931: Node v$3 = GNode.create("Modifiers", v$1, v$2);
1932: Node v$4 = GNode
1933: .create("TypeInstantiation", "Primitives", null);
1934: Node v$5 = GNode.create("Type", type, null);
1935: Node v$6 = GNode.create("TypeArguments", v$5);
1936: Node v$7 = GNode.create("TypeInstantiation", "Nth", v$6);
1937: Node v$8 = GNode.create("InstantiatedType", v$4, v$7);
1938: Node v$9 = GNode.create("Type", v$8, null);
1939: Node v$10 = GNode.create("TypeInstantiation", "Primitives",
1940: null);
1941: Node v$11 = GNode.create("Type", type, null);
1942: Node v$12 = GNode.create("TypeArguments", v$11);
1943: Node v$13 = GNode.create("TypeInstantiation", "Nth", v$12);
1944: Node v$14 = GNode.create("InstantiatedType", v$10, v$13);
1945: Node v$15 = GNode.create("Arguments", false);
1946: Node v$16 = GNode.create("NewClassExpression", null, null,
1947: v$14, v$15, null);
1948: Node v$17 = GNode.create("Declarator", name, null, v$16);
1949: Node v$18 = GNode.create("Declarators", v$17);
1950: Node v$19 = GNode.create("FieldDeclaration", v$3, v$9, v$18);
1951: return v$19;
1952: }
1953:
1954: /**
1955: * Create a field declaration.
1956: *
1957: * @param type The type.
1958: * @param name The name.
1959: * @return The generic node.
1960: */
1961: public Node newExists(Node type, String name) {
1962: Node v$1 = GNode.create("Modifier", "static");
1963: Node v$2 = GNode.create("Modifier", "final");
1964: Node v$3 = GNode.create("Modifiers", v$1, v$2);
1965: Node v$4 = GNode
1966: .create("TypeInstantiation", "Primitives", null);
1967: Node v$5 = GNode.create("Type", type, null);
1968: Node v$6 = GNode.create("TypeArguments", v$5);
1969: Node v$7 = GNode.create("TypeInstantiation", "Exists", v$6);
1970: Node v$8 = GNode.create("InstantiatedType", v$4, v$7);
1971: Node v$9 = GNode.create("Type", v$8, null);
1972: Node v$10 = GNode.create("TypeInstantiation", "Primitives",
1973: null);
1974: Node v$11 = GNode.create("Type", type, null);
1975: Node v$12 = GNode.create("TypeArguments", v$11);
1976: Node v$13 = GNode.create("TypeInstantiation", "Exists", v$12);
1977: Node v$14 = GNode.create("InstantiatedType", v$10, v$13);
1978: Node v$15 = GNode.create("Arguments", false);
1979: Node v$16 = GNode.create("NewClassExpression", null, null,
1980: v$14, v$15, null);
1981: Node v$17 = GNode.create("Declarator", name, null, v$16);
1982: Node v$18 = GNode.create("Declarators", v$17);
1983: Node v$19 = GNode.create("FieldDeclaration", v$3, v$9, v$18);
1984: return v$19;
1985: }
1986:
1987: /**
1988: * Create a field declaration.
1989: *
1990: * @param type1 The type1.
1991: * @param type2 The type2.
1992: * @param name The name.
1993: * @return The generic node.
1994: */
1995: public Node newIter(Node type1, Node type2, String name) {
1996: Node v$1 = GNode.create("Modifier", "static");
1997: Node v$2 = GNode.create("Modifier", "final");
1998: Node v$3 = GNode.create("Modifiers", v$1, v$2);
1999: Node v$4 = GNode
2000: .create("TypeInstantiation", "Primitives", null);
2001: Node v$5 = GNode.create("Type", type1, null);
2002: Node v$6 = GNode.create("Type", type2, null);
2003: Node v$7 = GNode.create("TypeArguments", v$5, v$6);
2004: Node v$8 = GNode.create("TypeInstantiation", "Iter", v$7);
2005: Node v$9 = GNode.create("InstantiatedType", v$4, v$8);
2006: Node v$10 = GNode.create("Type", v$9, null);
2007: Node v$11 = GNode.create("TypeInstantiation", "Primitives",
2008: null);
2009: Node v$12 = GNode.create("Type", type1, null);
2010: Node v$13 = GNode.create("Type", type2, null);
2011: Node v$14 = GNode.create("TypeArguments", v$12, v$13);
2012: Node v$15 = GNode.create("TypeInstantiation", "Iter", v$14);
2013: Node v$16 = GNode.create("InstantiatedType", v$11, v$15);
2014: Node v$17 = GNode.create("Arguments", false);
2015: Node v$18 = GNode.create("NewClassExpression", null, null,
2016: v$16, v$17, null);
2017: Node v$19 = GNode.create("Declarator", name, null, v$18);
2018: Node v$20 = GNode.create("Declarators", v$19);
2019: Node v$21 = GNode.create("FieldDeclaration", v$3, v$10, v$20);
2020: return v$21;
2021: }
2022:
2023: /**
2024: * Create a field declaration.
2025: *
2026: * @param type1 The type1.
2027: * @param type2 The type2.
2028: * @param name The name.
2029: * @return The generic node.
2030: */
2031: public Node newMap(Node type1, Node type2, String name) {
2032: Node v$1 = GNode.create("Modifier", "static");
2033: Node v$2 = GNode.create("Modifier", "final");
2034: Node v$3 = GNode.create("Modifiers", v$1, v$2);
2035: Node v$4 = GNode
2036: .create("TypeInstantiation", "Primitives", null);
2037: Node v$5 = GNode.create("Type", type1, null);
2038: Node v$6 = GNode.create("Type", type2, null);
2039: Node v$7 = GNode.create("TypeArguments", v$5, v$6);
2040: Node v$8 = GNode.create("TypeInstantiation", "Map", v$7);
2041: Node v$9 = GNode.create("InstantiatedType", v$4, v$8);
2042: Node v$10 = GNode.create("Type", v$9, null);
2043: Node v$11 = GNode.create("TypeInstantiation", "Primitives",
2044: null);
2045: Node v$12 = GNode.create("Type", type1, null);
2046: Node v$13 = GNode.create("Type", type2, null);
2047: Node v$14 = GNode.create("TypeArguments", v$12, v$13);
2048: Node v$15 = GNode.create("TypeInstantiation", "Map", v$14);
2049: Node v$16 = GNode.create("InstantiatedType", v$11, v$15);
2050: Node v$17 = GNode.create("Arguments", false);
2051: Node v$18 = GNode.create("NewClassExpression", null, null,
2052: v$16, v$17, null);
2053: Node v$19 = GNode.create("Declarator", name, null, v$18);
2054: Node v$20 = GNode.create("Declarators", v$19);
2055: Node v$21 = GNode.create("FieldDeclaration", v$3, v$10, v$20);
2056: return v$21;
2057: }
2058:
2059: /**
2060: * Create a field declaration.
2061: *
2062: * @param type1 The type1.
2063: * @param type2 The type2.
2064: * @param name The name.
2065: * @return The generic node.
2066: */
2067: public Node newFoldl(Node type1, Node type2, String name) {
2068: Node v$1 = GNode.create("Modifier", "static");
2069: Node v$2 = GNode.create("Modifier", "final");
2070: Node v$3 = GNode.create("Modifiers", v$1, v$2);
2071: Node v$4 = GNode
2072: .create("TypeInstantiation", "Primitives", null);
2073: Node v$5 = GNode.create("Type", type1, null);
2074: Node v$6 = GNode.create("Type", type2, null);
2075: Node v$7 = GNode.create("TypeArguments", v$5, v$6);
2076: Node v$8 = GNode.create("TypeInstantiation", "FoldLeft", v$7);
2077: Node v$9 = GNode.create("InstantiatedType", v$4, v$8);
2078: Node v$10 = GNode.create("Type", v$9, null);
2079: Node v$11 = GNode.create("TypeInstantiation", "Primitives",
2080: null);
2081: Node v$12 = GNode.create("Type", type1, null);
2082: Node v$13 = GNode.create("Type", type2, null);
2083: Node v$14 = GNode.create("TypeArguments", v$12, v$13);
2084: Node v$15 = GNode.create("TypeInstantiation", "FoldLeft", v$14);
2085: Node v$16 = GNode.create("InstantiatedType", v$11, v$15);
2086: Node v$17 = GNode.create("Arguments", false);
2087: Node v$18 = GNode.create("NewClassExpression", null, null,
2088: v$16, v$17, null);
2089: Node v$19 = GNode.create("Declarator", name, null, v$18);
2090: Node v$20 = GNode.create("Declarators", v$19);
2091: Node v$21 = GNode.create("FieldDeclaration", v$3, v$10, v$20);
2092: return v$21;
2093: }
2094:
2095: /**
2096: * Create a field declaration.
2097: *
2098: * @param type The type.
2099: * @param name The name.
2100: * @return The generic node.
2101: */
2102: public Node newAppend(Node type, String name) {
2103: Node v$1 = GNode.create("Modifier", "static");
2104: Node v$2 = GNode.create("Modifier", "final");
2105: Node v$3 = GNode.create("Modifiers", v$1, v$2);
2106: Node v$4 = GNode
2107: .create("TypeInstantiation", "Primitives", null);
2108: Node v$5 = GNode.create("Type", type, null);
2109: Node v$6 = GNode.create("TypeArguments", v$5);
2110: Node v$7 = GNode.create("TypeInstantiation", "Append", v$6);
2111: Node v$8 = GNode.create("InstantiatedType", v$4, v$7);
2112: Node v$9 = GNode.create("Type", v$8, null);
2113: Node v$10 = GNode.create("TypeInstantiation", "Primitives",
2114: null);
2115: Node v$11 = GNode.create("Type", type, null);
2116: Node v$12 = GNode.create("TypeArguments", v$11);
2117: Node v$13 = GNode.create("TypeInstantiation", "Append", v$12);
2118: Node v$14 = GNode.create("InstantiatedType", v$10, v$13);
2119: Node v$15 = GNode.create("Arguments", false);
2120: Node v$16 = GNode.create("NewClassExpression", null, null,
2121: v$14, v$15, null);
2122: Node v$17 = GNode.create("Declarator", name, null, v$16);
2123: Node v$18 = GNode.create("Declarators", v$17);
2124: Node v$19 = GNode.create("FieldDeclaration", v$3, v$9, v$18);
2125: return v$19;
2126: }
2127:
2128: /**
2129: * Create a field declaration.
2130: *
2131: * @param type The type.
2132: * @param name The name.
2133: * @return The generic node.
2134: */
2135: public Node newUnion(Node type, String name) {
2136: Node v$1 = GNode.create("Modifier", "static");
2137: Node v$2 = GNode.create("Modifier", "final");
2138: Node v$3 = GNode.create("Modifiers", v$1, v$2);
2139: Node v$4 = GNode
2140: .create("TypeInstantiation", "Primitives", null);
2141: Node v$5 = GNode.create("Type", type, null);
2142: Node v$6 = GNode.create("TypeArguments", v$5);
2143: Node v$7 = GNode.create("TypeInstantiation", "Union", v$6);
2144: Node v$8 = GNode.create("InstantiatedType", v$4, v$7);
2145: Node v$9 = GNode.create("Type", v$8, null);
2146: Node v$10 = GNode.create("TypeInstantiation", "Primitives",
2147: null);
2148: Node v$11 = GNode.create("Type", type, null);
2149: Node v$12 = GNode.create("TypeArguments", v$11);
2150: Node v$13 = GNode.create("TypeInstantiation", "Union", v$12);
2151: Node v$14 = GNode.create("InstantiatedType", v$10, v$13);
2152: Node v$15 = GNode.create("Arguments", false);
2153: Node v$16 = GNode.create("NewClassExpression", null, null,
2154: v$14, v$15, null);
2155: Node v$17 = GNode.create("Declarator", name, null, v$16);
2156: Node v$18 = GNode.create("Declarators", v$17);
2157: Node v$19 = GNode.create("FieldDeclaration", v$3, v$9, v$18);
2158: return v$19;
2159: }
2160:
2161: /**
2162: * Create a field declaration.
2163: *
2164: * @param type The type.
2165: * @param name The name.
2166: * @return The generic node.
2167: */
2168: public Node newIntersection(Node type, String name) {
2169: Node v$1 = GNode.create("Modifier", "static");
2170: Node v$2 = GNode.create("Modifier", "final");
2171: Node v$3 = GNode.create("Modifiers", v$1, v$2);
2172: Node v$4 = GNode
2173: .create("TypeInstantiation", "Primitives", null);
2174: Node v$5 = GNode.create("Type", type, null);
2175: Node v$6 = GNode.create("TypeArguments", v$5);
2176: Node v$7 = GNode.create("TypeInstantiation", "Intersection",
2177: v$6);
2178: Node v$8 = GNode.create("InstantiatedType", v$4, v$7);
2179: Node v$9 = GNode.create("Type", v$8, null);
2180: Node v$10 = GNode.create("TypeInstantiation", "Primitives",
2181: null);
2182: Node v$11 = GNode.create("Type", type, null);
2183: Node v$12 = GNode.create("TypeArguments", v$11);
2184: Node v$13 = GNode.create("TypeInstantiation", "Intersection",
2185: v$12);
2186: Node v$14 = GNode.create("InstantiatedType", v$10, v$13);
2187: Node v$15 = GNode.create("Arguments", false);
2188: Node v$16 = GNode.create("NewClassExpression", null, null,
2189: v$14, v$15, null);
2190: Node v$17 = GNode.create("Declarator", name, null, v$16);
2191: Node v$18 = GNode.create("Declarators", v$17);
2192: Node v$19 = GNode.create("FieldDeclaration", v$3, v$9, v$18);
2193: return v$19;
2194: }
2195:
2196: /**
2197: * Create a field declaration.
2198: *
2199: * @param type The type.
2200: * @param name The name.
2201: * @return The generic node.
2202: */
2203: public Node newSubtraction(Node type, String name) {
2204: Node v$1 = GNode.create("Modifier", "static");
2205: Node v$2 = GNode.create("Modifier", "final");
2206: Node v$3 = GNode.create("Modifiers", v$1, v$2);
2207: Node v$4 = GNode
2208: .create("TypeInstantiation", "Primitives", null);
2209: Node v$5 = GNode.create("Type", type, null);
2210: Node v$6 = GNode.create("TypeArguments", v$5);
2211: Node v$7 = GNode
2212: .create("TypeInstantiation", "Subtraction", v$6);
2213: Node v$8 = GNode.create("InstantiatedType", v$4, v$7);
2214: Node v$9 = GNode.create("Type", v$8, null);
2215: Node v$10 = GNode.create("TypeInstantiation", "Primitives",
2216: null);
2217: Node v$11 = GNode.create("Type", type, null);
2218: Node v$12 = GNode.create("TypeArguments", v$11);
2219: Node v$13 = GNode.create("TypeInstantiation", "Subtraction",
2220: v$12);
2221: Node v$14 = GNode.create("InstantiatedType", v$10, v$13);
2222: Node v$15 = GNode.create("Arguments", false);
2223: Node v$16 = GNode.create("NewClassExpression", null, null,
2224: v$14, v$15, null);
2225: Node v$17 = GNode.create("Declarator", name, null, v$16);
2226: Node v$18 = GNode.create("Declarators", v$17);
2227: Node v$19 = GNode.create("FieldDeclaration", v$3, v$9, v$18);
2228: return v$19;
2229: }
2230:
2231: /**
2232: * Create a call expression.
2233: *
2234: * @param argument The argument.
2235: * @return The generic node.
2236: */
2237: public Node nextCall(Node argument) {
2238: Node v$1 = GNode.create("Arguments", false);
2239: Node v$2 = GNode.create("CallExpression", argument, null,
2240: "next", v$1);
2241: return v$2;
2242: }
2243:
2244: /**
2245: * Create a field declaration.
2246: *
2247: * @return The generic node.
2248: */
2249: public Node nodeTypeDecl() {
2250: Node v$1 = GNode.create("Modifier", "protected");
2251: Node v$2 = GNode.create("Modifiers", v$1);
2252: Node v$3 = GNode.create("QualifiedIdentifier", "String");
2253: Node v$4 = GNode.create("Type", v$3, null);
2254: Node v$5 = GNode.create("NullLiteral", false);
2255: Node v$6 = GNode.create("Declarator", "nodeType", null, v$5);
2256: Node v$7 = GNode.create("Declarators", v$6);
2257: Node v$8 = GNode.create("FieldDeclaration", v$2, v$4, v$7);
2258: return v$8;
2259: }
2260:
2261: /**
2262: * Create a call expression.
2263: *
2264: * @param argument1 The argument1.
2265: * @return The generic node.
2266: */
2267: public Node not(Node argument1) {
2268: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
2269: Node v$2 = GNode.create("SelectionExpression", v$1, "not");
2270: Node v$3 = GNode.create("Arguments", argument1);
2271: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
2272: v$3);
2273: return v$4;
2274: }
2275:
2276: /**
2277: * Create an equality expression.
2278: *
2279: * @param argument The argument.
2280: * @return The generic node.
2281: */
2282: public Node notEqualsBottom(Node argument) {
2283: Node v$1 = GNode.create("NullLiteral", false);
2284: Node v$2 = GNode.create("EqualityExpression", v$1, "!=",
2285: argument);
2286: return v$2;
2287: }
2288:
2289: /**
2290: * Create a call expression.
2291: *
2292: * @param argument1 The argument1.
2293: * @param argument2 The argument2.
2294: * @return The generic node.
2295: */
2296: public Node or(Node argument1, Node argument2) {
2297: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
2298: Node v$2 = GNode.create("SelectionExpression", v$1, "or");
2299: Node v$3 = GNode.create("Arguments", argument1, argument2);
2300: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
2301: v$3);
2302: return v$4;
2303: }
2304:
2305: /**
2306: * Create a call expression.
2307: *
2308: * @param type The type.
2309: * @return The generic node.
2310: */
2311: public Node pairEmpty(Node type) {
2312: Node v$1 = GNode.create("PrimaryIdentifier", "Pair");
2313: Node v$2 = GNode.create("Type", type, null);
2314: Node v$3 = GNode.create("TypeArguments", v$2);
2315: Node v$4 = GNode.create("Arguments", false);
2316: Node v$5 = GNode.create("CallExpression", v$1, v$3, "empty",
2317: v$4);
2318: return v$5;
2319: }
2320:
2321: /**
2322: * Create a conditional statement.
2323: *
2324: * @param argument The argument.
2325: * @return The generic node.
2326: */
2327: public Node processScope(Node argument) {
2328: Node v$1 = GNode.create("NullLiteral", false);
2329: Node v$2 = GNode.create("EqualityExpression", v$1, "!=",
2330: argument);
2331: Node v$3 = GNode.create("PrimaryIdentifier",
2332: "processScopeNodes");
2333: Node v$4 = GNode.create("Arguments", false);
2334: Node v$5 = GNode.create("CallExpression", argument, null,
2335: "getName", v$4);
2336: Node v$6 = GNode.create("Arguments", v$5);
2337: Node v$7 = GNode.create("CallExpression", v$3, null,
2338: "contains", v$6);
2339: Node v$8 = GNode.create("LogicalAndExpression", v$2, v$7);
2340: Node v$9 = GNode.create("PrimaryIdentifier", "getScope");
2341: Node v$10 = GNode.create("Arguments", argument, v$9);
2342: Node v$11 = GNode.create("CallExpression", null, null,
2343: "processScope", v$10);
2344: Node v$12 = GNode.create("ExpressionStatement", v$11);
2345: Node v$13 = GNode.create("Block", v$12);
2346: Node v$14 = GNode.create("ConditionalStatement", v$8, v$13,
2347: null);
2348: return v$14;
2349: }
2350:
2351: /**
2352: * Create a field declaration.
2353: *
2354: * @param type The type.
2355: * @param name The name.
2356: * @return The generic node.
2357: */
2358: public Node publicFieldDecl(Node type, String name) {
2359: Node v$1 = GNode.create("Modifier", "public");
2360: Node v$2 = GNode.create("Modifiers", v$1);
2361: Node v$3 = GNode.create("Type", type, null);
2362: Node v$4 = GNode.create("Declarator", name, null, null);
2363: Node v$5 = GNode.create("Declarators", v$4);
2364: Node v$6 = GNode.create("FieldDeclaration", v$2, v$3, v$5);
2365: return v$6;
2366: }
2367:
2368: /**
2369: * Create a field declaration.
2370: *
2371: * @return The generic node.
2372: */
2373: public Node recordFieldEqual() {
2374: Node v$1 = GNode.create("Modifiers", false);
2375: Node v$2 = GNode.create("QualifiedIdentifier", "type");
2376: Node v$3 = GNode.create("Type", v$2, null);
2377: Node v$4 = GNode.create("QualifiedIdentifier", "type");
2378: Node v$5 = GNode.create("Type", v$4, null);
2379: Node v$6 = GNode.create("PrimaryIdentifier", "o");
2380: Node v$7 = GNode.create("CastExpression", v$5, v$6);
2381: Node v$8 = GNode.create("Declarator", "other", null, v$7);
2382: Node v$9 = GNode.create("Declarators", v$8);
2383: Node v$10 = GNode.create("FieldDeclaration", v$1, v$3, v$9);
2384: return v$10;
2385: }
2386:
2387: /**
2388: * Create a field declaration.
2389: *
2390: * @return The generic node.
2391: */
2392: public Node recordEqualReturn() {
2393: Node v$1 = GNode.create("Modifiers", false);
2394: Node v$2 = GNode.create("PrimitiveType", "boolean");
2395: Node v$3 = GNode.create("Type", v$2, null);
2396: Node v$4 = GNode.create("BooleanLiteral", "true");
2397: Node v$5 = GNode.create("Declarator", "res", null, v$4);
2398: Node v$6 = GNode.create("Declarators", v$5);
2399: Node v$7 = GNode.create("FieldDeclaration", v$1, v$3, v$6);
2400: return v$7;
2401: }
2402:
2403: /**
2404: * Create a call expression.
2405: *
2406: * @param arg1 The arg1.
2407: * @param arg2 The arg2.
2408: * @param initStatements The initStatements.
2409: * @return The generic node.
2410: */
2411: public Node reduceExpression(Node arg1, Node arg2,
2412: List<Node> initStatements) {
2413: Node v$1 = GNode.create("QualifiedIdentifier", "Reduction");
2414: Node v$2 = GNode.create("PrimaryIdentifier", "matching_nodes");
2415: Node v$3 = GNode.create("PrimaryIdentifier", "matching_nodes");
2416: Node v$4 = GNode.create("Arguments", false);
2417: Node v$5 = GNode.create("CallExpression", v$3, null, "size",
2418: v$4);
2419: Node v$6 = GNode.create("IntegerLiteral", "1");
2420: Node v$7 = GNode.create("AdditiveExpression", v$5, "-", v$6);
2421: Node v$8 = GNode.create("Arguments", v$7);
2422: Node v$9 = GNode
2423: .create("CallExpression", v$2, null, "get", v$8);
2424: Node v$10 = GNode.create("Arguments", arg1, arg2, v$9);
2425: Node v$11 = GNode.create("Block", initStatements.size())
2426: .addAll(initStatements);
2427: Node v$12 = GNode.create("BlockDeclaration", null, v$11);
2428: Node v$13 = GNode.create("ClassBody", v$12);
2429: Node v$14 = GNode.create("NewClassExpression", null, null, v$1,
2430: v$10, v$13);
2431: Node v$15 = GNode.create("Arguments", false);
2432: Node v$16 = GNode.create("CallExpression", v$14, null, "apply",
2433: v$15);
2434: return v$16;
2435: }
2436:
2437: /**
2438: * Create an expression statement.
2439: *
2440: * @return The generic node.
2441: */
2442: public Node reduceReq() {
2443: Node v$1 = GNode.create("Arguments", false);
2444: Node v$2 = GNode.create("CallExpression", null, null, "setReq",
2445: v$1);
2446: Node v$3 = GNode.create("ExpressionStatement", v$2);
2447: return v$3;
2448: }
2449:
2450: /**
2451: * Create an expression statement.
2452: *
2453: * @return The generic node.
2454: */
2455: public Node reduceSing() {
2456: Node v$1 = GNode.create("Arguments", false);
2457: Node v$2 = GNode.create("CallExpression", null, null,
2458: "setSing", v$1);
2459: Node v$3 = GNode.create("ExpressionStatement", v$2);
2460: return v$3;
2461: }
2462:
2463: /**
2464: * Create an expression statement.
2465: *
2466: * @return The generic node.
2467: */
2468: public Node reduceOpt() {
2469: Node v$1 = GNode.create("Arguments", false);
2470: Node v$2 = GNode.create("CallExpression", null, null, "setOpt",
2471: v$1);
2472: Node v$3 = GNode.create("ExpressionStatement", v$2);
2473: return v$3;
2474: }
2475:
2476: /**
2477: * Create an expression statement.
2478: *
2479: * @return The generic node.
2480: */
2481: public Node reduceList() {
2482: Node v$1 = GNode.create("Arguments", false);
2483: Node v$2 = GNode.create("CallExpression", null, null,
2484: "setList", v$1);
2485: Node v$3 = GNode.create("ExpressionStatement", v$2);
2486: return v$3;
2487: }
2488:
2489: /**
2490: * Create an expression statement.
2491: *
2492: * @return The generic node.
2493: */
2494: public Node reduceSet() {
2495: Node v$1 = GNode.create("Arguments", false);
2496: Node v$2 = GNode.create("CallExpression", null, null, "setSet",
2497: v$1);
2498: Node v$3 = GNode.create("ExpressionStatement", v$2);
2499: return v$3;
2500: }
2501:
2502: /**
2503: * Create an expression statement.
2504: *
2505: * @return The generic node.
2506: */
2507: public Node reduceDup() {
2508: Node v$1 = GNode.create("Arguments", false);
2509: Node v$2 = GNode.create("CallExpression", null, null, "setDup",
2510: v$1);
2511: Node v$3 = GNode.create("ExpressionStatement", v$2);
2512: return v$3;
2513: }
2514:
2515: /**
2516: * Create an expression statement.
2517: *
2518: * @return The generic node.
2519: */
2520: public Node reduceNodup() {
2521: Node v$1 = GNode.create("Arguments", false);
2522: Node v$2 = GNode.create("CallExpression", null, null,
2523: "setNodup", v$1);
2524: Node v$3 = GNode.create("ExpressionStatement", v$2);
2525: return v$3;
2526: }
2527:
2528: /**
2529: * Create an expression statement.
2530: *
2531: * @param arg The arg.
2532: * @return The generic node.
2533: */
2534: public Node reduceTag(Node arg) {
2535: Node v$1 = GNode.create("Arguments", arg);
2536: Node v$2 = GNode.create("CallExpression", null, null, "setTag",
2537: v$1);
2538: Node v$3 = GNode.create("ExpressionStatement", v$2);
2539: return v$3;
2540: }
2541:
2542: /**
2543: * Create an expression statement.
2544: *
2545: * @param set The set.
2546: * @return The generic node.
2547: */
2548: public Node reduceSet(Node set) {
2549: Node v$1 = GNode.create("Arguments", set);
2550: Node v$2 = GNode.create("CallExpression", null, null, "setSet",
2551: v$1);
2552: Node v$3 = GNode.create("ExpressionStatement", v$2);
2553: return v$3;
2554: }
2555:
2556: /**
2557: * Create an expression statement.
2558: *
2559: * @param patterns The patterns.
2560: * @return The generic node.
2561: */
2562: public Node reduceAddPatterns(List<Node> patterns) {
2563: Node v$1 = GNode.create("Arguments", patterns.size()).addAll(
2564: patterns);
2565: Node v$2 = GNode.create("CallExpression", null, null,
2566: "addPattern", v$1);
2567: Node v$3 = GNode.create("ExpressionStatement", v$2);
2568: return v$3;
2569: }
2570:
2571: /**
2572: * Create a field declaration.
2573: *
2574: * @param name The name.
2575: * @param arg The arg.
2576: * @return The generic node.
2577: */
2578: public Node reduceGetMatch(String name, Node arg) {
2579: Node v$1 = GNode.create("Modifiers", false);
2580: Node v$2 = GNode.create("QualifiedIdentifier", "Node");
2581: Node v$3 = GNode.create("Type", v$2, null);
2582: Node v$4 = GNode.create("Arguments", arg);
2583: Node v$5 = GNode.create("CallExpression", null, null,
2584: "getMatch", v$4);
2585: Node v$6 = GNode.create("Declarator", name, null, v$5);
2586: Node v$7 = GNode.create("Declarators", v$6);
2587: Node v$8 = GNode.create("FieldDeclaration", v$1, v$3, v$7);
2588: return v$8;
2589: }
2590:
2591: /**
2592: * Create a call expression.
2593: *
2594: * @param name The name.
2595: * @param argument1 The argument1.
2596: * @param argument2 The argument2.
2597: * @return The generic node.
2598: */
2599: public Node relationalExpr(Node name, Node argument1, Node argument2) {
2600: Node v$1 = GNode.create("Arguments", argument1, argument2);
2601: Node v$2 = GNode.create("CallExpression", name, null, "apply",
2602: v$1);
2603: return v$2;
2604: }
2605:
2606: /**
2607: * Create a call expression.
2608: *
2609: * @param type The type.
2610: * @param instructions The instructions.
2611: * @return The generic node.
2612: */
2613: public Node requireExpression(Node type, List<Node> instructions) {
2614: Node v$1 = GNode.create("Type", type, null);
2615: Node v$2 = GNode.create("TypeArguments", v$1);
2616: Node v$3 = GNode.create("TypeInstantiation", "Require", v$2);
2617: Node v$4 = GNode.create("InstantiatedType", v$3);
2618: Node v$5 = GNode.create("Arguments", false);
2619: Node v$6 = GNode.create("Modifier", "public");
2620: Node v$7 = GNode.create("Modifiers", v$6);
2621: Node v$8 = GNode.create("Type", type, null);
2622: Node v$9 = GNode.create("FormalParameters", false);
2623: Node v$10 = GNode.create("Block", instructions.size()).addAll(
2624: instructions);
2625: Node v$11 = GNode.create("MethodDeclaration", v$7, null, v$8,
2626: "apply", v$9, null, null, v$10);
2627: Node v$12 = GNode.create("ClassBody", v$11);
2628: Node v$13 = GNode.create("NewClassExpression", null, null, v$4,
2629: v$5, v$12);
2630: Node v$14 = GNode.create("Arguments", false);
2631: Node v$15 = GNode.create("CallExpression", v$13, null, "apply",
2632: v$14);
2633: return v$15;
2634: }
2635:
2636: /**
2637: * Create a return statement.
2638: *
2639: * @param argument The argument.
2640: * @return The generic node.
2641: */
2642: public Node ret(Node argument) {
2643: Node v$1 = GNode.create("ReturnStatement", argument);
2644: return v$1;
2645: }
2646:
2647: /**
2648: * Create a return statement.
2649: *
2650: * @return The generic node.
2651: */
2652: public Node returnBottom() {
2653: Node v$1 = GNode.create("NullLiteral", false);
2654: Node v$2 = GNode.create("ReturnStatement", v$1);
2655: return v$2;
2656: }
2657:
2658: /**
2659: * Create a method declaration.
2660: *
2661: * @param statments The statments.
2662: * @return The generic node.
2663: */
2664: public Node setMethod(List<Node> statments) {
2665: Node v$1 = GNode.create("Modifiers", false);
2666: Node v$2 = GNode.create("VoidType", false);
2667: Node v$3 = GNode.create("FormalParameters", false);
2668: Node v$4 = GNode.create("Block", statments.size()).addAll(
2669: statments);
2670: Node v$5 = GNode.create("MethodDeclaration", v$1, null, v$2,
2671: "set", v$3, null, null, v$4);
2672: return v$5;
2673: }
2674:
2675: /**
2676: * Create a method declaration.
2677: *
2678: * @param argument The argument.
2679: * @return The generic node.
2680: */
2681: public Node sizeMethod(Node argument) {
2682: Node v$1 = GNode.create("Modifier", "public");
2683: Node v$2 = GNode.create("Modifiers", v$1);
2684: Node v$3 = GNode.create("PrimitiveType", "int");
2685: Node v$4 = GNode.create("Type", v$3, null);
2686: Node v$5 = GNode.create("FormalParameters", false);
2687: Node v$6 = GNode.create("ReturnStatement", argument);
2688: Node v$7 = GNode.create("Block", v$6);
2689: Node v$8 = GNode.create("MethodDeclaration", v$2, null, v$4,
2690: "size", v$5, null, null, v$7);
2691: return v$8;
2692: }
2693:
2694: /**
2695: * Create a relational expression.
2696: *
2697: * @param argument The argument.
2698: * @param value The value.
2699: * @return The generic node.
2700: */
2701: public Node sizeGreater(Node argument, Node value) {
2702: Node v$1 = GNode.create("Arguments", false);
2703: Node v$2 = GNode.create("CallExpression", argument, null,
2704: "size", v$1);
2705: Node v$3 = GNode
2706: .create("RelationalExpression", v$2, ">", value);
2707: return v$3;
2708: }
2709:
2710: /**
2711: * Create a relational expression.
2712: *
2713: * @param argument The argument.
2714: * @param value The value.
2715: * @return The generic node.
2716: */
2717: public Node sizeGreaterEqual(Node argument, Node value) {
2718: Node v$1 = GNode.create("Arguments", false);
2719: Node v$2 = GNode.create("CallExpression", argument, null,
2720: "size", v$1);
2721: Node v$3 = GNode.create("RelationalExpression", v$2, ">=",
2722: value);
2723: return v$3;
2724: }
2725:
2726: /**
2727: * Create a relational expression.
2728: *
2729: * @param argument The argument.
2730: * @param value The value.
2731: * @return The generic node.
2732: */
2733: public Node sizeLess(Node argument, Node value) {
2734: Node v$1 = GNode.create("Arguments", false);
2735: Node v$2 = GNode.create("CallExpression", argument, null,
2736: "size", v$1);
2737: Node v$3 = GNode
2738: .create("RelationalExpression", v$2, "<", value);
2739: return v$3;
2740: }
2741:
2742: /**
2743: * Create an equality expression.
2744: *
2745: * @param argument The argument.
2746: * @param value The value.
2747: * @return The generic node.
2748: */
2749: public Node sizeEqual(Node argument, Node value) {
2750: Node v$1 = GNode.create("Arguments", false);
2751: Node v$2 = GNode.create("CallExpression", argument, null,
2752: "size", v$1);
2753: Node v$3 = GNode.create("EqualityExpression", v$2, "==", value);
2754: return v$3;
2755: }
2756:
2757: /**
2758: * Create a field declaration.
2759: *
2760: * @param listName The listName.
2761: * @return The generic node.
2762: */
2763: public Node spOffspringList(String listName) {
2764: Node v$1 = GNode.create("Modifiers", false);
2765: Node v$2 = GNode.create("QualifiedIdentifier", "Node");
2766: Node v$3 = GNode.create("Type", v$2, null);
2767: Node v$4 = GNode.create("TypeArguments", v$3);
2768: Node v$5 = GNode.create("TypeInstantiation", "List", v$4);
2769: Node v$6 = GNode.create("InstantiatedType", v$5);
2770: Node v$7 = GNode.create("Type", v$6, null);
2771: Node v$8 = GNode.create("QualifiedIdentifier", "Node");
2772: Node v$9 = GNode.create("Type", v$8, null);
2773: Node v$10 = GNode.create("TypeArguments", v$9);
2774: Node v$11 = GNode
2775: .create("TypeInstantiation", "ArrayList", v$10);
2776: Node v$12 = GNode.create("InstantiatedType", v$11);
2777: Node v$13 = GNode.create("Arguments", false);
2778: Node v$14 = GNode.create("NewClassExpression", null, null,
2779: v$12, v$13, null);
2780: Node v$15 = GNode.create("Declarator", listName, null, v$14);
2781: Node v$16 = GNode.create("Declarators", v$15);
2782: Node v$17 = GNode.create("FieldDeclaration", v$1, v$7, v$16);
2783: return v$17;
2784: }
2785:
2786: /**
2787: * Create a field declaration.
2788: *
2789: * @param nodeName The nodeName.
2790: * @param param The param.
2791: * @return The generic node.
2792: */
2793: public Node spRunNode(String nodeName, Node param) {
2794: Node v$1 = GNode.create("Modifiers", false);
2795: Node v$2 = GNode.create("QualifiedIdentifier", "Node");
2796: Node v$3 = GNode.create("Type", v$2, null);
2797: Node v$4 = GNode.create("Declarator", nodeName, null, param);
2798: Node v$5 = GNode.create("Declarators", v$4);
2799: Node v$6 = GNode.create("FieldDeclaration", v$1, v$3, v$5);
2800: return v$6;
2801: }
2802:
2803: /**
2804: * Create an expression statement.
2805: *
2806: * @param nodeName The nodeName.
2807: * @param index The index.
2808: * @return The generic node.
2809: */
2810: public Node spGetGeneric(Node nodeName, Node index) {
2811: Node v$1 = GNode.create("Arguments", index);
2812: Node v$2 = GNode.create("CallExpression", nodeName, null,
2813: "getGeneric", v$1);
2814: Node v$3 = GNode.create("Expression", nodeName, "=", v$2);
2815: Node v$4 = GNode.create("ExpressionStatement", v$3);
2816: return v$4;
2817: }
2818:
2819: /**
2820: * Create an expression statement.
2821: *
2822: * @param listName The listName.
2823: * @param nodeName The nodeName.
2824: * @return The generic node.
2825: */
2826: public Node spOffspringListAdd(Node listName, Node nodeName) {
2827: Node v$1 = GNode.create("IntegerLiteral", "0");
2828: Node v$2 = GNode.create("Arguments", v$1, nodeName);
2829: Node v$3 = GNode.create("CallExpression", listName, null,
2830: "add", v$2);
2831: Node v$4 = GNode.create("ExpressionStatement", v$3);
2832: return v$4;
2833: }
2834:
2835: /**
2836: * Create a for statement.
2837: *
2838: * @param listName The listName.
2839: * @return The generic node.
2840: */
2841: public Node spForLoop(Node listName) {
2842: Node v$1 = GNode.create("Modifiers", false);
2843: Node v$2 = GNode.create("QualifiedIdentifier", "Node");
2844: Node v$3 = GNode.create("Type", v$2, null);
2845: Node v$4 = GNode.create("EnhancedForControl", v$1, v$3, "no",
2846: listName);
2847: Node v$5 = GNode.create("PrimaryIdentifier", "no");
2848: Node v$6 = GNode.create("Arguments", v$5);
2849: Node v$7 = GNode.create("CallExpression", null, null,
2850: "checkExitScope", v$6);
2851: Node v$8 = GNode.create("ExpressionStatement", v$7);
2852: Node v$9 = GNode.create("Block", v$8);
2853: Node v$10 = GNode.create("ForStatement", v$4, v$9);
2854: return v$10;
2855: }
2856:
2857: /**
2858: * Create a field declaration.
2859: *
2860: * @param name The name.
2861: * @param value The value.
2862: * @return The generic node.
2863: */
2864: public Node storeValue(String name, Node value) {
2865: Node v$1 = GNode.create("Modifier", "final");
2866: Node v$2 = GNode.create("Modifiers", v$1);
2867: Node v$3 = GNode.create("QualifiedIdentifier", "Object");
2868: Node v$4 = GNode.create("Type", v$3, null);
2869: Node v$5 = GNode.create("Declarator", name, null, value);
2870: Node v$6 = GNode.create("Declarators", v$5);
2871: Node v$7 = GNode.create("FieldDeclaration", v$2, v$4, v$6);
2872: return v$7;
2873: }
2874:
2875: /**
2876: * Create a field declaration.
2877: *
2878: * @param type The type.
2879: * @param value The value.
2880: * @return The generic node.
2881: */
2882: public Node staticFieldDecl(Node type, Node value) {
2883: Node v$1 = GNode.create("Modifier", "final");
2884: Node v$2 = GNode.create("Modifier", "static");
2885: Node v$3 = GNode.create("Modifier", "protected");
2886: Node v$4 = GNode.create("Modifiers", v$1, v$2, v$3);
2887: Node v$5 = GNode.create("Type", type, null);
2888: Node v$6 = GNode.create("Declarator", "name", null, value);
2889: Node v$7 = GNode.create("Declarators", v$6);
2890: Node v$8 = GNode.create("FieldDeclaration", v$4, v$5, v$7);
2891: return v$8;
2892: }
2893:
2894: /**
2895: * Create a call expression.
2896: *
2897: * @param argument1 The argument1.
2898: * @param argument2 The argument2.
2899: * @return The generic node.
2900: */
2901: public Node subtractInt(Node argument1, Node argument2) {
2902: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
2903: Node v$2 = GNode.create("SelectionExpression", v$1,
2904: "subtractInt");
2905: Node v$3 = GNode.create("Arguments", argument1, argument2);
2906: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
2907: v$3);
2908: return v$4;
2909: }
2910:
2911: /**
2912: * Create a call expression.
2913: *
2914: * @param argument1 The argument1.
2915: * @param argument2 The argument2.
2916: * @return The generic node.
2917: */
2918: public Node subtractFloat64(Node argument1, Node argument2) {
2919: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
2920: Node v$2 = GNode.create("SelectionExpression", v$1,
2921: "subtractFloat64");
2922: Node v$3 = GNode.create("Arguments", argument1, argument2);
2923: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
2924: v$3);
2925: return v$4;
2926: }
2927:
2928: /**
2929: * Create a selection expression.
2930: *
2931: * @param support The support.
2932: * @param arg The arg.
2933: * @return The generic node.
2934: */
2935: public Node support(Node support, String arg) {
2936: Node v$1 = GNode.create("SelectionExpression", support, arg);
2937: return v$1;
2938: }
2939:
2940: /**
2941: * Create a field declaration.
2942: *
2943: * @param arg The arg.
2944: * @param value The value.
2945: * @return The generic node.
2946: */
2947: public Node supportNodeMatch(String arg, Node value) {
2948: Node v$1 = GNode.create("Modifier", "public");
2949: Node v$2 = GNode.create("Modifier", "static");
2950: Node v$3 = GNode.create("Modifier", "final");
2951: Node v$4 = GNode.create("Modifiers", v$1, v$2, v$3);
2952: Node v$5 = GNode.create("QualifiedIdentifier", "Analyzer",
2953: "NodeMatch");
2954: Node v$6 = GNode.create("Type", v$5, null);
2955: Node v$7 = GNode.create("Declarator", arg, null, value);
2956: Node v$8 = GNode.create("Declarators", v$7);
2957: Node v$9 = GNode.create("FieldDeclaration", v$4, v$6, v$8);
2958: return v$9;
2959: }
2960:
2961: /**
2962: * Create a switch statement.
2963: *
2964: * @param arg The arg.
2965: * @return The generic node.
2966: */
2967: public Node switchStmnt(Node arg) {
2968: Node v$1 = GNode.create("Arguments", false);
2969: Node v$2 = GNode
2970: .create("CallExpression", arg, null, "tag", v$1);
2971: Node v$3 = GNode.create("SwitchStatement", v$2);
2972: return v$3;
2973: }
2974:
2975: /**
2976: * Create a conditional statement.
2977: *
2978: * @param arg The arg.
2979: * @param action The action.
2980: * @return The generic node.
2981: */
2982: public Node switchWrap(Node arg, Node action) {
2983: Node v$1 = GNode.create("NullLiteral", false);
2984: Node v$2 = GNode.create("EqualityExpression", v$1, "!=", arg);
2985: Node v$3 = GNode.create("ExpressionStatement", action);
2986: Node v$4 = GNode.create("ConditionalStatement", v$2, v$3, null);
2987: return v$4;
2988: }
2989:
2990: /**
2991: * Create a switch statement.
2992: *
2993: * @param c The c.
2994: * @param action The action.
2995: * @return The generic node.
2996: */
2997: public Node caseStmnt(Node c, List<Node> action) {
2998: Node v$1 = GNode.create("PrimaryIdentifier", "blah");
2999: Node v$2 = GNode.create("BreakStatement", null);
3000: Node v$3 = GNode.create("CaseClause", action.size() + 2).add(c)
3001: .addAll(action).add(v$2);
3002: Node v$4 = GNode.create("SwitchStatement", v$1, v$3);
3003: return v$4;
3004: }
3005:
3006: /**
3007: * Create a call expression.
3008: *
3009: * @param argument The argument.
3010: * @return The generic node.
3011: */
3012: public Node tail(Node argument) {
3013: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
3014: Node v$2 = GNode.create("SelectionExpression", v$1, "tail");
3015: Node v$3 = GNode.create("Arguments", argument);
3016: Node v$4 = GNode.create("CallExpression", v$2, null, "apply",
3017: v$3);
3018: return v$4;
3019: }
3020:
3021: /**
3022: * Create a call expression.
3023: *
3024: * @param argument The argument.
3025: * @return The generic node.
3026: */
3027: public Node tailWrapper(Node argument) {
3028: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
3029: Node v$2 = GNode.create("Arguments", argument);
3030: Node v$3 = GNode.create("CallExpression", v$1, null,
3031: "wrapTail", v$2);
3032: return v$3;
3033: }
3034:
3035: /**
3036: * Create a selection expression.
3037: *
3038: * @param tail The tail.
3039: * @return The generic node.
3040: */
3041: public Node this Expr(String tail) {
3042: Node v$1 = GNode.create("ThisExpression", null);
3043: Node v$2 = GNode.create("SelectionExpression", v$1, tail);
3044: return v$2;
3045: }
3046:
3047: /**
3048: * Create a method declaration.
3049: *
3050: * @return The generic node.
3051: */
3052: public Node toStringMethod() {
3053: Node v$1 = GNode.create("Modifier", "public");
3054: Node v$2 = GNode.create("Modifiers", v$1);
3055: Node v$3 = GNode.create("QualifiedIdentifier", "String");
3056: Node v$4 = GNode.create("Type", v$3, null);
3057: Node v$5 = GNode.create("FormalParameters", false);
3058: Node v$6 = GNode.create("Modifiers", false);
3059: Node v$7 = GNode.create("QualifiedIdentifier", "String");
3060: Node v$8 = GNode.create("Type", v$7, null);
3061: Node v$9 = GNode.create("Declarator", "string", null, null);
3062: Node v$10 = GNode.create("Declarators", v$9);
3063: Node v$11 = GNode.create("FieldDeclaration", v$6, v$8, v$10);
3064: Node v$12 = GNode.create("Block", v$11);
3065: Node v$13 = GNode.create("MethodDeclaration", v$2, null, v$4,
3066: "toString", v$5, null, null, v$12);
3067: return v$13;
3068: }
3069:
3070: /**
3071: * Create a call expression.
3072: *
3073: * @param first The first.
3074: * @param second The second.
3075: * @return The generic node.
3076: */
3077: public Node unionWrapper(Node first, Node second) {
3078: Node v$1 = GNode.create("PrimaryIdentifier", "Primitives");
3079: Node v$2 = GNode.create("Arguments", first, second);
3080: Node v$3 = GNode.create("CallExpression", v$1, null,
3081: "wrapUnion", v$2);
3082: return v$3;
3083: }
3084:
3085: }
|