Skip to content
This repository was archived by the owner on Dec 31, 2025. It is now read-only.

ericcornelissen/bash-parser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

463 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Parses bash into an AST; fork of vorpaljs/bash-parser offering dependency maintenance

Resources

License

Stars

Watchers

Forks

Contributors

Languages

  • JavaScript 100.0%