Crate yash_syntax

source ·
Expand description

Shell language syntax and parser.

This crate defines data types for constructing abstract syntax trees (AST) of the shell language. See the syntax module for details.

Some AST elements (e.g. Word) provide a location where the element appears in the source code. See the source module to learn how locations are coded in this crate.

To parse source code into an AST, you can use the parse function on a &str, which is enabled by the implementations of FromStr for the AST data types. However, ASTs constructed this way do not contain very meaningful source information: All locations’ source will be unknown. To include substantial source information, you need to prepare a lexer with source information and then pass it to a parser. See the parser module for details.

The input module defines an abstract method for feeding the parser with source code.

This crate also defines the alias module that can be used to define aliases that are recognized while parsing.

Modules§

  • Defining aliases.
  • Methods about passing source code to the parser.
  • Syntax parser for the shell language.
  • Source code that is passed to the parser.
  • Shell command language syntax.