All files grammar.js

100% Statements 31/31
40.74% Branches 11/27
100% Functions 10/10
100% Lines 31/31

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 322x 2x 15585x 15585x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 15650x 15650x 2x  
// Generated automatically by nearley, version 2.20.1
// http://github.com/Hardmath123/nearley
function id(x) { return x[0]; }
 
  import { lexer } from './lexer.js';
  import { buildObject, buildPair, buildValue,  buildArray } from './buildAst.js';
let Lexer = lexer;
let ParserRules = [
    {"name": "main", "symbols": ["value", (lexer.has("EOF") ? {type: "EOF"} : EOF)], "postprocess": id},
    {"name": "value", "symbols": [(lexer.has("NUMBER") ? {type: "NUMBER"} : NUMBER)], "postprocess": buildValue},
    {"name": "value", "symbols": [(lexer.has("STRING") ? {type: "STRING"} : STRING)], "postprocess": buildValue},
    {"name": "value", "symbols": ["object"], "postprocess": id},
    {"name": "value", "symbols": ["array"], "postprocess": buildArray},
    {"name": "value", "symbols": [(lexer.has("TRUE") ? {type: "TRUE"} : TRUE)], "postprocess": buildValue},
    {"name": "value", "symbols": [(lexer.has("FALSE") ? {type: "FALSE"} : FALSE)], "postprocess": buildValue},
    {"name": "value", "symbols": [(lexer.has("NULL") ? {type: "NULL"} : NULL)], "postprocess": buildValue},
    {"name": "object", "symbols": [(lexer.has("LK") ? {type: "LK"} : LK), "pairList", (lexer.has("RK") ? {type: "RK"} : RK)], "postprocess": ([lk, pairList, rk]) => buildObject(pairList)},
    {"name": "object", "symbols": [(lexer.has("LK") ? {type: "LK"} : LK), (lexer.has("RK") ? {type: "RK"} : RK)], "postprocess": () => buildObject([])},
    {"name": "pairList$ebnf$1", "symbols": []},
    {"name": "pairList$ebnf$1$subexpression$1", "symbols": [(lexer.has("COMMA") ? {type: "COMMA"} : COMMA), "pair"], "postprocess": ([_, p]) => p},
    {"name": "pairList$ebnf$1", "symbols": ["pairList$ebnf$1", "pairList$ebnf$1$subexpression$1"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}},
    {"name": "pairList", "symbols": ["pair", "pairList$ebnf$1"], "postprocess": result => [result[0]].concat(result[1])},
    {"name": "pair", "symbols": [(lexer.has("STRING") ? {type: "STRING"} : STRING), (lexer.has("COLON") ? {type: "COLON"} : COLON), "value"], "postprocess": ([key, _, value]) => buildPair(key, value)},
    {"name": "array$ebnf$1", "symbols": []},
    {"name": "array$ebnf$1$subexpression$1", "symbols": [(lexer.has("COMMA") ? {type: "COMMA"} : COMMA), "value"], "postprocess": ([_, v]) => v},
    {"name": "array$ebnf$1", "symbols": ["array$ebnf$1", "array$ebnf$1$subexpression$1"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}},
    {"name": "array", "symbols": [(lexer.has("LB") ? {type: "LB"} : LB), "value", "array$ebnf$1", (lexer.has("RB") ? {type: "RB"} : RB)], "postprocess": result => [result[1]].concat(result[2])},
    {"name": "array", "symbols": [(lexer.has("LB") ? {type: "LB"} : LB), (lexer.has("RB") ? {type: "RB"} : RB)], "postprocess": () => []}
];
let ParserStart = "main";
export default { Lexer, ParserRules, ParserStart };