Mercurial > octave
diff libinterp/parse-tree/lex.ll @ 24833:7c88cf242111
use m_ prefix for data members in more classes
* input.h, input.cc, comment-list.h, lex.h, lex.ll, profiler.h,
profiler.cc: Use m_ prefix for data members in classes.
Change all uses.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 03 Mar 2018 09:34:16 -0500 |
parents | 194eb4bd202b |
children | 6652d3823428 |
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll Sat Mar 03 07:36:06 2018 +0100 +++ b/libinterp/parse-tree/lex.ll Sat Mar 03 09:34:16 2018 -0500 @@ -227,7 +227,7 @@ yyless (0); \ curr_lexer->xunput (','); \ /* Adjust for comma that was not really in the input stream. */ \ - curr_lexer->current_input_column--; \ + curr_lexer->m_current_input_column--; \ } \ else \ { \ @@ -247,8 +247,8 @@ do \ { \ curr_lexer->decrement_promptflag (); \ - curr_lexer->input_line_number++; \ - curr_lexer->current_input_column = 1; \ + curr_lexer->m_input_line_number++; \ + curr_lexer->m_current_input_column = 1; \ \ if (curr_lexer->is_push_lexer ()) \ { \ @@ -268,14 +268,14 @@ #define COMMAND_ARG_FINISH \ do \ { \ - if (curr_lexer->string_text.empty ()) \ + if (curr_lexer->m_string_text.empty ()) \ break; \ \ - int retval = curr_lexer->handle_token (curr_lexer->string_text, \ + int retval = curr_lexer->handle_token (curr_lexer->m_string_text, \ SQ_STRING); \ \ - curr_lexer->string_text = ""; \ - curr_lexer->command_arg_paren_count = 0; \ + curr_lexer->m_string_text = ""; \ + curr_lexer->m_command_arg_paren_count = 0; \ \ yyless (0); \ \ @@ -300,7 +300,7 @@ } \ else \ { \ - if (! curr_lexer->looking_at_decl_list \ + if (! curr_lexer->m_looking_at_decl_list \ && curr_lexer->previous_token_may_be_command ()) \ { \ yyless (0); \ @@ -311,7 +311,7 @@ if (get_set) \ { \ yyless (3); \ - curr_lexer->maybe_classdef_get_set_method = false; \ + curr_lexer->m_maybe_classdef_get_set_method = false; \ } \ \ int id_tok = curr_lexer->handle_identifier (); \ @@ -363,7 +363,7 @@ // May be reset later if we see "function" or "classdef" appears // as the first token. - curr_lexer->reading_script_file = true; + curr_lexer->m_reading_script_file = true; curr_lexer->pop_start_state (); @@ -375,7 +375,7 @@ // May be reset later if we see "function" or "classdef" appears // as the first token. - curr_lexer->reading_script_file = true; + curr_lexer->m_reading_script_file = true; curr_lexer->pop_start_state (); @@ -396,8 +396,8 @@ COMMAND_ARG_FINISH; - curr_lexer->input_line_number++; - curr_lexer->current_input_column = 1; + curr_lexer->m_input_line_number++; + curr_lexer->m_current_input_column = 1; HANDLE_STRING_CONTINUATION; } @@ -411,10 +411,10 @@ COMMAND_ARG_FINISH; - curr_lexer->input_line_number++; - curr_lexer->current_input_column = 1; - curr_lexer->looking_for_object_index = false; - curr_lexer->at_beginning_of_statement = true; + curr_lexer->m_input_line_number++; + curr_lexer->m_current_input_column = 1; + curr_lexer->m_looking_for_object_index = false; + curr_lexer->m_at_beginning_of_statement = true; curr_lexer->pop_start_state (); return curr_lexer->handle_token ('\n'); @@ -423,18 +423,18 @@ <COMMAND_START>[\,\;] { curr_lexer->lexer_debug ("<COMMAND_START>[\\,\\;]"); - if (yytext[0] != ',' || curr_lexer->command_arg_paren_count == 0) + if (yytext[0] != ',' || curr_lexer->m_command_arg_paren_count == 0) { COMMAND_ARG_FINISH; - curr_lexer->looking_for_object_index = false; - curr_lexer->at_beginning_of_statement = true; + curr_lexer->m_looking_for_object_index = false; + curr_lexer->m_at_beginning_of_statement = true; curr_lexer->pop_start_state (); return curr_lexer->handle_token (yytext[0]); } else - curr_lexer->string_text += yytext; - - curr_lexer->current_input_column += yyleng; + curr_lexer->m_string_text += yytext; + + curr_lexer->m_current_input_column += yyleng; } %{ @@ -446,17 +446,17 @@ <COMMAND_START>[\(\[\{]* { curr_lexer->lexer_debug ("<COMMAND_START>[\\(\\[\\{]+"); - curr_lexer->command_arg_paren_count += yyleng; - curr_lexer->string_text += yytext; - curr_lexer->current_input_column += yyleng; + curr_lexer->m_command_arg_paren_count += yyleng; + curr_lexer->m_string_text += yytext; + curr_lexer->m_current_input_column += yyleng; } <COMMAND_START>[\)\]\}]* { curr_lexer->lexer_debug ("<COMMAND_START>[\\)\\]\\}]+"); - curr_lexer->command_arg_paren_count -= yyleng; - curr_lexer->string_text += yytext; - curr_lexer->current_input_column += yyleng; + curr_lexer->m_command_arg_paren_count -= yyleng; + curr_lexer->m_string_text += yytext; + curr_lexer->m_current_input_column += yyleng; } %{ @@ -474,13 +474,13 @@ <COMMAND_START>[\"\'] { curr_lexer->lexer_debug ("<COMMAND_START>[\\\"\\']"); - if (curr_lexer->command_arg_paren_count == 0) + if (curr_lexer->m_command_arg_paren_count == 0) curr_lexer->begin_string (yytext[0] == '"' ? DQ_STRING_START : SQ_STRING_START); else - curr_lexer->string_text += yytext; - - curr_lexer->current_input_column += yyleng; + curr_lexer->m_string_text += yytext; + + curr_lexer->m_current_input_column += yyleng; } %{ @@ -492,12 +492,12 @@ <COMMAND_START>{S}* { curr_lexer->lexer_debug ("<COMMAND_START>{S}*"); - if (curr_lexer->command_arg_paren_count == 0) + if (curr_lexer->m_command_arg_paren_count == 0) COMMAND_ARG_FINISH; else - curr_lexer->string_text += yytext; - - curr_lexer->current_input_column += yyleng; + curr_lexer->m_string_text += yytext; + + curr_lexer->m_current_input_column += yyleng; } %{ @@ -507,8 +507,8 @@ <COMMAND_START>([\.]|[^#% \t\r\n\.\,\;\"\'\(\[\{\}\]\)]*) { curr_lexer->lexer_debug ("<COMMAND_START>([\\.]|[^#% \\t\\r\\n\\.\\,\\;\\\"\\'\\(\\[\\{\\}\\]\\)]*"); - curr_lexer->string_text += yytext; - curr_lexer->current_input_column += yyleng; + curr_lexer->m_string_text += yytext; + curr_lexer->m_current_input_column += yyleng; } <MATRIX_START>{S}* { @@ -520,10 +520,10 @@ <MATRIX_START>{NL} { curr_lexer->lexer_debug ("<MATRIX_START>{NL}"); - curr_lexer->input_line_number++; - curr_lexer->current_input_column = 1; - - if (curr_lexer->nesting_level.is_paren ()) + curr_lexer->m_input_line_number++; + curr_lexer->m_current_input_column = 1; + + if (curr_lexer->m_nesting_level.is_paren ()) curr_lexer->warn_language_extension ("bare newline inside parentheses"); else { @@ -533,7 +533,7 @@ { curr_lexer->xunput (';'); // Adjust for semicolon that was not really in the input stream. - curr_lexer->current_input_column--; + curr_lexer->m_current_input_column--; } } } @@ -555,10 +555,10 @@ <MATRIX_START>\] { curr_lexer->lexer_debug ("<MATRIX_START>\\]"); - curr_lexer->looking_at_object_index.pop_front (); - - curr_lexer->looking_for_object_index = true; - curr_lexer->at_beginning_of_statement = false; + curr_lexer->m_looking_at_object_index.pop_front (); + + curr_lexer->m_looking_for_object_index = true; + curr_lexer->m_at_beginning_of_statement = false; curr_lexer->handle_close_bracket (']'); @@ -572,10 +572,10 @@ <MATRIX_START>\} { curr_lexer->lexer_debug ("<MATRIX_START>\\}*"); - curr_lexer->looking_at_object_index.pop_front (); - - curr_lexer->looking_for_object_index = true; - curr_lexer->at_beginning_of_statement = false; + curr_lexer->m_looking_at_object_index.pop_front (); + + curr_lexer->m_looking_for_object_index = true; + curr_lexer->m_at_beginning_of_statement = false; curr_lexer->handle_close_bracket ('}'); @@ -602,27 +602,27 @@ yyless (0); curr_lexer->xunput (','); // Adjust for comma that was not really in the input stream. - curr_lexer->current_input_column--; + curr_lexer->m_current_input_column--; } else { - curr_lexer->nesting_level.bracket (); - - curr_lexer->looking_at_object_index.push_front (false); - - curr_lexer->current_input_column += yyleng; - curr_lexer->looking_for_object_index = false; - curr_lexer->at_beginning_of_statement = false; - - if (curr_lexer->defining_func - && ! curr_lexer->parsed_function_name.top ()) - curr_lexer->looking_at_return_list = true; + curr_lexer->m_nesting_level.bracket (); + + curr_lexer->m_looking_at_object_index.push_front (false); + + curr_lexer->m_current_input_column += yyleng; + curr_lexer->m_looking_for_object_index = false; + curr_lexer->m_at_beginning_of_statement = false; + + if (curr_lexer->m_defining_func + && ! curr_lexer->m_parsed_function_name.top ()) + curr_lexer->m_looking_at_return_list = true; else - curr_lexer->looking_at_matrix_or_assign_lhs = true; + curr_lexer->m_looking_at_matrix_or_assign_lhs = true; curr_lexer->decrement_promptflag (); - curr_lexer->bracketflag++; + curr_lexer->m_bracketflag++; curr_lexer->push_start_state (MATRIX_START); @@ -633,12 +633,12 @@ \] { curr_lexer->lexer_debug ("\\]"); - curr_lexer->nesting_level.remove (); - - curr_lexer->looking_at_object_index.pop_front (); - - curr_lexer->looking_for_object_index = true; - curr_lexer->at_beginning_of_statement = false; + curr_lexer->m_nesting_level.remove (); + + curr_lexer->m_looking_at_object_index.pop_front (); + + curr_lexer->m_looking_for_object_index = true; + curr_lexer->m_at_beginning_of_statement = false; return curr_lexer->handle_token (']'); } @@ -660,7 +660,7 @@ if (curr_lexer->start_state () == LINE_COMMENT_START) { - if (! curr_lexer->comment_text.empty ()) + if (! curr_lexer->m_comment_text.empty ()) curr_lexer->finish_comment (octave::comment_elt::full_line); curr_lexer->pop_start_state (); @@ -675,13 +675,13 @@ <BLOCK_COMMENT_START>^{S}*{CCHAR}\{{S}*{NL} { curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>^{S}*{CCHAR}\\{{S}*{NL}"); - curr_lexer->input_line_number++; - curr_lexer->current_input_column = 1; - - if (curr_lexer->block_comment_nesting_level) - curr_lexer->comment_text = "\n"; - - curr_lexer->block_comment_nesting_level++; + curr_lexer->m_input_line_number++; + curr_lexer->m_current_input_column = 1; + + if (curr_lexer->m_block_comment_nesting_level) + curr_lexer->m_comment_text = "\n"; + + curr_lexer->m_block_comment_nesting_level++; } %{ @@ -693,17 +693,17 @@ <BLOCK_COMMENT_START>^{S}*{CCHAR}\}{S}*{NL} { curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>^{S}*{CCHAR}\\}{S}*{NL}"); - curr_lexer->input_line_number++; - curr_lexer->current_input_column = 1; - - if (curr_lexer->block_comment_nesting_level > 1) - curr_lexer->comment_text = "\n"; + curr_lexer->m_input_line_number++; + curr_lexer->m_current_input_column = 1; + + if (curr_lexer->m_block_comment_nesting_level > 1) + curr_lexer->m_comment_text = "\n"; else curr_lexer->finish_comment (octave::comment_elt::block); - curr_lexer->block_comment_nesting_level--; - - if (curr_lexer->block_comment_nesting_level == 0) + curr_lexer->m_block_comment_nesting_level--; + + if (curr_lexer->m_block_comment_nesting_level == 0) { curr_lexer->increment_promptflag (); @@ -718,9 +718,9 @@ <BLOCK_COMMENT_START>{ANY_EXCEPT_NL}*{NL} { curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>{ANY_EXCEPT_NL}*{NL}"); - curr_lexer->input_line_number++; - curr_lexer->current_input_column = 1; - curr_lexer->comment_text += yytext; + curr_lexer->m_input_line_number++; + curr_lexer->m_current_input_column = 1; + curr_lexer->m_comment_text += yytext; } %{ @@ -737,9 +737,9 @@ <LINE_COMMENT_START>{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL} { curr_lexer->lexer_debug ("<LINE_COMMENT_START>{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}"); - bool full_line_comment = curr_lexer->current_input_column == 1; - curr_lexer->input_line_number++; - curr_lexer->current_input_column = 1; + bool full_line_comment = curr_lexer->m_current_input_column == 1; + curr_lexer->m_input_line_number++; + curr_lexer->m_current_input_column = 1; bool have_space = false; size_t len = yyleng; @@ -770,7 +770,7 @@ break; } - curr_lexer->comment_text += &yytext[i]; + curr_lexer->m_comment_text += &yytext[i]; if (full_line_comment) { @@ -808,7 +808,7 @@ curr_lexer->pop_start_state (); curr_lexer->xunput ('\n'); - curr_lexer->input_line_number--; + curr_lexer->m_input_line_number--; } } @@ -845,28 +845,28 @@ <DQ_STRING_START>\"\" { curr_lexer->lexer_debug ("<DQ_STRING_START>\\\"\\\""); - curr_lexer->current_input_column += yyleng; - curr_lexer->string_text += '"'; + curr_lexer->m_current_input_column += yyleng; + curr_lexer->m_string_text += '"'; } <DQ_STRING_START>\" { curr_lexer->lexer_debug ("<DQ_STRING_START>\\\""); - curr_lexer->current_input_column++; + curr_lexer->m_current_input_column++; curr_lexer->pop_start_state (); if (curr_lexer->start_state() != COMMAND_START) { - curr_lexer->looking_for_object_index = true; - curr_lexer->at_beginning_of_statement = false; + curr_lexer->m_looking_for_object_index = true; + curr_lexer->m_at_beginning_of_statement = false; curr_lexer->push_token (new octave::token (DQ_STRING, - curr_lexer->string_text, - curr_lexer->string_line, - curr_lexer->string_column)); - - curr_lexer->string_text = ""; + curr_lexer->m_string_text, + curr_lexer->m_string_line, + curr_lexer->m_string_column)); + + curr_lexer->m_string_text = ""; return curr_lexer->count_token_internal (DQ_STRING); } @@ -875,7 +875,7 @@ <DQ_STRING_START>\\[0-7]{1,3} { curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\[0-7]{1,3}"); - curr_lexer->current_input_column += yyleng; + curr_lexer->m_current_input_column += yyleng; int result; sscanf (yytext+1, "%o", &result); @@ -885,21 +885,21 @@ octave::token *tok = new octave::token (LEXICAL_ERROR, "invalid octal escape sequence in character string", - curr_lexer->input_line_number, - curr_lexer->current_input_column); + curr_lexer->m_input_line_number, + curr_lexer->m_current_input_column); curr_lexer->push_token (tok); return curr_lexer->count_token_internal (LEXICAL_ERROR); } else - curr_lexer->string_text += static_cast<unsigned char> (result); + curr_lexer->m_string_text += static_cast<unsigned char> (result); } <DQ_STRING_START>\\x[0-9a-fA-F]+ { curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\x[0-9a-fA-F]+"); - curr_lexer->current_input_column += yyleng; + curr_lexer->m_current_input_column += yyleng; int result; sscanf (yytext+2, "%x", &result); @@ -908,56 +908,56 @@ // we do for octal above. This is to match C/C++ where any number // of digits is allowed but the value is implementation-defined if // it exceeds the range of the character type. - curr_lexer->string_text += static_cast<unsigned char> (result); + curr_lexer->m_string_text += static_cast<unsigned char> (result); } <DQ_STRING_START>"\\a" { curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\a\""); - curr_lexer->current_input_column += yyleng; - curr_lexer->string_text += '\a'; + curr_lexer->m_current_input_column += yyleng; + curr_lexer->m_string_text += '\a'; } <DQ_STRING_START>"\\b" { curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\b\""); - curr_lexer->current_input_column += yyleng; - curr_lexer->string_text += '\b'; + curr_lexer->m_current_input_column += yyleng; + curr_lexer->m_string_text += '\b'; } <DQ_STRING_START>"\\f" { curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\f\""); - curr_lexer->current_input_column += yyleng; - curr_lexer->string_text += '\f'; + curr_lexer->m_current_input_column += yyleng; + curr_lexer->m_string_text += '\f'; } <DQ_STRING_START>"\\n" { curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\n\""); - curr_lexer->current_input_column += yyleng; - curr_lexer->string_text += '\n'; + curr_lexer->m_current_input_column += yyleng; + curr_lexer->m_string_text += '\n'; } <DQ_STRING_START>"\\r" { curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\r\""); - curr_lexer->current_input_column += yyleng; - curr_lexer->string_text += '\r'; + curr_lexer->m_current_input_column += yyleng; + curr_lexer->m_string_text += '\r'; } <DQ_STRING_START>"\\t" { curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\t\""); - curr_lexer->current_input_column += yyleng; - curr_lexer->string_text += '\t'; + curr_lexer->m_current_input_column += yyleng; + curr_lexer->m_string_text += '\t'; } <DQ_STRING_START>"\\v" { curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\v\""); - curr_lexer->current_input_column += yyleng; - curr_lexer->string_text += '\v'; + curr_lexer->m_current_input_column += yyleng; + curr_lexer->m_string_text += '\v'; } <DQ_STRING_START>(\.\.\.){S}*{NL} { @@ -965,14 +965,14 @@ static const char *msg = "'...' continuations in double-quoted character strings are obsolete and will not be allowed in a future version of Octave; please use '\\' instead"; - std::string nm = curr_lexer->fcn_file_full_name; + std::string nm = curr_lexer->m_fcn_file_full_name; if (nm.empty ()) warning_with_id ("Octave:deprecated-syntax", "%s", msg); else warning_with_id ("Octave:deprecated-syntax", "%s; near line %d of file '%s'", msg, - curr_lexer->input_line_number, nm.c_str ()); + curr_lexer->m_input_line_number, nm.c_str ()); HANDLE_STRING_CONTINUATION; } @@ -982,14 +982,14 @@ static const char *msg = "white space and comments after continuation markers in double-quoted character strings are obsolete and will not be allowed in a future version of Octave"; - std::string nm = curr_lexer->fcn_file_full_name; + std::string nm = curr_lexer->m_fcn_file_full_name; if (nm.empty ()) warning_with_id ("Octave:deprecated-syntax", "%s", msg); else warning_with_id ("Octave:deprecated-syntax", "%s; near line %d of file '%s'", msg, - curr_lexer->input_line_number, nm.c_str ()); + curr_lexer->m_input_line_number, nm.c_str ()); HANDLE_STRING_CONTINUATION; } @@ -1003,22 +1003,22 @@ <DQ_STRING_START>\\. { curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\."); - curr_lexer->current_input_column += yyleng; - curr_lexer->string_text += yytext[1]; + curr_lexer->m_current_input_column += yyleng; + curr_lexer->m_string_text += yytext[1]; } <DQ_STRING_START>\. { curr_lexer->lexer_debug ("<DQ_STRING_START>\\."); - curr_lexer->current_input_column++; - curr_lexer->string_text += yytext[0]; + curr_lexer->m_current_input_column++; + curr_lexer->m_string_text += yytext[0]; } <DQ_STRING_START>[^\.\\\r\n\"]+ { curr_lexer->lexer_debug ("<DQ_STRING_START>[^\\.\\\\\\r\\n\\\"]+"); - curr_lexer->current_input_column += yyleng; - curr_lexer->string_text += yytext; + curr_lexer->m_current_input_column += yyleng; + curr_lexer->m_string_text += yytext; } <DQ_STRING_START>{NL} { @@ -1027,13 +1027,13 @@ octave::token *tok = new octave::token (LEXICAL_ERROR, "unterminated character string constant", - curr_lexer->input_line_number, - curr_lexer->current_input_column); + curr_lexer->m_input_line_number, + curr_lexer->m_current_input_column); curr_lexer->push_token (tok); - curr_lexer->input_line_number++; - curr_lexer->current_input_column = 1; + curr_lexer->m_input_line_number++; + curr_lexer->m_current_input_column = 1; return curr_lexer->count_token_internal (LEXICAL_ERROR); } @@ -1045,28 +1045,28 @@ <SQ_STRING_START>\'\' { curr_lexer->lexer_debug ("<SQ_STRING_START>\\'\\'"); - curr_lexer->current_input_column += yyleng; - curr_lexer->string_text += '\''; + curr_lexer->m_current_input_column += yyleng; + curr_lexer->m_string_text += '\''; } <SQ_STRING_START>\' { curr_lexer->lexer_debug ("<SQ_STRING_START>\\'"); - curr_lexer->current_input_column++; + curr_lexer->m_current_input_column++; curr_lexer->pop_start_state (); if (curr_lexer->start_state() != COMMAND_START) { - curr_lexer->looking_for_object_index = true; - curr_lexer->at_beginning_of_statement = false; + curr_lexer->m_looking_for_object_index = true; + curr_lexer->m_at_beginning_of_statement = false; curr_lexer->push_token (new octave::token (SQ_STRING, - curr_lexer->string_text, - curr_lexer->string_line, - curr_lexer->string_column)); - - curr_lexer->string_text = ""; + curr_lexer->m_string_text, + curr_lexer->m_string_line, + curr_lexer->m_string_column)); + + curr_lexer->m_string_text = ""; return curr_lexer->count_token_internal (SQ_STRING); } @@ -1075,8 +1075,8 @@ <SQ_STRING_START>[^\'\n\r]+ { curr_lexer->lexer_debug ("<SQ_STRING_START>[^\\'\\n\\r]+"); - curr_lexer->current_input_column += yyleng; - curr_lexer->string_text += yytext; + curr_lexer->m_current_input_column += yyleng; + curr_lexer->m_string_text += yytext; } <SQ_STRING_START>{NL} { @@ -1085,13 +1085,13 @@ octave::token *tok = new octave::token (LEXICAL_ERROR, "unterminated character string constant", - curr_lexer->input_line_number, - curr_lexer->current_input_column); + curr_lexer->m_input_line_number, + curr_lexer->m_current_input_column); curr_lexer->push_token (tok); - curr_lexer->input_line_number++; - curr_lexer->current_input_column = 1; + curr_lexer->m_input_line_number++; + curr_lexer->m_current_input_column = 1; return curr_lexer->count_token_internal (LEXICAL_ERROR); } @@ -1108,14 +1108,14 @@ if (id_tok >= 0) { - curr_lexer->looking_for_object_index = true; + curr_lexer->m_looking_for_object_index = true; return curr_lexer->count_token_internal (id_tok); } } <FQ_IDENT_START>{S}+ { - curr_lexer->current_input_column += yyleng; + curr_lexer->m_current_input_column += yyleng; curr_lexer->mark_previous_token_trailing_space (); } @@ -1199,7 +1199,7 @@ %} {S}+ { - curr_lexer->current_input_column += yyleng; + curr_lexer->m_current_input_column += yyleng; curr_lexer->mark_previous_token_trailing_space (); } @@ -1224,14 +1224,14 @@ static const char *msg = "using continuation marker \\ outside of double quoted strings is deprecated and will be removed from a future version of Octave, use ... instead"; - std::string nm = curr_lexer->fcn_file_full_name; + std::string nm = curr_lexer->m_fcn_file_full_name; if (nm.empty ()) warning_with_id ("Octave:deprecated-syntax", "%s", msg); else warning_with_id ("Octave:deprecated-syntax", "%s; near line %d of file '%s'", msg, - curr_lexer->input_line_number, nm.c_str ()); + curr_lexer->m_input_line_number, nm.c_str ()); curr_lexer->handle_continuation (); } @@ -1277,7 +1277,7 @@ if (id_tok >= 0) { - curr_lexer->looking_for_object_index = true; + curr_lexer->m_looking_for_object_index = true; return curr_lexer->count_token_internal (id_tok); } @@ -1303,7 +1303,7 @@ if (id_tok >= 0) { - curr_lexer->looking_for_object_index = true; + curr_lexer->m_looking_for_object_index = true; return curr_lexer->count_token_internal (id_tok); } @@ -1333,11 +1333,11 @@ } else { - curr_lexer->current_input_column++; - - curr_lexer->looking_at_function_handle++; - curr_lexer->looking_for_object_index = false; - curr_lexer->at_beginning_of_statement = false; + curr_lexer->m_current_input_column++; + + curr_lexer->m_looking_at_function_handle++; + curr_lexer->m_looking_for_object_index = false; + curr_lexer->m_at_beginning_of_statement = false; return curr_lexer->count_token ('@'); } @@ -1353,37 +1353,37 @@ {NL} { curr_lexer->lexer_debug ("{NL}"); - if (curr_lexer->nesting_level.is_paren ()) + if (curr_lexer->m_nesting_level.is_paren ()) { - curr_lexer->input_line_number++; - curr_lexer->current_input_column = 1; - - curr_lexer->at_beginning_of_statement = false; + curr_lexer->m_input_line_number++; + curr_lexer->m_current_input_column = 1; + + curr_lexer->m_at_beginning_of_statement = false; curr_lexer->warn_language_extension ("bare newline inside parentheses"); } - else if (curr_lexer->nesting_level.none () - || curr_lexer->nesting_level.is_anon_fcn_body ()) + else if (curr_lexer->m_nesting_level.none () + || curr_lexer->m_nesting_level.is_anon_fcn_body ()) { - curr_lexer->input_line_number++; - curr_lexer->current_input_column = 1; - - curr_lexer->at_beginning_of_statement = true; + curr_lexer->m_input_line_number++; + curr_lexer->m_current_input_column = 1; + + curr_lexer->m_at_beginning_of_statement = true; return curr_lexer->count_token ('\n'); } - else if (curr_lexer->nesting_level.is_bracket_or_brace ()) + else if (curr_lexer->m_nesting_level.is_bracket_or_brace ()) { octave::token *tok = new octave::token (LEXICAL_ERROR, "unexpected internal lexer error", - curr_lexer->input_line_number, - curr_lexer->current_input_column); + curr_lexer->m_input_line_number, + curr_lexer->m_current_input_column); curr_lexer->push_token (tok); - curr_lexer->input_line_number++; - curr_lexer->current_input_column = 1; + curr_lexer->m_input_line_number++; + curr_lexer->m_current_input_column = 1; return curr_lexer->count_token_internal (LEXICAL_ERROR); } @@ -1400,13 +1400,13 @@ if (curr_lexer->previous_token_may_be_command () && curr_lexer->space_follows_previous_token ()) { - curr_lexer->current_input_column++; + curr_lexer->m_current_input_column++; curr_lexer->push_start_state (COMMAND_START); curr_lexer->begin_string (SQ_STRING_START); } - else if (curr_lexer->at_beginning_of_statement) + else if (curr_lexer->m_at_beginning_of_statement) { - curr_lexer->current_input_column++; + curr_lexer->m_current_input_column++; curr_lexer->begin_string (SQ_STRING_START); } else @@ -1420,7 +1420,7 @@ if (tok == '[' || tok == '{' || curr_lexer->previous_token_is_binop ()) { - curr_lexer->current_input_column++; + curr_lexer->m_current_input_column++; curr_lexer->begin_string (SQ_STRING_START); } else @@ -1428,7 +1428,7 @@ yyless (0); curr_lexer->xunput (','); // Adjust for comma that was not really in the input stream. - curr_lexer->current_input_column--; + curr_lexer->m_current_input_column--; } } else @@ -1437,7 +1437,7 @@ || curr_lexer->previous_token_is_binop () || curr_lexer->previous_token_is_keyword ()) { - curr_lexer->current_input_column++; + curr_lexer->m_current_input_column++; curr_lexer->begin_string (SQ_STRING_START); } else @@ -1450,7 +1450,7 @@ || curr_lexer->previous_token_is_binop () || curr_lexer->previous_token_is_keyword ()) { - curr_lexer->current_input_column++; + curr_lexer->m_current_input_column++; curr_lexer->begin_string (SQ_STRING_START); } else @@ -1469,7 +1469,7 @@ if (curr_lexer->previous_token_may_be_command () && curr_lexer->space_follows_previous_token ()) { - curr_lexer->current_input_column++; + curr_lexer->m_current_input_column++; curr_lexer->push_start_state (COMMAND_START); curr_lexer->begin_string (DQ_STRING_START); } @@ -1484,7 +1484,7 @@ if (tok == '[' || tok == '{' || curr_lexer->previous_token_is_binop ()) { - curr_lexer->current_input_column++; + curr_lexer->m_current_input_column++; curr_lexer->begin_string (DQ_STRING_START); } else @@ -1492,18 +1492,18 @@ yyless (0); curr_lexer->xunput (','); // Adjust for comma that was not really in the input stream. - curr_lexer->current_input_column--; + curr_lexer->m_current_input_column--; } } else { - curr_lexer->current_input_column++; + curr_lexer->m_current_input_column++; curr_lexer->begin_string (DQ_STRING_START); } } else { - curr_lexer->current_input_column++; + curr_lexer->m_current_input_column++; curr_lexer->begin_string (DQ_STRING_START); } } @@ -1547,7 +1547,7 @@ ";" { bool at_beginning_of_statement = (! (curr_lexer->whitespace_is_significant () - || curr_lexer->looking_at_object_index.front ())); + || curr_lexer->m_looking_at_object_index.front ())); return curr_lexer->handle_op (";", ';', at_beginning_of_statement); } @@ -1561,7 +1561,7 @@ "," { bool at_beginning_of_statement = (! (curr_lexer->whitespace_is_significant () - || curr_lexer->looking_at_object_index.front ())); + || curr_lexer->m_looking_at_object_index.front ())); return curr_lexer->handle_op (",", ',', at_beginning_of_statement); } @@ -1593,23 +1593,23 @@ yyless (0); curr_lexer->xunput (','); // Adjust for comma that was not really in the input stream. - curr_lexer->current_input_column--; + curr_lexer->m_current_input_column--; } else { // If we are looking for an object index, then push TRUE for - // looking_at_object_index. Otherwise, just push whatever state + // m_looking_at_object_index. Otherwise, just push whatever state // is current (so that we can pop it off the stack when we find // the matching close paren). - curr_lexer->looking_at_object_index.push_front - (curr_lexer->looking_for_object_index); - - curr_lexer->looking_at_indirect_ref = false; - curr_lexer->looking_for_object_index = false; - curr_lexer->at_beginning_of_statement = false; - - curr_lexer->nesting_level.paren (); + curr_lexer->m_looking_at_object_index.push_front + (curr_lexer->m_looking_for_object_index); + + curr_lexer->m_looking_at_indirect_ref = false; + curr_lexer->m_looking_for_object_index = false; + curr_lexer->m_at_beginning_of_statement = false; + + curr_lexer->m_nesting_level.paren (); curr_lexer->decrement_promptflag (); return curr_lexer->handle_token ('('); @@ -1619,18 +1619,18 @@ ")" { curr_lexer->lexer_debug (")"); - curr_lexer->nesting_level.remove (); - curr_lexer->current_input_column++; - - curr_lexer->looking_at_object_index.pop_front (); - - curr_lexer->looking_for_object_index = true; - curr_lexer->at_beginning_of_statement = false; - - if (curr_lexer->looking_at_anon_fcn_args) + curr_lexer->m_nesting_level.remove (); + curr_lexer->m_current_input_column++; + + curr_lexer->m_looking_at_object_index.pop_front (); + + curr_lexer->m_looking_for_object_index = true; + curr_lexer->m_at_beginning_of_statement = false; + + if (curr_lexer->m_looking_at_anon_fcn_args) { - curr_lexer->looking_at_anon_fcn_args = false; - curr_lexer->nesting_level.anon_fcn_body (); + curr_lexer->m_looking_at_anon_fcn_args = false; + curr_lexer->m_nesting_level.anon_fcn_body (); } return curr_lexer->count_token (')'); @@ -1647,8 +1647,8 @@ } else { - curr_lexer->looking_for_object_index = false; - curr_lexer->at_beginning_of_statement = false; + curr_lexer->m_looking_for_object_index = false; + curr_lexer->m_at_beginning_of_statement = false; return curr_lexer->handle_token ('.'); } @@ -1705,22 +1705,22 @@ yyless (0); curr_lexer->xunput (','); // Adjust for comma that was not really in the input stream. - curr_lexer->current_input_column--; + curr_lexer->m_current_input_column--; } else { - curr_lexer->nesting_level.brace (); - - curr_lexer->looking_at_object_index.push_front - (curr_lexer->looking_for_object_index); - - curr_lexer->current_input_column += yyleng; - curr_lexer->looking_for_object_index = false; - curr_lexer->at_beginning_of_statement = false; + curr_lexer->m_nesting_level.brace (); + + curr_lexer->m_looking_at_object_index.push_front + (curr_lexer->m_looking_for_object_index); + + curr_lexer->m_current_input_column += yyleng; + curr_lexer->m_looking_for_object_index = false; + curr_lexer->m_at_beginning_of_statement = false; curr_lexer->decrement_promptflag (); - curr_lexer->braceflag++; + curr_lexer->m_braceflag++; curr_lexer->push_start_state (MATRIX_START); @@ -1731,12 +1731,12 @@ "}" { curr_lexer->lexer_debug ("}"); - curr_lexer->looking_at_object_index.pop_front (); - - curr_lexer->looking_for_object_index = true; - curr_lexer->at_beginning_of_statement = false; - - curr_lexer->nesting_level.remove (); + curr_lexer->m_looking_at_object_index.pop_front (); + + curr_lexer->m_looking_for_object_index = true; + curr_lexer->m_at_beginning_of_statement = false; + + curr_lexer->m_nesting_level.remove (); return curr_lexer->handle_token ('}'); } @@ -1766,12 +1766,12 @@ octave::token *tok = new octave::token (LEXICAL_ERROR, buf.str (), - curr_lexer->input_line_number, - curr_lexer->current_input_column); + curr_lexer->m_input_line_number, + curr_lexer->m_current_input_column); curr_lexer->push_token (tok); - curr_lexer->current_input_column++; + curr_lexer->m_current_input_column++; return curr_lexer->count_token_internal (LEXICAL_ERROR); } @@ -2079,8 +2079,8 @@ void lexical_feedback::symbol_table_context::clear (void) { - while (! frame_stack.empty ()) - frame_stack.pop_front (); + while (! m_frame_stack.empty ()) + m_frame_stack.pop_front (); } void @@ -2089,7 +2089,7 @@ if (empty ()) panic_impossible (); - frame_stack.pop_front (); + m_frame_stack.pop_front (); } symbol_scope @@ -2103,7 +2103,7 @@ return scope; } else - return frame_stack.front (); + return m_frame_stack.front (); } symbol_scope @@ -2111,12 +2111,14 @@ { size_t sz = size (); - return sz > 1 ? frame_stack[1] : (sz == 1 ? frame_stack[0] : symbol_scope ()); + return (sz > 1 + ? m_frame_stack[1] + : (sz == 1 ? m_frame_stack[0] : symbol_scope ())); } lexical_feedback::~lexical_feedback (void) { - tokens.clear (); + m_tokens.clear (); } void @@ -2124,84 +2126,84 @@ { // The closest paren, brace, or bracket nesting is not an object // index. - looking_at_object_index.push_front (false); + m_looking_at_object_index.push_front (false); } void lexical_feedback::reset (void) { - end_of_input = false; - at_beginning_of_statement = true; - looking_at_anon_fcn_args = false; - looking_at_return_list = false; - looking_at_parameter_list = false; - looking_at_decl_list = false; - looking_at_initializer_expression = false; - looking_at_matrix_or_assign_lhs = false; - looking_for_object_index = false; - looking_at_indirect_ref = false; - parsing_class_method = false; - parsing_classdef = false; - maybe_classdef_get_set_method = false; - parsing_classdef_get_method = false; - parsing_classdef_set_method = false; - quote_is_transpose = false; - force_script = false; - reading_fcn_file = false; - reading_script_file = false; - reading_classdef_file = false; - buffer_function_text = false; - input_line_number = 1; - current_input_column = 1; - bracketflag = 0; - braceflag = 0; - looping = 0; - defining_func = 0; - looking_at_function_handle = 0; - block_comment_nesting_level = 0; - command_arg_paren_count = 0; - token_count = 0; - current_input_line = ""; - comment_text = ""; - help_text = ""; - function_text = ""; - string_text = ""; - string_line = 0; - string_column = 0; - fcn_file_name = ""; - fcn_file_full_name = ""; - dir_name = ""; - package_name = ""; - looking_at_object_index.clear (); - looking_at_object_index.push_front (false); - - while (! parsed_function_name.empty ()) - parsed_function_name.pop (); - - pending_local_variables.clear (); - symtab_context.clear (); - nesting_level.reset (); - tokens.clear (); + m_end_of_input = false; + m_at_beginning_of_statement = true; + m_looking_at_anon_fcn_args = false; + m_looking_at_return_list = false; + m_looking_at_parameter_list = false; + m_looking_at_decl_list = false; + m_looking_at_initializer_expression = false; + m_looking_at_matrix_or_assign_lhs = false; + m_looking_for_object_index = false; + m_looking_at_indirect_ref = false; + m_parsing_class_method = false; + m_parsing_classdef = false; + m_maybe_classdef_get_set_method = false; + m_parsing_classdef_get_method = false; + m_parsing_classdef_set_method = false; + m_quote_is_transpose = false; + m_force_script = false; + m_reading_fcn_file = false; + m_reading_script_file = false; + m_reading_classdef_file = false; + m_buffer_function_text = false; + m_input_line_number = 1; + m_current_input_column = 1; + m_bracketflag = 0; + m_braceflag = 0; + m_looping = 0; + m_defining_func = 0; + m_looking_at_function_handle = 0; + m_block_comment_nesting_level = 0; + m_command_arg_paren_count = 0; + m_token_count = 0; + m_current_input_line = ""; + m_comment_text = ""; + m_help_text = ""; + m_function_text = ""; + m_string_text = ""; + m_string_line = 0; + m_string_column = 0; + m_fcn_file_name = ""; + m_fcn_file_full_name = ""; + m_dir_name = ""; + m_package_name = ""; + m_looking_at_object_index.clear (); + m_looking_at_object_index.push_front (false); + + while (! m_parsed_function_name.empty ()) + m_parsed_function_name.pop (); + + m_pending_local_variables.clear (); + m_symtab_context.clear (); + m_nesting_level.reset (); + m_tokens.clear (); } int lexical_feedback::previous_token_value (void) const { - const token *tok = tokens.front (); + const token *tok = m_tokens.front (); return tok ? tok->token_value () : 0; } bool lexical_feedback::previous_token_value_is (int tok_val) const { - const token *tok = tokens.front (); + const token *tok = m_tokens.front (); return tok ? tok->token_value_is (tok_val) : false; } void lexical_feedback::mark_previous_token_trailing_space (void) { - token *tok = tokens.front (); + token *tok = m_tokens.front (); if (tok && ! previous_token_value_is ('\n')) tok->mark_trailing_space (); } @@ -2209,7 +2211,7 @@ bool lexical_feedback::space_follows_previous_token (void) const { - const token *tok = tokens.front (); + const token *tok = m_tokens.front (); return tok ? tok->space_follows_token () : false; } @@ -2236,31 +2238,31 @@ bool lexical_feedback::previous_token_is_keyword (void) const { - const token *tok = tokens.front (); + const token *tok = m_tokens.front (); return tok ? tok->is_keyword () : false; } bool lexical_feedback::previous_token_may_be_command (void) const { - const token *tok = tokens.front (); + const token *tok = m_tokens.front (); return tok ? tok->may_be_command () : false; } void lexical_feedback::maybe_mark_previous_token_as_variable (void) { - token *tok = tokens.front (); + token *tok = m_tokens.front (); if (tok && tok->is_symbol ()) - pending_local_variables.insert (tok->symbol_name ()); + m_pending_local_variables.insert (tok->symbol_name ()); } void lexical_feedback::mark_as_variables (const std::list<std::string>& lst) { for (const auto& var : lst) - pending_local_variables.insert (var); + m_pending_local_variables.insert (var); } } @@ -2291,10 +2293,10 @@ void base_lexer::input_buffer::fill (const std::string& input, bool eof_arg) { - buffer = input; - chars_left = buffer.length (); - pos = buffer.c_str (); - eof = eof_arg; + m_buffer = input; + m_chars_left = m_buffer.length (); + m_pos = m_buffer.c_str (); + m_eof = eof_arg; } int @@ -2302,16 +2304,16 @@ { static const char * const eol = "\n"; - size_t len = max_size > chars_left ? chars_left : max_size; + size_t len = max_size > m_chars_left ? m_chars_left : max_size; assert (len > 0); - memcpy (buf, pos, len); - - chars_left -= len; - pos += len; + memcpy (buf, m_pos, len); + + m_chars_left -= len; + m_pos += len; // Make sure input ends with a new line character. - if (chars_left == 0 && buf[len-1] != '\n') + if (m_chars_left == 0 && buf[len-1] != '\n') { if (len < max_size) { @@ -2324,8 +2326,8 @@ // There isn't enough room to plug the newline character // in the buffer so arrange to have it returned on the next // call to base_lexer::read. - pos = eol; - chars_left = 1; + m_pos = eol; + m_chars_left = 1; } } @@ -2334,17 +2336,17 @@ base_lexer::~base_lexer (void) { - yylex_destroy (scanner); + yylex_destroy (m_scanner); } void base_lexer::init (void) { - yylex_init (&scanner); + yylex_init (&m_scanner); // Make base_lexer object available through yyextra in // flex-generated lexer. - yyset_extra (this, scanner); + yyset_extra (this, m_scanner); clear_start_state (); } @@ -2356,7 +2358,7 @@ // OCTAVE_YYG macro. #define OCTAVE_YYG \ - struct yyguts_t *yyg = static_cast<struct yyguts_t*> (scanner) + struct yyguts_t *yyg = static_cast<struct yyguts_t*> (m_scanner) void base_lexer::reset (void) @@ -2364,7 +2366,7 @@ // Start off on the right foot. clear_start_state (); - symtab_context.clear (); + m_symtab_context.clear (); // We do want a prompt by default. promptflag (1); @@ -2373,21 +2375,21 @@ // input. if (application::interactive () - && ! (reading_fcn_file - || reading_classdef_file - || reading_script_file + && ! (m_reading_fcn_file + || m_reading_classdef_file + || m_reading_script_file || input_from_eval_string ())) - yyrestart (stdin, scanner); + yyrestart (stdin, m_scanner); lexical_feedback::reset (); - comment_buf.reset (); + m_comment_buf.reset (); } void base_lexer::prep_for_file (void) { - reading_script_file = true; + m_reading_script_file = true; push_start_state (INPUT_FILE_START); } @@ -2395,8 +2397,8 @@ void base_lexer::begin_string (int state) { - string_line = input_line_number; - string_column = current_input_column; + m_string_line = m_input_line_number; + m_string_column = m_current_input_column; push_start_state (state); } @@ -2406,14 +2408,14 @@ { lexer_debug ("<<EOF>>"); - if (block_comment_nesting_level != 0) + if (m_block_comment_nesting_level != 0) { warning ("block comment open at end of input"); - if ((reading_fcn_file || reading_script_file || reading_classdef_file) - && ! fcn_file_name.empty ()) + if ((m_reading_fcn_file || m_reading_script_file || m_reading_classdef_file) + && ! m_fcn_file_name.empty ()) warning ("near line %d of file '%s.m'", - input_line_number, fcn_file_name.c_str ()); + m_input_line_number, m_fcn_file_name.c_str ()); } return handle_token (END_OF_INPUT); @@ -2422,19 +2424,19 @@ char * base_lexer::flex_yytext (void) { - return yyget_text (scanner); + return yyget_text (m_scanner); } int base_lexer::flex_yyleng (void) { - return yyget_leng (scanner); + return yyget_leng (m_scanner); } int base_lexer::text_yyinput (void) { - int c = yyinput (scanner); + int c = yyinput (m_scanner); if (lexer_debug_flag) { @@ -2447,7 +2449,7 @@ if (c == '\r') { - c = yyinput (scanner); + c = yyinput (m_scanner); if (lexer_debug_flag) { @@ -2478,7 +2480,7 @@ std::cerr << std::endl; } - yyunput (c, buf, scanner); + yyunput (c, buf, m_scanner); } } @@ -2503,7 +2505,7 @@ { bool retval = false; - for (const bool is_obj_idx : looking_at_object_index) + for (const bool is_obj_idx : m_looking_at_object_index) { if (is_obj_idx) { @@ -2520,8 +2522,8 @@ const symbol_scope& scope) { return ((scope && scope.is_variable (name)) - || (pending_local_variables.find (name) - != pending_local_variables.end ())); + || (m_pending_local_variables.find (name) + != m_pending_local_variables.end ())); } // Handle keywords. Return -1 if the keyword should be ignored. @@ -2529,8 +2531,8 @@ int base_lexer::is_keyword_token (const std::string& s) { - int l = input_line_number; - int c = current_input_column; + int l = m_input_line_number; + int c = m_current_input_column; int len = s.length (); @@ -2538,10 +2540,10 @@ if (kw) { - bool previous_at_bos = at_beginning_of_statement; + bool previous_at_bos = m_at_beginning_of_statement; // May be reset to true for some token types. - at_beginning_of_statement = false; + m_at_beginning_of_statement = false; token *tok_val = nullptr; @@ -2554,12 +2556,12 @@ case otherwise_kw: case return_kw: case unwind_protect_cleanup_kw: - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; case persistent_kw: case global_kw: - looking_at_decl_list = true; + m_looking_at_decl_list = true; break; case case_kw: @@ -2569,82 +2571,82 @@ case end_kw: if (inside_any_object_index () - || (defining_func - && ! (looking_at_return_list - || parsed_function_name.top ()))) + || (m_defining_func + && ! (m_looking_at_return_list + || m_parsed_function_name.top ()))) { - at_beginning_of_statement = previous_at_bos; + m_at_beginning_of_statement = previous_at_bos; return 0; } tok_val = new token (end_kw, token::simple_end, l, c); - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; case end_try_catch_kw: tok_val = new token (end_try_catch_kw, token::try_catch_end, l, c); - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; case end_unwind_protect_kw: tok_val = new token (end_unwind_protect_kw, token::unwind_protect_end, l, c); - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; case endfor_kw: tok_val = new token (endfor_kw, token::for_end, l, c); - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; case endfunction_kw: tok_val = new token (endfunction_kw, token::function_end, l, c); - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; case endif_kw: tok_val = new token (endif_kw, token::if_end, l, c); - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; case endparfor_kw: tok_val = new token (endparfor_kw, token::parfor_end, l, c); - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; case endswitch_kw: tok_val = new token (endswitch_kw, token::switch_end, l, c); - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; case endwhile_kw: tok_val = new token (endwhile_kw, token::while_end, l, c); - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; case endclassdef_kw: tok_val = new token (endclassdef_kw, token::classdef_end, l, c); - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; case endenumeration_kw: tok_val = new token (endenumeration_kw, token::enumeration_end, l, c); - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; case endevents_kw: tok_val = new token (endevents_kw, token::events_end, l, c); - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; case endmethods_kw: tok_val = new token (endmethods_kw, token::methods_end, l, c); - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; case endproperties_kw: tok_val = new token (endproperties_kw, token::properties_end, l, c); - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; break; @@ -2652,18 +2654,18 @@ case parfor_kw: case while_kw: decrement_promptflag (); - looping++; + m_looping++; break; case do_kw: - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; decrement_promptflag (); - looping++; + m_looping++; break; case try_kw: case unwind_protect_kw: - at_beginning_of_statement = true; + m_at_beginning_of_statement = true; decrement_promptflag (); break; @@ -2676,9 +2678,9 @@ case set_kw: // 'get' and 'set' are keywords in classdef method // declarations. - if (! maybe_classdef_get_set_method) + if (! m_maybe_classdef_get_set_method) { - at_beginning_of_statement = previous_at_bos; + m_at_beginning_of_statement = previous_at_bos; return 0; } break; @@ -2689,9 +2691,9 @@ case properties_kw: // 'properties', 'methods' and 'events' are keywords for // classdef blocks. - if (! parsing_classdef) + if (! m_parsing_classdef) { - at_beginning_of_statement = previous_at_bos; + m_at_beginning_of_statement = previous_at_bos; return 0; } // fall through ... @@ -2700,42 +2702,42 @@ // 'classdef' is always a keyword. decrement_promptflag (); - if (! force_script && token_count == 0 && input_from_file ()) + if (! m_force_script && m_token_count == 0 && input_from_file ()) { - reading_classdef_file = true; - reading_script_file = false; + m_reading_classdef_file = true; + m_reading_script_file = false; } break; case function_kw: decrement_promptflag (); - defining_func++; - parsed_function_name.push (false); - - if (! force_script && token_count == 0 && input_from_file ()) + m_defining_func++; + m_parsed_function_name.push (false); + + if (! m_force_script && m_token_count == 0 && input_from_file ()) { - reading_fcn_file = true; - reading_script_file = false; + m_reading_fcn_file = true; + m_reading_script_file = false; } - if (! (reading_fcn_file || reading_script_file - || reading_classdef_file)) + if (! (m_reading_fcn_file || m_reading_script_file + || m_reading_classdef_file)) { // Input must be coming from the terminal or stdin? - buffer_function_text = true; - function_text += (current_input_line + "\n"); - - input_line_number = 1; + m_buffer_function_text = true; + m_function_text += (m_current_input_line + "\n"); + + m_input_line_number = 1; } break; case magic_file_kw: { - if ((reading_fcn_file || reading_script_file - || reading_classdef_file) - && ! fcn_file_full_name.empty ()) - tok_val = new token (magic_file_kw, fcn_file_full_name, l, c); + if ((m_reading_fcn_file || m_reading_script_file + || m_reading_classdef_file) + && ! m_fcn_file_full_name.empty ()) + tok_val = new token (magic_file_kw, m_fcn_file_full_name, l, c); else tok_val = new token (magic_file_kw, "stdin", l, c); } @@ -2792,9 +2794,9 @@ bool base_lexer::whitespace_is_significant (void) { - return (nesting_level.is_bracket () - || (nesting_level.is_brace () - && ! looking_at_object_index.front ())); + return (m_nesting_level.is_bracket () + || (m_nesting_level.is_brace () + && ! m_looking_at_object_index.front ())); } } @@ -2874,13 +2876,13 @@ assert (nread == 1); - looking_for_object_index = false; - at_beginning_of_statement = false; - - push_token (new token (NUM, value, yytxt, input_line_number, - current_input_column)); - - current_input_column += flex_yyleng (); + m_looking_for_object_index = false; + m_at_beginning_of_statement = false; + + push_token (new token (NUM, value, yytxt, m_input_line_number, + m_current_input_column)); + + m_current_input_column += flex_yyleng (); } void @@ -2926,41 +2928,41 @@ if (have_comment) { - comment_text = &yytxt[offset]; - - // finish_comment sets at_beginning_of_statement to true but + m_comment_text = &yytxt[offset]; + + // finish_comment sets m_at_beginning_of_statement to true but // that's not be correct if we are handling a continued // statement. Preserve the current state. - bool saved_bos = at_beginning_of_statement; + bool saved_bos = m_at_beginning_of_statement; finish_comment (comment_elt::end_of_line); - at_beginning_of_statement = saved_bos; + m_at_beginning_of_statement = saved_bos; } decrement_promptflag (); - input_line_number++; - current_input_column = 1; + m_input_line_number++; + m_current_input_column = 1; } void base_lexer::finish_comment (comment_elt::comment_type typ) { - bool copyright = looks_like_copyright (comment_text); - - if (nesting_level.none () && help_text.empty () && ! comment_text.empty () - && ! copyright && ! looks_like_shebang (comment_text)) - help_text = comment_text; + bool copyright = looks_like_copyright (m_comment_text); + + if (m_nesting_level.none () && m_help_text.empty () && ! m_comment_text.empty () + && ! copyright && ! looks_like_shebang (m_comment_text)) + m_help_text = m_comment_text; if (copyright) typ = comment_elt::copyright; - comment_buf.append (comment_text, typ); - - comment_text = ""; - - at_beginning_of_statement = true; + m_comment_buf.append (m_comment_text, typ); + + m_comment_text = ""; + + m_at_beginning_of_statement = true; } int @@ -2968,14 +2970,14 @@ { int retval = bracket_type; - if (! nesting_level.none ()) + if (! m_nesting_level.none ()) { - nesting_level.remove (); + m_nesting_level.remove (); if (bracket_type == ']') - bracketflag--; + m_bracketflag--; else if (bracket_type == '}') - braceflag--; + m_braceflag--; else panic_impossible (); } @@ -3012,7 +3014,7 @@ token *tok = new token (LEXICAL_ERROR, "method, class, and package names may not be keywords", - input_line_number, current_input_column); + m_input_line_number, m_current_input_column); push_token (tok); @@ -3020,9 +3022,9 @@ } push_token (new token (SUPERCLASSREF, meth, cls, - input_line_number, current_input_column)); - - current_input_column += flex_yyleng (); + m_input_line_number, m_current_input_column)); + + m_current_input_column += flex_yyleng (); return SUPERCLASSREF; } @@ -3036,16 +3038,16 @@ { token *tok = new token (LEXICAL_ERROR, "class and package names may not be keywords", - input_line_number, current_input_column); + m_input_line_number, m_current_input_column); push_token (tok); return count_token_internal (LEXICAL_ERROR); } - push_token (new token (METAQUERY, cls, input_line_number, - current_input_column)); - - current_input_column += flex_yyleng (); + push_token (new token (METAQUERY, cls, m_input_line_number, + m_current_input_column)); + + m_current_input_column += flex_yyleng (); return METAQUERY; } @@ -3060,17 +3062,17 @@ token *tok = new token (LEXICAL_ERROR, "function, method, class, and package names may not be keywords", - input_line_number, current_input_column); + m_input_line_number, m_current_input_column); push_token (tok); return count_token_internal (LEXICAL_ERROR); } - push_token (new token (FQ_IDENT, fq_id, input_line_number, - current_input_column)); - - current_input_column += flex_yyleng (); + push_token (new token (FQ_IDENT, fq_id, m_input_line_number, + m_current_input_column)); + + m_current_input_column += flex_yyleng (); return FQ_IDENT; } @@ -3088,32 +3090,32 @@ // keywords and other special names and return STRUCT_ELT, which is // a string that is also a valid identifier. - if (looking_at_indirect_ref) + if (m_looking_at_indirect_ref) { - push_token (new token (STRUCT_ELT, ident, input_line_number, - current_input_column)); - - looking_for_object_index = true; - - current_input_column += flex_yyleng (); + push_token (new token (STRUCT_ELT, ident, m_input_line_number, + m_current_input_column)); + + m_looking_for_object_index = true; + + m_current_input_column += flex_yyleng (); return STRUCT_ELT; } // If ident is a keyword token, then is_keyword_token will set - // at_beginning_of_statement. For example, if tok is an IF - // token, then at_beginning_of_statement will be false. + // m_at_beginning_of_statement. For example, if tok is an IF + // token, then m_at_beginning_of_statement will be false. int kw_token = is_keyword_token (ident); - if (looking_at_function_handle) + if (m_looking_at_function_handle) { if (kw_token) { token *tok = new token (LEXICAL_ERROR, "function handles may not refer to keywords", - input_line_number, current_input_column); + m_input_line_number, m_current_input_column); push_token (tok); @@ -3121,13 +3123,13 @@ } else { - push_token (new token (FCN_HANDLE, ident, input_line_number, - current_input_column)); - - current_input_column += flex_yyleng (); - looking_for_object_index = true; - - at_beginning_of_statement = false; + push_token (new token (FCN_HANDLE, ident, m_input_line_number, + m_current_input_column)); + + m_current_input_column += flex_yyleng (); + m_looking_for_object_index = true; + + m_at_beginning_of_statement = false; return FCN_HANDLE; } @@ -3140,22 +3142,22 @@ { if (kw_token >= 0) { - current_input_column += flex_yyleng (); - looking_for_object_index = false; + m_current_input_column += flex_yyleng (); + m_looking_for_object_index = false; } - // The call to is_keyword_token set at_beginning_of_statement. + // The call to is_keyword_token set m_at_beginning_of_statement. return kw_token; } // Find the token in the symbol table. - symbol_scope scope = symtab_context.curr_scope (); + symbol_scope scope = m_symtab_context.curr_scope (); symbol_record sr = (scope ? scope.insert (ident) : symbol_record (ident)); - token *tok = new token (NAME, sr, input_line_number, current_input_column); + token *tok = new token (NAME, sr, m_input_line_number, m_current_input_column); // The following symbols are handled specially so that things like // @@ -3164,7 +3166,7 @@ // are parsed as an addition expression instead of as a command-style // function call with the argument "+1". - if (at_beginning_of_statement + if (m_at_beginning_of_statement && (! (is_variable (ident, scope) || ident == "e" || ident == "pi" || ident == "I" || ident == "i" @@ -3175,14 +3177,14 @@ push_token (tok); - current_input_column += flex_yyleng (); + m_current_input_column += flex_yyleng (); // The magic end index can't be indexed. if (ident != "end") - looking_for_object_index = true; - - at_beginning_of_statement = false; + m_looking_for_object_index = true; + + m_at_beginning_of_statement = false; return NAME; } @@ -3190,37 +3192,37 @@ void base_lexer::maybe_warn_separator_insert (char sep) { - std::string nm = fcn_file_full_name; + std::string nm = m_fcn_file_full_name; if (nm.empty ()) warning_with_id ("Octave:separator-insert", "potential auto-insertion of '%c' near line %d", - sep, input_line_number); + sep, m_input_line_number); else warning_with_id ("Octave:separator-insert", "potential auto-insertion of '%c' near line %d of file %s", - sep, input_line_number, nm.c_str ()); + sep, m_input_line_number, nm.c_str ()); } void base_lexer::warn_single_quote_string (void) { - std::string nm = fcn_file_full_name; + std::string nm = m_fcn_file_full_name; if (nm.empty ()) warning_with_id ("Octave:single-quote-string", "single quote delimited string near line %d", - input_line_number); + m_input_line_number); else warning_with_id ("Octave:single-quote-string", "single quote delimited string near line %d of file %s", - input_line_number, nm.c_str ()); + m_input_line_number, nm.c_str ()); } void base_lexer::warn_language_extension (const std::string& msg) { - std::string nm = fcn_file_full_name; + std::string nm = m_fcn_file_full_name; if (nm.empty ()) warning_with_id ("Octave:language-extension", @@ -3229,7 +3231,7 @@ else warning_with_id ("Octave:language-extension", "Octave language extension used: %s near line %d offile %s", - msg.c_str (), input_line_number, nm.c_str ()); + msg.c_str (), m_input_line_number, nm.c_str ()); } void @@ -3258,15 +3260,15 @@ void base_lexer::push_token (token *tok) { - YYSTYPE *lval = yyget_lval (scanner); + YYSTYPE *lval = yyget_lval (m_scanner); lval->tok_val = tok; - tokens.push (tok); + m_tokens.push (tok); } token * base_lexer::current_token (void) { - YYSTYPE *lval = yyget_lval (scanner); + YYSTYPE *lval = yyget_lval (m_scanner); return lval->tok_val; } @@ -3553,11 +3555,11 @@ if (! compat) warn_language_extension_operator (flex_yytext ()); - push_token (new token (tok, input_line_number, current_input_column)); - - current_input_column += flex_yyleng (); - looking_for_object_index = false; - at_beginning_of_statement = bos; + push_token (new token (tok, m_input_line_number, m_current_input_column)); + + m_current_input_column += flex_yyleng (); + m_looking_for_object_index = false; + m_at_beginning_of_statement = bos; return count_token_internal (tok); } @@ -3565,8 +3567,8 @@ int base_lexer::handle_token (const std::string& name, int tok) { - token *tok_val = new token (tok, name, input_line_number, - current_input_column); + token *tok_val = new token (tok, name, m_input_line_number, + m_current_input_column); return handle_token (tok, tok_val); } @@ -3575,11 +3577,11 @@ base_lexer::handle_token (int tok, token *tok_val) { if (! tok_val) - tok_val = new token (tok, input_line_number, current_input_column); + tok_val = new token (tok, m_input_line_number, m_current_input_column); push_token (tok_val); - current_input_column += flex_yyleng (); + m_current_input_column += flex_yyleng (); return count_token_internal (tok); } @@ -3587,7 +3589,7 @@ int base_lexer::count_token (int tok) { - token *tok_val = new token (tok, input_line_number, current_input_column); + token *tok_val = new token (tok, m_input_line_number, m_current_input_column); push_token (tok_val); @@ -3600,7 +3602,7 @@ if (tok != '\n') { Vtoken_count++; - token_count++; + m_token_count++; } return show_token (tok); @@ -3633,12 +3635,12 @@ { int status = 0; - if (input_buf.empty ()) + if (m_input_buf.empty ()) { bool eof = false; - current_input_line = reader.get_input (eof); - - input_buf.fill (current_input_line, eof); + m_current_input_line = m_reader.get_input (eof); + + m_input_buf.fill (m_current_input_line, eof); // Attempt to capture text for functions defined on the // command line. @@ -3647,19 +3649,19 @@ // // See also comments in push_lexer::append_input. - if (buffer_function_text) + if (m_buffer_function_text) { - if (! current_input_line.empty ()) + if (! m_current_input_line.empty ()) { - function_text += current_input_line; - if (current_input_line.back () != '\n') - function_text += '\n'; + m_function_text += m_current_input_line; + if (m_current_input_line.back () != '\n') + m_function_text += '\n'; } } } - if (! input_buf.empty ()) - status = input_buf.copy_chunk (buf, max_size); + if (! m_input_buf.empty ()) + status = m_input_buf.copy_chunk (buf, max_size); else status = YY_NULL; @@ -3674,14 +3676,14 @@ // // Currently, base_lexer::is_keyword_token starts buffering text // for command-line functions by setting the initial value of - // function_text to current_input_line when function_kw is + // m_function_text to m_current_input_line when function_kw is // recognized. To make that work, we need to do something like // maintain a queue of input strings and pass them to the flex // buffer one line at a time, while also setting - // current_input_line. Some care will be needed if a single line + // m_current_input_line. Some care will be needed if a single line // of input arrives in multiple calls to append_input. - input_buf.fill (input, eof); + m_input_buf.fill (input, eof); } int @@ -3689,11 +3691,11 @@ { int status = 0; - if (input_buf.empty () && ! input_buf.at_eof ()) - input_buf.fill (std::string (1, static_cast<char> (1)), false); - - if (! input_buf.empty ()) - status = input_buf.copy_chunk (buf, max_size); + if (m_input_buf.empty () && ! m_input_buf.at_eof ()) + m_input_buf.fill (std::string (1, static_cast<char> (1)), false); + + if (! m_input_buf.empty ()) + status = m_input_buf.copy_chunk (buf, max_size); else status = YY_NULL;