56
57
/// If the last token read was an ERROR token, provide more info
57
58
/// or the empty string.
58
string DescribeLastError();
59
std::string DescribeLastError();
60
61
/// Start parsing some input.
61
62
void Start(StringPiece filename, StringPiece input);
72
73
/// Read a simple identifier (a rule or variable name).
73
74
/// Returns false if a name can't be read.
74
bool ReadIdent(string* out);
75
bool ReadIdent(std::string* out);
76
77
/// Read a path (complete with $escapes).
77
78
/// Returns false only on error, returned path may be empty if a delimiter
78
79
/// (space, newline) is hit.
79
bool ReadPath(EvalString* path, string* err) {
80
bool ReadPath(EvalString* path, std::string* err) {
80
81
return ReadEvalString(path, true, err);
83
84
/// Read the value side of a var = value line (complete with $escapes).
84
85
/// Returns false only on error.
85
bool ReadVarValue(EvalString* value, string* err) {
86
bool ReadVarValue(EvalString* value, std::string* err) {
86
87
return ReadEvalString(value, false, err);
89
90
/// Construct an error message with context.
90
bool Error(const string& message, string* err);
91
bool Error(const std::string& message, std::string* err);
93
94
/// Skip past whitespace (called after each read token/ident/etc.).
94
95
void EatWhitespace();
96
97
/// Read a $-escaped string.
97
bool ReadEvalString(EvalString* eval, bool path, string* err);
98
bool ReadEvalString(EvalString* eval, bool path, std::string* err);
99
100
StringPiece filename_;
100
101
StringPiece input_;