lexer: Add support for macro identifiers (that begin with '!').
[pspp] / src / language / lexer / segment.h
index 686b471e18d4bc7e3536c33ed3dcbb6c7bf9a937..dbb43d529d59541e9635d93ca536a2a31625b934 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2010, 2011, 2013 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -67,6 +67,7 @@ enum segmenter_mode
     SEG_TYPE(UNQUOTED_STRING)                   \
     SEG_TYPE(RESERVED_WORD)                     \
     SEG_TYPE(IDENTIFIER)                        \
+    SEG_TYPE(MACRO_ID)                          \
     SEG_TYPE(PUNCT)                             \
                                                 \
     SEG_TYPE(SHBANG)                            \
@@ -97,9 +98,13 @@ enum segment_type
 #define SEG_TYPE(NAME) SEG_##NAME,
     SEG_TYPES
 #undef SEG_TYPE
-    SEG_N_TYPES
   };
 
+/* Number of segment types. */
+#define SEG_TYPE(NAME) + 1
+enum { SEG_N_TYPES = SEG_TYPES };
+#undef SEG_TYPE
+
 const char *segment_type_to_string (enum segment_type);
 
 /* A segmenter.  Opaque. */
@@ -114,7 +119,7 @@ void segmenter_init (struct segmenter *, enum segmenter_mode);
 
 enum segmenter_mode segmenter_get_mode (const struct segmenter *);
 
-int segmenter_push (struct segmenter *, const char *input, size_t n,
+int segmenter_push (struct segmenter *, const char *input, size_t n, bool eof,
                     enum segment_type *);
 
 enum prompt_style segmenter_get_prompt (const struct segmenter *);