mirror of
https://github.com/Cekis/SWG-ScriptConverter.git
synced 2026-10-11 01:12:50 -04:00
Add code
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using ScriptConverter.Ast;
|
||||
using ScriptConverter.Ast.Declarations;
|
||||
|
||||
namespace ScriptConverter.Parser.Parselets.Declarations
|
||||
{
|
||||
class ConstParselet : IDeclarationParselet
|
||||
{
|
||||
public Declaration Parse(ScriptParser parser, ScriptToken token)
|
||||
{
|
||||
ScriptType type;
|
||||
string name;
|
||||
parser.ParseNamedType(out type, out name);
|
||||
|
||||
parser.Take(ScriptTokenType.Assign);
|
||||
|
||||
var value = parser.ParseExpression();
|
||||
|
||||
parser.Take(ScriptTokenType.Semicolon);
|
||||
|
||||
return new FieldDeclaration(token, parser.Previous, type, name, value, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user