- fixed some issues with the grammar for parsing states:

* Goto did not support the class scope operator '::'. Like in DECORATE, this cannot be done with a simple '.' because it creates semantic problems with first part of a state label. This requires different syntax so that it can unambiguously distinguish between a scope identifier and the actual label
 * Goto used the incorrect token PLUS for '+' instead of ADD.
 * The state's duration was not stored in the AST.
 * Truncating the sprite name inside the parser is probably not the best idea because it used a simple Printf to report this. Let's do this during processing of the AST where this can be properly handled as an error.
This commit is contained in:
Christoph Oelckers 2016-10-12 00:04:30 +02:00
commit f46b6b5be5
3 changed files with 23 additions and 13 deletions

View file

@ -405,6 +405,7 @@ static void PrintStateGoto(FLispString &out, ZCC_TreeNode *node)
{
ZCC_StateGoto *snode = (ZCC_StateGoto *)node;
out.Open("state-goto");
PrintNodes(out, snode->Qualifier);
PrintNodes(out, snode->Label);
PrintNodes(out, snode->Offset);
out.Close();
@ -414,7 +415,8 @@ static void PrintStateLine(FLispString &out, ZCC_TreeNode *node)
{
ZCC_StateLine *snode = (ZCC_StateLine *)node;
out.Open("state-line");
out.Add(snode->Sprite, 4);
out.Add(*(snode->Sprite));
PrintNodes(out, snode->Duration);
if (snode->bNoDelay) out.Add("nodelay", 7);
if (snode->bBright) out.Add("bright", 6);
if (snode->bFast) out.Add("fast", 4);