mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Remove the giant 'Fish grammar' comment
The fish grammar is now captured more precisely in parse_grammar.h
This commit is contained in:
parent
852cf183a6
commit
04162b05ea
1 changed files with 0 additions and 86 deletions
|
@ -222,90 +222,4 @@ using parsed_source_ref_t = std::shared_ptr<const parsed_source_t>;
|
|||
parsed_source_ref_t parse_source(wcstring src, parse_tree_flags_t flags, parse_error_list_t *errors,
|
||||
parse_token_type_t goal = symbol_job_list);
|
||||
|
||||
// Fish grammar:
|
||||
//
|
||||
// # A job_list is a list of jobs, separated by semicolons or newlines
|
||||
//
|
||||
// job_list = <empty> |
|
||||
// job job_list |
|
||||
// <TOK_END> job_list
|
||||
//
|
||||
// # A job is a non-empty list of statements, separated by pipes. (Non-empty is useful for cases
|
||||
// like if statements, where we require a command). To represent "non-empty", we require a
|
||||
// statement, followed by a possibly empty job_continuation, and then optionally a background
|
||||
// specifier '&'
|
||||
//
|
||||
// job = statement job_continuation optional_background
|
||||
// job_continuation = <empty> |
|
||||
// <TOK_PIPE> statement job_continuation
|
||||
//
|
||||
// # A statement is a normal command, or an if / while / and etc
|
||||
//
|
||||
// statement = boolean_statement | block_statement | if_statement | switch_statement |
|
||||
// decorated_statement
|
||||
//
|
||||
// # A block is a conditional, loop, or begin/end
|
||||
//
|
||||
// if_statement = if_clause else_clause end_command arguments_or_redirections_list
|
||||
// if_clause = <IF> job <TOK_END> andor_job_list job_list
|
||||
// else_clause = <empty> |
|
||||
// <ELSE> else_continuation
|
||||
// else_continuation = if_clause else_clause |
|
||||
// <TOK_END> job_list
|
||||
//
|
||||
// switch_statement = SWITCH argument <TOK_END> case_item_list end_command
|
||||
// arguments_or_redirections_list
|
||||
// case_item_list = <empty> |
|
||||
// case_item case_item_list |
|
||||
// <TOK_END> case_item_list
|
||||
//
|
||||
// case_item = CASE argument_list <TOK_END> job_list
|
||||
//
|
||||
// block_statement = block_header job_list end_command arguments_or_redirections_list
|
||||
// block_header = for_header | while_header | function_header | begin_header
|
||||
// for_header = FOR var_name IN argument_list <TOK_END>
|
||||
// while_header = WHILE job <TOK_END> andor_job_list
|
||||
// begin_header = BEGIN
|
||||
//
|
||||
// # Functions take arguments, and require at least one (the name). No redirections allowed.
|
||||
// function_header = FUNCTION argument argument_list <TOK_END>
|
||||
//
|
||||
// # A boolean statement is AND or OR or NOT
|
||||
// boolean_statement = AND statement | OR statement | NOT statement
|
||||
//
|
||||
// # An andor_job_list is zero or more job lists, where each starts with an `and` or `or` boolean
|
||||
// statement
|
||||
// andor_job_list = <empty> |
|
||||
// job andor_job_list |
|
||||
// <TOK_END> andor_job_list
|
||||
//
|
||||
// # A decorated_statement is a command with a list of arguments_or_redirections, possibly with
|
||||
// "builtin" or "command" or "exec"
|
||||
//
|
||||
// decorated_statement = plain_statement | COMMAND plain_statement | BUILTIN plain_statement |
|
||||
// EXEC
|
||||
//
|
||||
// plain_statement
|
||||
// plain_statement = <TOK_STRING> arguments_or_redirections_list
|
||||
//
|
||||
// argument_list = <empty> | argument argument_list
|
||||
//
|
||||
// arguments_or_redirections_list = <empty> |
|
||||
// argument_or_redirection arguments_or_redirections_list
|
||||
// argument_or_redirection = argument | redirection
|
||||
// argument = <TOK_STRING>
|
||||
//
|
||||
// redirection = <TOK_REDIRECTION> <TOK_STRING>
|
||||
//
|
||||
// optional_background = <empty> | <TOK_BACKGROUND>
|
||||
//
|
||||
// end_command = END
|
||||
//
|
||||
// # A freestanding_argument_list is equivalent to a normal argument list, except it may contain
|
||||
// TOK_END (newlines, and even semicolons, for historical reasons
|
||||
//
|
||||
// freestanding_argument_list = <empty> |
|
||||
// argument freestanding_argument_list |
|
||||
// <TOK_END> freestanding_argument_list
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue