Package org.eclipse.xtext.nodemodel

Examples of org.eclipse.xtext.nodemodel.INode


  public static List<String> resourceOffsets(Resource resource) {
    List<String> result = new ArrayList<String>();
    TreeIterator<Object> iterator = EcoreUtil.getAllContents(resource, true);
    while (iterator.hasNext()) {
      InternalEObject child = (InternalEObject)iterator.next();
      INode node = (INode)child.eAdapters().get(0);
      result.add("" + node.getOffset() + ", " + node.getSemanticElement());
    }
    return result;
  }
View Full Code Here


 
  public static List<String> parseResultOffsets(IParseResult parseResult) {
    List<String> result = new ArrayList<String>();
    Iterator<INode> iter = parseResult.getRootNode().getAsTreeIterable().iterator();
    while (iter.hasNext()) {
      INode node = iter.next();
      result.add("" + node.getOffset() + ", " + node.getSemanticElement());
    }
    return result;
  }
View Full Code Here

      boolean _not_1 = (!_isEmpty_1);
      _and = _not_1;
    }
    if (_and) {
      final List<INode> nodes = NodeModelUtils.findNodesForFeature(location, TargetPlatformPackage.Literals.LOCATION__OPTIONS);
      INode _head = IterableExtensions.<INode>head(nodes);
      final INode withKeyword = ((CompositeNode) _head).getPreviousSibling();
      INode _last = IterableExtensions.<INode>last(nodes);
      final CompositeNode lastOption = ((CompositeNode) _last);
      int _offset = withKeyword.getOffset();
      int _endOffset = lastOption.getEndOffset();
      int _offset_1 = withKeyword.getOffset();
      int _minus = (_endOffset - _offset_1);
View Full Code Here

          public void apply(final Location _) {
            final List<INode> nodes = NodeModelUtils.findNodesForFeature(_, TargetPlatformPackage.Literals.LOCATION__OPTIONS);
            boolean _isEmpty = nodes.isEmpty();
            boolean _not = (!_isEmpty);
            if (_not) {
              INode _head = IterableExtensions.<INode>head(nodes);
              final INode withKeyword = ((CompositeNode) _head).getPreviousSibling();
              INode _last = IterableExtensions.<INode>last(nodes);
              final CompositeNode lastOption = ((CompositeNode) _last);
              int _offset = withKeyword.getOffset();
              int _endOffset = lastOption.getEndOffset();
              int _offset_1 = withKeyword.getOffset();
              int _minus = (_endOffset - _offset_1);
View Full Code Here

      boolean _not = (!_isEmpty_1);
      _and = _not;
    }
    if (_and) {
      final List<INode> nodes = NodeModelUtils.findNodesForFeature(location, TargetPlatformPackage.Literals.LOCATION__OPTIONS);
      INode _head = IterableExtensions.<INode>head(nodes);
      final INode withKeyword = ((CompositeNode) _head).getPreviousSibling();
      INode _last = IterableExtensions.<INode>last(nodes);
      final CompositeNode lastOption = ((CompositeNode) _last);
      int _offset = withKeyword.getOffset();
      int _endOffset = lastOption.getEndOffset();
      int _offset_1 = withKeyword.getOffset();
      int _minus = (_endOffset - _offset_1);
View Full Code Here

  public void deprecateIUVersionRangeWihString(final IU iu) {
    String _version = iu.getVersion();
    boolean _notEquals = (!Objects.equal(_version, null));
    if (_notEquals) {
      final List<INode> nodes = NodeModelUtils.findNodesForFeature(iu, TargetPlatformPackage.Literals.IU__VERSION);
      INode _head = IterableExtensions.<INode>head(nodes);
      EObject _grammarElement = _head.getGrammarElement();
      AbstractRule _rule = ((RuleCall) _grammarElement).getRule();
      String _name = _rule.getName();
      boolean _equals = "STRING".equals(_name);
      if (_equals) {
        this.warning("Usage of strings is deprecated for version range. You should remove the quotes.", iu,
View Full Code Here

        TargetPlatformGrammarAccess.IUElements _iUAccess = TargetPlatformValidator.this.grammarAccess.getIUAccess();
        RuleCall _iDIDTerminalRuleCall_0_0 = _iUAccess.getIDIDTerminalRuleCall_0_0();
        return Boolean.valueOf(Objects.equal(_grammarElement, _iDIDTerminalRuleCall_0_0));
      }
    };
    final INode idRule = IterableExtensions.<INode>findFirst(_asTreeIterable, _function);
    String _xifexpression = null;
    boolean _and = false;
    String _text = idRule.getText();
    boolean _startsWith = _text.startsWith("^");
    if (!_startsWith) {
      _and = false;
    } else {
      String _text_1 = idRule.getText();
      boolean _contains = _text_1.contains(".");
      boolean _not = (!_contains);
      _and = _not;
    }
    if (_and) {
      String _text_2 = idRule.getText();
      _xifexpression = _text_2.substring(1);
    } else {
      _xifexpression = idRule.getText();
    }
    final String id = _xifexpression;
    boolean _contains_1 = id.contains("^");
    if (_contains_1) {
      StringConcatenation _builder = new StringConcatenation();
View Full Code Here

        TargetPlatformGrammarAccess.IUElements _iUAccess = TargetPlatformValidator.this.grammarAccess.getIUAccess();
        Keyword _semicolonKeyword_1_0_0 = _iUAccess.getSemicolonKeyword_1_0_0();
        return Boolean.valueOf(Objects.equal(_grammarElement, _semicolonKeyword_1_0_0));
      }
    };
    final INode semicolonKeywordRule = IterableExtensions.<INode>findFirst(_asTreeIterable, _function);
    BidiTreeIterable<INode> _asTreeIterable_1 = node.getAsTreeIterable();
    final Function1<INode, Boolean> _function_1 = new Function1<INode, Boolean>() {
      public Boolean apply(final INode it) {
        EObject _grammarElement = it.getGrammarElement();
        TargetPlatformGrammarAccess.IUElements _iUAccess = TargetPlatformValidator.this.grammarAccess.getIUAccess();
        Keyword _equalsSignKeyword_1_0_2 = _iUAccess.getEqualsSignKeyword_1_0_2();
        return Boolean.valueOf(Objects.equal(_grammarElement, _equalsSignKeyword_1_0_2));
      }
    };
    final INode equalSignKeywordRule = IterableExtensions.<INode>findFirst(_asTreeIterable_1, _function_1);
    boolean _notEquals = (!Objects.equal(semicolonKeywordRule, null));
    if (_notEquals) {
      int _offset = semicolonKeywordRule.getOffset();
      int _endOffset = equalSignKeywordRule.getEndOffset();
      int _offset_1 = semicolonKeywordRule.getOffset();
      int _minus = (_endOffset - _offset_1);
      this.acceptWarning("Usage of keywords \';version=\' are not required anymore and has been deprecated.", iu, _offset, _minus, TargetPlatformValidator.CHECK__VERSION_KEYWORDS);
    }
  }
View Full Code Here

 
  public TargetPlatformProposalProvider() {
  }
 
  public void complete_TargetPlatform(final EObject model, final RuleCall ruleCall, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) {
    INode _currentNode = context.getCurrentNode();
    EObject _grammarElement = _currentNode.getGrammarElement();
    TargetPlatformGrammarAccess.TargetPlatformElements _targetPlatformAccess = this.grammarAccess.getTargetPlatformAccess();
    Keyword _targetKeyword_0 = _targetPlatformAccess.getTargetKeyword_0();
    boolean _notEquals = (!Objects.equal(_grammarElement, _targetKeyword_0));
    if (_notEquals) {
      TargetPlatformGrammarAccess.TargetPlatformElements _targetPlatformAccess_1 = this.grammarAccess.getTargetPlatformAccess();
View Full Code Here

  }
 
  public void completeTargetPlatform_Name(final EObject model, final Assignment assignment, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) {
    String textProposal = null;
    int offset = 0;
    INode _currentNode = context.getCurrentNode();
    EObject _grammarElement = _currentNode.getGrammarElement();
    TargetPlatformGrammarAccess.TargetPlatformElements _targetPlatformAccess = this.grammarAccess.getTargetPlatformAccess();
    Keyword _targetKeyword_0 = _targetPlatformAccess.getTargetKeyword_0();
    boolean _equals = Objects.equal(_grammarElement, _targetKeyword_0);
    if (_equals) {
      StringConcatenation _builder = new StringConcatenation();
View Full Code Here

TOP

Related Classes of org.eclipse.xtext.nodemodel.INode

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.