Skip to content

Commit

Permalink
feat: Loop labels
Browse files Browse the repository at this point in the history
closes #199
  • Loading branch information
giann committed May 16, 2024
1 parent 1f93e9c commit 42182f2
Show file tree
Hide file tree
Showing 8 changed files with 551 additions and 199 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ var value = from {
- Tracing JIT (https://github.com/buzz-language/buzz/issues/134): will look for hot loops and compile them
- `list.fill`
- `std.panic` will panic and print current stack trace
- Loop can have _labels_ that you can `break` or `continue` to (https://github.com/buzz-language/buzz/issues/199)

## Changed
- Map type notation has changed from `{K, V}` to `{K: V}`. Similarly map expression with specified typed went from `{<K, V>, ...}` to `{<K: V>, ...}` (https://github.com/buzz-language/buzz/issues/253)
Expand Down
7 changes: 5 additions & 2 deletions src/Ast.zig
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ pub const Node = struct {
Block: []Node.Index,
BlockExpression: []Node.Index,
Boolean: bool,
Break: void,
Break: ?Node.Index,
Call: Call,
Continue: void,
Continue: ?Node.Index,
Dot: Dot,
DoUntil: WhileDoUntil,
Enum: Enum,
Expand Down Expand Up @@ -458,6 +458,7 @@ pub const For = struct {
condition: Node.Index,
post_loop: []Node.Index,
body: Node.Index,
label: ?TokenIndex,
};

pub const ForEach = struct {
Expand All @@ -466,6 +467,7 @@ pub const ForEach = struct {
value: Node.Index,
body: Node.Index,
key_omitted: bool,
label: ?TokenIndex,
};

pub const Function = struct {
Expand Down Expand Up @@ -697,6 +699,7 @@ pub const VarDeclaration = struct {
pub const WhileDoUntil = struct {
condition: Node.Index,
body: Node.Index,
label: ?TokenIndex,
};

pub const Zdef = struct {
Expand Down
Loading

0 comments on commit 42182f2

Please sign in to comment.