Package com.puppetlabs.xtext.dommodel.impl

Examples of com.puppetlabs.xtext.dommodel.impl.BaseDomNode


   *
   * @see org.eclipse.xtext.serializer.acceptor.ISyntacticSequenceAcceptor#acceptUnassignedAction(org.eclipse.xtext.Action)
   */
  @Override
  public void acceptUnassignedAction(Action action) {
    BaseDomNode n = addLeafNodeToCurrent(action, "", null, ACTION, //
      NodeClassifier.INSTANTIATION);
    n.setSemanticElement(action.getType().getClassifier());
  }


   * @see org.eclipse.xtext.serializer.acceptor.ISequenceAcceptor#acceptWhitespace(org.eclipse.xtext.AbstractRule, java.lang.String,
   *      org.eclipse.xtext.nodemodel.ILeafNode)
   */
  @Override
  public void acceptWhitespace(AbstractRule rule, String token, ILeafNode node) {
    BaseDomNode n = addLeafNodeToCurrent(rule, token, node, WHITESPACE, //
      NodeClassifier.HIDDEN);

    // TODO: Not a very robust way of checking if the whitespace is implied
    // Will probably need to change when also creating a dom model from the node model
    //
    n.setClassifiers(token == IDomNode.IMPLIED_EMPTY_WHITESPACE, NodeClassifier.IMPLIED);
  }

    n.setClassifiers(token == IDomNode.IMPLIED_EMPTY_WHITESPACE, NodeClassifier.IMPLIED);
  }

  protected BaseDomNode addCompositeNodeToCurrent(EObject rule, String token, ICompositeNode node, NodeType nodeType,
      Object... classifiers) {
    BaseDomNode result = new LeafDomNode();
    result.setText(token);
    result.setNode(node);
    result.setGrammarElement(rule);
    result.setNodeType(nodeType);
    result.setClassifiers(true, classifiers);
    addNodeToCurrent(result);
    return result;
  }

    return result;
  }

  protected BaseDomNode addLeafNodeToCurrent(EObject rule, String token, ILeafNode node, NodeType nodeType,
      Object... classifiers) {
    BaseDomNode result = new LeafDomNode();
    result.setText(token);
    result.setNode(node);
    result.setGrammarElement(rule);
    result.setNodeType(nodeType);
    result.setClassifiers(true, classifiers);
    if(node != null && node.isHidden()) {
      result.setClassifiers(true, NodeClassifier.HIDDEN);
    }
    addNodeToCurrent(result);
    return result;
  }

TOP

Related Classes of com.puppetlabs.xtext.dommodel.impl.BaseDomNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.