-
Seb35 authored
A lot of tests have been added to cover most rules. The grammar have been improved with increased legibility and a better handling of the semantic results (implemented in the grammar actions). The packaging have been reworked to avoid the step reading the grammar with node’s fs.readFile(). Now the basic use (compiled parser + grammar + basic loop to find articles) are compiled and packaged; and the advanced use (generation of own grammar is accessible for developers (with devDependencies). Also a PEG.js plugin is provided to prevent the grammar from failing: in this use case a fail is simply a precandidate which is not a link and there is no need to have details about why it failed, and we always want a partial match (to match only the beginning of the input) although default PEG.js parsers capture entire strings. Such simplification decreased the size of the minified parser by 20 % (from 123 Kio to 96 Kio) and probably increased the speed. This was proposed as a feature to PEG.js in a lighter form.