@mockpiler/lexer
v0.2.0
Published
Lexical Analyzer for MockpilerJS
Downloads
64
Readme
@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: ...
* }
* },
* ...
* ]
*/