| 32 | }; |
| 33 | |
| 34 | int main( int argc, char *argv[] ) |
| 35 | { |
| 36 | Interpreter::Initialize( ); |
| 37 | const std::string* prompt = &STD_PROMPT; |
| 38 | ParseHelper helper; |
| 39 | ParseListener* listener = new InterpreterRelay; |
| 40 | helper.subscribe( listener ); |
| 41 | |
| 42 | std::string str; |
| 43 | std::cout << *prompt; |
| 44 | std::getline( std::cin, str ); |
| 45 | while ( str != "quit" ) |
| 46 | { |
| 47 | std::cout << str << "\n"; |
| 48 | helper.process( str ); |
| 49 | if ( helper.buffered( ) ) |
| 50 | { |
| 51 | prompt = &MULTILINE_PROMPT; |
| 52 | } |
| 53 | else |
| 54 | { |
| 55 | prompt = &STD_PROMPT; |
| 56 | } |
| 57 | std::cout << *prompt; |
| 58 | std::getline( std::cin, str ); |
| 59 | } |
| 60 | |
| 61 | Interpreter::Finalize( ); |
| 62 | return 0; |
| 63 | } |