All files / egg-parser/src grammar.js

92.85% Statements 13/14
62.5% Branches 10/16
100% Functions 8/8
92.85% Lines 13/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38    1x 12x   1x           1x 1x               287x   103x 108x   161x 161x 293x       1x 1x          
// Generated automatically by nearley, version 2.20.1
// http://github.com/Hardmath123/nearley
(function () {
function id(x) { return x[0]; }
 
const { lexer } = require('./lex.js');
const { buildStringValue,
        buildNumberValue,
        buildWordApplies,
        buildApplyApplies,
        buildArrayValue,
        buildNestedApplies } = require('./build-ast.js');
var grammar = {
    Lexer: lexer,
    ParserRules: [
    {"name": "program", "symbols": ["expression", (lexer.has("EOF") ? {type: "EOF"} : EOF)], "postprocess": id},
    {"name": "expression", "symbols": [(lexer.has("STRING") ? {type: "STRING"} : STRING)], "postprocess": buildStringValue},
    {"name": "expression", "symbols": [(lexer.has("NUMBER") ? {type: "NUMBER"} : NUMBER)], "postprocess": buildNumberValue},
    {"name": "expression", "symbols": [(lexer.has("WORD") ? {type: "WORD"} : WORD), "applies"], "postprocess": buildWordApplies},
    {"name": "expression", "symbols": [(lexer.has("ARRAY") ? {type: "ARRAY"} : ARRAY)], "postprocess": buildArrayValue},
    {"name": "applies", "symbols": [], "postprocess": d => null},
    {"name": "applies", "symbols": ["parentExp", "applies"], "postprocess": buildNestedApplies},
    {"name": "parentExp", "symbols": [{"literal":"("}, "commaExp", {"literal":")"}], "postprocess": ([lp, commaExp, rp]) => commaExp || []},
    {"name": "commaExp", "symbols": [], "postprocess": d => null},
    {"name": "commaExp$ebnf$1", "symbols": []},
    {"name": "commaExp$ebnf$1$subexpression$1", "symbols": [{"literal":","}, "expression"], "postprocess": ([_,e]) => e},
    {"name": "commaExp$ebnf$1", "symbols": ["commaExp$ebnf$1", "commaExp$ebnf$1$subexpression$1"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}},
    {"name": "commaExp", "symbols": ["expression", "commaExp$ebnf$1"], "postprocess": d => [d[0]].concat(d[1])}
]
  , ParserStart: "program"
}
Eif (typeof module !== 'undefined'&& typeof module.exports !== 'undefined') {
   module.exports = grammar;
} else {
   window.grammar = grammar;
}
})();