Beispiel #1
0
size_t CFParser :: defineGrammarRule(_ScriptReader& reader, ScriptBookmark& bm, size_t parentRuleId, size_t nonterminal, size_t terminal)
{
   ReferenceNs ns;
   int   index = 0;
   do {
      ns.copy(retrieveKey(_names.start(), parentRuleId, DEFAULT_STR));
      ns.append('.');
      ns.appendHex(index++);

      if (!_names.exist(ns))
         break;

   } while (true);

   size_t ruleId = mapRuleId(ns);

   Rule rule;
   rule.nonterminal = nonterminal;
   rule.terminal = terminal;

   defineGrammarRule(reader, bm, rule, ruleId);

   addRule(ruleId, rule);

   return ruleId;
}
Beispiel #2
0
size_t CFParser :: defineGrammarRule(TokenInfo& token, _ScriptReader& reader, size_t nonterminal)
{
   ReferenceNs ns;
   int   index = 0;
   do {
      ns.copy("inline");
      ns.appendHex(index++);

      if (!_names.exist(ns))
         break;

   } while (true);

   size_t ruleId = mapRuleId(ns);

   Rule rule;
   rule.nonterminal = nonterminal;

   defineGrammarRule(token, reader, rule);

   _rules.add(ruleId, rule);

   return ruleId;
}