Comparing version 0.1.4 to 0.1.5
// Generated automatically by nearley | ||
// http://github.com/Hardmath123/nearley | ||
(function () { | ||
function id(x) {return x[0]; } | ||
function id(x) { | ||
return x[0]; | ||
} | ||
const R = require('ramda'); | ||
var grammar = { | ||
ParserRules: [ | ||
{"name": "_$ebnf$1", "symbols": []}, | ||
{"name": "_$ebnf$1", "symbols": ["wschar", "_$ebnf$1"], "postprocess": function arrconcat(d) {return [d[0]].concat(d[1]);}}, | ||
{"name": "_", "symbols": ["_$ebnf$1"], "postprocess": function(d) {return null;}}, | ||
{"name": "__$ebnf$1", "symbols": ["wschar"]}, | ||
{"name": "__$ebnf$1", "symbols": ["wschar", "__$ebnf$1"], "postprocess": function arrconcat(d) {return [d[0]].concat(d[1]);}}, | ||
{"name": "__", "symbols": ["__$ebnf$1"], "postprocess": function(d) {return null;}}, | ||
{"name": "wschar", "symbols": [/[ \t\n\v\f]/], "postprocess": id}, | ||
{"name": "declaration$string$1", "symbols": [{"literal":":"}, {"literal":":"}], "postprocess": function joiner(d) {return d.join('');}}, | ||
{"name": "declaration$ebnf$1$subexpression$1$string$1", "symbols": [{"literal":"="}, {"literal":">"}], "postprocess": function joiner(d) {return d.join('');}}, | ||
{"name": "declaration$ebnf$1$subexpression$1", "symbols": ["_", "classConstraints", "_", "declaration$ebnf$1$subexpression$1$string$1"]}, | ||
{"name": "declaration$ebnf$1", "symbols": ["declaration$ebnf$1$subexpression$1"], "postprocess": id}, | ||
{"name": "declaration$ebnf$1", "symbols": [], "postprocess": function(d) {return null;}}, | ||
{"name": "declaration", "symbols": ["name", "_", "declaration$string$1", "declaration$ebnf$1", "_", "type"], "postprocess": | ||
data => ({ | ||
name: data[0], | ||
constraints: R.pathOr([], [3, 1], data), | ||
type: data[5], | ||
}) | ||
}, | ||
{"name": "type$subexpression$1", "symbols": ["typevar"]}, | ||
{"name": "type$subexpression$1", "symbols": ["list"]}, | ||
{"name": "type$subexpression$1", "symbols": ["typeConstructor"]}, | ||
{"name": "type$subexpression$1", "symbols": ["function"]}, | ||
{"name": "type$subexpression$1", "symbols": ["thunk"]}, | ||
{"name": "type$subexpression$1", "symbols": ["uncurriedFunction"]}, | ||
{"name": "type$subexpression$1", "symbols": ["constrainedType"]}, | ||
{"name": "type$subexpression$1", "symbols": ["method"]}, | ||
{"name": "type$subexpression$1", "symbols": ["record"]}, | ||
{"name": "type", "symbols": ["type$subexpression$1"], "postprocess": data => data[0][0]}, | ||
{"name": "typevar", "symbols": ["lowId"], "postprocess": | ||
data => ({ | ||
type: 'typevar', | ||
text: data[0], | ||
children: [], | ||
}) | ||
}, | ||
{"name": "lowId$ebnf$1", "symbols": []}, | ||
{"name": "lowId$ebnf$1", "symbols": [/[a-zA-Z0-9_]/, "lowId$ebnf$1"], "postprocess": function arrconcat(d) {return [d[0]].concat(d[1]);}}, | ||
{"name": "lowId", "symbols": [/[a-z]/, "lowId$ebnf$1"], "postprocess": | ||
data => data[0] + R.join('', data[1]) | ||
}, | ||
{"name": "capId$ebnf$1", "symbols": []}, | ||
{"name": "capId$ebnf$1", "symbols": [/[a-zA-Z0-9_]/, "capId$ebnf$1"], "postprocess": function arrconcat(d) {return [d[0]].concat(d[1]);}}, | ||
{"name": "capId", "symbols": [/[A-Z]/, "capId$ebnf$1"], "postprocess": | ||
data => data[0] + R.join('', data[1]) | ||
}, | ||
{"name": "name$ebnf$1", "symbols": [/[A-Za-z0-9_'#@-]/]}, | ||
{"name": "name$ebnf$1", "symbols": [/[A-Za-z0-9_'#@-]/, "name$ebnf$1"], "postprocess": function arrconcat(d) {return [d[0]].concat(d[1]);}}, | ||
{"name": "name", "symbols": ["name$ebnf$1"], "postprocess": data => R.join('', data[0])}, | ||
{"name": "classConstraints$subexpression$1", "symbols": ["constraint"]}, | ||
{"name": "classConstraints$subexpression$1", "symbols": ["wrappedConstraints"]}, | ||
{"name": "classConstraints", "symbols": ["classConstraints$subexpression$1"], "postprocess": data => data[0][0]}, | ||
{"name": "constraint", "symbols": ["capId", "__", "lowId"], "postprocess": | ||
data => [{ | ||
typeclass: data[0], | ||
typevar: data[2], | ||
}] | ||
}, | ||
{"name": "wrappedConstraints$ebnf$1", "symbols": []}, | ||
{"name": "wrappedConstraints$ebnf$1$subexpression$1", "symbols": ["_", {"literal":","}, "_", "constraint"]}, | ||
{"name": "wrappedConstraints$ebnf$1", "symbols": ["wrappedConstraints$ebnf$1$subexpression$1", "wrappedConstraints$ebnf$1"], "postprocess": function arrconcat(d) {return [d[0]].concat(d[1]);}}, | ||
{"name": "wrappedConstraints", "symbols": [{"literal":"("}, "_", "constraint", "wrappedConstraints$ebnf$1", "_", {"literal":")"}], "postprocess": | ||
data => data[2].concat( | ||
R.unnest(R.pluck(3)(data[3])) | ||
) | ||
}, | ||
{"name": "typeConstructor$ebnf$1", "symbols": []}, | ||
{"name": "typeConstructor$ebnf$1$subexpression$1", "symbols": ["__", "typeConstructorArg"]}, | ||
{"name": "typeConstructor$ebnf$1", "symbols": ["typeConstructor$ebnf$1$subexpression$1", "typeConstructor$ebnf$1"], "postprocess": function arrconcat(d) {return [d[0]].concat(d[1]);}}, | ||
{"name": "typeConstructor", "symbols": ["capId", "typeConstructor$ebnf$1"], "postprocess": | ||
data => ({ | ||
type: 'typeConstructor', | ||
text: data[0], | ||
children: R.pluck(1)(data[1]), | ||
}) | ||
}, | ||
{"name": "typeConstructorArg$subexpression$1", "symbols": ["typevar"]}, | ||
{"name": "typeConstructorArg$subexpression$1", "symbols": ["list"]}, | ||
{"name": "typeConstructorArg$subexpression$1", "symbols": ["wrappedConstrainedType"]}, | ||
{"name": "typeConstructorArg$subexpression$1", "symbols": ["nullaryTypeConstructor"]}, | ||
{"name": "typeConstructorArg$subexpression$1", "symbols": ["wrappedTypeConstructor"]}, | ||
{"name": "typeConstructorArg", "symbols": ["typeConstructorArg$subexpression$1"], "postprocess": data => data[0][0]}, | ||
{"name": "nullaryTypeConstructor", "symbols": ["capId"], "postprocess": | ||
data => ({ | ||
type: 'typeConstructor', | ||
text: data[0], | ||
children: [], | ||
}) | ||
}, | ||
{"name": "wrappedTypeConstructor", "symbols": [{"literal":"("}, "_", "typeConstructor", "_", {"literal":")"}], "postprocess": data => data[2]}, | ||
{"name": "constrainedTypeArg$subexpression$1", "symbols": ["nullaryTypeConstructor"]}, | ||
{"name": "constrainedTypeArg$subexpression$1", "symbols": ["typevar"]}, | ||
{"name": "constrainedTypeArg$subexpression$1", "symbols": ["wrappedTypeConstructor"]}, | ||
{"name": "constrainedTypeArg$subexpression$1", "symbols": ["wrappedConstrainedType"]}, | ||
{"name": "constrainedTypeArg", "symbols": ["constrainedTypeArg$subexpression$1"], "postprocess": data => data[0][0]}, | ||
{"name": "constrainedType$ebnf$1$subexpression$1", "symbols": ["__", "constrainedTypeArg"]}, | ||
{"name": "constrainedType$ebnf$1", "symbols": ["constrainedType$ebnf$1$subexpression$1"]}, | ||
{"name": "constrainedType$ebnf$1$subexpression$2", "symbols": ["__", "constrainedTypeArg"]}, | ||
{"name": "constrainedType$ebnf$1", "symbols": ["constrainedType$ebnf$1$subexpression$2", "constrainedType$ebnf$1"], "postprocess": function arrconcat(d) {return [d[0]].concat(d[1]);}}, | ||
{"name": "constrainedType", "symbols": ["lowId", "constrainedType$ebnf$1"], "postprocess": | ||
data => ({ | ||
type: 'constrainedType', | ||
text: data[0], | ||
children: R.pluck(1)(data[1]), | ||
}) | ||
}, | ||
{"name": "wrappedConstrainedType", "symbols": [{"literal":"("}, "_", "constrainedType", "_", {"literal":")"}], "postprocess": data => data[2]}, | ||
{"name": "list", "symbols": [{"literal":"["}, "_", "type", "_", {"literal":"]"}], "postprocess": | ||
data => ({ | ||
type: 'list', | ||
text: '', | ||
children: [ data[2] ], | ||
}) | ||
}, | ||
{"name": "function$ebnf$1$subexpression$1$string$1", "symbols": [{"literal":"-"}, {"literal":">"}], "postprocess": function joiner(d) {return d.join('');}}, | ||
{"name": "function$ebnf$1$subexpression$1", "symbols": ["_", "function$ebnf$1$subexpression$1$string$1", "_", "functionArg"]}, | ||
{"name": "function$ebnf$1", "symbols": ["function$ebnf$1$subexpression$1"]}, | ||
{"name": "function$ebnf$1$subexpression$2$string$1", "symbols": [{"literal":"-"}, {"literal":">"}], "postprocess": function joiner(d) {return d.join('');}}, | ||
{"name": "function$ebnf$1$subexpression$2", "symbols": ["_", "function$ebnf$1$subexpression$2$string$1", "_", "functionArg"]}, | ||
{"name": "function$ebnf$1", "symbols": ["function$ebnf$1$subexpression$2", "function$ebnf$1"], "postprocess": function arrconcat(d) {return [d[0]].concat(d[1]);}}, | ||
{"name": "function", "symbols": ["functionArg", "function$ebnf$1"], "postprocess": | ||
data => ({ | ||
type: 'function', | ||
text: '', | ||
children: [data[0]].concat(R.pluck(3)(data[1])), | ||
}) | ||
}, | ||
{"name": "functionArg$subexpression$1", "symbols": ["typevar"]}, | ||
{"name": "functionArg$subexpression$1", "symbols": ["list"]}, | ||
{"name": "functionArg$subexpression$1", "symbols": ["typeConstructor"]}, | ||
{"name": "functionArg$subexpression$1", "symbols": ["constrainedType"]}, | ||
{"name": "functionArg$subexpression$1", "symbols": ["wrappedFunction"]}, | ||
{"name": "functionArg$subexpression$1", "symbols": ["wrappedUncurriedFunction"]}, | ||
{"name": "functionArg$subexpression$1", "symbols": ["wrappedThunk"]}, | ||
{"name": "functionArg$subexpression$1", "symbols": ["record"]}, | ||
{"name": "functionArg", "symbols": ["functionArg$subexpression$1"], "postprocess": data => data[0][0]}, | ||
{"name": "wrappedFunction", "symbols": [{"literal":"("}, "_", "function", "_", {"literal":")"}], "postprocess": data => data[2]}, | ||
{"name": "uncurriedFunction$string$1", "symbols": [{"literal":"-"}, {"literal":">"}], "postprocess": function joiner(d) {return d.join('');}}, | ||
{"name": "uncurriedFunction", "symbols": ["uncurriedFunctionParams", "_", "uncurriedFunction$string$1", "_", "type"], "postprocess": | ||
data => ({ | ||
type: 'uncurriedFunction', | ||
text: '', | ||
children: [data[0], data[4]], | ||
}) | ||
}, | ||
{"name": "uncurriedFunctionParams$ebnf$1$subexpression$1", "symbols": ["_", {"literal":","}, "_", "type"]}, | ||
{"name": "uncurriedFunctionParams$ebnf$1", "symbols": ["uncurriedFunctionParams$ebnf$1$subexpression$1"]}, | ||
{"name": "uncurriedFunctionParams$ebnf$1$subexpression$2", "symbols": ["_", {"literal":","}, "_", "type"]}, | ||
{"name": "uncurriedFunctionParams$ebnf$1", "symbols": ["uncurriedFunctionParams$ebnf$1$subexpression$2", "uncurriedFunctionParams$ebnf$1"], "postprocess": function arrconcat(d) {return [d[0]].concat(d[1]);}}, | ||
{"name": "uncurriedFunctionParams", "symbols": [{"literal":"("}, "_", "type", "uncurriedFunctionParams$ebnf$1", "_", {"literal":")"}], "postprocess": | ||
data => ({ | ||
type: 'parameters', | ||
text: '', | ||
children: [data[2]].concat(R.pluck(3)(data[3])), | ||
}) | ||
}, | ||
{"name": "wrappedUncurriedFunction", "symbols": [{"literal":"("}, "_", "uncurriedFunction", "_", {"literal":")"}], "postprocess": data => data[2]}, | ||
{"name": "method$string$1", "symbols": [{"literal":"~"}, {"literal":">"}], "postprocess": function joiner(d) {return d.join('');}}, | ||
{"name": "method$ebnf$1", "symbols": []}, | ||
{"name": "method$ebnf$1$subexpression$1$string$1", "symbols": [{"literal":"-"}, {"literal":">"}], "postprocess": function joiner(d) {return d.join('');}}, | ||
{"name": "method$ebnf$1$subexpression$1", "symbols": ["_", "method$ebnf$1$subexpression$1$string$1", "_", "functionArg"]}, | ||
{"name": "method$ebnf$1", "symbols": ["method$ebnf$1$subexpression$1", "method$ebnf$1"], "postprocess": function arrconcat(d) {return [d[0]].concat(d[1]);}}, | ||
{"name": "method", "symbols": ["typeConstructor", "_", "method$string$1", "_", "functionArg", "method$ebnf$1"], "postprocess": | ||
data => ({ | ||
type: 'method', | ||
text: '', | ||
children: [data[0], data[4]].concat(R.pluck(3)(data[5])) | ||
}) | ||
}, | ||
{"name": "thunk$ebnf$1$subexpression$1$string$1", "symbols": [{"literal":"-"}, {"literal":">"}], "postprocess": function joiner(d) {return d.join('');}}, | ||
{"name": "thunk$ebnf$1$subexpression$1", "symbols": ["_", "thunk$ebnf$1$subexpression$1$string$1", "_", "functionArg"]}, | ||
{"name": "thunk$ebnf$1", "symbols": ["thunk$ebnf$1$subexpression$1"]}, | ||
{"name": "thunk$ebnf$1$subexpression$2$string$1", "symbols": [{"literal":"-"}, {"literal":">"}], "postprocess": function joiner(d) {return d.join('');}}, | ||
{"name": "thunk$ebnf$1$subexpression$2", "symbols": ["_", "thunk$ebnf$1$subexpression$2$string$1", "_", "functionArg"]}, | ||
{"name": "thunk$ebnf$1", "symbols": ["thunk$ebnf$1$subexpression$2", "thunk$ebnf$1"], "postprocess": function arrconcat(d) {return [d[0]].concat(d[1]);}}, | ||
{"name": "thunk", "symbols": ["thunkParenthesis", "thunk$ebnf$1"], "postprocess": | ||
data => ({ | ||
type: 'function', | ||
text: '', | ||
children: [data[0]].concat(R.pluck(3)(data[1])), | ||
}) | ||
}, | ||
{"name": "thunkParenthesis", "symbols": [{"literal":"("}, "_", {"literal":")"}], "postprocess": | ||
data => ({ | ||
type: 'thunk', | ||
text: '', | ||
children: [], | ||
}) | ||
}, | ||
{"name": "wrappedThunk", "symbols": [{"literal":"("}, "_", "thunk", "_", {"literal":")"}], "postprocess": data => data[2]}, | ||
{"name": "record$ebnf$1", "symbols": []}, | ||
{"name": "record$ebnf$1$subexpression$1", "symbols": ["_", {"literal":","}, "_", "recordField"]}, | ||
{"name": "record$ebnf$1", "symbols": ["record$ebnf$1$subexpression$1", "record$ebnf$1"], "postprocess": function arrconcat(d) {return [d[0]].concat(d[1]);}}, | ||
{"name": "record", "symbols": [{"literal":"{"}, "_", "recordField", "record$ebnf$1", "_", {"literal":"}"}], "postprocess": | ||
data => ({ | ||
type: 'record', | ||
text: '', | ||
children: [data[2]].concat(R.pluck(3)(data[3])), | ||
}) | ||
}, | ||
{"name": "recordField$string$1", "symbols": [{"literal":":"}, {"literal":":"}], "postprocess": function joiner(d) {return d.join('');}}, | ||
{"name": "recordField", "symbols": ["recordFieldName", "_", "recordField$string$1", "_", "type"], "postprocess": | ||
data => ({ | ||
type: 'field', | ||
text: data[0], | ||
children: [data[4]], | ||
}) | ||
}, | ||
{"name": "recordFieldName$ebnf$1", "symbols": [/[A-Za-z0-9_]/]}, | ||
{"name": "recordFieldName$ebnf$1", "symbols": [/[A-Za-z0-9_]/, "recordFieldName$ebnf$1"], "postprocess": function arrconcat(d) {return [d[0]].concat(d[1]);}}, | ||
{"name": "recordFieldName", "symbols": ["recordFieldName$ebnf$1"], "postprocess": data => R.join('', data[0])} | ||
] | ||
, ParserStart: "declaration" | ||
} | ||
if (typeof module !== 'undefined'&& typeof module.exports !== 'undefined') { | ||
module.exports = grammar; | ||
} else { | ||
window.grammar = grammar; | ||
} | ||
const R = require('ramda'); | ||
var grammar = { | ||
ParserRules: [{ "name": "_$ebnf$1", "symbols": [] }, { "name": "_$ebnf$1", "symbols": ["wschar", "_$ebnf$1"], "postprocess": function arrconcat(d) { | ||
return [d[0]].concat(d[1]); | ||
} }, { "name": "_", "symbols": ["_$ebnf$1"], "postprocess": function (d) { | ||
return null; | ||
} }, { "name": "__$ebnf$1", "symbols": ["wschar"] }, { "name": "__$ebnf$1", "symbols": ["wschar", "__$ebnf$1"], "postprocess": function arrconcat(d) { | ||
return [d[0]].concat(d[1]); | ||
} }, { "name": "__", "symbols": ["__$ebnf$1"], "postprocess": function (d) { | ||
return null; | ||
} }, { "name": "wschar", "symbols": [/[ \t\n\v\f]/], "postprocess": id }, { "name": "declaration$string$1", "symbols": [{ "literal": ":" }, { "literal": ":" }], "postprocess": function joiner(d) { | ||
return d.join(''); | ||
} }, { "name": "declaration$ebnf$1$subexpression$1$string$1", "symbols": [{ "literal": "=" }, { "literal": ">" }], "postprocess": function joiner(d) { | ||
return d.join(''); | ||
} }, { "name": "declaration$ebnf$1$subexpression$1", "symbols": ["_", "classConstraints", "_", "declaration$ebnf$1$subexpression$1$string$1"] }, { "name": "declaration$ebnf$1", "symbols": ["declaration$ebnf$1$subexpression$1"], "postprocess": id }, { "name": "declaration$ebnf$1", "symbols": [], "postprocess": function (d) { | ||
return null; | ||
} }, { "name": "declaration", "symbols": ["name", "_", "declaration$string$1", "declaration$ebnf$1", "_", "type"], "postprocess": data => ({ | ||
name: data[0], | ||
constraints: R.pathOr([], [3, 1], data), | ||
type: data[5] | ||
}) | ||
}, { "name": "type$subexpression$1", "symbols": ["typevar"] }, { "name": "type$subexpression$1", "symbols": ["list"] }, { "name": "type$subexpression$1", "symbols": ["typeConstructor"] }, { "name": "type$subexpression$1", "symbols": ["function"] }, { "name": "type$subexpression$1", "symbols": ["thunk"] }, { "name": "type$subexpression$1", "symbols": ["uncurriedFunction"] }, { "name": "type$subexpression$1", "symbols": ["constrainedType"] }, { "name": "type$subexpression$1", "symbols": ["method"] }, { "name": "type$subexpression$1", "symbols": ["record"] }, { "name": "type", "symbols": ["type$subexpression$1"], "postprocess": data => data[0][0] }, { "name": "typevar", "symbols": ["lowId"], "postprocess": data => ({ | ||
type: 'typevar', | ||
text: data[0], | ||
children: [] | ||
}) | ||
}, { "name": "lowId$ebnf$1", "symbols": [] }, { "name": "lowId$ebnf$1", "symbols": [/[a-zA-Z0-9_]/, "lowId$ebnf$1"], "postprocess": function arrconcat(d) { | ||
return [d[0]].concat(d[1]); | ||
} }, { "name": "lowId", "symbols": [/[a-z]/, "lowId$ebnf$1"], "postprocess": data => data[0] + R.join('', data[1]) | ||
}, { "name": "capId$ebnf$1", "symbols": [] }, { "name": "capId$ebnf$1", "symbols": [/[a-zA-Z0-9_]/, "capId$ebnf$1"], "postprocess": function arrconcat(d) { | ||
return [d[0]].concat(d[1]); | ||
} }, { "name": "capId", "symbols": [/[A-Z]/, "capId$ebnf$1"], "postprocess": data => data[0] + R.join('', data[1]) | ||
}, { "name": "name$ebnf$1", "symbols": [/[A-Za-z0-9_'#@-]/] }, { "name": "name$ebnf$1", "symbols": [/[A-Za-z0-9_'#@-]/, "name$ebnf$1"], "postprocess": function arrconcat(d) { | ||
return [d[0]].concat(d[1]); | ||
} }, { "name": "name", "symbols": ["name$ebnf$1"], "postprocess": data => R.join('', data[0]) }, { "name": "classConstraints$subexpression$1", "symbols": ["constraint"] }, { "name": "classConstraints$subexpression$1", "symbols": ["wrappedConstraints"] }, { "name": "classConstraints", "symbols": ["classConstraints$subexpression$1"], "postprocess": data => data[0][0] }, { "name": "constraint", "symbols": ["capId", "__", "lowId"], "postprocess": data => [{ | ||
typeclass: data[0], | ||
typevar: data[2] | ||
}] | ||
}, { "name": "wrappedConstraints$ebnf$1", "symbols": [] }, { "name": "wrappedConstraints$ebnf$1$subexpression$1", "symbols": ["_", { "literal": "," }, "_", "constraint"] }, { "name": "wrappedConstraints$ebnf$1", "symbols": ["wrappedConstraints$ebnf$1$subexpression$1", "wrappedConstraints$ebnf$1"], "postprocess": function arrconcat(d) { | ||
return [d[0]].concat(d[1]); | ||
} }, { "name": "wrappedConstraints", "symbols": [{ "literal": "(" }, "_", "constraint", "wrappedConstraints$ebnf$1", "_", { "literal": ")" }], "postprocess": data => data[2].concat(R.unnest(R.pluck(3)(data[3]))) | ||
}, { "name": "typeConstructor$ebnf$1", "symbols": [] }, { "name": "typeConstructor$ebnf$1$subexpression$1", "symbols": ["__", "typeConstructorArg"] }, { "name": "typeConstructor$ebnf$1", "symbols": ["typeConstructor$ebnf$1$subexpression$1", "typeConstructor$ebnf$1"], "postprocess": function arrconcat(d) { | ||
return [d[0]].concat(d[1]); | ||
} }, { "name": "typeConstructor", "symbols": ["capId", "typeConstructor$ebnf$1"], "postprocess": data => ({ | ||
type: 'typeConstructor', | ||
text: data[0], | ||
children: R.pluck(1)(data[1]) | ||
}) | ||
}, { "name": "typeConstructorArg$subexpression$1", "symbols": ["typevar"] }, { "name": "typeConstructorArg$subexpression$1", "symbols": ["list"] }, { "name": "typeConstructorArg$subexpression$1", "symbols": ["wrappedConstrainedType"] }, { "name": "typeConstructorArg$subexpression$1", "symbols": ["nullaryTypeConstructor"] }, { "name": "typeConstructorArg$subexpression$1", "symbols": ["wrappedTypeConstructor"] }, { "name": "typeConstructorArg", "symbols": ["typeConstructorArg$subexpression$1"], "postprocess": data => data[0][0] }, { "name": "nullaryTypeConstructor", "symbols": ["capId"], "postprocess": data => ({ | ||
type: 'typeConstructor', | ||
text: data[0], | ||
children: [] | ||
}) | ||
}, { "name": "wrappedTypeConstructor", "symbols": [{ "literal": "(" }, "_", "typeConstructor", "_", { "literal": ")" }], "postprocess": data => data[2] }, { "name": "constrainedTypeArg$subexpression$1", "symbols": ["nullaryTypeConstructor"] }, { "name": "constrainedTypeArg$subexpression$1", "symbols": ["typevar"] }, { "name": "constrainedTypeArg$subexpression$1", "symbols": ["wrappedTypeConstructor"] }, { "name": "constrainedTypeArg$subexpression$1", "symbols": ["wrappedConstrainedType"] }, { "name": "constrainedTypeArg", "symbols": ["constrainedTypeArg$subexpression$1"], "postprocess": data => data[0][0] }, { "name": "constrainedType$ebnf$1$subexpression$1", "symbols": ["__", "constrainedTypeArg"] }, { "name": "constrainedType$ebnf$1", "symbols": ["constrainedType$ebnf$1$subexpression$1"] }, { "name": "constrainedType$ebnf$1$subexpression$2", "symbols": ["__", "constrainedTypeArg"] }, { "name": "constrainedType$ebnf$1", "symbols": ["constrainedType$ebnf$1$subexpression$2", "constrainedType$ebnf$1"], "postprocess": function arrconcat(d) { | ||
return [d[0]].concat(d[1]); | ||
} }, { "name": "constrainedType", "symbols": ["lowId", "constrainedType$ebnf$1"], "postprocess": data => ({ | ||
type: 'constrainedType', | ||
text: data[0], | ||
children: R.pluck(1)(data[1]) | ||
}) | ||
}, { "name": "wrappedConstrainedType", "symbols": [{ "literal": "(" }, "_", "constrainedType", "_", { "literal": ")" }], "postprocess": data => data[2] }, { "name": "list", "symbols": [{ "literal": "[" }, "_", "type", "_", { "literal": "]" }], "postprocess": data => ({ | ||
type: 'list', | ||
text: '', | ||
children: [data[2]] | ||
}) | ||
}, { "name": "function$ebnf$1$subexpression$1$string$1", "symbols": [{ "literal": "-" }, { "literal": ">" }], "postprocess": function joiner(d) { | ||
return d.join(''); | ||
} }, { "name": "function$ebnf$1$subexpression$1", "symbols": ["_", "function$ebnf$1$subexpression$1$string$1", "_", "functionArg"] }, { "name": "function$ebnf$1", "symbols": ["function$ebnf$1$subexpression$1"] }, { "name": "function$ebnf$1$subexpression$2$string$1", "symbols": [{ "literal": "-" }, { "literal": ">" }], "postprocess": function joiner(d) { | ||
return d.join(''); | ||
} }, { "name": "function$ebnf$1$subexpression$2", "symbols": ["_", "function$ebnf$1$subexpression$2$string$1", "_", "functionArg"] }, { "name": "function$ebnf$1", "symbols": ["function$ebnf$1$subexpression$2", "function$ebnf$1"], "postprocess": function arrconcat(d) { | ||
return [d[0]].concat(d[1]); | ||
} }, { "name": "function", "symbols": ["functionArg", "function$ebnf$1"], "postprocess": data => ({ | ||
type: 'function', | ||
text: '', | ||
children: [data[0]].concat(R.pluck(3)(data[1])) | ||
}) | ||
}, { "name": "functionArg$subexpression$1", "symbols": ["typevar"] }, { "name": "functionArg$subexpression$1", "symbols": ["list"] }, { "name": "functionArg$subexpression$1", "symbols": ["typeConstructor"] }, { "name": "functionArg$subexpression$1", "symbols": ["constrainedType"] }, { "name": "functionArg$subexpression$1", "symbols": ["wrappedFunction"] }, { "name": "functionArg$subexpression$1", "symbols": ["wrappedUncurriedFunction"] }, { "name": "functionArg$subexpression$1", "symbols": ["wrappedThunk"] }, { "name": "functionArg$subexpression$1", "symbols": ["record"] }, { "name": "functionArg", "symbols": ["functionArg$subexpression$1"], "postprocess": data => data[0][0] }, { "name": "wrappedFunction", "symbols": [{ "literal": "(" }, "_", "function", "_", { "literal": ")" }], "postprocess": data => data[2] }, { "name": "uncurriedFunction$string$1", "symbols": [{ "literal": "-" }, { "literal": ">" }], "postprocess": function joiner(d) { | ||
return d.join(''); | ||
} }, { "name": "uncurriedFunction", "symbols": ["uncurriedFunctionParams", "_", "uncurriedFunction$string$1", "_", "type"], "postprocess": data => ({ | ||
type: 'uncurriedFunction', | ||
text: '', | ||
children: [data[0], data[4]] | ||
}) | ||
}, { "name": "uncurriedFunctionParams$ebnf$1$subexpression$1", "symbols": ["_", { "literal": "," }, "_", "type"] }, { "name": "uncurriedFunctionParams$ebnf$1", "symbols": ["uncurriedFunctionParams$ebnf$1$subexpression$1"] }, { "name": "uncurriedFunctionParams$ebnf$1$subexpression$2", "symbols": ["_", { "literal": "," }, "_", "type"] }, { "name": "uncurriedFunctionParams$ebnf$1", "symbols": ["uncurriedFunctionParams$ebnf$1$subexpression$2", "uncurriedFunctionParams$ebnf$1"], "postprocess": function arrconcat(d) { | ||
return [d[0]].concat(d[1]); | ||
} }, { "name": "uncurriedFunctionParams", "symbols": [{ "literal": "(" }, "_", "type", "uncurriedFunctionParams$ebnf$1", "_", { "literal": ")" }], "postprocess": data => ({ | ||
type: 'parameters', | ||
text: '', | ||
children: [data[2]].concat(R.pluck(3)(data[3])) | ||
}) | ||
}, { "name": "wrappedUncurriedFunction", "symbols": [{ "literal": "(" }, "_", "uncurriedFunction", "_", { "literal": ")" }], "postprocess": data => data[2] }, { "name": "method$string$1", "symbols": [{ "literal": "~" }, { "literal": ">" }], "postprocess": function joiner(d) { | ||
return d.join(''); | ||
} }, { "name": "method$ebnf$1", "symbols": [] }, { "name": "method$ebnf$1$subexpression$1$string$1", "symbols": [{ "literal": "-" }, { "literal": ">" }], "postprocess": function joiner(d) { | ||
return d.join(''); | ||
} }, { "name": "method$ebnf$1$subexpression$1", "symbols": ["_", "method$ebnf$1$subexpression$1$string$1", "_", "functionArg"] }, { "name": "method$ebnf$1", "symbols": ["method$ebnf$1$subexpression$1", "method$ebnf$1"], "postprocess": function arrconcat(d) { | ||
return [d[0]].concat(d[1]); | ||
} }, { "name": "method", "symbols": ["typeConstructor", "_", "method$string$1", "_", "functionArg", "method$ebnf$1"], "postprocess": data => ({ | ||
type: 'method', | ||
text: '', | ||
children: [data[0], data[4]].concat(R.pluck(3)(data[5])) | ||
}) | ||
}, { "name": "thunk$ebnf$1$subexpression$1$string$1", "symbols": [{ "literal": "-" }, { "literal": ">" }], "postprocess": function joiner(d) { | ||
return d.join(''); | ||
} }, { "name": "thunk$ebnf$1$subexpression$1", "symbols": ["_", "thunk$ebnf$1$subexpression$1$string$1", "_", "functionArg"] }, { "name": "thunk$ebnf$1", "symbols": ["thunk$ebnf$1$subexpression$1"] }, { "name": "thunk$ebnf$1$subexpression$2$string$1", "symbols": [{ "literal": "-" }, { "literal": ">" }], "postprocess": function joiner(d) { | ||
return d.join(''); | ||
} }, { "name": "thunk$ebnf$1$subexpression$2", "symbols": ["_", "thunk$ebnf$1$subexpression$2$string$1", "_", "functionArg"] }, { "name": "thunk$ebnf$1", "symbols": ["thunk$ebnf$1$subexpression$2", "thunk$ebnf$1"], "postprocess": function arrconcat(d) { | ||
return [d[0]].concat(d[1]); | ||
} }, { "name": "thunk", "symbols": ["thunkParenthesis", "thunk$ebnf$1"], "postprocess": data => ({ | ||
type: 'function', | ||
text: '', | ||
children: [data[0]].concat(R.pluck(3)(data[1])) | ||
}) | ||
}, { "name": "thunkParenthesis", "symbols": [{ "literal": "(" }, "_", { "literal": ")" }], "postprocess": data => ({ | ||
type: 'thunk', | ||
text: '', | ||
children: [] | ||
}) | ||
}, { "name": "wrappedThunk", "symbols": [{ "literal": "(" }, "_", "thunk", "_", { "literal": ")" }], "postprocess": data => data[2] }, { "name": "record$ebnf$1", "symbols": [] }, { "name": "record$ebnf$1$subexpression$1", "symbols": ["_", { "literal": "," }, "_", "recordField"] }, { "name": "record$ebnf$1", "symbols": ["record$ebnf$1$subexpression$1", "record$ebnf$1"], "postprocess": function arrconcat(d) { | ||
return [d[0]].concat(d[1]); | ||
} }, { "name": "record", "symbols": [{ "literal": "{" }, "_", "recordField", "record$ebnf$1", "_", { "literal": "}" }], "postprocess": data => ({ | ||
type: 'record', | ||
text: '', | ||
children: [data[2]].concat(R.pluck(3)(data[3])) | ||
}) | ||
}, { "name": "recordField$string$1", "symbols": [{ "literal": ":" }, { "literal": ":" }], "postprocess": function joiner(d) { | ||
return d.join(''); | ||
} }, { "name": "recordField", "symbols": ["recordFieldName", "_", "recordField$string$1", "_", "type"], "postprocess": data => ({ | ||
type: 'field', | ||
text: data[0], | ||
children: [data[4]] | ||
}) | ||
}, { "name": "recordFieldName$ebnf$1", "symbols": [/[A-Za-z0-9_]/] }, { "name": "recordFieldName$ebnf$1", "symbols": [/[A-Za-z0-9_]/, "recordFieldName$ebnf$1"], "postprocess": function arrconcat(d) { | ||
return [d[0]].concat(d[1]); | ||
} }, { "name": "recordFieldName", "symbols": ["recordFieldName$ebnf$1"], "postprocess": data => R.join('', data[0]) }], | ||
ParserStart: "declaration" | ||
}; | ||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { | ||
module.exports = grammar; | ||
} else { | ||
window.grammar = grammar; | ||
} | ||
})(); |
@@ -10,4 +10,2 @@ 'use strict'; | ||
var _ramda2 = _interopRequireDefault(_ramda); | ||
var _nearley = require('nearley'); | ||
@@ -23,3 +21,3 @@ | ||
var parseFrom = _ramda2.default.curry(function parseFrom(start, s) { | ||
var parseFrom = (0, _ramda.curry)(function parseFrom(start, s) { | ||
var parser = new _nearley2.default.Parser(_grammar2.default.ParserRules, start); | ||
@@ -26,0 +24,0 @@ |
{ | ||
"name": "hm-parser", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"repository": "https://github.com/xodio/hm-parser", | ||
@@ -8,3 +8,3 @@ "description": "A parser for Hidnley Milner notations", | ||
"scripts": { | ||
"build": "babel src/ -d dist/ && nearleyc src/hm.ne -o dist/grammar.js", | ||
"build": "babel src/ -d dist/ && nearleyc src/hm.ne | babel --out-file dist/grammar.js", | ||
"test": "tape test/test.js" | ||
@@ -11,0 +11,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
101136
10
588
2