@mockpiler/lexer
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

@mockpiler/lexer

Lexical Analyzer for MockpilerJS

Usage

import { Lexer } from '@mockpiler/lexer'

const input = `
  [
    (2) {
      name
      age
    }
  ]
`

const lexer = new Lexer(input)
const tokens = lexer.scan()

console.log(tokens)

/**
 * Output:
 *
 *  [
 *    {
 *      type: 'array',
 *      value: '[',
 *      location: {
 *        start: {
 *          line: 2,
 *          column: 3
 *        },
 *        end: ...
 *      }
 *    },
 *    ...
 *  ]
 */

Readme

Keywords

none

Package Sidebar

Install

npm i @mockpiler/lexer

Weekly Downloads

13

Version

0.2.0

License

MIT

Unpacked Size

17.9 kB

Total Files

6

Last publish

Collaborators

  • aeroxmotion