stage1_2/stage1_2.cc
changeset 175 dadda1b5401e
parent 139 668a54686827
child 177 697562a5da7c
--- a/stage1_2/stage1_2.cc	Fri May 15 10:23:20 2009 +0200
+++ b/stage1_2/stage1_2.cc	Mon May 18 13:19:30 2009 +0200
@@ -134,6 +134,10 @@
  */
 /* static */ symtable_c<int, BOGUS_TOKEN_ID> variable_name_symtable;
 
+/* A symbol table to store the declared direct variables of
+ * the function currently being parsed...
+ */
+/* static */ symtable_c<int, BOGUS_TOKEN_ID> direct_variable_symtable;
 
 /* Function only called from within flex!
  *
@@ -153,6 +157,19 @@
   return token_id;
 }
 
+/* Function only called from within flex!
+ *
+ * search for a symbol in direct variables symbol table
+ * declared above, and return the token id of the first
+ * symbol found.
+ */
+int get_direct_variable_token(const char *direct_variable_str) {
+  int token_id;
+
+  if ((token_id = direct_variable_symtable.find_value(direct_variable_str)) == direct_variable_symtable.end_value())
+    return direct_variable_token;
+  return token_id;
+}
 
 /************************/
 /* Utility Functions... */