~ubuntu-branches/ubuntu/maverick/aspectc++/maverick

« back to all changes in this revision

Viewing changes to Puma/gen-release/step1/inc/Puma/CScanBuffer.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#define __CScanBuffer_h__
21
21
 
22
22
#include "Puma/ScanBuffer.h"
23
 
#include "Puma/Array.h"
24
23
 
25
24
namespace Puma {
26
25
 
27
26
 
28
 
class CScanBuffer {
29
 
  ScanBuffer *next_buffer;
30
 
  bool on_new_line;
31
 
  int nl_pos;
 
27
class CScanBuffer : public ScanBuffer {
32
28
 
 
29
  int _new_line_pos;
33
30
  void check ();
34
31
 
35
32
public:
36
 
  void decorate (ScanBuffer *nb) { next_buffer = nb; }
 
33
  CScanBuffer () : _new_line_pos (-1) {}
37
34
  inline char next ();
38
35
  inline void reset ();
 
36
  inline void retry (); 
39
37
  inline void accept (int len);
40
 
  inline void retry ();
41
 
  bool new_line () const { return on_new_line; }
42
 
  char *token () { return next_buffer->token (); }
43
 
  int len () const { return next_buffer->len (); }
44
 
  void more (int len) { next_buffer->more (len); }
45
 
  ScanBuffer::State state () const { return next_buffer->state (); }
 
38
  inline bool new_line (int len) const;
46
39
};
47
40
 
48
41
 
49
42
inline char CScanBuffer::next () {
50
 
  char character = next_buffer->next ();
51
 
  if (character == '\n' && nl_pos == -1)
52
 
    nl_pos = len () - 1;
53
 
  check ();
 
43
  char character = ScanBuffer::next ();
 
44
  if (character == '\n' && _new_line_pos == -1)
 
45
    _new_line_pos = len ();
 
46
  if (ScanBuffer::state () == ScanBuffer::STATE_OK &&
 
47
      ScanBuffer::lookahead () == '\\')
 
48
    check ();
54
49
  return character;
55
50
}
56
51
 
57
52
inline void CScanBuffer::reset () { 
58
 
  next_buffer->reset (); 
59
 
  on_new_line = true;
60
 
  nl_pos = -1;
 
53
  ScanBuffer::reset ();
 
54
  _new_line_pos = -1;
61
55
  check ();
62
56
}
63
57
 
64
 
 
65
58
inline void CScanBuffer::retry () {
66
 
  nl_pos = -1;
67
 
  next_buffer->retry ();
 
59
  ScanBuffer::retry ();
 
60
  _new_line_pos = -1;
68
61
}
69
62
 
70
 
 
71
63
inline void CScanBuffer::accept (int len) {
72
 
  on_new_line = (nl_pos >= 0 && nl_pos < len);
73
 
  nl_pos = -1;
74
 
  next_buffer->accept (len);
 
64
  ScanBuffer::accept (len);
 
65
  _new_line_pos = -1;
 
66
}
 
67
 
 
68
inline bool CScanBuffer::new_line (int len) const {
 
69
  return _new_line_pos != -1 && _new_line_pos <= len;
75
70
}
76
71
 
77
72
} // namespace Puma