diff options
Diffstat (limited to 'cpp/src/IceGrid/Parser.cpp')
-rw-r--r-- | cpp/src/IceGrid/Parser.cpp | 87 |
1 files changed, 4 insertions, 83 deletions
diff --git a/cpp/src/IceGrid/Parser.cpp b/cpp/src/IceGrid/Parser.cpp index 25c67564f93..35ab0cbf548 100644 --- a/cpp/src/IceGrid/Parser.cpp +++ b/cpp/src/IceGrid/Parser.cpp @@ -1702,7 +1702,7 @@ Parser::getInput(char* buf, int& result, int maxSize) } } } - else if(isatty(fileno(yyin))) + else { #ifdef HAVE_READLINE @@ -1772,21 +1772,6 @@ Parser::getInput(char* buf, int& result, int maxSize) #endif } - else - { - if(((result = (int) fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin)) - { - error("input in flex scanner failed"); - buf[0] = EOF; - result = 1; - } - } -} - -void -Parser::nextLine() -{ - _currentLine++; } void @@ -1798,7 +1783,7 @@ Parser::continueLine() const char* Parser::getPrompt() { - assert(_commands.empty() && isatty(fileno(yyin))); + assert(_commands.empty()); if(_continue) { @@ -1812,50 +1797,6 @@ Parser::getPrompt() } void -Parser::scanPosition(const char* s) -{ - string line(s); - string::size_type idx; - - idx = line.find("line"); - if(idx != string::npos) - { - line.erase(0, idx + 4); - } - - idx = line.find_first_not_of(" \t\r#"); - if(idx != string::npos) - { - line.erase(0, idx); - } - - _currentLine = atoi(line.c_str()) - 1; - - idx = line.find_first_of(" \t\r"); - if(idx != string::npos) - { - line.erase(0, idx); - } - - idx = line.find_first_not_of(" \t\r\""); - if(idx != string::npos) - { - line.erase(0, idx); - - idx = line.find_first_of(" \t\r\""); - if(idx != string::npos) - { - _currentFile = line.substr(0, idx); - line.erase(0, idx + 1); - } - else - { - _currentFile = line; - } - } -} - -void Parser::invalidCommand(const char* s) { error(s); @@ -1956,14 +1897,7 @@ Parser::patchFailed(const Ice::StringSeq& reasons) void Parser::error(const char* s) { - if(_commands.empty() && !isatty(fileno(yyin))) - { - cerr << _currentFile << ':' << _currentLine << ": " << s << endl; - } - else - { - cerr << "error: " << s << endl; - } + cerr << "error: " << s << endl; _errors++; } @@ -1976,14 +1910,7 @@ Parser::error(const string& s) void Parser::warning(const char* s) { - if(_commands.empty() && !isatty(fileno(yyin))) - { - cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl; - } - else - { - cerr << "warning: " << s << endl; - } + cerr << "warning: " << s << endl; } void @@ -2005,10 +1932,7 @@ Parser::parse(FILE* file, bool debug) yyin = file; assert(yyin); - _currentFile = ""; - _currentLine = 0; _continue = false; - nextLine(); int status = yyparse(); if(_errors) @@ -2033,10 +1957,7 @@ Parser::parse(const std::string& commands, bool debug) assert(!_commands.empty()); yyin = 0; - _currentFile = ""; - _currentLine = 0; _continue = false; - nextLine(); int status = yyparse(); if(_errors) |