Get the literal value for an expression.

@param expression expression
@return literal value
336775
private Object getLiteralValue(Expression expression) {
		if (!(expression instanceof Literal)) {
			throw new IllegalArgumentException("Expression " + expression + " is not a Literal.");
		}
		return ((Literal) expression).getValue();
	}
94623
private static final ExpressionTree parseToTree(String expression) throws InvalidExpressionException {

        ExpressionParser parser = new ExpressionParser();
        parser.parse(expression);

        return new ExpressionTree(parser.getVar(), parser.getTokens());
    }
1135786
def get_value(self, expression):
        """"""
        self._check_valid()
        return super(Result, self).get_value(expression)
996038
public Ast parse(String expression)
	{
		Ast ast=new Ast();
		if(expression==null || expression.length()==0)
			return ast;
		
		SeekableStringReader sr = new SeekableStringReader(expression);
		if(sr.peek()=='#')
			sr.readUntil('\n');  // skip comment line
		
		try {
			ast.root = parseExpr(sr);
			sr.skipWhitespace();
			if(sr.hasMore())
				throw new ParseException("garbage at end of expression");
			return ast;
		} catch (ParseException x) {
			String faultLocation = extractFaultLocation(sr);
			throw new ParseException(x.getMessage() + " (at position "+sr.bookmark()+"; '"+faultLocation+"')", x);
		}
	}
1283304
public static Expression regexpPosition(String expression, String pattern) {
        return regexpPosition(x(expression), pattern);
    }
1270526
public static Regex literal(String expression, Option... options) throws IOException
    {
        return compile(escape(expression), options);
    }
924779
public Object resolveELExpression(String expression, int lineNumber) {
    this.lineNumber = lineNumber;
    return expressionResolver.resolveExpression(expression);
  }
749970
private Optional<IRI> getPredicateIRI(DataRangeExpression expression) {
        if (expression instanceof Datatype) {
            return Optional.of(((Datatype) expression).getIRI());
        }
        if (expression instanceof DataPropertyRangeExpression) {
            return Optional.of(((DataPropertyRangeExpression) expression).getProperty().getIRI());
        }
        return Optional.empty();
    }
291810
Expression getValue( CssFormatter formatter ) {
        String name = toString();
        Expression value = formatter.getVariable( name );
        if( value != null ) {
            return value;
        }
        if( name.startsWith( "@@" ) ) {
            name = name.substring( 1 );
            value = formatter.getVariable( name );
            if( value != null ) {
                formatter.setInlineMode( true );
                name = '@' + value.stringValue( formatter );
                formatter.setInlineMode( false );
                value = formatter.getVariable( name );
                if( value != null ) {
                    return value;
                }
            }
        }
        throw createException( "Undefined Variable: " + name );
    }
532000
private static List<String> splitExpression(String expression) {
        List<String> tokens = new ArrayList<String>();
        int lastStart = -1;
        boolean isQuoted = false;
        for (int i = 0; i < expression.length(); i++) {
            if ( lastStart == -1 ) {
                if ( !isQuoted && Character.isJavaIdentifierStart( expression.charAt(i) ) ) {
                    lastStart = i;
                }
            } else if ( !Character.isJavaIdentifierPart( expression.charAt(i) ) ) {
                tokens.add(expression.subSequence(lastStart, i).toString());
                lastStart = -1;
            }
            if (expression.charAt(i) == '"' || expression.charAt(i) == '\'') {
                if (i == 0 || expression.charAt(i-1) != '\\') {
                    isQuoted = !isQuoted;
                }
                if (isQuoted) {
                    lastStart = -1;
                }
            }
        }
        if (lastStart != -1) {
            tokens.add( expression.subSequence( lastStart, expression.length() ).toString() );
        }
        return tokens;
    }
1337310
public String next(String expression) {
    if (expression == null || expression.length() == 0) { return null; }
    boolean indexed = false;
    boolean mapped = false;
    for (int i = 0; i < expression.length(); i++) {
      char c = expression.charAt(i);
      if (indexed) {
        if (c == IndexedEnd) { return expression.substring(0, i + 1); }
      } else if (mapped) {
        if (c == MappedEnd) { return expression.substring(0, i + 1); }
      } else {
        if (c == Nested) {
          return expression.substring(0, i);
        } else if (c == MappedStart) {
          mapped = true;
        } else if (c == IndexedStart) {
          indexed = true;
        }
      }
    }
    return expression;
  }
372812
public static boolean isValueReference(String expression)
  {
    if (null != expression)
    {
      int start = expression.indexOf("#{");
      if ((start >= 0) && (expression.indexOf('}', start + 1) >= 0))
      {
          return true;
      }
    }

    return false;
  }
1236177
public static Element getElementByXPath(String expression, Object source) {
		return (Element) getNodeByXPath(expression, source);
	}
597941
public static String strip(final String expression) {
        final String expr = StringUtils.trimToEmpty(expression);
        final Matcher matcher = DELIMITED_EXPR.matcher(expr);
        return matcher.matches() ? matcher.group(1) : expr;
    }
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
  	};
  }
516503
private Object getValue(Entry entry, Class type) {
        Object value = entry.getValue();
        if (type== Expression.class)
            value = new ConstantExpression(entry.getValue());
        return value;
    }
467888
public static ExpressionHandler getHandler(Expression expression) {
        ExpressionHandler ret = null;
        Class<? extends ExpressionHandler> cls = handlers.get(expression.getClass());
        if (cls != null) {
            try {
                Constructor<? extends ExpressionHandler> con = cls.getConstructor(Expression.class);
                ret = con.newInstance(expression);
            } catch (Exception e) {
                log.log(Level.SEVERE, "Failed to instantiate handler for expression '" + expression + "'", e);
            }
        }
        return ret;
    }