HASH(struct keyword) kw_hash;
-static struct sym_scope *conf_this_scope;
+struct sym_scope *conf_this_scope;
linpool *cfg_mem;
char *e;
errno = 0;
- l = bstrtoul(yytext, &e, 10);
+ l = bstrtoul10(yytext, &e);
if (e && (*e != ':') || (errno == ERANGE) || (l >> 32))
cf_error("ASN out of range");
}
errno = 0;
- l = bstrtoul(e+1, &e, 10);
+ l = bstrtoul10(e+1, &e);
if (e && *e || (errno == ERANGE) || (l >> len2))
cf_error("Number out of range");
cf_lval.i64 |= l;
}
errno = 0;
- l = bstrtoul(yytext+2, &e, 10);
+ l = bstrtoul10(yytext+2, &e);
if (e && (*e != ':') || (errno == ERANGE) || (l >> len1))
cf_error("ASN out of range");
cf_lval.i64 |= ((u64) l) << len2;
errno = 0;
- l = bstrtoul(e+1, &e, 10);
+ l = bstrtoul10(e+1, &e);
if (e && *e || (errno == ERANGE) || (l >> len2))
cf_error("Number out of range");
cf_lval.i64 |= l;
cf_lval.i64 |= ((u64) ip4_to_u32(ip4)) << 16;
errno = 0;
- l = bstrtoul(e, &e, 10);
+ l = bstrtoul10(e, &e);
if (e && *e || (errno == ERANGE) || (l >> 16))
cf_error("Number out of range");
cf_lval.i64 |= l;
char *e;
unsigned long int l;
errno = 0;
- l = bstrtoul(yytext+2, &e, 16);
+ l = bstrtoul16(yytext+2, &e);
if (e && *e || errno == ERANGE || (unsigned long int)(unsigned int) l != l)
cf_error("Number out of range");
cf_lval.i = l;
char *e;
unsigned long int l;
errno = 0;
- l = bstrtoul(yytext, &e, 10);
+ l = bstrtoul10(yytext, &e);
if (e && *e || errno == ERANGE || (unsigned long int)(unsigned int) l != l)
cf_error("Number out of range");
cf_lval.i = l;
static enum yytokentype
cf_lex_symbol(const char *data)
{
+ /* Have we defined such a symbol? */
+ struct symbol *sym = cf_get_symbol(data);
+ cf_lval.s = sym;
+
+ if (sym->class != SYM_VOID)
+ return CF_SYM_KNOWN;
+
+ /* Is it a keyword? */
struct keyword *k = HASH_FIND(kw_hash, KW, data);
if (k)
{
}
}
- cf_lval.s = cf_get_symbol(data);
- switch (cf_lval.s->class) {
- case SYM_VOID: return CF_SYM_VOID;
- case SYM_PROTO: return CF_SYM_PROTO;
- case SYM_TEMPLATE: return CF_SYM_TEMPLATE;
- case SYM_FUNCTION: return CF_SYM_FUNCTION;
- case SYM_FILTER: return CF_SYM_FILTER;
- case SYM_TABLE: return CF_SYM_TABLE;
- case SYM_ATTRIBUTE: return CF_SYM_ATTRIBUTE;
- case SYM_VARIABLE_RANGE: return CF_SYM_VARIABLE;
- case SYM_CONSTANT_RANGE: return CF_SYM_CONSTANT;
- default: bug("Unknown symbol class %d", cf_lval.s->class);
- }
+ /* OK, undefined symbol */
+ cf_lval.s = sym;
+ return CF_SYM_UNDEFINED;
}
static void
else
BEGIN(INITIAL);
- conf_this_scope = cfg_allocz(sizeof(struct sym_scope));
+ c->root_scope = cfg_allocz(sizeof(struct sym_scope));
+ conf_this_scope = c->root_scope;
conf_this_scope->active = 1;
}
conf_this_scope = s;
s->active = 1;
s->name = sym;
+ s->slots = 0;
}
/**
{
conf_this_scope->active = 0;
conf_this_scope = conf_this_scope->next;
+
ASSERT(conf_this_scope);
}