# HG changeset patch # User John W. Eaton # Date 1361903081 18000 # Node ID 3be725cd195b201af00c41724d557c370fe241e2 # Parent a484e39d1f223a29142d7b4571019c6e8e390a79 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. diff -r a484e39d1f22 -r 3be725cd195b libinterp/parse-tree/lex.h --- a/libinterp/parse-tree/lex.h Tue Feb 26 12:43:36 2013 -0500 +++ b/libinterp/parse-tree/lex.h Tue Feb 26 13:24:41 2013 -0500 @@ -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); diff -r a484e39d1f22 -r 3be725cd195b libinterp/parse-tree/lex.ll --- a/libinterp/parse-tree/lex.ll Tue Feb 26 12:43:36 2013 -0500 +++ b/libinterp/parse-tree/lex.ll Tue Feb 26 13:24:41 2013 -0500 @@ -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) { diff -r a484e39d1f22 -r 3be725cd195b libinterp/parse-tree/oct-parse.yy --- a/libinterp/parse-tree/oct-parse.yy Tue Feb 26 12:43:36 2013 -0500 +++ b/libinterp/parse-tree/oct-parse.yy Tue Feb 26 13:24:41 2013 -0500 @@ -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 ();