bash-parserParses bash into an AST

联合创作 · 2023-09-30 04:32

bash-parser

Parses bash source code to produce an AST

Travis Build Status Coveralls NPM module NPM downloads Try online

Installation

npm install --save bash-parser

Usage

  const parse = require('bash-parser');
  const ast = parse('echo ciao');

ast result is:

{
		type: "Script",
		commands: [
			{
				type: "SimpleCommand",
				name: {
					text: "echo",
					type: "Word"
				},
				suffix: [
					{
						text: "ciao",
						type: "Word"
					}
				]
			}
		]
	}

Related projects

  • cash - This parser should become the parser used by cash (and also vorpal)
  • nsh - This parser should become the parser used by nsh
  • js-shell-parse - bash-parser was born as a fork of js-shell-parse, but was rewritten to use a jison grammar
  • jison - Bison in JavaScript.

Documentation

Look in documents folder

License

The MIT License (MIT)

Copyright (c) 2016 vorpaljs

浏览 7
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报