1 #ifndef INC_ANTLRUtil_hpp__
2 #define INC_ANTLRUtil_hpp__
4 /* ANTLR Translator Generator
5 * Project led by Terence Parr at http://www.jGuru.com
6 * Software rights: http://www.antlr.org/license.html
11 #include <antlr/config.hpp>
15 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
19 /** Eat whitespace from the input stream
20 * @param is the stream to read from
22 ANTLR_USE_NAMESPACE(std)istream& eatwhite( ANTLR_USE_NAMESPACE(std)istream& is );
24 /** Read a string enclosed by '"' from a stream. Also handles escaping of \".
25 * Skips leading whitespace.
26 * @param in the istream to read from.
27 * @returns the string read from file exclusive the '"'
28 * @throws ios_base::failure if string is badly formatted
30 ANTLR_USE_NAMESPACE(std)string read_string( ANTLR_USE_NAMESPACE(std)istream& in );
32 /* Read a ([A-Z][0-9][a-z]_)* kindoff thing. Skips leading whitespace.
33 * @param in the istream to read from.
35 ANTLR_USE_NAMESPACE(std)string read_identifier( ANTLR_USE_NAMESPACE(std)istream& in );
37 /** Read a attribute="value" thing. Leading whitespace is skipped.
38 * Between attribute and '=' no whitespace is allowed. After the '=' it is
40 * @param in the istream to read from.
41 * @param attribute string the attribute name is put in
42 * @param value string the value of the attribute is put in
43 * @throws ios_base::failure if something is fishy. E.g. malformed quoting
46 void read_AttributeNValue( ANTLR_USE_NAMESPACE(std)istream& in,
47 ANTLR_USE_NAMESPACE(std)string& attribute,
48 ANTLR_USE_NAMESPACE(std)string& value );
50 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE