See: Description
Interface | Description |
---|---|
GrammaticalRuleI |
Indicates rules for parsing structured code.
|
Class | Description |
---|---|
BlockRule |
Parse a statement block
{ sequence } . |
ControlNode |
A node representing a control statement such as
break or continue . |
ControlRule |
Parses
break and continue statements
<ControlRule> ::=
| <word> <separator>
A successful parse returns a ControlNode |
ExpressionRule |
Parses an expression.
|
IfNode |
A node representing an if statement.
|
JavaForRule |
Parses a java-style for loop
for(i=0;i<10;++i) x+=i; . |
JavaIfRule |
Parse a java style if statement:
if(expr) statement [ else statement ]
<JavaInRule> ::=
|| <if> <open> <expression> <close> <statement>
|| <if> <open> <expression> <close> <statement> <else> <statement>
|
JavaWhileRule |
Parse a Java-style while loop
while(x<10) x=x+1;
<JavaWhileRule> ::=
<while> <open> <expression> <close> <statement>
A successful parse will return a LoopNode . |
LoopNode |
A node represents a looping construct such as a
for or while loop. |
PossiblyTerminatedExpressionRule |
Parse an expression followed by an optional separator.
|
SequenceNode |
A node representing a sequence of expressions.
|
SequenceRule |
Parses a sequence of statements
<SequenceRule> ::=
(<statement>)*
A successful parses will return a SequenceNode with one child per statement.
|
SequenceSeparatorRule |
Parses a sequence of statements separated by a separator
<SequenceRule> ::=
<statement> (<sep> <statement>)* <sep>?
|
StandardStructuredParser |
A structured parser with a java like grammar.
|
StatementRule |
Parse a single statement from a list of possibilities.
|
StructuredEvaluator |
An evaluator which works with structured programming.
|
StructuredGrammarParser |
A grammar parser which works with structured programming.
|
StructuredParser |
Base class for defining a parser for structured code.
|
StructureNode |
Base class for all structure nodes, defines an
eval method. |
TerminatedExpressionRule |
Parse an expression followed by a separator.
|
Enum | Description |
---|---|
LoopNode.ControlValues |
Special values to indicate break and continue statements
Used by
ControlRule and ControlNode . |
The structure package provides limited support for block style programming with if
,
for
and while
statements. The exact syntax can be configurable to give a Java,
Pascal or Basic like syntax.
It is not intended to be a fully featured parser more a way to add some
structured programming elements like simple loops to Jep code.
The StandardStructuredParser
provides a ready made parser with a java-like syntax.
It supports:
x=5; y=x^2;
{ x=5; y=6; }
if(x==5) {y=6;} else {y=7;}
for(j=0;j<=10;++j) x+=j;
while(x<10) x+=2;
Alternative syntaxes can be built up using the StructuredGrammerParser and a set of
GrammaticalRuleI
. Rules are provided for most types of statements.
The StructuredEvaluator is used to evaluate sequences of expressions after parsing.
StructuredConsole
,
DocumentationCopyright © 2018 Singular Systems http://www.singularsys.com/jep