1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 02:49:55 +00:00
openmw-tes3mp/monster/compiler/enums.d
nkorslund 0d7b08cbae - Updated to latest Monster trunk.
- Changed config and music manager to singletons


git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@77 ea6a568a-9f4f-0410-981a-c910a81bb256
2008-12-30 01:59:24 +00:00

67 lines
1.8 KiB
D

/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/
This file (enums.d) is part of the Monster script language package.
Monster is distributed as free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License
version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
version 3 along with this program. If not, see
http://www.gnu.org/licenses/ .
*/
module monster.compiler.enums;
import monster.compiler.scopes;
import monster.compiler.types;
import monster.compiler.statement;
import monster.compiler.tokenizer;
class EnumDeclaration : TypeDeclaration
{
static bool canParse(TokenArray toks)
{ return toks.isNext(TT.Enum); }
Token name;
EnumType type;
override:
void parse(ref TokenArray toks)
{
reqNext(toks, TT.Enum);
reqNext(toks, TT.Identifier, name);
reqNext(toks, TT.LeftCurl);
// Just skip everything until the matching }. This lets us
// define some enums and play around in the scripts, even if it
// doesn't actually work.
while(!isNext(toks, TT.RightCurl)) next(toks);
isNext(toks, TT.Semicolon);
}
void insertType(TFVScope last)
{
type = new EnumType(this);
// Insert ourselves into the parent scope
assert(last !is null);
last.insertEnum(this);
}
// Very little to resolve, really. It's purely a declarative
// statement.
void resolve(Scope last)
{}
}