Examples of ProductionNode


Examples of at.ssw.coco.lib.model.atgAst.nodeTypes.ProductionNode

        public boolean visit(AbstractAtgAstNode node) {
         
          if (node instanceof ProductionNode &&     // production node
            (globalReformat() || localSelection(node) || localCursorPos(node)))
          {             
            ProductionNode productionNode = (ProductionNode) node;
            IEditorInput editorInput = info.getAtgEditor().getEditorInput();
            IDocumentProvider documentProvider = info.getAtgEditor().getDocumentProvider();
            IDocument document = documentProvider.getDocument(editorInput);

            String production = null;
            try {
              production = document.get
                  productionNode.getRegion().getOffset(),
                  productionNode.getRegion().getLength());
              try {
                ATGProductionReformatter atgProductionReformatter = new ATGProductionReformatter(document, productionNode, info);
                production = atgProductionReformatter.reformat();
                ReplaceEdit edit = new ReplaceEdit
                    productionNode.getRegion().getOffset(),
                    productionNode.getRegion().getLength(),
                    production);     
                fileChangeRootEdit.addChild(edit);
              } catch (Exception e) {
                e.printStackTrace();
              }
View Full Code Here

Examples of at.ssw.coco.lib.model.atgAst.nodeTypes.ProductionNode

    assertEquals(3, productionNodes.size());   
  }
 
  @Test
  public void testProductionNode0() {
    ProductionNode productionNode =
      root.getCompilerNode().getParserSpecNode().getProductionNodes().get(0);
    checkNode(productionNode, 463, 319, root.getCompilerNode().getParserSpecNode());
   
    //Ident
    IdentNode identNode = productionNode.getIdentNode();
    checkNode(identNode, 463, 13, productionNode);
    assertTrue(identNode.getIdent().equals("JunitTestFile"));

    //AttrDecl
    AttrDeclNode attrDeclNode = productionNode.getAttrDeclNode();
    assertNull(attrDeclNode);
   
    //SemText
    SemTextNode semTextNode = productionNode.getSemTextNode();
    checkNode(semTextNode, 486, 124, productionNode);
  }
View Full Code Here

Examples of at.ssw.coco.lib.model.atgAst.nodeTypes.ProductionNode

    checkNode(semTextNode, 486, 124, productionNode);
  }

  @Test
  public void testProductionNode0_Expression() {
    ProductionNode productionNode =
      root.getCompilerNode().getParserSpecNode().getProductionNodes().get(0);
    ExpressionNode expressionNode = productionNode.getExpressionNode();   
    checkExpressionNode(expressionNode, 627, 152, productionNode, 1);
   
    //Term0
    TermNode term0 = expressionNode.getTermNodes().get(0);
    checkTermNode(term0, 627, 152, expressionNode, 1);
View Full Code Here

Examples of at.ssw.coco.lib.model.atgAst.nodeTypes.ProductionNode

             
  }

  @Test
  public void testProductionNode1() {
    ProductionNode productionNode =
      root.getCompilerNode().getParserSpecNode().getProductionNodes().get(1);
    checkNode(productionNode, 784, 277, root.getCompilerNode().getParserSpecNode());
   
    //Ident
    IdentNode identNode = productionNode.getIdentNode();
    checkNode(identNode, 784, 9, productionNode);
    assertTrue(identNode.getIdent().equals("Statement"));

    //AttrDecl
    AttrDeclNode attrDeclNode = productionNode.getAttrDeclNode();
    checkNode(attrDeclNode, 793, 35, productionNode);
   
      //AttrDecl Out
      attrDeclNode.getOutAttrDeclNode();
      //AttrDecl In
      attrDeclNode.getInAttrDeclNode();
   
    //SemText
    SemTextNode semTextNode = productionNode.getSemTextNode();
    checkNode(semTextNode, 831, 22, productionNode);
  }
View Full Code Here

Examples of at.ssw.coco.lib.model.atgAst.nodeTypes.ProductionNode

    checkNode(semTextNode, 831, 22, productionNode);
  }
 
  @Test
  public void testProductionNode1_Expression() {
    ProductionNode productionNode =
      root.getCompilerNode().getParserSpecNode().getProductionNodes().get(1);
    ExpressionNode expressionNode = productionNode.getExpressionNode();
    checkExpressionNode(expressionNode, 866, 193, productionNode, 1);

    // t0
    TermNode t0 = expressionNode.getTermNodes().get(0);
    checkTermNode(t0, 866, 193, expressionNode, 1);
View Full Code Here

Examples of at.ssw.coco.lib.model.atgAst.nodeTypes.ProductionNode

   
  }

  @Test
  public void testProductionNode2() {
    ProductionNode productionNode =
      root.getCompilerNode().getParserSpecNode().getProductionNodes().get(2);
    checkNode(productionNode, 1063, 115, root.getCompilerNode().getParserSpecNode());

    //Ident
    IdentNode identNode = productionNode.getIdentNode();
    checkNode(identNode, 1063, 9, productionNode);
    assertTrue(identNode.getIdent().equals("Condition"));

    //AttrDecl
    AttrDeclNode attrDeclNode = productionNode.getAttrDeclNode();
    checkNode(attrDeclNode, 1072, 18, productionNode);
   
    //SemText
    SemTextNode semTextNode = productionNode.getSemTextNode();
    assertNull(semTextNode);
  }
View Full Code Here

Examples of at.ssw.coco.lib.model.atgAst.nodeTypes.ProductionNode

    assertNull(semTextNode);
  }
 
  @Test
  public void testProductionNode2_Expression() {
    ProductionNode productionNode =
      root.getCompilerNode().getParserSpecNode().getProductionNodes().get(2);
    ExpressionNode expressionNode = productionNode.getExpressionNode();
    checkExpressionNode(expressionNode, 1098, 76, productionNode, 3);
   
    //t0
    TermNode t0 = expressionNode.getTermNodes().get(0);
    checkTermNode(t0, 1098, 39, expressionNode, 3, true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.