Skip to content

Commit

Permalink
(#120) Parser: break statement;
Browse files Browse the repository at this point in the history
  • Loading branch information
Griboedoff committed May 3, 2022
1 parent d4c7f74 commit bc8f4c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Cesium.Ast/Statements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ public record ForStatement(
// 6.8.6 Jump statements
public record GoToStatement(string Identifier) : Statement;

public record BreakStatement : Statement;

public record ReturnStatement(Expression Expression) : Statement;
5 changes: 4 additions & 1 deletion Cesium.Parser/CParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,10 @@ private static Statement MakeGoToStatement(ICToken _, ICToken identifier, ICToke
new GoToStatement(identifier.Text);

// [Rule("jump_statement: 'continue' ';'")]
// [Rule("jump_statement: 'break' ';'")]
[Rule("jump_statement: 'break' ';'")]
private static Statement MakeBreakStatement(ICToken _, ICToken __)
=> new BreakStatement();

[Rule("jump_statement: 'return' expression? ';'")]
private static Statement MakeReturnStatement(ICToken _, Expression expression, ICToken __) =>
new ReturnStatement(expression);
Expand Down

0 comments on commit bc8f4c2

Please sign in to comment.