This repository has been archived by the owner on Oct 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Completely rebuilt keyword grammar. I may regret this later.
- Loading branch information
1 parent
e9a83c9
commit bd8b85d
Showing
12 changed files
with
286 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
using Rockstar.Engine.Values; | ||
|
||
namespace Rockstar.Engine; | ||
|
||
public class Result { | ||
public static readonly Result Ok = new(); | ||
public static readonly Result Unknown = new(); | ||
} | ||
public enum WhatToDo { | ||
Unknown, | ||
Next, | ||
Skip, | ||
Break, | ||
Return | ||
} | ||
|
||
public class Result(Value value, WhatToDo whatToDo = WhatToDo.Next) { | ||
public Value Value => value; | ||
public WhatToDo WhatToDo => whatToDo; | ||
public static Result Unknown = new(new Null(), WhatToDo.Unknown); | ||
public static Result Return(Value value) => new Result(value, WhatToDo.Return); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
using System.Runtime.CompilerServices; | ||
using Rockstar.Engine.Expressions; | ||
|
||
namespace Rockstar.Engine.Statements; | ||
|
||
public class Return(Expression expr, Source source) | ||
: Statement(source) { | ||
public Expression Expression => expr; | ||
} | ||
|
||
public class Listen(Source source) | ||
: Statement(source) { | ||
public Variable? Variable { get; init; } = default; | ||
public Listen(Variable variable, Source source) : this(source) { | ||
this.Variable = variable; | ||
} | ||
} |
Oops, something went wrong.