Sha256: 7852fbda50bb936d84d03aa2849d2fc9f5a4fa2a63e5c563b0c66fc342190e71

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

if (typeof require !== 'undefined') {
    var bnf = require("./util/bnf-parser").parser;
    exports.parse = function parse () { return bnf.parse.apply(bnf, arguments) };
}

// adds a declaration to the grammar
bnf.yy.addDeclaration = function (grammar, decl) {
    if (decl.start) {
        grammar.start = decl.start
    }
    if (decl.operator) {
        if (!grammar.operators) {
            grammar.operators = [];
        }
        grammar.operators.push(decl.operator);
    }

};

// helps tokenize comments
bnf.yy.lexComment = function (lexer) {
    var ch = lexer.input();
    if (ch === '/') {
        lexer.yytext = lexer.yytext.replace(/\*(.|\s)\/\*/, '*$1');
        return;
    } else {
        lexer.unput('/*');
        lexer.more();
    }
}

// helps tokenize actions
bnf.yy.lexAction = function (lexer) {
    var ch = lexer.input();
    if (ch === '}') {
        lexer.yytext = lexer.yytext.substr(2, lexer.yyleng-4).replace(/\}(.|\s)\{\{/, '}$1');
        return 'ACTION';
    } else {
        lexer.unput('{{');
        lexer.more();
    }
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
haml-more-0.5.1 vendor/coffee-script/vendor/jison/lib/jison/bnf.js
haml-more-0.5.0 vendor/coffee-script/vendor/jison/lib/jison/bnf.js
haml-more-0.4.0 vendor/coffee-script/vendor/jison/lib/jison/bnf.js
haml-more-0.4.0.d vendor/coffee-script/vendor/jison/lib/jison/bnf.js
haml-more-0.4.0.c vendor/coffee-script/vendor/jison/lib/jison/bnf.js
haml-more-0.4.0.b vendor/coffee-script/vendor/jison/lib/jison/bnf.js
haml-more-0.4.0.a vendor/coffee-script/vendor/jison/lib/jison/bnf.js