summaryrefslogtreecommitdiff
path: root/tests/lexer/driver.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-11-17 01:35:29 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-11-22 18:52:21 +0300
commitd52c1fb406b1cef82c5f5a28fc1804d7d99a49d8 (patch)
tree89236d3dcdf6245c75d761fde09040d9d2a56480 /tests/lexer/driver.cxx
parentbe3dc4cee63da92cfa1fa44a0bf90ab11ec7aaca (diff)
Add support for build2 for tests and examples
Diffstat (limited to 'tests/lexer/driver.cxx')
-rw-r--r--tests/lexer/driver.cxx123
1 files changed, 0 insertions, 123 deletions
diff --git a/tests/lexer/driver.cxx b/tests/lexer/driver.cxx
deleted file mode 100644
index a054aad..0000000
--- a/tests/lexer/driver.cxx
+++ /dev/null
@@ -1,123 +0,0 @@
-// file : tests/lexer/driver.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-// license : MIT; see accompanying LICENSE file
-
-#include <fstream>
-#include <iostream>
-
-#include <token.hxx>
-#include <lexer.hxx>
-
-using namespace std;
-
-const char* keywords[] =
-{
- "source",
- "include",
- "namespace",
- "class",
- "signed",
- "unsigned",
- "bool",
- "char",
- "wchar_t",
- "short",
- "int",
- "long",
- "float",
- "double"
-};
-
-const char* punctuation[] = {
- ";", ",", ":", "::", "{", "}", /*"(", ")",*/ "=", "|"};
-
-int
-main (int argc, char* argv[])
-{
- if (argc != 2)
- {
- cerr << "usage: " << argv[0] << " file.cli" << endl;
- return 1;
- }
-
- ifstream ifs;
- ifs.exceptions (ifstream::failbit | ifstream::badbit);
- ifs.open (argv[1]);
-
- lexer l (ifs, argv[1]);
-
- while (true)
- {
- token t (l.next ());
-
- switch (t.type ())
- {
- case token::t_eos:
- {
- cout << "<EOS>" << endl;
- return 0;
- }
- case token::t_keyword:
- {
- cout << "keyword: " << keywords[t.keyword ()] << endl;
- break;
- }
- case token::t_identifier:
- {
- cout << "identifier: " << t.identifier () << endl;
- break;
- }
- case token::t_punctuation:
- {
- cout << punctuation[t.punctuation ()] << endl;
- break;
- }
- case token::t_cxx_path_lit:
- {
- cout << "c++ path: " << t.literal () << endl;
- break;
- }
- case token::t_cli_path_lit:
- {
- cout << "cli path: " << t.literal () << endl;
- break;
- }
- case token::t_string_lit:
- {
- cout << t.literal () << endl;
- break;
- }
- case token::t_char_lit:
- {
- cout << t.literal () << endl;
- break;
- }
- case token::t_bool_lit:
- {
- cout << t.literal () << endl;
- break;
- }
- case token::t_int_lit:
- {
- cout << t.literal () << endl;
- break;
- }
- case token::t_float_lit:
- {
- cout << t.literal () << endl;
- break;
- }
- case token::t_call_expr:
- {
- cout << t.expression () << endl;
- break;
- }
- case token::t_template_expr:
- {
- cout << t.expression () << endl;
- break;
- }
- }
- }
-}