Implemented the SHOW command and massaged the SET command to fit
[pspp-builds.git] / src / lexer.c
index 6bcb46eb97c88c71028f435f1dcd65fad254e320..5b1b39415393548b4619dc16873a09bfaa28c48f 100644 (file)
@@ -18,6 +18,7 @@
    02111-1307, USA. */
 
 #include <config.h>
+#include "lexer.h"
 #include <assert.h>
 #include <ctype.h>
 #include <errno.h>
 #include "command.h"
 #include "error.h"
 #include "getline.h"
-#include "lexer.h"
 #include "magic.h"
 #include "settings.h"
 #include "str.h"
 
-/*#define DUMP_TOKENS 1*/
+/*
+#define DUMP_TOKENS 1
+*/
 
 \f
 /* Global variables. */
@@ -159,6 +161,7 @@ lex_get (void)
            }
        }
 
+
       /* Actually parse the token. */
       cp = prog;
       ds_clear (&tokstr);
@@ -409,6 +412,23 @@ lex_integer (void)
   assert (lex_integer_p ());
   return tokval;
 }
+/* Returns nonzero if the current token is an floating point. */
+int
+lex_double_p (void)
+{
+  return ( token == T_NUM
+          && tokval != NOT_DOUBLE );
+}
+
+/* Returns the value of the current token, which must be a
+   floating point number. */
+double
+lex_double (void)
+{
+  assert (lex_double_p ());
+  return tokval;
+}
+
 \f  
 /* Token matching functions. */
 
@@ -774,12 +794,12 @@ lex_preprocess_line (void)
       len--;
 
     /* Check for and remove terminal dot. */
-    if (len > 0 && s[len - 1] == set_endcmd)
+    if (len > 0 && s[len - 1] == get_endcmd() )
       {
        dot = 1;
        len--;
       }
-    else if (len == 0 && set_nullline)
+    else if (len == 0 && get_nullline() )
       dot = 1;
     else
       dot = 0;