Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

testparser.cpp

Go to the documentation of this file.
00001 // testparser.cpp
00002 //
00003 // Copyright (C) 2002 Chris Laurel <claurel@shatters.net>
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 
00010 #include <celscript/parser.h>
00011 
00012 using namespace std;
00013 using namespace celx;
00014 
00015 
00016 int main(int argc, char* argv[])
00017 {
00018     Scanner scanner(&cin);
00019     Parser parser(scanner);
00020     GlobalEnvironment* env = new GlobalEnvironment();
00021     ExecutionContext context(env);
00022 
00023     cout << "Testing parser . . .\n";
00024 
00025     while (scanner.nextToken() != Scanner::TokenEnd)
00026     {
00027         scanner.pushBack();
00028         Statement* statement = parser.parseStatement();
00029         if (statement != NULL)
00030         {
00031             cout << "Valid\n";
00032             statement->execute(context);
00033         }
00034         else
00035         {
00036             cout << "Invalid\n";
00037         }
00038     }
00039 
00040     return 0;
00041 }

Generated on Sat Jan 14 22:30:32 2006 for Celestia by  doxygen 1.4.1