lexer: Change the functions for retrieving token strings.
[pspp-builds.git] / src / language / control / repeat.c
index bae0e4afb103d7e1838c27616abe7055198f64a7..130dfd68800d5327a3f66d872f199a9ab76d1c9a 100644 (file)
@@ -168,26 +168,24 @@ parse_specification (struct lexer *lexer, struct repeat_block *block)
       /* Get a stand-in variable name and make sure it's unique. */
       if (!lex_force_id (lexer))
        return false;
-      if (dict_lookup_var (dict, lex_tokid (lexer)))
-        msg (SW, _("Dummy variable name `%s' hides dictionary "
-                   "variable `%s'."),
-             lex_tokid (lexer), lex_tokid (lexer));
-      if (find_macro (block, ss_cstr (lex_tokid (lexer))))
+      if (dict_lookup_var (dict, lex_tokcstr (lexer)))
+        msg (SW, _("Dummy variable name `%s' hides dictionary variable `%s'."),
+             lex_tokcstr (lexer), lex_tokcstr (lexer));
+      if (find_macro (block, lex_tokss (lexer)))
          {
            msg (SE, _("Dummy variable name `%s' is given twice."),
-                lex_tokid (lexer));
+                lex_tokcstr (lexer));
            return false;
          }
 
       /* Make a new macro. */
       macro = pool_alloc (block->pool, sizeof *macro);
-      ss_alloc_substring_pool (&macro->name, ss_cstr (lex_tokid (lexer)),
-                               block->pool);
+      ss_alloc_substring_pool (&macro->name, lex_tokss (lexer), block->pool);
       ll_push_tail (&block->macros, &macro->ll);
 
       /* Skip equals sign. */
       lex_get (lexer);
-      if (!lex_force_match (lexer, '='))
+      if (!lex_force_match (lexer, T_EQUALS))
        return false;
 
       /* Get the details of the variable's possible values. */
@@ -204,7 +202,7 @@ parse_specification (struct lexer *lexer, struct repeat_block *block)
        }
       if (count == 0)
        return false;
-      if (lex_token (lexer) != '/' && lex_token (lexer) != '.')
+      if (lex_token (lexer) != T_SLASH && lex_token (lexer) != T_ENDCMD)
         {
           lex_error (lexer, NULL);
           return false;
@@ -230,9 +228,9 @@ parse_specification (struct lexer *lexer, struct repeat_block *block)
          return false;
        }
 
-      lex_match (lexer, '/');
+      lex_match (lexer, T_SLASH);
     }
-  while (lex_token (lexer) != '.');
+  while (lex_token (lexer) != T_ENDCMD);
 
   return true;
 }
@@ -458,9 +456,9 @@ parse_numbers (struct lexer *lexer, struct repeat_macro *macro,
         add_replacement (ss_cstr (pool_asprintf (pool, "%g", i)),
                          macro, pool, &used, &allocated);
 
-      lex_match (lexer, ',');
+      lex_match (lexer, T_COMMA);
     }
-  while (lex_token (lexer) != '/' && lex_token (lexer) != '.');
+  while (lex_token (lexer) != T_SLASH && lex_token (lexer) != T_ENDCMD);
 
   return used;
 }
@@ -490,9 +488,9 @@ parse_strings (struct lexer *lexer, struct repeat_macro *macro, struct pool *poo
       add_replacement (ss_cstr (string), macro, pool, &used, &allocated);
 
       lex_get (lexer);
-      lex_match (lexer, ',');
+      lex_match (lexer, T_COMMA);
     }
-  while (lex_token (lexer) != '/' && lex_token (lexer) != '.');
+  while (lex_token (lexer) != T_SLASH && lex_token (lexer) != T_ENDCMD);
 
   return used;
 }