mirror of
https://github.com/Cekis/SWG-ScriptConverter.git
synced 2026-09-12 23:45:00 -04:00
Add code
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using ScriptConverter.Ast;
|
||||
using ScriptConverter.Ast.Statements;
|
||||
|
||||
namespace ScriptConverter.Parser.Parselets.Statements
|
||||
{
|
||||
class ConstVariableParselet : IStatementParselet
|
||||
{
|
||||
public Statement Parse(ScriptParser parser, ScriptToken token, out bool trailingSemicolon)
|
||||
{
|
||||
trailingSemicolon = true;
|
||||
|
||||
ScriptType type;
|
||||
string name;
|
||||
parser.ParseNamedType(out type, out name);
|
||||
|
||||
parser.Take(ScriptTokenType.Assign);
|
||||
|
||||
var value = parser.ParseExpression();
|
||||
|
||||
var definitions = new List<VariableStatement.Definition>()
|
||||
{
|
||||
new VariableStatement.Definition(type, name, value)
|
||||
};
|
||||
|
||||
return new VariableStatement(token, parser.Previous, type, true, definitions);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user