package morbig
Module MorbigSource
Main API points
Parsing shell scripts
parse_file filename performs the syntactic analysis of filename and returns a concrete syntax tree if filename content is syntactically correct.
Raises exceptions from Errors.
parse_string filename content is similar to parse_file except the script source code is provided as a string.
Serialization of CST
load_binary_cst cin retrieves a serialized CST from input_channel cin.
save_binary_cst cout cst stores a serialized cst in cout.
load_json_cst cin retrieves a CST in JSON format from input_channel cin.
save_json_cst cout cst stores a cst using JSON format in cout.
save_dot_cst cout cst stores a cst using DOT format in cout.
CST helpers
on_located f applies f on a located value, preserving its location.
start_of_position p returns the beginning of a position p.
end_of_position p returns the end of a position p.
filename_of_position p returns the filename of a position p.
string_of_lexing_position p returns a human-readable representation of the lexing position p, using a format recognized by Emacs, and other decent editors.
POSIX related helpers
remove_quotes s yields a copy of string s, with all quotes removed as described in the POSIX specification.
Other modules
module CST : sig ... endThe type for concrete syntax trees of POSIX shell scripts. These trees are produced by the Morbig parser.
Serializers for concrete syntax trees.
Visitors for concrete syntax trees.
HereDocument.Lexer handles here documents. It does:
This module implements the token recognizer when it is not in the mode that recognizes here-documents, and in cases where the recognition of tokens is independent from the parsing context, as specified by: