mirror of
https://github.com/Cekis/SWG-ScriptConverter.git
synced 2026-01-16 22:04:29 -05:00
25 lines
680 B
C#
25 lines
680 B
C#
using System.Collections.Generic;
|
|
using ScriptConverter.Ast.Statements;
|
|
|
|
namespace ScriptConverter.Parser.Parselets.Statements
|
|
{
|
|
class BlockParselet : IStatementParselet
|
|
{
|
|
public Statement Parse(ScriptParser parser, ScriptToken token, out bool trailingSemicolon)
|
|
{
|
|
trailingSemicolon = false;
|
|
|
|
var statements = new List<Statement>();
|
|
|
|
while (!parser.Match(ScriptTokenType.RightBrace))
|
|
{
|
|
statements.Add(parser.ParseStatement());
|
|
}
|
|
|
|
parser.Take(ScriptTokenType.RightBrace);
|
|
|
|
return new BlockStatement(token, parser.Previous, statements);
|
|
}
|
|
}
|
|
}
|