comparison libinterp/parse-tree/lex.ll @ 16120:4b68eb9b98b0

move octave_read lexer helper function to lexical_feedback class * lex.h, lex.ll (octave_read): Declare as member of lexical_feedback class. Change all callers.
author John W. Eaton <jwe@octave.org>
date Tue, 26 Feb 2013 12:24:54 -0500
parents b31eb56f4d84
children bdf365c5c9bf
comparison
equal deleted inserted replaced
16119:b31eb56f4d84 16120:4b68eb9b98b0
101 101
102 #ifdef YY_INPUT 102 #ifdef YY_INPUT
103 #undef YY_INPUT 103 #undef YY_INPUT
104 #endif 104 #endif
105 #define YY_INPUT(buf, result, max_size) \ 105 #define YY_INPUT(buf, result, max_size) \
106 result = octave_read (buf, max_size) 106 result = curr_lexer->octave_read (buf, max_size)
107 107
108 // Try to avoid crashing out completely on fatal scanner errors. 108 // Try to avoid crashing out completely on fatal scanner errors.
109 // The call to yy_fatal_error should never happen, but it avoids a 109 // The call to yy_fatal_error should never happen, but it avoids a
110 // 'static function defined but not used' warning from gcc. 110 // 'static function defined but not used' warning from gcc.
111 111
223 223
224 // Forward declarations for functions defined at the bottom of this 224 // Forward declarations for functions defined at the bottom of this
225 // file that are needed inside the lexer actions. 225 // file that are needed inside the lexer actions.
226 226
227 static std::string strip_trailing_whitespace (char *s); 227 static std::string strip_trailing_whitespace (char *s);
228 static int octave_read (char *buf, unsigned int max_size);
229 228
230 %} 229 %}
231 230
232 D [0-9] 231 D [0-9]
233 S [ \t] 232 S [ \t]
1357 retval.resize (pos); 1356 retval.resize (pos);
1358 1357
1359 return retval; 1358 return retval;
1360 } 1359 }
1361 1360
1362 static int 1361 int
1363 octave_read (char *buf, unsigned max_size) 1362 lexical_feedback::octave_read (char *buf, unsigned max_size)
1364 { 1363 {
1365 static const char * const eol = "\n"; 1364 static const char * const eol = "\n";
1366 static std::string input_buf; 1365 static std::string input_buf;
1367 static const char *pos = 0; 1366 static const char *pos = 0;
1368 static size_t chars_left = 0; 1367 static size_t chars_left = 0;