Aria

A low-level systems programming language
git clone git://git.m21c.me/Aria.git
Log | Files | Refs | LICENSE

commit 00bb71560fd53de65b63b101118e456b4f7635c2
parent e9f9cb141592a17b88dc8d4273070dc7c267049d
Author: m21c  <ho*******@gmail.com>
Date:   Thu, 15 Jul 2021 16:00:12 +0200

minor cleanups

Diffstat:
Maria.c | 25++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/aria.c b/aria.c @@ -980,7 +980,8 @@ skipwhite: return source->tok.kind = keyword + KSTART; } - source->tok.u.key = getstringkey(&idents, + source->tok.u.key = getstringkey( + &idents, source->line + source->tok.loc.column, source->currloc.column - source->tok.loc.column ); @@ -1030,7 +1031,8 @@ skipwhite: { if (source->line[i] != '_') { if (j >= lengthof(source->stringbuf) - 1) { - error(&source->currloc, + error( + &source->currloc, "number-literal is too long" ); @@ -1231,7 +1233,8 @@ skipwhite: /* TODO(m21c): read '\''-token as character-literal 'C' */ - source->tok.u.key = getstringkey(&strings, + source->tok.u.key = getstringkey( + &strings, source->line + source->tok.loc.column, j - source->tok.loc.column ); @@ -1362,6 +1365,7 @@ int nodetop; Node * makenode(Node *tok, Node *lhs) { Node *node = nodebuf + nodetop++; + *node = *tok; node->lhs = lhs; node->rhs = NULL; @@ -1457,6 +1461,9 @@ setheadenv(Source *source, EnvKind kind) { /* TODO(m21c): make sure that source->tok.loc is the correct * source-location. */ + /* TODO(m21c): maybe use getloc(source) instead of + * &source->tok.loc and move the declaration of + * getloc() up in the source-code. */ env->loc = source->tok.loc; env->below = source->currenv; @@ -1481,6 +1488,9 @@ pushenv(Source *source, EnvKind kind) { env->kind = kind; /* TODO(m21c): make sure that source->tok.loc is the correct * source-location. */ + /* TODO(m21c): maybe use getloc(source) instead of + * &source->tok.loc and move the declaration of + * getloc() up in the source-code. */ env->loc = source->tok.loc; env->below = source->currenv; @@ -1526,6 +1536,9 @@ deferfuncenv(Source *source, int keydeclinfunc) } } } else { + /* TODO(m21c): maybe use getloc(source) instead of + * &source->tok.loc and move the declaration of + * getloc() up in the source-code. */ error( &source->tok.loc, "'%s' undeclared", @@ -1552,6 +1565,9 @@ makedecl(Source *source, int key, DeclKind kind) { decl->kind = kind; /* TODO(m21c): make sure that source->tok.loc is the correct * source-location. */ + /* TODO(m21c): maybe use getloc(source) instead of + * &source->tok.loc and move the declaration of + * getloc() up in the source-code. */ decl->loc = source->tok.loc; decl->key = key; decl->type = prim + TVOID; @@ -1564,6 +1580,9 @@ makedecl(Source *source, int key, DeclKind kind) { if (probe) { /* TODO(m21c): make sure that source->tok.loc is the correct * source-location. */ + /* TODO(m21c): maybe use getloc(source) instead of + * &source->tok.loc and move the declaration of + * getloc() up in the source-code. */ error( &source->tok.loc, "'%s' already declared",