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); }