Changeset 71450c8 in mainline for uspace/app/bithenge/script.c


Ignore:
Timestamp:
2012-08-09T05:41:00Z (12 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
05f5fbf
Parents:
c54f5d0
Message:

Bithenge: add member expressions and improve USB example

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bithenge/script.c

    rc54f5d0 r71450c8  
    537537static bithenge_expression_t *parse_postfix_expression(state_t *state)
    538538{
     539        int rc;
    539540        bithenge_expression_t *expr = parse_term(state);
    540541        while (state->error == EOK) {
    541                 if (state->token == '[') {
     542                if (state->token == '.') {
     543                        next_token(state);
     544
     545                        const char *id = expect_identifier(state);
     546
     547                        if (state->error != EOK) {
     548                                free((char *)id);
     549                                bithenge_expression_dec_ref(expr);
     550                                return NULL;
     551                        }
     552
     553                        bithenge_node_t *key = NULL;
     554                        rc = bithenge_new_string_node(&key, id, true);
     555                        if (rc != EOK) {
     556                                error_errno(state, rc);
     557                                bithenge_expression_dec_ref(expr);
     558                                return NULL;
     559                        }
     560
     561                        rc = bithenge_member_expression(&expr, expr, key);
     562                        if (rc != EOK) {
     563                                error_errno(state, rc);
     564                                return NULL;
     565                        }
     566                } else if (state->token == '[') {
    542567                        next_token(state);
    543568                        bithenge_expression_t *start = parse_expression(state);
     
    563588                                return NULL;
    564589                        }
    565                         int rc = bithenge_subblob_expression(&expr, expr,
    566                             start, limit, absolute_limit);
     590                        rc = bithenge_subblob_expression(&expr, expr, start,
     591                            limit, absolute_limit);
    567592                        if (rc != EOK) {
    568593                                error_errno(state, rc);
Note: See TracChangeset for help on using the changeset viewer.