Changeset d0febca in mainline for uspace/app/sbi/src/parse.c
- Timestamp:
- 2010-03-13T12:04:37Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7715994
- Parents:
- 94d484a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/parse.c
r94d484a rd0febca 55 55 static stree_prop_t *parse_prop(parse_t *parse); 56 56 57 static stree_ fun_arg_t *parse_fun_arg(parse_t *parse);57 static stree_proc_arg_t *parse_proc_arg(parse_t *parse); 58 58 static stree_arg_attr_t *parse_arg_attr(parse_t *parse); 59 59 … … 227 227 { 228 228 stree_fun_t *fun; 229 stree_ fun_arg_t *arg;229 stree_proc_arg_t *arg; 230 230 231 231 fun = stree_fun_new(); … … 241 241 /* Parse formal parameters. */ 242 242 while (b_true) { 243 arg = parse_ fun_arg(parse);243 arg = parse_proc_arg(parse); 244 244 if (stree_arg_has_attr(arg, aac_packed)) { 245 245 fun->varg = arg; … … 292 292 { 293 293 stree_prop_t *prop; 294 stree_ident_t *ident; 295 stree_proc_arg_t *arg; 294 296 295 297 prop = stree_prop_new(); 298 list_init(&prop->args); 296 299 297 300 lmatch(parse, lc_prop); 298 prop->name = parse_ident(parse); 301 302 if (lcur_lc(parse) == lc_self) { 303 /* Indexed property set */ 304 305 /* Use some name that is impossible as identifier. */ 306 ident = stree_ident_new(); 307 ident->sid = strtab_get_sid(INDEXER_IDENT); 308 prop->name = ident; 309 310 lskip(parse); 311 lmatch(parse, lc_lsbr); 312 313 /* Parse formal parameters. */ 314 while (b_true) { 315 arg = parse_proc_arg(parse); 316 if (stree_arg_has_attr(arg, aac_packed)) { 317 prop->varg = arg; 318 break; 319 } else { 320 list_append(&prop->args, arg); 321 } 322 323 if (lcur_lc(parse) == lc_rsbr) 324 break; 325 326 lmatch(parse, lc_scolon); 327 } 328 329 lmatch(parse, lc_rsbr); 330 } else { 331 /* Named property */ 332 prop->name = parse_ident(parse); 333 } 334 299 335 lmatch(parse, lc_colon); 300 336 prop->type = parse_texpr(parse); 301 337 lmatch(parse, lc_is); 338 339 while (lcur_lc(parse) != lc_end) { 340 switch (lcur_lc(parse)) { 341 case lc_get: 342 lskip(parse); 343 lmatch(parse, lc_is); 344 if (prop->getter_body != NULL) { 345 printf("Error: Duplicate getter.\n"); 346 exit(1); 347 } 348 prop->getter_body = parse_block(parse); 349 lmatch(parse, lc_end); 350 break; 351 case lc_set: 352 lskip(parse); 353 prop->setter_arg_name = parse_ident(parse); 354 lmatch(parse, lc_is); 355 if (prop->setter_body != NULL) { 356 printf("Error: Duplicate setter.\n"); 357 exit(1); 358 } 359 prop->setter_body = parse_block(parse); 360 lmatch(parse, lc_end); 361 break; 362 default: 363 lunexpected_error(parse); 364 } 365 } 366 302 367 lmatch(parse, lc_end); 303 368 … … 306 371 307 372 /** Parse formal function argument. */ 308 static stree_ fun_arg_t *parse_fun_arg(parse_t *parse)309 { 310 stree_ fun_arg_t *arg;373 static stree_proc_arg_t *parse_proc_arg(parse_t *parse) 374 { 375 stree_proc_arg_t *arg; 311 376 stree_arg_attr_t *attr; 312 377 313 arg = stree_ fun_arg_new();378 arg = stree_proc_arg_new(); 314 379 arg->name = parse_ident(parse); 315 380 lmatch(parse, lc_colon);
Note:
See TracChangeset
for help on using the changeset viewer.