myna.js
function registerGrammar(grammarName, grammar, defaultRule) {
        for (var k in grammar) {
            if (grammar[k] instanceof Rule) {
                var rule = grammar[k];
                rule.setName(grammarName, k);
                Myna.allRules[rule.fullName] = rule;
            }
        }
        Myna.grammars[grammarName] = grammar;
        if (defaultRule) {
            Myna.parsers[grammarName] = function (text) { return parse(defaultRule, text); };
        }
        return grammar;
    }
function registerGrammar(grammarName, grammar, defaultRule) {
        for (var k in grammar) {
            if (grammar[k] instanceof Rule) {
                var rule = grammar[k];
                rule.setName(grammarName, k);
                Myna.allRules[rule.fullName] = rule;
            }
        }
        Myna.grammars[grammarName] = grammar;
        if (defaultRule) {
            Myna.parsers[grammarName] = function (text) { return parse(defaultRule, text); };
        }
        return grammar;
    }
function registerGrammar ( grammarName , grammar , defaultRule ) { for ( var k in grammar ) { if ( grammar [ k ] instanceof Rule ) { var rule = grammar [ k ] ; rule . setName ( grammarName , k ) ; Myna . allRules [ rule . fullName ] = rule ; } } Myna . grammars [ grammarName ] = grammar ; if ( defaultRule ) { Myna . parsers [ grammarName ] = function ( text ) { return parse ( defaultRule , text ) ; } ; } return grammar ; }
Initializes and register a grammar object and all of the rules. Sets names for all of the rules from the name of the field it is associated with combined with the name of the grammar. Each rule is stored in Myna.rules and each grammar is stored in Myna.grammars.
Initializes and register a grammar object and all of the rules . Sets names for all of the rules from the name of the field it is associated with combined with the name of the grammar . Each rule is stored in Myna . rules and each grammar is stored in Myna . grammars .