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

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


 
  private ResultNode parseRef(ParserInputCursor l, CSSRuleRef r, ConsumeWS consumeWS) {
    CSSRule rule =  manager.resolveReference(r);
    if (rule == null) {
      logger.debug("resolving rule ref " + r.getRef().getName() + " returned null (maybe a function?) !!!!!");
      ResultNode inv = new ResultNode(NodeType.REF);
      inv.status = State.INVALID;
      return inv;
    }
   
    ResultNode rv = parse(l, rule, consumeWS);
   
    Definition ref = r.getRef();
    QualifiedName fqn = nameProvider.getFullyQualifiedName(ref);
   
    if (l.isConsumedOrOnlyWSLeft()) {
      List<Proposal> contributedProposalsForRule = manager.getContributedProposalsForRule(fqn.toString());
      for (Proposal c : contributedProposalsForRule) {
        ResultNode e = new ResultNode(NodeType.REF);
        e.status = State.PROPOSE;
        e.proposal = c;
        rv.next.add(e);
      }
    }
View Full Code Here


//      parse(l, rule, consumeWS);
//    }
//       
//    return result;
   
    ResultNode concatOrResult = new ResultNode(NodeType.CONCAT_OR);
    concatOrResult.remainingInput = l.copy();
    concatOrResult.status = State.FORWARD;
   
    Queue<CSSRule> rulesLeft = new LinkedList<>(r.getXors());
   
    int maxTests = rulesLeft.size();
    int testNo = 1;
   
    while (!rulesLeft.isEmpty() && testNo <= maxTests) {
      // pick rule
      final CSSRule rule = rulesLeft.poll();
     
      boolean match = false;
      //try on all
      for (ResultNode last : concatOrResult.findLast()) {
        if (last.isValid()) {
          ResultNode path = parse(last.remainingInput, rule, consumeWS);
          for (ResultNode pathEnd : path.findLast()) {
            if (pathEnd.isValid()) {
              match = true;
            }
          }
          last.next.add(path);
          if (!rulesLeft.isEmpty()) {
            // special skip node
            ResultNode skippy = new ResultNode(NodeType.CONCAT_OR);
            skippy.status = State.SKIP;
            skippy.remainingInput = last.remainingInput.copy();
            last.next.add(skippy);
          }
        }
View Full Code Here

      }
    };
  }
 
  private ResultNode parseFunction(ParserInputCursor in, CSSRuleFunc ruleFunc, ConsumeWS consumeWS) {
    ResultNode result = new ResultNode(NodeType.FUNCTION);
   
    ParserInputCursor local = in.copy();
   
    CssTok tok;
    try {
View Full Code Here

    result.remainingInput = local.copy();
    return result;
  }
 
  private ResultNode parseURLType(ParserInputCursor input, CSSType rule, ConsumeWS consumeWS) {
    final ResultNode result = new ResultNode(NodeType.TYPE_URL);
    ParserInputCursor local = input.copy();
    try {
      CssTok tok = consumeWS(local, consumeWS);
      if (tok != null) {
        if (tok instanceof UrlTok) {
View Full Code Here

   
    return result;
  }
 
  private ResultNode parseINTType(ParserInputCursor l, CSSType rule, ConsumeWS consumeWS) {
    final ResultNode result = new ResultNode(NodeType.TYPE_INT);

    ParserInputCursor local = l.copy();
    try {
      CssTok tok = consumeWS(local, consumeWS);
      if (tok != null) {
View Full Code Here

 
    return result;
  }
 
  private ResultNode parseNUMType(ParserInputCursor l, CSSType rule, ConsumeWS consumeWS) {
    ResultNode result = new ResultNode(NodeType.TYPE_NUM);
   
    ParserInputCursor local = l.copy();
   
    try {
      CssTok tok = consumeWS(local, consumeWS);
View Full Code Here

   
  }

  // Literal
  private ResultNode parseLiteral(ParserInputCursor input, CSSRuleLiteral r, ConsumeWS consumeWS) {
    ResultNode result = new ResultNode(NodeType.LITERAL);
   
    ParserInputCursor local = input.copy();
   
    try {
      CssTok tok = consumeWS(local, consumeWS);
View Full Code Here

    return result;
   
  }
 
  private ResultNode parseSymbol(ParserInputCursor l, CSSRuleSymbol r, ConsumeWS consumeWS) {
    final ResultNode result = new ResultNode(NodeType.SYMBOL);
   
    // This workaround allows symbol concatenation without whitespace
    if (consumeWS == ConsumeWS.MUST_CONSUME) {
      consumeWS = ConsumeWS.MAY_CONSUME;
    }
View Full Code Here

     
      final ParserInputCursor cursor = input.createCursor();
     
      logger.debugf("starting with input: %s", cursor);
      final long parseBegin = System.nanoTime();
      final ResultNode res = parse(cursor, def.getRule(), ConsumeWS.MAY_CONSUME);
      final long parseDuration = System.nanoTime() - parseBegin;
      logger.debugf("parse needed %2.3fms returnd with %s", parseDuration*10e-6, res);
     
      for (ParseResultListener l : resultListener) {
        l.parseFinished(res);
      }
     
      //ResultNode.dbg(res);
     
     
      // add semicolon if input was successfully parsed
      // THIS IS SIMPLY WRONG!!!!
      for (ResultNode x : res.findByState(State.MATCH)) {
        if (x.remainingInput.isConsumedOrOnlyWSLeft()) {
          result.add(new SimpleProposal(";"));
          break;
        }
      }
View Full Code Here

    List<Proposal> drop = new ArrayList<>();
   
    for (ResultNode r : result.findByState(State.PROPOSE)) {
     
      if (!r.next.isEmpty()) {
        ResultNode cur = r;
        List<ResultNode> allSubPropose = cur.findByState(State.PROPOSE);
        allSubPropose.remove(cur);
        for (ResultNode n : allSubPropose) {
          if (!(n.proposal instanceof MultiProposal)) {
            drop.add(n.proposal);
          }
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.