Package org.jmol.script
Class ScriptTokenParser
java.lang.Object
org.jmol.script.ScriptTokenParser
- Direct Known Subclasses:
ScriptCompiler
An abstract class subclassed by ScriptCompiler taking care of the second
phase of syntax checking. After all the tokens are created, these methods
ensure that they are in the proper order in terms of expressions, primarily.
Here we are going from an "infix" to a "postfix" set of tokens and then back
to infix for final storage.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected T[]protected static final intprotected static final intprotected static final intprivate static final intprotected static final intprivate static final intprivate static final intprivate static final intprivate static final intprotected static final intprivate static final intprotected static final intprivate static final intprivate static final intprivate static final intprotected static final intprotected static final intprivate static final intprotected static final intprotected static final intprotected Stringprotected Stringprotected Stringprotected Stringprotected boolean(package private) booleanprotected intprotected intprotected intprotected intprotected intprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected intprotected Tprotected Tprotected shortprotected booleanprivate javajs.util.Lst<T>protected intprotected intprivate booleanprotected Stringprotected intprotected Tprivate Objectprotected intprotected Tprotected Tprotected Viewer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanaddCompare(T tokenAtomProperty, T tokenComparator) private booleanprivate booleanaddNextTokenIf(int tok) private booleanaddSubstituteTokenIf(int tok, T token) private booleanaddTokenToPostfix(int tok, Object value) private booleanaddTokenToPostfixInt(int tok, int intValue, Object value) private booleanaddTokenToPostfixToken(T token) private booleancheckForCoordinate(boolean isImplicitExpression) private booleancheckForItemSelector(boolean allowNumeric) private booleancheck for %x or % (null alternate)private booleanprivate booleanprivate booleanclauseCell(int tok) private booleanclauseChainSpec(int tok) [:] [chars] [:] ["chars"] [:] [*] [:] [0-9] [:] [?] [:] (empty chain)private booleanclauseComparator(boolean isOptional) private booleanclauseConnected(boolean isPolyhedra) private booleanclauseDefine(boolean haveToken, boolean forceString) private booleanprivate booleanprocess /1 /1.1 / * or just /private booleanprivate booleanclauseOr(boolean allowCommaAsOr) private booleanprivate booleanprivate boolean[a] or just aprivate booleanprivate booleanprivate booleanclauseWithin(boolean isWithin) protected booleanprotected booleanprotected booleanprotected booleanerror(int error) protected booleanerrorIntStr2(int iError, String value, String more) protected booleanprotected boolean(package private) static StringerrorString(int iError, String value, String more, boolean translated) private intfixModelSpec(T token) private floatprivate booleangenerateResidueSpecCode(T token) private booleanprivate TgetSequenceCode(boolean isSecond) private TgetToken()gets the next token and sets global theToken and theValueprivate intintPeek()private booleanisError()private booleanprivate booleanisTerminator(int tok) we allow : and % to have null valuesprotected booleanisUserFunction(String name) private booleanprivate booleanprotected inttokAt(int i) protected static booleanprivate Tincrements the pointer; does NOT set theToken or theValueprivate booleantokenNextTok(int tok) private inttokPeek()private booleantokPeekIs(int tok) private Object
-
Field Details
-
vwr
-
htUserFunctions
-
script
-
isStateScript
protected boolean isStateScript -
lineCurrent
protected short lineCurrent -
iCommand
protected int iCommand -
ichCurrentCommand
protected int ichCurrentCommand -
ichComment
protected int ichComment -
ichEnd
protected int ichEnd -
ichToken
protected int ichToken -
theToken
-
lastFlowCommand
-
tokenCommand
-
lastToken
-
tokenAndEquals
-
theTok
protected int theTok -
nTokens
protected int nTokens -
tokCommand
protected int tokCommand -
ptNewSetModifier
protected int ptNewSetModifier -
isNewSet
protected boolean isNewSet -
haveMacro
protected boolean haveMacro -
logMessages
protected boolean logMessages -
atokenInfix
-
itokenInfix
protected int itokenInfix -
isSetBrace
protected boolean isSetBrace -
isMathExpressionCommand
protected boolean isMathExpressionCommand -
isSetOrDefine
protected boolean isSetOrDefine -
ltokenPostfix
-
isEmbeddedExpression
protected boolean isEmbeddedExpression -
isCommaAsOrAllowed
protected boolean isCommaAsOrAllowed -
theValue
-
haveString
boolean haveString -
residueSpecCodeGenerated
private boolean residueSpecCodeGenerated -
errorMessage
-
errorMessageUntranslated
-
errorLine
-
errorType
-
ERROR_badArgumentCount
protected static final int ERROR_badArgumentCount- See Also:
-
ERROR_badContext
protected static final int ERROR_badContext- See Also:
-
ERROR_commandExpected
protected static final int ERROR_commandExpected- See Also:
-
ERROR_endOfCommandUnexpected
protected static final int ERROR_endOfCommandUnexpected- See Also:
-
ERROR_invalidExpressionToken
protected static final int ERROR_invalidExpressionToken- See Also:
-
ERROR_missingEnd
protected static final int ERROR_missingEnd- See Also:
-
ERROR_tokenExpected
protected static final int ERROR_tokenExpected- See Also:
-
ERROR_tokenUnexpected
protected static final int ERROR_tokenUnexpected- See Also:
-
ERROR_unrecognizedParameter
protected static final int ERROR_unrecognizedParameter- See Also:
-
ERROR_unrecognizedToken
protected static final int ERROR_unrecognizedToken- See Also:
-
ERROR_coordinateExpected
private static final int ERROR_coordinateExpected- See Also:
-
ERROR_endOfExpressionExpected
private static final int ERROR_endOfExpressionExpected- See Also:
-
ERROR_identifierOrResidueSpecificationExpected
private static final int ERROR_identifierOrResidueSpecificationExpected- See Also:
-
ERROR_invalidAtomSpecification
private static final int ERROR_invalidAtomSpecification- See Also:
-
ERROR_invalidChainSpecification
private static final int ERROR_invalidChainSpecification- See Also:
-
ERROR_invalidModelSpecification
private static final int ERROR_invalidModelSpecification- See Also:
-
ERROR_numberExpected
private static final int ERROR_numberExpected- See Also:
-
ERROR_numberOrVariableNameExpected
private static final int ERROR_numberOrVariableNameExpected- See Also:
-
ERROR_residueSpecificationExpected
private static final int ERROR_residueSpecificationExpected- See Also:
-
ERROR_unrecognizedExpressionToken
private static final int ERROR_unrecognizedExpressionToken- See Also:
-
-
Constructor Details
-
ScriptTokenParser
ScriptTokenParser()
-
-
Method Details
-
compileExpressions
protected boolean compileExpressions() -
compileExpression
protected boolean compileExpression() -
isUserFunction
-
isExpressionNext
private boolean isExpressionNext() -
tokenAttr
-
moreTokens
private boolean moreTokens() -
tokAt
protected int tokAt(int i) -
tokPeek
private int tokPeek() -
tokPeekIs
private boolean tokPeekIs(int tok) -
intPeek
private int intPeek() -
valuePeek
-
tokenNext
increments the pointer; does NOT set theToken or theValue- Returns:
- the next token
-
tokenNextTok
private boolean tokenNextTok(int tok) -
returnToken
private boolean returnToken() -
getToken
gets the next token and sets global theToken and theValue- Returns:
- the next token
-
getNumericalToken
private boolean getNumericalToken() -
floatValue
private float floatValue() -
addTokenToPostfix
-
addTokenToPostfixInt
-
addTokenToPostfixToken
-
addNextToken
private boolean addNextToken() -
addNextTokenIf
private boolean addNextTokenIf(int tok) -
addSubstituteTokenIf
-
clauseOr
private boolean clauseOr(boolean allowCommaAsOr) -
clauseAnd
private boolean clauseAnd() -
clauseNot
private boolean clauseNot() -
clausePrimitive
private boolean clausePrimitive() -
checkForCoordinate
private boolean checkForCoordinate(boolean isImplicitExpression) -
checkForItemSelector
private boolean checkForItemSelector(boolean allowNumeric) -
clauseWithin
private boolean clauseWithin(boolean isWithin) -
clauseConnected
private boolean clauseConnected(boolean isPolyhedra) -
clauseSubstructure
private boolean clauseSubstructure() -
clauseItemSelector
private boolean clauseItemSelector() -
clauseComparator
private boolean clauseComparator(boolean isOptional) -
addCompare
-
clauseCell
private boolean clauseCell(int tok) -
clauseDefine
private boolean clauseDefine(boolean haveToken, boolean forceString) -
generateResidueSpecCode
-
clauseResidueSpec
private boolean clauseResidueSpec() -
clauseResNameSpec
private boolean clauseResNameSpec()[a] or just a- Returns:
- true if handled
-
clauseSequenceSpec
private boolean clauseSequenceSpec() -
getSequenceCode
-
clauseChainSpec
private boolean clauseChainSpec(int tok) [:] [chars] [:] ["chars"] [:] [*] [:] [0-9] [:] [?] [:] (empty chain)- Parameters:
tok-- Returns:
- true if chain handled
-
clauseAlternateSpec
private boolean clauseAlternateSpec()check for %x or % (null alternate)- Returns:
- true if no error
-
isTerminator
private boolean isTerminator(int tok) we allow : and % to have null values- Parameters:
tok-- Returns:
- true if terminating
-
clauseModelSpec
private boolean clauseModelSpec()process /1 /1.1 / * or just /- Returns:
- true if no error
-
fixModelSpec
-
clauseAtomSpec
private boolean clauseAtomSpec() -
errorString
-
commandExpected
protected boolean commandExpected() -
error
protected boolean error(int error) -
errorStr
-
errorIntStr2
-
isError
private boolean isError() -
errorStr2
-