Mercurial > octave
diff libinterp/parse-tree/parse.h @ 23673:1d1ce4df5255
refactor bison rules for parsing functions
* parse.h, oct-parse.in.yy: Expect 9 shift/reduce errors.
(base_parser::make_function): New function.
(function1, function1): Combine non-terminal rules with function rule.
(opt_param_list): New non-terminal.
(function): Combine rules as much as possible. Move all processing to
make_function.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 21 Jun 2017 14:23:47 -0400 |
parents | bbcc1e08aaed |
children | 4a62da62af09 |
line wrap: on
line diff
--- a/libinterp/parse-tree/parse.h Wed Jun 21 11:46:31 2017 -0400 +++ b/libinterp/parse-tree/parse.h Wed Jun 21 14:23:47 2017 -0400 @@ -276,17 +276,24 @@ // Define a script. void make_script (tree_statement_list *cmds, tree_statement *end_script); + // Define a function. + tree_function_def * + make_function (token *fcn_tok, tree_parameter_list *ret_list, + tree_identifier *id, tree_parameter_list *param_list, + tree_statement_list *body, tree_statement *end_fcn_stmt, + octave_comment_list *lc); + // Begin defining a function. octave_user_function * - start_function (tree_parameter_list *param_list, tree_statement_list *body, - tree_statement *end_function); + start_function (tree_identifier *id, tree_parameter_list *param_list, + tree_statement_list *body, tree_statement *end_function); // Create a no-op statement for end_function. tree_statement * make_end (const std::string& type, bool eof, int l, int c); // Do most of the work for defining a function. octave_user_function * - frob_function (const std::string& fname, octave_user_function *fcn); + frob_function (tree_identifier *id, octave_user_function *fcn); // Finish defining a function. tree_function_def *