aboutsummaryrefslogtreecommitdiff
path: root/include/cps
diff options
context:
space:
mode:
Diffstat (limited to 'include/cps')
-rw-r--r--include/cps/Lexer.h8
-rw-r--r--include/cps/Preprocessor.h19
2 files changed, 26 insertions, 1 deletions
diff --git a/include/cps/Lexer.h b/include/cps/Lexer.h
index bec1233..05fb857 100644
--- a/include/cps/Lexer.h
+++ b/include/cps/Lexer.h
@@ -113,7 +113,13 @@ enum Token {
tok_try = -700,
tok_catch = -701,
tok_endtry = -702,
- tok_throw = -703
+ tok_throw = -703,
+
+ tok_pp_define = -710,
+ tok_pp_undef = -711,
+ tok_pp_ifdef = -712,
+ tok_pp_ifndef = -713,
+ tok_pp_endif = -714
};
class Lexer {
diff --git a/include/cps/Preprocessor.h b/include/cps/Preprocessor.h
new file mode 100644
index 0000000..ebc2806
--- /dev/null
+++ b/include/cps/Preprocessor.h
@@ -0,0 +1,19 @@
+#pragma once
+#include <istream>
+#include <string>
+#include <vector>
+
+namespace cps {
+
+struct PreprocessedSource {
+ std::string Text;
+ // One entry per original source line, before processing that line's directive.
+ std::vector<bool> LibraryLines;
+ bool HadError = false;
+};
+
+// Switches and conditional nesting belong to this input only. Masked lines retain
+// their byte lengths and line endings so the lexer sees original source locations.
+PreprocessedSource preprocess(std::istream &Input);
+
+}