@friday-friday/unified-lua
v0.3.0
Published
unified parser plugin for Lua — produces luast syntax trees
Downloads
81
Maintainers
Readme
unified-lua
unified parser plugin for Lua — produces luast syntax trees.
What is this?
This package is a unified plugin that teaches unified how to parse Lua
source code into a luast syntax tree. It uses @friday-friday/luaparse under
the hood with {ast: 'luast'} mode.
Install
npm install @friday-friday/unified-luaUse
import {unified} from 'unified'
import luaParse from '@friday-friday/unified-lua'
const tree = unified()
.use(luaParse, {luaVersion: '5.3'})
.parse('local x = 1')
// tree.type === 'root'API
unified().use(luaParse, options?)
Configure the plugin.
Options:
luaVersion('5.1' | '5.2' | '5.3' | 'LuaJIT', default:'5.1') — Lua version to parseencodingMode('none' | 'x-user-defined' | 'pseudo-latin1', default:'none') — string encoding mode
Related
@friday-friday/luast— tree specification and types@friday-friday/luast-util-visit— tree visitor@friday-friday/luast-util-scope— scope analysis@friday-friday/luaparse— Lua parser
