/** * Throw syntax error. * * @param error the error * @throws org.matheclipse.parser.client.SyntaxError the syntax error */ protected void throwSyntaxError( final String error ) throws SyntaxError { throw new SyntaxError( fCurrentPosition - 1, rowCount, fCurrentPosition - fCurrentColumnStartPosition, getErrorLine(), error, 1 ); }
protected void initialize(final String s) throws SyntaxError { initializeNullScanner(); fInputString = s; if (s != null) { getNextToken(); } }
/** * Initialize Scanner without a math-expression. */ public Scanner() { initializeNullScanner(); }
/** * Get the variable names from the given expression. * * @param expression * @param result * a set which contains the variable names */ public static void getVariables(String expression, Set<String> result) { Parser p = new Parser(); ASTNode node = p.parse(expression); getVariables(node, result); }
private final ASTNode parsePostfixOperator(ASTNode lhs, PostfixOperator postfixOperator) { getNextToken(); lhs = postfixOperator.createFunction(fFactory, lhs); lhs = parseArguments(lhs); return lhs; }
protected void initialize(final String s) throws SyntaxError { initializeNullScanner(); fInputString = Characters.substituteCharacters(s).toCharArray(); getNextToken(); }
private ASTNode parseExpression() { return parseExpression(parsePrimary(0), 0); }
private ASTNode parseArguments(ASTNode lhs) { if (fRelaxedSyntax) { if (fToken == TT_PRECEDENCE_OPEN) { lhs = getFunction(lhs); } } else { if (fToken == TT_ARGUMENTS_OPEN) { lhs = getFunction(lhs); } } return lhs; }
/** * Verify the length of the input string and get the next character from the input string. If the current position * is greater than the input length, set current character to SPACE and token to TT_EOF. * */ protected void getChar() { if (isValidPosition()) { getNextChar(); return; } fCurrentPosition = fInputString.length + 1; fCurrentChar = ' '; fToken = TT_EOF; }
/** * Reevaluate the last <code>expression</code> (possibly after a new variable assignment). * * @return * @throws SyntaxError */ public IExpr eval() { if (fExpr == null) { throw new SyntaxError(0, 0, 0, " ", "No parser input defined", 1); } return eval(fExpr); }
/** * Throw syntax error. * * @param error the error * @param errorLength the error length * @throws org.matheclipse.parser.client.SyntaxError the syntax error */ protected void throwSyntaxError( final String error, final int errorLength ) throws SyntaxError { throw new SyntaxError( fCurrentPosition - errorLength, rowCount, fCurrentPosition - fCurrentColumnStartPosition, getErrorLine(), error, errorLength ); }
/** * Get the variable names from the given expression. * * @param expression the expression * @param result a set which contains the variable names */ public static void getVariables( String expression, Set<String> result ) { Parser p = new Parser(); ASTNode node = p.parse( expression ); getVariables( node, result ); }
/** * Initialize. * * @param s the s * @throws org.matheclipse.parser.client.SyntaxError the syntax error */ protected void initialize( final String s ) throws SyntaxError { initializeNullScanner(); fInputString = s; if ( s != null ) { getNextToken(); } }
/** * Initialize Scanner without a math-expression * */ public Scanner() { initializeNullScanner(); }
protected void throwSyntaxError(final String error, final int errorLength) throws SyntaxError { throw new SyntaxError(fCurrentPosition - errorLength, fRowCounter, fCurrentPosition - fCurrentColumnStartPosition, getErrorLine(), error, errorLength); } }
/** * Initialize Scanner without a math-expression */ protected Scanner(boolean packageMode, boolean explicitTimes) { fPackageMode = packageMode; fExplicitTimes = explicitTimes; initializeNullScanner(); }
protected void throwSyntaxError(final String error, final int errorLength) throws SyntaxError { throw new SyntaxError(fCurrentPosition - errorLength, rowCount, fCurrentPosition - fCurrentColumnStartPosition, getErrorLine(), error, errorLength); }
protected void throwSyntaxError(final String error) throws SyntaxError { throw new SyntaxError(fCurrentPosition - 1, rowCount, fCurrentPosition - fCurrentColumnStartPosition, getErrorLine(), error, 1); }
protected void throwSyntaxError(final String error) throws SyntaxError { throw new SyntaxError(fCurrentPosition - 1, fRowCounter, fCurrentPosition - fCurrentColumnStartPosition, getErrorLine(), error, 1); }