~mmach/netext73/ninja-build

« back to all changes in this revision

Viewing changes to src/lexer.h

  • Committer: mmach
  • Date: 2022-05-24 14:54:55 UTC
  • Revision ID: netbit73@gmail.com-20220524145455-qfaw0s6b68c2y293
1.11.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    NEWLINE,
42
42
    PIPE,
43
43
    PIPE2,
 
44
    PIPEAT,
44
45
    POOL,
45
46
    RULE,
46
47
    SUBNINJA,
55
56
 
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();
59
60
 
60
61
  /// Start parsing some input.
61
62
  void Start(StringPiece filename, StringPiece input);
71
72
 
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);
75
76
 
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);
81
82
  }
82
83
 
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);
87
88
  }
88
89
 
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);
91
92
 
92
93
private:
93
94
  /// Skip past whitespace (called after each read token/ident/etc.).
94
95
  void EatWhitespace();
95
96
 
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);
98
99
 
99
100
  StringPiece filename_;
100
101
  StringPiece input_;