Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/sbi/src/parse.c

    r23de644 r1ebc1a62  
    7979static stree_except_t *parse_except(parse_t *parse);
    8080
    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  */
    9281void parse_init(parse_t *parse, stree_program_t *prog, struct lex *lex)
    9382{
     
    10291}
    10392
    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  */
     93/** Parse module. */
    11994void parse_module(parse_t *parse)
    12095{
     
    142117}
    143118
    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  */
     119/** Parse class, struct or interface declaration. */
    151120static stree_csi_t *parse_csi(parse_t *parse, lclass_t dclass,
    152121    stree_csi_t *outer_csi)
     
    200169}
    201170
    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  */
     171/** Parse class, struct or interface member. */
    208172static stree_csimbr_t *parse_csimbr(parse_t *parse, stree_csi_t *outer_csi)
    209173{
     
    247211
    248212
    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  */
     213/** Parse member function. */
    255214static stree_fun_t *parse_fun(parse_t *parse, stree_csi_t *outer_csi)
    256215{
     
    338297}
    339298
    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  */
     299/** Parse member variable. */
    346300static stree_var_t *parse_var(parse_t *parse, stree_csi_t *outer_csi)
    347301{
     
    364318}
    365319
    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  */
     320/** Parse member property. */
    372321static stree_prop_t *parse_prop(parse_t *parse, stree_csi_t *outer_csi)
    373322{
     
    475424}
    476425
    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  */
     426/** Parse symbol attribute. */
    483427static stree_symbol_attr_t *parse_symbol_attr(parse_t *parse)
    484428{
     
    498442}
    499443
    500 /** Parse formal function argument.
    501  *
    502  * @param parse         Parser object.
    503  * @return              New syntax tree node.
    504  */
     444/** Parse formal function argument. */
    505445static stree_proc_arg_t *parse_proc_arg(parse_t *parse)
    506446{
     
    528468}
    529469
    530 /** Parse argument attribute.
    531  *
    532  * @param parse         Parser object.
    533  * @return              New syntax tree node.
    534  */
     470/** Parse argument attribute. */
    535471static stree_arg_attr_t *parse_arg_attr(parse_t *parse)
    536472{
     
    550486}
    551487
    552 /** Parse statement block.
    553  *
    554  * @param parse         Parser object.
    555  * @return              New syntax tree node.
    556  */
     488/** Parse statement block. */
    557489static stree_block_t *parse_block(parse_t *parse)
    558490{
     
    577509}
    578510
    579 /** Parse statement.
    580  *
    581  * @param parse         Parser object.
    582  * @return              New syntax tree node.
    583  */
     511/** Parse statement. */
    584512stree_stat_t *parse_stat(parse_t *parse)
    585513{
     
    648576}
    649577
    650 /** Parse variable declaration statement.
    651  *
    652  * @param parse         Parser object.
    653  * @return              New syntax tree node.
    654  */
     578/** Parse variable declaration statement. */
    655579static stree_vdecl_t *parse_vdecl(parse_t *parse)
    656580{
     
    679603}
    680604
    681 /** Parse @c if statement.
    682  *
    683  * @param parse         Parser object.
    684  * @return              New syntax tree node.
    685  */
     605/** Parse @c if statement, */
    686606static stree_if_t *parse_if(parse_t *parse)
    687607{
     
    709629}
    710630
    711 /** Parse @c while statement.
    712  *
    713  * @param parse         Parser object.
    714  */
     631/** Parse @c while statement. */
    715632static stree_while_t *parse_while(parse_t *parse)
    716633{
     
    731648}
    732649
    733 /** Parse @c for statement.
    734  *
    735  * @param parse         Parser object.
    736  * @return              New syntax tree node.
    737  */
     650/** Parse @c for statement. */
    738651static stree_for_t *parse_for(parse_t *parse)
    739652{
     
    758671}
    759672
    760 /** Parse @c raise statement.
    761  *
    762  * @param parse         Parser object.
    763  */
     673/** Parse @c raise statement. */
    764674static stree_raise_t *parse_raise(parse_t *parse)
    765675{
     
    777687}
    778688
    779 /** Parse @c return statement.
    780  *
    781  * @param parse         Parser object.
    782  * @return              New syntax tree node.
    783  */
     689/** Parse @c return statement. */
    784690static stree_return_t *parse_return(parse_t *parse)
    785691{
     
    798704}
    799705
    800 /* Parse @c with-except-finally statement.
    801  *
    802  * @param parse         Parser object.
    803  * @return              New syntax tree node.
    804  */
     706/* Parse @c with-except-finally statement. */
    805707static stree_wef_t *parse_wef(parse_t *parse)
    806708{
     
    844746}
    845747
    846 /* Parse expression statement.
    847  *
    848  * @param parse         Parser object.
    849  * @return              New syntax tree node.
    850  */
     748/* Parse expression statement. */
    851749static stree_exps_t *parse_exps(parse_t *parse)
    852750{
     
    866764}
    867765
    868 /* Parse @c except clause.
    869  *
    870  * @param parse         Parser object.
    871  * @return              New syntax tree node.
    872  */
     766/* Parse @c except clause. */
    873767static stree_except_t *parse_except(parse_t *parse)
    874768{
     
    891785}
    892786
    893 /** Parse identifier.
    894  *
    895  * @param parse         Parser object.
    896  * @return              New syntax tree node.
    897  */
     787/** Parse identifier. */
    898788stree_ident_t *parse_ident(parse_t *parse)
    899789{
     
    911801}
    912802
    913 /** Signal a parse error, start bailing out from parser.
    914  *
    915  * @param parse         Parser object.
    916  */
     803/** Signal a parse error, start bailing out from parser. */
    917804void parse_raise_error(parse_t *parse)
    918805{
     
    921808}
    922809
    923 /** Note a parse error that has been immediately recovered.
    924  *
    925  * @param parse         Parser object.
    926  */
     810/** Note a parse error that has been immediately recovered. */
    927811void parse_note_error(parse_t *parse)
    928812{
     
    930814}
    931815
    932 /** Check if we are currently bailing out of parser due to a parse error.
    933  *
    934  * @param parse         Parser object.
    935  */
     816/** Check if we are currently bailing out of parser due to a parse error. */
    936817bool_t parse_is_error(parse_t *parse)
    937818{
     
    942823 *
    943824 * Still remember that there was an error, but stop bailing out.
    944  *
    945  * @param parse         Parser object.
    946825 */
    947826void parse_recover_error(parse_t *parse)
     
    953832}
    954833
    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  */
     834/** Return current lem. */
    961835lem_t *lcur(parse_t *parse)
    962836{
     
    967841}
    968842
    969 /** Return current lem lclass.
    970  *
    971  * @param parse         Parser object.
    972  * @return              Lclass of the current lem.
    973  */
     843/** Retturn current lem lclass. */
    974844lclass_t lcur_lc(parse_t *parse)
    975845{
     
    991861}
    992862
    993 /** Skip to next lem.
    994  *
    995  * @param parse         Parser object.
    996  */
     863/** Skip to next lem. */
    997864void lskip(parse_t *parse)
    998865{
     
    1003870}
    1004871
    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  */
     872/** Verify that lclass of current lem is @a lc. */
    1013873void lcheck(parse_t *parse, lclass_t lc)
    1014874{
     
    1027887}
    1028888
    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  */
     889/** Verify that lclass of current lem is @a lc and go to next lem. */
    1037890void lmatch(parse_t *parse, lclass_t lc)
    1038891{
     
    1057910}
    1058911
    1059 /** Raise and display generic parsing error.
    1060  *
    1061  * @param parse         Parser object.
    1062  */
     912/** Display generic parsing error. */
    1063913void lunexpected_error(parse_t *parse)
    1064914{
     
    1070920}
    1071921
    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  */
     922/** Basically tells us whether @a lclass is in next(block). */
    1079923bool_t terminates_block(lclass_t lclass)
    1080924{
Note: See TracChangeset for help on using the changeset viewer.