OSDN Git Service

Adding switch case default keywords
authorAlexis Hetu <sugoi@google.com>
Thu, 4 Jun 2015 21:21:22 +0000 (17:21 -0400)
committerAlexis Hétu <sugoi@google.com>
Fri, 12 Jun 2015 21:12:11 +0000 (21:12 +0000)
This adds switch/case keywords to glsl.
This makes the shaders that include these
keywords compile, but they don't run
properly yet, partly because the "break"
statement only handles loops currently.

Change-Id: I1f52b445e1124ed3931843c46e27ecc1d9ce3d11
Reviewed-on: https://swiftshader-review.googlesource.com/3400
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
16 files changed:
src/OpenGL/compiler/Android.mk
src/OpenGL/compiler/Compiler.vcxproj
src/OpenGL/compiler/Compiler.vcxproj.filters
src/OpenGL/compiler/IntermTraverse.cpp
src/OpenGL/compiler/Intermediate.cpp
src/OpenGL/compiler/ParseHelper.cpp
src/OpenGL/compiler/ParseHelper.h
src/OpenGL/compiler/ValidateSwitch.cpp [new file with mode: 0644]
src/OpenGL/compiler/ValidateSwitch.h [new file with mode: 0644]
src/OpenGL/compiler/glslang.y
src/OpenGL/compiler/glslang_tab.cpp
src/OpenGL/compiler/glslang_tab.h
src/OpenGL/compiler/intermOut.cpp
src/OpenGL/compiler/intermediate.h
src/OpenGL/compiler/localintermediate.h
src/OpenGL/libGLESv2/libGLESv2.cbp

index 3a1f950..b513db8 100644 (file)
@@ -40,6 +40,7 @@ LOCAL_SRC_FILES += \
        TranslatorASM.cpp \
        util.cpp \
        ValidateLimitations.cpp \
+       ValidateSwitch.cpp \
 
 LOCAL_CFLAGS += -DLOG_TAG=\"swiftshader_compiler\" -Wno-unused-parameter
 
index 8f07b70..f28be0e 100644 (file)
     <ClCompile Include="ValidateLimitations.cpp" />\r
     <ClCompile Include="glslang_lex.cpp" />\r
     <ClCompile Include="glslang_tab.cpp" />\r
+    <ClCompile Include="ValidateSwitch.cpp" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <CustomBuild Include="glslang.l">\r
     <ClInclude Include="util.h" />\r
     <ClInclude Include="ValidateLimitations.h" />\r
     <ClInclude Include="glslang_tab.h" />\r
+    <ClInclude Include="ValidateSwitch.h" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ProjectReference Include="preprocessor\preprocessor.vcxproj">\r
index 8d4374b..91d0749 100644 (file)
@@ -83,6 +83,9 @@
     <ClCompile Include="AnalyzeCallDepth.cpp">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="ValidateSwitch.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="BaseTypes.h">\r
     <ClInclude Include="glslang.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="ValidateSwitch.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <CustomBuild Include="glslang.l">\r
index c79e1fc..3ed50e2 100644 (file)
@@ -53,7 +53,7 @@ void TIntermBinary::traverse(TIntermTraverser* it)
        //
        if(visit)
        {
-               it->incrementDepth();
+               it->incrementDepth(this);
 
                if(it->rightToLeft) 
                {
@@ -114,7 +114,7 @@ void TIntermUnary::traverse(TIntermTraverser* it)
                visit = it->visitUnary(PreVisit, this);
 
        if (visit) {
-               it->incrementDepth();
+               it->incrementDepth(this);
                operand->traverse(it);
                it->decrementDepth();
        }
@@ -137,7 +137,7 @@ void TIntermAggregate::traverse(TIntermTraverser* it)
        
        if(visit)
        {
-               it->incrementDepth();
+               it->incrementDepth(this);
 
                if(it->rightToLeft)
                {
@@ -190,7 +190,7 @@ void TIntermSelection::traverse(TIntermTraverser* it)
                visit = it->visitSelection(PreVisit, this);
        
        if (visit) {
-               it->incrementDepth();
+               it->incrementDepth(this);
                if (it->rightToLeft) {
                        if (falseBlock)
                                falseBlock->traverse(it);
@@ -212,6 +212,60 @@ void TIntermSelection::traverse(TIntermTraverser* it)
 }
 
 //
+// Traverse a switch node.  Same comments in binary node apply here.
+//
+void TIntermSwitch::traverse(TIntermTraverser *it)
+{
+       bool visit = true;
+
+       if(it->preVisit)
+               visit = it->visitSwitch(PreVisit, this);
+
+       if(visit)
+       {
+               it->incrementDepth(this);
+               if(it->rightToLeft)
+               {
+                       if(mStatementList)
+                               mStatementList->traverse(it);
+                       if(it->inVisit)
+                               visit = it->visitSwitch(InVisit, this);
+                       if(visit)
+                               mInit->traverse(it);
+               }
+               else
+               {
+                       mInit->traverse(it);
+                       if(it->inVisit)
+                               visit = it->visitSwitch(InVisit, this);
+                       if(visit && mStatementList)
+                               mStatementList->traverse(it);
+               }
+               it->decrementDepth();
+       }
+
+       if(visit && it->postVisit)
+               it->visitSwitch(PostVisit, this);
+}
+
+//
+// Traverse a switch node.  Same comments in binary node apply here.
+//
+void TIntermCase::traverse(TIntermTraverser *it)
+{
+       bool visit = true;
+
+       if(it->preVisit)
+               visit = it->visitCase(PreVisit, this);
+
+       if(visit && mCondition)
+               mCondition->traverse(it);
+
+       if(visit && it->postVisit)
+               it->visitCase(PostVisit, this);
+}
+
+//
 // Traverse a loop node.  Same comments in binary node apply here.
 //
 void TIntermLoop::traverse(TIntermTraverser* it)
@@ -225,7 +279,7 @@ void TIntermLoop::traverse(TIntermTraverser* it)
        
        if(visit)
        {
-               it->incrementDepth();
+               it->incrementDepth(this);
 
                if(it->rightToLeft)
                {
@@ -282,7 +336,7 @@ void TIntermBranch::traverse(TIntermTraverser* it)
                visit = it->visitBranch(PreVisit, this);
        
        if (visit && expression) {
-               it->incrementDepth();
+               it->incrementDepth(this);
                expression->traverse(it);
                it->decrementDepth();
        }
index ca0f702..62658a4 100644 (file)
@@ -552,6 +552,22 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true
     return node;
 }
 
+TIntermSwitch *TIntermediate::addSwitch(TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &line)
+{
+       TIntermSwitch *node = new TIntermSwitch(init, statementList);
+       node->setLine(line);
+
+       return node;
+}
+
+TIntermCase *TIntermediate::addCase(TIntermTyped *condition, const TSourceLoc &line)
+{
+       TIntermCase *node = new TIntermCase(condition);
+       node->setLine(line);
+
+       return node;
+}
+
 //
 // Constant terminal nodes.  Has a union that contains bool, float or int constants
 //
index 9f86042..7275d7b 100644 (file)
@@ -11,6 +11,7 @@
 
 #include "glslang.h"
 #include "preprocessor/SourceLocation.h"
+#include "ValidateSwitch.h"
 
 ///////////////////////////////////////////////////////////////////////
 //
@@ -2966,6 +2967,143 @@ bool TParseContext::binaryOpCommonCheck(TOperator op, TIntermTyped *left, TInter
        return true;
 }
 
+TIntermSwitch *TParseContext::addSwitch(TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &loc)
+{
+       TBasicType switchType = init->getBasicType();
+       if((switchType != EbtInt && switchType != EbtUInt) ||
+          init->isMatrix() ||
+          init->isArray() ||
+          init->isVector())
+       {
+               error(init->getLine(), "init-expression in a switch statement must be a scalar integer", "switch");
+               recover();
+               return nullptr;
+       }
+
+       if(statementList)
+       {
+               if(!ValidateSwitch::validate(switchType, this, statementList, loc))
+               {
+                       recover();
+                       return nullptr;
+               }
+       }
+
+       TIntermSwitch *node = intermediate.addSwitch(init, statementList, loc);
+       if(node == nullptr)
+       {
+               error(loc, "erroneous switch statement", "switch");
+               recover();
+               return nullptr;
+       }
+       return node;
+}
+
+TIntermCase *TParseContext::addCase(TIntermTyped *condition, const TSourceLoc &loc)
+{
+       if(switchNestingLevel == 0)
+       {
+               error(loc, "case labels need to be inside switch statements", "case");
+               recover();
+               return nullptr;
+       }
+       if(condition == nullptr)
+       {
+               error(loc, "case label must have a condition", "case");
+               recover();
+               return nullptr;
+       }
+       if((condition->getBasicType() != EbtInt && condition->getBasicType() != EbtUInt) ||
+          condition->isMatrix() ||
+          condition->isArray() ||
+          condition->isVector())
+       {
+               error(condition->getLine(), "case label must be a scalar integer", "case");
+               recover();
+       }
+       TIntermConstantUnion *conditionConst = condition->getAsConstantUnion();
+       if(conditionConst == nullptr)
+       {
+               error(condition->getLine(), "case label must be constant", "case");
+               recover();
+       }
+       TIntermCase *node = intermediate.addCase(condition, loc);
+       if(node == nullptr)
+       {
+               error(loc, "erroneous case statement", "case");
+               recover();
+               return nullptr;
+       }
+       return node;
+}
+
+TIntermCase *TParseContext::addDefault(const TSourceLoc &loc)
+{
+       if(switchNestingLevel == 0)
+       {
+               error(loc, "default labels need to be inside switch statements", "default");
+               recover();
+               return nullptr;
+       }
+       TIntermCase *node = intermediate.addCase(nullptr, loc);
+       if(node == nullptr)
+       {
+               error(loc, "erroneous default statement", "default");
+               recover();
+               return nullptr;
+       }
+       return node;
+}
+
+TIntermBranch *TParseContext::addBranch(TOperator op, const TSourceLoc &loc)
+{
+       switch(op)
+       {
+       case EOpContinue:
+               if(loopNestingLevel <= 0)
+               {
+                       error(loc, "continue statement only allowed in loops", "");
+                       recover();
+               }
+               break;
+       case EOpBreak:
+               if(loopNestingLevel <= 0 && switchNestingLevel <= 0)
+               {
+                       error(loc, "break statement only allowed in loops and switch statements", "");
+                       recover();
+               }
+               break;
+       case EOpReturn:
+               if(currentFunctionType->getBasicType() != EbtVoid)
+               {
+                       error(loc, "non-void function must return a value", "return");
+                       recover();
+               }
+               break;
+       default:
+               // No checks for discard
+               break;
+       }
+       return intermediate.addBranch(op, loc);
+}
+
+TIntermBranch *TParseContext::addBranch(TOperator op, TIntermTyped *returnValue, const TSourceLoc &loc)
+{
+       ASSERT(op == EOpReturn);
+       functionReturnsValue = true;
+       if(currentFunctionType->getBasicType() == EbtVoid)
+       {
+               error(loc, "void function cannot return a value", "return");
+               recover();
+       }
+       else if(*currentFunctionType != returnValue->getType())
+       {
+               error(loc, "function return is not matching type:", "return");
+               recover();
+       }
+       return intermediate.addBranch(op, returnValue, loc);
+}
+
 //
 // Parse an array of strings using yyparse.
 //
index fa31481..b5fd520 100644 (file)
@@ -34,6 +34,7 @@ struct TParseContext {
             treeRoot(0),
             lexAfterType(false),
             loopNestingLevel(0),
+            switchNestingLevel(0),
             structNestingLevel(0),
             inTypeParen(false),
             currentFunctionType(NULL),
@@ -58,6 +59,7 @@ struct TParseContext {
     TIntermNode* treeRoot;       // root of parse tree being created
     bool lexAfterType;           // true if we've recognized a type, so can only be looking for an identifier
     int loopNestingLevel;        // 0 if outside all loops
+    int switchNestingLevel;      // 0 if outside all switch statements
     int structNestingLevel;      // incremented while parsing a struct declaration
     bool inTypeParen;            // true if in parentheses, looking only for an identifier
     const TType* currentFunctionType;  // the return type of the function that's currently being parsed
@@ -82,6 +84,9 @@ struct TParseContext {
     void trace(const char* str);
     void recover();
 
+    void incrSwitchNestingLevel() { ++switchNestingLevel; }
+    void decrSwitchNestingLevel() { --switchNestingLevel; }
+
        // This method is guaranteed to succeed, even if no variable with 'name' exists.
        const TVariable *getNamedVariable(const TSourceLoc &location, const TString *name, const TSymbol *symbol);
 
@@ -189,9 +194,16 @@ struct TParseContext {
 
        bool structNestingErrorCheck(const TSourceLoc &line, const TField &field);
 
+       TIntermSwitch *addSwitch(TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &loc);
+       TIntermCase *addCase(TIntermTyped *condition, const TSourceLoc &loc);
+       TIntermCase *addDefault(const TSourceLoc &loc);
+
        TIntermTyped *addUnaryMath(TOperator op, TIntermTyped *child, const TSourceLoc &loc);
        TIntermTyped *addUnaryMathLValue(TOperator op, TIntermTyped *child, const TSourceLoc &loc);
 
+       TIntermBranch *addBranch(TOperator op, const TSourceLoc &loc);
+       TIntermBranch *addBranch(TOperator op, TIntermTyped *returnValue, const TSourceLoc &loc);
+
 private:
        bool declareVariable(const TSourceLoc &line, const TString &identifier, const TType &type, TVariable **variable);
 
diff --git a/src/OpenGL/compiler/ValidateSwitch.cpp b/src/OpenGL/compiler/ValidateSwitch.cpp
new file mode 100644 (file)
index 0000000..982cc51
--- /dev/null
@@ -0,0 +1,200 @@
+//\r
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.\r
+// Use of this source code is governed by a BSD-style license that can be\r
+// found in the LICENSE file.\r
+//\r
+\r
+#include "ValidateSwitch.h"\r
+\r
+#include "ParseHelper.h"\r
+\r
+bool ValidateSwitch::validate(TBasicType switchType, TParseContext *context,\r
+    TIntermAggregate *statementList, const TSourceLoc &loc)\r
+{\r
+    ValidateSwitch validate(switchType, context);\r
+    ASSERT(statementList);\r
+    statementList->traverse(&validate);\r
+    return validate.validateInternal(loc);\r
+}\r
+\r
+ValidateSwitch::ValidateSwitch(TBasicType switchType, TParseContext *context)\r
+    : TIntermTraverser(true, false, true),\r
+      mSwitchType(switchType),\r
+      mContext(context),\r
+      mCaseTypeMismatch(false),\r
+      mFirstCaseFound(false),\r
+      mStatementBeforeCase(false),\r
+      mLastStatementWasCase(false),\r
+      mControlFlowDepth(0),\r
+      mCaseInsideControlFlow(false),\r
+      mDefaultCount(0),\r
+      mDuplicateCases(false)\r
+{}\r
+\r
+void ValidateSwitch::visitSymbol(TIntermSymbol *)\r
+{\r
+    if (!mFirstCaseFound)\r
+        mStatementBeforeCase = true;\r
+    mLastStatementWasCase = false;\r
+}\r
+\r
+void ValidateSwitch::visitConstantUnion(TIntermConstantUnion *)\r
+{\r
+    // Conditions of case labels are not traversed, so this is some other constant\r
+    // Could be just a statement like "0;"\r
+    if (!mFirstCaseFound)\r
+        mStatementBeforeCase = true;\r
+    mLastStatementWasCase = false;\r
+}\r
+\r
+bool ValidateSwitch::visitBinary(Visit, TIntermBinary *)\r
+{\r
+    if (!mFirstCaseFound)\r
+        mStatementBeforeCase = true;\r
+    mLastStatementWasCase = false;\r
+    return true;\r
+}\r
+\r
+bool ValidateSwitch::visitUnary(Visit, TIntermUnary *)\r
+{\r
+    if (!mFirstCaseFound)\r
+        mStatementBeforeCase = true;\r
+    mLastStatementWasCase = false;\r
+    return true;\r
+}\r
+\r
+bool ValidateSwitch::visitSelection(Visit visit, TIntermSelection *)\r
+{\r
+    if (visit == PreVisit)\r
+        ++mControlFlowDepth;\r
+    if (visit == PostVisit)\r
+        --mControlFlowDepth;\r
+    if (!mFirstCaseFound)\r
+        mStatementBeforeCase = true;\r
+    mLastStatementWasCase = false;\r
+    return true;\r
+}\r
+\r
+bool ValidateSwitch::visitSwitch(Visit, TIntermSwitch *)\r
+{\r
+    if (!mFirstCaseFound)\r
+        mStatementBeforeCase = true;\r
+    mLastStatementWasCase = false;\r
+    // Don't go into nested switch statements\r
+    return false;\r
+}\r
+\r
+bool ValidateSwitch::visitCase(Visit, TIntermCase *node)\r
+{\r
+    const char *nodeStr = node->hasCondition() ? "case" : "default";\r
+    if (mControlFlowDepth > 0)\r
+    {\r
+        mContext->error(node->getLine(), "label statement nested inside control flow", nodeStr);\r
+        mCaseInsideControlFlow = true;\r
+    }\r
+    mFirstCaseFound = true;\r
+    mLastStatementWasCase = true;\r
+    if (!node->hasCondition())\r
+    {\r
+        ++mDefaultCount;\r
+        if (mDefaultCount > 1)\r
+        {\r
+            mContext->error(node->getLine(), "duplicate default label", nodeStr);\r
+        }\r
+    }\r
+    else\r
+    {\r
+        TIntermConstantUnion *condition = node->getCondition()->getAsConstantUnion();\r
+        if (condition == nullptr)\r
+        {\r
+            // This can happen in error cases.\r
+            return false;\r
+        }\r
+        TBasicType conditionType = condition->getBasicType();\r
+        if (conditionType != mSwitchType)\r
+        {\r
+            mContext->error(condition->getLine(),\r
+                "case label type does not match switch init-expression type", nodeStr);\r
+            mCaseTypeMismatch = true;\r
+        }\r
+\r
+        if (conditionType == EbtInt)\r
+        {\r
+            int iConst = condition->getIConst(0);\r
+            if (mCasesSigned.find(iConst) != mCasesSigned.end())\r
+            {\r
+                mContext->error(condition->getLine(), "duplicate case label", nodeStr);\r
+                mDuplicateCases = true;\r
+            }\r
+            else\r
+            {\r
+                mCasesSigned.insert(iConst);\r
+            }\r
+        }\r
+        else if (conditionType == EbtUInt)\r
+        {\r
+            unsigned int uConst = condition->getUConst(0);\r
+            if (mCasesUnsigned.find(uConst) != mCasesUnsigned.end())\r
+            {\r
+                mContext->error(condition->getLine(), "duplicate case label", nodeStr);\r
+                mDuplicateCases = true;\r
+            }\r
+            else\r
+            {\r
+                mCasesUnsigned.insert(uConst);\r
+            }\r
+        }\r
+        // Other types are possible only in error cases, where the error has already been generated\r
+        // when parsing the case statement.\r
+    }\r
+    // Don't traverse the condition of the case statement\r
+    return false;\r
+}\r
+\r
+bool ValidateSwitch::visitAggregate(Visit visit, TIntermAggregate *)\r
+{\r
+    if (getParentNode() != nullptr)\r
+    {\r
+        // This is not the statementList node, but some other node.\r
+        if (!mFirstCaseFound)\r
+            mStatementBeforeCase = true;\r
+        mLastStatementWasCase = false;\r
+    }\r
+    return true;\r
+}\r
+\r
+bool ValidateSwitch::visitLoop(Visit visit, TIntermLoop *)\r
+{\r
+    if (visit == PreVisit)\r
+        ++mControlFlowDepth;\r
+    if (visit == PostVisit)\r
+        --mControlFlowDepth;\r
+    if (!mFirstCaseFound)\r
+        mStatementBeforeCase = true;\r
+    mLastStatementWasCase = false;\r
+    return true;\r
+}\r
+\r
+bool ValidateSwitch::visitBranch(Visit, TIntermBranch *)\r
+{\r
+    if (!mFirstCaseFound)\r
+        mStatementBeforeCase = true;\r
+    mLastStatementWasCase = false;\r
+    return true;\r
+}\r
+\r
+bool ValidateSwitch::validateInternal(const TSourceLoc &loc)\r
+{\r
+    if (mStatementBeforeCase)\r
+    {\r
+        mContext->error(loc,\r
+            "statement before the first label", "switch");\r
+    }\r
+    if (mLastStatementWasCase)\r
+    {\r
+        mContext->error(loc,\r
+            "no statement between the last label and the end of the switch statement", "switch");\r
+    }\r
+    return !mStatementBeforeCase && !mLastStatementWasCase && !mCaseInsideControlFlow &&\r
+        !mCaseTypeMismatch && mDefaultCount <= 1 && !mDuplicateCases;\r
+}\r
diff --git a/src/OpenGL/compiler/ValidateSwitch.h b/src/OpenGL/compiler/ValidateSwitch.h
new file mode 100644 (file)
index 0000000..7db304a
--- /dev/null
@@ -0,0 +1,53 @@
+//\r
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.\r
+// Use of this source code is governed by a BSD-style license that can be\r
+// found in the LICENSE file.\r
+//\r
+\r
+#ifndef COMPILER_TRANSLATOR_VALIDATESWITCH_H_\r
+#define COMPILER_TRANSLATOR_VALIDATESWITCH_H_\r
+\r
+#include "intermediate.h"\r
+#include <set>\r
+\r
+struct TParseContext;\r
+\r
+class ValidateSwitch : public TIntermTraverser\r
+{\r
+  public:\r
+    // Check for errors and output messages any remaining errors on the context.\r
+    // Returns true if there are no errors.\r
+    static bool validate(TBasicType switchType, TParseContext *context,\r
+        TIntermAggregate *statementList, const TSourceLoc &loc);\r
+\r
+    void visitSymbol(TIntermSymbol *) override;\r
+    void visitConstantUnion(TIntermConstantUnion *) override;\r
+    bool visitBinary(Visit, TIntermBinary *) override;\r
+    bool visitUnary(Visit, TIntermUnary *) override;\r
+    bool visitSelection(Visit visit, TIntermSelection *) override;\r
+    bool visitSwitch(Visit, TIntermSwitch *) override;\r
+    bool visitCase(Visit, TIntermCase *) override;\r
+    bool visitAggregate(Visit, TIntermAggregate *) override;\r
+    bool visitLoop(Visit visit, TIntermLoop *) override;\r
+    bool visitBranch(Visit, TIntermBranch *) override;\r
+\r
+  private:\r
+    ValidateSwitch(TBasicType switchType, TParseContext *context);\r
+\r
+    bool validateInternal(const TSourceLoc &loc);\r
+\r
+    TBasicType mSwitchType;\r
+    TParseContext *mContext;\r
+    bool mCaseTypeMismatch;\r
+    bool mFirstCaseFound;\r
+    bool mStatementBeforeCase;\r
+    bool mLastStatementWasCase;\r
+    int mControlFlowDepth;\r
+    bool mCaseInsideControlFlow;\r
+    int mDefaultCount;\r
+    std::set<int> mCasesSigned;\r
+    std::set<unsigned int> mCasesUnsigned;\r
+    bool mDuplicateCases;\r
+};\r
+\r
+#endif // COMPILER_TRANSLATOR_VALIDATESWITCH_H_\r
index f483d2c..892f356 100644 (file)
@@ -67,6 +67,8 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
             TIntermNodePair nodePair;
             TIntermTyped* intermTypedNode;
             TIntermAggregate* intermAggregate;
+            TIntermSwitch* intermSwitch;
+            TIntermCase* intermCase;
         };
         union {
             TPublicType type;
@@ -165,6 +167,8 @@ extern void yyerror(TParseContext* context, const char* reason);
 %type <interm.intermNode> declaration external_declaration
 %type <interm.intermNode> for_init_statement compound_statement_no_new_scope
 %type <interm.nodePair> selection_rest_statement for_rest_statement
+%type <interm.intermSwitch> switch_statement
+%type <interm.intermCase> case_label
 %type <interm.intermNode> iteration_statement jump_statement statement_no_new_scope statement_with_scope
 %type <interm> single_declaration init_declarator_list
 
@@ -357,7 +361,7 @@ function_call
                     $$->getAsAggregate()->setName(fnCandidate->getMangledName());
 
                     TQualifier qual;
-                    for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
+                    for (size_t i = 0; i < fnCandidate->getParamCount(); ++i) {
                         qual = fnCandidate->getParam(i).type->getQualifier();
                         if (qual == EvqOut || qual == EvqInOut) {
                             if (context->lValueErrorCheck($$->getLine(), "assign", $$->getAsAggregate()->getSequence()[i]->getAsTyped())) {
@@ -906,7 +910,7 @@ declaration
         prototype->setType(function.getReturnType());
         prototype->setName(function.getName());
         
-        for (int i = 0; i < function.getParamCount(); i++)
+        for (size_t i = 0; i < function.getParamCount(); i++)
         {
             const TParameter &param = function.getParam(i);
             if (param.name != 0)
@@ -973,7 +977,7 @@ function_prototype
                 context->error($2.line, "overloaded functions must have the same return type", $1->getReturnType().getBasicString());
                 context->recover();
             }
-            for (int i = 0; i < prevDec->getParamCount(); ++i) {
+            for (size_t i = 0; i < prevDec->getParamCount(); ++i) {
                 if (prevDec->getParam(i).type->getQualifier() != $1->getParam(i).type->getQualifier()) {
                     context->error($2.line, "overloaded functions must have the same parameter qualifiers", $1->getParam(i).type->getQualifierString());
                     context->recover();
@@ -1802,6 +1806,8 @@ simple_statement
     : declaration_statement { $$ = $1; }
     | expression_statement  { $$ = $1; }
     | selection_statement   { $$ = $1; }
+    | switch_statement      { $$ = $1; }
+    | case_label            { $$ = $1; }
     | iteration_statement   { $$ = $1; }
     | jump_statement        { $$ = $1; }
     ;
@@ -1874,7 +1880,23 @@ selection_rest_statement
     }
     ;
 
-// Grammar Note:  No 'switch'.  Switch statements not supported.
+switch_statement
+    : SWITCH LEFT_PAREN expression RIGHT_PAREN { context->incrSwitchNestingLevel(); } compound_statement {
+        $$ = context->addSwitch($3, $6, $1.line);
+        context->decrSwitchNestingLevel();
+    }
+    ;
+
+case_label
+    : CASE constant_expression COLON {
+        $$ = context->addCase($2, $1.line);
+    }
+    | DEFAULT COLON {
+        $$ = context->addDefault($1.line);
+    }
+    ;
+
+// Grammar Note:  Labeled statements for SWITCH only; 'goto' is not supported.
 
 condition
     // In 1996 c++ draft, conditions can include single declarations
@@ -1950,40 +1972,20 @@ for_rest_statement
 
 jump_statement
     : CONTINUE SEMICOLON {
-        if (context->loopNestingLevel <= 0) {
-            context->error($1.line, "continue statement only allowed in loops", "");
-            context->recover();
-        }
-        $$ = context->intermediate.addBranch(EOpContinue, $1.line);
+        $$ = context->addBranch(EOpContinue, $1.line);
     }
     | BREAK SEMICOLON {
-        if (context->loopNestingLevel <= 0) {
-            context->error($1.line, "break statement only allowed in loops", "");
-            context->recover();
-        }
-        $$ = context->intermediate.addBranch(EOpBreak, $1.line);
+        $$ = context->addBranch(EOpBreak, $1.line);
     }
     | RETURN SEMICOLON {
-        $$ = context->intermediate.addBranch(EOpReturn, $1.line);
-        if (context->currentFunctionType->getBasicType() != EbtVoid) {
-            context->error($1.line, "non-void function must return a value", "return");
-            context->recover();
-        }
+        $$ = context->addBranch(EOpReturn, $1.line);
     }
     | RETURN expression SEMICOLON {
-        $$ = context->intermediate.addBranch(EOpReturn, $2, $1.line);
-        context->functionReturnsValue = true;
-        if (context->currentFunctionType->getBasicType() == EbtVoid) {
-            context->error($1.line, "void function cannot return a value", "return");
-            context->recover();
-        } else if (*(context->currentFunctionType) != $2->getType()) {
-            context->error($1.line, "function return is not matching type:", "return");
-            context->recover();
-        }
+        $$ = context->addBranch(EOpReturn, $2, $1.line);
     }
     | DISCARD SEMICOLON {
         FRAG_ONLY("discard", $1.line);
-        $$ = context->intermediate.addBranch(EOpKill, $1.line);
+        $$ = context->addBranch(EOpKill, $1.line);
     }
     ;
 
@@ -2065,7 +2067,7 @@ function_definition
         // knows where to find parameters.
         //
         TIntermAggregate* paramNodes = new TIntermAggregate;
-        for (int i = 0; i < function->getParamCount(); i++) {
+        for (size_t i = 0; i < function->getParamCount(); i++) {
             const TParameter& param = function->getParam(i);
             if (param.name != 0) {
                 TVariable *variable = new TVariable(param.name, *param.type);
index 9553e09..31bb692 100644 (file)
@@ -277,6 +277,8 @@ typedef union YYSTYPE
             TIntermNodePair nodePair;
             TIntermTyped* intermTypedNode;
             TIntermAggregate* intermAggregate;
+            TIntermSwitch* intermSwitch;
+            TIntermCase* intermCase;
         };
         union {
             TPublicType type;
@@ -556,16 +558,16 @@ union yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  110
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   2377
+#define YYLAST   2412
 
 /* YYNTOKENS -- Number of terminals.  */
 #define YYNTOKENS  128
 /* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  90
+#define YYNNTS  93
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  263
+#define YYNRULES  269
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  396
+#define YYNSTATES  409
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
@@ -645,17 +647,17 @@ static const yytype_uint16 yyprhs[] =
      549,   551,   553,   555,   557,   559,   561,   563,   565,   567,
      568,   575,   576,   582,   584,   587,   591,   596,   598,   602,
      604,   609,   611,   613,   615,   617,   619,   621,   623,   625,
-     627,   630,   631,   632,   638,   640,   642,   643,   646,   647,
-     650,   653,   657,   659,   662,   664,   667,   673,   677,   679,
-     681,   686,   687,   694,   695,   704,   705,   713,   715,   717,
-     719,   720,   723,   727,   730,   733,   736,   740,   743,   745,
-     748,   750,   752,   753
+     627,   629,   631,   634,   635,   636,   642,   644,   646,   647,
+     650,   651,   654,   657,   661,   663,   666,   668,   671,   677,
+     681,   683,   684,   691,   695,   698,   700,   705,   706,   713,
+     714,   723,   724,   732,   734,   736,   738,   739,   742,   746,
+     749,   752,   755,   759,   762,   764,   767,   769,   771,   772
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
 static const yytype_int16 yyrhs[] =
 {
-     214,     0,    -1,    76,    -1,   129,    -1,    79,    -1,    80,
+     217,     0,    -1,    76,    -1,   129,    -1,    79,    -1,    80,
       -1,    78,    -1,    81,    -1,   104,   156,   105,    -1,   130,
       -1,   131,   106,   132,   107,    -1,   133,    -1,   131,   110,
       82,    -1,   131,    85,    -1,   131,    86,    -1,   156,    -1,
@@ -717,52 +719,54 @@ static const yytype_int16 yyrhs[] =
       -1,   173,   175,   187,   114,    -1,   188,    -1,   187,   111,
      188,    -1,    76,    -1,    76,   106,   157,   107,    -1,   154,
       -1,   159,    -1,   193,    -1,   192,    -1,   190,    -1,   202,
-      -1,   203,    -1,   206,    -1,   213,    -1,   108,   109,    -1,
-      -1,    -1,   108,   194,   201,   195,   109,    -1,   200,    -1,
-     192,    -1,    -1,   198,   200,    -1,    -1,   199,   192,    -1,
-     108,   109,    -1,   108,   201,   109,    -1,   191,    -1,   201,
-     191,    -1,   114,    -1,   156,   114,    -1,    19,   104,   156,
-     105,   204,    -1,   197,    17,   197,    -1,   197,    -1,   156,
-      -1,   170,    76,   113,   189,    -1,    -1,    56,   104,   207,
-     205,   105,   196,    -1,    -1,    16,   208,   197,    56,   104,
-     156,   105,   114,    -1,    -1,    18,   104,   209,   210,   212,
-     105,   196,    -1,   202,    -1,   190,    -1,   205,    -1,    -1,
-     211,   114,    -1,   211,   114,   156,    -1,    15,   114,    -1,
-      14,   114,    -1,    21,   114,    -1,    21,   156,   114,    -1,
-      20,   114,    -1,   215,    -1,   214,   215,    -1,   216,    -1,
-     159,    -1,    -1,   160,   217,   200,    -1
+      -1,   203,    -1,   205,    -1,   207,    -1,   209,    -1,   216,
+      -1,   108,   109,    -1,    -1,    -1,   108,   194,   201,   195,
+     109,    -1,   200,    -1,   192,    -1,    -1,   198,   200,    -1,
+      -1,   199,   192,    -1,   108,   109,    -1,   108,   201,   109,
+      -1,   191,    -1,   201,   191,    -1,   114,    -1,   156,   114,
+      -1,    19,   104,   156,   105,   204,    -1,   197,    17,   197,
+      -1,   197,    -1,    -1,    22,   104,   156,   105,   206,   193,
+      -1,    23,   157,   112,    -1,    24,   112,    -1,   156,    -1,
+     170,    76,   113,   189,    -1,    -1,    56,   104,   210,   208,
+     105,   196,    -1,    -1,    16,   211,   197,    56,   104,   156,
+     105,   114,    -1,    -1,    18,   104,   212,   213,   215,   105,
+     196,    -1,   202,    -1,   190,    -1,   208,    -1,    -1,   214,
+     114,    -1,   214,   114,   156,    -1,    15,   114,    -1,    14,
+     114,    -1,    21,   114,    -1,    21,   156,   114,    -1,    20,
+     114,    -1,   218,    -1,   217,   218,    -1,   219,    -1,   159,
+      -1,    -1,   160,   220,   200,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   192,   192,   227,   230,   235,   240,   245,   250,   256,
-     259,   262,   265,   268,   271,   277,   285,   385,   388,   396,
-     400,   407,   411,   418,   424,   433,   441,   518,   525,   535,
-     538,   548,   558,   580,   581,   582,   583,   591,   592,   601,
-     610,   623,   624,   632,   643,   644,   653,   665,   666,   676,
-     686,   696,   709,   710,   720,   733,   734,   748,   749,   763,
-     764,   778,   779,   792,   793,   806,   807,   820,   821,   838,
-     839,   852,   853,   854,   855,   857,   858,   859,   861,   863,
-     865,   867,   872,   875,   886,   894,   902,   929,   935,   942,
-     946,   950,   954,   961,   999,  1002,  1009,  1017,  1038,  1059,
-    1070,  1099,  1104,  1114,  1119,  1129,  1132,  1135,  1138,  1144,
-    1151,  1154,  1158,  1162,  1167,  1172,  1179,  1183,  1187,  1191,
-    1196,  1201,  1205,  1281,  1291,  1297,  1300,  1306,  1312,  1319,
-    1328,  1337,  1340,  1343,  1350,  1354,  1361,  1365,  1370,  1375,
-    1385,  1395,  1404,  1414,  1421,  1424,  1427,  1433,  1440,  1443,
-    1449,  1452,  1455,  1461,  1464,  1479,  1483,  1487,  1491,  1495,
-    1499,  1504,  1509,  1514,  1519,  1524,  1529,  1534,  1539,  1544,
-    1549,  1554,  1559,  1565,  1571,  1577,  1583,  1589,  1595,  1601,
-    1607,  1613,  1618,  1623,  1632,  1637,  1642,  1647,  1652,  1657,
-    1662,  1667,  1672,  1677,  1682,  1687,  1692,  1697,  1702,  1715,
-    1715,  1718,  1718,  1724,  1727,  1743,  1746,  1755,  1759,  1765,
-    1772,  1787,  1791,  1795,  1796,  1802,  1803,  1804,  1805,  1806,
-    1810,  1811,  1811,  1811,  1821,  1822,  1826,  1826,  1827,  1827,
-    1832,  1835,  1845,  1848,  1854,  1855,  1859,  1867,  1871,  1881,
-    1886,  1903,  1903,  1908,  1908,  1915,  1915,  1923,  1926,  1932,
-    1935,  1941,  1945,  1952,  1959,  1966,  1973,  1984,  1993,  1997,
-    2004,  2007,  2013,  2013
+       0,   196,   196,   231,   234,   239,   244,   249,   254,   260,
+     263,   266,   269,   272,   275,   281,   289,   389,   392,   400,
+     404,   411,   415,   422,   428,   437,   445,   522,   529,   539,
+     542,   552,   562,   584,   585,   586,   587,   595,   596,   605,
+     614,   627,   628,   636,   647,   648,   657,   669,   670,   680,
+     690,   700,   713,   714,   724,   737,   738,   752,   753,   767,
+     768,   782,   783,   796,   797,   810,   811,   824,   825,   842,
+     843,   856,   857,   858,   859,   861,   862,   863,   865,   867,
+     869,   871,   876,   879,   890,   898,   906,   933,   939,   946,
+     950,   954,   958,   965,  1003,  1006,  1013,  1021,  1042,  1063,
+    1074,  1103,  1108,  1118,  1123,  1133,  1136,  1139,  1142,  1148,
+    1155,  1158,  1162,  1166,  1171,  1176,  1183,  1187,  1191,  1195,
+    1200,  1205,  1209,  1285,  1295,  1301,  1304,  1310,  1316,  1323,
+    1332,  1341,  1344,  1347,  1354,  1358,  1365,  1369,  1374,  1379,
+    1389,  1399,  1408,  1418,  1425,  1428,  1431,  1437,  1444,  1447,
+    1453,  1456,  1459,  1465,  1468,  1483,  1487,  1491,  1495,  1499,
+    1503,  1508,  1513,  1518,  1523,  1528,  1533,  1538,  1543,  1548,
+    1553,  1558,  1563,  1569,  1575,  1581,  1587,  1593,  1599,  1605,
+    1611,  1617,  1622,  1627,  1636,  1641,  1646,  1651,  1656,  1661,
+    1666,  1671,  1676,  1681,  1686,  1691,  1696,  1701,  1706,  1719,
+    1719,  1722,  1722,  1728,  1731,  1747,  1750,  1759,  1763,  1769,
+    1776,  1791,  1795,  1799,  1800,  1806,  1807,  1808,  1809,  1810,
+    1811,  1812,  1816,  1817,  1817,  1817,  1827,  1828,  1832,  1832,
+    1833,  1833,  1838,  1841,  1851,  1854,  1860,  1861,  1865,  1873,
+    1877,  1884,  1884,  1891,  1894,  1903,  1908,  1925,  1925,  1930,
+    1930,  1937,  1937,  1945,  1948,  1954,  1957,  1963,  1967,  1974,
+    1977,  1980,  1983,  1986,  1995,  1999,  2006,  2009,  2015,  2015
 };
 #endif
 
@@ -822,10 +826,11 @@ static const char *const yytname[] =
   "compound_statement", "$@3", "$@4", "statement_no_new_scope",
   "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope",
   "statement_list", "expression_statement", "selection_statement",
-  "selection_rest_statement", "condition", "iteration_statement", "$@7",
-  "$@8", "$@9", "for_init_statement", "conditionopt", "for_rest_statement",
+  "selection_rest_statement", "switch_statement", "$@7", "case_label",
+  "condition", "iteration_statement", "$@8", "$@9", "$@10",
+  "for_init_statement", "conditionopt", "for_rest_statement",
   "jump_statement", "translation_unit", "external_declaration",
-  "function_definition", "$@10", 0
+  "function_definition", "$@11", 0
 };
 #endif
 
@@ -875,11 +880,11 @@ static const yytype_uint8 yyr1[] =
      181,   181,   181,   181,   181,   181,   181,   181,   181,   183,
      182,   184,   182,   185,   185,   186,   186,   187,   187,   188,
      188,   189,   190,   191,   191,   192,   192,   192,   192,   192,
-     193,   194,   195,   193,   196,   196,   198,   197,   199,   197,
-     200,   200,   201,   201,   202,   202,   203,   204,   204,   205,
-     205,   207,   206,   208,   206,   209,   206,   210,   210,   211,
-     211,   212,   212,   213,   213,   213,   213,   213,   214,   214,
-     215,   215,   217,   216
+     192,   192,   193,   194,   195,   193,   196,   196,   198,   197,
+     199,   197,   200,   200,   201,   201,   202,   202,   203,   204,
+     204,   206,   205,   207,   207,   208,   208,   210,   209,   211,
+     209,   212,   209,   213,   213,   214,   214,   215,   215,   216,
+     216,   216,   216,   216,   217,   217,   218,   218,   220,   219
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
@@ -907,11 +912,11 @@ static const yytype_uint8 yyr2[] =
        1,     1,     1,     1,     1,     1,     1,     1,     1,     0,
        6,     0,     5,     1,     2,     3,     4,     1,     3,     1,
        4,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       2,     0,     0,     5,     1,     1,     0,     2,     0,     2,
-       2,     3,     1,     2,     1,     2,     5,     3,     1,     1,
-       4,     0,     6,     0,     8,     0,     7,     1,     1,     1,
-       0,     2,     3,     2,     2,     2,     3,     2,     1,     2,
-       1,     1,     0,     3
+       1,     1,     2,     0,     0,     5,     1,     1,     0,     2,
+       0,     2,     2,     3,     1,     2,     1,     2,     5,     3,
+       1,     0,     6,     3,     2,     1,     4,     0,     6,     0,
+       8,     0,     7,     1,     1,     1,     0,     2,     3,     2,
+       2,     2,     3,     2,     1,     2,     1,     1,     0,     3
 };
 
 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -925,266 +930,264 @@ static const yytype_uint16 yydefact[] =
      129,   175,   176,   177,   178,   179,   180,     0,   126,   125,
        0,   155,   181,   182,   183,   185,   186,   187,   188,   189,
      190,   191,   192,   193,   184,   194,   195,   196,     0,   198,
-     261,   262,     0,    95,   105,     0,   110,   116,   133,     0,
-     131,   123,     0,   134,   142,   153,   197,     0,   258,   260,
+     267,   268,     0,    95,   105,     0,   110,   116,   133,     0,
+     131,   123,     0,   134,   142,   153,   197,     0,   264,   266,
      130,   122,     0,   139,   140,     0,   201,     0,    86,     0,
       93,   105,   127,   106,   107,   108,    96,     0,   105,     0,
       87,   117,   132,     0,    92,     0,   124,   143,   135,     0,
-       1,   259,     0,   199,     0,   150,     0,   148,     0,   263,
+       1,   265,     0,   199,     0,   150,     0,   148,     0,   269,
       97,   102,   104,   109,     0,   111,    98,     0,     0,    85,
        0,     0,     0,     0,   203,     2,     6,     4,     5,     7,
       28,     0,     0,     0,    35,    34,    36,    33,     3,     9,
       29,    11,    16,    17,     0,     0,    22,     0,    37,     0,
       41,    44,    47,    52,    55,    57,    59,    61,    63,    65,
       67,    84,     0,    26,    88,     0,     0,     0,   147,     0,
-       0,     0,   243,     0,     0,     0,     0,     0,   221,   230,
-     234,    37,    69,    82,     0,   212,     0,   153,   215,   232,
-     214,   213,     0,   216,   217,   218,   219,    99,   101,   103,
-       0,     0,     0,     0,   211,   121,     0,   209,     0,   207,
-       0,   204,    30,    31,     0,    13,    14,     0,     0,    20,
-      19,     0,    21,    23,    25,    32,     0,     0,     0,     0,
+       0,     0,   249,     0,     0,     0,     0,     0,     0,     0,
+       0,   223,   232,   236,    37,    69,    82,     0,   212,     0,
+     153,   215,   234,   214,   213,     0,   216,   217,   218,   219,
+     220,   221,    99,   101,   103,     0,     0,     0,     0,   211,
+     121,     0,   209,     0,   207,     0,   204,    30,    31,     0,
+      13,    14,     0,     0,    20,    19,     0,    21,    23,    25,
+      32,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,   154,     0,   202,   151,
-     152,   149,   254,   253,   228,   245,     0,   257,   255,     0,
-     241,   220,     0,    72,    73,    75,    74,    77,    78,    79,
-      80,    81,    76,    71,     0,     0,   235,   231,   233,     0,
-       0,     0,   115,     0,   118,     0,     0,     0,   205,     0,
-      89,     8,     0,    15,    27,    12,    18,    24,    38,    39,
-      40,    43,    42,    45,    46,    50,    51,    48,    49,    53,
-      54,    56,    58,    60,    62,    64,    66,     0,   200,     0,
-       0,     0,     0,     0,   256,     0,   222,    70,    83,     0,
+       0,   154,     0,   202,   151,   152,   149,   260,   259,   230,
+     251,     0,   263,   261,     0,     0,     0,   244,   247,   222,
+       0,    72,    73,    75,    74,    77,    78,    79,    80,    81,
+      76,    71,     0,     0,   237,   233,   235,     0,     0,     0,
+     115,     0,   118,     0,     0,     0,   205,     0,    89,     8,
+       0,    15,    27,    12,    18,    24,    38,    39,    40,    43,
+      42,    45,    46,    50,    51,    48,    49,    53,    54,    56,
+      58,    60,    62,    64,    66,     0,   200,     0,     0,     0,
+       0,     0,   262,     0,   243,     0,   224,    70,    83,     0,
        0,   112,   119,     0,   206,     0,   208,     0,    90,    10,
-       0,     0,   227,   229,   248,   247,   250,   228,   239,     0,
-       0,     0,     0,   100,   113,     0,   120,   210,     0,    68,
-       0,   249,     0,     0,   238,   236,     0,     0,   223,   114,
-       0,     0,   251,     0,   228,     0,   225,   242,   224,    91,
-       0,   252,   246,   237,   240,   244
+       0,     0,   229,   231,   254,   253,   256,   230,   241,   245,
+       0,     0,     0,     0,   100,   113,     0,   120,   210,     0,
+      68,     0,   255,     0,     0,   240,   238,     0,     0,     0,
+     225,   114,     0,     0,   257,     0,   230,   242,     0,   227,
+     248,   226,    91,     0,   258,   252,   239,   246,   250
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int16 yydefgoto[] =
 {
-      -1,   148,   149,   150,   302,   151,   152,   153,   154,   155,
-     156,   157,   191,   159,   160,   161,   162,   163,   164,   165,
-     166,   167,   168,   169,   170,   192,   193,   284,   194,   172,
-     105,   195,   196,    62,    63,    64,   121,    96,    97,   122,
+      -1,   148,   149,   150,   310,   151,   152,   153,   154,   155,
+     156,   157,   194,   159,   160,   161,   162,   163,   164,   165,
+     166,   167,   168,   169,   170,   195,   196,   292,   197,   172,
+     105,   198,   199,    62,    63,    64,   121,    96,    97,   122,
       65,    66,    67,    68,    98,    69,    70,    71,    72,    73,
-     116,   117,    74,   173,    76,   175,   114,   133,   134,   218,
-     219,   215,   198,   199,   200,   201,   272,   362,   387,   329,
-     330,   331,   388,   202,   203,   204,   375,   361,   205,   335,
-     264,   332,   356,   372,   373,   206,    77,    78,    79,    89
+     116,   117,    74,   173,    76,   175,   114,   133,   134,   223,
+     224,   220,   201,   202,   203,   204,   280,   373,   400,   337,
+     338,   339,   401,   205,   206,   207,   386,   208,   387,   209,
+     372,   210,   345,   269,   340,   366,   383,   384,   211,    77,
+      78,    79,    89
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -338
+#define YYPACT_NINF -333
 static const yytype_int16 yypact[] =
 {
-    2015,   -27,  -338,  -338,  -338,   137,  -338,  -338,  -338,  -338,
-    -338,  -338,  -338,  -338,  -338,  -338,  -338,  -338,  -338,  -338,
-    -338,  -338,  -338,  -338,  -338,  -338,  -338,  -338,  -338,  -338,
-    -338,  -338,  -338,  -338,  -338,  -338,  -338,    59,  -338,  -338,
-     -57,  -338,  -338,  -338,  -338,  -338,  -338,  -338,  -338,  -338,
-    -338,  -338,  -338,  -338,  -338,  -338,  -338,  -338,   -80,  -338,
-    -338,   -64,   -32,   -26,    17,   -50,  -338,    44,    27,  1132,
-    -338,  -338,  2300,    27,  -338,    61,  -338,  1940,  -338,  -338,
-    -338,  -338,  2300,  -338,  -338,    63,  -338,    78,  -338,    66,
-    -338,    62,  -338,  -338,  -338,  -338,  -338,  2164,   107,    93,
-    -338,   -79,  -338,    72,  -338,  2090,  -338,  -338,  -338,  1493,
-    -338,  -338,    68,  -338,  2090,    70,   -83,  -338,   360,  -338,
-    -338,  -338,  -338,   108,  2164,   -51,  -338,  1202,  1493,  -338,
-     141,  2164,   111,  1685,  -338,    82,  -338,  -338,  -338,  -338,
-    -338,  1493,  1493,  1493,  -338,  -338,  -338,  -338,  -338,  -338,
-       9,  -338,  -338,  -338,    83,   -21,  1588,    86,  -338,  1493,
-      31,   -35,    51,   -43,    48,    67,    69,    71,   100,   104,
-     -74,  -338,    91,  -338,  -338,  2090,  1770,    65,  -338,    78,
-      89,   102,  -338,    96,   113,   105,  1300,   116,   112,  -338,
-    -338,   110,  -338,  -338,    -2,  -338,   -64,    49,  -338,  -338,
-    -338,  -338,   476,  -338,  -338,  -338,  -338,   118,  -338,  -338,
-    1395,  1493,   101,   119,  -338,  -338,   111,   121,    12,  -338,
-     -60,  -338,  -338,  -338,   -13,  -338,  -338,  1493,  2232,  -338,
-    -338,  1493,   125,  -338,  -338,  -338,  1493,  1493,  1493,  1493,
-    1493,  1493,  1493,  1493,  1493,  1493,  1493,  1493,  1493,  1493,
-    1493,  1493,  1493,  1493,  1493,  1493,  -338,  1855,  -338,  -338,
-    -338,  -338,  -338,  -338,   122,  -338,  1493,  -338,  -338,    14,
-    -338,  -338,   592,  -338,  -338,  -338,  -338,  -338,  -338,  -338,
-    -338,  -338,  -338,  -338,  1493,  1493,  -338,  -338,  -338,  1493,
-     120,   124,  -338,  1493,   126,    16,  1493,   111,  -338,   -71,
-    -338,  -338,   128,   127,  -338,   133,  -338,  -338,  -338,  -338,
-    -338,    31,    31,   -35,   -35,    51,    51,    51,    51,   -43,
-     -43,    48,    67,    69,    71,   100,   104,    46,  -338,   176,
-      66,   824,   940,     5,  -338,  1037,   592,  -338,  -338,   134,
-    1493,   129,  -338,  1493,  -338,   138,  -338,  1493,  -338,  -338,
-    1493,   140,  -338,  -338,  -338,  -338,  1037,   122,   127,   170,
-    2164,   144,   142,  -338,  -338,  1493,  -338,  -338,   145,  -338,
-    1493,  -338,   139,   149,   239,  -338,   146,   708,  -338,  -338,
-     147,     6,  1493,   708,   122,  1493,  -338,  -338,  -338,  -338,
-     148,   127,  -338,  -338,  -338,  -338
+    2050,   -21,  -333,  -333,  -333,    21,  -333,  -333,  -333,  -333,
+    -333,  -333,  -333,  -333,  -333,  -333,  -333,  -333,  -333,  -333,
+    -333,  -333,  -333,  -333,  -333,  -333,  -333,  -333,  -333,  -333,
+    -333,  -333,  -333,  -333,  -333,  -333,  -333,    26,  -333,  -333,
+     -46,  -333,  -333,  -333,  -333,  -333,  -333,  -333,  -333,  -333,
+    -333,  -333,  -333,  -333,  -333,  -333,  -333,  -333,   -25,  -333,
+    -333,   -78,   -16,   -15,    -1,   -43,  -333,    34,     7,  1167,
+    -333,  -333,  2335,     7,  -333,    31,  -333,  1975,  -333,  -333,
+    -333,  -333,  2335,  -333,  -333,     5,  -333,    47,  -333,    54,
+    -333,    19,  -333,  -333,  -333,  -333,  -333,  2199,   114,    49,
+    -333,   -23,  -333,    58,  -333,  2125,  -333,  -333,  -333,  1528,
+    -333,  -333,    13,  -333,  2125,    33,   -12,  -333,   395,  -333,
+    -333,  -333,  -333,   104,  2199,   -26,  -333,  1237,  1528,  -333,
+     139,  2199,   113,  1720,  -333,    86,  -333,  -333,  -333,  -333,
+    -333,  1528,  1528,  1528,  -333,  -333,  -333,  -333,  -333,  -333,
+      30,  -333,  -333,  -333,    88,    -5,  1623,    91,  -333,  1528,
+      38,    45,     1,   -69,    75,    70,    72,    74,   109,   108,
+     -70,  -333,    95,  -333,  -333,  2125,  1805,    92,  -333,    47,
+      93,    94,  -333,   102,   105,   107,  1335,   118,  1528,   111,
+     120,   122,  -333,  -333,   117,  -333,  -333,   -13,  -333,   -78,
+      39,  -333,  -333,  -333,  -333,   511,  -333,  -333,  -333,  -333,
+    -333,  -333,   121,  -333,  -333,  1430,  1528,   119,   126,  -333,
+    -333,   113,   128,    18,  -333,   -63,  -333,  -333,  -333,    -2,
+    -333,  -333,  1528,  2267,  -333,  -333,  1528,   131,  -333,  -333,
+    -333,  1528,  1528,  1528,  1528,  1528,  1528,  1528,  1528,  1528,
+    1528,  1528,  1528,  1528,  1528,  1528,  1528,  1528,  1528,  1528,
+    1528,  -333,  1890,  -333,  -333,  -333,  -333,  -333,  -333,   129,
+    -333,  1528,  -333,  -333,    27,  1528,   127,  -333,  -333,  -333,
+     627,  -333,  -333,  -333,  -333,  -333,  -333,  -333,  -333,  -333,
+    -333,  -333,  1528,  1528,  -333,  -333,  -333,  1528,   125,   134,
+    -333,  1528,   132,    28,  1528,   113,  -333,   -62,  -333,  -333,
+     135,   136,  -333,   142,  -333,  -333,  -333,  -333,  -333,    38,
+      38,    45,    45,     1,     1,     1,     1,   -69,   -69,    75,
+      70,    72,    74,   109,   108,    62,  -333,   192,    54,   859,
+     975,     6,  -333,    15,  -333,  1072,   627,  -333,  -333,   143,
+    1528,   138,  -333,  1528,  -333,   149,  -333,  1528,  -333,  -333,
+    1528,   145,  -333,  -333,  -333,  -333,  1072,   129,  -333,   136,
+     181,  2199,   153,   150,  -333,  -333,  1528,  -333,  -333,   154,
+    -333,  1528,  -333,   146,   160,   249,  -333,   159,   155,   743,
+    -333,  -333,   156,    17,  1528,   743,   129,  -333,  1528,  -333,
+    -333,  -333,  -333,   157,   136,  -333,  -333,  -333,  -333
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -338,  -338,  -338,  -338,  -338,  -338,  -338,    30,  -338,  -338,
-    -338,  -338,    37,  -338,   -77,   -76,  -205,   -75,    15,    13,
-      18,    19,    40,    41,  -338,   -97,  -125,  -338,  -134,  -119,
-    -338,    10,    11,  -338,  -338,  -338,   143,   174,   168,   172,
-    -338,  -338,  -314,  -338,  -338,  -101,    28,   -68,   263,  -338,
-    -338,   115,   -49,     0,  -338,  -338,  -338,   -99,  -128,    54,
-       1,  -204,   -33,  -196,  -317,  -338,  -338,  -338,   -86,  -337,
-    -338,  -338,   -87,    29,   -30,  -338,  -338,   -56,  -338,  -338,
-    -338,  -338,  -338,  -338,  -338,  -338,  -338,   226,  -338,  -338
+    -333,  -333,  -333,  -333,  -333,  -333,  -333,    36,  -333,  -333,
+    -333,  -333,    40,  -333,   -66,   -61,   -98,   -65,    22,    20,
+      16,    43,    44,    14,  -333,   -94,  -124,  -333,  -141,  -113,
+    -333,     9,    11,  -333,  -333,  -333,   177,   186,   180,   182,
+    -333,  -333,  -324,  -333,  -333,  -102,   -30,   -68,   274,  -333,
+    -333,   130,   -48,     0,  -333,  -333,  -333,   -97,  -127,    83,
+       2,  -206,   -35,  -198,  -319,   -79,  -333,  -333,   -85,  -332,
+    -333,  -333,   -84,    32,   -29,  -333,  -333,  -333,  -333,  -333,
+     -53,  -333,  -333,  -333,  -333,  -333,  -333,  -333,  -333,  -333,
+     237,  -333,  -333
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
    number is the opposite.  If zero, do what YYDEFACT says.
    If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -227
+#define YYTABLE_NINF -229
 static const yytype_int16 yytable[] =
 {
-      75,   106,   119,   214,   131,   221,   288,   292,   213,   224,
-      60,    61,   171,   131,   353,   176,   299,    80,   254,    85,
-     374,   359,   178,   107,    87,   126,    92,   127,   179,   123,
-     171,   233,   131,   112,   128,   347,     7,   132,   315,   316,
-     317,   318,   359,   348,   243,   244,   132,   393,   221,    81,
-      88,    86,   269,   255,   300,   210,   123,    93,    94,    95,
-     386,    99,   211,   216,   100,   132,   386,    27,    28,    75,
-      29,    92,    75,    90,   131,   131,   257,    75,    37,   245,
-     246,   239,    75,   240,   230,    91,   214,    60,    61,   342,
-     231,   291,   301,   303,   225,   226,   102,    75,   285,    83,
-      84,   108,    93,    94,    95,    75,   307,   132,   132,   285,
-     357,   390,   286,   171,    75,   227,   285,   285,   197,   228,
-     101,   327,   -94,   297,    75,   285,   298,   297,   334,   221,
-     344,    75,   333,    75,   241,   242,   364,   247,   248,   366,
-     288,     2,     3,     4,   259,   260,   158,    93,    94,    95,
-     236,   237,   238,   -26,   115,   109,   131,   285,   350,   337,
-     338,   379,   311,   312,   158,   313,   314,   109,   214,   125,
-     339,   113,   319,   320,   118,    75,    75,   345,   222,   223,
-     129,   394,   174,   177,   207,    80,   -27,   217,   229,   132,
-     234,   252,   171,   249,   250,   251,   235,   253,   256,   171,
-     265,   358,   197,   262,   273,   274,   275,   276,   277,   278,
-     279,   280,   281,   282,   293,   214,   263,   266,   214,   267,
-     270,   271,   358,   283,   289,   369,   294,   296,   368,  -155,
-    -226,   341,   351,   340,   360,   349,   381,   -28,   285,   343,
-     214,   363,   365,   352,   370,   367,   376,   158,   391,   377,
-     171,   378,   380,   382,   383,   360,   384,    75,   306,   385,
-     214,   389,   395,   322,   321,   120,   124,   208,    82,   323,
-     295,   324,   197,   308,   309,   310,   158,   158,   158,   158,
+      75,   106,   229,   131,   219,   119,   226,   296,    92,    60,
+     300,    61,   131,   307,   218,   171,     7,   176,   248,   249,
+     363,   370,   259,    80,   107,     2,     3,     4,    92,   123,
+      85,   131,   238,   171,   112,   385,    88,   132,   102,    93,
+      94,    95,   370,   108,   357,   274,   132,    27,    28,   226,
+      29,   308,   358,   250,   251,    81,   123,   260,    37,    93,
+      94,    95,    86,   221,   406,   132,    83,    84,    99,    75,
+     399,   100,    75,   131,   131,   276,   399,    75,   262,    87,
+     215,   126,    75,   127,   246,   247,    60,   216,    61,    90,
+     128,   311,   219,   178,   171,   352,    91,    75,   293,   179,
+     235,   294,   299,   309,   -94,    75,   236,   132,   132,   293,
+     101,   367,   315,   113,    75,   230,   231,   293,   200,   335,
+     368,   171,   403,   115,    75,   125,   293,   174,   293,   305,
+     341,    75,   306,    75,   343,   226,   232,   109,   293,   305,
+     233,   342,   354,   -26,   375,   109,   177,   377,   296,   158,
+     323,   324,   325,   326,    93,    94,    95,   241,   242,   243,
+     131,   244,   118,   245,   252,   253,   129,   158,   347,   348,
+     391,   264,   265,   293,   360,    75,    75,   219,   319,   320,
+     212,   227,   228,    80,   349,   321,   322,   327,   328,   222,
+     -27,   355,   407,   234,   132,   239,   254,   255,   256,   240,
+     257,   258,   261,   171,   369,   200,   270,   267,   268,   271,
+     171,   281,   282,   283,   284,   285,   286,   287,   288,   289,
+     290,   272,   275,   277,   278,   369,   219,   297,   158,   219,
+     291,   279,   301,   302,   304,  -155,   380,  -228,   350,   344,
+     393,   351,   359,   371,   379,   353,   -28,   293,   361,   381,
+     374,   376,   219,   404,   362,   158,   378,   388,   389,   390,
+     394,   392,    75,   171,   371,   395,   396,   191,   398,   314,
+     402,   408,   331,   334,   219,   330,   329,   120,   124,    82,
+     200,   316,   317,   318,   158,   158,   158,   158,   158,   158,
      158,   158,   158,   158,   158,   158,   158,   158,   158,   158,
-     158,   158,   106,   325,   261,   326,   209,   392,   346,   354,
-     371,   336,   355,   111,     0,     0,     0,     0,     0,     0,
+     332,   213,   333,   106,   303,   364,   214,   356,   397,   266,
+     405,   365,   346,   382,   111,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,   158,     0,     0,     0,
-       0,   197,   197,   158,     0,   197,   197,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   158,     0,   200,
+     200,     0,     0,     0,   158,   200,   200,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,   197,     0,     0,     0,
-      75,     0,     0,     1,     2,     3,     4,     5,     6,     7,
-       8,     9,    10,    11,   180,   181,   182,   197,   183,   184,
-     185,   186,     0,   197,   158,    12,    13,    14,    15,    16,
-      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
-      27,    28,     0,    29,    30,    31,    32,    33,    34,    35,
-      36,    37,    38,    39,    40,    41,   187,    42,    43,    44,
-       0,    45,    46,    47,    48,    49,    50,    51,    52,    53,
-      54,     0,    55,    56,    57,    58,   135,    59,   136,   137,
-     138,   139,   140,     0,     0,   141,   142,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,   200,     0,     0,     0,
+       0,    75,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   200,
+       0,     0,     0,     0,     0,   200,     0,   158,     1,     2,
+       3,     4,     5,     6,     7,     8,     9,    10,    11,   180,
+     181,   182,     0,   183,   184,   185,   186,   187,   188,   189,
+      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
+      22,    23,    24,    25,    26,    27,    28,     0,    29,    30,
+      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
+      41,   190,    42,    43,    44,     0,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,     0,    55,    56,    57,
+      58,   135,    59,   136,   137,   138,   139,   140,     0,     0,
+     141,   142,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   143,
+       0,     0,     0,   191,   192,     0,     0,     0,     0,   193,
+     144,   145,   146,   147,     1,     2,     3,     4,     5,     6,
+       7,     8,     9,    10,    11,   180,   181,   182,     0,   183,
+     184,   185,   186,   187,   188,   189,    12,    13,    14,    15,
+      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+      26,    27,    28,     0,    29,    30,    31,    32,    33,    34,
+      35,    36,    37,    38,    39,    40,    41,   190,    42,    43,
+      44,     0,    45,    46,    47,    48,    49,    50,    51,    52,
+      53,    54,     0,    55,    56,    57,    58,   135,    59,   136,
+     137,   138,   139,   140,     0,     0,   141,   142,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,   143,     0,     0,     0,   188,   189,
-       0,     0,     0,     0,   190,   144,   145,   146,   147,     1,
-       2,     3,     4,     5,     6,     7,     8,     9,    10,    11,
-     180,   181,   182,     0,   183,   184,   185,   186,     0,     0,
-       0,    12,    13,    14,    15,    16,    17,    18,    19,    20,
-      21,    22,    23,    24,    25,    26,    27,    28,     0,    29,
-      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
-      40,    41,   187,    42,    43,    44,     0,    45,    46,    47,
-      48,    49,    50,    51,    52,    53,    54,     0,    55,    56,
-      57,    58,   135,    59,   136,   137,   138,   139,   140,     0,
-       0,   141,   142,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   143,     0,     0,     0,   191,
+     295,     0,     0,     0,     0,   193,   144,   145,   146,   147,
+       1,     2,     3,     4,     5,     6,     7,     8,     9,    10,
+      11,   180,   181,   182,     0,   183,   184,   185,   186,   187,
+     188,   189,    12,    13,    14,    15,    16,    17,    18,    19,
+      20,    21,    22,    23,    24,    25,    26,    27,    28,     0,
+      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
+      39,    40,    41,   190,    42,    43,    44,     0,    45,    46,
+      47,    48,    49,    50,    51,    52,    53,    54,     0,    55,
+      56,    57,    58,   135,    59,   136,   137,   138,   139,   140,
+       0,     0,   141,   142,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     143,     0,     0,     0,   188,   287,     0,     0,     0,     0,
-     190,   144,   145,   146,   147,     1,     2,     3,     4,     5,
-       6,     7,     8,     9,    10,    11,   180,   181,   182,     0,
-     183,   184,   185,   186,     0,     0,     0,    12,    13,    14,
+       0,   143,     0,     0,     0,   191,     0,     0,     0,     0,
+       0,   193,   144,   145,   146,   147,     1,     2,     3,     4,
+       5,     6,     7,     8,     9,    10,    11,   180,   181,   182,
+       0,   183,   184,   185,   186,   187,   188,   189,    12,    13,
+      14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
+      24,    25,    26,    27,    28,     0,    29,    30,    31,    32,
+      33,    34,    35,    36,    37,    38,    39,    40,    41,   190,
+      42,    43,    44,     0,    45,    46,    47,    48,    49,    50,
+      51,    52,    53,    54,     0,    55,    56,    57,    58,   135,
+      59,   136,   137,   138,   139,   140,     0,     0,   141,   142,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   143,     0,     0,
+       0,   118,     0,     0,     0,     0,     0,   193,   144,   145,
+     146,   147,     1,     2,     3,     4,     5,     6,     7,     8,
+       9,    10,    11,   180,   181,   182,     0,   183,   184,   185,
+     186,   187,   188,   189,    12,    13,    14,    15,    16,    17,
+      18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
+      28,     0,    29,    30,    31,    32,    33,    34,    35,    36,
+      37,    38,    39,    40,    41,   190,    42,    43,    44,     0,
+      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
+       0,    55,    56,    57,    58,   135,    59,   136,   137,   138,
+     139,   140,     0,     0,   141,   142,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,   143,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,   193,   144,   145,   146,   147,     1,     2,
+       3,     4,     5,     6,     7,     8,     9,    10,    11,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
+      22,    23,    24,    25,    26,    27,    28,     0,    29,    30,
+      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
+      41,     0,    42,    43,    44,     0,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,     0,    55,    56,    57,
+      58,   135,    59,   136,   137,   138,   139,   140,     0,     0,
+     141,   142,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   130,     2,     3,     4,   143,
+       6,     7,     8,     9,    10,    11,     0,     0,     0,   193,
+     144,   145,   146,   147,     0,     0,     0,    12,    13,    14,
       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
       25,    26,    27,    28,     0,    29,    30,    31,    32,    33,
-      34,    35,    36,    37,    38,    39,    40,    41,   187,    42,
+      34,    35,    36,    37,    38,    39,    40,    41,     0,    42,
       43,    44,     0,    45,    46,    47,    48,    49,    50,    51,
       52,    53,    54,     0,    55,    56,    57,    58,   135,    59,
      136,   137,   138,   139,   140,     0,     0,   141,   142,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,   143,     0,     0,     0,
-     188,     0,     0,     0,     0,     0,   190,   144,   145,   146,
-     147,     1,     2,     3,     4,     5,     6,     7,     8,     9,
-      10,    11,   180,   181,   182,     0,   183,   184,   185,   186,
-       0,     0,     0,    12,    13,    14,    15,    16,    17,    18,
-      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
-       0,    29,    30,    31,    32,    33,    34,    35,    36,    37,
-      38,    39,    40,    41,   187,    42,    43,    44,     0,    45,
-      46,    47,    48,    49,    50,    51,    52,    53,    54,     0,
-      55,    56,    57,    58,   135,    59,   136,   137,   138,   139,
-     140,     0,     0,   141,   142,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,   143,     0,     0,     0,   118,     0,     0,     0,
-       0,     0,   190,   144,   145,   146,   147,     1,     2,     3,
-       4,     5,     6,     7,     8,     9,    10,    11,   180,   181,
-     182,     0,   183,   184,   185,   186,     0,     0,     0,    12,
-      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
-      23,    24,    25,    26,    27,    28,     0,    29,    30,    31,
-      32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
-     187,    42,    43,    44,     0,    45,    46,    47,    48,    49,
-      50,    51,    52,    53,    54,     0,    55,    56,    57,    58,
-     135,    59,   136,   137,   138,   139,   140,     0,     0,   141,
-     142,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,   143,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,   190,   144,
-     145,   146,   147,     1,     2,     3,     4,     5,     6,     7,
-       8,     9,    10,    11,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,    12,    13,    14,    15,    16,
-      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
-      27,    28,     0,    29,    30,    31,    32,    33,    34,    35,
-      36,    37,    38,    39,    40,    41,     0,    42,    43,    44,
-       0,    45,    46,    47,    48,    49,    50,    51,    52,    53,
-      54,     0,    55,    56,    57,    58,   135,    59,   136,   137,
-     138,   139,   140,     0,     0,   141,   142,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     130,     2,     3,     4,   143,     6,     7,     8,     9,    10,
-      11,     0,     0,     0,   190,   144,   145,   146,   147,     0,
+       0,     2,     3,     4,     0,     0,   143,     8,     9,    10,
+      11,     0,     0,     0,     0,     0,     0,   144,   145,   146,
+     147,     0,    12,    13,    14,    15,    16,    17,    18,    19,
+      20,    21,    22,    23,    24,    25,    26,     0,     0,     0,
+       0,     0,    31,    32,    33,    34,    35,    36,     0,     0,
+       0,    40,    41,     0,    42,    43,    44,     0,    45,    46,
+      47,    48,    49,    50,    51,    52,    53,    54,     0,    55,
+      56,    57,     0,   103,    59,     0,     0,     8,     9,    10,
+      11,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,    12,    13,    14,    15,    16,    17,    18,    19,
-      20,    21,    22,    23,    24,    25,    26,    27,    28,     0,
-      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
-      39,    40,    41,     0,    42,    43,    44,     0,    45,    46,
+      20,    21,    22,    23,    24,    25,    26,     0,     0,     0,
+       0,   104,    31,    32,    33,    34,    35,    36,     0,     0,
+       0,    40,    41,     0,    42,    43,    44,     0,    45,    46,
       47,    48,    49,    50,    51,    52,    53,    54,     0,    55,
-      56,    57,    58,   135,    59,   136,   137,   138,   139,   140,
+      56,    57,     0,   135,    59,   136,   137,   138,   139,   140,
        0,     0,   141,   142,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     2,     3,     4,     0,
-       0,   143,     8,     9,    10,    11,     0,     0,     0,     0,
-       0,     0,   144,   145,   146,   147,     0,    12,    13,    14,
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-      25,    26,     0,     0,     0,     0,     0,    31,    32,    33,
-      34,    35,    36,     0,     0,     0,    40,    41,     0,    42,
-      43,    44,     0,    45,    46,    47,    48,    49,    50,    51,
-      52,    53,    54,     0,    55,    56,    57,     0,   103,    59,
-       0,     0,     8,     9,    10,    11,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    12,    13,    14,
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-      25,    26,     0,     0,     0,     0,   104,    31,    32,    33,
-      34,    35,    36,     0,     0,     0,    40,    41,     0,    42,
-      43,    44,     0,    45,    46,    47,    48,    49,    50,    51,
-      52,    53,    54,     0,    55,    56,    57,     0,   135,    59,
-     136,   137,   138,   139,   140,     0,     0,   141,   142,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,   143,     0,     0,   212,
-       8,     9,    10,    11,     0,     0,     0,   144,   145,   146,
-     147,     0,     0,     0,     0,    12,    13,    14,    15,    16,
-      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
-       0,     0,     0,     0,     0,    31,    32,    33,    34,    35,
-      36,     0,     0,     0,    40,    41,     0,    42,    43,    44,
-       0,    45,    46,    47,    48,    49,    50,    51,    52,    53,
-      54,     0,    55,    56,    57,     0,   135,    59,   136,   137,
-     138,   139,   140,     0,     0,   141,   142,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,   143,     8,     9,    10,    11,     0,
-       0,     0,     0,     0,   268,   144,   145,   146,   147,     0,
+       0,   143,     0,     0,   217,     8,     9,    10,    11,     0,
+       0,     0,   144,   145,   146,   147,     0,     0,     0,     0,
       12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
       22,    23,    24,    25,    26,     0,     0,     0,     0,     0,
       31,    32,    33,    34,    35,    36,     0,     0,     0,    40,
@@ -1193,36 +1196,37 @@ static const yytype_int16 yytable[] =
        0,   135,    59,   136,   137,   138,   139,   140,     0,     0,
      141,   142,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,   143,
-       0,     0,   290,     8,     9,    10,    11,     0,     0,     0,
-     144,   145,   146,   147,     0,     0,     0,     0,    12,    13,
-      14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
-      24,    25,    26,     0,     0,     0,     0,     0,    31,    32,
-      33,    34,    35,    36,     0,     0,     0,    40,    41,     0,
-      42,    43,    44,     0,    45,    46,    47,    48,    49,    50,
-      51,    52,    53,    54,     0,    55,    56,    57,     0,   135,
-      59,   136,   137,   138,   139,   140,     0,     0,   141,   142,
+       8,     9,    10,    11,     0,     0,     0,     0,     0,   273,
+     144,   145,   146,   147,     0,    12,    13,    14,    15,    16,
+      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
+       0,     0,     0,     0,     0,    31,    32,    33,    34,    35,
+      36,     0,     0,     0,    40,    41,     0,    42,    43,    44,
+       0,    45,    46,    47,    48,    49,    50,    51,    52,    53,
+      54,     0,    55,    56,    57,     0,   135,    59,   136,   137,
+     138,   139,   140,     0,     0,   141,   142,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,   143,     8,     9,
-      10,    11,     0,     0,     0,     0,     0,     0,   144,   145,
-     146,   147,     0,    12,    13,    14,    15,    16,    17,    18,
+       0,     0,     0,     0,   143,     0,     0,   298,     8,     9,
+      10,    11,     0,     0,     0,   144,   145,   146,   147,     0,
+       0,     0,     0,    12,    13,    14,    15,    16,    17,    18,
       19,    20,    21,    22,    23,    24,    25,    26,     0,     0,
        0,     0,     0,    31,    32,    33,    34,    35,    36,     0,
-       0,     0,    40,   232,     0,    42,    43,    44,     0,    45,
+       0,     0,    40,    41,     0,    42,    43,    44,     0,    45,
       46,    47,    48,    49,    50,    51,    52,    53,    54,     0,
       55,    56,    57,     0,   135,    59,   136,   137,   138,   139,
      140,     0,     0,   141,   142,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,   130,     2,
-       3,     4,   143,     6,     7,     8,     9,    10,    11,     0,
-       0,     0,     0,   144,   145,   146,   147,     0,     0,     0,
-      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
-      22,    23,    24,    25,    26,    27,    28,     0,    29,    30,
-      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
-      41,     0,    42,    43,    44,     0,    45,    46,    47,    48,
-      49,    50,    51,    52,    53,    54,     0,    55,    56,    57,
-      58,     0,    59,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,   130,     2,     3,     4,     0,     6,     7,
-       8,     9,    10,    11,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,   220,    12,    13,    14,    15,    16,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,   143,     8,     9,    10,    11,     0,     0,     0,
+       0,     0,     0,   144,   145,   146,   147,     0,    12,    13,
+      14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
+      24,    25,    26,     0,     0,     0,     0,     0,    31,    32,
+      33,    34,    35,    36,     0,     0,     0,    40,   237,     0,
+      42,    43,    44,     0,    45,    46,    47,    48,    49,    50,
+      51,    52,    53,    54,     0,    55,    56,    57,     0,   135,
+      59,   136,   137,   138,   139,   140,     0,     0,   141,   142,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,   130,     2,     3,     4,   143,     6,     7,
+       8,     9,    10,    11,     0,     0,     0,     0,   144,   145,
+     146,   147,     0,     0,     0,    12,    13,    14,    15,    16,
       17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
       27,    28,     0,    29,    30,    31,    32,    33,    34,    35,
       36,    37,    38,    39,    40,    41,     0,    42,    43,    44,
@@ -1230,203 +1234,206 @@ static const yytype_int16 yytable[] =
       54,     0,    55,    56,    57,    58,     0,    59,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,   130,     2,
        3,     4,     0,     6,     7,     8,     9,    10,    11,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,   258,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   225,
       12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
       22,    23,    24,    25,    26,    27,    28,     0,    29,    30,
       31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
       41,     0,    42,    43,    44,     0,    45,    46,    47,    48,
       49,    50,    51,    52,    53,    54,     0,    55,    56,    57,
       58,     0,    59,     0,     0,     0,     0,     0,     0,     0,
-     110,     0,     0,     1,     2,     3,     4,     5,     6,     7,
+       0,     0,     0,   130,     2,     3,     4,     0,     6,     7,
        8,     9,    10,    11,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,   328,    12,    13,    14,    15,    16,
+       0,     0,     0,     0,   263,    12,    13,    14,    15,    16,
       17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
       27,    28,     0,    29,    30,    31,    32,    33,    34,    35,
       36,    37,    38,    39,    40,    41,     0,    42,    43,    44,
        0,    45,    46,    47,    48,    49,    50,    51,    52,    53,
-      54,     0,    55,    56,    57,    58,     0,    59,     1,     2,
+      54,     0,    55,    56,    57,    58,     0,    59,     0,     0,
+       0,     0,     0,     0,     0,   110,     0,     0,     1,     2,
        3,     4,     5,     6,     7,     8,     9,    10,    11,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   336,
       12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
       22,    23,    24,    25,    26,    27,    28,     0,    29,    30,
       31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
       41,     0,    42,    43,    44,     0,    45,    46,    47,    48,
       49,    50,    51,    52,    53,    54,     0,    55,    56,    57,
-      58,     0,    59,   130,     2,     3,     4,     0,     6,     7,
+      58,     0,    59,     1,     2,     3,     4,     5,     6,     7,
        8,     9,    10,    11,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,    12,    13,    14,    15,    16,
       17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
       27,    28,     0,    29,    30,    31,    32,    33,    34,    35,
       36,    37,    38,    39,    40,    41,     0,    42,    43,    44,
        0,    45,    46,    47,    48,    49,    50,    51,    52,    53,
-      54,     0,    55,    56,    57,    58,     0,    59,     2,     3,
-       4,     0,     0,     0,     8,     9,    10,    11,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,    12,
-      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
-      23,    24,    25,    26,     0,     0,     0,     0,     0,    31,
-      32,    33,    34,    35,    36,     0,     0,     0,    40,    41,
-       0,    42,    43,    44,     0,    45,    46,    47,    48,    49,
-      50,    51,    52,    53,    54,     0,    55,    56,    57,     0,
-       0,    59,     8,     9,    10,    11,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    12,    13,    14,
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-      25,    26,     0,     0,     0,     0,     0,    31,    32,    33,
-      34,    35,    36,     0,     0,     0,    40,    41,     0,    42,
-      43,    44,     0,    45,    46,    47,    48,    49,    50,    51,
-      52,    53,    54,     0,    55,    56,    57,     0,   304,    59,
-       8,     9,    10,    11,   305,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,    12,    13,    14,    15,    16,
-      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
-       0,     0,     0,     0,     0,    31,    32,    33,    34,    35,
-      36,     0,     0,     0,    40,    41,     0,    42,    43,    44,
-       0,    45,    46,    47,    48,    49,    50,    51,    52,    53,
-      54,     0,    55,    56,    57,     0,     0,    59
+      54,     0,    55,    56,    57,    58,     0,    59,   130,     2,
+       3,     4,     0,     6,     7,     8,     9,    10,    11,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
+      22,    23,    24,    25,    26,    27,    28,     0,    29,    30,
+      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
+      41,     0,    42,    43,    44,     0,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,     0,    55,    56,    57,
+      58,     0,    59,     2,     3,     4,     0,     0,     0,     8,
+       9,    10,    11,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,    12,    13,    14,    15,    16,    17,
+      18,    19,    20,    21,    22,    23,    24,    25,    26,     0,
+       0,     0,     0,     0,    31,    32,    33,    34,    35,    36,
+       0,     0,     0,    40,    41,     0,    42,    43,    44,     0,
+      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
+       0,    55,    56,    57,     0,     0,    59,     8,     9,    10,
+      11,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,    12,    13,    14,    15,    16,    17,    18,    19,
+      20,    21,    22,    23,    24,    25,    26,     0,     0,     0,
+       0,     0,    31,    32,    33,    34,    35,    36,     0,     0,
+       0,    40,    41,     0,    42,    43,    44,     0,    45,    46,
+      47,    48,    49,    50,    51,    52,    53,    54,     0,    55,
+      56,    57,     0,   312,    59,     8,     9,    10,    11,   313,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
+      22,    23,    24,    25,    26,     0,     0,     0,     0,     0,
+      31,    32,    33,    34,    35,    36,     0,     0,     0,    40,
+      41,     0,    42,    43,    44,     0,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,     0,    55,    56,    57,
+       0,     0,    59
 };
 
 static const yytype_int16 yycheck[] =
 {
-       0,    69,    89,   128,   105,   133,   202,   211,   127,   143,
-       0,     0,   109,   114,   331,   114,    76,    44,    92,    76,
-     357,   335,   105,    72,   104,   104,     9,   106,   111,    97,
-     127,   156,   133,    82,   113,   106,     9,   105,   243,   244,
-     245,   246,   356,   114,    87,    88,   114,   384,   176,    76,
-     114,   108,   186,   127,   114,   106,   124,    40,    41,    42,
-     377,   111,   113,   131,   114,   133,   383,    40,    41,    69,
-      43,     9,    72,   105,   175,   176,   175,    77,    51,   122,
-     123,   116,    82,   118,   105,   111,   211,    77,    77,   293,
-     111,   210,   105,   227,    85,    86,    68,    97,   111,    40,
-      41,    73,    40,    41,    42,   105,   231,   175,   176,   111,
-     105,   105,   114,   210,   114,   106,   111,   111,   118,   110,
-      76,   255,   105,   111,   124,   111,   114,   111,   114,   257,
-     114,   131,   266,   133,    83,    84,   340,    89,    90,   343,
-     336,     4,     5,     6,    79,    80,   109,    40,    41,    42,
-     119,   120,   121,   104,    76,   106,   257,   111,   112,   284,
-     285,   365,   239,   240,   127,   241,   242,   106,   293,    76,
-     289,   108,   247,   248,   108,   175,   176,   296,   141,   142,
-     108,   385,   114,   113,    76,    44,   104,    76,   105,   257,
-     104,    91,   289,   126,   125,   124,   159,    93,   107,   296,
-     104,   335,   202,   114,    94,    95,    96,    97,    98,    99,
-     100,   101,   102,   103,   113,   340,   114,   104,   343,   114,
-     104,   109,   356,   113,   106,   350,   107,   106,   347,   104,
-     108,   107,    56,   113,   335,   107,   370,   104,   111,   113,
-     365,   107,   113,   330,   104,   107,    76,   210,   382,   105,
-     347,   109,   107,   114,   105,   356,    17,   257,   228,   113,
-     385,   114,   114,   250,   249,    91,    98,   124,     5,   251,
-     216,   252,   272,   236,   237,   238,   239,   240,   241,   242,
-     243,   244,   245,   246,   247,   248,   249,   250,   251,   252,
-     253,   254,   360,   253,   179,   254,   124,   383,   297,   332,
-     356,   272,   332,    77,    -1,    -1,    -1,    -1,    -1,    -1,
+       0,    69,   143,   105,   128,    89,   133,   205,     9,     0,
+     216,     0,   114,    76,   127,   109,     9,   114,    87,    88,
+     339,   345,    92,    44,    72,     4,     5,     6,     9,    97,
+      76,   133,   156,   127,    82,   367,   114,   105,    68,    40,
+      41,    42,   366,    73,   106,   186,   114,    40,    41,   176,
+      43,   114,   114,   122,   123,    76,   124,   127,    51,    40,
+      41,    42,   108,   131,   396,   133,    40,    41,   111,    69,
+     389,   114,    72,   175,   176,   188,   395,    77,   175,   104,
+     106,   104,    82,   106,    83,    84,    77,   113,    77,   105,
+     113,   232,   216,   105,   188,   301,   111,    97,   111,   111,
+     105,   114,   215,   105,   105,   105,   111,   175,   176,   111,
+      76,   105,   236,   108,   114,    85,    86,   111,   118,   260,
+     105,   215,   105,    76,   124,    76,   111,   114,   111,   111,
+     271,   131,   114,   133,   275,   262,   106,   106,   111,   111,
+     110,   114,   114,   104,   350,   106,   113,   353,   346,   109,
+     248,   249,   250,   251,    40,    41,    42,   119,   120,   121,
+     262,   116,   108,   118,    89,    90,   108,   127,   292,   293,
+     376,    79,    80,   111,   112,   175,   176,   301,   244,   245,
+      76,   141,   142,    44,   297,   246,   247,   252,   253,    76,
+     104,   304,   398,   105,   262,   104,   126,   125,   124,   159,
+      91,    93,   107,   297,   345,   205,   104,   114,   114,   104,
+     304,    94,    95,    96,    97,    98,    99,   100,   101,   102,
+     103,   114,   104,   112,   104,   366,   350,   106,   188,   353,
+     113,   109,   113,   107,   106,   104,   360,   108,   113,   112,
+     381,   107,   107,   345,   357,   113,   104,   111,    56,   104,
+     107,   113,   376,   394,   338,   215,   107,    76,   105,   109,
+     114,   107,   262,   357,   366,   105,    17,   108,   113,   233,
+     114,   114,   256,   259,   398,   255,   254,    91,    98,     5,
+     280,   241,   242,   243,   244,   245,   246,   247,   248,   249,
+     250,   251,   252,   253,   254,   255,   256,   257,   258,   259,
+     257,   124,   258,   371,   221,   340,   124,   305,   387,   179,
+     395,   340,   280,   366,    77,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,   289,    -1,    -1,    -1,
-      -1,   331,   332,   296,    -1,   335,   336,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   297,    -1,   339,
+     340,    -1,    -1,    -1,   304,   345,   346,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,   356,    -1,    -1,    -1,
-     360,    -1,    -1,     3,     4,     5,     6,     7,     8,     9,
-      10,    11,    12,    13,    14,    15,    16,   377,    18,    19,
-      20,    21,    -1,   383,   347,    25,    26,    27,    28,    29,
-      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
-      40,    41,    -1,    43,    44,    45,    46,    47,    48,    49,
-      50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
-      -1,    61,    62,    63,    64,    65,    66,    67,    68,    69,
-      70,    -1,    72,    73,    74,    75,    76,    77,    78,    79,
-      80,    81,    82,    -1,    -1,    85,    86,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,   366,    -1,    -1,    -1,
+      -1,   371,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   389,
+      -1,    -1,    -1,    -1,    -1,   395,    -1,   357,     3,     4,
+       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
+      15,    16,    -1,    18,    19,    20,    21,    22,    23,    24,
+      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
+      35,    36,    37,    38,    39,    40,    41,    -1,    43,    44,
+      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
+      55,    56,    57,    58,    59,    -1,    61,    62,    63,    64,
+      65,    66,    67,    68,    69,    70,    -1,    72,    73,    74,
+      75,    76,    77,    78,    79,    80,    81,    82,    -1,    -1,
+      85,    86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,
+      -1,    -1,    -1,   108,   109,    -1,    -1,    -1,    -1,   114,
+     115,   116,   117,   118,     3,     4,     5,     6,     7,     8,
+       9,    10,    11,    12,    13,    14,    15,    16,    -1,    18,
+      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
+      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
+      39,    40,    41,    -1,    43,    44,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
+      59,    -1,    61,    62,    63,    64,    65,    66,    67,    68,
+      69,    70,    -1,    72,    73,    74,    75,    76,    77,    78,
+      79,    80,    81,    82,    -1,    -1,    85,    86,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,   104,    -1,    -1,    -1,   108,   109,
-      -1,    -1,    -1,    -1,   114,   115,   116,   117,   118,     3,
-       4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
-      14,    15,    16,    -1,    18,    19,    20,    21,    -1,    -1,
-      -1,    25,    26,    27,    28,    29,    30,    31,    32,    33,
-      34,    35,    36,    37,    38,    39,    40,    41,    -1,    43,
-      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
-      54,    55,    56,    57,    58,    59,    -1,    61,    62,    63,
-      64,    65,    66,    67,    68,    69,    70,    -1,    72,    73,
-      74,    75,    76,    77,    78,    79,    80,    81,    82,    -1,
-      -1,    85,    86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   104,    -1,    -1,    -1,   108,
+     109,    -1,    -1,    -1,    -1,   114,   115,   116,   117,   118,
+       3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
+      13,    14,    15,    16,    -1,    18,    19,    20,    21,    22,
+      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
+      33,    34,    35,    36,    37,    38,    39,    40,    41,    -1,
+      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
+      53,    54,    55,    56,    57,    58,    59,    -1,    61,    62,
+      63,    64,    65,    66,    67,    68,    69,    70,    -1,    72,
+      73,    74,    75,    76,    77,    78,    79,    80,    81,    82,
+      -1,    -1,    85,    86,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,   104,    -1,    -1,    -1,   108,    -1,    -1,    -1,    -1,
+      -1,   114,   115,   116,   117,   118,     3,     4,     5,     6,
+       7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
+      -1,    18,    19,    20,    21,    22,    23,    24,    25,    26,
+      27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
+      37,    38,    39,    40,    41,    -1,    43,    44,    45,    46,
+      47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
+      57,    58,    59,    -1,    61,    62,    63,    64,    65,    66,
+      67,    68,    69,    70,    -1,    72,    73,    74,    75,    76,
+      77,    78,    79,    80,    81,    82,    -1,    -1,    85,    86,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-     104,    -1,    -1,    -1,   108,   109,    -1,    -1,    -1,    -1,
-     114,   115,   116,   117,   118,     3,     4,     5,     6,     7,
-       8,     9,    10,    11,    12,    13,    14,    15,    16,    -1,
-      18,    19,    20,    21,    -1,    -1,    -1,    25,    26,    27,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,    -1,    -1,
+      -1,   108,    -1,    -1,    -1,    -1,    -1,   114,   115,   116,
+     117,   118,     3,     4,     5,     6,     7,     8,     9,    10,
+      11,    12,    13,    14,    15,    16,    -1,    18,    19,    20,
+      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
+      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
+      41,    -1,    43,    44,    45,    46,    47,    48,    49,    50,
+      51,    52,    53,    54,    55,    56,    57,    58,    59,    -1,
+      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
+      -1,    72,    73,    74,    75,    76,    77,    78,    79,    80,
+      81,    82,    -1,    -1,    85,    86,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,   104,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,   114,   115,   116,   117,   118,     3,     4,
+       5,     6,     7,     8,     9,    10,    11,    12,    13,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
+      35,    36,    37,    38,    39,    40,    41,    -1,    43,    44,
+      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
+      55,    -1,    57,    58,    59,    -1,    61,    62,    63,    64,
+      65,    66,    67,    68,    69,    70,    -1,    72,    73,    74,
+      75,    76,    77,    78,    79,    80,    81,    82,    -1,    -1,
+      85,    86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,     3,     4,     5,     6,   104,
+       8,     9,    10,    11,    12,    13,    -1,    -1,    -1,   114,
+     115,   116,   117,   118,    -1,    -1,    -1,    25,    26,    27,
       28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
       38,    39,    40,    41,    -1,    43,    44,    45,    46,    47,
-      48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
+      48,    49,    50,    51,    52,    53,    54,    55,    -1,    57,
       58,    59,    -1,    61,    62,    63,    64,    65,    66,    67,
       68,    69,    70,    -1,    72,    73,    74,    75,    76,    77,
       78,    79,    80,    81,    82,    -1,    -1,    85,    86,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,   104,    -1,    -1,    -1,
-     108,    -1,    -1,    -1,    -1,    -1,   114,   115,   116,   117,
-     118,     3,     4,     5,     6,     7,     8,     9,    10,    11,
-      12,    13,    14,    15,    16,    -1,    18,    19,    20,    21,
-      -1,    -1,    -1,    25,    26,    27,    28,    29,    30,    31,
-      32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
-      -1,    43,    44,    45,    46,    47,    48,    49,    50,    51,
-      52,    53,    54,    55,    56,    57,    58,    59,    -1,    61,
-      62,    63,    64,    65,    66,    67,    68,    69,    70,    -1,
-      72,    73,    74,    75,    76,    77,    78,    79,    80,    81,
-      82,    -1,    -1,    85,    86,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,   104,    -1,    -1,    -1,   108,    -1,    -1,    -1,
-      -1,    -1,   114,   115,   116,   117,   118,     3,     4,     5,
-       6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
-      16,    -1,    18,    19,    20,    21,    -1,    -1,    -1,    25,
-      26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
-      36,    37,    38,    39,    40,    41,    -1,    43,    44,    45,
-      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
-      56,    57,    58,    59,    -1,    61,    62,    63,    64,    65,
-      66,    67,    68,    69,    70,    -1,    72,    73,    74,    75,
-      76,    77,    78,    79,    80,    81,    82,    -1,    -1,    85,
-      86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   114,   115,
-     116,   117,   118,     3,     4,     5,     6,     7,     8,     9,
-      10,    11,    12,    13,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    25,    26,    27,    28,    29,
-      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
-      40,    41,    -1,    43,    44,    45,    46,    47,    48,    49,
-      50,    51,    52,    53,    54,    55,    -1,    57,    58,    59,
-      -1,    61,    62,    63,    64,    65,    66,    67,    68,    69,
-      70,    -1,    72,    73,    74,    75,    76,    77,    78,    79,
-      80,    81,    82,    -1,    -1,    85,    86,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       3,     4,     5,     6,   104,     8,     9,    10,    11,    12,
-      13,    -1,    -1,    -1,   114,   115,   116,   117,   118,    -1,
+      -1,     4,     5,     6,    -1,    -1,   104,    10,    11,    12,
+      13,    -1,    -1,    -1,    -1,    -1,    -1,   115,   116,   117,
+     118,    -1,    25,    26,    27,    28,    29,    30,    31,    32,
+      33,    34,    35,    36,    37,    38,    39,    -1,    -1,    -1,
+      -1,    -1,    45,    46,    47,    48,    49,    50,    -1,    -1,
+      -1,    54,    55,    -1,    57,    58,    59,    -1,    61,    62,
+      63,    64,    65,    66,    67,    68,    69,    70,    -1,    72,
+      73,    74,    -1,    76,    77,    -1,    -1,    10,    11,    12,
+      13,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    25,    26,    27,    28,    29,    30,    31,    32,
-      33,    34,    35,    36,    37,    38,    39,    40,    41,    -1,
-      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
-      53,    54,    55,    -1,    57,    58,    59,    -1,    61,    62,
+      33,    34,    35,    36,    37,    38,    39,    -1,    -1,    -1,
+      -1,   114,    45,    46,    47,    48,    49,    50,    -1,    -1,
+      -1,    54,    55,    -1,    57,    58,    59,    -1,    61,    62,
       63,    64,    65,    66,    67,    68,    69,    70,    -1,    72,
-      73,    74,    75,    76,    77,    78,    79,    80,    81,    82,
+      73,    74,    -1,    76,    77,    78,    79,    80,    81,    82,
       -1,    -1,    85,    86,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,     4,     5,     6,    -1,
-      -1,   104,    10,    11,    12,    13,    -1,    -1,    -1,    -1,
-      -1,    -1,   115,   116,   117,   118,    -1,    25,    26,    27,
-      28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
-      38,    39,    -1,    -1,    -1,    -1,    -1,    45,    46,    47,
-      48,    49,    50,    -1,    -1,    -1,    54,    55,    -1,    57,
-      58,    59,    -1,    61,    62,    63,    64,    65,    66,    67,
-      68,    69,    70,    -1,    72,    73,    74,    -1,    76,    77,
-      -1,    -1,    10,    11,    12,    13,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    25,    26,    27,
-      28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
-      38,    39,    -1,    -1,    -1,    -1,   114,    45,    46,    47,
-      48,    49,    50,    -1,    -1,    -1,    54,    55,    -1,    57,
-      58,    59,    -1,    61,    62,    63,    64,    65,    66,    67,
-      68,    69,    70,    -1,    72,    73,    74,    -1,    76,    77,
-      78,    79,    80,    81,    82,    -1,    -1,    85,    86,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,   104,    -1,    -1,   107,
-      10,    11,    12,    13,    -1,    -1,    -1,   115,   116,   117,
-     118,    -1,    -1,    -1,    -1,    25,    26,    27,    28,    29,
-      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
-      -1,    -1,    -1,    -1,    -1,    45,    46,    47,    48,    49,
-      50,    -1,    -1,    -1,    54,    55,    -1,    57,    58,    59,
-      -1,    61,    62,    63,    64,    65,    66,    67,    68,    69,
-      70,    -1,    72,    73,    74,    -1,    76,    77,    78,    79,
-      80,    81,    82,    -1,    -1,    85,    86,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,   104,    10,    11,    12,    13,    -1,
-      -1,    -1,    -1,    -1,   114,   115,   116,   117,   118,    -1,
+      -1,   104,    -1,    -1,   107,    10,    11,    12,    13,    -1,
+      -1,    -1,   115,   116,   117,   118,    -1,    -1,    -1,    -1,
       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
       35,    36,    37,    38,    39,    -1,    -1,    -1,    -1,    -1,
       45,    46,    47,    48,    49,    50,    -1,    -1,    -1,    54,
@@ -1435,27 +1442,45 @@ static const yytype_int16 yycheck[] =
       -1,    76,    77,    78,    79,    80,    81,    82,    -1,    -1,
       85,    86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,
-      -1,    -1,   107,    10,    11,    12,    13,    -1,    -1,    -1,
-     115,   116,   117,   118,    -1,    -1,    -1,    -1,    25,    26,
-      27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
-      37,    38,    39,    -1,    -1,    -1,    -1,    -1,    45,    46,
-      47,    48,    49,    50,    -1,    -1,    -1,    54,    55,    -1,
-      57,    58,    59,    -1,    61,    62,    63,    64,    65,    66,
-      67,    68,    69,    70,    -1,    72,    73,    74,    -1,    76,
-      77,    78,    79,    80,    81,    82,    -1,    -1,    85,    86,
+      10,    11,    12,    13,    -1,    -1,    -1,    -1,    -1,   114,
+     115,   116,   117,   118,    -1,    25,    26,    27,    28,    29,
+      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
+      -1,    -1,    -1,    -1,    -1,    45,    46,    47,    48,    49,
+      50,    -1,    -1,    -1,    54,    55,    -1,    57,    58,    59,
+      -1,    61,    62,    63,    64,    65,    66,    67,    68,    69,
+      70,    -1,    72,    73,    74,    -1,    76,    77,    78,    79,
+      80,    81,    82,    -1,    -1,    85,    86,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,    10,    11,
-      12,    13,    -1,    -1,    -1,    -1,    -1,    -1,   115,   116,
-     117,   118,    -1,    25,    26,    27,    28,    29,    30,    31,
+      -1,    -1,    -1,    -1,   104,    -1,    -1,   107,    10,    11,
+      12,    13,    -1,    -1,    -1,   115,   116,   117,   118,    -1,
+      -1,    -1,    -1,    25,    26,    27,    28,    29,    30,    31,
       32,    33,    34,    35,    36,    37,    38,    39,    -1,    -1,
       -1,    -1,    -1,    45,    46,    47,    48,    49,    50,    -1,
       -1,    -1,    54,    55,    -1,    57,    58,    59,    -1,    61,
       62,    63,    64,    65,    66,    67,    68,    69,    70,    -1,
       72,    73,    74,    -1,    76,    77,    78,    79,    80,    81,
       82,    -1,    -1,    85,    86,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,   104,    10,    11,    12,    13,    -1,    -1,    -1,
+      -1,    -1,    -1,   115,   116,   117,   118,    -1,    25,    26,
+      27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
+      37,    38,    39,    -1,    -1,    -1,    -1,    -1,    45,    46,
+      47,    48,    49,    50,    -1,    -1,    -1,    54,    55,    -1,
+      57,    58,    59,    -1,    61,    62,    63,    64,    65,    66,
+      67,    68,    69,    70,    -1,    72,    73,    74,    -1,    76,
+      77,    78,    79,    80,    81,    82,    -1,    -1,    85,    86,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,     3,     4,     5,     6,   104,     8,     9,
+      10,    11,    12,    13,    -1,    -1,    -1,    -1,   115,   116,
+     117,   118,    -1,    -1,    -1,    25,    26,    27,    28,    29,
+      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
+      40,    41,    -1,    43,    44,    45,    46,    47,    48,    49,
+      50,    51,    52,    53,    54,    55,    -1,    57,    58,    59,
+      -1,    61,    62,    63,    64,    65,    66,    67,    68,    69,
+      70,    -1,    72,    73,    74,    75,    -1,    77,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     3,     4,
-       5,     6,   104,     8,     9,    10,    11,    12,    13,    -1,
-      -1,    -1,    -1,   115,   116,   117,   118,    -1,    -1,    -1,
+       5,     6,    -1,     8,     9,    10,    11,    12,    13,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   109,
       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
       35,    36,    37,    38,    39,    40,    41,    -1,    43,    44,
       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
@@ -1470,59 +1495,51 @@ static const yytype_int16 yycheck[] =
       50,    51,    52,    53,    54,    55,    -1,    57,    58,    59,
       -1,    61,    62,    63,    64,    65,    66,    67,    68,    69,
       70,    -1,    72,    73,    74,    75,    -1,    77,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     3,     4,
-       5,     6,    -1,     8,     9,    10,    11,    12,    13,    -1,
+      -1,    -1,    -1,    -1,    -1,     0,    -1,    -1,     3,     4,
+       5,     6,     7,     8,     9,    10,    11,    12,    13,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   109,
       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
       35,    36,    37,    38,    39,    40,    41,    -1,    43,    44,
       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
       55,    -1,    57,    58,    59,    -1,    61,    62,    63,    64,
       65,    66,    67,    68,    69,    70,    -1,    72,    73,    74,
-      75,    -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       0,    -1,    -1,     3,     4,     5,     6,     7,     8,     9,
+      75,    -1,    77,     3,     4,     5,     6,     7,     8,     9,
       10,    11,    12,    13,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,   109,    25,    26,    27,    28,    29,
+      -1,    -1,    -1,    -1,    -1,    25,    26,    27,    28,    29,
       30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
       40,    41,    -1,    43,    44,    45,    46,    47,    48,    49,
       50,    51,    52,    53,    54,    55,    -1,    57,    58,    59,
       -1,    61,    62,    63,    64,    65,    66,    67,    68,    69,
       70,    -1,    72,    73,    74,    75,    -1,    77,     3,     4,
-       5,     6,     7,     8,     9,    10,    11,    12,    13,    -1,
+       5,     6,    -1,     8,     9,    10,    11,    12,    13,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
       35,    36,    37,    38,    39,    40,    41,    -1,    43,    44,
       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
       55,    -1,    57,    58,    59,    -1,    61,    62,    63,    64,
       65,    66,    67,    68,    69,    70,    -1,    72,    73,    74,
-      75,    -1,    77,     3,     4,     5,     6,    -1,     8,     9,
-      10,    11,    12,    13,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    25,    26,    27,    28,    29,
-      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
-      40,    41,    -1,    43,    44,    45,    46,    47,    48,    49,
-      50,    51,    52,    53,    54,    55,    -1,    57,    58,    59,
-      -1,    61,    62,    63,    64,    65,    66,    67,    68,    69,
-      70,    -1,    72,    73,    74,    75,    -1,    77,     4,     5,
-       6,    -1,    -1,    -1,    10,    11,    12,    13,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    25,
-      26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
-      36,    37,    38,    39,    -1,    -1,    -1,    -1,    -1,    45,
-      46,    47,    48,    49,    50,    -1,    -1,    -1,    54,    55,
-      -1,    57,    58,    59,    -1,    61,    62,    63,    64,    65,
-      66,    67,    68,    69,    70,    -1,    72,    73,    74,    -1,
-      -1,    77,    10,    11,    12,    13,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    25,    26,    27,
-      28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
-      38,    39,    -1,    -1,    -1,    -1,    -1,    45,    46,    47,
-      48,    49,    50,    -1,    -1,    -1,    54,    55,    -1,    57,
-      58,    59,    -1,    61,    62,    63,    64,    65,    66,    67,
-      68,    69,    70,    -1,    72,    73,    74,    -1,    76,    77,
-      10,    11,    12,    13,    82,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    25,    26,    27,    28,    29,
-      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
-      -1,    -1,    -1,    -1,    -1,    45,    46,    47,    48,    49,
-      50,    -1,    -1,    -1,    54,    55,    -1,    57,    58,    59,
-      -1,    61,    62,    63,    64,    65,    66,    67,    68,    69,
-      70,    -1,    72,    73,    74,    -1,    -1,    77
+      75,    -1,    77,     4,     5,     6,    -1,    -1,    -1,    10,
+      11,    12,    13,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    25,    26,    27,    28,    29,    30,
+      31,    32,    33,    34,    35,    36,    37,    38,    39,    -1,
+      -1,    -1,    -1,    -1,    45,    46,    47,    48,    49,    50,
+      -1,    -1,    -1,    54,    55,    -1,    57,    58,    59,    -1,
+      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
+      -1,    72,    73,    74,    -1,    -1,    77,    10,    11,    12,
+      13,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    25,    26,    27,    28,    29,    30,    31,    32,
+      33,    34,    35,    36,    37,    38,    39,    -1,    -1,    -1,
+      -1,    -1,    45,    46,    47,    48,    49,    50,    -1,    -1,
+      -1,    54,    55,    -1,    57,    58,    59,    -1,    61,    62,
+      63,    64,    65,    66,    67,    68,    69,    70,    -1,    72,
+      73,    74,    -1,    76,    77,    10,    11,    12,    13,    82,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
+      35,    36,    37,    38,    39,    -1,    -1,    -1,    -1,    -1,
+      45,    46,    47,    48,    49,    50,    -1,    -1,    -1,    54,
+      55,    -1,    57,    58,    59,    -1,    61,    62,    63,    64,
+      65,    66,    67,    68,    69,    70,    -1,    72,    73,    74,
+      -1,    -1,    77
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -1536,39 +1553,40 @@ static const yytype_uint8 yystos[] =
       54,    55,    57,    58,    59,    61,    62,    63,    64,    65,
       66,    67,    68,    69,    70,    72,    73,    74,    75,    77,
      159,   160,   161,   162,   163,   168,   169,   170,   171,   173,
-     174,   175,   176,   177,   180,   181,   182,   214,   215,   216,
-      44,    76,   176,    40,    41,    76,   108,   104,   114,   217,
+     174,   175,   176,   177,   180,   181,   182,   217,   218,   219,
+      44,    76,   176,    40,    41,    76,   108,   104,   114,   220,
      105,   111,     9,    40,    41,    42,   165,   166,   172,   111,
      114,    76,   174,    76,   114,   158,   175,   180,   174,   106,
-       0,   215,   180,   108,   184,    76,   178,   179,   108,   200,
+       0,   218,   180,   108,   184,    76,   178,   179,   108,   200,
      165,   164,   167,   175,   166,    76,   104,   106,   113,   108,
        3,   173,   175,   185,   186,    76,    78,    79,    80,    81,
       82,    85,    86,   104,   115,   116,   117,   118,   129,   130,
      131,   133,   134,   135,   136,   137,   138,   139,   140,   141,
      142,   143,   144,   145,   146,   147,   148,   149,   150,   151,
      152,   153,   157,   181,   114,   183,   185,   113,   105,   111,
-      14,    15,    16,    18,    19,    20,    21,    56,   108,   109,
-     114,   140,   153,   154,   156,   159,   160,   181,   190,   191,
-     192,   193,   201,   202,   203,   206,   213,    76,   164,   167,
-     106,   113,   107,   157,   154,   189,   175,    76,   187,   188,
-     109,   186,   140,   140,   156,    85,    86,   106,   110,   105,
-     105,   111,    55,   154,   104,   140,   119,   120,   121,   116,
-     118,    83,    84,    87,    88,   122,   123,    89,    90,   126,
-     125,   124,    91,    93,    92,   127,   107,   185,   109,    79,
-      80,   179,   114,   114,   208,   104,   104,   114,   114,   156,
-     104,   109,   194,    94,    95,    96,    97,    98,    99,   100,
-     101,   102,   103,   113,   155,   111,   114,   109,   191,   106,
-     107,   157,   189,   113,   107,   187,   106,   111,   114,    76,
-     114,   105,   132,   156,    76,    82,   135,   154,   140,   140,
-     140,   142,   142,   143,   143,   144,   144,   144,   144,   145,
-     145,   146,   147,   148,   149,   150,   151,   156,   109,   197,
-     198,   199,   209,   156,   114,   207,   201,   154,   154,   157,
+      14,    15,    16,    18,    19,    20,    21,    22,    23,    24,
+      56,   108,   109,   114,   140,   153,   154,   156,   159,   160,
+     181,   190,   191,   192,   193,   201,   202,   203,   205,   207,
+     209,   216,    76,   164,   167,   106,   113,   107,   157,   154,
+     189,   175,    76,   187,   188,   109,   186,   140,   140,   156,
+      85,    86,   106,   110,   105,   105,   111,    55,   154,   104,
+     140,   119,   120,   121,   116,   118,    83,    84,    87,    88,
+     122,   123,    89,    90,   126,   125,   124,    91,    93,    92,
+     127,   107,   185,   109,    79,    80,   179,   114,   114,   211,
+     104,   104,   114,   114,   156,   104,   157,   112,   104,   109,
+     194,    94,    95,    96,    97,    98,    99,   100,   101,   102,
+     103,   113,   155,   111,   114,   109,   191,   106,   107,   157,
+     189,   113,   107,   187,   106,   111,   114,    76,   114,   105,
+     132,   156,    76,    82,   135,   154,   140,   140,   140,   142,
+     142,   143,   143,   144,   144,   144,   144,   145,   145,   146,
+     147,   148,   149,   150,   151,   156,   109,   197,   198,   199,
+     212,   156,   114,   156,   112,   210,   201,   154,   154,   157,
      113,   107,   189,   113,   114,   157,   188,   106,   114,   107,
-     112,    56,   200,   192,   190,   202,   210,   105,   156,   170,
-     173,   205,   195,   107,   189,   113,   189,   107,   157,   154,
-     104,   205,   211,   212,   197,   204,    76,   105,   109,   189,
-     107,   156,   114,   105,    17,   113,   192,   196,   200,   114,
-     105,   156,   196,   197,   189,   114
+     112,    56,   200,   192,   190,   202,   213,   105,   105,   156,
+     170,   173,   208,   195,   107,   189,   113,   189,   107,   157,
+     154,   104,   208,   214,   215,   197,   204,   206,    76,   105,
+     109,   189,   107,   156,   114,   105,    17,   193,   113,   192,
+     196,   200,   114,   105,   156,   196,   197,   189,   114
 };
 
 #define yyerrok                (yyerrstatus = 0)
@@ -2598,7 +2616,7 @@ yyreduce:
                     (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
 
                     TQualifier qual;
-                    for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
+                    for (size_t i = 0; i < fnCandidate->getParamCount(); ++i) {
                         qual = fnCandidate->getParam(i).type->getQualifier();
                         if (qual == EvqOut || qual == EvqInOut) {
                             if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
@@ -3345,7 +3363,7 @@ yyreduce:
         prototype->setType(function.getReturnType());
         prototype->setName(function.getName());
         
-        for (int i = 0; i < function.getParamCount(); i++)
+        for (size_t i = 0; i < function.getParamCount(); i++)
         {
             const TParameter &param = function.getParam(i);
             if (param.name != 0)
@@ -3437,7 +3455,7 @@ yyreduce:
                 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
                 context->recover();
             }
-            for (int i = 0; i < prevDec->getParamCount(); ++i) {
+            for (size_t i = 0; i < prevDec->getParamCount(); ++i) {
                 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
                     context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString());
                     context->recover();
@@ -4594,31 +4612,41 @@ yyreduce:
 
   case 218:
 
-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
+    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermSwitch); }
     break;
 
   case 219:
 
-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
+    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermCase); }
     break;
 
   case 220:
 
-    { (yyval.interm.intermAggregate) = 0; }
+    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
     break;
 
   case 221:
 
-    { context->symbolTable.push(); }
+    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
     break;
 
   case 222:
 
-    { context->symbolTable.pop(); }
+    { (yyval.interm.intermAggregate) = 0; }
     break;
 
   case 223:
 
+    { context->symbolTable.push(); }
+    break;
+
+  case 224:
+
+    { context->symbolTable.pop(); }
+    break;
+
+  case 225:
+
     {
         if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
             (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
@@ -4628,44 +4656,44 @@ yyreduce:
     }
     break;
 
-  case 224:
+  case 226:
 
     { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
     break;
 
-  case 225:
+  case 227:
 
     { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
     break;
 
-  case 226:
+  case 228:
 
     { context->symbolTable.push(); }
     break;
 
-  case 227:
+  case 229:
 
     { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
     break;
 
-  case 228:
+  case 230:
 
     { context->symbolTable.push(); }
     break;
 
-  case 229:
+  case 231:
 
     { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
     break;
 
-  case 230:
+  case 232:
 
     {
         (yyval.interm.intermNode) = 0;
     }
     break;
 
-  case 231:
+  case 233:
 
     {
         if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
@@ -4676,31 +4704,31 @@ yyreduce:
     }
     break;
 
-  case 232:
+  case 234:
 
     {
         (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
     }
     break;
 
-  case 233:
+  case 235:
 
     {
         (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
     }
     break;
 
-  case 234:
+  case 236:
 
     { (yyval.interm.intermNode) = 0; }
     break;
 
-  case 235:
+  case 237:
 
     { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
     break;
 
-  case 236:
+  case 238:
 
     {
         if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
@@ -4709,7 +4737,7 @@ yyreduce:
     }
     break;
 
-  case 237:
+  case 239:
 
     {
         (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
@@ -4717,7 +4745,7 @@ yyreduce:
     }
     break;
 
-  case 238:
+  case 240:
 
     {
         (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
@@ -4725,7 +4753,34 @@ yyreduce:
     }
     break;
 
-  case 239:
+  case 241:
+
+    { context->incrSwitchNestingLevel(); }
+    break;
+
+  case 242:
+
+    {
+        (yyval.interm.intermSwitch) = context->addSwitch((yyvsp[(3) - (6)].interm.intermTypedNode), (yyvsp[(6) - (6)].interm.intermAggregate), (yyvsp[(1) - (6)].lex).line);
+        context->decrSwitchNestingLevel();
+    }
+    break;
+
+  case 243:
+
+    {
+        (yyval.interm.intermCase) = context->addCase((yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
+    }
+    break;
+
+  case 244:
+
+    {
+        (yyval.interm.intermCase) = context->addDefault((yyvsp[(1) - (2)].lex).line);
+    }
+    break;
+
+  case 245:
 
     {
         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
@@ -4734,7 +4789,7 @@ yyreduce:
     }
     break;
 
-  case 240:
+  case 246:
 
     {
         TIntermNode* intermNode;
@@ -4752,12 +4807,12 @@ yyreduce:
     }
     break;
 
-  case 241:
+  case 247:
 
     { context->symbolTable.push(); ++context->loopNestingLevel; }
     break;
 
-  case 242:
+  case 248:
 
     {
         context->symbolTable.pop();
@@ -4766,12 +4821,12 @@ yyreduce:
     }
     break;
 
-  case 243:
+  case 249:
 
     { ++context->loopNestingLevel; }
     break;
 
-  case 244:
+  case 250:
 
     {
         if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
@@ -4782,12 +4837,12 @@ yyreduce:
     }
     break;
 
-  case 245:
+  case 251:
 
     { context->symbolTable.push(); ++context->loopNestingLevel; }
     break;
 
-  case 246:
+  case 252:
 
     {
         context->symbolTable.pop();
@@ -4796,35 +4851,35 @@ yyreduce:
     }
     break;
 
-  case 247:
+  case 253:
 
     {
         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
     }
     break;
 
-  case 248:
+  case 254:
 
     {
         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
     }
     break;
 
-  case 249:
+  case 255:
 
     {
         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
     }
     break;
 
-  case 250:
+  case 256:
 
     {
         (yyval.interm.intermTypedNode) = 0;
     }
     break;
 
-  case 251:
+  case 257:
 
     {
         (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
@@ -4832,7 +4887,7 @@ yyreduce:
     }
     break;
 
-  case 252:
+  case 258:
 
     {
         (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
@@ -4840,63 +4895,43 @@ yyreduce:
     }
     break;
 
-  case 253:
+  case 259:
 
     {
-        if (context->loopNestingLevel <= 0) {
-            context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "");
-            context->recover();
-        }
-        (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
+        (yyval.interm.intermNode) = context->addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
     }
     break;
 
-  case 254:
+  case 260:
 
     {
-        if (context->loopNestingLevel <= 0) {
-            context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "");
-            context->recover();
-        }
-        (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
+        (yyval.interm.intermNode) = context->addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
     }
     break;
 
-  case 255:
+  case 261:
 
     {
-        (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
-        if (context->currentFunctionType->getBasicType() != EbtVoid) {
-            context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return");
-            context->recover();
-        }
+        (yyval.interm.intermNode) = context->addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
     }
     break;
 
-  case 256:
+  case 262:
 
     {
-        (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
-        context->functionReturnsValue = true;
-        if (context->currentFunctionType->getBasicType() == EbtVoid) {
-            context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return");
-            context->recover();
-        } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
-            context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return");
-            context->recover();
-        }
+        (yyval.interm.intermNode) = context->addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
     }
     break;
 
-  case 257:
+  case 263:
 
     {
         FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
-        (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
+        (yyval.interm.intermNode) = context->addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
     }
     break;
 
-  case 258:
+  case 264:
 
     {
         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
@@ -4904,7 +4939,7 @@ yyreduce:
     }
     break;
 
-  case 259:
+  case 265:
 
     {
         (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
@@ -4912,21 +4947,21 @@ yyreduce:
     }
     break;
 
-  case 260:
+  case 266:
 
     {
         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
     }
     break;
 
-  case 261:
+  case 267:
 
     {
         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
     }
     break;
 
-  case 262:
+  case 268:
 
     {
         TFunction* function = (yyvsp[(1) - (1)].interm).function;
@@ -4983,7 +5018,7 @@ yyreduce:
         // knows where to find parameters.
         //
         TIntermAggregate* paramNodes = new TIntermAggregate;
-        for (int i = 0; i < function->getParamCount(); i++) {
+        for (size_t i = 0; i < function->getParamCount(); i++) {
             const TParameter& param = function->getParam(i);
             if (param.name != 0) {
                 TVariable *variable = new TVariable(param.name, *param.type);
@@ -5015,7 +5050,7 @@ yyreduce:
     }
     break;
 
-  case 263:
+  case 269:
 
     {
         //?? Check that all paths return a value if return type != void ?
index e1ada23..e80cce4 100644 (file)
@@ -193,6 +193,8 @@ typedef union YYSTYPE
             TIntermNodePair nodePair;
             TIntermTyped* intermTypedNode;
             TIntermAggregate* intermAggregate;
+            TIntermSwitch* intermSwitch;
+            TIntermCase* intermCase;
         };
         union {
             TPublicType type;
index b190e26..8a65f49 100644 (file)
@@ -78,7 +78,7 @@ void OutputTreeText(TInfoSinkBase& sink, TIntermNode* node, const int depth)
 
 void TOutputTraverser::visitSymbol(TIntermSymbol* node)
 {
-    OutputTreeText(sink, node, depth);
+    OutputTreeText(sink, node, mDepth);
 
     sink << "'" << node->getSymbol() << "' ";
     sink << "(" << node->getCompleteString() << ")\n";
@@ -88,7 +88,7 @@ bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary* node)
 {
     TInfoSinkBase& out = sink;
 
-    OutputTreeText(out, node, depth);
+    OutputTreeText(out, node, mDepth);
 
     switch (node->getOp()) {
         case EOpAssign:                   out << "move second child to first child";           break;
@@ -152,7 +152,7 @@ bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary* node)
 {
     TInfoSinkBase& out = sink;
 
-    OutputTreeText(out, node, depth);
+    OutputTreeText(out, node, mDepth);
 
     switch (node->getOp()) {
         case EOpNegative:       out << "Negate value";         break;
@@ -243,7 +243,7 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
         return true;
     }
 
-    OutputTreeText(out, node, depth);
+    OutputTreeText(out, node, mDepth);
 
     switch (node->getOp()) {
         case EOpSequence:      out << "Sequence\n"; return true;
@@ -316,18 +316,18 @@ bool TOutputTraverser::visitSelection(Visit visit, TIntermSelection* node)
 {
     TInfoSinkBase& out = sink;
 
-    OutputTreeText(out, node, depth);
+    OutputTreeText(out, node, mDepth);
 
     out << "Test condition and select";
     out << " (" << node->getCompleteString() << ")\n";
 
-    ++depth;
+    ++mDepth;
 
-    OutputTreeText(sink, node, depth);
+    OutputTreeText(sink, node, mDepth);
     out << "Condition\n";
     node->getCondition()->traverse(this);
 
-    OutputTreeText(sink, node, depth);
+    OutputTreeText(sink, node, mDepth);
     if (node->getTrueBlock()) {
         out << "true case\n";
         node->getTrueBlock()->traverse(this);
@@ -335,12 +335,12 @@ bool TOutputTraverser::visitSelection(Visit visit, TIntermSelection* node)
         out << "true case is null\n";
 
     if (node->getFalseBlock()) {
-        OutputTreeText(sink, node, depth);
+        OutputTreeText(sink, node, mDepth);
         out << "false case\n";
         node->getFalseBlock()->traverse(this);
     }
 
-    --depth;
+    --mDepth;
 
     return false;
 }
@@ -352,7 +352,7 @@ void TOutputTraverser::visitConstantUnion(TIntermConstantUnion* node)
     int size = node->getType().getObjectSize();
 
     for (int i = 0; i < size; i++) {
-        OutputTreeText(out, node, depth);
+        OutputTreeText(out, node, mDepth);
         switch (node->getUnionArrayPointer()[i].getType()) {
             case EbtBool:
                 if (node->getUnionArrayPointer()[i].getBConst())
@@ -386,23 +386,23 @@ bool TOutputTraverser::visitLoop(Visit visit, TIntermLoop* node)
 {
     TInfoSinkBase& out = sink;
 
-    OutputTreeText(out, node, depth);
+    OutputTreeText(out, node, mDepth);
 
     out << "Loop with condition ";
     if (node->getType() == ELoopDoWhile)
         out << "not ";
     out << "tested first\n";
 
-    ++depth;
+    ++mDepth;
 
-    OutputTreeText(sink, node, depth);
+    OutputTreeText(sink, node, mDepth);
     if (node->getCondition()) {
         out << "Loop Condition\n";
         node->getCondition()->traverse(this);
     } else
         out << "No loop condition\n";
 
-    OutputTreeText(sink, node, depth);
+    OutputTreeText(sink, node, mDepth);
     if (node->getBody()) {
         out << "Loop Body\n";
         node->getBody()->traverse(this);
@@ -410,12 +410,12 @@ bool TOutputTraverser::visitLoop(Visit visit, TIntermLoop* node)
         out << "No loop body\n";
 
     if (node->getExpression()) {
-        OutputTreeText(sink, node, depth);
+        OutputTreeText(sink, node, mDepth);
         out << "Loop Terminal Expression\n";
         node->getExpression()->traverse(this);
     }
 
-    --depth;
+    --mDepth;
 
     return false;
 }
@@ -424,7 +424,7 @@ bool TOutputTraverser::visitBranch(Visit visit, TIntermBranch* node)
 {
     TInfoSinkBase& out = sink;
 
-    OutputTreeText(out, node, depth);
+    OutputTreeText(out, node, mDepth);
 
     switch (node->getFlowOp()) {
         case EOpKill:      out << "Branch: Kill";           break;
@@ -436,9 +436,9 @@ bool TOutputTraverser::visitBranch(Visit visit, TIntermBranch* node)
 
     if (node->getExpression()) {
         out << " with expression\n";
-        ++depth;
+        ++mDepth;
         node->getExpression()->traverse(this);
-        --depth;
+        --mDepth;
     } else
         out << "\n";
 
index de6951f..7a65056 100644 (file)
@@ -242,6 +242,8 @@ class TIntermSymbol;
 class TIntermLoop;
 class TIntermBranch;
 class TInfoSink;
+class TIntermSwitch;
+class TIntermCase;
 
 //
 // Base class for the tree nodes
@@ -265,6 +267,8 @@ public:
     virtual TIntermSymbol* getAsSymbolNode() { return 0; }
     virtual TIntermLoop* getAsLoopNode() { return 0; }
        virtual TIntermBranch* getAsBranchNode() { return 0; }
+       virtual TIntermSwitch *getAsSwitchNode() { return 0; }
+       virtual TIntermCase *getAsCaseNode() { return 0; }
     virtual ~TIntermNode() { }
 
 protected:
@@ -554,6 +558,49 @@ protected:
     TIntermNode* falseBlock;
 };
 
+//
+// Switch statement.
+//
+class TIntermSwitch : public TIntermNode
+{
+public:
+       TIntermSwitch(TIntermTyped *init, TIntermAggregate *statementList)
+               : TIntermNode(), mInit(init), mStatementList(statementList)
+       {}
+
+       void traverse(TIntermTraverser *it);
+
+       TIntermSwitch *getAsSwitchNode() { return this; }
+
+       TIntermAggregate *getStatementList() { return mStatementList; }
+       void setStatementList(TIntermAggregate *statementList) { mStatementList = statementList; }
+
+protected:
+       TIntermTyped *mInit;
+       TIntermAggregate *mStatementList;
+};
+
+//
+// Case label.
+//
+class TIntermCase : public TIntermNode
+{
+public:
+       TIntermCase(TIntermTyped *condition)
+               : TIntermNode(), mCondition(condition)
+       {}
+
+       void traverse(TIntermTraverser *it);
+
+       TIntermCase *getAsCaseNode() { return this; }
+
+       bool hasCondition() const { return mCondition != nullptr; }
+       TIntermTyped *getCondition() const { return mCondition; }
+
+protected:
+       TIntermTyped *mCondition;
+};
+
 enum Visit
 {
     PreVisit,
@@ -578,7 +625,7 @@ public:
             inVisit(inVisit),
             postVisit(postVisit),
             rightToLeft(rightToLeft),
-            depth(0) {}
+            mDepth(0) {}
     virtual ~TIntermTraverser() {};
 
     virtual void visitSymbol(TIntermSymbol*) {}
@@ -589,9 +636,25 @@ public:
     virtual bool visitAggregate(Visit visit, TIntermAggregate*) {return true;}
     virtual bool visitLoop(Visit visit, TIntermLoop*) {return true;}
     virtual bool visitBranch(Visit visit, TIntermBranch*) {return true;}
+       virtual bool visitSwitch(Visit, TIntermSwitch*) { return true; }
+       virtual bool visitCase(Visit, TIntermCase*) { return true; }
+
+       void incrementDepth(TIntermNode *current)
+       {
+               mDepth++;
+               mPath.push_back(current);
+       }
 
-    void incrementDepth() {depth++;}
-    void decrementDepth() {depth--;}
+       void decrementDepth()
+       {
+               mDepth--;
+               mPath.pop_back();
+       }
+
+       TIntermNode *getParentNode()
+       {
+               return mPath.size() == 0 ? NULL : mPath.back();
+       }
 
     const bool preVisit;
     const bool inVisit;
@@ -599,7 +662,23 @@ public:
     const bool rightToLeft;
 
 protected:
-    int depth;
+       int mDepth;
+
+       // All the nodes from root to the current node's parent during traversing.
+       TVector<TIntermNode *> mPath;
+
+private:
+       struct ParentBlock
+       {
+               ParentBlock(TIntermAggregate *nodeIn, TIntermSequence::size_type posIn)
+               : node(nodeIn), pos(posIn)
+               {}
+
+               TIntermAggregate *node;
+               TIntermSequence::size_type pos;
+       };
+       // All the code blocks from the root to the current node's parent during traversal.
+       std::vector<ParentBlock> mParentBlockStack;
 };
 
 #endif // __INTERMEDIATE_H
index da7c283..9e7b48e 100644 (file)
@@ -33,6 +33,8 @@ public:
     TIntermAggregate* setAggregateOperator(TIntermNode*, TOperator, TSourceLoc);
     TIntermNode*  addSelection(TIntermTyped* cond, TIntermNodePair code, TSourceLoc);
     TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, TSourceLoc);
+    TIntermSwitch *addSwitch(TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &line);
+    TIntermCase *addCase(TIntermTyped *condition, const TSourceLoc &line);
     TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, TSourceLoc);
     TIntermConstantUnion* addConstantUnion(ConstantUnion*, const TType&, TSourceLoc);
     TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*);
index d7aa0f9..292b625 100644 (file)
                <Unit filename="../compiler/Types.h" />
                <Unit filename="../compiler/ValidateLimitations.cpp" />
                <Unit filename="../compiler/ValidateLimitations.h" />
+               <Unit filename="../compiler/ValidateSwitch.cpp" />
+               <Unit filename="../compiler/ValidateSwitch.h" />
                <Unit filename="../compiler/debug.cpp" />
                <Unit filename="../compiler/debug.h" />
                <Unit filename="../compiler/glslang.h" />