void fieldValue::parse(tokenizer &tokens, void *data) { tokens.syntax_start(this); if (type.substr(0,2) == "MF") { tokens.increment(false); tokens.expect("["); if (tokens.decrement(__FILE__, __LINE__, data)) { tokens.next(); tokens.increment(true); tokens.expect("]"); tokens.increment(false); tokens.expect<sfValue>(); while (tokens.decrement(__FILE__, __LINE__, data)) { values.push_back(sfValue(tokens, "SF" + type.substr(2), data)); tokens.increment(false); tokens.expect(","); if (tokens.decrement(__FILE__, __LINE__, data)) tokens.next(); tokens.increment(false); tokens.expect<sfValue>(); } if (tokens.decrement(__FILE__, __LINE__, data)) tokens.next(); } else { tokens.increment(true); tokens.expect<sfValue>(); if (tokens.decrement(__FILE__, __LINE__, data)) values.push_back(sfValue(tokens, "SF" + type.substr(2), data)); } } else { tokens.increment(true); tokens.expect<sfValue>(); if (tokens.decrement(__FILE__, __LINE__, data)) values.push_back(sfValue(tokens, type, data)); } tokens.syntax_end(this); }
void attribute_list::parse(tokenizer &tokens, void *data) { tokens.syntax_start(this); tokens.increment(false); tokens.expect<assignment_list>(); while (tokens.decrement(__FILE__, __LINE__, data)) { attributes.push_back(assignment_list(tokens, data)); tokens.increment(false); tokens.expect<assignment_list>(); } tokens.syntax_end(this); }
void protoDeclaration::parse(tokenizer &tokens, void *data) { tokens.syntax_start(this); tokens.increment(true); tokens.expect("]"); tokens.increment(true); tokens.expect<interfaceDeclaration>(); tokens.increment(true); tokens.expect("["); tokens.increment(true); tokens.expect<parse::instance>(); tokens.increment(true); tokens.expect("PROTO"); tokens.expect("EXTERNPROTO"); if (tokens.decrement(__FILE__, __LINE__, data)) { if (tokens.found("PROTO")) external = false; else if (tokens.found("EXTERNPROTO")) external = true; } if (tokens.decrement(__FILE__, __LINE__, data)) nodeType = tokens.next(); if (tokens.decrement(__FILE__, __LINE__, data)) tokens.next(); while (tokens.decrement(__FILE__, __LINE__, data)) { interfaces.push_back(interfaceDeclaration(tokens, external, data)); tokens.increment(false); tokens.expect<interfaceDeclaration>(); } if (tokens.decrement(__FILE__, __LINE__, data)) tokens.next(); if (external) { tokens.increment(true); tokens.expect<fieldValue>(); if (tokens.decrement(__FILE__, __LINE__, data)) value = fieldValue(tokens, "MFString", data); } else { tokens.increment(true); tokens.expect("}"); tokens.increment(true); tokens.expect<scene>(); tokens.increment(true); tokens.expect("{"); if (tokens.decrement(__FILE__, __LINE__, data)) tokens.next(); if (tokens.decrement(__FILE__, __LINE__, data)) sub = new scene(tokens, data); if (tokens.decrement(__FILE__, __LINE__, data)) tokens.next(); } tokens.syntax_end(this); }
void statement::parse(tokenizer &tokens, void *data) { tokens.syntax_start(this); statement_type = "node"; tokens.increment(true); tokens.expect("graph"); tokens.expect("node"); tokens.expect("edge"); tokens.expect<node_id>(); tokens.expect("subgraph"); if (tokens.decrement(__FILE__, __LINE__, data)) { if (tokens.found("subgraph")) nodes.push_back(new graph(tokens, data)); else if (tokens.found<node_id>()) nodes.push_back(new node_id(tokens, data)); else { statement_type = "attribute"; attribute_type = tokens.next(); } } if (statement_type != "attribute") { tokens.increment(false); tokens.expect("->"); tokens.expect("--"); while (tokens.decrement(__FILE__, __LINE__, data)) { statement_type = "edge"; tokens.next(); tokens.increment(false); tokens.expect("->"); tokens.expect("--"); tokens.increment(true); tokens.expect<node_id>(); tokens.expect("subgraph"); if (tokens.decrement(__FILE__, __LINE__, data)) { if (tokens.found("subgraph")) nodes.push_back(new graph(tokens, data)); else if (tokens.found<node_id>()) nodes.push_back(new node_id(tokens, data)); } } } tokens.increment(statement_type == "attribute"); tokens.expect<attribute_list>(); if (tokens.decrement(__FILE__, __LINE__, data)) attributes.parse(tokens, data); tokens.syntax_end(this); }