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