Package at.bestsolution.efxclipse.tooling.css.cssext.parser.result

Examples of at.bestsolution.efxclipse.tooling.css.cssext.parser.result.ResultNode


  }
 
  private ResultNode parse(ParserInputCursor input, CSSRule rule, ConsumeWS consumeWS) {
    Assert.isNotNull(rule, "rule must not be null");
    Assert.isNotNull(input, "input must not be null");
    ResultNode result = null;
   
    switch(rule.eClass().getClassifierID()) {
    case CssExtDslPackage.CSS_RULE_BRACKET: result = parseBracket(input, (CSSRuleBracket)rule, consumeWS);
      break;
    case CssExtDslPackage.CSS_RULE_REF: result = parseRef(input, (CSSRuleRef)rule, consumeWS);
View Full Code Here


//    }
    return result;
  }
 
  private ResultNode parseOr(ParserInputCursor input, CSSRuleOr or, ConsumeWS consumeWS) {
    ResultNode orResult = new ResultNode(NodeType.OR);
    orResult.remainingInput = input.copy();
    orResult.status = State.FORWARD;
   
    for (CSSRule rule : or.getOrs()) {
      ResultNode result = parse(input.copy(), rule, consumeWS);
      orResult.next.add(result);
    }
   
    return orResult;
  }
View Full Code Here

    return orResult;
  }
 
  // Concat
  private ResultNode parseConcat(ParserInputCursor l, CSSRuleConcat r, ConsumeWS consumeWS) {
    ResultNode concatResult = new ResultNode(NodeType.CONCAT);
    concatResult.remainingInput = l.copy();
    concatResult.status = State.FORWARD;
   
    Iterator<CSSRule> ruleIt = r.getConc().iterator();
    while (ruleIt.hasNext()) {
      final CSSRule rule = ruleIt.next();
      final boolean isFirstRule = r.getConc().indexOf(rule) == 0;
      for (ResultNode last : concatResult.findLast()) {
        if (last.isValid()) {
          last.next.add(parse(last.remainingInput, rule, isFirstRule?consumeWS:ConsumeWS.MUST_CONSUME));
         
        }
      }
View Full Code Here

    return concatResult;
  }
 
  // Concat without space
  private ResultNode parseConcatWithoutSpace(ParserInputCursor l, CSSRuleConcatWithoutSpace r, ConsumeWS consumeWS) {
    ResultNode concatResult = new ResultNode(NodeType.CONCAT_WITHOUT_SPACE);
    concatResult.remainingInput = l.copy();
    concatResult.status = State.FORWARD;
   
    Iterator<CSSRule> ruleIt = r.getConc().iterator();
    while (ruleIt.hasNext()) {
      final CSSRule rule = ruleIt.next();
      final boolean isFirstRule = r.getConc().indexOf(rule) == 0;
      for (ResultNode last : concatResult.findLast()) {
        if (last.isValid()) {
          last.next.add(parse(last.remainingInput, rule, isFirstRule?consumeWS:ConsumeWS.NO_CONSUME));
        }
        else if (!isFirstRule && last.status == State.PROPOSE) {
//          // if the last was a proposal we go on with empty input to get multiple proposals in sequence
          ResultNode node = parse(ParserInputCursor.emptyParserInputCursor(), rule, ConsumeWS.NO_CONSUME);
          node.findByState(State.PROPOSE);
          for (ResultNode n : node.findLast()) {
            n.proposal = wrapMultiProposal(last.proposal, n.proposal);
          }
          last.next.add(node);
        }
       
View Full Code Here

//    result.next.add(parse(in.copy(), rule.getInner(), consumeWS));
//    return result;
  }
 
  private ResultNode parsePostfix(ParserInputCursor in, CSSRulePostfix r, ConsumeWS consumeWS) {
    ResultNode result = null;
    if( r.getCardinality() != null && ! r.getCardinality().isEmpty() ) {
      switch (r.getCardinality().charAt(0)) {
      case '?':
        result = parseOptional(in, r.getRule(), consumeWS);
        break;
View Full Code Here

    }
    return result;
  }
 
  private ResultNode parseOptional(ParserInputCursor in, CSSRule rule, ConsumeWS consumeWS) {
    ResultNode result = new ResultNode(NodeType.OPTIONAL);
    result.remainingInput = in.copy();
    result.status = State.FORWARD;
   
    result.next.add(ResultNode.createSkipNode(result));
    result.next.add(parse(in.copy(), rule, consumeWS));
View Full Code Here

   
    return result;
  }
 
  private ResultNode parseStar(ParserInputCursor in, CSSRule rule, ConsumeWS consumeWS) {
    ResultNode result = new ResultNode(NodeType.STAR);
    result.status = State.FORWARD;
    result.remainingInput = in.copy();
   
    Queue<ResultNode> last = new LinkedList<>();
    last.addAll(result.findLast());
   
    boolean first = true;
   
    while (!last.isEmpty()) {
      ResultNode cur = last.poll();
      if (cur.isValid()) {
        ResultNode n = parse(cur.remainingInput.copy(), rule, consumeWS);
       
        last.addAll(n.findLast());
       
        if (first) {
          cur.next.add(n);
         
          ResultNode skipStarNode = new ResultNode(NodeType.STAR);
          skipStarNode.status = State.SKIP;
          skipStarNode.remainingInput = cur.remainingInput.copy();
         
          cur.next.add(skipStarNode);
         
          first = false;
        }
        else {
          ResultNode starNode = new ResultNode(NodeType.STAR);
          starNode.status = State.FORWARD;
          starNode.remainingInput = cur.remainingInput.copy();
          starNode.next.add(n);
          cur.next.add(starNode);
         
          ResultNode skipStarNode = new ResultNode(NodeType.STAR);
          skipStarNode.status = State.SKIP;
          skipStarNode.remainingInput = cur.remainingInput.copy();
         
          starNode.next.add(skipStarNode);
        }
View Full Code Here

    return result;
  }
 
 
  private ResultNode parsePlus(ParserInputCursor in, CSSRule rule, ConsumeWS consumeWS) {
    ResultNode result = new ResultNode(NodeType.PLUS);
    result.status = State.FORWARD;
    result.remainingInput = in.copy();
   
    // 1 - n
    Queue<ResultNode> last = new LinkedList<>();
    last.addAll(result.findLast());
    int iteration = 0;
    while (!last.isEmpty()) {
      ResultNode cur = last.poll();
      if (cur.isValid()) {
       
        ResultNode n = parse(cur.remainingInput.copy(), rule, consumeWS);
        cur.next.add(n);
       
        if (iteration >= 1) {
          cur.next.add(ResultNode.createSkipNode(cur));
        }
View Full Code Here

    return result;
  }
 
 
  private ResultNode parseType(ParserInputCursor l, CSSType type, ConsumeWS consumeWS) {
    ResultNode result = null;
    if ("@NUM".equals(type.getType())) {
      result = parseNUMType(l, type, consumeWS);
    }
    else if ("@INT".equals(type.getType())) {
      result = parseINTType(l, type, consumeWS);
View Full Code Here

   
    return result;
  }
 
  private ResultNode parseRegex(ParserInputCursor l, CSSRuleRegex r, ConsumeWS consumeWS) {
    ResultNode result = new ResultNode(NodeType.REGEX);
   
    String regex = r.getRegex().replaceAll("\\$", "");
   
   
    ParserInputCursor localInput = l.copy();
View Full Code Here

TOP

Related Classes of at.bestsolution.efxclipse.tooling.css.cssext.parser.result.ResultNode

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.