|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.silence.smushcode.SmushcodeDefines
SmushcodeDefines controls most of the SMUSHcode75 parser's behavior.
It is here that all of the "magic values" are defined - what character
sequence defines a comment, what character starts a string literal, etc.
All of these things are kept separate so they will be easy to change if the
need ever arises. This entire class is nothing but public static final
Strings and public static final chars, basically the
Java equivalent of a collection of constants. No SmushcodeDefines
object should ever be instantiated - values should simply be read right out
of the class.
The EBNF specification for SMUSHcode75 is shown below:
EBNF specifications use the following tokens:
a | b Indicates that either a or b is allowed.
[ a ] Indicates that a is optional.
{ a } Indicates that 0 or more instances of a are allowed.
x{ a } Indicates that x instances of a are required, and may be
followed by 0 or more instances of a.
"a" Indicates that the lower-case letter a is required.
<a> Indicates that a is an EBNF object defined elsewhere.
a ... b Indicates both a and b as well as everything between them
in a logical progression (used primarily for lists of letters
and numbers).
expression:
<literal> | <compound-expression> | <function>
literal:
<numeric-literal> | <string-literal> |
<empty-literal>
numeric-literal:
[ "+" | "-" ] 1{ "0" | "1" | ... | "9" } [ "." 1{ "0" | "1" | ... |
"9" } ] [ "E" 1{ "0" | "1" | ... | "9" } ]
string-literal:
"`" { "a" | "b" | ... | "z" | "0" | "1" | ... | "9" | "!" | "@" | "#" |
"$" | "%" | "^" | "&" | "*" | "(" | ")" | "-" | "_" | "=" | "+" | "[" |
"{" | "]" | "}" | "|" | ";" | ":" | "'" | """ | "," | "<" | "." | ">" |
"/" | "?" | "~" | " " | "\\" | "\`" | "\b" | "\t" | "\n" | "\r" } "`"
empty-literal:
compound-expression:
"{" [ <expression> { ";" <expression> } ] "}"
function:
<function-identifier> "(" [ <expression> { "," <expression> } ] ")"
function-identifier:
<mathematical-function> | <numeric-function> | <string-function> |
<looping-function> | <decision-function> | <variable-function> |
<logic-function> | <subroutine-function>
mathematical-function:
"add" | "sub" | "mul" | "div" | "mod" | "exp" | "abs"
numeric-function:
"trunc" | "round" | "lt" | "gt" | "eq"
string-function:
"null" | "perror" | "strlen"
looping-function:
"preloop" | "postloop"
decision-function:
"if" | "select"
variable-function:
"store" | "vstore" | "v"
subroutine-function:
"u" | "eval" | "p" | "pnum"
logic-function:
"and" | "or" | "not" | "true" |
Note that the EBNF specifications only dictate what SMUSHcode75 is
required to do in order to be called SMUSHcode75. It is quite possible
that any given implementation may exceed the stated requirements (an example
of this would be a string literal accepting more characters than are listed).
The EBNF specifications also say nothing about the functional meanings of any of the above constructs. For that type of interpretation, some sort of SMUSHcode75 programmer's manual is needed.
| Field Summary | |
static java.lang.String |
badFunctionErrorText
Defines the full text that accompanies a parse error in a SMUSHcode75 statement. |
static java.lang.String |
badNumericArgumentErrorText
Defines the full text that accompanies a SMUSHcode75 function error, specifically an error resulting from an invalid numberic argument being supplied to a function. |
static java.lang.String |
baseFalse
Defines the value that is returned when a boolean SMUSHcode75 function returns "false". |
static java.lang.String |
baseTrue
Defines the value that is returned when a boolean SMUSHcode75 function returns "true". |
static java.lang.String |
commentEnd
Defines what character sequence ends a comment in a SMUSHcode75. |
static java.lang.String |
commentStart
Defines what character sequence begins a comment in a SMUSHcode75. |
static char |
compoundEnd
Defines the character that ends a compound expression in SMUSHcode75. |
static char |
compoundSeparator
Defines the character that separates expressions within a SMUSHcode75 compound expression. |
static char |
compoundStart
Defines the character that starts a compound expression in SMUSHcode75. |
static java.lang.String |
debugSeparator
Defines the string that separates a SMUSHcode75's source expression from its output during a call to traceExec(). |
static char |
delimitedBackspace
Defines the character that, when preceded by specialDelimiter,
signals a backspace character. |
static char |
delimitedCarriageReturn
Defines the character that, when preceded by specialDelimiter,
signals a carriage return. |
static char |
delimitedNewline
Defines the character that, when preceded by specialDelimiter,
signals a newline. |
static char |
delimitedTab
Defines the character that, when preceded by specialDelimiter,
signals a tab character. |
static java.lang.String |
errorPattern
Defines the text that surrounds a SMUSHcode75 function error to make it more noticable. |
static char |
functionEnd
Defines the character that marks the end of a SMUSHcode75 function's parameter list. |
static java.lang.String |
functionErrorHeader
Defines the text that precedes an error message from a SMUSHcode75 function. |
static char |
functionSeparator
Defines the character that separates the parameters in a SMUSHcode75 function's parameter list. |
static char |
functionStart
Defines the character that marks the beginning of a SMUSHcode75 function's parameter list. |
static java.lang.String |
illegalNumberFormatErrorText
Defines the full text that accompanies a parse error in a SMUSHcode75 statement. |
static int |
indexExec
Defines which element in the array of Vectors used by the evaluate()
functions contains the output of the SMUSHcode75 statements. |
static int |
indexNoExec
Defines which element in the array of Vectors used by the evaluate()
functions contains the original SMUSHcode75 statements. |
static java.lang.String |
invalidExpressionErrorText
Defines the text that precedes a SMUSHcode75 function error, specifically an error message resulting from an attempt to evaluate an invalid user-defined expression. |
static java.lang.String |
misplacedStringEndErrorText
Defines the full text that accompanies a parse error in a SMUSHcode75 statement. |
static java.lang.String |
misplacedStringStartErrorText
Defines the full text that accompanies a parse error in a SMUSHcode75 statement. |
static java.lang.String |
missingCommentEndErrorText
Defines the full text that accompanies a parse error in a SMUSHcode75 statement. |
static java.lang.String |
missingCompoundEndErrorText
Defines the full text that accompanies a parse error in a SMUSHcode75 statement. |
static java.lang.String |
missingCompoundStartErrorText
Defines the full text that accompanies a parse error in a SMUSHcode75 statement. |
static java.lang.String |
missingFunctionEndErrorText
Defines the full text that accompanies a parse error in a SMUSHcode75 statement. |
static java.lang.String |
missingFunctionStartErrorText
Defines the full text that accompanies a parse error in a SMUSHcode75 statement. |
static java.lang.String |
missingStringEndErrorText
Defines the full text that accompanies a parse error in a SMUSHcode75 statement. |
static java.lang.String |
missingStringStartErrorText
Defines the full text that accompanies a parse error in a SMUSHcode75 statement. |
static java.lang.String |
parseErrorHeader
Defines the start of the error text that accompanies a parse error in a SMUSHcode75 statement. |
static char |
realBackspace
Defines the character that is printed when the sequence specialDelimiter-delimitedBackspace
is encountered. |
static char |
realCarriageReturn
Defines the character that is printed when the sequence specialDelimiter-delimitedCarriageReturn
is encountered. |
static char |
realNewline
Defines the character that is printed when the sequence specialDelimiter-delimitedNewline
is encountered. |
static char |
realTab
Defines the character that is printed when the sequence specialDelimiter-delimitedTab
is encountered. |
static int |
recursionLimit
Defines the maximum size of the runtime execution stack. |
static java.lang.String |
recursionLimitExceededErrorText
Defines the text that precedes a SMUSHcode75 function error, specifically an error message resulting from too many levels being added to the runtime stack. |
static char |
specialDelimiter
Defines the "special delimiter" that offsets special characters in SMUSHcode75 statements. |
static char |
stringEnd
Defines the character that ends a string literal. |
static char |
stringStart
Defines the character that begins a string literal. |
static java.lang.String |
tooFewArgumentsErrorText
Defines the full text that accompanies a SMUSHcode75 function error, specifically an error resulting from too few arguments being supplied to a function. |
static java.lang.String |
tooManyArgumentsErrorText
Defines the full text that accompanies a SMUSHcode75 function error, specifically an error resulting from too many arguments being supplied to a function. |
static java.lang.String |
whiteSpace
Defines what is taken to be whitespace in a SMUSHcode75 statement. |
| Constructor Summary | |
SmushcodeDefines()
|
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String whiteSpace
This is set to a space, a tab, a newline and a carriage return.
public static final java.lang.String commentStart
This is set to "[*".
public static final java.lang.String commentEnd
This is set to "*]".
public static final java.lang.String baseTrue
This is set to "1".
public static final java.lang.String baseFalse
Expression.logic(ExpressionCaller) looks
for when determining a statement's "falseness".
This is set to "0".
Expression.logic(org.silence.smushcode.ExpressionCaller),
Constant Field Valuespublic static final java.lang.String parseErrorHeader
This is set to "Parse error: ".
public static final java.lang.String missingFunctionStartErrorText
This is set to parseErrorHeader + "Expected function begin
delimiter not found."
public static final java.lang.String missingFunctionEndErrorText
This is set to parseErrorHeader + "Expected function end
delimiter not found."
public static final java.lang.String misplacedStringStartErrorText
This is set to parseErrorHeader + "String start delimiter found
within string."
public static final java.lang.String misplacedStringEndErrorText
This is set to parseErrorHeader + "String end delimiter found
outside string."
public static final java.lang.String missingStringStartErrorText
This is set to parseErrorHeader + "String start delimiter not
found."
public static final java.lang.String missingStringEndErrorText
This is set to parseErrorHeader + "String end delimiter not
found."
public static final java.lang.String missingCommentEndErrorText
This is set to parseErrorHeader + "Comment end delimiter not
found."
public static final java.lang.String illegalNumberFormatErrorText
Double.valueOf().doubleValue() cannot parse.
This is set to parseErrorHeader + "Illegal number format."
public static final java.lang.String badFunctionErrorText
This is set to parseErrorHeader + "Unknown SMUSHcode75
function reference."
public static final java.lang.String missingCompoundStartErrorText
This is set to parseErrorHeader + "Expected compound expression
start delimiter not found."
public static final java.lang.String missingCompoundEndErrorText
This is set to parseErrorHeader + "Expected compound expression
end delimiter not found."
public static final java.lang.String errorPattern
This is set to "###".
public static final java.lang.String functionErrorHeader
This is set to "ERROR:".
public static final java.lang.String tooFewArgumentsErrorText
This is set to functionErrorHeader + "Not enough arguments
given." + errorPattern
public static final java.lang.String tooManyArgumentsErrorText
This is set to functionErrorHeader + "Too many arguments
given." + errorPattern
public static final java.lang.String badNumericArgumentErrorText
This is set to functionErrorHeader + "Invalid numeric literal
in argument." + errorPattern
public static final java.lang.String invalidExpressionErrorText
This is set to functionErrorHeader + "Invalid SMUSHcode75
expression in evaluation: "
public static final java.lang.String recursionLimitExceededErrorText
This is set to functionErrorHeader + "Recursion limit exceeded."
+ errorPattern
public static final char stringStart
This is set to '`'.
public static final char stringEnd
This is set to '`'.
public static final char specialDelimiter
This is set to '\'.
public static final char compoundStart
public static final char compoundEnd
public static final char compoundSeparator
public static final char functionStart
public static final char functionEnd
public static final char functionSeparator
public static final char delimitedTab
specialDelimiter,
signals a tab character.
This is set to 't'.
public static final char realTab
specialDelimiter-delimitedTab
is encountered.
This is set to '\t' (tab).
public static final char delimitedBackspace
specialDelimiter,
signals a backspace character.
This is set to 'b'.
public static final char realBackspace
specialDelimiter-delimitedBackspace
is encountered.
This is set to '\b' (backspace).
public static final char delimitedNewline
specialDelimiter,
signals a newline.
This is set to 'n'.
public static final char realNewline
specialDelimiter-delimitedNewline
is encountered.
This is set to '\n' (newline).
public static final char delimitedCarriageReturn
specialDelimiter,
signals a carriage return.
This is set to 'r'.
public static final char realCarriageReturn
specialDelimiter-delimitedCarriageReturn
is encountered.
This is set to '\r' (carriage return).
public static final java.lang.String debugSeparator
traceExec().
This is set to " => ".
Expression.traceExec(org.silence.smushcode.ExpressionCaller),
Constant Field Valuespublic static final int indexExec
Vectors used by the evaluate()
functions contains the output of the SMUSHcode75 statements.
This is set to 0.
Expression.evaluate(org.silence.smushcode.ExpressionCaller),
Constant Field Valuespublic static final int indexNoExec
Vectors used by the evaluate()
functions contains the original SMUSHcode75 statements.
This is set to 1.
Expression.evaluate(org.silence.smushcode.ExpressionCaller),
Constant Field Valuespublic static final int recursionLimit
| Constructor Detail |
public SmushcodeDefines()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||