version 1.22, 2007/06/05 09:48:59
|
version 1.23, 2007/06/22 21:34:59
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Bob Blair (bblair@bmc.com) |
|
// |
|
// Modified By: |
|
// Sean Keenan, Hewlett-Packard Company (sean.keenan@hp.com) |
|
// Jim Wunderlich (Jim_Wunderlich@prodigy.net) |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
// bug 4573 - cimmof include file search path processing is inadequate | // bug 4573 - cimmof include file search path processing is inadequate |
|
|
// Take a YY_BUFFERSTATE off the stack of saved contexts | // Take a YY_BUFFERSTATE off the stack of saved contexts |
//--------------------------------------------------------------------- | //--------------------------------------------------------------------- |
bufstate * | bufstate * |
parser::pop_statebuff() { |
parser::pop_statebuff() |
|
{ |
bufstate *v = 0; | bufstate *v = 0; |
if (!_include_stack.isEmpty()) { |
if (!_include_stack.isEmpty()) |
|
{ |
v = _include_stack.top(); | v = _include_stack.top(); |
_include_stack.pop(); | _include_stack.pop(); |
} | } |
|
|
//------------------------------------------------------------------- | //------------------------------------------------------------------- |
// Create a flex input buffer from a String containing the file name | // Create a flex input buffer from a String containing the file name |
//------------------------------------------------------------------- | //------------------------------------------------------------------- |
int |
int parser::setInputBufferFromName(const String &filename) |
parser::setInputBufferFromName(const String &filename) { |
{ |
#if defined (PEGASUS_OS_VMS) | #if defined (PEGASUS_OS_VMS) |
FILE *f = fopen(filename.getCString(),"r"); | FILE *f = fopen(filename.getCString(),"r"); |
#else | #else |
|
|
// or there isn't. If there is, restore the saved particulars | // or there isn't. If there is, restore the saved particulars |
// of that context so we can keep on parsing | // of that context so we can keep on parsing |
//----------------------------------------------------------------- | //----------------------------------------------------------------- |
int |
int parser::wrap() |
parser::wrap() { |
{ |
bufstate *v = pop_statebuff(); | bufstate *v = pop_statebuff(); |
if (v) { |
if (v) |
|
{ |
setInputBuffer(v->buffer_state, true); | setInputBuffer(v->buffer_state, true); |
set_current_filename(v->filename); | set_current_filename(v->filename); |
set_lineno(v->lineno); | set_lineno(v->lineno); |
|
|
// ATTN: P2 BB 2001 Log where an error occured. This is lame, so it needs work | // ATTN: P2 BB 2001 Log where an error occured. This is lame, so it needs work |
// | // |
//---------------------------------------------------------------- | //---------------------------------------------------------------- |
void |
void parser::log_parse_error(char *token, const char *errmsg) const |
parser::log_parse_error(char *token, const char *errmsg) const { |
{ |
char buf[40]; | char buf[40]; |
sprintf(buf, "%d", _lineno); | sprintf(buf, "%d", _lineno); |
String s = _current_filename + ":" + buf + ": " + errmsg + " before `" | String s = _current_filename + ":" + buf + ": " + errmsg + " before `" |