summaryrefslogtreecommitdiff
path: root/cli/parser.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-08-22 10:24:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-08-22 10:24:18 +0200
commit1470fed809be7b11f147f8a6ca924a252b473c97 (patch)
tree3c001c6123af4507a34d4fd036b792989db91b0a /cli/parser.hxx
parent522e21fa892dfc8b436eb6e7cb46f386a9116316 (diff)
Implement the CLI language parser
Diffstat (limited to 'cli/parser.hxx')
-rw-r--r--cli/parser.hxx60
1 files changed, 60 insertions, 0 deletions
diff --git a/cli/parser.hxx b/cli/parser.hxx
new file mode 100644
index 0000000..d1f4b4b
--- /dev/null
+++ b/cli/parser.hxx
@@ -0,0 +1,60 @@
+// file : cli/parser.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009 Code Synthesis Tools CC
+// license : MIT; see accompanying LICENSE file
+
+#ifndef CLI_PARSER_HXX
+#define CLI_PARSER_HXX
+
+#include <string>
+#include <istream>
+
+class Token;
+class Lexer;
+
+class Parser
+{
+public:
+ struct InvalidInput {};
+
+ void
+ parse (std::istream& is, std::string const& id);
+
+private:
+ struct Error {};
+
+ void
+ def_unit ();
+
+ void
+ include_decl ();
+
+ bool
+ decl (Token&);
+
+ void
+ namespace_def ();
+
+ void
+ class_def ();
+
+ bool
+ option_def (Token&);
+
+ bool
+ qualified_name (Token&);
+
+ bool
+ fundamental_type (Token&);
+
+private:
+ void
+ recover (Token& t);
+
+private:
+ bool valid_;
+ Lexer* lexer_;
+ std::string const* id_;
+};
+
+#endif // CLI_PARSER_HXX