Mercurial > hg > octave-nkf
changeset 16124:3be725cd195b
move more lexer helper functions to lexical_feedback class
* lex.h, lex.ll (prep_for_script_file, prep_for_function_file):
Declare as member functions in lexical_feedback class. Rename from
prep_lexer_for_script file and prep_lexer_for_function_file. Change
all uses.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 26 Feb 2013 13:24:41 -0500 |
parents | a484e39d1f22 |
children | 96a58f197f93 |
files | libinterp/parse-tree/lex.h libinterp/parse-tree/lex.ll libinterp/parse-tree/oct-parse.yy |
diffstat | 3 files changed, 18 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.h +++ b/libinterp/parse-tree/lex.h @@ -51,9 +51,6 @@ // Is the given string a keyword? extern bool is_keyword (const std::string& s); -extern void prep_lexer_for_script_file (void); -extern void prep_lexer_for_function_file (void); - class stream_reader { @@ -207,6 +204,10 @@ void reset_parser (void); + void prep_for_script_file (void); + + void prep_for_function_file (void); + int octave_read (char *buf, unsigned int max_size); void do_comma_insert_check (void);
--- a/libinterp/parse-tree/lex.ll +++ b/libinterp/parse-tree/lex.ll @@ -1297,18 +1297,6 @@ */ -void -prep_lexer_for_script_file (void) -{ - BEGIN (SCRIPT_FILE_BEGIN); -} - -void -prep_lexer_for_function_file (void) -{ - BEGIN (FUNCTION_FILE_BEGIN); -} - // Used to delete trailing white space from tokens. static std::string @@ -1421,6 +1409,18 @@ help_buf.pop (); } +void +lexical_feedback::prep_for_script_file (void) +{ + BEGIN (SCRIPT_FILE_BEGIN); +} + +void +lexical_feedback::prep_for_function_file (void) +{ + BEGIN (FUNCTION_FILE_BEGIN); +} + int lexical_feedback::octave_read (char *buf, unsigned max_size) {
--- a/libinterp/parse-tree/oct-parse.yy +++ b/libinterp/parse-tree/oct-parse.yy @@ -3578,9 +3578,9 @@ help_buf.push (help_txt); if (reading_script_file) - prep_lexer_for_script_file (); + curr_lexer->prep_for_script_file (); else - prep_lexer_for_function_file (); + curr_lexer->prep_for_function_file (); curr_lexer->parsing_class_method = ! dispatch_type.empty ();