Mercurial > hg > octave-nkf
changeset 16116:67f71e2a6190
store pointer to current lexer in flex_stream_reader object
* lex.ll (flex_stream_reader::lexer): New data member.
(flex_stream_reader::flex_stream_reader): Initialize it.
(flex_steram_reader::getc, flex_steram_reader::ungetc): Use it.
(lexical_feedback::process_comment): Pass "this" to flex_stream_reader
constructor.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 26 Feb 2013 11:23:04 -0500 |
parents | 4f6c37cfbdce |
children | 771186909285 |
files | libinterp/parse-tree/lex.ll |
diffstat | 1 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll +++ b/libinterp/parse-tree/lex.ll @@ -1237,10 +1237,12 @@ flex_stream_reader : public stream_reader { public: - flex_stream_reader (char *buf_arg) : stream_reader (), buf (buf_arg) { } - - int getc (void) { return curr_lexer->text_yyinput (); } - int ungetc (int c) { curr_lexer->xunput (c, buf); return 0; } + flex_stream_reader (lexical_feedback *l, char *buf_arg) + : lexer (l), stream_reader (), buf (buf_arg) + { } + + int getc (void) { return lexer->text_yyinput (); } + int ungetc (int c) { lexer->xunput (c, buf); return 0; } private: @@ -1250,6 +1252,8 @@ flex_stream_reader& operator = (const flex_stream_reader&); + lexical_feedback *lexer; + char *buf; }; @@ -2253,7 +2257,7 @@ if (! help_buf.empty ()) help_txt = help_buf.top (); - flex_stream_reader flex_reader (yytext); + flex_stream_reader flex_reader (this, yytext); // process_comment is only supposed to be called when we are not // initially looking at a block comment.