// This code was generated by the Gardens Point Parser Generator
// Copyright (c) Wayne Kelly, John Gough, QUT 2005-2014
// (see accompanying GPPGcopyright.rtf)

// GPPG version 1.5.2
// Machine:  ANDY-XBIM
// DateTime: 25/03/2025 15:48:09
// UserName: AndyWard
// Input file <StepP21Parser.y - 25/03/2025 15:18:04>

// options: lines gplex

using System;
using System.Collections.Generic;
using System.CodeDom.Compiler;
using System.Globalization;
using System.Text;
using QUT.Gppg;

namespace Xbim.IO.Parser
{
public enum Tokens {error=63,EOF=64,ISOSTEPSTART=65,HEADER=66,
    ENDSEC=67,DATA=68,ISOSTEPEND=69,SCOPE=70,ENDSCOPE=71,ENTITY=72,
    TYPE=73,INTEGER=74,FLOAT=75,STRING=76,BOOLEAN=77,IDENTITY=78,
    TEXT=79,NONDEF=80,OVERRIDE=81,ENUM=82,HEXA=83,ILLEGALCHAR=84,
    MISC=85,MLSTRING=86,INVALIDSTRING=87};

public partial struct ValueType
#line 10 "StepP21Parser.y"
      {
		public string strVal;
	  }
#line default
// Abstract base class for GPLEX scanners
[GeneratedCodeAttribute( "Gardens Point Parser Generator", "1.5.2")]
public abstract class ScanBase : AbstractScanner<ValueType,LexLocation> {
  private LexLocation __yylloc = new LexLocation();
  public override LexLocation yylloc { get { return __yylloc; } set { __yylloc = value; } }
  protected virtual bool yywrap() { return true; }
}

// Utility class for encapsulating token information
[GeneratedCodeAttribute( "Gardens Point Parser Generator", "1.5.2")]
public class ScanObj {
  public int token;
  public ValueType yylval;
  public LexLocation yylloc;
  public ScanObj( int t, ValueType val, LexLocation loc ) {
    this.token = t; this.yylval = val; this.yylloc = loc;
  }
}

[GeneratedCodeAttribute( "Gardens Point Parser Generator", "1.5.2")]
public partial class P21Parser: ShiftReduceParser<ValueType, LexLocation>
{
  // Verbatim content from StepP21Parser.y - 25/03/2025 15:18:04
#line 2 "StepP21Parser.y"
 public bool InHeader = false;
#line default
  // End verbatim content from StepP21Parser.y - 25/03/2025 15:18:04

#pragma warning disable 649
  private static Dictionary<int, string> aliases;
#pragma warning restore 649
  private static Rule[] rules = new Rule[64];
  private static State[] states = new State[99];
  private static string[] nonTerms = new string[] {
      "stepFile", "trailingSpace", "$accept", "endStep", "beginStep", "startHeader", 
      "stepFile1", "headerEntities", "endSec", "endOfHeader", "model", "stepFile2", 
      "stepFile3", "headerEntity", "entityType", "listArgument", "argument", 
      "listType", "beginList", "endList", "argumentList", "bloc", "entityLabel", 
      "entity", "beginScope", "endScope", "complex", "uniqueID", "export", "beginExport", 
      };

  static P21Parser() {
    states[0] = new State(new int[]{65,95,72,74,63,75},new int[]{-1,1,-7,3,-5,4,-12,96,-13,97,-11,98,-22,79,-23,19});
    states[1] = new State(new int[]{64,2});
    states[2] = new State(-1);
    states[3] = new State(-11);
    states[4] = new State(new int[]{66,94},new int[]{-6,5});
    states[5] = new State(new int[]{73,56,84,57,63,86,67,17},new int[]{-8,6,-9,87,-14,93,-15,83});
    states[6] = new State(new int[]{67,17,73,56,84,57,63,86},new int[]{-9,7,-14,82,-15,83});
    states[7] = new State(new int[]{68,81},new int[]{-10,8});
    states[8] = new State(new int[]{72,74,63,75},new int[]{-11,9,-22,79,-23,19});
    states[9] = new State(new int[]{67,17,72,74,63,75},new int[]{-9,10,-22,16,-23,19});
    states[10] = new State(new int[]{69,12},new int[]{-4,11});
    states[11] = new State(-8);
    states[12] = new State(new int[]{32,15,64,-4},new int[]{-2,13});
    states[13] = new State(new int[]{32,14,64,-5});
    states[14] = new State(-3);
    states[15] = new State(-2);
    states[16] = new State(-45);
    states[17] = new State(new int[]{32,15,68,-15,69,-15},new int[]{-2,18});
    states[18] = new State(new int[]{32,14,68,-16,69,-16});
    states[19] = new State(new int[]{61,20});
    states[20] = new State(new int[]{73,56,84,57,40,58,70,80},new int[]{-24,21,-25,23,-15,28});
    states[21] = new State(new int[]{59,22});
    states[22] = new State(-46);
    states[23] = new State(new int[]{72,74,63,75,71,65},new int[]{-11,24,-26,76,-22,79,-23,19});
    states[24] = new State(new int[]{71,65,72,74,63,75},new int[]{-26,25,-22,16,-23,19});
    states[25] = new State(new int[]{73,56,84,57,40,58},new int[]{-24,26,-15,28});
    states[26] = new State(new int[]{59,27});
    states[27] = new State(-47);
    states[28] = new State(new int[]{40,48},new int[]{-16,29,-19,30});
    states[29] = new State(-52);
    states[30] = new State(new int[]{63,54,41,53,78,36,74,37,75,38,76,39,86,40,87,41,77,42,82,43,83,44,80,45,81,46,40,48,73,51},new int[]{-20,31,-21,32,-17,55,-16,47,-19,30,-18,49});
    states[31] = new State(-38);
    states[32] = new State(new int[]{44,34,63,52,41,53},new int[]{-20,33});
    states[33] = new State(-39);
    states[34] = new State(new int[]{78,36,74,37,75,38,76,39,86,40,87,41,77,42,82,43,83,44,80,45,81,46,40,48,73,51},new int[]{-17,35,-16,47,-19,30,-18,49});
    states[35] = new State(-42);
    states[36] = new State(-22);
    states[37] = new State(-23);
    states[38] = new State(-24);
    states[39] = new State(-25);
    states[40] = new State(-26);
    states[41] = new State(-27);
    states[42] = new State(-28);
    states[43] = new State(-29);
    states[44] = new State(-30);
    states[45] = new State(-31);
    states[46] = new State(-32);
    states[47] = new State(-33);
    states[48] = new State(-36);
    states[49] = new State(new int[]{40,48},new int[]{-16,50,-19,30});
    states[50] = new State(-34);
    states[51] = new State(-35);
    states[52] = new State(-43);
    states[53] = new State(-37);
    states[54] = new State(-40);
    states[55] = new State(-41);
    states[56] = new State(-62);
    states[57] = new State(-63);
    states[58] = new State(new int[]{73,56,84,57},new int[]{-27,59,-15,63});
    states[59] = new State(new int[]{41,60,73,56,84,57},new int[]{-15,61});
    states[60] = new State(-53);
    states[61] = new State(new int[]{40,48},new int[]{-16,62,-19,30});
    states[62] = new State(-51);
    states[63] = new State(new int[]{40,48},new int[]{-16,64,-19,30});
    states[64] = new State(-50);
    states[65] = new State(new int[]{47,73,73,-59,84,-59,40,-59},new int[]{-30,66});
    states[66] = new State(new int[]{78,71},new int[]{-29,67,-28,72});
    states[67] = new State(new int[]{47,68,44,69});
    states[68] = new State(-60);
    states[69] = new State(new int[]{78,71},new int[]{-28,70});
    states[70] = new State(-57);
    states[71] = new State(-55);
    states[72] = new State(-56);
    states[73] = new State(-58);
    states[74] = new State(-61);
    states[75] = new State(-49);
    states[76] = new State(new int[]{73,56,84,57,40,58},new int[]{-24,77,-15,28});
    states[77] = new State(new int[]{59,78});
    states[78] = new State(-48);
    states[79] = new State(-44);
    states[80] = new State(-54);
    states[81] = new State(-21);
    states[82] = new State(-18);
    states[83] = new State(new int[]{40,48},new int[]{-16,84,-19,30});
    states[84] = new State(new int[]{59,85});
    states[85] = new State(-19);
    states[86] = new State(-20);
    states[87] = new State(new int[]{68,81},new int[]{-10,88});
    states[88] = new State(new int[]{72,74,63,75},new int[]{-11,89,-22,79,-23,19});
    states[89] = new State(new int[]{63,92,67,17,72,74},new int[]{-9,90,-22,16,-23,19});
    states[90] = new State(new int[]{69,12},new int[]{-4,91});
    states[91] = new State(-9);
    states[92] = new State(new int[]{64,-10,63,-49,67,-49,72,-49});
    states[93] = new State(-17);
    states[94] = new State(-7);
    states[95] = new State(-6);
    states[96] = new State(-12);
    states[97] = new State(-13);
    states[98] = new State(new int[]{72,74,63,75,64,-14},new int[]{-22,16,-23,19});

    for (int sNo = 0; sNo < states.Length; sNo++) states[sNo].number = sNo;

    rules[1] = new Rule(-3, new int[]{-1,64});
    rules[2] = new Rule(-2, new int[]{32});
    rules[3] = new Rule(-2, new int[]{-2,32});
    rules[4] = new Rule(-4, new int[]{69});
    rules[5] = new Rule(-4, new int[]{69,-2});
    rules[6] = new Rule(-5, new int[]{65});
    rules[7] = new Rule(-6, new int[]{66});
    rules[8] = new Rule(-7, new int[]{-5,-6,-8,-9,-10,-11,-9,-4});
    rules[9] = new Rule(-12, new int[]{-5,-6,-9,-10,-11,-9,-4});
    rules[10] = new Rule(-13, new int[]{-5,-6,-9,-10,-11,63});
    rules[11] = new Rule(-1, new int[]{-7});
    rules[12] = new Rule(-1, new int[]{-12});
    rules[13] = new Rule(-1, new int[]{-13});
    rules[14] = new Rule(-1, new int[]{-11});
    rules[15] = new Rule(-9, new int[]{67});
    rules[16] = new Rule(-9, new int[]{67,-2});
    rules[17] = new Rule(-8, new int[]{-14});
    rules[18] = new Rule(-8, new int[]{-8,-14});
    rules[19] = new Rule(-14, new int[]{-15,-16,59});
    rules[20] = new Rule(-14, new int[]{63});
    rules[21] = new Rule(-10, new int[]{68});
    rules[22] = new Rule(-17, new int[]{78});
    rules[23] = new Rule(-17, new int[]{74});
    rules[24] = new Rule(-17, new int[]{75});
    rules[25] = new Rule(-17, new int[]{76});
    rules[26] = new Rule(-17, new int[]{86});
    rules[27] = new Rule(-17, new int[]{87});
    rules[28] = new Rule(-17, new int[]{77});
    rules[29] = new Rule(-17, new int[]{82});
    rules[30] = new Rule(-17, new int[]{83});
    rules[31] = new Rule(-17, new int[]{80});
    rules[32] = new Rule(-17, new int[]{81});
    rules[33] = new Rule(-17, new int[]{-16});
    rules[34] = new Rule(-17, new int[]{-18,-16});
    rules[35] = new Rule(-18, new int[]{73});
    rules[36] = new Rule(-19, new int[]{40});
    rules[37] = new Rule(-20, new int[]{41});
    rules[38] = new Rule(-16, new int[]{-19,-20});
    rules[39] = new Rule(-16, new int[]{-19,-21,-20});
    rules[40] = new Rule(-16, new int[]{-19,63});
    rules[41] = new Rule(-21, new int[]{-17});
    rules[42] = new Rule(-21, new int[]{-21,44,-17});
    rules[43] = new Rule(-21, new int[]{-21,63});
    rules[44] = new Rule(-11, new int[]{-22});
    rules[45] = new Rule(-11, new int[]{-11,-22});
    rules[46] = new Rule(-22, new int[]{-23,61,-24,59});
    rules[47] = new Rule(-22, new int[]{-23,61,-25,-11,-26,-24,59});
    rules[48] = new Rule(-22, new int[]{-23,61,-25,-26,-24,59});
    rules[49] = new Rule(-22, new int[]{63});
    rules[50] = new Rule(-27, new int[]{-15,-16});
    rules[51] = new Rule(-27, new int[]{-27,-15,-16});
    rules[52] = new Rule(-24, new int[]{-15,-16});
    rules[53] = new Rule(-24, new int[]{40,-27,41});
    rules[54] = new Rule(-25, new int[]{70});
    rules[55] = new Rule(-28, new int[]{78});
    rules[56] = new Rule(-29, new int[]{-28});
    rules[57] = new Rule(-29, new int[]{-29,44,-28});
    rules[58] = new Rule(-30, new int[]{47});
    rules[59] = new Rule(-26, new int[]{71});
    rules[60] = new Rule(-26, new int[]{71,-30,-29,47});
    rules[61] = new Rule(-23, new int[]{72});
    rules[62] = new Rule(-15, new int[]{73});
    rules[63] = new Rule(-15, new int[]{84});
  }

  protected override void Initialize() {
    this.InitSpecialTokens((int)Tokens.error, (int)Tokens.EOF);
    this.InitStates(states);
    this.InitRules(rules);
    this.InitNonTerminals(nonTerms);
  }

  protected override void DoAction(int action)
  {
#pragma warning disable 162, 1522
    switch (action)
    {
      case 4: // endStep -> ISOSTEPEND
#line 40 "StepP21Parser.y"
                    {EndParse();}
#line default
        break;
      case 5: // endStep -> ISOSTEPEND, trailingSpace
#line 42 "StepP21Parser.y"
 {EndParse();}
#line default
        break;
      case 6: // beginStep -> ISOSTEPSTART
#line 45 "StepP21Parser.y"
    {BeginParse(); }
#line default
        break;
      case 7: // startHeader -> HEADER
#line 50 "StepP21Parser.y"
    {InHeader=true; BeginHeader();}
#line default
        break;
      case 14: // stepFile -> model
#line 61 "StepP21Parser.y"
         { EndParse(); }
#line default
        break;
      case 15: // endSec -> ENDSEC
#line 64 "StepP21Parser.y"
               {EndSec();}
#line default
        break;
      case 16: // endSec -> ENDSEC, trailingSpace
#line 65 "StepP21Parser.y"
                        {EndSec();}
#line default
        break;
      case 19: // headerEntity -> entityType, listArgument, ';'
#line 71 "StepP21Parser.y"
                                           {EndHeaderEntity();}
#line default
        break;
      case 21: // endOfHeader -> DATA
#line 75 "StepP21Parser.y"
 {  InHeader=false; EndHeader();  }
#line default
        break;
      case 22: // argument -> IDENTITY
#line 78 "StepP21Parser.y"
                            {SetObjectValue(CurrentSemanticValue.strVal);}
#line default
        break;
      case 23: // argument -> INTEGER
#line 79 "StepP21Parser.y"
                        {SetIntegerValue(CurrentSemanticValue.strVal);}
#line default
        break;
      case 24: // argument -> FLOAT
#line 80 "StepP21Parser.y"
                          {SetFloatValue(CurrentSemanticValue.strVal);}
#line default
        break;
      case 25: // argument -> STRING
#line 81 "StepP21Parser.y"
                       {SetStringValue(CurrentSemanticValue.strVal);}
#line default
        break;
      case 26: // argument -> MLSTRING
#line 82 "StepP21Parser.y"
                         {SetStringValue(CurrentSemanticValue.strVal);}
#line default
        break;
      case 27: // argument -> INVALIDSTRING
#line 83 "StepP21Parser.y"
                          {SetInvalidStringValue(CurrentSemanticValue.strVal);}
#line default
        break;
      case 28: // argument -> BOOLEAN
#line 84 "StepP21Parser.y"
                        {SetBooleanValue(CurrentSemanticValue.strVal);}
#line default
        break;
      case 29: // argument -> ENUM
#line 85 "StepP21Parser.y"
                         {SetEnumValue(CurrentSemanticValue.strVal);}
#line default
        break;
      case 30: // argument -> HEXA
#line 86 "StepP21Parser.y"
                         {SetHexValue(CurrentSemanticValue.strVal);}
#line default
        break;
      case 31: // argument -> NONDEF
#line 87 "StepP21Parser.y"
                       {SetNonDefinedValue();}
#line default
        break;
      case 32: // argument -> OVERRIDE
#line 88 "StepP21Parser.y"
                         {SetOverrideValue();}
#line default
        break;
      case 34: // argument -> listType, listArgument
#line 90 "StepP21Parser.y"
                          {EndNestedType(CurrentSemanticValue.strVal);}
#line default
        break;
      case 35: // listType -> TYPE
#line 94 "StepP21Parser.y"
 {  BeginNestedType(CurrentSemanticValue.strVal);  }
#line default
        break;
      case 36: // beginList -> '('
#line 97 "StepP21Parser.y"
 {  BeginList(); }
#line default
        break;
      case 37: // endList -> ')'
#line 100 "StepP21Parser.y"
 { EndList(); }
#line default
        break;
      case 43: // argumentList -> argumentList, error
#line 108 "StepP21Parser.y"
                      {SetErrorMessage();}
#line default
        break;
      case 46: // bloc -> entityLabel, '=', entity, ';'
#line 113 "StepP21Parser.y"
                                  {EndEntity();}
#line default
        break;
      case 47: // bloc -> entityLabel, '=', beginScope, model, endScope, entity, ';'
#line 114 "StepP21Parser.y"
                                                       {EndEntity();}
#line default
        break;
      case 48: // bloc -> entityLabel, '=', beginScope, endScope, entity, ';'
#line 115 "StepP21Parser.y"
                                                 {EndEntity();}
#line default
        break;
      case 49: // bloc -> error
#line 116 "StepP21Parser.y"
          {SetErrorMessage();EndEntity();}
#line default
        break;
      case 55: // uniqueID -> IDENTITY
#line 128 "StepP21Parser.y"
 {   SetObjectValue(CurrentSemanticValue.strVal);  }
#line default
        break;
      case 58: // beginExport -> '/'
#line 134 "StepP21Parser.y"
 {  BeginList();  }
#line default
        break;
      case 61: // entityLabel -> ENTITY
#line 143 "StepP21Parser.y"
 {  NewEntity(CurrentSemanticValue.strVal);  }
#line default
        break;
      case 62: // entityType -> TYPE
#line 146 "StepP21Parser.y"
 {  SetType(CurrentSemanticValue.strVal);  }
#line default
        break;
      case 63: // entityType -> ILLEGALCHAR
#line 149 "StepP21Parser.y"
 {  CharacterError();  }
#line default
        break;
    }
#pragma warning restore 162, 1522
  }

  protected override string TerminalToString(int terminal)
  {
    if (aliases != null && aliases.ContainsKey(terminal))
        return aliases[terminal];
    else if (((Tokens)terminal).ToString() != terminal.ToString(CultureInfo.InvariantCulture))
        return ((Tokens)terminal).ToString();
    else
        return CharToString((char)terminal);
  }

#line 153 "StepP21Parser.y"


#line default
}
}
