Crate yash_syntax

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 following modules are re-exported from the yash-env crate:

  • The input module defines an abstract method for feeding the parser with source code.
  • The alias module can be used to define aliases that are recognized while parsing.
  • The decl_util module provides utilities for working with declaration utilities.

Modules§

alias
Defining aliases
decl_util
Items for parsing declaration utilities
input
Methods about passing source code to the parser
parser
Syntax parser for the shell language
source
Shell script source code
syntax
Shell command language syntax