{"_id":"apg-lite@1.0.7","bugs":{"url":"https://github.com/ldthomas/apg-lite/issues"},"dist":{"shasum":"523e43e186d30ab1107226b3ab9b13ed4fd4f4f0","tarball":"http://registry-npm.ywwl.com/apg-lite/download/apg-lite-1.0.7.tgz","fileCount":79,"integrity":"sha512-wehJttEme63zE8FsrFThE8Ozmx2u8brywefDNb9oVPUQJupDNBFOOyhbpQSI2P+k/yqKhdgx2DErLfy4Pswycg==","signatures":[{"sig":"MEQCID30eh/at/bf35lsPeXZFJehNk8MZDQ/kS/MUd83wOwwAiAsjd0kD+Xr14e87SJ4IVM1v59AEkcmCIZu5ugABkjyBQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBc0RwXzcHbyPuGQFjM64NitSn/1JPtleLYAJ5OQL5fDAiEAzHUKoigKzmA54bG0W7R4ufSBTNeJQfXie/FvpqgQrmI="}],"unpackedSize":582153,"size":109843,"noattachment":false,"key":"/apg-lite/-/apg-lite-1.0.7.tgz"},"jest":{"bail":1,"verbose":true,"testRegex":"/__tests__/.*\\.test\\.js"},"main":"lib/parser.js","name":"apg-lite","type":"module","author":{"url":"https://sabnf.com/","name":"Lowell D. Thomas","email":"ldt@sabnf.com"},"gitHead":"1a1d1dbb9c9889d08d4d638248f4c1bc91952444","license":"BSD-2-Clause","scripts":{"apg":"node node_modules/apg-js/bin/apg.sh","ast":"node ast-app/parser-app.js && node ast-app/ast-app.js && node ast-app/ast-xml.js","min":"bin/min.sh","udt":"node udt-app/node-app.js","uri":"node uri-app/node-app.js","cool":"node cool-app/node-app.js","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js","basic":"node basic-app/node-app.js","regen":"bin/regen.sh","trace":"node trace-app/node-app.js","terser":"terser","lookahead":"node lookahead-app/positive-app.js && node lookahead-app/negative-app.js"},"version":"1.0.7","_npmUser":{"name":"ldthomas","email":"ldt@sabnf.com"},"homepage":"https://github.com/ldthomas/apg-lite#readme","keywords":["APG","parser","ABNF","SABNF"],"repository":{"url":"git+https://github.com/ldthomas/apg-lite.git","type":"git"},"_npmVersion":"11.19.1","description":"lightweight JavaScript APG parser","directories":{},"maintainers":[{"name":"ldthomas","email":"ldt@sabnf.com"}],"_nodeVersion":"24.22.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","apg-js":"4.4.0","eslint":"^7.26.0","terser":"^5.24.0","prettier":"^2.3.0","eslint-config-airbnb":"^18.2.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/apg-lite_1.0.7_1793197623107_0.13631683849853582"},"readme":"# APG Lite\r\n\r\n`apg-lite` is a light-weight parser of [ABNF](https://www.rfc-editor.org/rfc/rfc5234) grammars.\r\nIt is a parser only.\r\nIt relies on [apg-js](https://github.com/ldthomas/apg-js), version 4.3.0 or higher, with the new `--lite` option\r\nto generate ESM grammar objects.\r\n`apg-lite` features:\r\n\r\n- Parses only JavaScript strings, whereas `apg-js` can parse any arbitrary array of positive integers.\r\n- Retains only three of the eight [SABNF](https://sabnf.com/docs/python/md_docs_SABNF.html) superset operators of `apg-js`.\r\n  - UDT, (User-Defined Terminals) Handwritten, phrase-matching code snippets.\r\n  - AND, The positive look-ahead operator (see [syntactic predicates](https://en.wikipedia.org/wiki/Syntactic_predicate)).\r\n  - NOT, The negative look-ahead operator.\r\n- The AST has been simplified (see `./ast-app/`).\r\n- Tracing (debugging) the parse tree has been simplified (see `./trace-app/`).\r\n- Statistics collection (profiling) has been simplified (see `./trace-app/`).\r\n- `apg-lite` is fully contained in a single JavaScript file.\r\n  - `./lib/parser.js` contains ECMAScript Modules (ESM) which can be `import`-ed into your application.\r\n  - `./lib/web-parser.js` can be scripted into your web page application with no bundling necessary.\r\n\r\nA number of example application are included here to demonstrate the use of `apg-lite` in both\r\nNode.js and web page applications. Each example application is in its own directory.\r\nThe documentation for each is in the file `documentation.md`.\r\nMost (but not all) examples will be presented as both Node.js and web page applications.\r\n\r\n- `./basic-app/` - A simple parser demonstrating the most basic construction and use of a parser.\r\n- `./ast-app/` - Use of the AST - how to construct the AST and translate or semantically manipulate the phrases captured by the AST nodes.\r\n  Demonstrates generating an XML version of the AST.\r\n- `./udt-app/` - Use of a UDT, a handwritten code snippet to recognize a somewhat complicated phrase.\r\n- `./lookahead-app/` - Demonstration of the look ahead operators.\r\n- `./trace-app/` - How to debug and profile the parse tree.\r\n  - Tracing is the primary means of debugging a grammar or input string.\r\n  - Counting node hits serves as a type of profiling, exposing which rules are most often hit.\r\n- `./cool-app/` - A simple demonstration of parsing a string with UTF+32 (in this case emoticon) characters.\r\n- `./uri-app/` - This example builds a light-weight, but robust and well-tested URI parser.\r\n\r\nThe Node.js applications can all be run from the `package.json` scripts.\r\nUse `npm run` to see the script names of the demonstrations.\r\n\r\n### The URI Parser\r\n\r\nNote: version 1.0.5 fixes a bug in the URI grammar.\r\nThe previous versions incorrectly allowed empty strings for the IPv4 octets.\r\nNo changes to the `apg-lite` parser or any of the other examples have been made.\r\n\r\nThe `UriParser` object in the `./uri-app/` application is of special interest.\r\nIt is a fully-contained (no dependencies) [URI](https://www.rfc-editor.org/rfc/rfc3986) parser.\r\nAny URI can be parsed with, for example:\r\n\r\n> npm run uri -- http://user@example.com\r\n\r\nIf no argument is given, the example will parse a pre-chosen representive URI.\r\n\r\n`UriParser` is well-tested with [Jest](https://jestjs.io/) unit tests in the `__tests__` directory.\r\n\r\n> npm test\r\n\r\nwill run all of the unit tests.\r\n\r\nSee `./uri-app/documentation.md` for complete documentation.\r\nSee `./uri-app/node-app.js` for a sample Node.js application\r\nand `./uri-app/web.html` for sample web page application.\r\n","publish_time":1793197623261,"_cnpm_publish_time":1793197623261,"dist-tags":{"latest":"1.0.7"}}