Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vorpaljs/bash-parser
Parses bash into an AST
https://github.com/vorpaljs/bash-parser
ast bash parse
Last synced: 6 days ago
JSON representation
Parses bash into an AST
- Host: GitHub
- URL: https://github.com/vorpaljs/bash-parser
- Owner: vorpaljs
- License: mit
- Created: 2016-03-08T22:17:57.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-06-23T18:55:05.000Z (7 months ago)
- Last Synced: 2024-10-17T02:31:08.556Z (3 months ago)
- Topics: ast, bash, parse
- Language: JavaScript
- Homepage: https://vorpaljs.github.io/bash-parser-playground/
- Size: 1.19 MB
- Stars: 200
- Watchers: 7
- Forks: 34
- Open Issues: 23
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# bash-parser
Parses bash source code to produce an AST
[![Travis Build Status](https://img.shields.io/travis/vorpaljs/bash-parser/master.svg)](http://travis-ci.org/vorpaljs/bash-parser)
[![Coveralls](https://img.shields.io/coveralls/vorpaljs/bash-parser.svg?maxAge=2592000)](https://coveralls.io/github/vorpaljs/bash-parser)
[![NPM module](https://img.shields.io/npm/v/bash-parser.svg)](https://npmjs.org/package/bash-parser)
[![NPM downloads](https://img.shields.io/npm/dt/bash-parser.svg)](https://npmjs.org/package/bash-parser)
[![Try online](https://img.shields.io/badge/try_it-online!-yellow.svg)](https://vorpaljs.github.io/bash-parser-playground/)# Installation
```bash
npm install --save bash-parser
```# Usage
```js
const parse = require('bash-parser');
const ast = parse('echo ciao');
````ast` result is:
```js
{
type: "Script",
commands: [
{
type: "SimpleCommand",
name: {
text: "echo",
type: "Word"
},
suffix: [
{
text: "ciao",
type: "Word"
}
]
}
]
}
```# Related projects
* [cash](https://github.com/dthree/cash) - This parser should become the parser used by `cash` (and also [vorpal](https://github.com/dthree/vorpal))
* [nsh](https://github.com/piranna/nsh) - This parser should become the parser used by `nsh`
* [js-shell-parse](https://github.com/grncdr/js-shell-parse) - bash-parser was born as a fork of `js-shell-parse`, but was rewritten to use a `jison` grammar
* [jison](https://github.com/zaach/jison) - Bison in JavaScript.# Documentation
Look in [documents folder](https://github.com/vorpaljs/bash-parser/tree/master/documents)
# License
The MIT License (MIT)
Copyright (c) 2016 vorpaljs