WIP: added const flag to symbols
authorLukas Krickl <lukas@krickl.dev>
Sat, 2 Dec 2023 06:17:09 +0000 (07:17 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sat, 2 Dec 2023 06:17:09 +0000 (07:17 +0100)
include/ulas.h
src/ulas.c

index 4dd9166fddd28bed005bb99c7c54236510aad8e1..83d90288c93e50898d142e85de1134dce3238289 100644 (file)
@@ -173,6 +173,7 @@ struct ulas_sym {
   // last pass this was defined in...
   // a symbol may only be defined once per pass/scope
   enum ulas_pass lastdefin;
+  int constant;
 };
 
 // holds all currently defned symbols
@@ -415,7 +416,7 @@ struct ulas_sym *ulas_symbolresolve(const char *name, int *rc);
 // define a new symbol
 // scope 0 indicates global scope
 // if the symbol already exists -1 is returned
-int ulas_symboldef(const char *name, int scope, struct ulas_tok token);
+int ulas_symbolset(const char *name, int scope, struct ulas_tok token);
 
 // tokenisze according to pre-defined rules
 // returns the amount of bytes of line that were
index 4f4b394a84911f502b659ccb29534fd04c019c7d..c2d79cfacc436a69d35c18590d150fa5b6780dc8 100644 (file)
@@ -223,7 +223,7 @@ struct ulas_sym *ulas_symbolresolve(const char *name, int *rc) {
   return NULL;
 }
 
-int ulas_symboldef(const char *name, int scope, struct ulas_tok token) {
+int ulas_symbolset(const char *name, int scope, struct ulas_tok token) {
   int rc = 0;
   int resolve_rc = 0;
   struct ulas_sym *exisitng = ulas_symbolresolve(name, &resolve_rc);
@@ -2059,6 +2059,7 @@ int ulas_asmline(FILE *dst, FILE *src, const char *line, unsigned long n) {
         ulas_asmlst(start, outbuf, towrite);
         return 0;
       }
+      // ulas_symbolset(ulas.tok.buf, ulas.scope, 
       line = prev;
     } else {
       // start over for the next step...