lexer: New function lex_ofs_representation().
[pspp] / src / language / stats / matrix.c
index 8a08740183a54f72dba21798abae29d9fa42d6c1..b1537cd92e01d9e810118b7730fd33ed82fded50 100644 (file)
@@ -5367,25 +5367,12 @@ matrix_print_parse (struct matrix_state *s)
 
   if (lex_token (s->lexer) != T_SLASH && lex_token (s->lexer) != T_ENDCMD)
     {
-      size_t depth = 0;
-      for (size_t i = 0; ; i++)
-        {
-          enum token_type t = lex_next_token (s->lexer, i);
-          if (t == T_LPAREN || t == T_LBRACK || t == T_LCURLY)
-            depth++;
-          else if ((t == T_RPAREN || t == T_RBRACK || t == T_RCURLY) && depth)
-            depth--;
-          else if ((t == T_SLASH && !depth) || t == T_ENDCMD || t == T_STOP)
-            {
-              if (i > 0)
-                cmd->print.title = lex_next_representation (s->lexer, 0, i - 1);
-              break;
-            }
-        }
-
+      int start_ofs = lex_ofs (s->lexer);
       cmd->print.expression = matrix_parse_exp (s);
       if (!cmd->print.expression)
         goto error;
+      cmd->print.title = lex_ofs_representation (s->lexer, start_ofs,
+                                                 lex_ofs (s->lexer) - 1);
     }
 
   while (lex_match (s->lexer, T_SLASH))
@@ -7505,7 +7492,7 @@ matrix_get_execute__ (struct matrix_command *cmd, struct casereader *reader,
                   error = true;
                 }
             }
-          else if (var_is_num_missing (var, d, MV_USER))
+          else if (var_is_num_missing (var, d) == MV_USER)
             {
               if (get->user.treatment == MGET_RECODE)
                 d = get->user.substitute;
@@ -8228,7 +8215,7 @@ matrix_mget_commit_var (struct ccase **rows, size_t n_rows,
         {
           struct variable *var = dict_get_var (d, cs + x);
           double value = case_num (rows[y], var);
-          if (var_is_num_missing (var, value, MV_ANY))
+          if (var_is_num_missing (var, value))
             {
               n_missing++;
               value = 0.0;