%{ // // restricted VRML 2 parser // // used in G-PASS (3d Shadow) project // // Copyright 1999-2000 Consilium AB // Copyright 1999-2000 Antonio Solo (aka SoloTony) // // autogenerated by Yacc #include "stdafx.h" #include "vrml_2.h" %} %union { bool b; float f; int i; _str64 s; _float3 c; _float4 r; _pNode pn; _pList pl; _pIntList pil; _pCoordList pcl; S_Anchor n_Anchor; S_Coordinate n_Coordinate; S_Group n_Group; S_IndexedFaceSet n_IndexedFaceSet; S_Normal n_Normal; S_Shape n_Shape; S_Transform n_Transform; }; %token T_Material, T_Anchor, T_Appearance, T_Coordinate, T_Group, T_IndexedFaceSet, T_Normal, T_Shape, T_Transform, T_Box, T_Color, T_Cone, T_Cylinder, T_ElevationGrid, T_Extrusion, T_ImageTexture, T_IndexedLineSet, T_MovieTexture, T_PixelTexture, T_PointSet, T_Sphere, T_Text, T_TextureCoordinate, T_TextureTransform %token T_ambientIntensity, T_appearance, T_bboxCenter, T_bboxSize, T_ccw, T_center, T_children, T_color, T_colorIndex, T_colorPerVertex, T_convex, T_coord, T_coordIndex, T_creaseAngle, T_diffuseColor, T_description, T_emissiveColor, T_geometry, T_material, T_normal, T_normalIndex, T_normalPerVertex, T_parameter, T_point, T_rotation, T_shininess, T_scale, T_scaleOrientation, T_solid, T_specularColor, T_texCoord, T_texCoordIndex, T_texture, T_textureTransform, T_translation, T_transparency, T_url, T_vector %token T_ERROR, T_STRING, T_INTEGER, T_FLOAT %token T_TRUE, T_FALSE %token T_DEF %token T_Unknown %type T_Material, T_Anchor, T_Appearance, T_Coordinate, T_Group, T_IndexedFaceSet, T_Normal, T_Shape, T_Transform, T_Box, T_Color, T_Cone, T_Cylinder, T_ElevationGrid, T_Extrusion, T_ImageTexture, T_IndexedLineSet, T_MovieTexture, T_PixelTexture, T_PointSet, T_Sphere, T_Text, T_TextureCoordinate, T_TextureTransform %type T_ambientIntensity, T_appearance, T_bboxCenter, T_bboxSize, T_ccw, T_center, T_children, T_color, T_colorIndex, T_colorPerVertex, T_convex, T_coord, T_coordIndex, T_creaseAngle, T_diffuseColor, T_description, T_emissiveColor, T_geometry, T_material, T_normal, T_normalIndex, T_normalPerVertex, T_parameter, T_point, T_rotation, T_shininess, T_scale, T_scaleOrientation, T_solid, T_specularColor, T_texCoord, T_texCoordIndex, T_texture, T_textureTransform, T_translation, T_transparency, T_url, T_vector %type T_STRING, T_ERROR %type T_INTEGER %type T_FLOAT %type T_Unknown %type FLOAT %type BOOL %type COORD %type ROTATION %type _root_node, _color_node, _coordinate_node, _normal_node, _texCoord_node, _appearance_node, _geometry_node %type N_Anchor, N_Coordinate, N_Group, N_IndexedFaceSet, N_Normal, N_Shape, N_Transform %type N_Appearance, N_Box, N_Color, N_Cone, N_Cylinder, N_ElevationGrid, N_Extrusion, N_ImageTexture, N_IndexedLineSet, N_MovieTexture, N_PixelTexture, N_PointSet, N_Sphere, N_Text, N_TextureCoordinate %type N_Unknown %type _root_nodes_list, _child_nodes_list %type _Anchor %type _Coordinate %type _Group %type _IndexedFaceSet %type _Normal %type _Shape %type _Transform %type I_color, I_coord, I_normal, I_texCoord, I_appearance, I_geometry %type I_children %type I_description, I_parameter, I_url %type I_bboxCenter, I_bboxSize %type I_point, I_vector %type I_ccw, I_colorPerVertex, I_convex, I_normalPerVertex, I_solid %type I_colorIndex, I_coordIndex, I_normalIndex, I_texCoordIndex %type I_creaseAngle %type I_center, I_scale, I_translation %type I_rotation, I_scaleOrientation %type _coord_list, _coord_list_entry %type _integer_list, _integer_list_entry %start _root_nodes_list %% _root_nodes_list : _root_node {$$ = CreateRootNodesList(); AppendNode($$, $1); } | _root_nodes_list _root_node { $$ = $1; AppendNode($$, $2); } ; _child_nodes_list : _root_node {$$ = CreateNodesList(); AppendNode($$, $1); } | _child_nodes_list _root_node { $$ = $1; AppendNode($$, $2); } ; N_Anchor : T_Anchor '{' _Anchor '}' {$$ = CreateAnchor($3); } ; N_Coordinate : T_Coordinate '{' _Coordinate '}' {$$ = CreateCoordinate($3); } ; N_Group : T_Group '{' _Group '}' {$$ = CreateGroup($3); } ; N_IndexedFaceSet : T_IndexedFaceSet '{' _IndexedFaceSet '}' {$$ = CreateIndexedFaceSet($3);}; N_Normal : T_Normal '{' _Normal '}' {$$ = CreateNormal($3); } ; N_Shape : T_Shape '{' _Shape '}' {$$ = CreateShape($3); } ; N_Transform : T_Transform '{' _Transform '}' {$$ = CreateTransform($3); } ; N_Appearance : T_Appearance {SkipNode($1); $$=NULL;} ; N_Box : T_Box {SkipNode($1); $$=NULL;} ; N_Color : T_Color {SkipNode($1); $$=NULL;} ; N_Cone : T_Cone {SkipNode($1); $$=NULL;} ; N_Cylinder : T_Cylinder {SkipNode($1); $$=NULL;} ; N_ElevationGrid : T_ElevationGrid {SkipNode($1); $$=NULL;} ; N_Extrusion : T_Extrusion {SkipNode($1); $$=NULL;} ; N_ImageTexture : T_ImageTexture {SkipNode($1); $$=NULL;} ; N_IndexedLineSet : T_IndexedLineSet {SkipNode($1); $$=NULL;} ; N_MovieTexture : T_MovieTexture {SkipNode($1); $$=NULL;} ; N_PixelTexture : T_PixelTexture {SkipNode($1); $$=NULL;} ; N_PointSet : T_PointSet {SkipNode($1); $$=NULL;} ; N_Sphere : T_Sphere {SkipNode($1); $$=NULL;} ; N_Text : T_Text {SkipNode($1); $$=NULL;} ; N_TextureCoordinate : T_TextureCoordinate {SkipNode($1); $$=NULL;} ; N_Unknown : T_Unknown {SkipNode($1); $$=NULL;} ; _root_node : N_Anchor {$$ = $1;} | N_Group {$$ = $1;} | N_Shape {$$ = $1;} | N_Transform {$$ = $1;} | N_Unknown {$$ = NULL;} | T_DEF T_Unknown N_Anchor {$$ = $3; SetNodeName($$, $2); } | T_DEF T_Unknown N_Group {$$ = $3; SetNodeName($$, $2); } | T_DEF T_Unknown N_Shape {$$ = $3; SetNodeName($$, $2); } | T_DEF T_Unknown N_Transform {$$ = $3; SetNodeName($$, $2); } | T_DEF T_Unknown N_Unknown {$$ = NULL;} ; _color_node : T_DEF T_Unknown N_Color {$$=$3; SetNodeName($$, $2);} | N_Color {$$ = $1;} ; _coordinate_node : T_DEF T_Unknown N_Coordinate {$$=$3; SetNodeName($$, $2);} | N_Coordinate {$$ = $1;} ; _normal_node : T_DEF T_Unknown N_Normal {$$=$3; SetNodeName($$, $2);} | N_Normal {$$ = $1;} ; _texCoord_node : T_DEF T_Unknown N_TextureCoordinate {$$=$3; SetNodeName($$, $2);} | N_TextureCoordinate {$$ = $1;} ; _appearance_node : T_DEF T_Unknown N_Appearance {$$=$3; SetNodeName($$, $2);} | N_Appearance {$$ = $1;} ; _geometry_node : N_Box {$$ = $1;} | N_Cone {$$ = $1;} | N_Cylinder {$$ = $1;} | N_ElevationGrid {$$ = $1;} | N_Extrusion {$$ = $1;} | N_IndexedFaceSet {$$ = $1;} | N_IndexedLineSet {$$ = $1;} | N_PointSet {$$ = $1;} | N_Sphere {$$ = $1;} | N_Text {$$ = $1;} | T_DEF T_Unknown N_Box {$$=$3; SetNodeName($$, $2);} | T_DEF T_Unknown N_Cone {$$=$3; SetNodeName($$, $2);} | T_DEF T_Unknown N_Cylinder {$$=$3; SetNodeName($$, $2);} | T_DEF T_Unknown N_ElevationGrid {$$=$3; SetNodeName($$, $2);} | T_DEF T_Unknown N_Extrusion {$$=$3; SetNodeName($$, $2);} | T_DEF T_Unknown N_IndexedFaceSet {$$=$3; SetNodeName($$, $2);} | T_DEF T_Unknown N_IndexedLineSet {$$=$3; SetNodeName($$, $2);} | T_DEF T_Unknown N_PointSet {$$=$3; SetNodeName($$, $2);} | T_DEF T_Unknown N_Sphere {$$=$3; SetNodeName($$, $2);} | T_DEF T_Unknown N_Text {$$=$3; SetNodeName($$, $2);} ; _Anchor : I_children {$$.children = $1; $$.fields = S_Anchor_children;} | I_description {$$.description = $1; $$.fields = S_Anchor_description;} | I_parameter {$$.fields = 0;} | I_url {$$.fields = 0;} | I_bboxCenter {$$.fields = 0;} | I_bboxSize {$$.fields = 0;} | _Anchor I_children {$$ = $1; $$.children = $2; $$.fields |= S_Anchor_children;} | _Anchor I_description {$$ = $1; $$.description = $2; $$.fields |= S_Anchor_description;} | _Anchor I_parameter {$$ = $1; } | _Anchor I_url {$$ = $1; } | _Anchor I_bboxCenter {$$ = $1; } | _Anchor I_bboxSize {$$ = $1; } ; _Coordinate : I_point {$$.point = $1; $$.fields = S_Coordinate_point;} ; _Group : I_children {$$.children = $1; $$.fields = S_Group_children;} | I_bboxCenter {$$.fields = 0;} | I_bboxSize {$$.fields = 0;} | _Group I_children {$$ = $1; $$.children = $2; $$.fields |= S_Group_children;} | _Group I_bboxCenter {$$ = $1; } | _Group I_bboxSize {$$ = $1; } ; _IndexedFaceSet : I_color {$$.fields = 0;} | I_coord {$$.coord = $1; $$.fields = S_IndexedFaceSet_coord;} | I_normal {$$.normal = $1; $$.fields = S_IndexedFaceSet_normal;} | I_texCoord {$$.fields = 0;} | I_ccw {$$.fields = 0;} | I_colorIndex {$$.fields = 0;} | I_colorPerVertex {$$.fields = 0;} | I_convex {$$.fields = 0;} | I_coordIndex {$$.coordIndex = $1; $$.fields = S_IndexedFaceSet_coordIndex;} | I_creaseAngle {$$.fields = 0;} | I_normalIndex {$$.normalIndex = $1; $$.fields = S_IndexedFaceSet_normalIndex;} | I_normalPerVertex {$$.fields = 0;} | I_solid {$$.fields = 0;} | I_texCoordIndex {$$.fields = 0;} | _IndexedFaceSet I_color {$$ = $1; } | _IndexedFaceSet I_coord {$$ = $1; $$.coord = $2; $$.fields |= S_IndexedFaceSet_coord;} | _IndexedFaceSet I_normal {$$ = $1; $$.normal = $2; $$.fields |= S_IndexedFaceSet_normal;} | _IndexedFaceSet I_texCoord {$$ = $1; } | _IndexedFaceSet I_ccw {$$ = $1; } | _IndexedFaceSet I_colorIndex {$$ = $1; } | _IndexedFaceSet I_colorPerVertex {$$ = $1; } | _IndexedFaceSet I_convex {$$ = $1; } | _IndexedFaceSet I_coordIndex {$$ = $1; $$.coordIndex = $2; $$.fields |= S_IndexedFaceSet_coordIndex;} | _IndexedFaceSet I_creaseAngle {$$ = $1; } | _IndexedFaceSet I_normalIndex {$$ = $1; $$.normalIndex = $2; $$.fields |= S_IndexedFaceSet_normalIndex;} | _IndexedFaceSet I_normalPerVertex {$$ = $1; } | _IndexedFaceSet I_solid {$$ = $1; } | _IndexedFaceSet I_texCoordIndex {$$ = $1; } ; _Normal : I_vector {$$.vector = $1; $$.fields = S_Normal_vector;} ; _Shape : I_appearance {$$.fields = 0;} | I_geometry {$$.geometry = $1; $$.fields = S_Shape_geometry;} | _Shape I_appearance { $$ = $1;} | _Shape I_geometry {$$ = $1; $$.geometry = $2; $$.fields |= S_Shape_geometry;} ; _Transform : I_center {$$.center =$1; $$.fields = S_Transform_center;} | I_children {$$.children = $1; $$.fields = S_Transform_children;} | I_rotation {$$.rotation =$1; $$.fields = S_Transform_rotation;} | I_scale {$$.scale =$1; $$.fields = S_Transform_scale;} | I_scaleOrientation {$$.scaleOrientation =$1; $$.fields = S_Transform_scaleOrientation;} | I_translation {$$.translation =$1; $$.fields = S_Transform_translation;} | I_bboxCenter {$$.fields = 0;} | I_bboxSize {$$.fields = 0;} | _Transform I_center {$$ = $1; $$.center =$2; $$.fields |= S_Transform_center;} | _Transform I_children {$$ = $1; $$.children = $2; $$.fields |= S_Transform_children;} | _Transform I_rotation {$$ = $1; $$.rotation =$2; $$.fields |= S_Transform_rotation;} | _Transform I_scale {$$ = $1; $$.scale =$2; $$.fields |= S_Transform_scale;} | _Transform I_scaleOrientation {$$ = $1; $$.scaleOrientation =$2; $$.fields |= S_Transform_scaleOrientation;} | _Transform I_translation {$$ = $1; $$.translation =$2; $$.fields |= S_Transform_translation;} | _Transform I_bboxCenter {$$ = $1; } | _Transform I_bboxSize {$$ = $1; } ; I_children : T_children '[' _child_nodes_list ']' {$$ = $3;} | T_children _root_node {$$ = CreateNodesList(); AppendNode($$, $2); } ; I_description : T_description T_STRING {$$ = $2;} ; I_parameter : T_parameter T_STRING {$$ = $2;} ; I_url : T_url T_STRING {$$ = $2;} ; I_bboxCenter : T_bboxCenter COORD {$$ = $2;} ; I_bboxSize : T_bboxSize COORD {$$ = $2;} ; I_point : T_point _coord_list {$$ = $2;} ; I_color : T_color _color_node {$$ = $2;} ; I_coord : T_coord _coordinate_node {$$ = $2;} ; I_normal : T_normal _normal_node {$$ = $2;} ; I_texCoord : T_texCoord _texCoord_node {$$ = $2;} ; I_ccw : T_ccw BOOL {$$ = $2;} ; I_colorIndex : T_colorIndex _integer_list {$$ = NULL; DestroyIntList($2);} ; I_colorPerVertex : T_colorPerVertex BOOL {$$ = $2;} ; I_convex : T_convex BOOL {$$ = $2;} ; I_coordIndex : T_coordIndex _integer_list {$$ = $2;} ; I_creaseAngle : T_creaseAngle FLOAT {$$ = $2;} ; I_normalIndex : T_normalIndex _integer_list {$$ = $2;} ; I_normalPerVertex : T_normalPerVertex BOOL {$$ = $2;} ; I_solid : T_solid BOOL {$$ = $2;} ; I_texCoordIndex : T_texCoordIndex _integer_list {$$ = NULL; DestroyIntList($2);} ; I_vector : T_vector _coord_list {$$ = $2;} ; I_appearance : T_appearance _appearance_node {$$ = $2;} ; I_geometry : T_geometry _geometry_node {$$ = $2;} ; I_center : T_center COORD {$$ = $2;} ; I_rotation : T_rotation ROTATION {$$ = $2;} ; I_scale : T_scale COORD {$$ = $2;} ; I_scaleOrientation : T_scaleOrientation ROTATION {$$ = $2;} ; I_translation : T_translation COORD {$$ = $2;} ; _coord_list : '[' _coord_list_entry ']' {$$ = $2;} | '[' _coord_list_entry ',' ']' {$$ = $2;} | COORD {$$ = CreateCoordList(); AppendToCoordList($$, $1);} ; _coord_list_entry : COORD {$$ = CreateCoordList(); AppendToCoordList($$, $1);} | _coord_list_entry ',' COORD { AppendToCoordList($$,$3); } ; _integer_list : '[' _integer_list_entry ']' {$$ = $2;} | '[' _integer_list_entry ',' ']' {$$ = $2;} | T_INTEGER {$$ = CreateIntList(); AppendToIntList($$, $1);} ; _integer_list_entry : T_INTEGER {$$ = CreateIntList(); AppendToIntList($$, $1);} | _integer_list_entry ',' T_INTEGER {AppendToIntList($$, $3);} ; _empty : ; COORD : FLOAT FLOAT FLOAT {$$[0] = $1; $$[1] = $2; $$[2] = $3; } ; ROTATION : FLOAT FLOAT FLOAT FLOAT {$$[0] = $1; $$[1] = $2; $$[2] = $3; $$[3] = $4; } ; BOOL : T_TRUE {$$ = true;} | T_FALSE {$$ = false;} ; FLOAT : T_FLOAT {$$=$1;} | T_INTEGER {$$= (float) $1;} ; %%