Changes in uspace/app/sbi/src/parse.c [1ebc1a62:23de644] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/parse.c
r1ebc1a62 r23de644 79 79 static stree_except_t *parse_except(parse_t *parse); 80 80 81 /** Initialize parser object. 82 * 83 * Set up parser @a parse to use lexer @a lex for input and to store 84 * output (i.e. new declarations) to program @a prog. @a prog is not 85 * necessarily empty, the declarations being parsed are simply added 86 * to it. 87 * 88 * @param parse Parser object. 89 * @param prog Destination program stree. 90 * @param lex Input lexer. 91 */ 81 92 void parse_init(parse_t *parse, stree_program_t *prog, struct lex *lex) 82 93 { … … 91 102 } 92 103 93 /** Parse module. */ 104 /** Parse module. 105 * 106 * Parse a program module. 107 * 108 * The input is read using the lexer associated with @a parse. The resulting 109 * declarations are added to existing declarations in the program associated 110 * with @a parse. 111 * 112 * If any parse error occurs, parse->error will @c b_true when this function 113 * returns. parse->error_bailout will be @c b_true if the error has not 114 * been recovered yet. Similar holds for other parsing functions in this 115 * module. 116 * 117 * @param parse Parser object. 118 */ 94 119 void parse_module(parse_t *parse) 95 120 { … … 117 142 } 118 143 119 /** Parse class, struct or interface declaration. */ 144 /** Parse class, struct or interface declaration. 145 * 146 * @param parse Parser object. 147 * @param dclass What to parse: @c lc_class, @c lc_struct or @c lc_csi. 148 * @param outer_csi CSI containing this declaration or @c NULL if global. 149 * @return New syntax tree node. 150 */ 120 151 static stree_csi_t *parse_csi(parse_t *parse, lclass_t dclass, 121 152 stree_csi_t *outer_csi) … … 169 200 } 170 201 171 /** Parse class, struct or interface member. */ 202 /** Parse class, struct or interface member. 203 * 204 * @param parse Parser object. 205 * @param outer_csi CSI containing this declaration or @c NULL if global. 206 * @return New syntax tree node. 207 */ 172 208 static stree_csimbr_t *parse_csimbr(parse_t *parse, stree_csi_t *outer_csi) 173 209 { … … 211 247 212 248 213 /** Parse member function. */ 249 /** Parse member function. 250 * 251 * @param parse Parser object. 252 * @param outer_csi CSI containing this declaration or @c NULL if global. 253 * @return New syntax tree node. 254 */ 214 255 static stree_fun_t *parse_fun(parse_t *parse, stree_csi_t *outer_csi) 215 256 { … … 297 338 } 298 339 299 /** Parse member variable. */ 340 /** Parse member variable. 341 * 342 * @param parse Parser object. 343 * @param outer_csi CSI containing this declaration or @c NULL if global. 344 * @return New syntax tree node. 345 */ 300 346 static stree_var_t *parse_var(parse_t *parse, stree_csi_t *outer_csi) 301 347 { … … 318 364 } 319 365 320 /** Parse member property. */ 366 /** Parse member property. 367 * 368 * @param parse Parser object. 369 * @param outer_csi CSI containing this declaration or @c NULL if global. 370 * @return New syntax tree node. 371 */ 321 372 static stree_prop_t *parse_prop(parse_t *parse, stree_csi_t *outer_csi) 322 373 { … … 424 475 } 425 476 426 /** Parse symbol attribute. */ 477 /** Parse symbol attribute. 478 * 479 * @param parse Parser object. 480 * @param outer_csi CSI containing this declaration or @c NULL if global. 481 * @return New syntax tree node. 482 */ 427 483 static stree_symbol_attr_t *parse_symbol_attr(parse_t *parse) 428 484 { … … 442 498 } 443 499 444 /** Parse formal function argument. */ 500 /** Parse formal function argument. 501 * 502 * @param parse Parser object. 503 * @return New syntax tree node. 504 */ 445 505 static stree_proc_arg_t *parse_proc_arg(parse_t *parse) 446 506 { … … 468 528 } 469 529 470 /** Parse argument attribute. */ 530 /** Parse argument attribute. 531 * 532 * @param parse Parser object. 533 * @return New syntax tree node. 534 */ 471 535 static stree_arg_attr_t *parse_arg_attr(parse_t *parse) 472 536 { … … 486 550 } 487 551 488 /** Parse statement block. */ 552 /** Parse statement block. 553 * 554 * @param parse Parser object. 555 * @return New syntax tree node. 556 */ 489 557 static stree_block_t *parse_block(parse_t *parse) 490 558 { … … 509 577 } 510 578 511 /** Parse statement. */ 579 /** Parse statement. 580 * 581 * @param parse Parser object. 582 * @return New syntax tree node. 583 */ 512 584 stree_stat_t *parse_stat(parse_t *parse) 513 585 { … … 576 648 } 577 649 578 /** Parse variable declaration statement. */ 650 /** Parse variable declaration statement. 651 * 652 * @param parse Parser object. 653 * @return New syntax tree node. 654 */ 579 655 static stree_vdecl_t *parse_vdecl(parse_t *parse) 580 656 { … … 603 679 } 604 680 605 /** Parse @c if statement, */ 681 /** Parse @c if statement. 682 * 683 * @param parse Parser object. 684 * @return New syntax tree node. 685 */ 606 686 static stree_if_t *parse_if(parse_t *parse) 607 687 { … … 629 709 } 630 710 631 /** Parse @c while statement. */ 711 /** Parse @c while statement. 712 * 713 * @param parse Parser object. 714 */ 632 715 static stree_while_t *parse_while(parse_t *parse) 633 716 { … … 648 731 } 649 732 650 /** Parse @c for statement. */ 733 /** Parse @c for statement. 734 * 735 * @param parse Parser object. 736 * @return New syntax tree node. 737 */ 651 738 static stree_for_t *parse_for(parse_t *parse) 652 739 { … … 671 758 } 672 759 673 /** Parse @c raise statement. */ 760 /** Parse @c raise statement. 761 * 762 * @param parse Parser object. 763 */ 674 764 static stree_raise_t *parse_raise(parse_t *parse) 675 765 { … … 687 777 } 688 778 689 /** Parse @c return statement. */ 779 /** Parse @c return statement. 780 * 781 * @param parse Parser object. 782 * @return New syntax tree node. 783 */ 690 784 static stree_return_t *parse_return(parse_t *parse) 691 785 { … … 704 798 } 705 799 706 /* Parse @c with-except-finally statement. */ 800 /* Parse @c with-except-finally statement. 801 * 802 * @param parse Parser object. 803 * @return New syntax tree node. 804 */ 707 805 static stree_wef_t *parse_wef(parse_t *parse) 708 806 { … … 746 844 } 747 845 748 /* Parse expression statement. */ 846 /* Parse expression statement. 847 * 848 * @param parse Parser object. 849 * @return New syntax tree node. 850 */ 749 851 static stree_exps_t *parse_exps(parse_t *parse) 750 852 { … … 764 866 } 765 867 766 /* Parse @c except clause. */ 868 /* Parse @c except clause. 869 * 870 * @param parse Parser object. 871 * @return New syntax tree node. 872 */ 767 873 static stree_except_t *parse_except(parse_t *parse) 768 874 { … … 785 891 } 786 892 787 /** Parse identifier. */ 893 /** Parse identifier. 894 * 895 * @param parse Parser object. 896 * @return New syntax tree node. 897 */ 788 898 stree_ident_t *parse_ident(parse_t *parse) 789 899 { … … 801 911 } 802 912 803 /** Signal a parse error, start bailing out from parser. */ 913 /** Signal a parse error, start bailing out from parser. 914 * 915 * @param parse Parser object. 916 */ 804 917 void parse_raise_error(parse_t *parse) 805 918 { … … 808 921 } 809 922 810 /** Note a parse error that has been immediately recovered. */ 923 /** Note a parse error that has been immediately recovered. 924 * 925 * @param parse Parser object. 926 */ 811 927 void parse_note_error(parse_t *parse) 812 928 { … … 814 930 } 815 931 816 /** Check if we are currently bailing out of parser due to a parse error. */ 932 /** Check if we are currently bailing out of parser due to a parse error. 933 * 934 * @param parse Parser object. 935 */ 817 936 bool_t parse_is_error(parse_t *parse) 818 937 { … … 823 942 * 824 943 * Still remember that there was an error, but stop bailing out. 944 * 945 * @param parse Parser object. 825 946 */ 826 947 void parse_recover_error(parse_t *parse) … … 832 953 } 833 954 834 /** Return current lem. */ 955 /** Return current lem. 956 * 957 * @param parse Parser object. 958 * @return Pointer to current lem. Only valid until the lexing 959 * position is advanced. 960 */ 835 961 lem_t *lcur(parse_t *parse) 836 962 { … … 841 967 } 842 968 843 /** Retturn current lem lclass. */ 969 /** Return current lem lclass. 970 * 971 * @param parse Parser object. 972 * @return Lclass of the current lem. 973 */ 844 974 lclass_t lcur_lc(parse_t *parse) 845 975 { … … 861 991 } 862 992 863 /** Skip to next lem. */ 993 /** Skip to next lem. 994 * 995 * @param parse Parser object. 996 */ 864 997 void lskip(parse_t *parse) 865 998 { … … 870 1003 } 871 1004 872 /** Verify that lclass of current lem is @a lc. */ 1005 /** Verify that lclass of current lem is @a lc. 1006 * 1007 * If a lem of different lclass is found, a parse error is raised and 1008 * a message is printed. 1009 * 1010 * @param parse Parser object. 1011 * @param lc Expected lclass. 1012 */ 873 1013 void lcheck(parse_t *parse, lclass_t lc) 874 1014 { … … 887 1027 } 888 1028 889 /** Verify that lclass of current lem is @a lc and go to next lem. */ 1029 /** Verify that lclass of current lem is @a lc and go to next lem. 1030 * 1031 * If a lem of different lclass is found, a parse error is raised and 1032 * a message is printed. 1033 * 1034 * @param parse Parser object. 1035 * @param lc Expected lclass. 1036 */ 890 1037 void lmatch(parse_t *parse, lclass_t lc) 891 1038 { … … 910 1057 } 911 1058 912 /** Display generic parsing error. */ 1059 /** Raise and display generic parsing error. 1060 * 1061 * @param parse Parser object. 1062 */ 913 1063 void lunexpected_error(parse_t *parse) 914 1064 { … … 920 1070 } 921 1071 922 /** Basically tells us whether @a lclass is in next(block). */ 1072 /** Determine whether @a lclass is in follow(block). 1073 * 1074 * Tests whether @a lclass belongs to the follow(block) set, i.e. if it is 1075 * lclass of a lem that can follow a block in the program. 1076 * 1077 * @param lclass Lclass. 1078 */ 923 1079 bool_t terminates_block(lclass_t lclass) 924 1080 {
Note:
See TracChangeset
for help on using the changeset viewer.