Ignore:
File:
1 edited

Legend:

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

    r23de644 r1ebc1a62  
    3434#include <stdio.h>
    3535#include <stdlib.h>
    36 #include "bigint.h"
    3736#include "mytypes.h"
    3837#include "input.h"
     
    136135        { lc_assign,    "=" },
    137136        { lc_plus,      "+" },
    138         { lc_minus,     "-" },
    139         { lc_mult,      "*" },
    140137        { lc_increase,  "+=" },
    141138
     
    208205                break;
    209206        case lc_lit_int:
    210                 printf("(");
    211                 bigint_print(&lem->u.lit_int.value);
    212                 printf(")");
     207                printf("(%d)", lem->u.lit_int.value);
    213208                break;
    214209        case lc_lit_string:
     
    272267 *
    273268 * @param lex           Lexer object.
    274  * @return              Pointer to current lem. Owned by @a lex and only valid
    275  *                      until next call to lex_next().
    276269 */
    277270lem_t *lex_get_current(lex_t *lex)
     
    383376                lex->current.lclass = lc_plus; ++bp; break;
    384377
    385         case '-':
    386                 lex->current.lclass = lc_minus; ++bp; break;
    387 
    388         case '*':
    389                 lex->current.lclass = lc_mult; ++bp; break;
    390 
    391378        case '<':
    392379                if (bp[1] == '=') {
     
    471458{
    472459        char *bp;
    473         bigint_t value;
    474         bigint_t dgval;
    475         bigint_t base;
    476         bigint_t tprod;
     460        int value;
    477461
    478462        bp = lex->ibp;
    479 
    480         bigint_init(&value, 0);
    481         bigint_init(&base, 10);
     463        value = 0;
    482464
    483465        while (is_digit(*bp)) {
    484                 bigint_mul(&value, &base, &tprod);
    485                 bigint_init(&dgval, digit_value(*bp));
    486 
    487                 bigint_destroy(&value);
    488                 bigint_add(&tprod, &dgval, &value);
    489                 bigint_destroy(&tprod);
    490                 bigint_destroy(&dgval);
    491 
     466                value = value * 10 + digit_value(*bp);
    492467                ++bp;
    493468        }
    494469
    495         bigint_destroy(&base);
    496 
    497470        lex->ibp = bp;
    498471
    499472        lex->current.lclass = lc_lit_int;
    500         bigint_shallow_copy(&value, &lex->current.u.lit_int.value);
     473        lex->current.u.lit_int.value = value;
    501474}
    502475
Note: See TracChangeset for help on using the changeset viewer.