Mercurial > hg > octave-lyh
diff libinterp/interpfcn/input.h @ 16203:127cccb037bf
move more global parser and lexer variables to classes
* pt-check.h, pt-check.cc (tree_checker::file_name): New data member.
(tree_checker::gripe): Use it instead of curr_fcn_file_name.
* input.h, input.cc, octave.cc (input_from_command_line_file):
Delete global variable and all uses.
* parse.h, oct-parse.in.yy (input_from_startup_file): Delete global
variable and all uses.
* input.h, input.cc, lex.h, lex.ll (curr_fcn_file_name,
curr_fcn_file_full_name): Declare as members of lexical_feedback
class. Rename to fcn_file_name and fcn_file_full_name. Change all
uses.
* oct-parse.in.yy (parse_fcn_file): New arg, file. Set
curr_lexer->fcn_file_name and curr_lexer->fcn_file_full_name here.
(load_fcn_from_file): Pass short file name to parse_fcn_file.
* octave.cc (execute_command_line_file): Not here.
* lex.h, lex.ll (lexical_feedback::force_script): New data member.
* oct-parse.in.yy (parse_fcn_file): Set it here.
* lex.h, lex.ll (lexical_feedback::input_from_terminal,
lexical_feedback::input_from_file): New functions.
* lex.ll (octave_lexer::handle_keyword): Set reading_fcn_file,
reading_classdef_file, and reading_script_file.
* lex.h, lex.ll (lexical_feedback::token_count): New variable.
(COUNT_TOK_AND_RETURN): Increment it here. Don't count '\n' as a
token.
* lex.h, lex.ll (lexical_feedback::help_text):
New variable.
* parse.h, parse.in.yy (help_buf): Delete global variable and all uses.
(octave_parser::frob_function, octave_parser::make_script): Use help_text.
* lex.ll (octave_lexer::process_comment): Cache doc string directly in
help_text variable.
(looks_like_copyright): Move here from parse.in.yy.
* lex.h, lex.ll (octave_lexer::prep_for_file): New function.
(octave_lexer::prep_for_function_file,
octave_lexer::prep_for_script_file): Delete.
* parse.in.yy (INPUT_FILE_BEGIN): New start state. Delete
SCRIPT_FILE_BEGIN and FCN_FILE_BEGIN. Tentatively set
curr_lexer->reading_script_file to true.
(parse_fcn_file): Call curr_lexer->prep_for_file.
Don't call gobble_leading_whitespace. Don't attempt to determine
function script, or classdef file status here.
* parse.in.yy (INPUT_FILE): New token.
(SCRIPT_FILE, FUNCTION_FILE): Delete.
* lex.ll (octave_lexer::display_token): Update.
* parse.in.yy (nl, opt_nl): New non-terminals.
(function_file): Delete rule.
(file): Rename from script_file. Allow opt_nl before opt_list.
Don't make script if reading fcn file.
* parse.in.yy (text_getc, class stdio_stream_reader, skip_white_space,
looking_at_classdef_keyword, gobble_leading_white_space,
looking_at_function_keyword): Delete.
(get_help_from_file): Parse file to get help instead of calling
gobble_leading_white_space
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 06 Mar 2013 14:36:19 -0500 |
parents | 743b895259e0 |
children | 0467d68ca891 |
line wrap: on
line diff
--- a/libinterp/interpfcn/input.h +++ b/libinterp/interpfcn/input.h @@ -37,19 +37,9 @@ extern OCTINTERP_API FILE *get_input_from_stdin (void); -// TRUE means that input is coming from a file that was named on -// the command line. -extern bool input_from_command_line_file; - // TRUE means that stdin is a terminal, not a pipe or redirected file. extern bool stdin_is_tty; -// Simple name of function file we are reading. -extern std::string curr_fcn_file_name; - -// Full name of file we are reading. -extern std::string curr_fcn_file_full_name; - // TRUE means this is an interactive shell. extern bool interactive;