Browse Source

Change the token names in the parser

Andrew Young 8 years ago
parent
commit
dcb2b7fc7c
2 changed files with 15 additions and 15 deletions
  1. 11 11
      src/org_parser.c
  2. 4 4
      src/org_parser.h

+ 11 - 11
src/org_parser.c

@@ -46,7 +46,7 @@ org_parse_file_stream (FILE * file, doc_src src)
   struct extra e;
   e.elt = NULL;
   e.curr_elt = NULL;
-  e.curr_type = NOTHING;
+  e.curr_type = T_NOTHING;
   e.src = src;
   yyset_extra (&e, scanner);
 
@@ -89,12 +89,12 @@ rec_parse_document (yyscan_t scanner, org_document *this)
   /* Parse the file */
   while(!exit)
     {
-      if (tok == NOTHING)
+      if (tok == T_NOTHING)
 	{
 	  debug_msg (PARSER, 3, "Got Nothing\n");
 	  /* do nothing */
 	}
-      else if (tok == ORG_HEADING)
+      else if (tok == T_ORG_HEADING)
 	{
 	  int next_level = org_heading_get_level ((org_heading *) elt, src);
 	  if (next_level <= 0)
@@ -112,7 +112,7 @@ rec_parse_document (yyscan_t scanner, org_document *this)
 		rec_parse_heading(scanner, (org_heading *) elt, next_level);
 	    }
 	}
-      else if (tok == ORG_TEXT)
+      else if (tok == T_ORG_TEXT)
 	{
 	  debug_msg (PARSER, 3, "Got Text\n");
 	  /* eat up all text elements below this one */
@@ -123,12 +123,12 @@ rec_parse_document (yyscan_t scanner, org_document *this)
 	  elt = yyget_extra (scanner) -> elt;
 	}
 
-      if (tok == QUIT || elt == NULL)
+      if (tok == T_QUIT || elt == NULL)
 	{
 	  /* break if at the end of the file */
 	  ret = NULL;
 	  exit = true;
-	  tok = QUIT;
+	  tok = T_QUIT;
 	  elt = NULL;
 	}
     }
@@ -161,13 +161,13 @@ rec_parse_heading(yyscan_t scanner, org_heading *this, int this_level)
   /* Parse the file */
   while(!exit)
     {
-      if (tok == NOTHING)
+      if (tok == T_NOTHING)
 	{
 
 	  debug_msg (PARSER, 3, "Got Nothing\n");
 	  /* do nothing */
 	}
-      else if (tok == ORG_HEADING)
+      else if (tok == T_ORG_HEADING)
 	{
 	  int next_level = org_heading_get_level ((org_heading *)elt, src);
 	  //int next_level = 1;
@@ -185,7 +185,7 @@ rec_parse_heading(yyscan_t scanner, org_heading *this, int this_level)
 		rec_parse_heading(scanner, (org_heading *)elt, next_level);
 	    }
 	}
-      else if (tok == ORG_TEXT)
+      else if (tok == T_ORG_TEXT)
 	{
 	  debug_msg (PARSER, 3, "Got Text\n");
 
@@ -196,12 +196,12 @@ rec_parse_heading(yyscan_t scanner, org_heading *this, int this_level)
 	  elt = yyget_extra (scanner)-> elt;
 	}
 
-      if (tok == QUIT || elt == NULL)
+      if (tok == T_QUIT || elt == NULL)
 	{
 	  /* break if at the end of the file */
 	  ret = NULL;
 	  exit = true;
-	  tok = QUIT;
+	  tok = T_QUIT;
 	  elt = NULL;
 	}
     }

+ 4 - 4
src/org_parser.h

@@ -28,10 +28,10 @@ org_document *org_parse_file_stream (FILE * file, doc_src src);
  */
 typedef enum TOKEN
   {
-    QUIT = 0,
-    NOTHING,
-    ORG_HEADING,
-    ORG_TEXT         /* regular text under a heading */
+    T_QUIT = 0,
+    T_NOTHING,
+    T_ORG_HEADING,
+    T_ORG_TEXT         /* regular text under a heading */
   } TOKEN;
 
 struct extra