@ericcornelissen/bash-parser

0.5.3 • Public • Published

bash-parser

A fork of vorpaljs/bash-parser - Parses bash source code to produce an AST

This fork is focussed at dependency maintenance and will not receive any updates beyond that. No new features, no bug (nor security) fixes.

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-2022 vorpaljs Copyright (c) 2023-2024 ericcornelissen, sockmaster27

Dependents (0)

Package Sidebar

Install

npm i @ericcornelissen/bash-parser

Weekly Downloads

147,851

Version

0.5.3

License

MIT

Unpacked Size

197 kB

Total Files

69

Last publish

Collaborators

  • ericcornelissen