#9 Bug in lex file to handle DEF and PROTO

v1.0 (example)
open
nobody
None
5
2007-06-13
2007-06-13
Anonymous
No

In file VRML97.l, the code slice to handle DEF is:

<INITIAL>DEF {
int c = 0;
std::ostringstream defBuf;
do {
c = input();
defBuf << (char)(c);
} while (c != '{' && c != EOF);

char defName[256];
char nodeName[256];
std::string defStr = defBuf.str();
const char *defCStr = defStr.c_str();
sscanf(defStr.c_str(), "%s %s", defName, nodeName);

std::string unputbuf;
unputbuf.append(nodeName);
unputbuf.append(" {");

SetDEFName(defName);
UnputString((char *)unputbuf.c_str());
}

Suppose you have a DEF sentence in your wrl file like:
DEF Sensor SphereSensor{}.
Then the nodeName is "SphereSensor{". After appending " {", the unputbuf is "SphereSensor{ {".
This will cause syntax error to VRML97Parser.
The reason is the do-while loop......

Proto routine has the similar problem. Also I think there is some logical error in PROTO routine.

For Router routine, suppose you have a router defined as
"ROUTE Sensor.rotation_changed TO Flaeche.set_rotation DEF Sensor2 SphereSensor{}".
The router routine will eat all this line and cause
"DEF Sensor2 SphereSensor{}" disappeared.

Discussion