10#ifndef vtkVRMLImporter_Yacc_h
11#define vtkVRMLImporter_Yacc_h
30VTK_ABI_NAMESPACE_BEGIN
37 void*
operator new(
size_t n)
39 return vtkVRMLAllocator::AllocateMemory(n);
42 void operator delete(
void *vtkNotUsed(ptr)) {}
59 void addField(
const char *name,
int type);
64 int hasField(
const char *name)
const;
67 const char *
getName()
const {
return name; }
69 void*
operator new(
size_t n)
71 return vtkVRMLAllocator::AllocateMemory(n);
74 void operator delete(
void *vtkNotUsed(ptr)) {}
80 void*
operator new(
size_t n)
82 return vtkVRMLAllocator::AllocateMemory(n);
85 void operator delete(
void *vtkNotUsed(ptr)) {}
99 void add(vtkVRMLVectorType<NameTypeRec*> &,
const char *,
int);
100 int has(
const vtkVRMLVectorType<NameTypeRec*> &,
const char *)
const;
104 vtkVRMLVectorType<NameTypeRec*> eventIns;
105 vtkVRMLVectorType<NameTypeRec*> eventOuts;
106 vtkVRMLVectorType<NameTypeRec*> fields;
129 int addField(
const char *type,
const char *name);
130 int addEventIn(
const char *type,
const char *name);
131 int addEventOut(
const char *type,
const char *name);
310 vtkVRMLVectorType<vtkVRMLUseStruct *>*
useList;
337 assert(nm !=
nullptr);
338 name =
static_cast<char*
>(
339 vtkVRMLAllocator::AllocateMemory((strlen(nm)+1)*
sizeof(
char)));
348 for (i = 0;i < eventIns.Count(); i++)
354 for (i = 0;i < eventOuts.Count(); i++)
360 for (i = 0;i < fields.Count(); i++)
370 add(eventIns, nodeName, type);
375 add(eventOuts, nodeName, type);
380 add(fields, nodeName, type);
385 size_t length = 20 + strlen(nodeName);
386 std::vector<char> tmp(length);
387 add(fields, nodeName, type);
388 snprintf(tmp.data(), length,
"set_%s", nodeName);
389 add(eventIns, tmp.data(), type);
390 snprintf(tmp.data(), length,
"%s_changed", nodeName);
391 add(eventOuts, tmp.data(), type);
395VrmlNodeType::add(vtkVRMLVectorType<NameTypeRec*> &recs,
const char *nodeName,
int type)
397 NameTypeRec *r =
new NameTypeRec;
398 r->name = vtkVRMLAllocator::StrDup(nodeName);
406 return has(eventIns, nodeName);
411 return has(eventOuts, nodeName);
416 return has(fields, nodeName);
424 if ( (type = has(fields, nodeName)) == 0)
return 0;
426 if (type != has(eventIns, nodeName))
return 0;
428 if (type != has(eventOuts, nodeName))
return 0;
433VrmlNodeType::has(
const vtkVRMLVectorType<NameTypeRec*> &recs,
const char *nodeName)
const
435 for (
int i = 0;i < recs.Count(); i++)
437 NameTypeRec *n = recs.Get(i);
438 if (strcmp(n->name, nodeName) == 0)
487 cerr <<
"PROTO " << _type->
getName() <<
" already defined\n";
506 for (
int i = 0;i <
typeList->Count(); i++)
510 if (nodeType ==
nullptr)
528 for (
int i = 0;i <
typeList->Count(); i++)
531 if (nt !=
nullptr && strcmp(nt->
getName(),_name) == 0)
548#define IDENTIFIER 258
552#define EXTERNPROTO 262
560#define EXPOSEDFIELD 270
567#define SFROTATION 277
575#define MFROTATION 285
634#define YYLTYPE yyltype
641#define YYTRANSLATE(x) ((unsigned)(x) <= 289 ? yytranslate[x] : 68)
644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
648 2, 2, 2, 2, 2, 39, 2, 2, 2, 2,
649 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
653 35, 2, 36, 2, 2, 2, 2, 2, 2, 2,
654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
656 2, 2, 37, 2, 38, 2, 2, 2, 2, 2,
657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
662 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
663 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
664 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
665 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
666 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
667 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
668 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
669 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
670 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
671 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
672 26, 27, 28, 29, 30, 31, 32, 33, 34
676static const short yyprhs[] = { 0,
677 0, 2, 3, 6, 8, 10, 12, 14, 15, 16,
678 22, 25, 27, 29, 30, 40, 41, 42, 51, 52,
679 55, 59, 63, 64, 70, 71, 77, 78, 81, 85,
680 89, 93, 97, 106, 107, 113, 114, 117, 118, 122,
681 124, 126, 130, 134, 135, 141, 147, 153, 155, 157,
682 159, 161, 163, 165, 167, 169, 171, 173, 175, 177,
683 179, 181, 183, 185, 187, 190, 193, 196, 199, 203,
687static const short yyrhs[] = { 41,
688 0, 0, 41, 42, 0, 43, 0, 46, 0, 58,
689 0, 59, 0, 0, 0, 4, 44, 3, 45, 59,
690 0, 5, 3, 0, 47, 0, 49, 0, 0, 6,
691 3, 48, 35, 52, 36, 37, 41, 38, 0, 0,
692 0, 7, 3, 50, 35, 56, 36, 51, 65, 0,
693 0, 52, 53, 0, 12, 3, 3, 0, 13, 3,
694 3, 0, 0, 14, 3, 3, 54, 65, 0, 0,
695 15, 3, 3, 55, 65, 0, 0, 56, 57, 0,
696 12, 3, 3, 0, 13, 3, 3, 0, 14, 3,
697 3, 0, 15, 3, 3, 0, 10, 3, 39, 3,
698 8, 3, 39, 3, 0, 0, 3, 60, 37, 61,
699 38, 0, 0, 61, 62, 0, 0, 3, 63, 65,
700 0, 58, 0, 46, 0, 12, 3, 3, 0, 13,
701 3, 3, 0, 0, 14, 3, 3, 64, 65, 0,
702 12, 3, 3, 9, 3, 0, 13, 3, 3, 9,
703 3, 0, 16, 0, 17, 0, 27, 0, 18, 0,
704 28, 0, 19, 0, 20, 0, 29, 0, 22, 0,
705 30, 0, 23, 0, 31, 0, 24, 0, 25, 0,
706 32, 0, 26, 0, 33, 0, 21, 43, 0, 21,
707 11, 0, 34, 66, 0, 9, 3, 0, 35, 67,
708 36, 0, 43, 0, 0, 67, 43, 0
714static const short yyrline[] = { 0,
715 106, 109, 111, 114, 116, 117, 120, 122, 123, 124,
716 125, 128, 130, 133, 135, 139, 141, 143, 145, 147,
717 150, 153, 155, 157, 158, 160, 163, 165, 168, 171,
718 173, 175, 179, 184, 186, 189, 191, 194, 196, 197,
719 198, 201, 202, 203, 206, 207, 209, 213, 215, 216,
720 217, 218, 219, 220, 221, 222, 223, 224, 225, 226,
721 227, 228, 229, 230, 232, 233, 234, 235, 238, 240,
725static const char *
const yytname[] = {
"$",
"error",
"$undefined.",
"IDENTIFIER",
726 "DEF",
"USE",
"PROTO",
"EXTERNPROTO",
"TO",
"IS",
"ROUTE",
"SFN_NULL",
"EVENTIN",
"EVENTOUT",
727 "FIELD",
"EXPOSEDFIELD",
"SFBOOL",
"SFCOLOR",
"SFFLOAT",
"SFIMAGE",
"SFINT32",
"SFNODE",
728 "SFROTATION",
"SFSTRING",
"SFTIME",
"SFVEC2F",
"SFVEC3F",
"MFCOLOR",
"MFFLOAT",
"MFINT32",
729 "MFROTATION",
"MFSTRING",
"MFVEC2F",
"MFVEC3F",
"MFNODE",
"'['",
"']'",
"'{'",
"'}'",
730 "'.'",
"vrmlscene",
"declarations",
"declaration",
"nodeDeclaration",
"@1",
"@2",
"protoDeclaration",
731 "proto",
"@3",
"externproto",
"@4",
"@5",
"interfaceDeclarations",
"interfaceDeclaration",
732 "@6",
"@7",
"externInterfaceDeclarations",
"externInterfaceDeclaration",
"routeDeclaration",
733 "node",
"@8",
"nodeGuts",
"nodeGut",
"@9",
"@10",
"fieldValue",
"mfnodeValue",
"nodes",
738static const short yyr1[] = { 0,
739 40, 41, 41, 42, 42, 42, 43, 44, 45, 43,
740 43, 46, 46, 48, 47, 50, 51, 49, 52, 52,
741 53, 53, 54, 53, 55, 53, 56, 56, 57, 57,
742 57, 57, 58, 60, 59, 61, 61, 63, 62, 62,
743 62, 62, 62, 64, 62, 62, 62, 65, 65, 65,
744 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
745 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
749static const short yyr2[] = { 0,
750 1, 0, 2, 1, 1, 1, 1, 0, 0, 5,
751 2, 1, 1, 0, 9, 0, 0, 8, 0, 2,
752 3, 3, 0, 5, 0, 5, 0, 2, 3, 3,
753 3, 3, 8, 0, 5, 0, 2, 0, 3, 1,
754 1, 3, 3, 0, 5, 5, 5, 1, 1, 1,
755 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
756 1, 1, 1, 1, 2, 2, 2, 2, 3, 1,
761 1, 34, 8, 0, 0, 0, 0, 3, 4, 5,
762 12, 13, 6, 7, 0, 0, 11, 14, 16, 0,
763 36, 9, 0, 0, 0, 0, 0, 19, 27, 0,
764 38, 0, 0, 0, 35, 41, 40, 37, 10, 0,
765 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
766 0, 20, 0, 0, 0, 0, 17, 28, 0, 0,
767 48, 49, 51, 53, 54, 0, 56, 58, 60, 61,
768 63, 50, 52, 55, 57, 59, 62, 64, 0, 39,
769 42, 43, 44, 0, 0, 0, 0, 2, 0, 0,
770 0, 0, 0, 0, 68, 66, 65, 71, 70, 67,
771 0, 0, 0, 21, 22, 23, 25, 0, 29, 30,
772 31, 32, 18, 33, 0, 46, 47, 45, 0, 0,
773 15, 69, 72, 24, 26, 0, 0, 0
777 1, 8, 9, 16, 27, 10, 11, 23, 12, 24,
778 93, 40, 52, 119, 120, 41, 58, 13, 14, 15,
779 26, 38, 43, 103, 80, 100, 115
783 79,-32768,-32768, -1, 0, 3, 4,-32768,-32768,-32768,
784 -32768,-32768,-32768,-32768, -28, 11,-32768,-32768,-32768, -18,
785 -32768,-32768, -6, 5, 32, -2, 38,-32768,-32768, 35,
786 -32768, 39, 41, 45,-32768,-32768,-32768,-32768,-32768, 19,
787 66, 48, 43, 50, 51, 54, 84, 85, 87, 88,
788 55,-32768, 90, 91, 92, 93,-32768,-32768, 58, 95,
789 -32768,-32768,-32768,-32768,-32768, 34,-32768,-32768,-32768,-32768,
790 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 23,-32768,
791 94, 96,-32768, 97, 98, 101, 103,-32768, 104, 105,
792 106, 107, 43, 108,-32768,-32768,-32768,-32768,-32768,-32768,
793 109, 110, 43,-32768,-32768,-32768,-32768, 12,-32768,-32768,
794 -32768,-32768,-32768,-32768, 20,-32768,-32768,-32768, 43, 43,
795 -32768,-32768,-32768,-32768,-32768, 99, 114,-32768
799 27,-32768, -66,-32768,-32768, 100,-32768,-32768,-32768,-32768,
800 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 102, 89,-32768,
801 -32768,-32768,-32768,-32768, -73,-32768,-32768
809 31, 17, 18, 5, 6, 19, 20, 7, 21, 32,
810 33, 34, 99, 22, 2, 3, 4, 5, 6, 113,
811 25, 7, 2, 3, 4, 2, 3, 4, 28, 118,
812 47, 48, 49, 50, 30, 35, 2, 3, 4, 29,
813 2, 44, 42, 45, 96, 124, 125, 46, 123, 121,
814 59, 60, 81, 82, 51, 122, 83, 98, 61, 62,
815 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
816 73, 74, 75, 76, 77, 78, 79, 53, 54, 55,
817 56, 2, 3, 4, 5, 6, 84, 85, 7, 86,
818 87, 88, 89, 90, 91, 92, 94, 95, 127, 104,
819 105, 57, 101, 106, 102, 107, 109, 110, 111, 112,
820 114, 116, 117, 128, 108, 39, 0, 0, 0, 0,
821 0, 0, 0, 0, 0, 36, 0, 37
825 3, 3, 3, 6, 7, 3, 3, 10, 37, 12,
826 13, 14, 79, 3, 3, 4, 5, 6, 7, 93,
827 39, 10, 3, 4, 5, 3, 4, 5, 35, 103,
828 12, 13, 14, 15, 3, 38, 3, 4, 5, 35,
829 3, 3, 8, 3, 11, 119, 120, 3, 115, 38,
830 3, 9, 3, 3, 36, 36, 3, 35, 16, 17,
831 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
832 28, 29, 30, 31, 32, 33, 34, 12, 13, 14,
833 15, 3, 4, 5, 6, 7, 3, 3, 10, 3,
834 3, 37, 3, 3, 3, 3, 39, 3, 0, 3,
835 3, 36, 9, 3, 9, 3, 3, 3, 3, 3,
836 3, 3, 3, 0, 88, 27, -1, -1, -1, -1,
837 -1, -1, -1, -1, -1, 26, -1, 26
860VTK_ABI_NAMESPACE_BEGIN
867 for(list_type::iterator it = this->m_allocs.begin();
868 it != this->m_allocs.end(); ++it)
875 void *rval = malloc(size);
876 m_allocs.push_back(rval);
891#define yyerrok (yyerrstatus = 0)
892#define yyclearin (yychar = YYEMPTY)
895#define YYACCEPT return(0)
896#define YYABORT return(1)
897#define YYERROR goto yyerrlab1
902#define YYFAIL goto yyerrlab
903#define YYRECOVERING() (!!yyerrstatus)
904#define YYBACKUP(token, value) \
906 if (yychar == YYEMPTY && yylen == 1) \
907 { yychar = (token), yylval = (value); \
908 yychar1 = YYTRANSLATE (yychar); \
913 { yyerror ("syntax error: cannot back up"); YYERROR; } \
923#define YYINITDEPTH 200
929#if defined(YYMAXDEPTH) && (YYMAXDEPTH == 0)
934#define YYMAXDEPTH 10000
970#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
972#define YYPOPSTACK (yyvsp--, yyssp--)
994 fprintf(stderr,
"Starting parse\n");
1020 if (yyssp >= yyss + yystacksize - 1)
1025 short *yyss1 = yyss;
1031 int size = yyssp - yyss + 1;
1039 yyoverflow(
"parser stack overflow",
1040 &yyss1, size *
sizeof (*yyssp),
1041 &yyvs1, size *
sizeof (*yyvsp),
1042 &yyls1, size *
sizeof (*yylsp),
1045 yyoverflow(
"parser stack overflow",
1046 &yyss1, size *
sizeof (*yyssp),
1047 &yyvs1, size *
sizeof (*yyvsp),
1051 yyss = yyss1; yyvs = yyvs1;
1059 yyerror(
"parser stack overflow");
1065 yyss = (
short *) yyallocator.
Allocate (yystacksize * sizeof (*yyssp));
1066 yy_memcpy ((
char *)yyss1, (
char *)yyss, size *
sizeof (*yyssp));
1067 yyvs = (
YYSTYPE *) yyallocator.
Allocate (yystacksize * sizeof (*yyvsp));
1068 yy_memcpy ((
char *)yyvs1, (
char *)yyvs, size *
sizeof (*yyvsp));
1070 yyls = (
YYLTYPE *) yyallocator.
Allocate (yystacksize * sizeof (*yylsp));
1071 yy_memcpy ((
char *)yyls1, (
char *)yyls, size *
sizeof (*yylsp));
1075 yyssp = yyss + size - 1;
1076 yyvsp = yyvs + size - 1;
1078 yylsp = yyls + size - 1;
1083 fprintf(stderr,
"Stack size increased to %d\n", yystacksize);
1086 if (yyssp >= yyss + yystacksize - 1)
1092 fprintf(stderr,
"Entering state %d\n", yystate);
1117 fprintf(stderr,
"Reading a token: ");
1131 fprintf(stderr,
"Now at end of input.\n");
1141 fprintf (stderr,
"Next token is %d (%s",
yychar, yytname[yychar1]);
1147 fprintf (stderr,
")\n");
1182 fprintf(stderr,
"Shifting token %d (%s), ",
yychar, yytname[yychar1]);
1195 if (yyerrstatus) yyerrstatus--;
1211 yyval = yyvsp[1-yylen];
1220 fprintf (stderr,
"Reducing via rule %d (line %d), ",
1224 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1225 fprintf (stderr,
"%s ", yytname[yyrhs[i]]);
1226 fprintf (stderr,
" -> %s\n", yytname[
yyr1[yyn]]);
1245 { self->
useNode(yyvsp[0].
string);
1263 {
addEventIn(yyvsp[-1].
string, yyvsp[0].
string);