This commit is contained in:
Rohan Singh
2019-01-23 22:52:45 -05:00
parent 3f69ec7987
commit ad50a19057
103 changed files with 5734 additions and 1 deletions
@@ -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);
}
}
}