]>
Commit | Line | Data |
---|---|---|
427c49bc A |
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 <istream> | |
13 | #include <string> | |
14 | ||
15 | #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE | |
16 | namespace antlr { | |
17 | #endif | |
18 | ||
19 | /** Eat whitespace from the input stream | |
20 | * @param is the stream to read from | |
21 | */ | |
22 | ANTLR_USE_NAMESPACE(std)istream& eatwhite( ANTLR_USE_NAMESPACE(std)istream& is ); | |
23 | ||
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 | |
29 | */ | |
30 | ANTLR_USE_NAMESPACE(std)string read_string( ANTLR_USE_NAMESPACE(std)istream& in ); | |
31 | ||
32 | /* Read a ([A-Z][0-9][a-z]_)* kindoff thing. Skips leading whitespace. | |
33 | * @param in the istream to read from. | |
34 | */ | |
35 | ANTLR_USE_NAMESPACE(std)string read_identifier( ANTLR_USE_NAMESPACE(std)istream& in ); | |
36 | ||
37 | /** Read a attribute="value" thing. Leading whitespace is skipped. | |
38 | * Between attribute and '=' no whitespace is allowed. After the '=' it is | |
39 | * permitted. | |
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 | |
44 | * or missing '=' | |
45 | */ | |
46 | void read_AttributeNValue( ANTLR_USE_NAMESPACE(std)istream& in, | |
47 | ANTLR_USE_NAMESPACE(std)string& attribute, | |
48 | ANTLR_USE_NAMESPACE(std)string& value ); | |
49 | ||
50 | #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE | |
51 | } | |
52 | #endif | |
53 | ||
54 | #endif |