Lines Matching refs:cursor
66 * keeps a separate size, pointer, and cursor so that we can move
70 int cursor;
76 cursor(c) {}
91 input_buffer() : buffer(0), size(0), cursor(0) {}
95 input_buffer(const char* b, int s) : buffer(b), size(s), cursor(0){}
112 return cursor >= size;
117 * the cursor is out of range.
121 if (cursor >= size) { return '\0'; }
122 if (cursor < 0) { return '\0'; }
123 return buffer[cursor];
127 * index offset from the current cursor. The offset may be negative,
129 * cursor plus offset is outside of the range, this returns a nul
134 if (cursor + offset >= size) { return '\0'; }
135 if (cursor + offset < 0) { return '\0'; }
136 return buffer[cursor + offset];
139 * Increments the cursor, iterating forward in the buffer.
143 cursor++;
152 if (cursor >= size) { return 0; }
153 if (cursor < 0) { return 0; }
154 return &buffer[cursor];
157 * Consumes a character. Moves the cursor one character forward if the
172 * argument appears in the input, advances the cursor to the end and
179 * the cursor to the end of the integer if the cursor points to an
180 * integer, returns false and does not move the cursor otherwise.
187 * from the input stream. Returns true and advances the cursor if
189 * all values must be natively aligned, and so advances the cursor to
197 if (cursor % type_size != 0)
199 align = type_size - (cursor % type_size);
201 if (size < cursor + align + type_size)
205 cursor += align;
206 assert(cursor % type_size == 0);
211 out |= (((T)buffer[cursor++]) & 0xff);
218 * and advances the cursor. If not, then returns false and leaves the
219 * cursor in place.
223 * Advances the cursor to the start of the next token, skipping
224 * comments and whitespace. If the cursor already points to the start
233 * Dumps the current cursor value and the unconsumed values in the
245 if (size < cursor + 1)
249 out = buffer[cursor++];