comparison src/expr.c @ 40:d2cee0c335e7

adjusted symbol rules to accept symbols starting with @ but not @<digit>
author lost
date Sat, 03 Jan 2009 19:41:39 +0000
parents efa19ec69df9
children 7eafdb3a8074
comparison
equal deleted inserted replaced
39:efa19ec69df9 40:d2cee0c335e7
28 #include <stdlib.h> 28 #include <stdlib.h>
29 #include <string.h> 29 #include <string.h>
30 30
31 #include "expr.h" 31 #include "expr.h"
32 #include "util.h" 32 #include "util.h"
33 33 #include "lwasm.h"
34 // this definition is in lwasm.h but we don't need the whole file here
35 extern void debug_message(int level, const char *fmt, ...);
36 34
37 lwasm_expr_stack_t *lwasm_expr_stack_create(void) 35 lwasm_expr_stack_t *lwasm_expr_stack_create(void)
38 { 36 {
39 lwasm_expr_stack_t *s; 37 lwasm_expr_stack_t *s;
40 38
363 t = lwasm_expr_term_create_int(val); 361 t = lwasm_expr_term_create_int(val);
364 lwasm_expr_stack_push(s, t); 362 lwasm_expr_stack_push(s, t);
365 lwasm_expr_term_free(t); 363 lwasm_expr_term_free(t);
366 return 0; 364 return 0;
367 } 365 }
368 else if (**p == '@') 366 // an @ followed by a digit is an octal number
367 // but if it's followed by anything else, it is a symbol
368 else if (**p == '@' && isdigit(*(*p + 1)))
369 { 369 {
370 // octal constant 370 // octal constant
371 int val = 0; 371 int val = 0;
372 372
373 (*p)++; 373 (*p)++;