if (fb_.verbInfo.executionMode is "start") { // validate attributes // condition - string - required if (not structKeyExists(fb_.verbInfo.attributes,"condition")) { fb_throw("fusebox.badGrammar.requiredAttributeMissing", "Required attribute is missing", "The attribute 'condition' is required, for a 'if' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); } // strict mode - check attribute count: if (fb_.verbInfo.action.getCircuit().getApplication().strictMode) { if (structCount(fb_.verbInfo.attributes) neq 1) { fb_throw("fusebox.badGrammar.unexpectedAttributes", "Unexpected attributes", "Unexpected attributes were found in a 'if' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); } } // validation of children: // at most one , at most one , nothing else: fb_.hasTrue = false; fb_.hasFalse = false; for (fb_.i = 1; fb_.i lte fb_.verbInfo.nChildren; fb_.i = fb_.i + 1) { if (fb_.verbInfo.children[fb_.i].getNamespace() is not "") { fb_throw("fusebox.badGrammar.illegalVerb", "Illegal verb", "An 'if' may contain only 'true' and 'false' verbs in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); } switch (fb_.verbInfo.children[fb_.i].getVerb()) { case "true": if (fb_.hasTrue) { fb_throw("fusebox.badGrammar.illegalVerb", "Illegal verb", "An 'if' may contain at most one 'true' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); } else { fb_.hasTrue = true; } break; case "false": if (fb_.hasFalse) { fb_throw("fusebox.badGrammar.illegalVerb", "Illegal verb", "An 'if' may contain at most one 'false' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); } else { fb_.hasFalse = true; } break; default: fb_throw("fusebox.badGrammar.illegalVerb", "Illegal verb", "An 'if' may contain only 'true' and 'false' verbs in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); break; } } // compile // and can occur in either order so we defer the conditional // to the child tags... fb_.verbInfo.condition = fb_.verbInfo.attributes.condition; fb_.verbInfo.ifUsed = false; } else { // compile if (fb_.verbInfo.ifUsed) { fb_appendLine(""); } }