Crate conch_parser

Source
Expand description

A library for parsing programs written in the shell programming language.

The Parser implementation will pass all of its intermediate parse results to a Builder implementation, allowing the Builder to transform the results to a desired format. This allows for customizing what AST is produced without having to walk and transform an entire AST produced by the parser.

See the Parser documentation for more information on getting started.

§Supported Grammar

  • Conditional lists (foo && bar || baz)
  • Pipelines (! foo | bar)
  • Compound commands
  • Brace blocks ({ foo; })
  • Subshells ($(foo))
  • for / case / if / while / until
  • Function declarations
  • Redirections
  • Heredocs
  • Comments
  • Parameters ($foo, $@, etc.)
  • Parameter substitutions (${foo:-bar})
  • Quoting (single, double, backticks, escaping)
  • Arithmetic substitutions
  • Common arithmetic operations required by the POSIX standard
  • Variable expansion
  • Not yet implemented: Other inner abitrary parameter/substitution expansion

§Supported Cargo Features

  • nightly: enable unstable features/optimizations which require a nightly compiler

Modules§

ast
Defines abstract representations of the shell source.
lexer
This module defines a lexer to recognize tokens of the shell language.
parse
The definition of a parser (and related methods) for the shell language.
token
This module defines the tokens of the shell language.