diff options
| author | Paul Buetow <paul@buetow.org> | 2008-10-19 17:48:21 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-10-19 17:48:21 +0000 |
| commit | 3d7b35bb37c066489546751e100c2c2b823ccba3 (patch) | |
| tree | a507be11afc3c55807e254ce5b24c5412367aa46 /src/core/interpret.c | |
| parent | d4657a5d7029ea66d19a5d238a9dd6bf75fe5bb0 (diff) | |
refs and syms
Diffstat (limited to 'src/core/interpret.c')
| -rw-r--r-- | src/core/interpret.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/core/interpret.c b/src/core/interpret.c index 2c80163..9dbd7df 100644 --- a/src/core/interpret.c +++ b/src/core/interpret.c @@ -927,6 +927,27 @@ _term(Interpret *p_interpret) { } break; + case TT_SYMS: + { + _NEXT + if (p_interpret->tt != TT_IDENT) + _INTERPRET_ERROR("Expexted identifier for 'syms'", + p_interpret->p_token); + + char *c_name = token_get_val(p_interpret->p_token); + Symbol *p_symbol = scope_get(p_interpret->p_scope, c_name); + if (p_symbol == NULL) + _INTERPRET_ERROR("No such symbol", p_interpret->p_token); + + + Token *p_token_num_refs = token_new_integer(p_symbol->i_refs); + stack_push(p_interpret->p_stack, p_token_num_refs); + + _NEXT; + return (1); + } + break; + /* case TT_PARANT_AL: { |
