Changeset ecb6ac32 in mainline for uspace/app/sbi/src/parse.c


Ignore:
Timestamp:
2010-04-04T22:32:39Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0a72efc
Parents:
73060801 (diff), 23de644 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~jsvoboda/helenos/sysel.

File:
1 edited

Legend:

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

    r73060801 recb6ac32  
    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 */
    8192void parse_init(parse_t *parse, stree_program_t *prog, struct lex *lex)
    8293{
     
    91102}
    92103
    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 */
    94119void parse_module(parse_t *parse)
    95120{
     
    117142}
    118143
    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 */
    120151static stree_csi_t *parse_csi(parse_t *parse, lclass_t dclass,
    121152    stree_csi_t *outer_csi)
     
    169200}
    170201
    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 */
    172208static stree_csimbr_t *parse_csimbr(parse_t *parse, stree_csi_t *outer_csi)
    173209{
     
    211247
    212248
    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 */
    214255static stree_fun_t *parse_fun(parse_t *parse, stree_csi_t *outer_csi)
    215256{
     
    297338}
    298339
    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 */
    300346static stree_var_t *parse_var(parse_t *parse, stree_csi_t *outer_csi)
    301347{
     
    318364}
    319365
    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 */
    321372static stree_prop_t *parse_prop(parse_t *parse, stree_csi_t *outer_csi)
    322373{
     
    424475}
    425476
    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 */
    427483static stree_symbol_attr_t *parse_symbol_attr(parse_t *parse)
    428484{
     
    442498}
    443499
    444 /** Parse formal function argument. */
     500/** Parse formal function argument.
     501 *
     502 * @param parse         Parser object.
     503 * @return              New syntax tree node.
     504 */
    445505static stree_proc_arg_t *parse_proc_arg(parse_t *parse)
    446506{
     
    468528}
    469529
    470 /** Parse argument attribute. */
     530/** Parse argument attribute.
     531 *
     532 * @param parse         Parser object.
     533 * @return              New syntax tree node.
     534 */
    471535static stree_arg_attr_t *parse_arg_attr(parse_t *parse)
    472536{
     
    486550}
    487551
    488 /** Parse statement block. */
     552/** Parse statement block.
     553 *
     554 * @param parse         Parser object.
     555 * @return              New syntax tree node.
     556 */
    489557static stree_block_t *parse_block(parse_t *parse)
    490558{
     
    509577}
    510578
    511 /** Parse statement. */
     579/** Parse statement.
     580 *
     581 * @param parse         Parser object.
     582 * @return              New syntax tree node.
     583 */
    512584stree_stat_t *parse_stat(parse_t *parse)
    513585{
     
    576648}
    577649
    578 /** Parse variable declaration statement. */
     650/** Parse variable declaration statement.
     651 *
     652 * @param parse         Parser object.
     653 * @return              New syntax tree node.
     654 */
    579655static stree_vdecl_t *parse_vdecl(parse_t *parse)
    580656{
     
    603679}
    604680
    605 /** Parse @c if statement, */
     681/** Parse @c if statement.
     682 *
     683 * @param parse         Parser object.
     684 * @return              New syntax tree node.
     685 */
    606686static stree_if_t *parse_if(parse_t *parse)
    607687{
     
    629709}
    630710
    631 /** Parse @c while statement. */
     711/** Parse @c while statement.
     712 *
     713 * @param parse         Parser object.
     714 */
    632715static stree_while_t *parse_while(parse_t *parse)
    633716{
     
    648731}
    649732
    650 /** Parse @c for statement. */
     733/** Parse @c for statement.
     734 *
     735 * @param parse         Parser object.
     736 * @return              New syntax tree node.
     737 */
    651738static stree_for_t *parse_for(parse_t *parse)
    652739{
     
    671758}
    672759
    673 /** Parse @c raise statement. */
     760/** Parse @c raise statement.
     761 *
     762 * @param parse         Parser object.
     763 */
    674764static stree_raise_t *parse_raise(parse_t *parse)
    675765{
     
    687777}
    688778
    689 /** Parse @c return statement. */
     779/** Parse @c return statement.
     780 *
     781 * @param parse         Parser object.
     782 * @return              New syntax tree node.
     783 */
    690784static stree_return_t *parse_return(parse_t *parse)
    691785{
     
    704798}
    705799
    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 */
    707805static stree_wef_t *parse_wef(parse_t *parse)
    708806{
     
    746844}
    747845
    748 /* Parse expression statement. */
     846/* Parse expression statement.
     847 *
     848 * @param parse         Parser object.
     849 * @return              New syntax tree node.
     850 */
    749851static stree_exps_t *parse_exps(parse_t *parse)
    750852{
     
    764866}
    765867
    766 /* Parse @c except clause. */
     868/* Parse @c except clause.
     869 *
     870 * @param parse         Parser object.
     871 * @return              New syntax tree node.
     872 */
    767873static stree_except_t *parse_except(parse_t *parse)
    768874{
     
    785891}
    786892
    787 /** Parse identifier. */
     893/** Parse identifier.
     894 *
     895 * @param parse         Parser object.
     896 * @return              New syntax tree node.
     897 */
    788898stree_ident_t *parse_ident(parse_t *parse)
    789899{
     
    801911}
    802912
    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 */
    804917void parse_raise_error(parse_t *parse)
    805918{
     
    808921}
    809922
    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 */
    811927void parse_note_error(parse_t *parse)
    812928{
     
    814930}
    815931
    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 */
    817936bool_t parse_is_error(parse_t *parse)
    818937{
     
    823942 *
    824943 * Still remember that there was an error, but stop bailing out.
     944 *
     945 * @param parse         Parser object.
    825946 */
    826947void parse_recover_error(parse_t *parse)
     
    832953}
    833954
    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 */
    835961lem_t *lcur(parse_t *parse)
    836962{
     
    841967}
    842968
    843 /** Retturn current lem lclass. */
     969/** Return current lem lclass.
     970 *
     971 * @param parse         Parser object.
     972 * @return              Lclass of the current lem.
     973 */
    844974lclass_t lcur_lc(parse_t *parse)
    845975{
     
    861991}
    862992
    863 /** Skip to next lem. */
     993/** Skip to next lem.
     994 *
     995 * @param parse         Parser object.
     996 */
    864997void lskip(parse_t *parse)
    865998{
     
    8701003}
    8711004
    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 */
    8731013void lcheck(parse_t *parse, lclass_t lc)
    8741014{
     
    8871027}
    8881028
    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 */
    8901037void lmatch(parse_t *parse, lclass_t lc)
    8911038{
     
    9101057}
    9111058
    912 /** Display generic parsing error. */
     1059/** Raise and display generic parsing error.
     1060 *
     1061 * @param parse         Parser object.
     1062 */
    9131063void lunexpected_error(parse_t *parse)
    9141064{
     
    9201070}
    9211071
    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 */
    9231079bool_t terminates_block(lclass_t lclass)
    9241080{
Note: See TracChangeset for help on using the changeset viewer.