~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/lex_input_stream.h

  • Committer: Mark Atwood
  • Date: 2011-08-11 03:05:03 UTC
  • mfrom: (2385.1.12 refactor4)
  • Revision ID: me@mark.atwood.name-20110811030503-rp9xjihc5x3y0x4q
mergeĀ lp:~olafvdspek/drizzle/refactor4

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_LEX_INPUT_STREAM_H
21
 
#define DRIZZLED_LEX_INPUT_STREAM_H
 
20
#pragma once
22
21
 
23
22
/**
24
23
  @brief This class represents the character input stream consumed during
34
33
  should be seen once out-of-bound data is removed.
35
34
*/
36
35
 
37
 
namespace drizzled
38
 
{
 
36
namespace drizzled {
39
37
 
40
38
class Lex_input_stream
41
39
{
42
40
public:
43
41
  Lex_input_stream(Session *session, const char* buff, unsigned int length);
44
 
  ~Lex_input_stream();
45
42
 
46
43
  /**
47
44
    Set the echo mode.
85
82
    Get the last character accepted.
86
83
    @return the last character accepted.
87
84
  */
88
 
  char yyGetLast()
 
85
  char yyGetLast() const
89
86
  {
90
87
    return m_ptr[-1];
91
88
  }
93
90
  /**
94
91
    Look at the next character to parse, but do not accept it.
95
92
  */
96
 
  char yyPeek()
 
93
  char yyPeek() const
97
94
  {
98
95
    return m_ptr[0];
99
96
  }
102
99
    Look ahead at some character to parse.
103
100
    @param n offset of the character to look up
104
101
  */
105
 
  char yyPeekn(int n)
 
102
  char yyPeekn(int n) const
106
103
  {
107
104
    return m_ptr[n];
108
105
  }
204
201
  }
205
202
 
206
203
  /** Get the token start position, in the raw buffer. */
207
 
  const char *get_tok_start()
 
204
  const char *get_tok_start() const
208
205
  {
209
206
    return m_tok_start;
210
207
  }
211
208
 
212
209
  /** Get the token start position, in the pre-processed buffer. */
213
 
  const char *get_cpp_tok_start()
 
210
  const char *get_cpp_tok_start() const
214
211
  {
215
212
    return m_cpp_tok_start;
216
213
  }
217
214
 
218
215
  /** Get the token end position, in the raw buffer. */
219
 
  const char *get_tok_end()
 
216
  const char *get_tok_end() const
220
217
  {
221
218
    return m_tok_end;
222
219
  }
223
220
 
224
221
  /** Get the token end position, in the pre-processed buffer. */
225
 
  const char *get_cpp_tok_end()
 
222
  const char *get_cpp_tok_end() const
226
223
  {
227
224
    return m_cpp_tok_end;
228
225
  }
229
226
 
230
227
  /** Get the previous token start position, in the raw buffer. */
231
 
  const char *get_tok_start_prev()
 
228
  const char *get_tok_start_prev() const
232
229
  {
233
230
    return m_tok_start_prev;
234
231
  }
235
232
 
236
233
  /** Get the current stream pointer, in the raw buffer. */
237
 
  const char *get_ptr()
 
234
  const char *get_ptr() const
238
235
  {
239
236
    return m_ptr;
240
237
  }
241
238
 
242
239
  /** Get the current stream pointer, in the pre-processed buffer. */
243
 
  const char *get_cpp_ptr()
 
240
  const char *get_cpp_ptr() const
244
241
  {
245
242
    return m_cpp_ptr;
246
243
  }
247
244
 
248
245
  /** Get the length of the current token, in the raw buffer. */
249
 
  uint32_t yyLength()
 
246
  uint32_t yyLength() const
250
247
  {
251
248
    /*
252
249
      The assumption is that the lexical analyser is always 1 character ahead,
257
254
  }
258
255
 
259
256
  /** Get the utf8-body string. */
260
 
  const char *get_body_utf8_str()
 
257
  const char *get_body_utf8_str() const
261
258
  {
262
259
    return m_body_utf8;
263
260
  }
264
261
 
265
262
  /** Get the utf8-body length. */
266
 
  uint32_t get_body_utf8_length()
 
263
  uint32_t get_body_utf8_length() const
267
264
  {
268
265
    return m_body_utf8_ptr - m_body_utf8;
269
266
  }
270
267
 
271
 
  void body_utf8_start(Session *session, const char *begin_ptr);
272
268
  void body_utf8_append(const char *ptr);
273
269
  void body_utf8_append(const char *ptr, const char *end_ptr);
274
 
  void body_utf8_append_literal(const LEX_STRING *txt,
 
270
  void body_utf8_append_literal(const lex_string_t *txt,
275
271
                                const char *end_ptr);
276
272
 
277
273
  /** Current thread. */
371
367
    Starting position of the TEXT_STRING or IDENT in the pre-processed
372
368
    buffer.
373
369
 
374
 
    NOTE: this member must be used within DRIZZLElex() function only.
 
370
    NOTE: this member must be used within base_sql_lex() function only.
375
371
  */
376
372
  const char *m_cpp_text_start;
377
373
 
379
375
    Ending position of the TEXT_STRING or IDENT in the pre-processed
380
376
    buffer.
381
377
 
382
 
    NOTE: this member must be used within DRIZZLElex() function only.
 
378
    NOTE: this member must be used within base_sql_lex() function only.
383
379
    */
384
380
  const char *m_cpp_text_end;
385
381
 
387
383
 
388
384
} /* namespace drizzled */
389
385
 
390
 
#endif /* DRIZZLED_LEX_INPUT_STREAM_H */