Package org.rascalmpl.parser.gtd.result

Examples of org.rascalmpl.parser.gtd.result.AbstractNode


    }
   
    if(next.isMatchable()){ // Eager matching optimization.
      if((location + next.getLength()) > input.length) return null;
     
      AbstractNode nextResult = next.match(input, location);
      if(nextResult == null){
        // Push the node including it's predecessor to the appropriate error tracking collection (and take care of merging when necessary).
        DoubleArrayList<AbstractStackNode<P>, AbstractNode> predecessors = new DoubleArrayList<AbstractStackNode<P>, AbstractNode>();
        predecessors.add(node, result);
        unmatchableMidProductionNodes.push(predecessors, next);
View Full Code Here


    }
   
    if(next.isMatchable()){ // Eager matching optimization.
      if((location + next.getLength()) > input.length) return false;
     
      AbstractNode nextResult = next.match(input, location);
      if(nextResult == null){
        // Push the node including it's predecessor to the appropriate error tracking collection (and take care of merging when necessary).
        DoubleArrayList<AbstractStackNode<P>, AbstractNode> predecessors = new DoubleArrayList<AbstractStackNode<P>, AbstractNode>();
        predecessors.add(node, result);
        unmatchableMidProductionNodes.push(predecessors, next);
View Full Code Here

      if(first.isMatchable()){ // Eager matching optimization.
        int length = first.getLength();
        int endLocation = location + length;
        if(endLocation > input.length) continue;
       
        AbstractNode result = first.match(input, location);
        if(result == null){
          unmatchableLeafNodes.push(first);
         
          if(debugListener != null) debugListener.failedToMatch(first);
         
View Full Code Here

            if(child.isMatchable()){
              int length = child.getLength();
              int endLocation = location + length;
              if(endLocation > input.length) continue;
             
              AbstractNode result = child.match(input, location);
              if(result == null){
                unmatchableLeafNodes.push(child);
               
                if(debugListener != null) debugListener.failedToMatch(child);
               
View Full Code Here

  /**
   * Parses with post parse filtering.
   */
  private T parse(String nonterminal, URI inputURI, int[] input, IActionExecutor<T> actionExecutor, INodeFlattener<T, S> converter, INodeConstructorFactory<T, S> nodeConstructorFactory, IRecoverer<P> recoverer, IDebugListener<P> debugListener){
    AbstractNode result = parse(new NonTerminalStackNode<P>(AbstractStackNode.START_SYMBOL_ID, 0, nonterminal), inputURI, input, recoverer, debugListener);
    return buildResult(result, converter, nodeConstructorFactory, actionExecutor);
  }
View Full Code Here

  /**
   * Parses without post parse filtering.
   */
  private T parse(String nonterminal, URI inputURI, int[] input, INodeFlattener<T, S> converter, INodeConstructorFactory<T, S> nodeConstructorFactory, IRecoverer<P> recoverer, IDebugListener<P> debugListener){
    AbstractNode result = parse(new NonTerminalStackNode<P>(AbstractStackNode.START_SYMBOL_ID, 0, nonterminal), inputURI, input, recoverer, debugListener);
    return buildResult(result, converter, nodeConstructorFactory, new VoidActionExecutor<T>());
  }
View Full Code Here

    return parse(nonterminal, inputURI, charsToInts(input), converter, nodeConstructorFactory, null, null);
  }
 
  protected T parse(AbstractStackNode<P> startNode, URI inputURI, char[] input, INodeFlattener<T, S> converter, INodeConstructorFactory<T, S> nodeConstructorFactory) {
   
    AbstractNode result = parse(startNode, inputURI, charsToInts(input), null, null);
   
    return buildResult(result, converter, nodeConstructorFactory, new VoidActionExecutor<T>());
  }
View Full Code Here

    int index = prefix.length - 1;
   
    int postFixLength = postFix.length;
    for(int i = 0; i < postFixLength; ++i){
      AbstractNode node = postFix.element;
      postFix = postFix.next;
     
      newEnvironment = actionExecutor.enteringListNode(production, index++, newEnvironment); // Fire a 'entering node' event when converting a child to enable environment handling.
     
      if(!(node instanceof CycleNode)){ // Not a cycle.
View Full Code Here

 
  /**
   * Gather all the alternatives ending with the given child.
   */
  protected void gatherAlternatives(INodeFlattener<T, S> converter, INodeConstructorFactory<T, S> nodeConstructorFactory, Link child, ArrayList<T> gatheredAlternatives, Object production, IndexedStack<AbstractNode> stack, int depth, CycleMark cycleMark, HashMap<ArrayList<Link>, SharedPrefix<T>> sharedPrefixCache, PositionStore positionStore, int offset, int endOffset, FilteringTracker filteringTracker, IActionExecutor<T> actionExecutor, Object environment){
    AbstractNode childNode = child.getNode();
   
    if(!(childNode.isEpsilon() && child.getPrefixes() == null)){ // Has non-epsilon results.
      ArrayList<AbstractNode> blackList = new ArrayList<AbstractNode>();
      if(childNode.isEmpty()){ // Child starts a cycle.
        CycleNode cycle = gatherCycle(child, new AbstractNode[]{childNode}, blackList);
        if(cycle != null){ // Encountered a cycle.
          if(cycle.cycle.length == 1){
            gatherProduction(converter, nodeConstructorFactory, child, new ForwardLink<AbstractNode>(NO_NODES, cycle), gatheredAlternatives, production, stack, depth, cycleMark, sharedPrefixCache, positionStore, blackList, offset, endOffset, filteringTracker, actionExecutor, environment);
          }else{
View Full Code Here

        if(prefix == null){ // Start of the production encountered.
          buildAlternative(converter, nodeConstructorFactory, noChildren, postFix, production, gatheredAlternatives, stack, depth, cycleMark, positionStore, offset, endOffset, filteringTracker, actionExecutor, environment);
          return;
        }
       
        AbstractNode prefixNode = prefix.getNode();
        if(blackList.contains(prefixNode)) return; // Prefix node is not allowed (due to being part of a cycle already gathered cycle).
       
        if(prefixNode.isEmpty() && !prefixNode.isNonterminalSeparator()){ // Possibly a cycle (separators can't start or end cycles, only elements can).
          CycleNode cycle = gatherCycle(prefix, new AbstractNode[]{prefixNode}, blackList);
          if(cycle != null){ // Encountered cycle, insert it.
            prefixNode = cycle;
          }
        }
View Full Code Here

TOP

Related Classes of org.rascalmpl.parser.gtd.result.AbstractNode

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.