Revision 47017 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/grammars/BasicGrammarFactory.java
BasicGrammarFactory.java | ||
---|---|---|
29 | 29 |
import org.gvsig.expressionevaluator.Codes; |
30 | 30 |
import org.gvsig.expressionevaluator.ExpressionBuilder; |
31 | 31 |
import static org.gvsig.expressionevaluator.ExpressionBuilder.FUNCTION_DICT; |
32 |
import org.gvsig.expressionevaluator.impl.function.programming.BreakFunction; |
|
32 | 33 |
|
33 | 34 |
/** |
34 | 35 |
* |
... | ... | |
167 | 168 |
theGrammar.addStatement(this.createTimestampStatement(theGrammar)); |
168 | 169 |
theGrammar.addStatement(this.createWhileStatement(theGrammar)); |
169 | 170 |
theGrammar.addStatement(this.create$ConstantStatement(theGrammar)); |
170 |
|
|
171 |
theGrammar.addStatement(this.createBreakStatement(theGrammar)); |
|
171 | 172 |
this.grammar = theGrammar; |
172 | 173 |
} |
173 | 174 |
return grammar; |
... | ... | |
375 | 376 |
|
376 | 377 |
stmt = theGrammar.createStatement("RETURN"); |
377 | 378 |
stmt.addRule(stmt.require_any_token("RETURN")); |
378 |
stmt.addRule(stmt.optional_any_token(";") |
|
379 |
.addRuleOnTrue(stmt.set_expression("VALUES", null)) |
|
380 |
.addRuleOnFalse(stmt.require_expression().capture_as("VALUES")) |
|
381 |
.addRuleOnFalse(stmt.require_any_token(";")) |
|
382 |
); |
|
379 |
stmt.addRule(stmt.optional_expression().capture_as("VALUES")); |
|
383 | 380 |
stmt.code( |
384 | 381 |
ReturnFunction.NAME, |
385 | 382 |
stmt.args_expand("VALUES") |
... | ... | |
387 | 384 |
return stmt; |
388 | 385 |
} |
389 | 386 |
|
387 |
private Statement createBreakStatement(Grammar theGrammar) { |
|
388 |
Statement stmt; |
|
389 |
|
|
390 |
theGrammar.addReservedWord("BREAK"); |
|
391 |
|
|
392 |
stmt = theGrammar.createStatement("BREAK"); |
|
393 |
stmt.addRule(stmt.require_any_token("BREAK")); |
|
394 |
stmt.code( |
|
395 |
BreakFunction.NAME, |
|
396 |
stmt.args_expand() |
|
397 |
); |
|
398 |
return stmt; |
|
399 |
} |
|
400 |
|
|
390 | 401 |
private Statement createVarStatement(Grammar theGrammar) { |
391 | 402 |
Statement stmt; |
392 | 403 |
|
Also available in: Unified diff