feat: made the firsts system for parser (not yet populated)
This commit is contained in:
parent
32e182bd50
commit
da1a73c264
3 changed files with 129 additions and 22 deletions
|
|
@ -10,18 +10,24 @@
|
|||
* ends by a newline
|
||||
*
|
||||
* @code list = and_or { ';' and_or } [ ';' ] ;
|
||||
*
|
||||
* @first first(and_or)
|
||||
*/
|
||||
struct ast *parse_list(struct lexer_context *ctx);
|
||||
|
||||
/* @brief Only parses a pipeline rule for the moment
|
||||
*
|
||||
* @code and_or = pipeline { ( '&&' | '||' ) {'\n'} pipeline } ;
|
||||
*
|
||||
* @first first(pipeline)
|
||||
*/
|
||||
struct ast *parse_and_or(struct lexer_context *ctx);
|
||||
|
||||
/* @brief Only parses a command rule for the moment
|
||||
*
|
||||
* @code pipeline = command ;
|
||||
*
|
||||
* @first first(command)
|
||||
*/
|
||||
struct ast *parse_pipeline(struct lexer_context *ctx);
|
||||
|
||||
|
|
@ -34,6 +40,7 @@ struct ast *parse_pipeline(struct lexer_context *ctx);
|
|||
* @code command = simple_command
|
||||
* | shell_command
|
||||
* ;
|
||||
* @first first(simple_command), first(shell_command)
|
||||
*/
|
||||
struct ast *parse_command(struct lexer_context *ctx);
|
||||
|
||||
|
|
@ -41,18 +48,24 @@ struct ast *parse_command(struct lexer_context *ctx);
|
|||
* ending by a separator
|
||||
*
|
||||
* @code simple_command = WORD { element } ;
|
||||
*
|
||||
* @first WORD
|
||||
*/
|
||||
struct ast *parse_simple_command(struct lexer_context *ctx);
|
||||
|
||||
/* @brief Only parses if rules for the moment
|
||||
*
|
||||
* @code shell_command = if_rule ;
|
||||
*
|
||||
* @first first(if_rule)
|
||||
*/
|
||||
struct ast *parse_shell_command(struct lexer_context *ctx);
|
||||
|
||||
/* @brief Parses a if rule (condition, then-clause, elif-clause, else-clause)
|
||||
*
|
||||
* @code if_rule = 'if' compound_list 'then' compound_list [else_clause] 'fi' ;
|
||||
*
|
||||
* @first TOKEN_IF
|
||||
*/
|
||||
struct ast *parse_if_rule(struct lexer_context *ctx);
|
||||
|
||||
|
|
@ -61,6 +74,8 @@ struct ast *parse_if_rule(struct lexer_context *ctx);
|
|||
*
|
||||
* @code compound_list = {'\n'} and_or { ( ';' | '\n' ) {'\n'} and_or } [';']
|
||||
* {'\n'} ;
|
||||
*
|
||||
* @first TOKEN_NEWLINE, first(and_or)
|
||||
*/
|
||||
struct ast *parse_compound_list(struct lexer_context *ctx);
|
||||
|
||||
|
|
@ -69,6 +84,8 @@ struct ast *parse_compound_list(struct lexer_context *ctx);
|
|||
* @code else_clause = 'else' compound_list
|
||||
* | 'elif' compound_list 'then' compound_list [else_clause]
|
||||
* ;
|
||||
*
|
||||
* @first TOKEN_ELSE, TOKEN_ELIF
|
||||
*/
|
||||
struct ast *parse_else_clause(struct lexer_context *ctx);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue