comparison libinterp/parse-tree/oct-parse.yy @ 27762:80d68a3e8ec0

make location info available for more tokens in parser * oct-parse.yy: Use tok_val instead of dummy_type for single character tokens '(' ')' '[' ']' '{' '}' '.' '@' ',' ';' '\n'. For now, tag all as unused in the grammer.
author John W. Eaton <jwe@octave.org>
date Mon, 02 Dec 2019 01:16:12 -0600
parents 7a45100a40c4
children f64e399b6dda
comparison
equal deleted inserted replaced
27761:223981108144 27762:80d68a3e8ec0
187 octave::tree_classdef_enum_block* tree_classdef_enum_block_type; 187 octave::tree_classdef_enum_block* tree_classdef_enum_block_type;
188 } 188 }
189 189
190 // Tokens with line and column information. 190 // Tokens with line and column information.
191 %token <tok_val> '=' ':' '-' '+' '*' '/' 191 %token <tok_val> '=' ':' '-' '+' '*' '/'
192 %token <tok_val> '(' ')' '[' ']' '{' '}' '.' '@'
193 %token <tok_val> ',' ';' '\n'
192 %token <tok_val> ADD_EQ SUB_EQ MUL_EQ DIV_EQ LEFTDIV_EQ POW_EQ 194 %token <tok_val> ADD_EQ SUB_EQ MUL_EQ DIV_EQ LEFTDIV_EQ POW_EQ
193 %token <tok_val> EMUL_EQ EDIV_EQ ELEFTDIV_EQ EPOW_EQ AND_EQ OR_EQ 195 %token <tok_val> EMUL_EQ EDIV_EQ ELEFTDIV_EQ EPOW_EQ AND_EQ OR_EQ
194 %token <tok_val> EXPR_AND_AND EXPR_OR_OR 196 %token <tok_val> EXPR_AND_AND EXPR_OR_OR
195 %token <tok_val> EXPR_AND EXPR_OR EXPR_NOT 197 %token <tok_val> EXPR_AND EXPR_OR EXPR_NOT
196 %token <tok_val> EXPR_LT EXPR_LE EXPR_EQ EXPR_NE EXPR_GE EXPR_GT 198 %token <tok_val> EXPR_LT EXPR_LE EXPR_EQ EXPR_NE EXPR_GE EXPR_GT
221 223
222 // Other tokens. 224 // Other tokens.
223 %token<dummy_type> END_OF_INPUT 225 %token<dummy_type> END_OF_INPUT
224 %token<dummy_type> INPUT_FILE 226 %token<dummy_type> INPUT_FILE
225 // %token VARARGIN VARARGOUT 227 // %token VARARGIN VARARGOUT
226
227 %token<dummy_type> '(' ')' '[' ']' '{' '}' '.' ',' ';' '@' '\n'
228 228
229 // Nonterminals we construct. 229 // Nonterminals we construct.
230 %type <dummy_type> indirect_ref_op decl_param_init 230 %type <dummy_type> indirect_ref_op decl_param_init
231 %type <dummy_type> push_fcn_symtab push_script_symtab begin_file 231 %type <dummy_type> push_fcn_symtab push_script_symtab begin_file
232 %type <dummy_type> param_list_beg param_list_end stmt_begin anon_fcn_begin 232 %type <dummy_type> param_list_beg param_list_end stmt_begin anon_fcn_begin
380 // Statements and statement lists 380 // Statements and statement lists
381 // ============================== 381 // ==============================
382 382
383 input : simple_list '\n' 383 input : simple_list '\n'
384 { 384 {
385 YYUSE ($2);
386
385 $$ = nullptr; 387 $$ = nullptr;
386 parser.statement_list (std::shared_ptr<octave::tree_statement_list> ($1)); 388 parser.statement_list (std::shared_ptr<octave::tree_statement_list> ($1));
387 YYACCEPT; 389 YYACCEPT;
388 } 390 }
389 | simple_list END_OF_INPUT 391 | simple_list END_OF_INPUT
541 | string 543 | string
542 { $$ = $1; } 544 { $$ = $1; }
543 ; 545 ;
544 546
545 matrix : '[' matrix_rows ']' 547 matrix : '[' matrix_rows ']'
546 { $$ = parser.finish_matrix ($2); } 548 {
549 YYUSE ($1);
550 YYUSE ($3);
551
552 $$ = parser.finish_matrix ($2);
553 }
547 ; 554 ;
548 555
549 matrix_rows : cell_or_matrix_row 556 matrix_rows : cell_or_matrix_row
550 { $$ = $1 ? new octave::tree_matrix ($1) : nullptr; } 557 { $$ = $1 ? new octave::tree_matrix ($1) : nullptr; }
551 | matrix_rows ';' cell_or_matrix_row 558 | matrix_rows ';' cell_or_matrix_row
552 { 559 {
560 YYUSE ($2);
561
553 if ($1) 562 if ($1)
554 { 563 {
555 if ($3) 564 if ($3)
556 $1->append ($3); 565 $1->append ($3);
557 566
561 $$ = $3 ? new octave::tree_matrix ($3) : nullptr; 570 $$ = $3 ? new octave::tree_matrix ($3) : nullptr;
562 } 571 }
563 ; 572 ;
564 573
565 cell : '{' cell_rows '}' 574 cell : '{' cell_rows '}'
566 { $$ = parser.finish_cell ($2); } 575 {
576 YYUSE ($1);
577 YYUSE ($3);
578
579 $$ = parser.finish_cell ($2);
580 }
567 ; 581 ;
568 582
569 cell_rows : cell_or_matrix_row 583 cell_rows : cell_or_matrix_row
570 { $$ = $1 ? new octave::tree_cell ($1) : nullptr; } 584 { $$ = $1 ? new octave::tree_cell ($1) : nullptr; }
571 | cell_rows ';' cell_or_matrix_row 585 | cell_rows ';' cell_or_matrix_row
572 { 586 {
587 YYUSE ($2);
588
573 if ($1) 589 if ($1)
574 { 590 {
575 if ($3) 591 if ($3)
576 $1->append ($3); 592 $1->append ($3);
577 593
587 603
588 cell_or_matrix_row 604 cell_or_matrix_row
589 : // empty 605 : // empty
590 { $$ = nullptr; } 606 { $$ = nullptr; }
591 | ',' 607 | ','
592 { $$ = nullptr; } 608 {
609 YYUSE ($1);
610
611 $$ = nullptr;
612 }
593 | arg_list 613 | arg_list
594 { $$ = $1; } 614 { $$ = $1; }
595 | arg_list ',' 615 | arg_list ','
596 { $$ = $1; } 616 {
617 YYUSE ($2);
618
619 $$ = $1;
620 }
597 | ',' arg_list 621 | ',' arg_list
598 { $$ = $2; } 622 {
623 YYUSE ($1);
624
625 $$ = $2;
626 }
599 | ',' arg_list ',' 627 | ',' arg_list ','
600 { $$ = $2; } 628 {
629 YYUSE ($1);
630 YYUSE ($3);
631
632 $$ = $2;
633 }
601 ; 634 ;
602 635
603 fcn_handle : FCN_HANDLE 636 fcn_handle : FCN_HANDLE
604 { $$ = parser.make_fcn_handle ($1); } 637 { $$ = parser.make_fcn_handle ($1); }
605 ; 638 ;
608 // flag after recognizing the parameter list because we don't want to 641 // flag after recognizing the parameter list because we don't want to
609 // accept word list commands in anonymous function bodies. 642 // accept word list commands in anonymous function bodies.
610 643
611 anon_fcn_handle : '@' param_list anon_fcn_begin expression 644 anon_fcn_handle : '@' param_list anon_fcn_begin expression
612 { 645 {
646 YYUSE ($1);
647
613 $$ = parser.make_anon_fcn_handle ($2, $4); 648 $$ = parser.make_anon_fcn_handle ($2, $4);
614 if (! $$) 649 if (! $$)
615 { 650 {
616 // make_anon_fcn_handle deleted $2 and $4. 651 // make_anon_fcn_handle deleted $2 and $4.
617 YYABORT; 652 YYABORT;
620 lexer.m_parsing_anon_fcn_body = false; 655 lexer.m_parsing_anon_fcn_body = false;
621 lexer.m_nesting_level.remove (); 656 lexer.m_nesting_level.remove ();
622 } 657 }
623 | '@' param_list anon_fcn_begin error 658 | '@' param_list anon_fcn_begin error
624 { 659 {
660 YYUSE ($1);
625 YYUSE ($2); 661 YYUSE ($2);
626 662
627 lexer.m_parsing_anon_fcn_body = false; 663 lexer.m_parsing_anon_fcn_body = false;
628 664
629 $$ = nullptr; 665 $$ = nullptr;
648 | meta_identifier 684 | meta_identifier
649 { $$ = $1; } 685 { $$ = $1; }
650 | superclass_identifier 686 | superclass_identifier
651 { $$ = $1; } 687 { $$ = $1; }
652 | '(' expression ')' 688 | '(' expression ')'
653 { $$ = $2->mark_in_parens (); } 689 {
690 YYUSE ($1);
691 YYUSE ($3);
692
693 $$ = $2->mark_in_parens ();
694 }
654 ; 695 ;
655 696
656 magic_colon : ':' 697 magic_colon : ':'
657 { 698 {
658 YYUSE ($1); 699 YYUSE ($1);
676 { $$ = new octave::tree_argument_list ($1); } 717 { $$ = new octave::tree_argument_list ($1); }
677 | magic_tilde 718 | magic_tilde
678 { $$ = new octave::tree_argument_list ($1); } 719 { $$ = new octave::tree_argument_list ($1); }
679 | arg_list ',' magic_colon 720 | arg_list ',' magic_colon
680 { 721 {
722 YYUSE ($2);
723
681 $1->append ($3); 724 $1->append ($3);
682 $$ = $1; 725 $$ = $1;
683 } 726 }
684 | arg_list ',' magic_tilde 727 | arg_list ',' magic_tilde
685 { 728 {
729 YYUSE ($2);
730
686 $1->append ($3); 731 $1->append ($3);
687 $$ = $1; 732 $$ = $1;
688 } 733 }
689 | arg_list ',' expression 734 | arg_list ',' expression
690 { 735 {
736 YYUSE ($2);
737
691 $1->append ($3); 738 $1->append ($3);
692 $$ = $1; 739 $$ = $1;
693 } 740 }
694 ; 741 ;
695 742
696 indirect_ref_op : '.' 743 indirect_ref_op : '.'
697 { 744 {
745 YYUSE ($1);
746
698 $$ = 0; 747 $$ = 0;
699 lexer.m_looking_at_indirect_ref = true; 748 lexer.m_looking_at_indirect_ref = true;
700 } 749 }
701 ; 750 ;
702 751
706 { $$ = parser.make_postfix_op (PLUS_PLUS, $1, $2); } 755 { $$ = parser.make_postfix_op (PLUS_PLUS, $1, $2); }
707 | oper_expr MINUS_MINUS 756 | oper_expr MINUS_MINUS
708 { $$ = parser.make_postfix_op (MINUS_MINUS, $1, $2); } 757 { $$ = parser.make_postfix_op (MINUS_MINUS, $1, $2); }
709 | oper_expr '(' ')' 758 | oper_expr '(' ')'
710 { 759 {
760 YYUSE ($2);
761 YYUSE ($3);
762
711 $$ = parser.make_index_expression ($1, nullptr, '('); 763 $$ = parser.make_index_expression ($1, nullptr, '(');
712 if (! $$) 764 if (! $$)
713 { 765 {
714 // make_index_expression deleted $1. 766 // make_index_expression deleted $1.
715 YYABORT; 767 YYABORT;
716 } 768 }
717 } 769 }
718 | oper_expr '(' arg_list ')' 770 | oper_expr '(' arg_list ')'
719 { 771 {
772 YYUSE ($2);
773 YYUSE ($4);
774
720 $$ = parser.make_index_expression ($1, $3, '('); 775 $$ = parser.make_index_expression ($1, $3, '(');
721 if (! $$) 776 if (! $$)
722 { 777 {
723 // make_index_expression deleted $1 and $3. 778 // make_index_expression deleted $1 and $3.
724 YYABORT; 779 YYABORT;
725 } 780 }
726 } 781 }
727 | oper_expr '{' '}' 782 | oper_expr '{' '}'
728 { 783 {
784 YYUSE ($2);
785 YYUSE ($3);
786
729 $$ = parser.make_index_expression ($1, nullptr, '{'); 787 $$ = parser.make_index_expression ($1, nullptr, '{');
730 if (! $$) 788 if (! $$)
731 { 789 {
732 // make_index_expression deleted $1. 790 // make_index_expression deleted $1.
733 YYABORT; 791 YYABORT;
734 } 792 }
735 } 793 }
736 | oper_expr '{' arg_list '}' 794 | oper_expr '{' arg_list '}'
737 { 795 {
796 YYUSE ($2);
797 YYUSE ($4);
798
738 $$ = parser.make_index_expression ($1, $3, '{'); 799 $$ = parser.make_index_expression ($1, $3, '{');
739 if (! $$) 800 if (! $$)
740 { 801 {
741 // make_index_expression deleted $1 and $3. 802 // make_index_expression deleted $1 and $3.
742 YYABORT; 803 YYABORT;
747 | oper_expr TRANSPOSE 808 | oper_expr TRANSPOSE
748 { $$ = parser.make_postfix_op (TRANSPOSE, $1, $2); } 809 { $$ = parser.make_postfix_op (TRANSPOSE, $1, $2); }
749 | oper_expr indirect_ref_op STRUCT_ELT 810 | oper_expr indirect_ref_op STRUCT_ELT
750 { $$ = parser.make_indirect_ref ($1, $3->text ()); } 811 { $$ = parser.make_indirect_ref ($1, $3->text ()); }
751 | oper_expr indirect_ref_op '(' expression ')' 812 | oper_expr indirect_ref_op '(' expression ')'
752 { $$ = parser.make_indirect_ref ($1, $4); } 813 {
814 YYUSE ($3);
815 YYUSE ($5);
816
817 $$ = parser.make_indirect_ref ($1, $4);
818 }
753 | PLUS_PLUS oper_expr %prec UNARY 819 | PLUS_PLUS oper_expr %prec UNARY
754 { $$ = parser.make_prefix_op (PLUS_PLUS, $2, $1); } 820 { $$ = parser.make_prefix_op (PLUS_PLUS, $2, $1); }
755 | MINUS_MINUS oper_expr %prec UNARY 821 | MINUS_MINUS oper_expr %prec UNARY
756 { $$ = parser.make_prefix_op (MINUS_MINUS, $2, $1); } 822 { $$ = parser.make_prefix_op (MINUS_MINUS, $2, $1); }
757 | EXPR_NOT oper_expr %prec UNARY 823 | EXPR_NOT oper_expr %prec UNARY
792 { $$ = parser.make_postfix_op (PLUS_PLUS, $1, $2); } 858 { $$ = parser.make_postfix_op (PLUS_PLUS, $1, $2); }
793 | power_expr MINUS_MINUS 859 | power_expr MINUS_MINUS
794 { $$ = parser.make_postfix_op (MINUS_MINUS, $1, $2); } 860 { $$ = parser.make_postfix_op (MINUS_MINUS, $1, $2); }
795 | power_expr '(' ')' 861 | power_expr '(' ')'
796 { 862 {
863 YYUSE ($2);
864 YYUSE ($3);
865
797 $$ = parser.make_index_expression ($1, nullptr, '('); 866 $$ = parser.make_index_expression ($1, nullptr, '(');
798 if (! $$) 867 if (! $$)
799 { 868 {
800 // make_index_expression deleted $1. 869 // make_index_expression deleted $1.
801 YYABORT; 870 YYABORT;
802 } 871 }
803 } 872 }
804 | power_expr '(' arg_list ')' 873 | power_expr '(' arg_list ')'
805 { 874 {
875 YYUSE ($2);
876 YYUSE ($4);
877
806 $$ = parser.make_index_expression ($1, $3, '('); 878 $$ = parser.make_index_expression ($1, $3, '(');
807 if (! $$) 879 if (! $$)
808 { 880 {
809 // make_index_expression deleted $1 and $3. 881 // make_index_expression deleted $1 and $3.
810 YYABORT; 882 YYABORT;
811 } 883 }
812 } 884 }
813 | power_expr '{' '}' 885 | power_expr '{' '}'
814 { 886 {
887 YYUSE ($2);
888 YYUSE ($3);
889
815 $$ = parser.make_index_expression ($1, nullptr, '{'); 890 $$ = parser.make_index_expression ($1, nullptr, '{');
816 if (! $$) 891 if (! $$)
817 { 892 {
818 // make_index_expression deleted $1. 893 // make_index_expression deleted $1.
819 YYABORT; 894 YYABORT;
820 } 895 }
821 } 896 }
822 | power_expr '{' arg_list '}' 897 | power_expr '{' arg_list '}'
823 { 898 {
899 YYUSE ($2);
900 YYUSE ($4);
901
824 $$ = parser.make_index_expression ($1, $3, '{'); 902 $$ = parser.make_index_expression ($1, $3, '{');
825 if (! $$) 903 if (! $$)
826 { 904 {
827 // make_index_expression deleted $1 and $3. 905 // make_index_expression deleted $1 and $3.
828 YYABORT; 906 YYABORT;
829 } 907 }
830 } 908 }
831 | power_expr indirect_ref_op STRUCT_ELT 909 | power_expr indirect_ref_op STRUCT_ELT
832 { $$ = parser.make_indirect_ref ($1, $3->text ()); } 910 { $$ = parser.make_indirect_ref ($1, $3->text ()); }
833 | power_expr indirect_ref_op '(' expression ')' 911 | power_expr indirect_ref_op '(' expression ')'
834 { $$ = parser.make_indirect_ref ($1, $4); } 912 {
913 YYUSE ($3);
914 YYUSE ($5);
915
916 $$ = parser.make_indirect_ref ($1, $4);
917 }
835 | PLUS_PLUS power_expr %prec POW 918 | PLUS_PLUS power_expr %prec POW
836 { $$ = parser.make_prefix_op (PLUS_PLUS, $2, $1); } 919 { $$ = parser.make_prefix_op (PLUS_PLUS, $2, $1); }
837 | MINUS_MINUS power_expr %prec POW 920 | MINUS_MINUS power_expr %prec POW
838 { $$ = parser.make_prefix_op (MINUS_MINUS, $2, $1); } 921 { $$ = parser.make_prefix_op (MINUS_MINUS, $2, $1); }
839 | EXPR_NOT power_expr %prec POW 922 | EXPR_NOT power_expr %prec POW
1186 YYABORT; 1269 YYABORT;
1187 } 1270 }
1188 } 1271 }
1189 | FOR stash_comment '(' assign_lhs '=' expression ')' opt_sep opt_list END 1272 | FOR stash_comment '(' assign_lhs '=' expression ')' opt_sep opt_list END
1190 { 1273 {
1274 YYUSE ($3);
1191 YYUSE ($5); 1275 YYUSE ($5);
1276 YYUSE ($7);
1192 YYUSE ($8); 1277 YYUSE ($8);
1193 1278
1194 if (! ($$ = parser.make_for_command (FOR, $1, $4, $6, 1279 if (! ($$ = parser.make_for_command (FOR, $1, $4, $6,
1195 nullptr, $9, $10, $2))) 1280 nullptr, $9, $10, $2)))
1196 { 1281 {
1210 YYABORT; 1295 YYABORT;
1211 } 1296 }
1212 } 1297 }
1213 | PARFOR stash_comment '(' assign_lhs '=' expression ',' expression ')' opt_sep opt_list END 1298 | PARFOR stash_comment '(' assign_lhs '=' expression ',' expression ')' opt_sep opt_list END
1214 { 1299 {
1300 YYUSE ($3);
1215 YYUSE ($5); 1301 YYUSE ($5);
1302 YYUSE ($7);
1303 YYUSE ($9);
1216 YYUSE ($10); 1304 YYUSE ($10);
1217 1305
1218 if (! ($$ = parser.make_for_command (PARFOR, $1, $4, $6, 1306 if (! ($$ = parser.make_for_command (PARFOR, $1, $4, $6,
1219 $8, $11, $12, $2))) 1307 $8, $11, $12, $2)))
1220 { 1308 {
1302 // List of function parameters 1390 // List of function parameters
1303 // =========================== 1391 // ===========================
1304 1392
1305 param_list_beg : '(' 1393 param_list_beg : '('
1306 { 1394 {
1395 YYUSE ($1);
1396
1307 $$ = 0; 1397 $$ = 0;
1308 lexer.m_looking_at_parameter_list = true; 1398 lexer.m_looking_at_parameter_list = true;
1309 1399
1310 if (lexer.m_looking_at_function_handle) 1400 if (lexer.m_looking_at_function_handle)
1311 { 1401 {
1317 } 1407 }
1318 ; 1408 ;
1319 1409
1320 param_list_end : ')' 1410 param_list_end : ')'
1321 { 1411 {
1412 YYUSE ($1);
1413
1322 $$ = 0; 1414 $$ = 0;
1323 lexer.m_looking_at_parameter_list = false; 1415 lexer.m_looking_at_parameter_list = false;
1324 lexer.m_looking_for_object_index = false; 1416 lexer.m_looking_for_object_index = false;
1325 } 1417 }
1326 ; 1418 ;
1367 1459
1368 param_list2 : param_list_elt 1460 param_list2 : param_list_elt
1369 { $$ = new octave::tree_parameter_list ($1); } 1461 { $$ = new octave::tree_parameter_list ($1); }
1370 | param_list2 ',' param_list_elt 1462 | param_list2 ',' param_list_elt
1371 { 1463 {
1464 YYUSE ($2);
1465
1372 $1->append ($3); 1466 $1->append ($3);
1373 $$ = $1; 1467 $$ = $1;
1374 } 1468 }
1375 ; 1469 ;
1376 1470
1384 // List of function return value names 1478 // List of function return value names
1385 // =================================== 1479 // ===================================
1386 1480
1387 return_list : '[' ']' 1481 return_list : '[' ']'
1388 { 1482 {
1483 YYUSE ($1);
1484 YYUSE ($2);
1485
1389 lexer.m_looking_at_return_list = false; 1486 lexer.m_looking_at_return_list = false;
1390 1487
1391 $$ = new octave::tree_parameter_list (); 1488 $$ = new octave::tree_parameter_list ();
1392 } 1489 }
1393 | identifier 1490 | identifier
1408 YYABORT; 1505 YYABORT;
1409 } 1506 }
1410 } 1507 }
1411 | '[' return_list1 ']' 1508 | '[' return_list1 ']'
1412 { 1509 {
1510 YYUSE ($1);
1511 YYUSE ($3);
1512
1413 lexer.m_looking_at_return_list = false; 1513 lexer.m_looking_at_return_list = false;
1414 1514
1415 // Check for duplicate parameter names, varargin, 1515 // Check for duplicate parameter names, varargin,
1416 // or varargout. 1516 // or varargout.
1417 1517
1427 1527
1428 return_list1 : identifier 1528 return_list1 : identifier
1429 { $$ = new octave::tree_parameter_list (new octave::tree_decl_elt ($1)); } 1529 { $$ = new octave::tree_parameter_list (new octave::tree_decl_elt ($1)); }
1430 | return_list1 ',' identifier 1530 | return_list1 ',' identifier
1431 { 1531 {
1532 YYUSE ($2);
1533
1432 $1->append (new octave::tree_decl_elt ($3)); 1534 $1->append (new octave::tree_decl_elt ($3));
1433 $$ = $1; 1535 $$ = $1;
1434 } 1536 }
1435 ; 1537 ;
1436 1538
1523 } 1625 }
1524 } 1626 }
1525 | GET '.' identifier 1627 | GET '.' identifier
1526 { 1628 {
1527 YYUSE ($1); 1629 YYUSE ($1);
1630 YYUSE ($2);
1528 1631
1529 lexer.m_parsed_function_name.top () = true; 1632 lexer.m_parsed_function_name.top () = true;
1530 lexer.m_maybe_classdef_get_set_method = false; 1633 lexer.m_maybe_classdef_get_set_method = false;
1531 lexer.m_parsing_classdef_get_method = true; 1634 lexer.m_parsing_classdef_get_method = true;
1532 $$ = $3; 1635 $$ = $3;
1533 } 1636 }
1534 | SET '.' identifier 1637 | SET '.' identifier
1535 { 1638 {
1536 YYUSE ($1); 1639 YYUSE ($1);
1640 YYUSE ($2);
1537 1641
1538 lexer.m_parsed_function_name.top () = true; 1642 lexer.m_parsed_function_name.top () = true;
1539 lexer.m_maybe_classdef_get_set_method = false; 1643 lexer.m_maybe_classdef_get_set_method = false;
1540 lexer.m_parsing_classdef_set_method = true; 1644 lexer.m_parsing_classdef_set_method = true;
1541 $$ = $3; 1645 $$ = $3;
1657 ; 1761 ;
1658 1762
1659 opt_attr_list : // empty 1763 opt_attr_list : // empty
1660 { $$ = nullptr; } 1764 { $$ = nullptr; }
1661 | '(' attr_list ')' 1765 | '(' attr_list ')'
1662 { $$ = $2; } 1766 {
1767 YYUSE ($1);
1768 YYUSE ($3);
1769
1770 $$ = $2;
1771 }
1663 ; 1772 ;
1664 1773
1665 attr_list : attr 1774 attr_list : attr
1666 { $$ = new octave::tree_classdef_attribute_list ($1); } 1775 { $$ = new octave::tree_classdef_attribute_list ($1); }
1667 | attr_list ',' attr 1776 | attr_list ',' attr
1668 { 1777 {
1778 YYUSE ($2);
1779
1669 $1->append ($3); 1780 $1->append ($3);
1670 $$ = $1; 1781 $$ = $1;
1671 } 1782 }
1672 ; 1783 ;
1673 1784
1967 $$ = $1; 2078 $$ = $1;
1968 } 2079 }
1969 ; 2080 ;
1970 2081
1971 class_enum : identifier '(' expression ')' 2082 class_enum : identifier '(' expression ')'
1972 { $$ = new octave::tree_classdef_enum ($1, $3); } 2083 {
2084 YYUSE ($2);
2085 YYUSE ($4);
2086
2087 $$ = new octave::tree_classdef_enum ($1, $3);
2088 }
1973 ; 2089 ;
1974 2090
1975 // ============= 2091 // =============
1976 // Miscellaneous 2092 // Miscellaneous
1977 // ============= 2093 // =============
2004 | error 2120 | error
2005 { $$ = 0; } 2121 { $$ = 0; }
2006 ; 2122 ;
2007 2123
2008 sep_no_nl : ',' 2124 sep_no_nl : ','
2009 { $$ = ','; } 2125 {
2126 YYUSE ($1);
2127
2128 $$ = ',';
2129 }
2010 | ';' 2130 | ';'
2011 { $$ = ';'; } 2131 {
2132 YYUSE ($1);
2133
2134 $$ = ';';
2135 }
2012 | sep_no_nl ',' 2136 | sep_no_nl ','
2013 { $$ = $1; } 2137 {
2138 YYUSE ($2);
2139
2140 $$ = $1;
2141 }
2014 | sep_no_nl ';' 2142 | sep_no_nl ';'
2015 { $$ = $1; } 2143 {
2144 YYUSE ($2);
2145
2146 $$ = $1;
2147 }
2016 ; 2148 ;
2017 2149
2018 opt_sep_no_nl : // empty 2150 opt_sep_no_nl : // empty
2019 { $$ = 0; } 2151 { $$ = 0; }
2020 | sep_no_nl 2152 | sep_no_nl
2026 | nl 2158 | nl
2027 { $$ = $1; } 2159 { $$ = $1; }
2028 ; 2160 ;
2029 2161
2030 nl : '\n' 2162 nl : '\n'
2031 { $$ = '\n'; } 2163 {
2164 YYUSE ($1);
2165
2166 $$ = '\n';
2167 }
2032 | nl '\n' 2168 | nl '\n'
2033 { $$ = $1; } 2169 {
2170 YYUSE ($2);
2171
2172 $$ = $1;
2173 }
2034 ; 2174 ;
2035 2175
2036 sep : ',' 2176 sep : ','
2037 { $$ = ','; } 2177 {
2178 YYUSE ($1);
2179
2180 $$ = ',';
2181 }
2038 | ';' 2182 | ';'
2039 { $$ = ';'; } 2183 {
2184 YYUSE ($1);
2185
2186 $$ = ';';
2187 }
2040 | '\n' 2188 | '\n'
2041 { $$ = '\n'; } 2189 {
2190 YYUSE ($1);
2191
2192 $$ = '\n';
2193 }
2042 | sep ',' 2194 | sep ','
2043 { $$ = $1; } 2195 {
2196 YYUSE ($2);
2197
2198 $$ = $1;
2199 }
2044 | sep ';' 2200 | sep ';'
2045 { $$ = $1; } 2201 {
2202 YYUSE ($2);
2203
2204 $$ = $1;
2205 }
2046 | sep '\n' 2206 | sep '\n'
2047 { $$ = $1; } 2207 {
2208 YYUSE ($2);
2209
2210 $$ = $1;
2211 }
2048 ; 2212 ;
2049 2213
2050 opt_sep : // empty 2214 opt_sep : // empty
2051 { $$ = 0; } 2215 { $$ = 0; }
2052 | sep 2216 | sep