-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
483 additions
and
62 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
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
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using LanguageParser.Common; | ||
using LanguageParser.Interfaces; | ||
using LanguageParser.Lexer; | ||
using LanguageParser.Visitors; | ||
|
||
namespace LanguageParser.Expressions; | ||
|
||
public sealed class ForInExpression : ExpressionBase | ||
{ | ||
public Token ForToken { get; } | ||
public VariableExpression Variable { get; } | ||
public Token InToken { get; } | ||
public ExpressionBase Collection { get; } | ||
public ExpressionBase Body { get; } | ||
|
||
internal ForInExpression(Token forToken, VariableExpression variable, Token inToken, ExpressionBase collection, ExpressionBase body) : base(SyntaxKind.ForInExpression) | ||
{ | ||
ForToken = forToken; | ||
Variable = variable; | ||
InToken = inToken; | ||
Collection = collection; | ||
Body = body; | ||
} | ||
|
||
public override IEnumerable<ISyntaxElement> GetAllElements() | ||
{ | ||
yield return ForToken; | ||
yield return Variable; | ||
yield return InToken; | ||
yield return Collection; | ||
yield return Body; | ||
} | ||
|
||
public override void Visit(ExpressionVisitor visitor) | ||
{ | ||
visitor.VisitForIn(this); | ||
} | ||
|
||
public override T Visit<T, TState>(ExpressionVisitor<T, TState> visitor, TState state) | ||
{ | ||
return visitor.VisitForIn(this, state); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using LanguageParser.Common; | ||
using LanguageParser.Interfaces; | ||
using LanguageParser.Lexer; | ||
using LanguageParser.Visitors; | ||
|
||
namespace LanguageParser.Expressions; | ||
|
||
public sealed class ForToExpression : ExpressionBase | ||
{ | ||
public Token ForToken { get; } | ||
public VariableExpression Variable { get; } | ||
public Token? DownToken { get; } | ||
public Token ToToken { get; } | ||
public ExpressionBase Count { get; } | ||
public ExpressionBase Body { get; } | ||
|
||
internal ForToExpression(Token forToken, VariableExpression variable, Token? downToken, Token toToken, ExpressionBase count, ExpressionBase body) : base(SyntaxKind.ForToExpression) | ||
{ | ||
ForToken = forToken; | ||
Variable = variable; | ||
DownToken = downToken; | ||
ToToken = toToken; | ||
Count = count; | ||
Body = body; | ||
} | ||
|
||
public override IEnumerable<ISyntaxElement> GetAllElements() | ||
{ | ||
yield return ForToken; | ||
yield return Variable; | ||
if (DownToken is not null) | ||
yield return DownToken; | ||
yield return ToToken; | ||
yield return Count; | ||
yield return Body; | ||
} | ||
|
||
public override void Visit(ExpressionVisitor visitor) | ||
{ | ||
visitor.VisitForTo(this); | ||
} | ||
|
||
public override T Visit<T, TState>(ExpressionVisitor<T, TState> visitor, TState state) | ||
{ | ||
return visitor.VisitForTo(this, state); | ||
} | ||
} |
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
Oops, something went wrong.