public void doGenerateText(SNode node) {
   if (getBuffer().hasPositionsSupport()) {
     TraceInfoGenerationUtil.createPositionInfo(this, node);
   }
   for (SNode item : SLinkOperations.getTargets(node, "item", true)) {
     if (item != ListSequence.fromList(SLinkOperations.getTargets(node, "item", true)).first()) {
       TextGenManager.instance()
           .appendNodeText(
               this.getContext(),
               this.getBuffer(),
               SLinkOperations.getTarget(node, "separator", true),
               this.getSNode());
     }
     TextGenManager.instance()
         .appendNodeText(this.getContext(), this.getBuffer(), item, this.getSNode());
   }
   if (getBuffer().hasPositionsSupport()) {
     {
       String traceableProperty = "";
       try {
         traceableProperty =
             BehaviorReflection.invokeVirtual(
                 String.class,
                 SNodeOperations.cast(
                     node, "jetbrains.mps.lang.traceable.structure.TraceableConcept"),
                 "virtual_getTraceableProperty_5067982036267369901",
                 new Object[] {});
       } catch (Throwable t) {
         LOG.error("Can't calculate traceable prorerty for a node " + node + ".", t);
       }
       TraceInfoGenerationUtil.fillPositionInfo(this, node, traceableProperty);
     }
   }
 }
예제 #2
0
 public void doGenerateText(SNode node) {
   this.append("@ECHO OFF");
   this.appendNewLine();
   this.append("SETLOCAL ENABLEDELAYEDEXPANSION");
   this.appendNewLine();
   this.append("REM ");
   this.append(SPropertyOperations.getString(node, "name"));
   this.appendNewLine();
   this.append("REM ");
   this.append(SPropertyOperations.getString(node, "description"));
   this.appendNewLine();
   this.appendNewLine();
   TextGenManager.instance()
       .appendNodeText(
           this.getContext(),
           this.getBuffer(),
           SLinkOperations.getTarget(node, "code", true),
           this.getSNode());
   this.appendNewLine();
   this.appendNewLine();
   this.append("GOTO :EOF");
   this.appendNewLine();
   TextGenManager.instance()
       .appendNodeText(
           this.getContext(),
           this.getBuffer(),
           SLinkOperations.getTarget(node, "functions", true),
           this.getSNode());
 }
예제 #3
0
 public void doGenerateText(SNode node) {
   TextGenManager.instance()
       .appendNodeText(
           this.getContext(),
           this.getBuffer(),
           SLinkOperations.getTarget(node, "componentType", true),
           this.getSNode());
   if (ListSequence.fromList(SLinkOperations.getTargets(node, "dimensionExpression", true))
       .isNotEmpty()) {
     for (SNode item : SLinkOperations.getTargets(node, "dimensionExpression", true)) {
       TextGenManager.instance()
           .appendNodeText(this.getContext(), this.getBuffer(), item, this.getSNode());
     }
   }
 }
예제 #4
0
 public void doGenerateText(SNode node) {
   if (getBuffer().hasPositionsSupport()) {
     TraceInfoGenerationUtil.createPositionInfo(this, node);
   }
   this.increaseDepth();
   TextGenManager.instance()
       .appendNodeText(
           this.getContext(),
           this.getBuffer(),
           SLinkOperations.getTarget(node, "itemList", true),
           this.getSNode());
   this.decreaseDepth();
   if (getBuffer().hasPositionsSupport()) {
     {
       String traceableProperty = "";
       try {
         traceableProperty =
             BehaviorReflection.invokeVirtual(
                 String.class,
                 SNodeOperations.cast(
                     node, "jetbrains.mps.lang.traceable.structure.TraceableConcept"),
                 "virtual_getTraceableProperty_5067982036267369901",
                 new Object[] {});
       } catch (Throwable t) {
         if (LOG.isEnabledFor(Priority.ERROR)) {
           LOG.error("Can't calculate traceable prorerty for a node " + node + ".", t);
         }
       }
       TraceInfoGenerationUtil.fillPositionInfo(this, node, traceableProperty);
     }
   }
 }
예제 #5
0
 public static String getFileName(SNode outputRootNode) {
   // TODO refactor, use DefaultFileGenerator.getFileName
   String extension = TextGenManager.instance().getExtension(outputRootNode);
   return (extension == null)
       ? outputRootNode.getName()
       : outputRootNode.getName() + "." + extension;
 }
예제 #6
0
 public static void collection(List<SNode> nodes, final SNodeTextGen textGen) {
   if (ListSequence.fromList(nodes).isNotEmpty()) {
     for (SNode item : nodes) {
       TextGenManager.instance()
           .appendNodeText(textGen.getContext(), textGen.getBuffer(), item, textGen.getSNode());
     }
   }
   textGen.appendNewLine();
 }
예제 #7
0
 public static void innerClassifiers(SNode concept, final SNodeTextGen textGen) {
   for (SNode classifier : SLinkOperations.getTargets(concept, "staticInnerClassifiers", true)) {
     TextGenManager.instance()
         .appendNodeText(
             textGen.getContext(), textGen.getBuffer(), classifier, textGen.getSNode());
     if (!(classifier.equals(
         ListSequence.fromList(SLinkOperations.getTargets(concept, "staticInnerClassifiers", true))
             .last()))) {
       textGen.appendNewLine();
     }
   }
 }
예제 #8
0
 public static void body(SNode concept, final SNodeTextGen textGen) {
   boolean needNewLine = false;
   if ((SLinkOperations.getTarget(concept, "instanceInitializer", true) != null)) {
     TextGenManager.instance()
         .appendNodeText(
             textGen.getContext(),
             textGen.getBuffer(),
             SLinkOperations.getTarget(concept, "instanceInitializer", true),
             textGen.getSNode());
     needNewLine = true;
   }
   if (ListSequence.fromList(SLinkOperations.getTargets(concept, "staticField", true))
       .isNotEmpty()) {
     BaseClassConceptTextGen.collection(
         SLinkOperations.getTargets(concept, "staticField", true), textGen);
     needNewLine = true;
   }
   if (ListSequence.fromList(SLinkOperations.getTargets(concept, "field", true)).isNotEmpty()) {
     BaseClassConceptTextGen.collection(
         SLinkOperations.getTargets(concept, "field", true), textGen);
     needNewLine = true;
   }
   if (ListSequence.fromList(SLinkOperations.getTargets(concept, "constructor", true))
       .isNotEmpty()) {
     for (SNode constructor : SLinkOperations.getTargets(concept, "constructor", true)) {
       TextGenManager.instance()
           .appendNodeText(
               textGen.getContext(), textGen.getBuffer(), constructor, textGen.getSNode());
       textGen.appendNewLine();
     }
     needNewLine = true;
   }
   if (ListSequence.fromList(SLinkOperations.getTargets(concept, "method", true)).isNotEmpty()) {
     if (ListSequence.fromList(SLinkOperations.getTargets(concept, "method", true)).isNotEmpty()) {
       for (SNode item : SLinkOperations.getTargets(concept, "method", true)) {
         TextGenManager.instance()
             .appendNodeText(textGen.getContext(), textGen.getBuffer(), item, textGen.getSNode());
       }
     }
     needNewLine = true;
   }
   if (ListSequence.fromList(SLinkOperations.getTargets(concept, "staticMethod", true))
       .isNotEmpty()) {
     if (ListSequence.fromList(SLinkOperations.getTargets(concept, "staticMethod", true))
         .isNotEmpty()) {
       for (SNode item : SLinkOperations.getTargets(concept, "staticMethod", true)) {
         TextGenManager.instance()
             .appendNodeText(textGen.getContext(), textGen.getBuffer(), item, textGen.getSNode());
       }
     }
     needNewLine = true;
   }
   if (ListSequence.fromList(SLinkOperations.getTargets(concept, "staticInnerClassifiers", true))
       .isNotEmpty()) {
     textGen.appendNewLine();
     BaseClassConceptTextGen.innerClassifiers(concept, textGen);
     needNewLine = true;
   }
   if ((SLinkOperations.getTarget(concept, "staticInitializer", true) != null)) {
     BaseLanguageTextGen.newLine(needNewLine, textGen);
     textGen.appendWithIndent("static {");
     textGen.increaseDepth();
     TextGenManager.instance()
         .appendNodeText(
             textGen.getContext(),
             textGen.getBuffer(),
             SLinkOperations.getTarget(concept, "staticInitializer", true),
             textGen.getSNode());
     textGen.appendNewLine();
     textGen.decreaseDepth();
     textGen.appendWithIndent("}");
     textGen.appendNewLine();
     needNewLine = true;
   }
   if ((SLinkOperations.getTarget(concept, "classInitializer", true) != null)) {
     BaseLanguageTextGen.newLine(needNewLine, textGen);
     textGen.appendWithIndent("static {");
     textGen.increaseDepth();
     TextGenManager.instance()
         .appendNodeText(
             textGen.getContext(),
             textGen.getBuffer(),
             SLinkOperations.getTarget(
                 SLinkOperations.getTarget(concept, "classInitializer", true),
                 "statementList",
                 true),
             textGen.getSNode());
     textGen.appendNewLine();
     textGen.decreaseDepth();
     textGen.appendWithIndent("}");
     textGen.appendNewLine();
   }
 }