获取某个节点

@param expression
路径
@return {Node}
776359
public Node getNode(String expression) {
		return (Node) evalXPath(expression, null, XPathConstants.NODE);
	}
874638
@Nullable
    public static String findContentText(final Node rootNode, final XPath xPath, final String expression) {
        final Node node = findNode(rootNode, xPath, expression);
        if (node == null) {
            return null;
        }
        return node.getTextContent();
    }
812890
function parseFunction (node) {
	const args = [];
	let index = 0;
	node.nodes.forEach((subNode) => {
		if (subNode.type === "div" && subNode.value === ",") {
			// 遇到`,`下标自加1
			index++;
			return;
		} else if (subNode.type === "function") {
			// 将参数中的`color-stop`,`from`,`to`三种function特殊处理
			if ((subNode.value === "from" || subNode.value === "to" || subNode.value === "color-stop")) {
				let colorStop = subNode.nodes.filter((colorStopInfo) => {
					// colorStop的子节点，除function和word外，都丢去
					return colorStopInfo.type === "function" || colorStopInfo.type === "word";
				}).map((colorStopInfo) => {
					// colorStop的子节点，转换为字符串
					return valueParser.stringify(colorStopInfo);
				});

				// 组装新的对象传递出去
				colorStop = {
					nodes: colorStop,
					type: "function",
					value: subNode.value,
				};

				// 不使用第三个数组维度，而是将其存在最上面的维度上
				args[index] = colorStop;
				return args[index];
			}
		} else if (subNode.type !== "word") {
			return;
		}

		if (!args[index]) {
			// 如果未初始化该数组维度，对其初始化
			args[index] = [];
		}
		// 未特殊处理的function，还有普通的word，将其转字符串
		args[index].push(valueParser.stringify(subNode));
	});
	// 返回转换后的数组
	return args;
}
669331
function() {
    var node = this.logical();
    if (this.accept('?')) {
      var trueExpr = this.expression();
      this.expect(':');
      var falseExpr = this.expression();
      node = new nodes.Ternary(node, trueExpr, falseExpr);
    }
    return node;
  }
29553
public static ExpressionModel computeExpression(String expression) {
		
		// Si l'expression est vide
		if(expression == null || expression.trim().length() == 0) {
			
			// On retourne null
			return null;
		}
		
		// On Instancie un model d'expression
		ExpressionModel expressionModel = new ExpressionModel(expression.trim());
		
		// Index de l'iteration
		int i = 0;
		
		// Si la chaine contient des Fonctions
		if(isExpressionContainPattern(expression.trim(), FUNC_CHAIN_PATTERN)) {
			
			// Obtention de la liste des Fonctions
			String[] functions = extractToken(expression, FUNC_CHAIN_PATTERN);
			
			// Parcours
			for (String function : functions) {

				// Chaine en cours
				String currentExpression = expressionModel.getComputedExpression();
				
				// Nom de la Variable
				String parameterName = "var" + i++;
				
				// On remplace l'occurence courante par le nom de la variable
				currentExpression = currentExpression.replace(function, ":" + parameterName);
				
				// On met a jour l'expression computee
				expressionModel.setComputedExpression(currentExpression);
				
				// On ajoute les parametres
				expressionModel.addParameter(parameterName, function);
			}
			
		}
						
		// Tant que la chaene traitee contient des ENVs
		while(isExpressionContainPattern(expressionModel.getComputedExpression(), ENV_CHAIN_PATTERN)) {
			
			// Obtention de la liste des ENVs
			String[] envs = extractToken(expressionModel.getComputedExpression(), ENV_CHAIN_PATTERN);
			
			// Parcours
			for (String env : envs) {
				
				// Chaine en cours
				String currentExpression = expressionModel.getComputedExpression();
				
				// Nom de la Variable
				String parameterName = "var" + i++;
				
				// On remplace l'occurence courante par le nom de la variable
				currentExpression = currentExpression.replace(env, ":" + parameterName);
				
				// On met a jour l'expression computee
				expressionModel.setComputedExpression(currentExpression);
				
				// On ajoute les parametres
				expressionModel.addParameter(parameterName, env);
			}
		}
		
		// On retourne l'expression
		return expressionModel;
	}
752136
public Boolean getBoolean(Object node, String expression) {
		return (Boolean) evalXPath(expression, node, XPathConstants.BOOLEAN);
	}
908746
public static Expression trimParentheses(Expression node) {
    while (node instanceof ParenthesizedExpression) {
      node = ((ParenthesizedExpression) node).getExpression();
    }
    return node;
  }
380892
function resolveExpression(expression) {
    // return empty string for undefined
    if (expression === undefined) {
        return "";
    }
    // return placeholder for promise
    if (isPromise(expression)) {
        // recursively resolve
        return "[promise]";
    }
    // return placeholder for function
    if (typeof expression === "function") {
        return "[function]";
    }
    // handle arrays
    if (Array.isArray(expression)) {
        var items = [];
        // resolve each item (might be promises as well)
        for (var _i = 0, expression_1 = expression; _i < expression_1.length; _i++) {
            var expressionItem = expression_1[_i];
            items.push(resolveExpression(expressionItem));
        }
        // join with newline
        return items.join("\n");
    }
    // return unmodified if got a string
    if (typeof expression === "string") {
        return expression;
    }
    // convert to string if got a number
    if (typeof expression === "number") {
        return expression.toString();
    }
    // return stringified value, handles circular references
    return flatted_1.stringify(expression, undefined, 2);
}
127049
function() {
    var node
      , segs = []
      , star;

    star = this.accept('*');
    if (star) segs.push(new nodes.Literal('*'));

    while (true) {
      if (this.accept('{')) {
        this.state.push('interpolation');
        segs.push(this.expression());
        this.expect('}');
        this.state.pop();
      } else if (node = this.accept('-')){
        segs.push(new nodes.Literal('-'));
      } else if (node = this.accept('ident')){
        segs.push(node.val);
      } else {
        break;
      }
    }
    if (!segs.length) this.expect('ident');
    return segs;
  }
1309438
protected Expression visitExpression(Expression expr) {
        if (expr == null) {
            return null;
        }

        Expression newExpr = (Expression)expr.accept(this);
        if (expr != newExpr) {
            Type newType = newExpr.getType();

            if (newType == null || !newType.equals(expr.getType())) {
                Iterator<Expression.Conversion> it =
                    expr.getConversionChain().iterator();
                while (it.hasNext()) {
                    Expression.Conversion conv = it.next();
                    newExpr.convertTo
                        (conv.getToType(), conv.isCastPreferred());
                }
            }
        }
        return newExpr;
    }
516479
function isStandAloneExpression(text) {
        var found = ASTWalker.findNodeAt(getAST(text), 0, text.length, function (nodeType, node) {
            if (nodeType === "Expression") {
                return true;
            }
            return false;
        });
        return found && found.node;
    }
404586
protected Object getParsedExpression(final String expression) {
		try {
			return Ognl.parseExpression(expression);
		} catch (OgnlException ex) {
			throw new OgnlRuntimeException("Failed to parse the expression.[" + expression + "]", ex);
		}
	}
118961
private NodeList getNodeList(String document, XPathExpression expression) throws Exception
   {
      Document doc = m_documentBuilder.parse(new InputSource(new StringReader(document)));
      return (NodeList) expression.evaluate(doc, XPathConstants.NODESET);
   }
756717
public Tree get(String expression) throws TreeBuilderException {
		if (cache == null) {
			return builder.build(expression);
		}
		Tree tree = cache.get(expression);
		if (tree == null) {
			cache.put(expression, tree = builder.build(expression));
		}
		return tree;
	}
259412
function(expression){
      var t = this,
          value = null;

      // Evaluate the expression
      try {
        value = eval(expression);
      } catch (e) {
        var err = 'Unable to evaluate expression: "' + expression + '"';
        logger.error('evaluate', err);
        throw new Error(err);
      }

      // Return the value
      return value;
    }
1001776
function getReferenceExpression ( expression ) {
  	var members = [], refinement;

  	while ( expression.t === MEMBER && expression.r.t === REFINEMENT ) {
  		refinement = expression.r;

  		if ( refinement.x ) {
  			if ( refinement.x.t === REFERENCE ) {
  				members.unshift( refinement.x );
  			} else {
  				members.unshift( flattenExpression( refinement.x ) );
  			}
  		} else {
  			members.unshift( refinement.n );
  		}

  		expression = expression.x;
  	}

  	if ( expression.t !== REFERENCE ) {
  		return null;
  	}

  	return {
  		r: expression.n,
  		m: members
  	};
  }
662369
function() {
                var e, expressions = [];

                e = $(this.expression);
                while (e) {
                    expressions.push(e);
                    if (! $(',')) { break; }
                    e = $(this.expression);
                }

                if (expressions.length > 1) {
                    return new tree.Value(expressions.map(function(e) {
                        return e.value[0];
                    }));
                } else if (expressions.length === 1) {
                    return new tree.Value(expressions);
                }
            }