8#include <antlr/config.hpp>
9#include <antlr/IOException.hpp>
15#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
22ANTLR_USE_NAMESPACE(std)istream& eatwhite( ANTLR_USE_NAMESPACE(std)istream& is )
27#ifdef ANTLR_CCTYPE_NEEDS_STD
28 if( !ANTLR_USE_NAMESPACE(std)isspace(c) )
46ANTLR_USE_NAMESPACE(std)
string read_string( ANTLR_USE_NAMESPACE(std)istream& in )
49 ANTLR_USE_NAMESPACE(std)
string ret(
"");
51 enum { START, READING, ESCAPE, FINISHED };
56 while( state != FINISHED && in.get(ch) )
63 throw IOException(
"string must start with '\"'");
103 if( state != FINISHED )
104 throw IOException(
"badly formatted string: "+ret);
112ANTLR_USE_NAMESPACE(std)
string read_identifier( ANTLR_USE_NAMESPACE(std)istream& in )
115 ANTLR_USE_NAMESPACE(std)
string ret(
"");
121#ifdef ANTLR_CCTYPE_NEEDS_STD
122 if( ANTLR_USE_NAMESPACE(std)isupper(ch) ||
123 ANTLR_USE_NAMESPACE(std)islower(ch) ||
124 ANTLR_USE_NAMESPACE(std)isdigit(ch) ||
127 if( isupper(ch) || islower(ch) || isdigit(ch) || ch ==
'_' )
148void read_AttributeNValue( ANTLR_USE_NAMESPACE(std)istream& in,
149 ANTLR_USE_NAMESPACE(std)
string& attribute,
150 ANTLR_USE_NAMESPACE(std)
string& value )
152 attribute = read_identifier(in);
155 if( in.get(ch) && ch ==
'=' )
156 value = read_string(in);
158 throw IOException(
"invalid attribute=value thing "+attribute);
161#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE