Module parse

Source
Expand description

Shell reader/parser. Parses a string into a shell command. Roughly a subset of https://www.gnu.org/software/bash/manual/html_node/Shell-Expansions.html

Structsยง

ParseState ๐Ÿ”’
ParsedJob
A list of commands to run in a pipe as a job.

Enumsยง

SeqType ๐Ÿ”’
Type of the current sequence being parsed.

Functionsยง

char_to_hex_num ๐Ÿ”’
consume_whitespace ๐Ÿ”’
escape_to_char ๐Ÿ”’
Read an ascii char from 0x00-0x7F endowed in a string as โ€˜\xXXโ€™ where X is single hex digit.
parse_line
parse_line_inner ๐Ÿ”’
push_next_seq_item ๐Ÿ”’
push_next_seq_run ๐Ÿ”’
read_arg ๐Ÿ”’
read_chars_until ๐Ÿ”’
read_simple_string ๐Ÿ”’
Read string surrounded by single quote (โ€™). Assumes chars is on the open quote and consumes the end quote. This simply reads the chars until the next โ€™ and puts them in a String Arg. Note, can not produce a string containing a โ€™ character.
read_special_arg ๐Ÿ”’
read_string ๐Ÿ”’
Read string surrounded by quote (โ€œ). Assumes chars is on the open quote and consumes the end quote. This version will handle interpolation and escape chars.
read_token ๐Ÿ”’
read_utf_scalar ๐Ÿ”’
Read a UTF8 codepoint encoded in a string with โ€˜\uXXXXXXXXโ€™ or \u{XXXXXXXX}โ€™ where X is a single hex digit. There can be 1-8 hex values (X- a nibble) in the encoding (Up to 4 bytes).