jmathlib.core.interpreter
Class LexicalAnalyser

java.lang.Object
  extended by jmathlib.core.interpreter.LexicalAnalyser
All Implemented Interfaces:
ErrorCodes, TokenConstants

public class LexicalAnalyser
extends java.lang.Object
implements TokenConstants, ErrorCodes

class for turning a string expression into a vector of tokens. All public methods are static so there is no need to instantiate it. it creates an instance of itself when the analyseExpression function is called.


Field Summary
 
Fields inherited from interface jmathlib.core.constants.TokenConstants
ADDSUB_PRIORITY, AND_PRIORITY, ANDAND_PRIORITY, ASSIGN_PRIORITY, BRACKET_PRIORITY, COMPARE_PRIORITY, CONCAT, MATRIX, MULDIV_PRIORITY, OR_PRIORITY, OROR_PRIORITY, PARAMETER, POWER_PRIORITY, RELATION_PRIORITY, SINGLE, ttDelimiter, ttNotSet, ttOperand, ttOperator
 
Fields inherited from interface jmathlib.core.constants.ErrorCodes
ERR_BRACKET_OPEN, ERR_BRACKET_ORDER, ERR_FUNCTION_NOT_FOUND, ERR_FUNCTION_NOT_IMPLEMENTED, ERR_INSUFFICIENT_PARAMETERS, ERR_INVALID_PARAMETER, ERR_LVALUE_REQUIRED, ERR_MATRIX_SINGULAR, ERR_NOT_SQUARE_MATRIX, ERR_OPNOTSUPPORTED, ERR_TOO_MANY_PARAMETERS, ERR_USER_ERROR, ERR_VARIABLE_NOTDEFINED, OK, OK_FUNCTION_PROCESS
 
Constructor Summary
LexicalAnalyser()
          default constructor - creates the lexical analyser object with an empty string
 
Method Summary
 void analyseExpression(java.lang.String expression)
          Interface function used to analyse an expression
 boolean EOChars()
          return true if no more characters are available for parsing
 Token getNextToken(int type)
           
 java.lang.String getScannedLineOfCode()
          return string of currently scanned line of code for error message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LexicalAnalyser

public LexicalAnalyser()
default constructor - creates the lexical analyser object with an empty string

Method Detail

analyseExpression

public void analyseExpression(java.lang.String expression)
Interface function used to analyse an expression

Parameters:
expression - - expression to be analysed

getNextToken

public Token getNextToken(int type)
Returns:
the next token in the input string

getScannedLineOfCode

public java.lang.String getScannedLineOfCode()
return string of currently scanned line of code for error message


EOChars

public boolean EOChars()
return true if no more characters are available for parsing