iris

small scheme interpreter
git clone git://git.2f30.org/iris.git
Log | Files | Refs | LICENSE

commit a45c8561f198fb8ccdb58bc462d79efaea74587d
parent b8af866fce7ea0378e098115d2eebb999cdf3af5
Author: sin <sin@2f30.org>
Date:   Sun May 11 16:40:41 +0100

't' comes after 'g'

Diffstat:
lexer.c | 22+++++++++++-----------
lexer.h | 2+-
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/lexer.c b/lexer.c @@ -38,17 +38,6 @@ delim(int c) c == '(' || c == ')'); } -char * -tok2string(struct tok *t) -{ - if (t->s == NULL) - return NULL; - /* In this case, t->s is null-terminated */ - if (t->e == NULL) - return strdup(t->s); - return strndup(t->s, t->e - t->s); -} - struct tok gettok(FILE *in) { @@ -240,3 +229,14 @@ again: tok.e = NULL; return tok; } + +char * +tok2string(struct tok *t) +{ + if (t->s == NULL) + return NULL; + /* In this case, t->s is null-terminated */ + if (t->e == NULL) + return strdup(t->s); + return strndup(t->s, t->e - t->s); +} diff --git a/lexer.h b/lexer.h @@ -19,5 +19,5 @@ struct tok { char *e; }; -char *tok2string(struct tok *); struct tok gettok(FILE *fp); +char *tok2string(struct tok *);