Skip to content

Commit

Permalink
[lang] Add "break" keyword.
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Mar 18, 2017
1 parent fa6418c commit e441213
Show file tree
Hide file tree
Showing 51 changed files with 30,413 additions and 28,147 deletions.
Expand Up @@ -4177,6 +4177,30 @@ describe "General Syntax Reference" {
)
}

/* The `break` keyword is provides for breaking the enclosing loop.
* When this keyword is run, the control flow exists for the nearest
* enclosing loop, and run the statement that is jsut following the loop
* expression in the sequence of instructions.
*
* @filter(.* = '''|'''|.parseSuccessfully.*)
*/
fact "Break a loop"{
'''
var tab : String[]
for (v : tab) {
if (v == 1) {
break
}
}
'''.parseSuccessfully(
"package io.sarl.docs.reference.gsr
agent A {
def example {",
// TEXT
"} }"
)
}

}

/* SARL supports exception throwing and catching.
Expand Down
Expand Up @@ -74,6 +74,7 @@ protected String getRuleName(AbstractElement element) {
put(grammarAccess.getMemberAccess().getAlternatives_2_2_9(), "rule__Member__Alternatives_2_2_9");
put(grammarAccess.getAnnotationFieldAccess().getAlternatives_2(), "rule__AnnotationField__Alternatives_2");
put(grammarAccess.getParameterAccess().getAlternatives_6(), "rule__Parameter__Alternatives_6");
put(grammarAccess.getXPrimaryExpressionAccess().getAlternatives(), "rule__XPrimaryExpression__Alternatives");
put(grammarAccess.getXVariableDeclarationAccess().getAlternatives_0_0_1(), "rule__XVariableDeclaration__Alternatives_0_0_1");
put(grammarAccess.getXVariableDeclarationAccess().getAlternatives_0_0_1_0_0(), "rule__XVariableDeclaration__Alternatives_0_0_1_0_0");
put(grammarAccess.getXVariableDeclarationAccess().getAlternatives_0_0_1_1_1(), "rule__XVariableDeclaration__Alternatives_0_0_1_1_1");
Expand Down Expand Up @@ -117,7 +118,6 @@ protected String getRuleName(AbstractElement element) {
put(grammarAccess.getXMemberFeatureCallAccess().getAlternatives_1_0_0_0_1(), "rule__XMemberFeatureCall__Alternatives_1_0_0_0_1");
put(grammarAccess.getXMemberFeatureCallAccess().getAlternatives_1_1_0_0_1(), "rule__XMemberFeatureCall__Alternatives_1_1_0_0_1");
put(grammarAccess.getXMemberFeatureCallAccess().getAlternatives_1_1_3_1(), "rule__XMemberFeatureCall__Alternatives_1_1_3_1");
put(grammarAccess.getXPrimaryExpressionAccess().getAlternatives(), "rule__XPrimaryExpression__Alternatives");
put(grammarAccess.getXLiteralAccess().getAlternatives(), "rule__XLiteral__Alternatives");
put(grammarAccess.getXCollectionLiteralAccess().getAlternatives(), "rule__XCollectionLiteral__Alternatives");
put(grammarAccess.getXCasePartAccess().getAlternatives_3(), "rule__XCasePart__Alternatives_3");
Expand Down Expand Up @@ -320,6 +320,7 @@ protected String getRuleName(AbstractElement element) {
put(grammarAccess.getParameterAccess().getGroup_2(), "rule__Parameter__Group_2__0");
put(grammarAccess.getParameterAccess().getGroup_6_1(), "rule__Parameter__Group_6_1__0");
put(grammarAccess.getXtendEnumLiteralAccess().getGroup(), "rule__XtendEnumLiteral__Group__0");
put(grammarAccess.getBreakExpressionAccess().getGroup(), "rule__BreakExpression__Group__0");
put(grammarAccess.getXVariableDeclarationAccess().getGroup(), "rule__XVariableDeclaration__Group__0");
put(grammarAccess.getXVariableDeclarationAccess().getGroup_0(), "rule__XVariableDeclaration__Group_0__0");
put(grammarAccess.getXVariableDeclarationAccess().getGroup_0_0(), "rule__XVariableDeclaration__Group_0_0__0");
Expand Down

0 comments on commit e441213

Please sign in to comment.