parser.cpp File Reference

#include <iostream>
#include <string>
#include <map>
#include "vhdVRMLParser/stdafx.h"
#include "vhdVRMLParser/parser.h"
#include "vhdVRMLParser/Scene.h"
#include "vhdVRMLParser/Element.h"
#include "vhdVRMLParser/EventIn.h"
#include "vhdVRMLParser/EventOut.h"
#include "vhdVRMLParser/ExposedField.h"
#include "vhdVRMLParser/Field.h"
#include "vhdVRMLParser/FieldValue.h"
#include "vhdVRMLParser/MFColor.h"
#include "vhdVRMLParser/MFFloat.h"
#include "vhdVRMLParser/MFInt32.h"
#include "vhdVRMLParser/MFNode.h"
#include "vhdVRMLParser/MFRotation.h"
#include "vhdVRMLParser/MFString.h"
#include "vhdVRMLParser/MFTime.h"
#include "vhdVRMLParser/MFVec2f.h"
#include "vhdVRMLParser/MFVec3f.h"
#include "vhdVRMLParser/Node.h"
#include "vhdVRMLParser/Proto.h"
#include "vhdVRMLParser/NodeScript.h"
#include "vhdVRMLParser/SFBool.h"
#include "vhdVRMLParser/SFColor.h"
#include "vhdVRMLParser/SFFloat.h"
#include "vhdVRMLParser/SFImage.h"
#include "vhdVRMLParser/SFInt32.h"
#include "vhdVRMLParser/SFNode.h"
#include "vhdVRMLParser/SFRotation.h"
#include "vhdVRMLParser/SFString.h"
#include "vhdVRMLParser/SFTime.h"
#include "vhdVRMLParser/SFVec2f.h"
#include "vhdVRMLParser/SFVec3f.h"
#include "vhdVRMLParser/Stack.h"

Classes

union  YYSTYPE
union  yyalloc

Defines

#define YYBISON   1
#define YYBISON_VERSION   "2.1"
#define YYSKELETON_NAME   "yacc.c"
#define YYPURE   0
#define YYLSP_NEEDED   0
#define ID   258
#define STRING   259
#define INT   260
#define FLOAT   261
#define SCRIPT   262
#define DEF   263
#define EXTERNPROTO   264
#define FALSE_TOK   265
#define IS   266
#define NULL_TOK   267
#define PROTO   268
#define ROUTE   269
#define TO   270
#define TRUE_TOK   271
#define USE   272
#define EVENT_IN   273
#define EVENT_OUT   274
#define EXPOSED_FIELD   275
#define FIELD   276
#define FBUG   0
#define SYMB(id)   (scene->getSymbol(id))
#define YYDEBUG   0
#define YYERROR_VERBOSE   0
#define YYTOKEN_TABLE   0
#define yystype   YYSTYPE
#define YYSTYPE_IS_DECLARED   1
#define YYSTYPE_IS_TRIVIAL   1
#define YYSIZE_T   unsigned int
#define YY_(msgid)   msgid
#define YYSTACK_ALLOC   YYMALLOC
#define YYSTACK_FREE   YYFREE
#define YYSTACK_ALLOC_MAXIMUM   ((YYSIZE_T) -1)
#define YYMALLOC   malloc
#define YYFREE   free
#define YYSTACK_GAP_MAXIMUM   (sizeof (union yyalloc) - 1)
#define YYSTACK_BYTES(N)
#define YYCOPY(To, From, Count)
#define YYSTACK_RELOCATE(Stack)
#define YYFINAL   4
#define YYLAST   149
#define YYNTOKENS   27
#define YYNNTS   41
#define YYNRULES   84
#define YYNSTATES   151
#define YYUNDEFTOK   2
#define YYMAXUTOK   276
#define YYTRANSLATE(YYX)   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
#define YYPACT_NINF   -121
#define YYTABLE_NINF   -1
#define yyerrok   (yyerrstatus = 0)
#define yyclearin   (yychar = YYEMPTY)
#define YYEMPTY   (-2)
#define YYEOF   0
#define YYACCEPT   goto yyacceptlab
#define YYABORT   goto yyabortlab
#define YYERROR   goto yyerrorlab
#define YYFAIL   goto yyerrlab
#define YYRECOVERING()   (!!yyerrstatus)
#define YYBACKUP(Token, Value)
#define YYTERROR   1
#define YYERRCODE   256
#define YYRHSLOC(Rhs, K)   ((Rhs)[K])
#define YYLLOC_DEFAULT(Current, Rhs, N)
#define YY_LOCATION_PRINT(File, Loc)   ((void) 0)
#define YYLEX   yylex ()
#define YYDPRINTF(Args)
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
#define YY_STACK_PRINT(Bottom, Top)
#define YY_REDUCE_PRINT(Rule)
#define YYINITDEPTH   200
#define YYMAXDEPTH   10000
#define YYPOPSTACK   (yyvsp--, yyssp--)

Typedefs

typedef short int yysigned_char

Enumerations

enum  yytokentype {
  ID = 258, STRING = 259, INT = 260, FLOAT = 261,
  SCRIPT = 262, DEF = 263, EXTERNPROTO = 264, FALSE_TOK = 265,
  IS = 266, NULL_TOK = 267, PROTO = 268, ROUTE = 269,
  TO = 270, TRUE_TOK = 271, USE = 272, EVENT_IN = 273,
  EVENT_OUT = 274, EXPOSED_FIELD = 275, FIELD = 276
}

Functions

static void route (const std::string &srcNode, const std::string &srcField, const std::string &dstNode, const std::string &dstField)
static NodenewNode (const std::string &nodeType)
static int checkField (Node *node, const std::string &fieldName)
static void setField (Node *node, int index, FieldValue *value)
static void isField (Node *node, const std::string &fieldName, const std::string &isName)
static FieldValueintsToType (IntArray *floats, int type)
static FieldValuefloatsToType (FloatArray *floats, int type)
static FloatArrayintsToFloats (IntArray *ints)
static FieldValueemptyMF (int type)
static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg
int yyparse ()

Variables

Scenescene
FILE * inputFile
int lineno = 1
static Stack< Node * > nodeStack
static Stack< Proto * > protoStack
static int defName = -1
static int currentType
static const unsigned char yytranslate []
static const unsigned char yyr1 []
static const unsigned char yyr2 []
static const unsigned char yydefact []
static const short int yydefgoto []
static const short int yypact []
static const yysigned_char yypgoto []
static const unsigned char yytable []
static const unsigned char yycheck []
static const unsigned char yystos []
int yytype
YYSTYPEyyvaluep
int yychar
YYSTYPE yylval
int yynerrs

Define Documentation

#define DEF   263

#define EVENT_IN   273

#define EVENT_OUT   274

#define EXPOSED_FIELD   275

#define EXTERNPROTO   264

#define FALSE_TOK   265

#define FBUG   0

#define FIELD   276

#define FLOAT   261

#define ID   258

#define INT   260

#define IS   266

#define NULL_TOK   267

#define PROTO   268

#define ROUTE   269

#define SCRIPT   262

#define STRING   259

#define SYMB ( id   )     (scene->getSymbol(id))

#define TO   270

#define TRUE_TOK   271

#define USE   272

#define YY_ ( msgid   )     msgid

#define YY_LOCATION_PRINT ( File,
Loc   )     ((void) 0)

#define YY_REDUCE_PRINT ( Rule   ) 

#define YY_STACK_PRINT ( Bottom,
Top   ) 

#define YY_SYMBOL_PRINT ( Title,
Type,
Value,
Location   ) 

#define YYABORT   goto yyabortlab

#define YYACCEPT   goto yyacceptlab

#define YYBACKUP ( Token,
Value   ) 

Value:

do                                                              \
  if (yychar == YYEMPTY && yylen == 1)                          \
    {                                                           \
      yychar = (Token);                                         \
      yylval = (Value);                                         \
      yytoken = YYTRANSLATE (yychar);                           \
      YYPOPSTACK;                                               \
      goto yybackup;                                            \
    }                                                           \
  else                                                          \
    {                                                           \
      yyerror (YY_("syntax error: cannot back up")); \
      YYERROR;                                                  \
    }                                                           \
while (0)

#define YYBISON   1

#define YYBISON_VERSION   "2.1"

#define yyclearin   (yychar = YYEMPTY)

#define YYCOPY ( To,
From,
Count   ) 

Value:

do                                      \
        {                                       \
          YYSIZE_T yyi;                         \
          for (yyi = 0; yyi < (Count); yyi++)   \
            (To)[yyi] = (From)[yyi];            \
        }                                       \
      while (0)

#define YYDEBUG   0

#define YYDPRINTF ( Args   ) 

#define YYEMPTY   (-2)

#define YYEOF   0

#define YYERRCODE   256

#define yyerrok   (yyerrstatus = 0)

#define YYERROR   goto yyerrorlab

#define YYERROR_VERBOSE   0

#define YYFAIL   goto yyerrlab

#define YYFINAL   4

#define YYFREE   free

#define YYINITDEPTH   200

#define YYLAST   149

#define YYLEX   yylex ()

#define YYLLOC_DEFAULT ( Current,
Rhs,
 ) 

Value:

do                                                                      \
      if (N)                                                            \
        {                                                               \
          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
        }                                                               \
      else                                                              \
        {                                                               \
          (Current).first_line   = (Current).last_line   =              \
            YYRHSLOC (Rhs, 0).last_line;                                \
          (Current).first_column = (Current).last_column =              \
            YYRHSLOC (Rhs, 0).last_column;                              \
        }                                                               \
    while (0)

#define YYLSP_NEEDED   0

#define YYMALLOC   malloc

#define YYMAXDEPTH   10000

#define YYMAXUTOK   276

#define YYNNTS   41

#define YYNRULES   84

#define YYNSTATES   151

#define YYNTOKENS   27

#define YYPACT_NINF   -121

#define YYPOPSTACK   (yyvsp--, yyssp--)

#define YYPURE   0

 
#define YYRECOVERING (  )     (!!yyerrstatus)

#define YYRHSLOC ( Rhs,
 )     ((Rhs)[K])

#define YYSIZE_T   unsigned int

#define YYSKELETON_NAME   "yacc.c"

#define YYSTACK_ALLOC   YYMALLOC

#define YYSTACK_ALLOC_MAXIMUM   ((YYSIZE_T) -1)

#define YYSTACK_BYTES (  ) 

Value:

((N) * (sizeof (short int) + sizeof (YYSTYPE))                  \
      + YYSTACK_GAP_MAXIMUM)

#define YYSTACK_FREE   YYFREE

#define YYSTACK_GAP_MAXIMUM   (sizeof (union yyalloc) - 1)

#define YYSTACK_RELOCATE ( Stack   ) 

Value:

do                                                                      \
      {                                                                 \
        YYSIZE_T yynewbytes;                                            \
        YYCOPY (&yyptr->Stack, Stack, yysize);                          \
        Stack = &yyptr->Stack;                                          \
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
        yyptr += yynewbytes / sizeof (*yyptr);                          \
      }                                                                 \
    while (0)

#define yystype   YYSTYPE

#define YYSTYPE_IS_DECLARED   1

#define YYSTYPE_IS_TRIVIAL   1

#define YYTABLE_NINF   -1

#define YYTERROR   1

#define YYTOKEN_TABLE   0

#define YYTRANSLATE ( YYX   )     ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

#define YYUNDEFTOK   2


Typedef Documentation

typedef short int yysigned_char


Enumeration Type Documentation

enum yytokentype

Enumerator:
ID 
STRING 
INT 
FLOAT 
SCRIPT 
DEF 
EXTERNPROTO 
FALSE_TOK 
IS 
NULL_TOK 
PROTO 
ROUTE 
TO 
TRUE_TOK 
USE 
EVENT_IN 
EVENT_OUT 
EXPOSED_FIELD 
FIELD 


Function Documentation

static int checkField ( Node node,
const std::string &  fieldName 
) [static]

static FieldValue* emptyMF ( int  type  )  [static]

static FieldValue* floatsToType ( FloatArray floats,
int  type 
) [static]

static FloatArray* intsToFloats ( IntArray ints  )  [static]

static FieldValue* intsToType ( IntArray floats,
int  type 
) [static]

static void isField ( Node node,
const std::string &  fieldName,
const std::string &  isName 
) [static]

static Node* newNode ( const std::string &  nodeType  )  [static]

static void route ( const std::string &  srcNode,
const std::string &  srcField,
const std::string &  dstNode,
const std::string &  dstField 
) [static]

static void setField ( Node node,
int  index,
FieldValue value 
) [static]

static void yydestruct ( yymsg  ,
yytype  ,
yyvaluep   
) const [static]

int yyparse (  ) 


Variable Documentation

int currentType [static]

int defName = -1 [static]

FILE* inputFile

int lineno = 1

Stack<Node *> nodeStack [static]

Stack<Proto *> protoStack [static]

Scene* scene

int yychar

const unsigned char yycheck[] [static]

Initial value:

{
       2,    35,   122,    28,    10,    11,     3,    41,    33,     4,
       7,     3,    37,    38,     5,     6,     0,     9,    44,    45,
      24,    13,    14,     4,     3,   145,    18,    19,    23,    21,
       9,     4,    23,    25,    13,    14,     3,     4,     5,     6,
       7,     8,    23,     3,     5,     6,    25,     7,     8,    22,
      17,    57,    78,    79,    80,    81,    23,    17,    84,    85,
      86,     3,    23,    23,     3,     4,     5,     6,     7,     8,
      72,    10,    11,    12,     3,     3,    35,    16,    17,     7,
       8,     9,    41,    22,    24,    13,    14,     5,     6,    17,
      26,     3,    22,   118,     3,     7,     8,     9,     5,     6,
     102,    13,    22,   137,     3,    17,     3,    18,    19,    20,
      21,    15,    23,    18,    19,    20,    21,    11,    23,     8,
       9,     3,     3,     3,    24,    26,    11,    11,     3,     3,
       3,     3,     3,    25,     4,   137,     3,     3,     3,     3,
       3,     3,    55,   146,   112,    41,    29,    72,   150,    72
}

const unsigned char yydefact[] [static]

Initial value:

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

const short int yydefgoto[] [static]

Initial value:

{
      -1,     1,     2,    12,    73,    29,    14,   137,    15,    31,
     138,    55,    48,    94,    89,   136,    16,    30,    53,    83,
      17,   113,     3,    18,    33,    28,    41,    35,    50,    51,
      52,    22,    19,    62,    74,    75,    76,    77,   114,   101,
     102
}

YYSTYPE yylval

int yynerrs

const short int yypact[] [static]

Initial value:

{
    -121,    16,    72,  -121,  -121,  -121,    -4,    58,    71,    71,
      58,    58,  -121,  -121,  -121,  -121,  -121,  -121,  -121,    60,
    -121,  -121,  -121,  -121,  -121,    64,  -121,  -121,  -121,     3,
      70,    80,    91,  -121,  -121,     8,  -121,  -121,  -121,    96,
    -121,    21,   106,   101,   101,   101,  -121,  -121,  -121,  -121,
    -121,  -121,    61,    89,  -121,    95,  -121,    58,  -121,  -121,
     103,  -121,   118,   119,  -121,  -121,  -121,  -121,  -121,   120,
    -121,  -121,    33,  -121,  -121,  -121,    82,    93,   101,   101,
     101,   101,    27,  -121,   101,   101,   101,   100,  -121,  -121,
      99,  -121,   115,   116,   125,  -121,  -121,  -121,  -121,     9,
      39,     5,    40,  -121,  -121,  -121,  -121,   126,   127,   128,
     129,  -121,   130,  -121,  -121,   133,   134,  -121,  -121,   135,
     136,   137,    61,  -121,  -121,  -121,  -121,  -121,  -121,  -121,
    -121,  -121,  -121,    19,  -121,  -121,   138,    88,   108,  -121,
    -121,  -121,  -121,  -121,  -121,    61,  -121,  -121,  -121,  -121,
      72
}

const yysigned_char yypgoto[] [static]

Initial value:

{
    -121,  -121,    -3,  -121,    -2,  -121,   -34,  -121,  -121,  -121,
    -121,  -121,    87,  -121,  -121,  -121,  -121,  -121,  -121,  -121,
      41,  -121,   -25,   117,  -121,  -121,  -121,  -121,  -121,   104,
    -121,    -6,   111,   -26,  -120,  -121,    75,    77,  -121,    32,
    -121
}

const unsigned char yyr1[] [static]

Initial value:

{
       0,    27,    28,    29,    29,    30,    30,    30,    31,    32,
      31,    31,    33,    33,    34,    34,    36,    35,    37,    38,
      38,    39,    39,    40,    39,    41,    42,    41,    44,    43,
      45,    45,    46,    46,    46,    46,    47,    48,    49,    51,
      50,    52,    50,    53,    53,    54,    54,    55,    55,    55,
      55,    56,    56,    56,    56,    57,    58,    59,    60,    61,
      61,    61,    61,    61,    61,    61,    61,    61,    61,    61,
      61,    62,    62,    63,    63,    64,    64,    64,    64,    65,
      65,    66,    66,    67,    67
}

const unsigned char yyr2[] [static]

Initial value:

{
       0,     2,     1,     2,     1,     1,     1,     1,     1,     0,
       4,     2,     1,     1,     2,     1,     0,     9,     3,     2,
       1,     3,     3,     0,     5,     1,     0,     5,     0,     7,
       2,     1,     3,     3,     3,     3,     8,     1,     0,     0,
       5,     0,     5,     2,     1,     2,     1,     1,     1,     5,
       5,     2,     3,     1,     1,     1,     1,     1,     1,     1,
       1,     3,     1,     1,     3,     1,     1,     3,     3,     2,
       2,     1,     1,     2,     1,     2,     2,     2,     1,     1,
       3,     1,     2,     1,     2
}

const unsigned char yystos[] [static]

Initial value:

{
       0,    28,    29,    49,     0,     3,     7,     8,     9,    13,
      14,    17,    30,    31,    33,    35,    43,    47,    50,    59,
      24,     3,    58,    59,    59,    58,    58,    24,    52,    32,
      44,    36,    26,    51,    49,    54,    50,    22,    22,     3,
      49,    53,     3,    18,    19,    21,    25,    33,    39,    47,
      55,    56,    57,    45,    49,    38,    49,    15,    25,    56,
      11,     3,    60,    60,    60,     4,     5,     6,    10,    11,
      12,    16,    22,    31,    61,    62,    63,    64,    18,    19,
      20,    21,    23,    46,    18,    19,    20,    23,    39,    41,
      58,     3,     3,     3,    40,     3,     4,    23,    31,    63,
      64,    66,    67,     5,     6,     5,     6,    60,    60,    60,
      60,     4,    22,    48,    65,    60,    60,    60,    24,    26,
      11,    11,     3,    23,    23,     4,    23,    23,    31,     3,
       3,     3,     3,    66,     3,     3,    42,    34,    37,    49,
       3,     3,     3,    61,    23,     3,    31,    33,    25,    61,
      29
}

const unsigned char yytable[] [static]

Initial value:

{
      13,    47,   143,    34,    25,    26,     5,    47,    40,   125,
       6,    42,    54,    56,   103,   104,     4,     8,    63,    64,
      20,     9,    10,   125,    42,   149,    43,    44,   126,    45,
       8,   111,   123,    46,     9,    10,     5,    96,    66,    67,
       6,     7,   144,     5,   105,   106,    58,     6,     7,   112,
      11,    90,   107,   108,   109,   110,    97,    11,   115,   116,
     117,    21,   124,   127,     5,    65,    66,    67,     6,     7,
      98,    68,    69,    70,     5,     5,    49,    71,    11,     6,
       7,     8,    49,    72,    27,     9,    10,   103,   104,    11,
      32,     5,    37,   139,    39,     6,     7,     8,   105,   106,
     128,     9,    38,   147,    61,    11,    91,    78,    79,    80,
      81,    57,    82,    84,    85,    86,    45,    60,    87,    23,
      24,    92,    93,    95,   118,   119,   120,   121,   122,   129,
     130,   131,   132,   148,    96,   146,   134,   135,   140,   141,
     142,   145,    88,   150,   133,    59,    36,    99,    13,   100
}

const unsigned char yytranslate[] [static]

int yytype

YYSTYPE* yyvaluep


Generated on Thu Jan 18 10:06:09 2007 for vhdPLUS by  doxygen 1.5.1-p1