Module Morsmall__AST
Names in Shell are just strings with a few additional conditions.
and character_range= char listand attribute=|NoAttribute|ParameterLength of word|UseDefaultValues of word|AssignDefaultValues of word|IndicateErrorifNullorUnset of word|UseAlternativeValue of word|RemoveSmallestSuffixPattern of word|RemoveLargestSuffixPattern of word|RemoveSmallestPrefixPattern of word|RemoveLargestPrefixPattern of wordand word_component=|WTildePrefix of string|WLiteral of string|WDoubleQuoted of word|WVariable of name * attribute|WSubshell of program|WGlobAll|WGlobAny|WBracketExpression of Morbig.CST.bracket_expressionand word= word_component listand word'= word Morsmall.Location.located
and pattern= word listand pattern'= pattern Morsmall.Location.located
and assignment= name * wordand assignment'= assignment Morsmall.Location.located
Simple Command
See POSIX, 2 Shell & Utilities, 2.9.1 Simple Command
Lists and Pipelines
See POSIX, 2 Shell & Utilities, 2.9.2 Pipelines and 2.9.3 Lists
- Asynchronous Lists. When encountering
Async c, the Shell shall executecasynchronously in a subshell. This means that the shell shall not wait for the command to finish before executing the next command.
- Sequential Lists. A contrario, the commands
c1andc2inSeq (c1, c2)shall be executed sequentially.
- AND Lists. In
And (c1, c2),c1shall be executed first. If its exit status is zero,c2shall be executed. The commands are expanded only if they are executed.
- OR Lists. In
Or (c1, c2),c1shall be executed first. If its exit status is non-zero,c2shall be executed.
- Pipeline. In
Pipe (c1, c2), the standard output ofc1shall be connected to the standard input ofc2. The standard input, standard output, or both of a command shall be considered to be assigned by the pipeline before any redirection specified by redirection operators that are part of the command.
- Negation. The command
Not chas the same behaviour asc, except for the exit status that shall be the logical NOT of the exit status ofc.
Compound Commands
See POSIX, 2 Shell & Utilities, 2.9.4 Compound Commands
- The Subshell Environment.
Subshell cshall executeca subshell environment. Variable assignments and built-in commands that affect the environment shall not remain in effect after the list finishes.
- The for Loop.
For (x, l, c)shall execute a sequence of commandscfor each member in a list of items. It is to be noted thatlis non-mandatory and is thus an option. Besides, there is an important semantic difference betweenNoneandSome []. The former appears in a for loop where the list of words appear but is empty. In that case, the for loops through the empty list. The latter appears in a for loop where the list of words has been omitted. In that case, the for loops through the positional parameters.
- The case Conditional Construct.
Case (w, [([p11;...],c1); ...])shall execute the compound-list corresponding to the first one of several patterns that is matched by the string resulting from the expansion of the given wordw. In order from the beginning to the end of the case statement, each patternp*shall be subjected to expansion, and the result of these expansions shall be compared against the expansion ofw. After the first match, no more patterns shall be expanded, and the correspondingc*shall be executed. The order of expansion and comparison of multiple patterns that label the same statement is unspecified.
- The if Conditional Construct.
If (c1, c2, c3)shall executec1and use its exit status to determine whether to executec2orc3. In fact,c3is not mandatory and is thus an option.
- The while Loop.
While (c1, c2)shall continuously executec2as long asc1has a zero exit status.
- The until Loop.
Until (c1, c2)shall continuously executec2as long asc1has a non-zero exit status.
Function Definition Command
See POSIX, 2 Shell & Utilities, 2.9.5 Function Definition Command
A function is a user-defined name that is used as a simple command to call a compound command with new positional parameters. A function is defined with a function definition command, Function (name, body).
This function definition command defines a function named name:
string and with body body: command. The body shall be executed whenever name is specified as the name of a simple command.
Redirection
See POSIX, 2 Shell & Utilities, 2.7 Redirections
Type Definitions
The type command describes a command in the AST. All the command semantics are described at the top of this document.
and program= command' listand command=|Simple of assignment' list * word' list|Async of command|Seq of command' * command'|And of command' * command'|Or of command' * command'|Not of command'|Pipe of command' * command'|Subshell of command'|For of name * word list option * command'|Case of word * case_item' list|If of command' * command' * command' option|While of command' * command'|Until of command' * command'|Function of name * command'|Redirection of command' * descr * kind * word|HereDocument of command' * descr * word'and command'= command Morsmall.Location.locatedand case_item= pattern' * command' optionand case_item'= case_item Morsmall.Location.locatedand kind=|Output|OutputDuplicate|OutputAppend|OutputClobber|Input|InputDuplicate|InputOutput
val equal_name : name -> name -> Ppx_deriving_runtime.boolval equal_character_range : character_range -> character_range -> Ppx_deriving_runtime.boolval equal_attribute : attribute -> attribute -> Ppx_deriving_runtime.boolval equal_word_component : word_component -> word_component -> Ppx_deriving_runtime.boolval equal_word : word -> word -> Ppx_deriving_runtime.boolval equal_word' : word' -> word' -> Ppx_deriving_runtime.boolval equal_pattern : pattern -> pattern -> Ppx_deriving_runtime.boolval equal_pattern' : pattern' -> pattern' -> Ppx_deriving_runtime.boolval equal_assignment : assignment -> assignment -> Ppx_deriving_runtime.boolval equal_assignment' : assignment' -> assignment' -> Ppx_deriving_runtime.boolval equal_descr : descr -> descr -> Ppx_deriving_runtime.boolval equal_program : program -> program -> Ppx_deriving_runtime.boolval equal_command : command -> command -> Ppx_deriving_runtime.boolval equal_command' : command' -> command' -> Ppx_deriving_runtime.boolval equal_case_item : case_item -> case_item -> Ppx_deriving_runtime.boolval equal_case_item' : case_item' -> case_item' -> Ppx_deriving_runtime.boolval equal_kind : kind -> kind -> Ppx_deriving_runtime.boolval pp_name : Ppx_deriving_runtime.Format.formatter -> name -> Ppx_deriving_runtime.unitval show_name : name -> Ppx_deriving_runtime.stringval pp_character_range : Ppx_deriving_runtime.Format.formatter -> character_range -> Ppx_deriving_runtime.unitval show_character_range : character_range -> Ppx_deriving_runtime.stringval pp_attribute : Ppx_deriving_runtime.Format.formatter -> attribute -> Ppx_deriving_runtime.unitval show_attribute : attribute -> Ppx_deriving_runtime.stringval pp_word_component : Ppx_deriving_runtime.Format.formatter -> word_component -> Ppx_deriving_runtime.unitval show_word_component : word_component -> Ppx_deriving_runtime.stringval pp_word : Ppx_deriving_runtime.Format.formatter -> word -> Ppx_deriving_runtime.unitval show_word : word -> Ppx_deriving_runtime.stringval pp_word' : Ppx_deriving_runtime.Format.formatter -> word' -> Ppx_deriving_runtime.unitval show_word' : word' -> Ppx_deriving_runtime.stringval pp_pattern : Ppx_deriving_runtime.Format.formatter -> pattern -> Ppx_deriving_runtime.unitval show_pattern : pattern -> Ppx_deriving_runtime.stringval pp_pattern' : Ppx_deriving_runtime.Format.formatter -> pattern' -> Ppx_deriving_runtime.unitval show_pattern' : pattern' -> Ppx_deriving_runtime.stringval pp_assignment : Ppx_deriving_runtime.Format.formatter -> assignment -> Ppx_deriving_runtime.unitval show_assignment : assignment -> Ppx_deriving_runtime.stringval pp_assignment' : Ppx_deriving_runtime.Format.formatter -> assignment' -> Ppx_deriving_runtime.unitval show_assignment' : assignment' -> Ppx_deriving_runtime.stringval pp_descr : Ppx_deriving_runtime.Format.formatter -> descr -> Ppx_deriving_runtime.unitval show_descr : descr -> Ppx_deriving_runtime.stringval pp_program : Ppx_deriving_runtime.Format.formatter -> program -> Ppx_deriving_runtime.unitval show_program : program -> Ppx_deriving_runtime.stringval pp_command : Ppx_deriving_runtime.Format.formatter -> command -> Ppx_deriving_runtime.unitval show_command : command -> Ppx_deriving_runtime.stringval pp_command' : Ppx_deriving_runtime.Format.formatter -> command' -> Ppx_deriving_runtime.unitval show_command' : command' -> Ppx_deriving_runtime.stringval pp_case_item : Ppx_deriving_runtime.Format.formatter -> case_item -> Ppx_deriving_runtime.unitval show_case_item : case_item -> Ppx_deriving_runtime.stringval pp_case_item' : Ppx_deriving_runtime.Format.formatter -> case_item' -> Ppx_deriving_runtime.unitval show_case_item' : case_item' -> Ppx_deriving_runtime.stringval pp_kind : Ppx_deriving_runtime.Format.formatter -> kind -> Ppx_deriving_runtime.unitval show_kind : kind -> Ppx_deriving_runtime.stringval name_to_yojson : name -> Yojson.Safe.tval name_of_yojson : Yojson.Safe.t -> name Ppx_deriving_yojson_runtime.error_orval character_range_to_yojson : character_range -> Yojson.Safe.tval character_range_of_yojson : Yojson.Safe.t -> character_range Ppx_deriving_yojson_runtime.error_orval attribute_to_yojson : attribute -> Yojson.Safe.tval attribute_of_yojson : Yojson.Safe.t -> attribute Ppx_deriving_yojson_runtime.error_orval word_component_to_yojson : word_component -> Yojson.Safe.tval word_component_of_yojson : Yojson.Safe.t -> word_component Ppx_deriving_yojson_runtime.error_orval word_to_yojson : word -> Yojson.Safe.tval word_of_yojson : Yojson.Safe.t -> word Ppx_deriving_yojson_runtime.error_orval word'_to_yojson : word' -> Yojson.Safe.tval word'_of_yojson : Yojson.Safe.t -> word' Ppx_deriving_yojson_runtime.error_orval pattern_to_yojson : pattern -> Yojson.Safe.tval pattern_of_yojson : Yojson.Safe.t -> pattern Ppx_deriving_yojson_runtime.error_orval pattern'_to_yojson : pattern' -> Yojson.Safe.tval pattern'_of_yojson : Yojson.Safe.t -> pattern' Ppx_deriving_yojson_runtime.error_orval assignment_to_yojson : assignment -> Yojson.Safe.tval assignment_of_yojson : Yojson.Safe.t -> assignment Ppx_deriving_yojson_runtime.error_orval assignment'_to_yojson : assignment' -> Yojson.Safe.tval assignment'_of_yojson : Yojson.Safe.t -> assignment' Ppx_deriving_yojson_runtime.error_orval descr_to_yojson : descr -> Yojson.Safe.tval descr_of_yojson : Yojson.Safe.t -> descr Ppx_deriving_yojson_runtime.error_orval program_to_yojson : program -> Yojson.Safe.tval program_of_yojson : Yojson.Safe.t -> program Ppx_deriving_yojson_runtime.error_orval command_to_yojson : command -> Yojson.Safe.tval command_of_yojson : Yojson.Safe.t -> command Ppx_deriving_yojson_runtime.error_orval command'_to_yojson : command' -> Yojson.Safe.tval command'_of_yojson : Yojson.Safe.t -> command' Ppx_deriving_yojson_runtime.error_orval case_item_to_yojson : case_item -> Yojson.Safe.tval case_item_of_yojson : Yojson.Safe.t -> case_item Ppx_deriving_yojson_runtime.error_orval case_item'_to_yojson : case_item' -> Yojson.Safe.tval case_item'_of_yojson : Yojson.Safe.t -> case_item' Ppx_deriving_yojson_runtime.error_orval kind_to_yojson : kind -> Yojson.Safe.tval kind_of_yojson : Yojson.Safe.t -> kind Ppx_deriving_yojson_runtime.error_orval _ : name -> Yojson.Safe.tval _ : Yojson.Safe.t -> name Ppx_deriving_yojson_runtime.error_orval name_of_yojson_exn : Yojson.Safe.t -> nameval _ : Yojson.Safe.t -> nameval _ : character_range -> Yojson.Safe.tval _ : Yojson.Safe.t -> character_range Ppx_deriving_yojson_runtime.error_orval character_range_of_yojson_exn : Yojson.Safe.t -> character_rangeval _ : Yojson.Safe.t -> character_rangeval _ : attribute -> Yojson.Safe.tval _ : Yojson.Safe.t -> attribute Ppx_deriving_yojson_runtime.error_orval attribute_of_yojson_exn : Yojson.Safe.t -> attributeval _ : Yojson.Safe.t -> attributeval _ : word_component -> Yojson.Safe.tval _ : Yojson.Safe.t -> word_component Ppx_deriving_yojson_runtime.error_orval word_component_of_yojson_exn : Yojson.Safe.t -> word_componentval _ : Yojson.Safe.t -> word_componentval _ : word -> Yojson.Safe.tval _ : Yojson.Safe.t -> word Ppx_deriving_yojson_runtime.error_orval word_of_yojson_exn : Yojson.Safe.t -> wordval _ : Yojson.Safe.t -> wordval _ : word' -> Yojson.Safe.tval _ : Yojson.Safe.t -> word' Ppx_deriving_yojson_runtime.error_orval word'_of_yojson_exn : Yojson.Safe.t -> word'val _ : Yojson.Safe.t -> word'val _ : pattern -> Yojson.Safe.tval _ : Yojson.Safe.t -> pattern Ppx_deriving_yojson_runtime.error_orval pattern_of_yojson_exn : Yojson.Safe.t -> patternval _ : Yojson.Safe.t -> patternval _ : pattern' -> Yojson.Safe.tval _ : Yojson.Safe.t -> pattern' Ppx_deriving_yojson_runtime.error_orval pattern'_of_yojson_exn : Yojson.Safe.t -> pattern'val _ : Yojson.Safe.t -> pattern'val _ : assignment -> Yojson.Safe.tval _ : Yojson.Safe.t -> assignment Ppx_deriving_yojson_runtime.error_orval assignment_of_yojson_exn : Yojson.Safe.t -> assignmentval _ : Yojson.Safe.t -> assignmentval _ : assignment' -> Yojson.Safe.tval _ : Yojson.Safe.t -> assignment' Ppx_deriving_yojson_runtime.error_orval assignment'_of_yojson_exn : Yojson.Safe.t -> assignment'val _ : Yojson.Safe.t -> assignment'val _ : descr -> Yojson.Safe.tval _ : Yojson.Safe.t -> descr Ppx_deriving_yojson_runtime.error_orval descr_of_yojson_exn : Yojson.Safe.t -> descrval _ : Yojson.Safe.t -> descrval _ : program -> Yojson.Safe.tval _ : Yojson.Safe.t -> program Ppx_deriving_yojson_runtime.error_orval program_of_yojson_exn : Yojson.Safe.t -> programval _ : Yojson.Safe.t -> programval _ : command -> Yojson.Safe.tval _ : Yojson.Safe.t -> command Ppx_deriving_yojson_runtime.error_orval command_of_yojson_exn : Yojson.Safe.t -> commandval _ : Yojson.Safe.t -> commandval _ : command' -> Yojson.Safe.tval _ : Yojson.Safe.t -> command' Ppx_deriving_yojson_runtime.error_orval command'_of_yojson_exn : Yojson.Safe.t -> command'val _ : Yojson.Safe.t -> command'val _ : case_item -> Yojson.Safe.tval _ : Yojson.Safe.t -> case_item Ppx_deriving_yojson_runtime.error_orval case_item_of_yojson_exn : Yojson.Safe.t -> case_itemval _ : Yojson.Safe.t -> case_itemval _ : case_item' -> Yojson.Safe.tval _ : Yojson.Safe.t -> case_item' Ppx_deriving_yojson_runtime.error_orval case_item'_of_yojson_exn : Yojson.Safe.t -> case_item'val _ : Yojson.Safe.t -> case_item'val _ : kind -> Yojson.Safe.tval _ : Yojson.Safe.t -> kind Ppx_deriving_yojson_runtime.error_orval kind_of_yojson_exn : Yojson.Safe.t -> kindval _ : Yojson.Safe.t -> kind
include sig ... end
class virtual +'b iter : object ... endinclude sig ... end
class virtual +'c map : object ... endinclude sig ... end
class virtual +'b reduce : object ... endinclude sig ... end
class virtual +'c mapreduce : object ... endinclude sig ... end
class virtual +'c iter2 : object ... endinclude sig ... end
class virtual +'d map2 : object ... endinclude sig ... end
class virtual +'c reduce2 : object ... endval default_redirection_descriptor : kind -> int