Skip to content
Permalink
Browse files

nested alias lookup

best explained with an example:

one = two ; two = three ; three = four
echo $one
> two
echo $$one
> three
echo $$$one
> four
  • Loading branch information...
ac-stef committed Feb 22, 2015
1 parent 47f71f1 commit ec13fd7005493f2f04ec58454b5efc68cdafa799
Showing with 10 additions and 0 deletions.
  1. +10 −0 source/src/command.cpp
@@ -389,6 +389,16 @@ char *parseexp(const char *&p, int right) // parse any nested set of

char *lookup(char *n) // find value of ident referenced with $ in exp
{
if(n[1] == '$') // nested ("$$var")
{
char *nn = lookup(newstring(n + 1));
delete[] n;
int nnl = strlen(nn);
n = newstring(nnl + 1);
n[0] = '$';
copystring(n + 1, nn, nnl + 1);
delete[] nn;
}
ident *id = idents->access(n+1);
if(id) switch(id->type)
{

0 comments on commit ec13fd7

Please sign in to comment.
You can’t perform that action at this time.