file.cpp

changeset 73
d20867ac03cc
parent 72
5755c02d89f0
child 79
f8917e9d07f6
equal deleted inserted replaced
72:5755c02d89f0 73:d20867ac03cc
277 } 277 }
278 278
279 if (~tokens[0] != 1) 279 if (~tokens[0] != 1)
280 return new LDGibberish (zLine, "Illogical line code"); 280 return new LDGibberish (zLine, "Illogical line code");
281 281
282 char const c = tokens[0][0]; 282 const char c = tokens[0][0];
283 switch (c - '0') { 283 switch (c - '0') {
284 case 0: 284 case 0:
285 { 285 {
286 // Comment 286 // Comment
287 str zComment = zLine.substr (2, -1); 287 str zComment;
288 for (uint i = 1; i < tokens.size(); ++i) {
289 zComment += tokens[i];
290
291 if (i != tokens.size() - 1)
292 zComment += ' ';
293 }
294
295 // Handle BFC statements
296 if (tokens.size() > 2 && tokens[1] == "BFC") {
297 for (short i = 0; i < NUM_BFCStatements; ++i)
298 if (zComment == str::mkfmt ("BFC %s", LDBFC::saStatements [i]))
299 return new LDBFC (i);
300
301 // MLCAD is notorious for stuffing these statements in parts it
302 // creates. The above block only handles valid statements, so we
303 // need to handle MLCAD-style invertnext separately.
304 if (zComment == "BFC CERTIFY INVERTNEXT")
305 return new LDBFC (BFC_InvertNext);
306 }
288 307
289 if (tokens.size() > 2 && tokens[1] == "!LDFORGE") { 308 if (tokens.size() > 2 && tokens[1] == "!LDFORGE") {
290 // Handle LDForge-specific types, they're embedded into comments 309 // Handle LDForge-specific types, they're embedded into comments
291 310
292 if (tokens[2] == "VERTEX") { 311 if (tokens[2] == "VERTEX") {

mercurial