{"_id":"@agarimo/lexer","name":"@agarimo/lexer","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@agarimo/lexer","version":"1.0.0","description":"Generic lexer","main":"src/index.js","scripts":{"test":"eslint --fix . && jest --silent --coverage --maxWorkers=4 ."},"repository":{"type":"git","url":"git+https://github.com/agarimojs/lexer.git"},"author":{"name":"Jesus Seijas","email":"jseijas@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/agarimojs/lexer/issues"},"homepage":"https://github.com/agarimojs/lexer#readme","devDependencies":{"eslint":"^8.12.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^8.5.0","eslint-plugin-import":"^2.26.0","eslint-plugin-jest":"^26.1.3","eslint-plugin-prettier":"^4.0.0","jest":"^27.5.1","prettier":"^2.6.2"},"publishConfig":{"access":"public"},"gitHead":"9b6bb4ae4b1d920d94e51773476c708304d39a87","_id":"@agarimo/lexer@1.0.0","_nodeVersion":"15.14.0","_npmVersion":"7.7.6","dist":{"integrity":"sha512-IeYuUgIG6y9DBm9xWkggxNjRb8Wp8YjgLPvq6UL3LJ7tEz3P8LHkAqwJm+E84WKhK5A3PQ45IQ6twwhNpmlqKQ==","shasum":"37f7662bdfb51af938258174bf9d0b630bb7bfbb","tarball":"https://registry.npmjs.org/@agarimo/lexer/-/lexer-1.0.0.tgz","fileCount":8,"unpackedSize":15370,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA8CDy7xvlV9FVSvXHs9E4NyOW+a72SkUQgS7NRm+IKLAiA/+IjaXyNz1S4iew/ly4OiHRwesUXwPK1HMjzzIkvVDg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJisXojACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpI9RAAgk1ceDc1aOvnEd37NfJQ5KM5NBypzDI3wjyp4yyw9XQXwb3U\r\nHr0OaHSj6x0XLCTYFvF/1DK+HCZcWwkmssZ89naXD4hy7mGrbi5A6CAvkN59\r\nXlOx5WkkWtq4Cx3akkgLQM8fh/1y+3rTM0tZONoIm4YXeW9ZCYShku4K+GLX\r\ny/kXLkZuSP60rD4plJFUxTsfIFGsyfac791C1jz76K+ZygXuCCMpEY+B+Qpe\r\nKe3THb7GpPG3do+9rjwgz31vkUiQMrJuc/XqBrR4mZbPYSwGog3JBO5yj8nR\r\nHKJzb87QJjIVq9HKmaxMwrWVwyD21t5J/Ff3N3Mnto+DKNikTKfHRKfMmfAz\r\n9vwErzJduc7Tg8o7e+vPXkpiddbBjtZMvpEUoLQmsh1zcYegMqmDJMYB4V5E\r\n3HRf/RGrwsbAIjR+jqgptHhpvwI4iynvNJF9OtzNuayk5h+ks92dDVLVEEeb\r\nFrYAS1mf9olwPdiibEbSDDv47/FF8djG7roRliQECLh6t2PNXZ3uNLYZ8+qQ\r\nJGwo8LUIlE3e5zsLsTlaDUdlzoWwUB8BPALPruINBYotIU9nAqhRbJem13XM\r\ngU9T+wC3Pnkoh19PJbOXGEdtM+7//tFqL2B+t8gIipE/zAkxswZbOMG0r9Ve\r\nNUZwU61ZhgltOWkrcoHlQcUDgM42rtTV59Q=\r\n=pR2R\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"jesus-seijas","email":"jseijas@gmail.com"},"directories":{},"maintainers":[{"name":"jesus-seijas","email":"jseijas@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lexer_1.0.0_1655798306945_0.5573759422091198"},"_hasShrinkwrap":false}},"time":{"created":"2022-06-21T07:58:26.878Z","1.0.0":"2022-06-21T07:58:27.127Z","modified":"2022-06-21T07:58:27.261Z"},"maintainers":[{"name":"jesus-seijas","email":"jseijas@gmail.com"}],"description":"Generic lexer","homepage":"https://github.com/agarimojs/lexer#readme","repository":{"type":"git","url":"git+https://github.com/agarimojs/lexer.git"},"author":{"name":"Jesus Seijas","email":"jseijas@gmail.com"},"bugs":{"url":"https://github.com/agarimojs/lexer/issues"},"license":"MIT","readme":"# @agarimo/lexer\n\n## Introduction\n\nThis package provides the class _Lexer_ that is the basic class to build parsers.\n\n## Installation\n\nYou can install it using NPM\n\n```shell\n  npm i @agarimo/lexer\n```\n\n## Token Types\n- Identifier: 1\n- Number: 2\n- String: 3\n- Operator: 4\n- Separator: 5\n- EndOfLine: 6\n- Assignment: 7\n- EndOfFile: 8\n\n## Example of use\n\n```javascript\nconst { Lexer } = require('@agarimo/lexer');\n\nconst script = `\nn = 0\nwhile n < 10:\n  n += 1\nprint(\"hola\")\n`\n\nconst lexer = new Lexer();\nlexer.init(script);\nlet token;\nwhile (!token || token.type !== Lexer.TokenType.EndOfFile) {\n  token = lexer.nextToken();\n  console.log(token);\n}\n```\n\nThis will show in console:\n\n```shell\nToken { value: 'n', type: 1 }\nToken { value: '=', type: 7 }\nToken { value: '0', type: 2 }\nToken { value: '\\n', type: 6 }\nToken { value: 'while', type: 1 }\nToken { value: 'n', type: 1 }\nToken { value: '<', type: 4 }\nToken { value: '10', type: 2 }\nToken { value: ':', type: 5 }\nToken { value: '\\n', type: 6 }\nToken { value: 'n', type: 1 }\nToken { value: '+=', type: 7 }\nToken { value: '1', type: 2 }\nToken { value: '\\n', type: 6 }\nToken { value: 'print', type: 1 }\nToken { value: '(', type: 5 }\nToken { value: 'hola', type: 3 }\nToken { value: ')', type: 5 }\nToken { value: '', type: 8 }\n```\n\n","readmeFilename":"README.md"}