comparison 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
comparison
equal deleted inserted replaced
24832:a16c810b77c8 24833:7c88cf242111
225 if (tok < 0) \ 225 if (tok < 0) \
226 { \ 226 { \
227 yyless (0); \ 227 yyless (0); \
228 curr_lexer->xunput (','); \ 228 curr_lexer->xunput (','); \
229 /* Adjust for comma that was not really in the input stream. */ \ 229 /* Adjust for comma that was not really in the input stream. */ \
230 curr_lexer->current_input_column--; \ 230 curr_lexer->m_current_input_column--; \
231 } \ 231 } \
232 else \ 232 else \
233 { \ 233 { \
234 return tok; \ 234 return tok; \
235 } \ 235 } \
245 // the current buffer. 245 // the current buffer.
246 #define HANDLE_STRING_CONTINUATION \ 246 #define HANDLE_STRING_CONTINUATION \
247 do \ 247 do \
248 { \ 248 { \
249 curr_lexer->decrement_promptflag (); \ 249 curr_lexer->decrement_promptflag (); \
250 curr_lexer->input_line_number++; \ 250 curr_lexer->m_input_line_number++; \
251 curr_lexer->current_input_column = 1; \ 251 curr_lexer->m_current_input_column = 1; \
252 \ 252 \
253 if (curr_lexer->is_push_lexer ()) \ 253 if (curr_lexer->is_push_lexer ()) \
254 { \ 254 { \
255 if (curr_lexer->at_end_of_buffer ()) \ 255 if (curr_lexer->at_end_of_buffer ()) \
256 return -1; \ 256 return -1; \
266 // candidate for a function call. 266 // candidate for a function call.
267 267
268 #define COMMAND_ARG_FINISH \ 268 #define COMMAND_ARG_FINISH \
269 do \ 269 do \
270 { \ 270 { \
271 if (curr_lexer->string_text.empty ()) \ 271 if (curr_lexer->m_string_text.empty ()) \
272 break; \ 272 break; \
273 \ 273 \
274 int retval = curr_lexer->handle_token (curr_lexer->string_text, \ 274 int retval = curr_lexer->handle_token (curr_lexer->m_string_text, \
275 SQ_STRING); \ 275 SQ_STRING); \
276 \ 276 \
277 curr_lexer->string_text = ""; \ 277 curr_lexer->m_string_text = ""; \
278 curr_lexer->command_arg_paren_count = 0; \ 278 curr_lexer->m_command_arg_paren_count = 0; \
279 \ 279 \
280 yyless (0); \ 280 yyless (0); \
281 \ 281 \
282 return retval; \ 282 return retval; \
283 } \ 283 } \
298 yyless (0); \ 298 yyless (0); \
299 unput (','); \ 299 unput (','); \
300 } \ 300 } \
301 else \ 301 else \
302 { \ 302 { \
303 if (! curr_lexer->looking_at_decl_list \ 303 if (! curr_lexer->m_looking_at_decl_list \
304 && curr_lexer->previous_token_may_be_command ()) \ 304 && curr_lexer->previous_token_may_be_command ()) \
305 { \ 305 { \
306 yyless (0); \ 306 yyless (0); \
307 curr_lexer->push_start_state (COMMAND_START); \ 307 curr_lexer->push_start_state (COMMAND_START); \
308 } \ 308 } \
309 else \ 309 else \
310 { \ 310 { \
311 if (get_set) \ 311 if (get_set) \
312 { \ 312 { \
313 yyless (3); \ 313 yyless (3); \
314 curr_lexer->maybe_classdef_get_set_method = false; \ 314 curr_lexer->m_maybe_classdef_get_set_method = false; \
315 } \ 315 } \
316 \ 316 \
317 int id_tok = curr_lexer->handle_identifier (); \ 317 int id_tok = curr_lexer->handle_identifier (); \
318 \ 318 \
319 if (id_tok >= 0) \ 319 if (id_tok >= 0) \
361 361
362 curr_lexer->xunput (yytext[0]); 362 curr_lexer->xunput (yytext[0]);
363 363
364 // May be reset later if we see "function" or "classdef" appears 364 // May be reset later if we see "function" or "classdef" appears
365 // as the first token. 365 // as the first token.
366 curr_lexer->reading_script_file = true; 366 curr_lexer->m_reading_script_file = true;
367 367
368 curr_lexer->pop_start_state (); 368 curr_lexer->pop_start_state ();
369 369
370 return curr_lexer->show_token (INPUT_FILE); 370 return curr_lexer->show_token (INPUT_FILE);
371 } 371 }
373 <INPUT_FILE_START><<EOF>> { 373 <INPUT_FILE_START><<EOF>> {
374 curr_lexer->lexer_debug ("<INPUT_FILE_START><<EOF>>"); 374 curr_lexer->lexer_debug ("<INPUT_FILE_START><<EOF>>");
375 375
376 // May be reset later if we see "function" or "classdef" appears 376 // May be reset later if we see "function" or "classdef" appears
377 // as the first token. 377 // as the first token.
378 curr_lexer->reading_script_file = true; 378 curr_lexer->m_reading_script_file = true;
379 379
380 curr_lexer->pop_start_state (); 380 curr_lexer->pop_start_state ();
381 381
382 return curr_lexer->show_token (INPUT_FILE); 382 return curr_lexer->show_token (INPUT_FILE);
383 } 383 }
394 <COMMAND_START>(\.\.\.){ANY_EXCEPT_NL}*{NL} { 394 <COMMAND_START>(\.\.\.){ANY_EXCEPT_NL}*{NL} {
395 curr_lexer->lexer_debug ("<COMMAND_START>(\\.\\.\\.){ANY_EXCEPT_NL}*{NL}"); 395 curr_lexer->lexer_debug ("<COMMAND_START>(\\.\\.\\.){ANY_EXCEPT_NL}*{NL}");
396 396
397 COMMAND_ARG_FINISH; 397 COMMAND_ARG_FINISH;
398 398
399 curr_lexer->input_line_number++; 399 curr_lexer->m_input_line_number++;
400 curr_lexer->current_input_column = 1; 400 curr_lexer->m_current_input_column = 1;
401 401
402 HANDLE_STRING_CONTINUATION; 402 HANDLE_STRING_CONTINUATION;
403 } 403 }
404 404
405 %{ 405 %{
409 <COMMAND_START>({CCHAR}{ANY_EXCEPT_NL}*)?{NL} { 409 <COMMAND_START>({CCHAR}{ANY_EXCEPT_NL}*)?{NL} {
410 curr_lexer->lexer_debug ("<COMMAND_START>({CCHAR}{ANY_EXCEPT_NL}*)?{NL}"); 410 curr_lexer->lexer_debug ("<COMMAND_START>({CCHAR}{ANY_EXCEPT_NL}*)?{NL}");
411 411
412 COMMAND_ARG_FINISH; 412 COMMAND_ARG_FINISH;
413 413
414 curr_lexer->input_line_number++; 414 curr_lexer->m_input_line_number++;
415 curr_lexer->current_input_column = 1; 415 curr_lexer->m_current_input_column = 1;
416 curr_lexer->looking_for_object_index = false; 416 curr_lexer->m_looking_for_object_index = false;
417 curr_lexer->at_beginning_of_statement = true; 417 curr_lexer->m_at_beginning_of_statement = true;
418 curr_lexer->pop_start_state (); 418 curr_lexer->pop_start_state ();
419 419
420 return curr_lexer->handle_token ('\n'); 420 return curr_lexer->handle_token ('\n');
421 } 421 }
422 422
423 <COMMAND_START>[\,\;] { 423 <COMMAND_START>[\,\;] {
424 curr_lexer->lexer_debug ("<COMMAND_START>[\\,\\;]"); 424 curr_lexer->lexer_debug ("<COMMAND_START>[\\,\\;]");
425 425
426 if (yytext[0] != ',' || curr_lexer->command_arg_paren_count == 0) 426 if (yytext[0] != ',' || curr_lexer->m_command_arg_paren_count == 0)
427 { 427 {
428 COMMAND_ARG_FINISH; 428 COMMAND_ARG_FINISH;
429 curr_lexer->looking_for_object_index = false; 429 curr_lexer->m_looking_for_object_index = false;
430 curr_lexer->at_beginning_of_statement = true; 430 curr_lexer->m_at_beginning_of_statement = true;
431 curr_lexer->pop_start_state (); 431 curr_lexer->pop_start_state ();
432 return curr_lexer->handle_token (yytext[0]); 432 return curr_lexer->handle_token (yytext[0]);
433 } 433 }
434 else 434 else
435 curr_lexer->string_text += yytext; 435 curr_lexer->m_string_text += yytext;
436 436
437 curr_lexer->current_input_column += yyleng; 437 curr_lexer->m_current_input_column += yyleng;
438 } 438 }
439 439
440 %{ 440 %{
441 // Unbalanced parentheses serve as pseudo-quotes: they are included in 441 // Unbalanced parentheses serve as pseudo-quotes: they are included in
442 // the final argument string, but they cause parentheses and quotes to 442 // the final argument string, but they cause parentheses and quotes to
444 %} 444 %}
445 445
446 <COMMAND_START>[\(\[\{]* { 446 <COMMAND_START>[\(\[\{]* {
447 curr_lexer->lexer_debug ("<COMMAND_START>[\\(\\[\\{]+"); 447 curr_lexer->lexer_debug ("<COMMAND_START>[\\(\\[\\{]+");
448 448
449 curr_lexer->command_arg_paren_count += yyleng; 449 curr_lexer->m_command_arg_paren_count += yyleng;
450 curr_lexer->string_text += yytext; 450 curr_lexer->m_string_text += yytext;
451 curr_lexer->current_input_column += yyleng; 451 curr_lexer->m_current_input_column += yyleng;
452 } 452 }
453 453
454 <COMMAND_START>[\)\]\}]* { 454 <COMMAND_START>[\)\]\}]* {
455 curr_lexer->lexer_debug ("<COMMAND_START>[\\)\\]\\}]+"); 455 curr_lexer->lexer_debug ("<COMMAND_START>[\\)\\]\\}]+");
456 456
457 curr_lexer->command_arg_paren_count -= yyleng; 457 curr_lexer->m_command_arg_paren_count -= yyleng;
458 curr_lexer->string_text += yytext; 458 curr_lexer->m_string_text += yytext;
459 curr_lexer->current_input_column += yyleng; 459 curr_lexer->m_current_input_column += yyleng;
460 } 460 }
461 461
462 %{ 462 %{
463 // Handle quoted strings. Quoted strings that are not separated by 463 // Handle quoted strings. Quoted strings that are not separated by
464 // whitespace from other argument text are combined with that previous 464 // whitespace from other argument text are combined with that previous
472 %} 472 %}
473 473
474 <COMMAND_START>[\"\'] { 474 <COMMAND_START>[\"\'] {
475 curr_lexer->lexer_debug ("<COMMAND_START>[\\\"\\']"); 475 curr_lexer->lexer_debug ("<COMMAND_START>[\\\"\\']");
476 476
477 if (curr_lexer->command_arg_paren_count == 0) 477 if (curr_lexer->m_command_arg_paren_count == 0)
478 curr_lexer->begin_string (yytext[0] == '"' 478 curr_lexer->begin_string (yytext[0] == '"'
479 ? DQ_STRING_START : SQ_STRING_START); 479 ? DQ_STRING_START : SQ_STRING_START);
480 else 480 else
481 curr_lexer->string_text += yytext; 481 curr_lexer->m_string_text += yytext;
482 482
483 curr_lexer->current_input_column += yyleng; 483 curr_lexer->m_current_input_column += yyleng;
484 } 484 }
485 485
486 %{ 486 %{
487 // In standard command argument processing, whitespace separates 487 // In standard command argument processing, whitespace separates
488 // arguments. In the presence of unbalanced parentheses, it is 488 // arguments. In the presence of unbalanced parentheses, it is
490 %} 490 %}
491 491
492 <COMMAND_START>{S}* { 492 <COMMAND_START>{S}* {
493 curr_lexer->lexer_debug ("<COMMAND_START>{S}*"); 493 curr_lexer->lexer_debug ("<COMMAND_START>{S}*");
494 494
495 if (curr_lexer->command_arg_paren_count == 0) 495 if (curr_lexer->m_command_arg_paren_count == 0)
496 COMMAND_ARG_FINISH; 496 COMMAND_ARG_FINISH;
497 else 497 else
498 curr_lexer->string_text += yytext; 498 curr_lexer->m_string_text += yytext;
499 499
500 curr_lexer->current_input_column += yyleng; 500 curr_lexer->m_current_input_column += yyleng;
501 } 501 }
502 502
503 %{ 503 %{
504 // Everything else is slurped into the command arguments. 504 // Everything else is slurped into the command arguments.
505 %} 505 %}
506 506
507 <COMMAND_START>([\.]|[^#% \t\r\n\.\,\;\"\'\(\[\{\}\]\)]*) { 507 <COMMAND_START>([\.]|[^#% \t\r\n\.\,\;\"\'\(\[\{\}\]\)]*) {
508 curr_lexer->lexer_debug ("<COMMAND_START>([\\.]|[^#% \\t\\r\\n\\.\\,\\;\\\"\\'\\(\\[\\{\\}\\]\\)]*"); 508 curr_lexer->lexer_debug ("<COMMAND_START>([\\.]|[^#% \\t\\r\\n\\.\\,\\;\\\"\\'\\(\\[\\{\\}\\]\\)]*");
509 509
510 curr_lexer->string_text += yytext; 510 curr_lexer->m_string_text += yytext;
511 curr_lexer->current_input_column += yyleng; 511 curr_lexer->m_current_input_column += yyleng;
512 } 512 }
513 513
514 <MATRIX_START>{S}* { 514 <MATRIX_START>{S}* {
515 curr_lexer->lexer_debug ("<MATRIX_START>{S}*"); 515 curr_lexer->lexer_debug ("<MATRIX_START>{S}*");
516 516
518 } 518 }
519 519
520 <MATRIX_START>{NL} { 520 <MATRIX_START>{NL} {
521 curr_lexer->lexer_debug ("<MATRIX_START>{NL}"); 521 curr_lexer->lexer_debug ("<MATRIX_START>{NL}");
522 522
523 curr_lexer->input_line_number++; 523 curr_lexer->m_input_line_number++;
524 curr_lexer->current_input_column = 1; 524 curr_lexer->m_current_input_column = 1;
525 525
526 if (curr_lexer->nesting_level.is_paren ()) 526 if (curr_lexer->m_nesting_level.is_paren ())
527 curr_lexer->warn_language_extension ("bare newline inside parentheses"); 527 curr_lexer->warn_language_extension ("bare newline inside parentheses");
528 else 528 else
529 { 529 {
530 int tok = curr_lexer->previous_token_value (); 530 int tok = curr_lexer->previous_token_value ();
531 531
532 if (! (tok == ';' || tok == '[' || tok == '{')) 532 if (! (tok == ';' || tok == '[' || tok == '{'))
533 { 533 {
534 curr_lexer->xunput (';'); 534 curr_lexer->xunput (';');
535 // Adjust for semicolon that was not really in the input stream. 535 // Adjust for semicolon that was not really in the input stream.
536 curr_lexer->current_input_column--; 536 curr_lexer->m_current_input_column--;
537 } 537 }
538 } 538 }
539 } 539 }
540 540
541 %{ 541 %{
553 %} 553 %}
554 554
555 <MATRIX_START>\] { 555 <MATRIX_START>\] {
556 curr_lexer->lexer_debug ("<MATRIX_START>\\]"); 556 curr_lexer->lexer_debug ("<MATRIX_START>\\]");
557 557
558 curr_lexer->looking_at_object_index.pop_front (); 558 curr_lexer->m_looking_at_object_index.pop_front ();
559 559
560 curr_lexer->looking_for_object_index = true; 560 curr_lexer->m_looking_for_object_index = true;
561 curr_lexer->at_beginning_of_statement = false; 561 curr_lexer->m_at_beginning_of_statement = false;
562 562
563 curr_lexer->handle_close_bracket (']'); 563 curr_lexer->handle_close_bracket (']');
564 564
565 return curr_lexer->count_token (']'); 565 return curr_lexer->count_token (']');
566 } 566 }
570 %} 570 %}
571 571
572 <MATRIX_START>\} { 572 <MATRIX_START>\} {
573 curr_lexer->lexer_debug ("<MATRIX_START>\\}*"); 573 curr_lexer->lexer_debug ("<MATRIX_START>\\}*");
574 574
575 curr_lexer->looking_at_object_index.pop_front (); 575 curr_lexer->m_looking_at_object_index.pop_front ();
576 576
577 curr_lexer->looking_for_object_index = true; 577 curr_lexer->m_looking_for_object_index = true;
578 curr_lexer->at_beginning_of_statement = false; 578 curr_lexer->m_at_beginning_of_statement = false;
579 579
580 curr_lexer->handle_close_bracket ('}'); 580 curr_lexer->handle_close_bracket ('}');
581 581
582 return curr_lexer->count_token ('}'); 582 return curr_lexer->count_token ('}');
583 } 583 }
600 if (unput_comma) 600 if (unput_comma)
601 { 601 {
602 yyless (0); 602 yyless (0);
603 curr_lexer->xunput (','); 603 curr_lexer->xunput (',');
604 // Adjust for comma that was not really in the input stream. 604 // Adjust for comma that was not really in the input stream.
605 curr_lexer->current_input_column--; 605 curr_lexer->m_current_input_column--;
606 } 606 }
607 else 607 else
608 { 608 {
609 curr_lexer->nesting_level.bracket (); 609 curr_lexer->m_nesting_level.bracket ();
610 610
611 curr_lexer->looking_at_object_index.push_front (false); 611 curr_lexer->m_looking_at_object_index.push_front (false);
612 612
613 curr_lexer->current_input_column += yyleng; 613 curr_lexer->m_current_input_column += yyleng;
614 curr_lexer->looking_for_object_index = false; 614 curr_lexer->m_looking_for_object_index = false;
615 curr_lexer->at_beginning_of_statement = false; 615 curr_lexer->m_at_beginning_of_statement = false;
616 616
617 if (curr_lexer->defining_func 617 if (curr_lexer->m_defining_func
618 && ! curr_lexer->parsed_function_name.top ()) 618 && ! curr_lexer->m_parsed_function_name.top ())
619 curr_lexer->looking_at_return_list = true; 619 curr_lexer->m_looking_at_return_list = true;
620 else 620 else
621 curr_lexer->looking_at_matrix_or_assign_lhs = true; 621 curr_lexer->m_looking_at_matrix_or_assign_lhs = true;
622 622
623 curr_lexer->decrement_promptflag (); 623 curr_lexer->decrement_promptflag ();
624 624
625 curr_lexer->bracketflag++; 625 curr_lexer->m_bracketflag++;
626 626
627 curr_lexer->push_start_state (MATRIX_START); 627 curr_lexer->push_start_state (MATRIX_START);
628 628
629 return curr_lexer->count_token ('['); 629 return curr_lexer->count_token ('[');
630 } 630 }
631 } 631 }
632 632
633 \] { 633 \] {
634 curr_lexer->lexer_debug ("\\]"); 634 curr_lexer->lexer_debug ("\\]");
635 635
636 curr_lexer->nesting_level.remove (); 636 curr_lexer->m_nesting_level.remove ();
637 637
638 curr_lexer->looking_at_object_index.pop_front (); 638 curr_lexer->m_looking_at_object_index.pop_front ();
639 639
640 curr_lexer->looking_for_object_index = true; 640 curr_lexer->m_looking_for_object_index = true;
641 curr_lexer->at_beginning_of_statement = false; 641 curr_lexer->m_at_beginning_of_statement = false;
642 642
643 return curr_lexer->handle_token (']'); 643 return curr_lexer->handle_token (']');
644 } 644 }
645 645
646 %{ 646 %{
658 658
659 yyless (0); 659 yyless (0);
660 660
661 if (curr_lexer->start_state () == LINE_COMMENT_START) 661 if (curr_lexer->start_state () == LINE_COMMENT_START)
662 { 662 {
663 if (! curr_lexer->comment_text.empty ()) 663 if (! curr_lexer->m_comment_text.empty ())
664 curr_lexer->finish_comment (octave::comment_elt::full_line); 664 curr_lexer->finish_comment (octave::comment_elt::full_line);
665 665
666 curr_lexer->pop_start_state (); 666 curr_lexer->pop_start_state ();
667 } 667 }
668 668
673 } 673 }
674 674
675 <BLOCK_COMMENT_START>^{S}*{CCHAR}\{{S}*{NL} { 675 <BLOCK_COMMENT_START>^{S}*{CCHAR}\{{S}*{NL} {
676 curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>^{S}*{CCHAR}\\{{S}*{NL}"); 676 curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>^{S}*{CCHAR}\\{{S}*{NL}");
677 677
678 curr_lexer->input_line_number++; 678 curr_lexer->m_input_line_number++;
679 curr_lexer->current_input_column = 1; 679 curr_lexer->m_current_input_column = 1;
680 680
681 if (curr_lexer->block_comment_nesting_level) 681 if (curr_lexer->m_block_comment_nesting_level)
682 curr_lexer->comment_text = "\n"; 682 curr_lexer->m_comment_text = "\n";
683 683
684 curr_lexer->block_comment_nesting_level++; 684 curr_lexer->m_block_comment_nesting_level++;
685 } 685 }
686 686
687 %{ 687 %{
688 // End of a block comment. If this block comment is nested inside 688 // End of a block comment. If this block comment is nested inside
689 // another, wait for the outermost block comment block to be closed 689 // another, wait for the outermost block comment block to be closed
691 %} 691 %}
692 692
693 <BLOCK_COMMENT_START>^{S}*{CCHAR}\}{S}*{NL} { 693 <BLOCK_COMMENT_START>^{S}*{CCHAR}\}{S}*{NL} {
694 curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>^{S}*{CCHAR}\\}{S}*{NL}"); 694 curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>^{S}*{CCHAR}\\}{S}*{NL}");
695 695
696 curr_lexer->input_line_number++; 696 curr_lexer->m_input_line_number++;
697 curr_lexer->current_input_column = 1; 697 curr_lexer->m_current_input_column = 1;
698 698
699 if (curr_lexer->block_comment_nesting_level > 1) 699 if (curr_lexer->m_block_comment_nesting_level > 1)
700 curr_lexer->comment_text = "\n"; 700 curr_lexer->m_comment_text = "\n";
701 else 701 else
702 curr_lexer->finish_comment (octave::comment_elt::block); 702 curr_lexer->finish_comment (octave::comment_elt::block);
703 703
704 curr_lexer->block_comment_nesting_level--; 704 curr_lexer->m_block_comment_nesting_level--;
705 705
706 if (curr_lexer->block_comment_nesting_level == 0) 706 if (curr_lexer->m_block_comment_nesting_level == 0)
707 { 707 {
708 curr_lexer->increment_promptflag (); 708 curr_lexer->increment_promptflag ();
709 709
710 curr_lexer->pop_start_state (); 710 curr_lexer->pop_start_state ();
711 } 711 }
716 %} 716 %}
717 717
718 <BLOCK_COMMENT_START>{ANY_EXCEPT_NL}*{NL} { 718 <BLOCK_COMMENT_START>{ANY_EXCEPT_NL}*{NL} {
719 curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>{ANY_EXCEPT_NL}*{NL}"); 719 curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>{ANY_EXCEPT_NL}*{NL}");
720 720
721 curr_lexer->input_line_number++; 721 curr_lexer->m_input_line_number++;
722 curr_lexer->current_input_column = 1; 722 curr_lexer->m_current_input_column = 1;
723 curr_lexer->comment_text += yytext; 723 curr_lexer->m_comment_text += yytext;
724 } 724 }
725 725
726 %{ 726 %{
727 // Full-line or end-of-line comment. 727 // Full-line or end-of-line comment.
728 %} 728 %}
735 } 735 }
736 736
737 <LINE_COMMENT_START>{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL} { 737 <LINE_COMMENT_START>{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL} {
738 curr_lexer->lexer_debug ("<LINE_COMMENT_START>{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}"); 738 curr_lexer->lexer_debug ("<LINE_COMMENT_START>{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}");
739 739
740 bool full_line_comment = curr_lexer->current_input_column == 1; 740 bool full_line_comment = curr_lexer->m_current_input_column == 1;
741 curr_lexer->input_line_number++; 741 curr_lexer->m_input_line_number++;
742 curr_lexer->current_input_column = 1; 742 curr_lexer->m_current_input_column = 1;
743 743
744 bool have_space = false; 744 bool have_space = false;
745 size_t len = yyleng; 745 size_t len = yyleng;
746 size_t i = 0; 746 size_t i = 0;
747 while (i < len) 747 while (i < len)
768 } 768 }
769 else 769 else
770 break; 770 break;
771 } 771 }
772 772
773 curr_lexer->comment_text += &yytext[i]; 773 curr_lexer->m_comment_text += &yytext[i];
774 774
775 if (full_line_comment) 775 if (full_line_comment)
776 { 776 {
777 if (num_comment_chars == 1 && yytext[i++] == '{') 777 if (num_comment_chars == 1 && yytext[i++] == '{')
778 { 778 {
806 curr_lexer->finish_comment (octave::comment_elt::end_of_line); 806 curr_lexer->finish_comment (octave::comment_elt::end_of_line);
807 807
808 curr_lexer->pop_start_state (); 808 curr_lexer->pop_start_state ();
809 809
810 curr_lexer->xunput ('\n'); 810 curr_lexer->xunput ('\n');
811 curr_lexer->input_line_number--; 811 curr_lexer->m_input_line_number--;
812 } 812 }
813 } 813 }
814 814
815 %{ 815 %{
816 // End of a block of full-line comments. 816 // End of a block of full-line comments.
843 %} 843 %}
844 844
845 <DQ_STRING_START>\"\" { 845 <DQ_STRING_START>\"\" {
846 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\"\\\""); 846 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\"\\\"");
847 847
848 curr_lexer->current_input_column += yyleng; 848 curr_lexer->m_current_input_column += yyleng;
849 curr_lexer->string_text += '"'; 849 curr_lexer->m_string_text += '"';
850 } 850 }
851 851
852 <DQ_STRING_START>\" { 852 <DQ_STRING_START>\" {
853 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\""); 853 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\"");
854 854
855 curr_lexer->current_input_column++; 855 curr_lexer->m_current_input_column++;
856 856
857 curr_lexer->pop_start_state (); 857 curr_lexer->pop_start_state ();
858 858
859 if (curr_lexer->start_state() != COMMAND_START) 859 if (curr_lexer->start_state() != COMMAND_START)
860 { 860 {
861 curr_lexer->looking_for_object_index = true; 861 curr_lexer->m_looking_for_object_index = true;
862 curr_lexer->at_beginning_of_statement = false; 862 curr_lexer->m_at_beginning_of_statement = false;
863 863
864 curr_lexer->push_token (new octave::token (DQ_STRING, 864 curr_lexer->push_token (new octave::token (DQ_STRING,
865 curr_lexer->string_text, 865 curr_lexer->m_string_text,
866 curr_lexer->string_line, 866 curr_lexer->m_string_line,
867 curr_lexer->string_column)); 867 curr_lexer->m_string_column));
868 868
869 curr_lexer->string_text = ""; 869 curr_lexer->m_string_text = "";
870 870
871 return curr_lexer->count_token_internal (DQ_STRING); 871 return curr_lexer->count_token_internal (DQ_STRING);
872 } 872 }
873 } 873 }
874 874
875 <DQ_STRING_START>\\[0-7]{1,3} { 875 <DQ_STRING_START>\\[0-7]{1,3} {
876 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\[0-7]{1,3}"); 876 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\[0-7]{1,3}");
877 877
878 curr_lexer->current_input_column += yyleng; 878 curr_lexer->m_current_input_column += yyleng;
879 879
880 int result; 880 int result;
881 sscanf (yytext+1, "%o", &result); 881 sscanf (yytext+1, "%o", &result);
882 882
883 if (result > 0xff) 883 if (result > 0xff)
884 { 884 {
885 octave::token *tok 885 octave::token *tok
886 = new octave::token (LEXICAL_ERROR, 886 = new octave::token (LEXICAL_ERROR,
887 "invalid octal escape sequence in character string", 887 "invalid octal escape sequence in character string",
888 curr_lexer->input_line_number, 888 curr_lexer->m_input_line_number,
889 curr_lexer->current_input_column); 889 curr_lexer->m_current_input_column);
890 890
891 curr_lexer->push_token (tok); 891 curr_lexer->push_token (tok);
892 892
893 return curr_lexer->count_token_internal (LEXICAL_ERROR); 893 return curr_lexer->count_token_internal (LEXICAL_ERROR);
894 } 894 }
895 else 895 else
896 curr_lexer->string_text += static_cast<unsigned char> (result); 896 curr_lexer->m_string_text += static_cast<unsigned char> (result);
897 } 897 }
898 898
899 <DQ_STRING_START>\\x[0-9a-fA-F]+ { 899 <DQ_STRING_START>\\x[0-9a-fA-F]+ {
900 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\x[0-9a-fA-F]+"); 900 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\x[0-9a-fA-F]+");
901 901
902 curr_lexer->current_input_column += yyleng; 902 curr_lexer->m_current_input_column += yyleng;
903 903
904 int result; 904 int result;
905 sscanf (yytext+2, "%x", &result); 905 sscanf (yytext+2, "%x", &result);
906 906
907 // Truncate the value silently instead of checking the range like 907 // Truncate the value silently instead of checking the range like
908 // we do for octal above. This is to match C/C++ where any number 908 // we do for octal above. This is to match C/C++ where any number
909 // of digits is allowed but the value is implementation-defined if 909 // of digits is allowed but the value is implementation-defined if
910 // it exceeds the range of the character type. 910 // it exceeds the range of the character type.
911 curr_lexer->string_text += static_cast<unsigned char> (result); 911 curr_lexer->m_string_text += static_cast<unsigned char> (result);
912 } 912 }
913 913
914 <DQ_STRING_START>"\\a" { 914 <DQ_STRING_START>"\\a" {
915 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\a\""); 915 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\a\"");
916 916
917 curr_lexer->current_input_column += yyleng; 917 curr_lexer->m_current_input_column += yyleng;
918 curr_lexer->string_text += '\a'; 918 curr_lexer->m_string_text += '\a';
919 } 919 }
920 920
921 <DQ_STRING_START>"\\b" { 921 <DQ_STRING_START>"\\b" {
922 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\b\""); 922 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\b\"");
923 923
924 curr_lexer->current_input_column += yyleng; 924 curr_lexer->m_current_input_column += yyleng;
925 curr_lexer->string_text += '\b'; 925 curr_lexer->m_string_text += '\b';
926 } 926 }
927 927
928 <DQ_STRING_START>"\\f" { 928 <DQ_STRING_START>"\\f" {
929 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\f\""); 929 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\f\"");
930 930
931 curr_lexer->current_input_column += yyleng; 931 curr_lexer->m_current_input_column += yyleng;
932 curr_lexer->string_text += '\f'; 932 curr_lexer->m_string_text += '\f';
933 } 933 }
934 934
935 <DQ_STRING_START>"\\n" { 935 <DQ_STRING_START>"\\n" {
936 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\n\""); 936 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\n\"");
937 937
938 curr_lexer->current_input_column += yyleng; 938 curr_lexer->m_current_input_column += yyleng;
939 curr_lexer->string_text += '\n'; 939 curr_lexer->m_string_text += '\n';
940 } 940 }
941 941
942 <DQ_STRING_START>"\\r" { 942 <DQ_STRING_START>"\\r" {
943 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\r\""); 943 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\r\"");
944 944
945 curr_lexer->current_input_column += yyleng; 945 curr_lexer->m_current_input_column += yyleng;
946 curr_lexer->string_text += '\r'; 946 curr_lexer->m_string_text += '\r';
947 } 947 }
948 948
949 <DQ_STRING_START>"\\t" { 949 <DQ_STRING_START>"\\t" {
950 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\t\""); 950 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\t\"");
951 951
952 curr_lexer->current_input_column += yyleng; 952 curr_lexer->m_current_input_column += yyleng;
953 curr_lexer->string_text += '\t'; 953 curr_lexer->m_string_text += '\t';
954 } 954 }
955 955
956 <DQ_STRING_START>"\\v" { 956 <DQ_STRING_START>"\\v" {
957 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\v\""); 957 curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\v\"");
958 958
959 curr_lexer->current_input_column += yyleng; 959 curr_lexer->m_current_input_column += yyleng;
960 curr_lexer->string_text += '\v'; 960 curr_lexer->m_string_text += '\v';
961 } 961 }
962 962
963 <DQ_STRING_START>(\.\.\.){S}*{NL} { 963 <DQ_STRING_START>(\.\.\.){S}*{NL} {
964 curr_lexer->lexer_debug ("<DQ_STRING_START>(\\.\\.\\.){S}*{NL}"); 964 curr_lexer->lexer_debug ("<DQ_STRING_START>(\\.\\.\\.){S}*{NL}");
965 965
966 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"; 966 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";
967 967
968 std::string nm = curr_lexer->fcn_file_full_name; 968 std::string nm = curr_lexer->m_fcn_file_full_name;
969 969
970 if (nm.empty ()) 970 if (nm.empty ())
971 warning_with_id ("Octave:deprecated-syntax", "%s", msg); 971 warning_with_id ("Octave:deprecated-syntax", "%s", msg);
972 else 972 else
973 warning_with_id ("Octave:deprecated-syntax", 973 warning_with_id ("Octave:deprecated-syntax",
974 "%s; near line %d of file '%s'", msg, 974 "%s; near line %d of file '%s'", msg,
975 curr_lexer->input_line_number, nm.c_str ()); 975 curr_lexer->m_input_line_number, nm.c_str ());
976 976
977 HANDLE_STRING_CONTINUATION; 977 HANDLE_STRING_CONTINUATION;
978 } 978 }
979 979
980 <DQ_STRING_START>\\{S}+{NL} { 980 <DQ_STRING_START>\\{S}+{NL} {
981 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\{S}+{NL}"); 981 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\{S}+{NL}");
982 982
983 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"; 983 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";
984 984
985 std::string nm = curr_lexer->fcn_file_full_name; 985 std::string nm = curr_lexer->m_fcn_file_full_name;
986 986
987 if (nm.empty ()) 987 if (nm.empty ())
988 warning_with_id ("Octave:deprecated-syntax", "%s", msg); 988 warning_with_id ("Octave:deprecated-syntax", "%s", msg);
989 else 989 else
990 warning_with_id ("Octave:deprecated-syntax", 990 warning_with_id ("Octave:deprecated-syntax",
991 "%s; near line %d of file '%s'", msg, 991 "%s; near line %d of file '%s'", msg,
992 curr_lexer->input_line_number, nm.c_str ()); 992 curr_lexer->m_input_line_number, nm.c_str ());
993 993
994 HANDLE_STRING_CONTINUATION; 994 HANDLE_STRING_CONTINUATION;
995 } 995 }
996 996
997 <DQ_STRING_START>\\{NL} { 997 <DQ_STRING_START>\\{NL} {
1001 } 1001 }
1002 1002
1003 <DQ_STRING_START>\\. { 1003 <DQ_STRING_START>\\. {
1004 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\."); 1004 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\.");
1005 1005
1006 curr_lexer->current_input_column += yyleng; 1006 curr_lexer->m_current_input_column += yyleng;
1007 curr_lexer->string_text += yytext[1]; 1007 curr_lexer->m_string_text += yytext[1];
1008 } 1008 }
1009 1009
1010 <DQ_STRING_START>\. { 1010 <DQ_STRING_START>\. {
1011 curr_lexer->lexer_debug ("<DQ_STRING_START>\\."); 1011 curr_lexer->lexer_debug ("<DQ_STRING_START>\\.");
1012 1012
1013 curr_lexer->current_input_column++; 1013 curr_lexer->m_current_input_column++;
1014 curr_lexer->string_text += yytext[0]; 1014 curr_lexer->m_string_text += yytext[0];
1015 } 1015 }
1016 1016
1017 <DQ_STRING_START>[^\.\\\r\n\"]+ { 1017 <DQ_STRING_START>[^\.\\\r\n\"]+ {
1018 curr_lexer->lexer_debug ("<DQ_STRING_START>[^\\.\\\\\\r\\n\\\"]+"); 1018 curr_lexer->lexer_debug ("<DQ_STRING_START>[^\\.\\\\\\r\\n\\\"]+");
1019 1019
1020 curr_lexer->current_input_column += yyleng; 1020 curr_lexer->m_current_input_column += yyleng;
1021 curr_lexer->string_text += yytext; 1021 curr_lexer->m_string_text += yytext;
1022 } 1022 }
1023 1023
1024 <DQ_STRING_START>{NL} { 1024 <DQ_STRING_START>{NL} {
1025 curr_lexer->lexer_debug ("<DQ_STRING_START>{NL}"); 1025 curr_lexer->lexer_debug ("<DQ_STRING_START>{NL}");
1026 1026
1027 octave::token *tok 1027 octave::token *tok
1028 = new octave::token (LEXICAL_ERROR, 1028 = new octave::token (LEXICAL_ERROR,
1029 "unterminated character string constant", 1029 "unterminated character string constant",
1030 curr_lexer->input_line_number, 1030 curr_lexer->m_input_line_number,
1031 curr_lexer->current_input_column); 1031 curr_lexer->m_current_input_column);
1032 1032
1033 curr_lexer->push_token (tok); 1033 curr_lexer->push_token (tok);
1034 1034
1035 curr_lexer->input_line_number++; 1035 curr_lexer->m_input_line_number++;
1036 curr_lexer->current_input_column = 1; 1036 curr_lexer->m_current_input_column = 1;
1037 1037
1038 return curr_lexer->count_token_internal (LEXICAL_ERROR); 1038 return curr_lexer->count_token_internal (LEXICAL_ERROR);
1039 } 1039 }
1040 1040
1041 %{ 1041 %{
1043 %} 1043 %}
1044 1044
1045 <SQ_STRING_START>\'\' { 1045 <SQ_STRING_START>\'\' {
1046 curr_lexer->lexer_debug ("<SQ_STRING_START>\\'\\'"); 1046 curr_lexer->lexer_debug ("<SQ_STRING_START>\\'\\'");
1047 1047
1048 curr_lexer->current_input_column += yyleng; 1048 curr_lexer->m_current_input_column += yyleng;
1049 curr_lexer->string_text += '\''; 1049 curr_lexer->m_string_text += '\'';
1050 } 1050 }
1051 1051
1052 <SQ_STRING_START>\' { 1052 <SQ_STRING_START>\' {
1053 curr_lexer->lexer_debug ("<SQ_STRING_START>\\'"); 1053 curr_lexer->lexer_debug ("<SQ_STRING_START>\\'");
1054 1054
1055 curr_lexer->current_input_column++; 1055 curr_lexer->m_current_input_column++;
1056 1056
1057 curr_lexer->pop_start_state (); 1057 curr_lexer->pop_start_state ();
1058 1058
1059 if (curr_lexer->start_state() != COMMAND_START) 1059 if (curr_lexer->start_state() != COMMAND_START)
1060 { 1060 {
1061 curr_lexer->looking_for_object_index = true; 1061 curr_lexer->m_looking_for_object_index = true;
1062 curr_lexer->at_beginning_of_statement = false; 1062 curr_lexer->m_at_beginning_of_statement = false;
1063 1063
1064 curr_lexer->push_token (new octave::token (SQ_STRING, 1064 curr_lexer->push_token (new octave::token (SQ_STRING,
1065 curr_lexer->string_text, 1065 curr_lexer->m_string_text,
1066 curr_lexer->string_line, 1066 curr_lexer->m_string_line,
1067 curr_lexer->string_column)); 1067 curr_lexer->m_string_column));
1068 1068
1069 curr_lexer->string_text = ""; 1069 curr_lexer->m_string_text = "";
1070 1070
1071 return curr_lexer->count_token_internal (SQ_STRING); 1071 return curr_lexer->count_token_internal (SQ_STRING);
1072 } 1072 }
1073 } 1073 }
1074 1074
1075 <SQ_STRING_START>[^\'\n\r]+ { 1075 <SQ_STRING_START>[^\'\n\r]+ {
1076 curr_lexer->lexer_debug ("<SQ_STRING_START>[^\\'\\n\\r]+"); 1076 curr_lexer->lexer_debug ("<SQ_STRING_START>[^\\'\\n\\r]+");
1077 1077
1078 curr_lexer->current_input_column += yyleng; 1078 curr_lexer->m_current_input_column += yyleng;
1079 curr_lexer->string_text += yytext; 1079 curr_lexer->m_string_text += yytext;
1080 } 1080 }
1081 1081
1082 <SQ_STRING_START>{NL} { 1082 <SQ_STRING_START>{NL} {
1083 curr_lexer->lexer_debug ("<SQ_STRING_START>{NL}"); 1083 curr_lexer->lexer_debug ("<SQ_STRING_START>{NL}");
1084 1084
1085 octave::token *tok 1085 octave::token *tok
1086 = new octave::token (LEXICAL_ERROR, 1086 = new octave::token (LEXICAL_ERROR,
1087 "unterminated character string constant", 1087 "unterminated character string constant",
1088 curr_lexer->input_line_number, 1088 curr_lexer->m_input_line_number,
1089 curr_lexer->current_input_column); 1089 curr_lexer->m_current_input_column);
1090 1090
1091 curr_lexer->push_token (tok); 1091 curr_lexer->push_token (tok);
1092 1092
1093 curr_lexer->input_line_number++; 1093 curr_lexer->m_input_line_number++;
1094 curr_lexer->current_input_column = 1; 1094 curr_lexer->m_current_input_column = 1;
1095 1095
1096 return curr_lexer->count_token_internal (LEXICAL_ERROR); 1096 return curr_lexer->count_token_internal (LEXICAL_ERROR);
1097 } 1097 }
1098 1098
1099 %{ 1099 %{
1106 1106
1107 int id_tok = curr_lexer->handle_fq_identifier (); 1107 int id_tok = curr_lexer->handle_fq_identifier ();
1108 1108
1109 if (id_tok >= 0) 1109 if (id_tok >= 0)
1110 { 1110 {
1111 curr_lexer->looking_for_object_index = true; 1111 curr_lexer->m_looking_for_object_index = true;
1112 1112
1113 return curr_lexer->count_token_internal (id_tok); 1113 return curr_lexer->count_token_internal (id_tok);
1114 } 1114 }
1115 } 1115 }
1116 1116
1117 <FQ_IDENT_START>{S}+ { 1117 <FQ_IDENT_START>{S}+ {
1118 curr_lexer->current_input_column += yyleng; 1118 curr_lexer->m_current_input_column += yyleng;
1119 1119
1120 curr_lexer->mark_previous_token_trailing_space (); 1120 curr_lexer->mark_previous_token_trailing_space ();
1121 } 1121 }
1122 1122
1123 <FQ_IDENT_START>. { 1123 <FQ_IDENT_START>. {
1197 // Eat whitespace. Whitespace inside matrix constants is handled by 1197 // Eat whitespace. Whitespace inside matrix constants is handled by
1198 // the <MATRIX_START> start state code above. 1198 // the <MATRIX_START> start state code above.
1199 %} 1199 %}
1200 1200
1201 {S}+ { 1201 {S}+ {
1202 curr_lexer->current_input_column += yyleng; 1202 curr_lexer->m_current_input_column += yyleng;
1203 1203
1204 curr_lexer->mark_previous_token_trailing_space (); 1204 curr_lexer->mark_previous_token_trailing_space ();
1205 } 1205 }
1206 1206
1207 %{ 1207 %{
1222 \\{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL} { 1222 \\{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL} {
1223 curr_lexer->lexer_debug ("\\\\{S}*{NL}|\\\\{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}"); 1223 curr_lexer->lexer_debug ("\\\\{S}*{NL}|\\\\{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}");
1224 1224
1225 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"; 1225 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";
1226 1226
1227 std::string nm = curr_lexer->fcn_file_full_name; 1227 std::string nm = curr_lexer->m_fcn_file_full_name;
1228 1228
1229 if (nm.empty ()) 1229 if (nm.empty ())
1230 warning_with_id ("Octave:deprecated-syntax", "%s", msg); 1230 warning_with_id ("Octave:deprecated-syntax", "%s", msg);
1231 else 1231 else
1232 warning_with_id ("Octave:deprecated-syntax", 1232 warning_with_id ("Octave:deprecated-syntax",
1233 "%s; near line %d of file '%s'", msg, 1233 "%s; near line %d of file '%s'", msg,
1234 curr_lexer->input_line_number, nm.c_str ()); 1234 curr_lexer->m_input_line_number, nm.c_str ());
1235 1235
1236 curr_lexer->handle_continuation (); 1236 curr_lexer->handle_continuation ();
1237 } 1237 }
1238 1238
1239 %{ 1239 %{
1275 { 1275 {
1276 int id_tok = curr_lexer->handle_superclass_identifier (); 1276 int id_tok = curr_lexer->handle_superclass_identifier ();
1277 1277
1278 if (id_tok >= 0) 1278 if (id_tok >= 0)
1279 { 1279 {
1280 curr_lexer->looking_for_object_index = true; 1280 curr_lexer->m_looking_for_object_index = true;
1281 1281
1282 return curr_lexer->count_token_internal (id_tok); 1282 return curr_lexer->count_token_internal (id_tok);
1283 } 1283 }
1284 } 1284 }
1285 } 1285 }
1301 { 1301 {
1302 int id_tok = curr_lexer->handle_meta_identifier (); 1302 int id_tok = curr_lexer->handle_meta_identifier ();
1303 1303
1304 if (id_tok >= 0) 1304 if (id_tok >= 0)
1305 { 1305 {
1306 curr_lexer->looking_for_object_index = true; 1306 curr_lexer->m_looking_for_object_index = true;
1307 1307
1308 return curr_lexer->count_token_internal (id_tok); 1308 return curr_lexer->count_token_internal (id_tok);
1309 } 1309 }
1310 } 1310 }
1311 } 1311 }
1331 yyless (0); 1331 yyless (0);
1332 unput (','); 1332 unput (',');
1333 } 1333 }
1334 else 1334 else
1335 { 1335 {
1336 curr_lexer->current_input_column++; 1336 curr_lexer->m_current_input_column++;
1337 1337
1338 curr_lexer->looking_at_function_handle++; 1338 curr_lexer->m_looking_at_function_handle++;
1339 curr_lexer->looking_for_object_index = false; 1339 curr_lexer->m_looking_for_object_index = false;
1340 curr_lexer->at_beginning_of_statement = false; 1340 curr_lexer->m_at_beginning_of_statement = false;
1341 1341
1342 return curr_lexer->count_token ('@'); 1342 return curr_lexer->count_token ('@');
1343 } 1343 }
1344 } 1344 }
1345 } 1345 }
1351 %} 1351 %}
1352 1352
1353 {NL} { 1353 {NL} {
1354 curr_lexer->lexer_debug ("{NL}"); 1354 curr_lexer->lexer_debug ("{NL}");
1355 1355
1356 if (curr_lexer->nesting_level.is_paren ()) 1356 if (curr_lexer->m_nesting_level.is_paren ())
1357 { 1357 {
1358 curr_lexer->input_line_number++; 1358 curr_lexer->m_input_line_number++;
1359 curr_lexer->current_input_column = 1; 1359 curr_lexer->m_current_input_column = 1;
1360 1360
1361 curr_lexer->at_beginning_of_statement = false; 1361 curr_lexer->m_at_beginning_of_statement = false;
1362 curr_lexer->warn_language_extension 1362 curr_lexer->warn_language_extension
1363 ("bare newline inside parentheses"); 1363 ("bare newline inside parentheses");
1364 } 1364 }
1365 else if (curr_lexer->nesting_level.none () 1365 else if (curr_lexer->m_nesting_level.none ()
1366 || curr_lexer->nesting_level.is_anon_fcn_body ()) 1366 || curr_lexer->m_nesting_level.is_anon_fcn_body ())
1367 { 1367 {
1368 curr_lexer->input_line_number++; 1368 curr_lexer->m_input_line_number++;
1369 curr_lexer->current_input_column = 1; 1369 curr_lexer->m_current_input_column = 1;
1370 1370
1371 curr_lexer->at_beginning_of_statement = true; 1371 curr_lexer->m_at_beginning_of_statement = true;
1372 1372
1373 return curr_lexer->count_token ('\n'); 1373 return curr_lexer->count_token ('\n');
1374 } 1374 }
1375 else if (curr_lexer->nesting_level.is_bracket_or_brace ()) 1375 else if (curr_lexer->m_nesting_level.is_bracket_or_brace ())
1376 { 1376 {
1377 octave::token *tok 1377 octave::token *tok
1378 = new octave::token (LEXICAL_ERROR, 1378 = new octave::token (LEXICAL_ERROR,
1379 "unexpected internal lexer error", 1379 "unexpected internal lexer error",
1380 curr_lexer->input_line_number, 1380 curr_lexer->m_input_line_number,
1381 curr_lexer->current_input_column); 1381 curr_lexer->m_current_input_column);
1382 1382
1383 curr_lexer->push_token (tok); 1383 curr_lexer->push_token (tok);
1384 1384
1385 curr_lexer->input_line_number++; 1385 curr_lexer->m_input_line_number++;
1386 curr_lexer->current_input_column = 1; 1386 curr_lexer->m_current_input_column = 1;
1387 1387
1388 return curr_lexer->count_token_internal (LEXICAL_ERROR); 1388 return curr_lexer->count_token_internal (LEXICAL_ERROR);
1389 } 1389 }
1390 } 1390 }
1391 1391
1398 curr_lexer->lexer_debug ("'"); 1398 curr_lexer->lexer_debug ("'");
1399 1399
1400 if (curr_lexer->previous_token_may_be_command () 1400 if (curr_lexer->previous_token_may_be_command ()
1401 && curr_lexer->space_follows_previous_token ()) 1401 && curr_lexer->space_follows_previous_token ())
1402 { 1402 {
1403 curr_lexer->current_input_column++; 1403 curr_lexer->m_current_input_column++;
1404 curr_lexer->push_start_state (COMMAND_START); 1404 curr_lexer->push_start_state (COMMAND_START);
1405 curr_lexer->begin_string (SQ_STRING_START); 1405 curr_lexer->begin_string (SQ_STRING_START);
1406 } 1406 }
1407 else if (curr_lexer->at_beginning_of_statement) 1407 else if (curr_lexer->m_at_beginning_of_statement)
1408 { 1408 {
1409 curr_lexer->current_input_column++; 1409 curr_lexer->m_current_input_column++;
1410 curr_lexer->begin_string (SQ_STRING_START); 1410 curr_lexer->begin_string (SQ_STRING_START);
1411 } 1411 }
1412 else 1412 else
1413 { 1413 {
1414 int tok = curr_lexer->previous_token_value (); 1414 int tok = curr_lexer->previous_token_value ();
1418 if (curr_lexer->space_follows_previous_token ()) 1418 if (curr_lexer->space_follows_previous_token ())
1419 { 1419 {
1420 if (tok == '[' || tok == '{' 1420 if (tok == '[' || tok == '{'
1421 || curr_lexer->previous_token_is_binop ()) 1421 || curr_lexer->previous_token_is_binop ())
1422 { 1422 {
1423 curr_lexer->current_input_column++; 1423 curr_lexer->m_current_input_column++;
1424 curr_lexer->begin_string (SQ_STRING_START); 1424 curr_lexer->begin_string (SQ_STRING_START);
1425 } 1425 }
1426 else 1426 else
1427 { 1427 {
1428 yyless (0); 1428 yyless (0);
1429 curr_lexer->xunput (','); 1429 curr_lexer->xunput (',');
1430 // Adjust for comma that was not really in the input stream. 1430 // Adjust for comma that was not really in the input stream.
1431 curr_lexer->current_input_column--; 1431 curr_lexer->m_current_input_column--;
1432 } 1432 }
1433 } 1433 }
1434 else 1434 else
1435 { 1435 {
1436 if (tok == '[' || tok == '{' 1436 if (tok == '[' || tok == '{'
1437 || curr_lexer->previous_token_is_binop () 1437 || curr_lexer->previous_token_is_binop ()
1438 || curr_lexer->previous_token_is_keyword ()) 1438 || curr_lexer->previous_token_is_keyword ())
1439 { 1439 {
1440 curr_lexer->current_input_column++; 1440 curr_lexer->m_current_input_column++;
1441 curr_lexer->begin_string (SQ_STRING_START); 1441 curr_lexer->begin_string (SQ_STRING_START);
1442 } 1442 }
1443 else 1443 else
1444 return curr_lexer->count_token (HERMITIAN); 1444 return curr_lexer->count_token (HERMITIAN);
1445 } 1445 }
1448 { 1448 {
1449 if (! tok || tok == '[' || tok == '{' || tok == '(' 1449 if (! tok || tok == '[' || tok == '{' || tok == '('
1450 || curr_lexer->previous_token_is_binop () 1450 || curr_lexer->previous_token_is_binop ()
1451 || curr_lexer->previous_token_is_keyword ()) 1451 || curr_lexer->previous_token_is_keyword ())
1452 { 1452 {
1453 curr_lexer->current_input_column++; 1453 curr_lexer->m_current_input_column++;
1454 curr_lexer->begin_string (SQ_STRING_START); 1454 curr_lexer->begin_string (SQ_STRING_START);
1455 } 1455 }
1456 else 1456 else
1457 return curr_lexer->count_token (HERMITIAN); 1457 return curr_lexer->count_token (HERMITIAN);
1458 } 1458 }
1467 curr_lexer->lexer_debug ("\\\""); 1467 curr_lexer->lexer_debug ("\\\"");
1468 1468
1469 if (curr_lexer->previous_token_may_be_command () 1469 if (curr_lexer->previous_token_may_be_command ()
1470 && curr_lexer->space_follows_previous_token ()) 1470 && curr_lexer->space_follows_previous_token ())
1471 { 1471 {
1472 curr_lexer->current_input_column++; 1472 curr_lexer->m_current_input_column++;
1473 curr_lexer->push_start_state (COMMAND_START); 1473 curr_lexer->push_start_state (COMMAND_START);
1474 curr_lexer->begin_string (DQ_STRING_START); 1474 curr_lexer->begin_string (DQ_STRING_START);
1475 } 1475 }
1476 else 1476 else
1477 { 1477 {
1482 if (curr_lexer->space_follows_previous_token ()) 1482 if (curr_lexer->space_follows_previous_token ())
1483 { 1483 {
1484 if (tok == '[' || tok == '{' 1484 if (tok == '[' || tok == '{'
1485 || curr_lexer->previous_token_is_binop ()) 1485 || curr_lexer->previous_token_is_binop ())
1486 { 1486 {
1487 curr_lexer->current_input_column++; 1487 curr_lexer->m_current_input_column++;
1488 curr_lexer->begin_string (DQ_STRING_START); 1488 curr_lexer->begin_string (DQ_STRING_START);
1489 } 1489 }
1490 else 1490 else
1491 { 1491 {
1492 yyless (0); 1492 yyless (0);
1493 curr_lexer->xunput (','); 1493 curr_lexer->xunput (',');
1494 // Adjust for comma that was not really in the input stream. 1494 // Adjust for comma that was not really in the input stream.
1495 curr_lexer->current_input_column--; 1495 curr_lexer->m_current_input_column--;
1496 } 1496 }
1497 } 1497 }
1498 else 1498 else
1499 { 1499 {
1500 curr_lexer->current_input_column++; 1500 curr_lexer->m_current_input_column++;
1501 curr_lexer->begin_string (DQ_STRING_START); 1501 curr_lexer->begin_string (DQ_STRING_START);
1502 } 1502 }
1503 } 1503 }
1504 else 1504 else
1505 { 1505 {
1506 curr_lexer->current_input_column++; 1506 curr_lexer->m_current_input_column++;
1507 curr_lexer->begin_string (DQ_STRING_START); 1507 curr_lexer->begin_string (DQ_STRING_START);
1508 } 1508 }
1509 } 1509 }
1510 } 1510 }
1511 1511
1545 "||" { CMD_OR_OP ("||", EXPR_OR_OR, true); } 1545 "||" { CMD_OR_OP ("||", EXPR_OR_OR, true); }
1546 1546
1547 ";" { 1547 ";" {
1548 bool at_beginning_of_statement 1548 bool at_beginning_of_statement
1549 = (! (curr_lexer->whitespace_is_significant () 1549 = (! (curr_lexer->whitespace_is_significant ()
1550 || curr_lexer->looking_at_object_index.front ())); 1550 || curr_lexer->m_looking_at_object_index.front ()));
1551 1551
1552 return curr_lexer->handle_op (";", ';', at_beginning_of_statement); 1552 return curr_lexer->handle_op (";", ';', at_beginning_of_statement);
1553 } 1553 }
1554 1554
1555 "+" { CMD_OR_UNARY_OP ("+", '+', true); } 1555 "+" { CMD_OR_UNARY_OP ("+", '+', true); }
1559 "!" { CMD_OR_UNARY_OP ("!", EXPR_NOT, false); } 1559 "!" { CMD_OR_UNARY_OP ("!", EXPR_NOT, false); }
1560 1560
1561 "," { 1561 "," {
1562 bool at_beginning_of_statement 1562 bool at_beginning_of_statement
1563 = (! (curr_lexer->whitespace_is_significant () 1563 = (! (curr_lexer->whitespace_is_significant ()
1564 || curr_lexer->looking_at_object_index.front ())); 1564 || curr_lexer->m_looking_at_object_index.front ()));
1565 1565
1566 return curr_lexer->handle_op (",", ',', at_beginning_of_statement); 1566 return curr_lexer->handle_op (",", ',', at_beginning_of_statement);
1567 } 1567 }
1568 1568
1569 ".'" { 1569 ".'" {
1591 if (unput_comma) 1591 if (unput_comma)
1592 { 1592 {
1593 yyless (0); 1593 yyless (0);
1594 curr_lexer->xunput (','); 1594 curr_lexer->xunput (',');
1595 // Adjust for comma that was not really in the input stream. 1595 // Adjust for comma that was not really in the input stream.
1596 curr_lexer->current_input_column--; 1596 curr_lexer->m_current_input_column--;
1597 } 1597 }
1598 else 1598 else
1599 { 1599 {
1600 // If we are looking for an object index, then push TRUE for 1600 // If we are looking for an object index, then push TRUE for
1601 // looking_at_object_index. Otherwise, just push whatever state 1601 // m_looking_at_object_index. Otherwise, just push whatever state
1602 // is current (so that we can pop it off the stack when we find 1602 // is current (so that we can pop it off the stack when we find
1603 // the matching close paren). 1603 // the matching close paren).
1604 1604
1605 curr_lexer->looking_at_object_index.push_front 1605 curr_lexer->m_looking_at_object_index.push_front
1606 (curr_lexer->looking_for_object_index); 1606 (curr_lexer->m_looking_for_object_index);
1607 1607
1608 curr_lexer->looking_at_indirect_ref = false; 1608 curr_lexer->m_looking_at_indirect_ref = false;
1609 curr_lexer->looking_for_object_index = false; 1609 curr_lexer->m_looking_for_object_index = false;
1610 curr_lexer->at_beginning_of_statement = false; 1610 curr_lexer->m_at_beginning_of_statement = false;
1611 1611
1612 curr_lexer->nesting_level.paren (); 1612 curr_lexer->m_nesting_level.paren ();
1613 curr_lexer->decrement_promptflag (); 1613 curr_lexer->decrement_promptflag ();
1614 1614
1615 return curr_lexer->handle_token ('('); 1615 return curr_lexer->handle_token ('(');
1616 } 1616 }
1617 } 1617 }
1618 1618
1619 ")" { 1619 ")" {
1620 curr_lexer->lexer_debug (")"); 1620 curr_lexer->lexer_debug (")");
1621 1621
1622 curr_lexer->nesting_level.remove (); 1622 curr_lexer->m_nesting_level.remove ();
1623 curr_lexer->current_input_column++; 1623 curr_lexer->m_current_input_column++;
1624 1624
1625 curr_lexer->looking_at_object_index.pop_front (); 1625 curr_lexer->m_looking_at_object_index.pop_front ();
1626 1626
1627 curr_lexer->looking_for_object_index = true; 1627 curr_lexer->m_looking_for_object_index = true;
1628 curr_lexer->at_beginning_of_statement = false; 1628 curr_lexer->m_at_beginning_of_statement = false;
1629 1629
1630 if (curr_lexer->looking_at_anon_fcn_args) 1630 if (curr_lexer->m_looking_at_anon_fcn_args)
1631 { 1631 {
1632 curr_lexer->looking_at_anon_fcn_args = false; 1632 curr_lexer->m_looking_at_anon_fcn_args = false;
1633 curr_lexer->nesting_level.anon_fcn_body (); 1633 curr_lexer->m_nesting_level.anon_fcn_body ();
1634 } 1634 }
1635 1635
1636 return curr_lexer->count_token (')'); 1636 return curr_lexer->count_token (')');
1637 } 1637 }
1638 1638
1645 yyless (0); 1645 yyless (0);
1646 curr_lexer->push_start_state (COMMAND_START); 1646 curr_lexer->push_start_state (COMMAND_START);
1647 } 1647 }
1648 else 1648 else
1649 { 1649 {
1650 curr_lexer->looking_for_object_index = false; 1650 curr_lexer->m_looking_for_object_index = false;
1651 curr_lexer->at_beginning_of_statement = false; 1651 curr_lexer->m_at_beginning_of_statement = false;
1652 1652
1653 return curr_lexer->handle_token ('.'); 1653 return curr_lexer->handle_token ('.');
1654 } 1654 }
1655 } 1655 }
1656 1656
1703 if (unput_comma) 1703 if (unput_comma)
1704 { 1704 {
1705 yyless (0); 1705 yyless (0);
1706 curr_lexer->xunput (','); 1706 curr_lexer->xunput (',');
1707 // Adjust for comma that was not really in the input stream. 1707 // Adjust for comma that was not really in the input stream.
1708 curr_lexer->current_input_column--; 1708 curr_lexer->m_current_input_column--;
1709 } 1709 }
1710 else 1710 else
1711 { 1711 {
1712 curr_lexer->nesting_level.brace (); 1712 curr_lexer->m_nesting_level.brace ();
1713 1713
1714 curr_lexer->looking_at_object_index.push_front 1714 curr_lexer->m_looking_at_object_index.push_front
1715 (curr_lexer->looking_for_object_index); 1715 (curr_lexer->m_looking_for_object_index);
1716 1716
1717 curr_lexer->current_input_column += yyleng; 1717 curr_lexer->m_current_input_column += yyleng;
1718 curr_lexer->looking_for_object_index = false; 1718 curr_lexer->m_looking_for_object_index = false;
1719 curr_lexer->at_beginning_of_statement = false; 1719 curr_lexer->m_at_beginning_of_statement = false;
1720 1720
1721 curr_lexer->decrement_promptflag (); 1721 curr_lexer->decrement_promptflag ();
1722 1722
1723 curr_lexer->braceflag++; 1723 curr_lexer->m_braceflag++;
1724 1724
1725 curr_lexer->push_start_state (MATRIX_START); 1725 curr_lexer->push_start_state (MATRIX_START);
1726 1726
1727 return curr_lexer->count_token ('{'); 1727 return curr_lexer->count_token ('{');
1728 } 1728 }
1729 } 1729 }
1730 1730
1731 "}" { 1731 "}" {
1732 curr_lexer->lexer_debug ("}"); 1732 curr_lexer->lexer_debug ("}");
1733 1733
1734 curr_lexer->looking_at_object_index.pop_front (); 1734 curr_lexer->m_looking_at_object_index.pop_front ();
1735 1735
1736 curr_lexer->looking_for_object_index = true; 1736 curr_lexer->m_looking_for_object_index = true;
1737 curr_lexer->at_beginning_of_statement = false; 1737 curr_lexer->m_at_beginning_of_statement = false;
1738 1738
1739 curr_lexer->nesting_level.remove (); 1739 curr_lexer->m_nesting_level.remove ();
1740 1740
1741 return curr_lexer->handle_token ('}'); 1741 return curr_lexer->handle_token ('}');
1742 } 1742 }
1743 1743
1744 %{ 1744 %{
1764 << undo_string_escape (static_cast<char> (c)) 1764 << undo_string_escape (static_cast<char> (c))
1765 << "' (ASCII " << c << ")"; 1765 << "' (ASCII " << c << ")";
1766 1766
1767 octave::token *tok 1767 octave::token *tok
1768 = new octave::token (LEXICAL_ERROR, buf.str (), 1768 = new octave::token (LEXICAL_ERROR, buf.str (),
1769 curr_lexer->input_line_number, 1769 curr_lexer->m_input_line_number,
1770 curr_lexer->current_input_column); 1770 curr_lexer->m_current_input_column);
1771 1771
1772 curr_lexer->push_token (tok); 1772 curr_lexer->push_token (tok);
1773 1773
1774 curr_lexer->current_input_column++; 1774 curr_lexer->m_current_input_column++;
1775 1775
1776 return curr_lexer->count_token_internal (LEXICAL_ERROR); 1776 return curr_lexer->count_token_internal (LEXICAL_ERROR);
1777 } 1777 }
1778 } 1778 }
1779 1779
2077 namespace octave 2077 namespace octave
2078 { 2078 {
2079 void 2079 void
2080 lexical_feedback::symbol_table_context::clear (void) 2080 lexical_feedback::symbol_table_context::clear (void)
2081 { 2081 {
2082 while (! frame_stack.empty ()) 2082 while (! m_frame_stack.empty ())
2083 frame_stack.pop_front (); 2083 m_frame_stack.pop_front ();
2084 } 2084 }
2085 2085
2086 void 2086 void
2087 lexical_feedback::symbol_table_context::pop (void) 2087 lexical_feedback::symbol_table_context::pop (void)
2088 { 2088 {
2089 if (empty ()) 2089 if (empty ())
2090 panic_impossible (); 2090 panic_impossible ();
2091 2091
2092 frame_stack.pop_front (); 2092 m_frame_stack.pop_front ();
2093 } 2093 }
2094 2094
2095 symbol_scope 2095 symbol_scope
2096 lexical_feedback::symbol_table_context::curr_scope (void) const 2096 lexical_feedback::symbol_table_context::curr_scope (void) const
2097 { 2097 {
2101 = __get_current_scope__ ("lexical_feedback::symbol_table_context::curr_scope"); 2101 = __get_current_scope__ ("lexical_feedback::symbol_table_context::curr_scope");
2102 2102
2103 return scope; 2103 return scope;
2104 } 2104 }
2105 else 2105 else
2106 return frame_stack.front (); 2106 return m_frame_stack.front ();
2107 } 2107 }
2108 2108
2109 symbol_scope 2109 symbol_scope
2110 lexical_feedback::symbol_table_context::parent_scope (void) const 2110 lexical_feedback::symbol_table_context::parent_scope (void) const
2111 { 2111 {
2112 size_t sz = size (); 2112 size_t sz = size ();
2113 2113
2114 return sz > 1 ? frame_stack[1] : (sz == 1 ? frame_stack[0] : symbol_scope ()); 2114 return (sz > 1
2115 ? m_frame_stack[1]
2116 : (sz == 1 ? m_frame_stack[0] : symbol_scope ()));
2115 } 2117 }
2116 2118
2117 lexical_feedback::~lexical_feedback (void) 2119 lexical_feedback::~lexical_feedback (void)
2118 { 2120 {
2119 tokens.clear (); 2121 m_tokens.clear ();
2120 } 2122 }
2121 2123
2122 void 2124 void
2123 lexical_feedback::init (void) 2125 lexical_feedback::init (void)
2124 { 2126 {
2125 // The closest paren, brace, or bracket nesting is not an object 2127 // The closest paren, brace, or bracket nesting is not an object
2126 // index. 2128 // index.
2127 looking_at_object_index.push_front (false); 2129 m_looking_at_object_index.push_front (false);
2128 } 2130 }
2129 2131
2130 void 2132 void
2131 lexical_feedback::reset (void) 2133 lexical_feedback::reset (void)
2132 { 2134 {
2133 end_of_input = false; 2135 m_end_of_input = false;
2134 at_beginning_of_statement = true; 2136 m_at_beginning_of_statement = true;
2135 looking_at_anon_fcn_args = false; 2137 m_looking_at_anon_fcn_args = false;
2136 looking_at_return_list = false; 2138 m_looking_at_return_list = false;
2137 looking_at_parameter_list = false; 2139 m_looking_at_parameter_list = false;
2138 looking_at_decl_list = false; 2140 m_looking_at_decl_list = false;
2139 looking_at_initializer_expression = false; 2141 m_looking_at_initializer_expression = false;
2140 looking_at_matrix_or_assign_lhs = false; 2142 m_looking_at_matrix_or_assign_lhs = false;
2141 looking_for_object_index = false; 2143 m_looking_for_object_index = false;
2142 looking_at_indirect_ref = false; 2144 m_looking_at_indirect_ref = false;
2143 parsing_class_method = false; 2145 m_parsing_class_method = false;
2144 parsing_classdef = false; 2146 m_parsing_classdef = false;
2145 maybe_classdef_get_set_method = false; 2147 m_maybe_classdef_get_set_method = false;
2146 parsing_classdef_get_method = false; 2148 m_parsing_classdef_get_method = false;
2147 parsing_classdef_set_method = false; 2149 m_parsing_classdef_set_method = false;
2148 quote_is_transpose = false; 2150 m_quote_is_transpose = false;
2149 force_script = false; 2151 m_force_script = false;
2150 reading_fcn_file = false; 2152 m_reading_fcn_file = false;
2151 reading_script_file = false; 2153 m_reading_script_file = false;
2152 reading_classdef_file = false; 2154 m_reading_classdef_file = false;
2153 buffer_function_text = false; 2155 m_buffer_function_text = false;
2154 input_line_number = 1; 2156 m_input_line_number = 1;
2155 current_input_column = 1; 2157 m_current_input_column = 1;
2156 bracketflag = 0; 2158 m_bracketflag = 0;
2157 braceflag = 0; 2159 m_braceflag = 0;
2158 looping = 0; 2160 m_looping = 0;
2159 defining_func = 0; 2161 m_defining_func = 0;
2160 looking_at_function_handle = 0; 2162 m_looking_at_function_handle = 0;
2161 block_comment_nesting_level = 0; 2163 m_block_comment_nesting_level = 0;
2162 command_arg_paren_count = 0; 2164 m_command_arg_paren_count = 0;
2163 token_count = 0; 2165 m_token_count = 0;
2164 current_input_line = ""; 2166 m_current_input_line = "";
2165 comment_text = ""; 2167 m_comment_text = "";
2166 help_text = ""; 2168 m_help_text = "";
2167 function_text = ""; 2169 m_function_text = "";
2168 string_text = ""; 2170 m_string_text = "";
2169 string_line = 0; 2171 m_string_line = 0;
2170 string_column = 0; 2172 m_string_column = 0;
2171 fcn_file_name = ""; 2173 m_fcn_file_name = "";
2172 fcn_file_full_name = ""; 2174 m_fcn_file_full_name = "";
2173 dir_name = ""; 2175 m_dir_name = "";
2174 package_name = ""; 2176 m_package_name = "";
2175 looking_at_object_index.clear (); 2177 m_looking_at_object_index.clear ();
2176 looking_at_object_index.push_front (false); 2178 m_looking_at_object_index.push_front (false);
2177 2179
2178 while (! parsed_function_name.empty ()) 2180 while (! m_parsed_function_name.empty ())
2179 parsed_function_name.pop (); 2181 m_parsed_function_name.pop ();
2180 2182
2181 pending_local_variables.clear (); 2183 m_pending_local_variables.clear ();
2182 symtab_context.clear (); 2184 m_symtab_context.clear ();
2183 nesting_level.reset (); 2185 m_nesting_level.reset ();
2184 tokens.clear (); 2186 m_tokens.clear ();
2185 } 2187 }
2186 2188
2187 int 2189 int
2188 lexical_feedback::previous_token_value (void) const 2190 lexical_feedback::previous_token_value (void) const
2189 { 2191 {
2190 const token *tok = tokens.front (); 2192 const token *tok = m_tokens.front ();
2191 return tok ? tok->token_value () : 0; 2193 return tok ? tok->token_value () : 0;
2192 } 2194 }
2193 2195
2194 bool 2196 bool
2195 lexical_feedback::previous_token_value_is (int tok_val) const 2197 lexical_feedback::previous_token_value_is (int tok_val) const
2196 { 2198 {
2197 const token *tok = tokens.front (); 2199 const token *tok = m_tokens.front ();
2198 return tok ? tok->token_value_is (tok_val) : false; 2200 return tok ? tok->token_value_is (tok_val) : false;
2199 } 2201 }
2200 2202
2201 void 2203 void
2202 lexical_feedback::mark_previous_token_trailing_space (void) 2204 lexical_feedback::mark_previous_token_trailing_space (void)
2203 { 2205 {
2204 token *tok = tokens.front (); 2206 token *tok = m_tokens.front ();
2205 if (tok && ! previous_token_value_is ('\n')) 2207 if (tok && ! previous_token_value_is ('\n'))
2206 tok->mark_trailing_space (); 2208 tok->mark_trailing_space ();
2207 } 2209 }
2208 2210
2209 bool 2211 bool
2210 lexical_feedback::space_follows_previous_token (void) const 2212 lexical_feedback::space_follows_previous_token (void) const
2211 { 2213 {
2212 const token *tok = tokens.front (); 2214 const token *tok = m_tokens.front ();
2213 return tok ? tok->space_follows_token () : false; 2215 return tok ? tok->space_follows_token () : false;
2214 } 2216 }
2215 2217
2216 bool 2218 bool
2217 lexical_feedback::previous_token_is_binop (void) const 2219 lexical_feedback::previous_token_is_binop (void) const
2234 } 2236 }
2235 2237
2236 bool 2238 bool
2237 lexical_feedback::previous_token_is_keyword (void) const 2239 lexical_feedback::previous_token_is_keyword (void) const
2238 { 2240 {
2239 const token *tok = tokens.front (); 2241 const token *tok = m_tokens.front ();
2240 return tok ? tok->is_keyword () : false; 2242 return tok ? tok->is_keyword () : false;
2241 } 2243 }
2242 2244
2243 bool 2245 bool
2244 lexical_feedback::previous_token_may_be_command (void) const 2246 lexical_feedback::previous_token_may_be_command (void) const
2245 { 2247 {
2246 const token *tok = tokens.front (); 2248 const token *tok = m_tokens.front ();
2247 return tok ? tok->may_be_command () : false; 2249 return tok ? tok->may_be_command () : false;
2248 } 2250 }
2249 2251
2250 void 2252 void
2251 lexical_feedback::maybe_mark_previous_token_as_variable (void) 2253 lexical_feedback::maybe_mark_previous_token_as_variable (void)
2252 { 2254 {
2253 token *tok = tokens.front (); 2255 token *tok = m_tokens.front ();
2254 2256
2255 if (tok && tok->is_symbol ()) 2257 if (tok && tok->is_symbol ())
2256 pending_local_variables.insert (tok->symbol_name ()); 2258 m_pending_local_variables.insert (tok->symbol_name ());
2257 } 2259 }
2258 2260
2259 void 2261 void
2260 lexical_feedback::mark_as_variables (const std::list<std::string>& lst) 2262 lexical_feedback::mark_as_variables (const std::list<std::string>& lst)
2261 { 2263 {
2262 for (const auto& var : lst) 2264 for (const auto& var : lst)
2263 pending_local_variables.insert (var); 2265 m_pending_local_variables.insert (var);
2264 } 2266 }
2265 } 2267 }
2266 2268
2267 static bool 2269 static bool
2268 looks_like_copyright (const std::string& s) 2270 looks_like_copyright (const std::string& s)
2289 namespace octave 2291 namespace octave
2290 { 2292 {
2291 void 2293 void
2292 base_lexer::input_buffer::fill (const std::string& input, bool eof_arg) 2294 base_lexer::input_buffer::fill (const std::string& input, bool eof_arg)
2293 { 2295 {
2294 buffer = input; 2296 m_buffer = input;
2295 chars_left = buffer.length (); 2297 m_chars_left = m_buffer.length ();
2296 pos = buffer.c_str (); 2298 m_pos = m_buffer.c_str ();
2297 eof = eof_arg; 2299 m_eof = eof_arg;
2298 } 2300 }
2299 2301
2300 int 2302 int
2301 base_lexer::input_buffer::copy_chunk (char *buf, size_t max_size) 2303 base_lexer::input_buffer::copy_chunk (char *buf, size_t max_size)
2302 { 2304 {
2303 static const char * const eol = "\n"; 2305 static const char * const eol = "\n";
2304 2306
2305 size_t len = max_size > chars_left ? chars_left : max_size; 2307 size_t len = max_size > m_chars_left ? m_chars_left : max_size;
2306 assert (len > 0); 2308 assert (len > 0);
2307 2309
2308 memcpy (buf, pos, len); 2310 memcpy (buf, m_pos, len);
2309 2311
2310 chars_left -= len; 2312 m_chars_left -= len;
2311 pos += len; 2313 m_pos += len;
2312 2314
2313 // Make sure input ends with a new line character. 2315 // Make sure input ends with a new line character.
2314 if (chars_left == 0 && buf[len-1] != '\n') 2316 if (m_chars_left == 0 && buf[len-1] != '\n')
2315 { 2317 {
2316 if (len < max_size) 2318 if (len < max_size)
2317 { 2319 {
2318 // There is enough room to plug the newline character in 2320 // There is enough room to plug the newline character in
2319 // the buffer. 2321 // the buffer.
2322 else 2324 else
2323 { 2325 {
2324 // There isn't enough room to plug the newline character 2326 // There isn't enough room to plug the newline character
2325 // in the buffer so arrange to have it returned on the next 2327 // in the buffer so arrange to have it returned on the next
2326 // call to base_lexer::read. 2328 // call to base_lexer::read.
2327 pos = eol; 2329 m_pos = eol;
2328 chars_left = 1; 2330 m_chars_left = 1;
2329 } 2331 }
2330 } 2332 }
2331 2333
2332 return len; 2334 return len;
2333 } 2335 }
2334 2336
2335 base_lexer::~base_lexer (void) 2337 base_lexer::~base_lexer (void)
2336 { 2338 {
2337 yylex_destroy (scanner); 2339 yylex_destroy (m_scanner);
2338 } 2340 }
2339 2341
2340 void 2342 void
2341 base_lexer::init (void) 2343 base_lexer::init (void)
2342 { 2344 {
2343 yylex_init (&scanner); 2345 yylex_init (&m_scanner);
2344 2346
2345 // Make base_lexer object available through yyextra in 2347 // Make base_lexer object available through yyextra in
2346 // flex-generated lexer. 2348 // flex-generated lexer.
2347 yyset_extra (this, scanner); 2349 yyset_extra (this, m_scanner);
2348 2350
2349 clear_start_state (); 2351 clear_start_state ();
2350 } 2352 }
2351 2353
2352 // Inside Flex-generated functions, yyg is the scanner cast to its real 2354 // Inside Flex-generated functions, yyg is the scanner cast to its real
2354 // (for example, BEGIN) use yyg. If we could perform the actions of 2356 // (for example, BEGIN) use yyg. If we could perform the actions of
2355 // these macros with functions instead, we could eliminate the 2357 // these macros with functions instead, we could eliminate the
2356 // OCTAVE_YYG macro. 2358 // OCTAVE_YYG macro.
2357 2359
2358 #define OCTAVE_YYG \ 2360 #define OCTAVE_YYG \
2359 struct yyguts_t *yyg = static_cast<struct yyguts_t*> (scanner) 2361 struct yyguts_t *yyg = static_cast<struct yyguts_t*> (m_scanner)
2360 2362
2361 void 2363 void
2362 base_lexer::reset (void) 2364 base_lexer::reset (void)
2363 { 2365 {
2364 // Start off on the right foot. 2366 // Start off on the right foot.
2365 clear_start_state (); 2367 clear_start_state ();
2366 2368
2367 symtab_context.clear (); 2369 m_symtab_context.clear ();
2368 2370
2369 // We do want a prompt by default. 2371 // We do want a prompt by default.
2370 promptflag (1); 2372 promptflag (1);
2371 2373
2372 // Only ask for input from stdin if we are expecting interactive 2374 // Only ask for input from stdin if we are expecting interactive
2373 // input. 2375 // input.
2374 2376
2375 if (application::interactive () 2377 if (application::interactive ()
2376 && ! (reading_fcn_file 2378 && ! (m_reading_fcn_file
2377 || reading_classdef_file 2379 || m_reading_classdef_file
2378 || reading_script_file 2380 || m_reading_script_file
2379 || input_from_eval_string ())) 2381 || input_from_eval_string ()))
2380 yyrestart (stdin, scanner); 2382 yyrestart (stdin, m_scanner);
2381 2383
2382 lexical_feedback::reset (); 2384 lexical_feedback::reset ();
2383 2385
2384 comment_buf.reset (); 2386 m_comment_buf.reset ();
2385 } 2387 }
2386 2388
2387 void 2389 void
2388 base_lexer::prep_for_file (void) 2390 base_lexer::prep_for_file (void)
2389 { 2391 {
2390 reading_script_file = true; 2392 m_reading_script_file = true;
2391 2393
2392 push_start_state (INPUT_FILE_START); 2394 push_start_state (INPUT_FILE_START);
2393 } 2395 }
2394 2396
2395 void 2397 void
2396 base_lexer::begin_string (int state) 2398 base_lexer::begin_string (int state)
2397 { 2399 {
2398 string_line = input_line_number; 2400 m_string_line = m_input_line_number;
2399 string_column = current_input_column; 2401 m_string_column = m_current_input_column;
2400 2402
2401 push_start_state (state); 2403 push_start_state (state);
2402 } 2404 }
2403 2405
2404 int 2406 int
2405 base_lexer::handle_end_of_input (void) 2407 base_lexer::handle_end_of_input (void)
2406 { 2408 {
2407 lexer_debug ("<<EOF>>"); 2409 lexer_debug ("<<EOF>>");
2408 2410
2409 if (block_comment_nesting_level != 0) 2411 if (m_block_comment_nesting_level != 0)
2410 { 2412 {
2411 warning ("block comment open at end of input"); 2413 warning ("block comment open at end of input");
2412 2414
2413 if ((reading_fcn_file || reading_script_file || reading_classdef_file) 2415 if ((m_reading_fcn_file || m_reading_script_file || m_reading_classdef_file)
2414 && ! fcn_file_name.empty ()) 2416 && ! m_fcn_file_name.empty ())
2415 warning ("near line %d of file '%s.m'", 2417 warning ("near line %d of file '%s.m'",
2416 input_line_number, fcn_file_name.c_str ()); 2418 m_input_line_number, m_fcn_file_name.c_str ());
2417 } 2419 }
2418 2420
2419 return handle_token (END_OF_INPUT); 2421 return handle_token (END_OF_INPUT);
2420 } 2422 }
2421 2423
2422 char * 2424 char *
2423 base_lexer::flex_yytext (void) 2425 base_lexer::flex_yytext (void)
2424 { 2426 {
2425 return yyget_text (scanner); 2427 return yyget_text (m_scanner);
2426 } 2428 }
2427 2429
2428 int 2430 int
2429 base_lexer::flex_yyleng (void) 2431 base_lexer::flex_yyleng (void)
2430 { 2432 {
2431 return yyget_leng (scanner); 2433 return yyget_leng (m_scanner);
2432 } 2434 }
2433 2435
2434 int 2436 int
2435 base_lexer::text_yyinput (void) 2437 base_lexer::text_yyinput (void)
2436 { 2438 {
2437 int c = yyinput (scanner); 2439 int c = yyinput (m_scanner);
2438 2440
2439 if (lexer_debug_flag) 2441 if (lexer_debug_flag)
2440 { 2442 {
2441 std::cerr << "I: "; 2443 std::cerr << "I: ";
2442 display_character (c); 2444 display_character (c);
2445 2447
2446 // Convert CRLF into just LF and single CR into LF. 2448 // Convert CRLF into just LF and single CR into LF.
2447 2449
2448 if (c == '\r') 2450 if (c == '\r')
2449 { 2451 {
2450 c = yyinput (scanner); 2452 c = yyinput (m_scanner);
2451 2453
2452 if (lexer_debug_flag) 2454 if (lexer_debug_flag)
2453 { 2455 {
2454 std::cerr << "I: "; 2456 std::cerr << "I: ";
2455 display_character (c); 2457 display_character (c);
2476 std::cerr << "U: "; 2478 std::cerr << "U: ";
2477 display_character (c); 2479 display_character (c);
2478 std::cerr << std::endl; 2480 std::cerr << std::endl;
2479 } 2481 }
2480 2482
2481 yyunput (c, buf, scanner); 2483 yyunput (c, buf, m_scanner);
2482 } 2484 }
2483 } 2485 }
2484 2486
2485 void 2487 void
2486 base_lexer::xunput (char c) 2488 base_lexer::xunput (char c)
2501 bool 2503 bool
2502 base_lexer::inside_any_object_index (void) 2504 base_lexer::inside_any_object_index (void)
2503 { 2505 {
2504 bool retval = false; 2506 bool retval = false;
2505 2507
2506 for (const bool is_obj_idx : looking_at_object_index) 2508 for (const bool is_obj_idx : m_looking_at_object_index)
2507 { 2509 {
2508 if (is_obj_idx) 2510 if (is_obj_idx)
2509 { 2511 {
2510 retval = true; 2512 retval = true;
2511 break; 2513 break;
2518 bool 2520 bool
2519 base_lexer::is_variable (const std::string& name, 2521 base_lexer::is_variable (const std::string& name,
2520 const symbol_scope& scope) 2522 const symbol_scope& scope)
2521 { 2523 {
2522 return ((scope && scope.is_variable (name)) 2524 return ((scope && scope.is_variable (name))
2523 || (pending_local_variables.find (name) 2525 || (m_pending_local_variables.find (name)
2524 != pending_local_variables.end ())); 2526 != m_pending_local_variables.end ()));
2525 } 2527 }
2526 2528
2527 // Handle keywords. Return -1 if the keyword should be ignored. 2529 // Handle keywords. Return -1 if the keyword should be ignored.
2528 2530
2529 int 2531 int
2530 base_lexer::is_keyword_token (const std::string& s) 2532 base_lexer::is_keyword_token (const std::string& s)
2531 { 2533 {
2532 int l = input_line_number; 2534 int l = m_input_line_number;
2533 int c = current_input_column; 2535 int c = m_current_input_column;
2534 2536
2535 int len = s.length (); 2537 int len = s.length ();
2536 2538
2537 const octave_kw *kw = octave_kw_hash::in_word_set (s.c_str (), len); 2539 const octave_kw *kw = octave_kw_hash::in_word_set (s.c_str (), len);
2538 2540
2539 if (kw) 2541 if (kw)
2540 { 2542 {
2541 bool previous_at_bos = at_beginning_of_statement; 2543 bool previous_at_bos = m_at_beginning_of_statement;
2542 2544
2543 // May be reset to true for some token types. 2545 // May be reset to true for some token types.
2544 at_beginning_of_statement = false; 2546 m_at_beginning_of_statement = false;
2545 2547
2546 token *tok_val = nullptr; 2548 token *tok_val = nullptr;
2547 2549
2548 switch (kw->kw_id) 2550 switch (kw->kw_id)
2549 { 2551 {
2552 case continue_kw: 2554 case continue_kw:
2553 case else_kw: 2555 case else_kw:
2554 case otherwise_kw: 2556 case otherwise_kw:
2555 case return_kw: 2557 case return_kw:
2556 case unwind_protect_cleanup_kw: 2558 case unwind_protect_cleanup_kw:
2557 at_beginning_of_statement = true; 2559 m_at_beginning_of_statement = true;
2558 break; 2560 break;
2559 2561
2560 case persistent_kw: 2562 case persistent_kw:
2561 case global_kw: 2563 case global_kw:
2562 looking_at_decl_list = true; 2564 m_looking_at_decl_list = true;
2563 break; 2565 break;
2564 2566
2565 case case_kw: 2567 case case_kw:
2566 case elseif_kw: 2568 case elseif_kw:
2567 case until_kw: 2569 case until_kw:
2568 break; 2570 break;
2569 2571
2570 case end_kw: 2572 case end_kw:
2571 if (inside_any_object_index () 2573 if (inside_any_object_index ()
2572 || (defining_func 2574 || (m_defining_func
2573 && ! (looking_at_return_list 2575 && ! (m_looking_at_return_list
2574 || parsed_function_name.top ()))) 2576 || m_parsed_function_name.top ())))
2575 { 2577 {
2576 at_beginning_of_statement = previous_at_bos; 2578 m_at_beginning_of_statement = previous_at_bos;
2577 return 0; 2579 return 0;
2578 } 2580 }
2579 2581
2580 tok_val = new token (end_kw, token::simple_end, l, c); 2582 tok_val = new token (end_kw, token::simple_end, l, c);
2581 at_beginning_of_statement = true; 2583 m_at_beginning_of_statement = true;
2582 break; 2584 break;
2583 2585
2584 case end_try_catch_kw: 2586 case end_try_catch_kw:
2585 tok_val = new token (end_try_catch_kw, token::try_catch_end, l, c); 2587 tok_val = new token (end_try_catch_kw, token::try_catch_end, l, c);
2586 at_beginning_of_statement = true; 2588 m_at_beginning_of_statement = true;
2587 break; 2589 break;
2588 2590
2589 case end_unwind_protect_kw: 2591 case end_unwind_protect_kw:
2590 tok_val = new token (end_unwind_protect_kw, 2592 tok_val = new token (end_unwind_protect_kw,
2591 token::unwind_protect_end, l, c); 2593 token::unwind_protect_end, l, c);
2592 at_beginning_of_statement = true; 2594 m_at_beginning_of_statement = true;
2593 break; 2595 break;
2594 2596
2595 case endfor_kw: 2597 case endfor_kw:
2596 tok_val = new token (endfor_kw, token::for_end, l, c); 2598 tok_val = new token (endfor_kw, token::for_end, l, c);
2597 at_beginning_of_statement = true; 2599 m_at_beginning_of_statement = true;
2598 break; 2600 break;
2599 2601
2600 case endfunction_kw: 2602 case endfunction_kw:
2601 tok_val = new token (endfunction_kw, token::function_end, l, c); 2603 tok_val = new token (endfunction_kw, token::function_end, l, c);
2602 at_beginning_of_statement = true; 2604 m_at_beginning_of_statement = true;
2603 break; 2605 break;
2604 2606
2605 case endif_kw: 2607 case endif_kw:
2606 tok_val = new token (endif_kw, token::if_end, l, c); 2608 tok_val = new token (endif_kw, token::if_end, l, c);
2607 at_beginning_of_statement = true; 2609 m_at_beginning_of_statement = true;
2608 break; 2610 break;
2609 2611
2610 case endparfor_kw: 2612 case endparfor_kw:
2611 tok_val = new token (endparfor_kw, token::parfor_end, l, c); 2613 tok_val = new token (endparfor_kw, token::parfor_end, l, c);
2612 at_beginning_of_statement = true; 2614 m_at_beginning_of_statement = true;
2613 break; 2615 break;
2614 2616
2615 case endswitch_kw: 2617 case endswitch_kw:
2616 tok_val = new token (endswitch_kw, token::switch_end, l, c); 2618 tok_val = new token (endswitch_kw, token::switch_end, l, c);
2617 at_beginning_of_statement = true; 2619 m_at_beginning_of_statement = true;
2618 break; 2620 break;
2619 2621
2620 case endwhile_kw: 2622 case endwhile_kw:
2621 tok_val = new token (endwhile_kw, token::while_end, l, c); 2623 tok_val = new token (endwhile_kw, token::while_end, l, c);
2622 at_beginning_of_statement = true; 2624 m_at_beginning_of_statement = true;
2623 break; 2625 break;
2624 2626
2625 case endclassdef_kw: 2627 case endclassdef_kw:
2626 tok_val = new token (endclassdef_kw, token::classdef_end, l, c); 2628 tok_val = new token (endclassdef_kw, token::classdef_end, l, c);
2627 at_beginning_of_statement = true; 2629 m_at_beginning_of_statement = true;
2628 break; 2630 break;
2629 2631
2630 case endenumeration_kw: 2632 case endenumeration_kw:
2631 tok_val = new token (endenumeration_kw, token::enumeration_end, l, c); 2633 tok_val = new token (endenumeration_kw, token::enumeration_end, l, c);
2632 at_beginning_of_statement = true; 2634 m_at_beginning_of_statement = true;
2633 break; 2635 break;
2634 2636
2635 case endevents_kw: 2637 case endevents_kw:
2636 tok_val = new token (endevents_kw, token::events_end, l, c); 2638 tok_val = new token (endevents_kw, token::events_end, l, c);
2637 at_beginning_of_statement = true; 2639 m_at_beginning_of_statement = true;
2638 break; 2640 break;
2639 2641
2640 case endmethods_kw: 2642 case endmethods_kw:
2641 tok_val = new token (endmethods_kw, token::methods_end, l, c); 2643 tok_val = new token (endmethods_kw, token::methods_end, l, c);
2642 at_beginning_of_statement = true; 2644 m_at_beginning_of_statement = true;
2643 break; 2645 break;
2644 2646
2645 case endproperties_kw: 2647 case endproperties_kw:
2646 tok_val = new token (endproperties_kw, token::properties_end, l, c); 2648 tok_val = new token (endproperties_kw, token::properties_end, l, c);
2647 at_beginning_of_statement = true; 2649 m_at_beginning_of_statement = true;
2648 break; 2650 break;
2649 2651
2650 2652
2651 case for_kw: 2653 case for_kw:
2652 case parfor_kw: 2654 case parfor_kw:
2653 case while_kw: 2655 case while_kw:
2654 decrement_promptflag (); 2656 decrement_promptflag ();
2655 looping++; 2657 m_looping++;
2656 break; 2658 break;
2657 2659
2658 case do_kw: 2660 case do_kw:
2659 at_beginning_of_statement = true; 2661 m_at_beginning_of_statement = true;
2660 decrement_promptflag (); 2662 decrement_promptflag ();
2661 looping++; 2663 m_looping++;
2662 break; 2664 break;
2663 2665
2664 case try_kw: 2666 case try_kw:
2665 case unwind_protect_kw: 2667 case unwind_protect_kw:
2666 at_beginning_of_statement = true; 2668 m_at_beginning_of_statement = true;
2667 decrement_promptflag (); 2669 decrement_promptflag ();
2668 break; 2670 break;
2669 2671
2670 case if_kw: 2672 case if_kw:
2671 case switch_kw: 2673 case switch_kw:
2674 2676
2675 case get_kw: 2677 case get_kw:
2676 case set_kw: 2678 case set_kw:
2677 // 'get' and 'set' are keywords in classdef method 2679 // 'get' and 'set' are keywords in classdef method
2678 // declarations. 2680 // declarations.
2679 if (! maybe_classdef_get_set_method) 2681 if (! m_maybe_classdef_get_set_method)
2680 { 2682 {
2681 at_beginning_of_statement = previous_at_bos; 2683 m_at_beginning_of_statement = previous_at_bos;
2682 return 0; 2684 return 0;
2683 } 2685 }
2684 break; 2686 break;
2685 2687
2686 case enumeration_kw: 2688 case enumeration_kw:
2687 case events_kw: 2689 case events_kw:
2688 case methods_kw: 2690 case methods_kw:
2689 case properties_kw: 2691 case properties_kw:
2690 // 'properties', 'methods' and 'events' are keywords for 2692 // 'properties', 'methods' and 'events' are keywords for
2691 // classdef blocks. 2693 // classdef blocks.
2692 if (! parsing_classdef) 2694 if (! m_parsing_classdef)
2693 { 2695 {
2694 at_beginning_of_statement = previous_at_bos; 2696 m_at_beginning_of_statement = previous_at_bos;
2695 return 0; 2697 return 0;
2696 } 2698 }
2697 // fall through ... 2699 // fall through ...
2698 2700
2699 case classdef_kw: 2701 case classdef_kw:
2700 // 'classdef' is always a keyword. 2702 // 'classdef' is always a keyword.
2701 decrement_promptflag (); 2703 decrement_promptflag ();
2702 2704
2703 if (! force_script && token_count == 0 && input_from_file ()) 2705 if (! m_force_script && m_token_count == 0 && input_from_file ())
2704 { 2706 {
2705 reading_classdef_file = true; 2707 m_reading_classdef_file = true;
2706 reading_script_file = false; 2708 m_reading_script_file = false;
2707 } 2709 }
2708 break; 2710 break;
2709 2711
2710 case function_kw: 2712 case function_kw:
2711 decrement_promptflag (); 2713 decrement_promptflag ();
2712 2714
2713 defining_func++; 2715 m_defining_func++;
2714 parsed_function_name.push (false); 2716 m_parsed_function_name.push (false);
2715 2717
2716 if (! force_script && token_count == 0 && input_from_file ()) 2718 if (! m_force_script && m_token_count == 0 && input_from_file ())
2717 { 2719 {
2718 reading_fcn_file = true; 2720 m_reading_fcn_file = true;
2719 reading_script_file = false; 2721 m_reading_script_file = false;
2720 } 2722 }
2721 2723
2722 if (! (reading_fcn_file || reading_script_file 2724 if (! (m_reading_fcn_file || m_reading_script_file
2723 || reading_classdef_file)) 2725 || m_reading_classdef_file))
2724 { 2726 {
2725 // Input must be coming from the terminal or stdin? 2727 // Input must be coming from the terminal or stdin?
2726 buffer_function_text = true; 2728 m_buffer_function_text = true;
2727 function_text += (current_input_line + "\n"); 2729 m_function_text += (m_current_input_line + "\n");
2728 2730
2729 input_line_number = 1; 2731 m_input_line_number = 1;
2730 } 2732 }
2731 break; 2733 break;
2732 2734
2733 case magic_file_kw: 2735 case magic_file_kw:
2734 { 2736 {
2735 if ((reading_fcn_file || reading_script_file 2737 if ((m_reading_fcn_file || m_reading_script_file
2736 || reading_classdef_file) 2738 || m_reading_classdef_file)
2737 && ! fcn_file_full_name.empty ()) 2739 && ! m_fcn_file_full_name.empty ())
2738 tok_val = new token (magic_file_kw, fcn_file_full_name, l, c); 2740 tok_val = new token (magic_file_kw, m_fcn_file_full_name, l, c);
2739 else 2741 else
2740 tok_val = new token (magic_file_kw, "stdin", l, c); 2742 tok_val = new token (magic_file_kw, "stdin", l, c);
2741 } 2743 }
2742 break; 2744 break;
2743 2745
2790 } 2792 }
2791 2793
2792 bool 2794 bool
2793 base_lexer::whitespace_is_significant (void) 2795 base_lexer::whitespace_is_significant (void)
2794 { 2796 {
2795 return (nesting_level.is_bracket () 2797 return (m_nesting_level.is_bracket ()
2796 || (nesting_level.is_brace () 2798 || (m_nesting_level.is_brace ()
2797 && ! looking_at_object_index.front ())); 2799 && ! m_looking_at_object_index.front ()));
2798 } 2800 }
2799 } 2801 }
2800 2802
2801 static inline bool 2803 static inline bool
2802 looks_like_bin (const char *s, int len) 2804 looks_like_bin (const char *s, int len)
2872 2874
2873 // If yytext doesn't contain a valid number, we are in deep doo doo. 2875 // If yytext doesn't contain a valid number, we are in deep doo doo.
2874 2876
2875 assert (nread == 1); 2877 assert (nread == 1);
2876 2878
2877 looking_for_object_index = false; 2879 m_looking_for_object_index = false;
2878 at_beginning_of_statement = false; 2880 m_at_beginning_of_statement = false;
2879 2881
2880 push_token (new token (NUM, value, yytxt, input_line_number, 2882 push_token (new token (NUM, value, yytxt, m_input_line_number,
2881 current_input_column)); 2883 m_current_input_column));
2882 2884
2883 current_input_column += flex_yyleng (); 2885 m_current_input_column += flex_yyleng ();
2884 } 2886 }
2885 2887
2886 void 2888 void
2887 base_lexer::handle_continuation (void) 2889 base_lexer::handle_continuation (void)
2888 { 2890 {
2924 break; 2926 break;
2925 } 2927 }
2926 2928
2927 if (have_comment) 2929 if (have_comment)
2928 { 2930 {
2929 comment_text = &yytxt[offset]; 2931 m_comment_text = &yytxt[offset];
2930 2932
2931 // finish_comment sets at_beginning_of_statement to true but 2933 // finish_comment sets m_at_beginning_of_statement to true but
2932 // that's not be correct if we are handling a continued 2934 // that's not be correct if we are handling a continued
2933 // statement. Preserve the current state. 2935 // statement. Preserve the current state.
2934 2936
2935 bool saved_bos = at_beginning_of_statement; 2937 bool saved_bos = m_at_beginning_of_statement;
2936 2938
2937 finish_comment (comment_elt::end_of_line); 2939 finish_comment (comment_elt::end_of_line);
2938 2940
2939 at_beginning_of_statement = saved_bos; 2941 m_at_beginning_of_statement = saved_bos;
2940 } 2942 }
2941 2943
2942 decrement_promptflag (); 2944 decrement_promptflag ();
2943 input_line_number++; 2945 m_input_line_number++;
2944 current_input_column = 1; 2946 m_current_input_column = 1;
2945 } 2947 }
2946 2948
2947 void 2949 void
2948 base_lexer::finish_comment (comment_elt::comment_type typ) 2950 base_lexer::finish_comment (comment_elt::comment_type typ)
2949 { 2951 {
2950 bool copyright = looks_like_copyright (comment_text); 2952 bool copyright = looks_like_copyright (m_comment_text);
2951 2953
2952 if (nesting_level.none () && help_text.empty () && ! comment_text.empty () 2954 if (m_nesting_level.none () && m_help_text.empty () && ! m_comment_text.empty ()
2953 && ! copyright && ! looks_like_shebang (comment_text)) 2955 && ! copyright && ! looks_like_shebang (m_comment_text))
2954 help_text = comment_text; 2956 m_help_text = m_comment_text;
2955 2957
2956 if (copyright) 2958 if (copyright)
2957 typ = comment_elt::copyright; 2959 typ = comment_elt::copyright;
2958 2960
2959 comment_buf.append (comment_text, typ); 2961 m_comment_buf.append (m_comment_text, typ);
2960 2962
2961 comment_text = ""; 2963 m_comment_text = "";
2962 2964
2963 at_beginning_of_statement = true; 2965 m_at_beginning_of_statement = true;
2964 } 2966 }
2965 2967
2966 int 2968 int
2967 base_lexer::handle_close_bracket (int bracket_type) 2969 base_lexer::handle_close_bracket (int bracket_type)
2968 { 2970 {
2969 int retval = bracket_type; 2971 int retval = bracket_type;
2970 2972
2971 if (! nesting_level.none ()) 2973 if (! m_nesting_level.none ())
2972 { 2974 {
2973 nesting_level.remove (); 2975 m_nesting_level.remove ();
2974 2976
2975 if (bracket_type == ']') 2977 if (bracket_type == ']')
2976 bracketflag--; 2978 m_bracketflag--;
2977 else if (bracket_type == '}') 2979 else if (bracket_type == '}')
2978 braceflag--; 2980 m_braceflag--;
2979 else 2981 else
2980 panic_impossible (); 2982 panic_impossible ();
2981 } 2983 }
2982 2984
2983 pop_start_state (); 2985 pop_start_state ();
3010 if (kw_token) 3012 if (kw_token)
3011 { 3013 {
3012 token *tok 3014 token *tok
3013 = new token (LEXICAL_ERROR, 3015 = new token (LEXICAL_ERROR,
3014 "method, class, and package names may not be keywords", 3016 "method, class, and package names may not be keywords",
3015 input_line_number, current_input_column); 3017 m_input_line_number, m_current_input_column);
3016 3018
3017 push_token (tok); 3019 push_token (tok);
3018 3020
3019 return count_token_internal (LEXICAL_ERROR); 3021 return count_token_internal (LEXICAL_ERROR);
3020 } 3022 }
3021 3023
3022 push_token (new token (SUPERCLASSREF, meth, cls, 3024 push_token (new token (SUPERCLASSREF, meth, cls,
3023 input_line_number, current_input_column)); 3025 m_input_line_number, m_current_input_column));
3024 3026
3025 current_input_column += flex_yyleng (); 3027 m_current_input_column += flex_yyleng ();
3026 3028
3027 return SUPERCLASSREF; 3029 return SUPERCLASSREF;
3028 } 3030 }
3029 3031
3030 int 3032 int
3034 3036
3035 if (fq_identifier_contains_keyword (cls)) 3037 if (fq_identifier_contains_keyword (cls))
3036 { 3038 {
3037 token *tok = new token (LEXICAL_ERROR, 3039 token *tok = new token (LEXICAL_ERROR,
3038 "class and package names may not be keywords", 3040 "class and package names may not be keywords",
3039 input_line_number, current_input_column); 3041 m_input_line_number, m_current_input_column);
3040 push_token (tok); 3042 push_token (tok);
3041 3043
3042 return count_token_internal (LEXICAL_ERROR); 3044 return count_token_internal (LEXICAL_ERROR);
3043 } 3045 }
3044 3046
3045 push_token (new token (METAQUERY, cls, input_line_number, 3047 push_token (new token (METAQUERY, cls, m_input_line_number,
3046 current_input_column)); 3048 m_current_input_column));
3047 3049
3048 current_input_column += flex_yyleng (); 3050 m_current_input_column += flex_yyleng ();
3049 3051
3050 return METAQUERY; 3052 return METAQUERY;
3051 } 3053 }
3052 3054
3053 int 3055 int
3058 if (fq_identifier_contains_keyword (fq_id)) 3060 if (fq_identifier_contains_keyword (fq_id))
3059 { 3061 {
3060 token *tok 3062 token *tok
3061 = new token (LEXICAL_ERROR, 3063 = new token (LEXICAL_ERROR,
3062 "function, method, class, and package names may not be keywords", 3064 "function, method, class, and package names may not be keywords",
3063 input_line_number, current_input_column); 3065 m_input_line_number, m_current_input_column);
3064 3066
3065 push_token (tok); 3067 push_token (tok);
3066 3068
3067 return count_token_internal (LEXICAL_ERROR); 3069 return count_token_internal (LEXICAL_ERROR);
3068 } 3070 }
3069 3071
3070 push_token (new token (FQ_IDENT, fq_id, input_line_number, 3072 push_token (new token (FQ_IDENT, fq_id, m_input_line_number,
3071 current_input_column)); 3073 m_current_input_column));
3072 3074
3073 current_input_column += flex_yyleng (); 3075 m_current_input_column += flex_yyleng ();
3074 3076
3075 return FQ_IDENT; 3077 return FQ_IDENT;
3076 } 3078 }
3077 3079
3078 // Figure out exactly what kind of token to return when we have seen 3080 // Figure out exactly what kind of token to return when we have seen
3086 3088
3087 // If we are expecting a structure element, avoid recognizing 3089 // If we are expecting a structure element, avoid recognizing
3088 // keywords and other special names and return STRUCT_ELT, which is 3090 // keywords and other special names and return STRUCT_ELT, which is
3089 // a string that is also a valid identifier. 3091 // a string that is also a valid identifier.
3090 3092
3091 if (looking_at_indirect_ref) 3093 if (m_looking_at_indirect_ref)
3092 { 3094 {
3093 push_token (new token (STRUCT_ELT, ident, input_line_number, 3095 push_token (new token (STRUCT_ELT, ident, m_input_line_number,
3094 current_input_column)); 3096 m_current_input_column));
3095 3097
3096 looking_for_object_index = true; 3098 m_looking_for_object_index = true;
3097 3099
3098 current_input_column += flex_yyleng (); 3100 m_current_input_column += flex_yyleng ();
3099 3101
3100 return STRUCT_ELT; 3102 return STRUCT_ELT;
3101 } 3103 }
3102 3104
3103 // If ident is a keyword token, then is_keyword_token will set 3105 // If ident is a keyword token, then is_keyword_token will set
3104 // at_beginning_of_statement. For example, if tok is an IF 3106 // m_at_beginning_of_statement. For example, if tok is an IF
3105 // token, then at_beginning_of_statement will be false. 3107 // token, then m_at_beginning_of_statement will be false.
3106 3108
3107 int kw_token = is_keyword_token (ident); 3109 int kw_token = is_keyword_token (ident);
3108 3110
3109 if (looking_at_function_handle) 3111 if (m_looking_at_function_handle)
3110 { 3112 {
3111 if (kw_token) 3113 if (kw_token)
3112 { 3114 {
3113 token *tok 3115 token *tok
3114 = new token (LEXICAL_ERROR, 3116 = new token (LEXICAL_ERROR,
3115 "function handles may not refer to keywords", 3117 "function handles may not refer to keywords",
3116 input_line_number, current_input_column); 3118 m_input_line_number, m_current_input_column);
3117 3119
3118 push_token (tok); 3120 push_token (tok);
3119 3121
3120 return count_token_internal (LEXICAL_ERROR); 3122 return count_token_internal (LEXICAL_ERROR);
3121 } 3123 }
3122 else 3124 else
3123 { 3125 {
3124 push_token (new token (FCN_HANDLE, ident, input_line_number, 3126 push_token (new token (FCN_HANDLE, ident, m_input_line_number,
3125 current_input_column)); 3127 m_current_input_column));
3126 3128
3127 current_input_column += flex_yyleng (); 3129 m_current_input_column += flex_yyleng ();
3128 looking_for_object_index = true; 3130 m_looking_for_object_index = true;
3129 3131
3130 at_beginning_of_statement = false; 3132 m_at_beginning_of_statement = false;
3131 3133
3132 return FCN_HANDLE; 3134 return FCN_HANDLE;
3133 } 3135 }
3134 } 3136 }
3135 3137
3138 3140
3139 if (kw_token) 3141 if (kw_token)
3140 { 3142 {
3141 if (kw_token >= 0) 3143 if (kw_token >= 0)
3142 { 3144 {
3143 current_input_column += flex_yyleng (); 3145 m_current_input_column += flex_yyleng ();
3144 looking_for_object_index = false; 3146 m_looking_for_object_index = false;
3145 } 3147 }
3146 3148
3147 // The call to is_keyword_token set at_beginning_of_statement. 3149 // The call to is_keyword_token set m_at_beginning_of_statement.
3148 3150
3149 return kw_token; 3151 return kw_token;
3150 } 3152 }
3151 3153
3152 // Find the token in the symbol table. 3154 // Find the token in the symbol table.
3153 3155
3154 symbol_scope scope = symtab_context.curr_scope (); 3156 symbol_scope scope = m_symtab_context.curr_scope ();
3155 3157
3156 symbol_record sr = (scope ? scope.insert (ident) : symbol_record (ident)); 3158 symbol_record sr = (scope ? scope.insert (ident) : symbol_record (ident));
3157 3159
3158 token *tok = new token (NAME, sr, input_line_number, current_input_column); 3160 token *tok = new token (NAME, sr, m_input_line_number, m_current_input_column);
3159 3161
3160 // The following symbols are handled specially so that things like 3162 // The following symbols are handled specially so that things like
3161 // 3163 //
3162 // pi +1 3164 // pi +1
3163 // 3165 //
3164 // are parsed as an addition expression instead of as a command-style 3166 // are parsed as an addition expression instead of as a command-style
3165 // function call with the argument "+1". 3167 // function call with the argument "+1".
3166 3168
3167 if (at_beginning_of_statement 3169 if (m_at_beginning_of_statement
3168 && (! (is_variable (ident, scope) 3170 && (! (is_variable (ident, scope)
3169 || ident == "e" || ident == "pi" 3171 || ident == "e" || ident == "pi"
3170 || ident == "I" || ident == "i" 3172 || ident == "I" || ident == "i"
3171 || ident == "J" || ident == "j" 3173 || ident == "J" || ident == "j"
3172 || ident == "Inf" || ident == "inf" 3174 || ident == "Inf" || ident == "inf"
3173 || ident == "NaN" || ident == "nan"))) 3175 || ident == "NaN" || ident == "nan")))
3174 tok->mark_may_be_command (); 3176 tok->mark_may_be_command ();
3175 3177
3176 push_token (tok); 3178 push_token (tok);
3177 3179
3178 current_input_column += flex_yyleng (); 3180 m_current_input_column += flex_yyleng ();
3179 3181
3180 // The magic end index can't be indexed. 3182 // The magic end index can't be indexed.
3181 3183
3182 if (ident != "end") 3184 if (ident != "end")
3183 looking_for_object_index = true; 3185 m_looking_for_object_index = true;
3184 3186
3185 at_beginning_of_statement = false; 3187 m_at_beginning_of_statement = false;
3186 3188
3187 return NAME; 3189 return NAME;
3188 } 3190 }
3189 3191
3190 void 3192 void
3191 base_lexer::maybe_warn_separator_insert (char sep) 3193 base_lexer::maybe_warn_separator_insert (char sep)
3192 { 3194 {
3193 std::string nm = fcn_file_full_name; 3195 std::string nm = m_fcn_file_full_name;
3194 3196
3195 if (nm.empty ()) 3197 if (nm.empty ())
3196 warning_with_id ("Octave:separator-insert", 3198 warning_with_id ("Octave:separator-insert",
3197 "potential auto-insertion of '%c' near line %d", 3199 "potential auto-insertion of '%c' near line %d",
3198 sep, input_line_number); 3200 sep, m_input_line_number);
3199 else 3201 else
3200 warning_with_id ("Octave:separator-insert", 3202 warning_with_id ("Octave:separator-insert",
3201 "potential auto-insertion of '%c' near line %d of file %s", 3203 "potential auto-insertion of '%c' near line %d of file %s",
3202 sep, input_line_number, nm.c_str ()); 3204 sep, m_input_line_number, nm.c_str ());
3203 } 3205 }
3204 3206
3205 void 3207 void
3206 base_lexer::warn_single_quote_string (void) 3208 base_lexer::warn_single_quote_string (void)
3207 { 3209 {
3208 std::string nm = fcn_file_full_name; 3210 std::string nm = m_fcn_file_full_name;
3209 3211
3210 if (nm.empty ()) 3212 if (nm.empty ())
3211 warning_with_id ("Octave:single-quote-string", 3213 warning_with_id ("Octave:single-quote-string",
3212 "single quote delimited string near line %d", 3214 "single quote delimited string near line %d",
3213 input_line_number); 3215 m_input_line_number);
3214 else 3216 else
3215 warning_with_id ("Octave:single-quote-string", 3217 warning_with_id ("Octave:single-quote-string",
3216 "single quote delimited string near line %d of file %s", 3218 "single quote delimited string near line %d of file %s",
3217 input_line_number, nm.c_str ()); 3219 m_input_line_number, nm.c_str ());
3218 } 3220 }
3219 3221
3220 void 3222 void
3221 base_lexer::warn_language_extension (const std::string& msg) 3223 base_lexer::warn_language_extension (const std::string& msg)
3222 { 3224 {
3223 std::string nm = fcn_file_full_name; 3225 std::string nm = m_fcn_file_full_name;
3224 3226
3225 if (nm.empty ()) 3227 if (nm.empty ())
3226 warning_with_id ("Octave:language-extension", 3228 warning_with_id ("Octave:language-extension",
3227 "Octave language extension used: %s", 3229 "Octave language extension used: %s",
3228 msg.c_str ()); 3230 msg.c_str ());
3229 else 3231 else
3230 warning_with_id ("Octave:language-extension", 3232 warning_with_id ("Octave:language-extension",
3231 "Octave language extension used: %s near line %d offile %s", 3233 "Octave language extension used: %s near line %d offile %s",
3232 msg.c_str (), input_line_number, nm.c_str ()); 3234 msg.c_str (), m_input_line_number, nm.c_str ());
3233 } 3235 }
3234 3236
3235 void 3237 void
3236 base_lexer::maybe_warn_language_extension_comment (char c) 3238 base_lexer::maybe_warn_language_extension_comment (char c)
3237 { 3239 {
3256 } 3258 }
3257 3259
3258 void 3260 void
3259 base_lexer::push_token (token *tok) 3261 base_lexer::push_token (token *tok)
3260 { 3262 {
3261 YYSTYPE *lval = yyget_lval (scanner); 3263 YYSTYPE *lval = yyget_lval (m_scanner);
3262 lval->tok_val = tok; 3264 lval->tok_val = tok;
3263 tokens.push (tok); 3265 m_tokens.push (tok);
3264 } 3266 }
3265 3267
3266 token * 3268 token *
3267 base_lexer::current_token (void) 3269 base_lexer::current_token (void)
3268 { 3270 {
3269 YYSTYPE *lval = yyget_lval (scanner); 3271 YYSTYPE *lval = yyget_lval (m_scanner);
3270 return lval->tok_val; 3272 return lval->tok_val;
3271 } 3273 }
3272 3274
3273 void 3275 void
3274 base_lexer::display_token (int tok) 3276 base_lexer::display_token (int tok)
3551 base_lexer::handle_op_internal (int tok, bool bos, bool compat) 3553 base_lexer::handle_op_internal (int tok, bool bos, bool compat)
3552 { 3554 {
3553 if (! compat) 3555 if (! compat)
3554 warn_language_extension_operator (flex_yytext ()); 3556 warn_language_extension_operator (flex_yytext ());
3555 3557
3556 push_token (new token (tok, input_line_number, current_input_column)); 3558 push_token (new token (tok, m_input_line_number, m_current_input_column));
3557 3559
3558 current_input_column += flex_yyleng (); 3560 m_current_input_column += flex_yyleng ();
3559 looking_for_object_index = false; 3561 m_looking_for_object_index = false;
3560 at_beginning_of_statement = bos; 3562 m_at_beginning_of_statement = bos;
3561 3563
3562 return count_token_internal (tok); 3564 return count_token_internal (tok);
3563 } 3565 }
3564 3566
3565 int 3567 int
3566 base_lexer::handle_token (const std::string& name, int tok) 3568 base_lexer::handle_token (const std::string& name, int tok)
3567 { 3569 {
3568 token *tok_val = new token (tok, name, input_line_number, 3570 token *tok_val = new token (tok, name, m_input_line_number,
3569 current_input_column); 3571 m_current_input_column);
3570 3572
3571 return handle_token (tok, tok_val); 3573 return handle_token (tok, tok_val);
3572 } 3574 }
3573 3575
3574 int 3576 int
3575 base_lexer::handle_token (int tok, token *tok_val) 3577 base_lexer::handle_token (int tok, token *tok_val)
3576 { 3578 {
3577 if (! tok_val) 3579 if (! tok_val)
3578 tok_val = new token (tok, input_line_number, current_input_column); 3580 tok_val = new token (tok, m_input_line_number, m_current_input_column);
3579 3581
3580 push_token (tok_val); 3582 push_token (tok_val);
3581 3583
3582 current_input_column += flex_yyleng (); 3584 m_current_input_column += flex_yyleng ();
3583 3585
3584 return count_token_internal (tok); 3586 return count_token_internal (tok);
3585 } 3587 }
3586 3588
3587 int 3589 int
3588 base_lexer::count_token (int tok) 3590 base_lexer::count_token (int tok)
3589 { 3591 {
3590 token *tok_val = new token (tok, input_line_number, current_input_column); 3592 token *tok_val = new token (tok, m_input_line_number, m_current_input_column);
3591 3593
3592 push_token (tok_val); 3594 push_token (tok_val);
3593 3595
3594 return count_token_internal (tok); 3596 return count_token_internal (tok);
3595 } 3597 }
3598 base_lexer::count_token_internal (int tok) 3600 base_lexer::count_token_internal (int tok)
3599 { 3601 {
3600 if (tok != '\n') 3602 if (tok != '\n')
3601 { 3603 {
3602 Vtoken_count++; 3604 Vtoken_count++;
3603 token_count++; 3605 m_token_count++;
3604 } 3606 }
3605 3607
3606 return show_token (tok); 3608 return show_token (tok);
3607 } 3609 }
3608 3610
3631 int 3633 int
3632 lexer::fill_flex_buffer (char *buf, unsigned max_size) 3634 lexer::fill_flex_buffer (char *buf, unsigned max_size)
3633 { 3635 {
3634 int status = 0; 3636 int status = 0;
3635 3637
3636 if (input_buf.empty ()) 3638 if (m_input_buf.empty ())
3637 { 3639 {
3638 bool eof = false; 3640 bool eof = false;
3639 current_input_line = reader.get_input (eof); 3641 m_current_input_line = m_reader.get_input (eof);
3640 3642
3641 input_buf.fill (current_input_line, eof); 3643 m_input_buf.fill (m_current_input_line, eof);
3642 3644
3643 // Attempt to capture text for functions defined on the 3645 // Attempt to capture text for functions defined on the
3644 // command line. 3646 // command line.
3645 // 3647 //
3646 // FIXME: the handling of newline here seems a bit clumsy. 3648 // FIXME: the handling of newline here seems a bit clumsy.
3647 // 3649 //
3648 // See also comments in push_lexer::append_input. 3650 // See also comments in push_lexer::append_input.
3649 3651
3650 if (buffer_function_text) 3652 if (m_buffer_function_text)
3651 { 3653 {
3652 if (! current_input_line.empty ()) 3654 if (! m_current_input_line.empty ())
3653 { 3655 {
3654 function_text += current_input_line; 3656 m_function_text += m_current_input_line;
3655 if (current_input_line.back () != '\n') 3657 if (m_current_input_line.back () != '\n')
3656 function_text += '\n'; 3658 m_function_text += '\n';
3657 } 3659 }
3658 } 3660 }
3659 } 3661 }
3660 3662
3661 if (! input_buf.empty ()) 3663 if (! m_input_buf.empty ())
3662 status = input_buf.copy_chunk (buf, max_size); 3664 status = m_input_buf.copy_chunk (buf, max_size);
3663 else 3665 else
3664 status = YY_NULL; 3666 status = YY_NULL;
3665 3667
3666 return status; 3668 return status;
3667 } 3669 }
3672 // FIXME: input may contain more than one line, so how can we 3674 // FIXME: input may contain more than one line, so how can we
3673 // properly start buffering input for command-line functions? 3675 // properly start buffering input for command-line functions?
3674 // 3676 //
3675 // Currently, base_lexer::is_keyword_token starts buffering text 3677 // Currently, base_lexer::is_keyword_token starts buffering text
3676 // for command-line functions by setting the initial value of 3678 // for command-line functions by setting the initial value of
3677 // function_text to current_input_line when function_kw is 3679 // m_function_text to m_current_input_line when function_kw is
3678 // recognized. To make that work, we need to do something like 3680 // recognized. To make that work, we need to do something like
3679 // maintain a queue of input strings and pass them to the flex 3681 // maintain a queue of input strings and pass them to the flex
3680 // buffer one line at a time, while also setting 3682 // buffer one line at a time, while also setting
3681 // current_input_line. Some care will be needed if a single line 3683 // m_current_input_line. Some care will be needed if a single line
3682 // of input arrives in multiple calls to append_input. 3684 // of input arrives in multiple calls to append_input.
3683 3685
3684 input_buf.fill (input, eof); 3686 m_input_buf.fill (input, eof);
3685 } 3687 }
3686 3688
3687 int 3689 int
3688 push_lexer::fill_flex_buffer (char *buf, unsigned max_size) 3690 push_lexer::fill_flex_buffer (char *buf, unsigned max_size)
3689 { 3691 {
3690 int status = 0; 3692 int status = 0;
3691 3693
3692 if (input_buf.empty () && ! input_buf.at_eof ()) 3694 if (m_input_buf.empty () && ! m_input_buf.at_eof ())
3693 input_buf.fill (std::string (1, static_cast<char> (1)), false); 3695 m_input_buf.fill (std::string (1, static_cast<char> (1)), false);
3694 3696
3695 if (! input_buf.empty ()) 3697 if (! m_input_buf.empty ())
3696 status = input_buf.copy_chunk (buf, max_size); 3698 status = m_input_buf.copy_chunk (buf, max_size);
3697 else 3699 else
3698 status = YY_NULL; 3700 status = YY_NULL;
3699 3701
3700 return status; 3702 return status;
3701 } 3703 }