]> git.mdlowis.com Git - proto/obnc.git/commitdiff
reorganized file
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 15 Jul 2021 20:37:44 +0000 (16:37 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 15 Jul 2021 20:37:44 +0000 (16:37 -0400)
cerise/src/sym.c

index d3b110e340b77a270986611e81cc4b8b7e0c5190..77b6c59c1d410095c8f6d346778af2ed152d2b0b 100644 (file)
@@ -126,24 +126,6 @@ void symbol_closescope(Parser* p, size_t scope)
     p->nsyms = scope;
 }
 
-void symbol_import(Parser* p, char* name, char* alias)
-{
-    Symbol* mod = symbol_new(p, 0, name, SYM_MODULE, false);
-    size_t modid = symbol_getid(p, 0, mod->name, SYM_MODULE);
-    if (alias)
-    {
-        Symbol* modalias = symbol_new(p, 0, alias, SYM_MODULE, false);
-        modalias->module = modid; // Points to the aliased module
-    }
-
-    /* TODO: read symbols from real symbol file */
-    // All of these should set ->module = modid
-
-    Symbol* sym = symbol_new(p, 0, "testint", SYM_CONST, false);
-    sym->module = modid;
-    sym->value = ast_int(42);
-}
-
 /* Symbol File Generation
  *****************************************************************************/
 
@@ -168,7 +150,24 @@ void symbol_export(Parser* p, char* path)
 
 /* Symbol File Parsing
  *****************************************************************************/
-/* TODO: write logic to parse symbol file */
+
+void symbol_import(Parser* p, char* name, char* alias)
+{
+    Symbol* mod = symbol_new(p, 0, name, SYM_MODULE, false);
+    size_t modid = symbol_getid(p, 0, mod->name, SYM_MODULE);
+    if (alias)
+    {
+        Symbol* modalias = symbol_new(p, 0, alias, SYM_MODULE, false);
+        modalias->module = modid; // Points to the aliased module
+    }
+
+    /* TODO: read symbols from real symbol file */
+    // All of these should set ->module = modid
+
+    Symbol* sym = symbol_new(p, 0, "testint", SYM_CONST, false);
+    sym->module = modid;
+    sym->value = ast_int(42);
+}
 
 /* Symbol Table Unit Tests
  *****************************************************************************/