Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
vhdl::parser::CharStream Class Reference

#include <CharStream.h>

Public Member Functions

void setTabSize (int i)
 
int getTabSize (int i)
 
virtual int getColumn ()
 
virtual int getLine ()
 
virtual int getEndColumn ()
 
virtual int getEndLine ()
 
virtual int getBeginColumn ()
 
virtual int getBeginLine ()
 
virtual bool getTrackLineColumn ()
 
virtual void setTrackLineColumn (bool val)
 
virtual void backup (int amount)
 
virtual JAVACC_CHAR_TYPE BeginToken ()
 
virtual JAVACC_CHAR_TYPE readChar ()
 
virtual void ExpandBuff (bool wrapAround)
 
virtual void FillBuff ()
 
virtual JAVACC_STRING_TYPE GetImage ()
 
virtual JAVACC_STRING_TYPE GetSuffix (int len)
 
virtual void DeleteBuffers ()
 
virtual ~CharStream ()
 
bool endOfInput ()
 
 CharStream (const JAVACC_CHAR_TYPE *buf, int sz, int startline, int startcolumn, int buffersize)
 
 CharStream (const JAVACC_CHAR_TYPE *buf, int sz, int startline, int startcolumn)
 
 CharStream (const JAVACC_STRING_TYPE &str, int startline, int startcolumn, int buffersize)
 
 CharStream (const JAVACC_STRING_TYPE &str, int startline, int startcolumn)
 
 CharStream (ReaderStream *input_stream, int startline, int startcolumn, int buffersize)
 
 CharStream (ReaderStream *input_stream, int startline, int startcolumn)
 
 CharStream (ReaderStream *input_stream)
 
virtual void ReInit (ReaderStream *input_stream, int startline, int startcolumn, int buffersize)
 
virtual void ReInit (ReaderStream *input_stream, int startline, int startcolumn)
 
virtual void ReInit (ReaderStream *input_stream)
 
virtual void ReInit (const JAVACC_STRING_TYPE &str, int startline, int startcolumn, int buffersize)
 
virtual void ReInit (const JAVACC_STRING_TYPE &str, int startline, int startcolumn)
 
virtual void adjustBeginLineColumn (int newLine, int newCol)
 

Protected Member Functions

virtual void UpdateLineColumn (JAVACC_CHAR_TYPE c)
 

Protected Attributes

int * bufline
 
int * bufcolumn
 
JAVACC_CHAR_TYPEbuffer
 
int bufpos
 
int bufsize
 
int tokenBegin
 
int column
 
int line
 
bool prevCharIsCR
 
bool prevCharIsLF
 
int available
 
int maxNextCharInd
 
int inBuf
 
int tabSize
 
bool trackLineColumn
 
ReaderStreaminputStream
 
bool deleteStream
 

Private Member Functions

int getBufcolumn (int pos)
 
int getBufline (int pos)
 

Detailed Description

This class describes a character stream that maintains line and column number positions of the characters. It also has the capability to backup the stream to some extent. An implementation of this class is used in the TokenManager implementation generated by JavaCCParser.

All the methods except backup can be implemented in any fashion. backup needs to be implemented correctly for the correct operation of the lexer. Rest of the methods are all used to get information like line number, column number and the string that constitutes a token and are not used by the lexer. Hence their implementation won't affect the generated lexer's operation.

Definition at line 30 of file CharStream.h.

Constructor & Destructor Documentation

virtual vhdl::parser::CharStream::~CharStream ( )
inlinevirtual

Definition at line 152 of file CharStream.h.

152  {
153  if (deleteStream) {
154  delete inputStream;
155  }
156  DeleteBuffers();
157  }
virtual void DeleteBuffers()
Definition: CharStream.cc:67
ReaderStream * inputStream
Definition: CharStream.h:260
vhdl::parser::CharStream::CharStream ( const JAVACC_CHAR_TYPE buf,
int  sz,
int  startline,
int  startcolumn,
int  buffersize 
)
inline

Definition at line 163 of file CharStream.h.

164  :
165  bufline(NULL), bufcolumn(NULL), buffer(NULL), bufpos(0), bufsize(0),
166  tokenBegin(0), column(0), line(0), prevCharIsCR(false), prevCharIsLF(false),
167  available(0), maxNextCharInd(0), inBuf(0), tabSize(1), trackLineColumn(true),
168  inputStream(NULL), deleteStream(false) {
169  ReInit(JAVACC_STRING_TYPE(buf, sz), startline, startcolumn, buffersize);
170  }
#define JAVACC_STRING_TYPE
Definition: JavaCC.h:16
virtual void ReInit(ReaderStream *input_stream, int startline, int startcolumn, int buffersize)
Definition: CharStream.cc:43
JAVACC_CHAR_TYPE * buffer
Definition: CharStream.h:247
ReaderStream * inputStream
Definition: CharStream.h:260
vhdl::parser::CharStream::CharStream ( const JAVACC_CHAR_TYPE buf,
int  sz,
int  startline,
int  startcolumn 
)
inline

Definition at line 172 of file CharStream.h.

172  :
173  bufline(NULL), bufcolumn(NULL), buffer(NULL), bufpos(0), bufsize(0),
174  tokenBegin(0), column(0), line(0), prevCharIsCR(false), prevCharIsLF(false),
175  available(0), maxNextCharInd(0), inBuf(0), tabSize(1), trackLineColumn(true),
176  inputStream(NULL), deleteStream(false) {
177  ReInit(JAVACC_STRING_TYPE(buf, sz), startline, startcolumn, INITIAL_BUFFER_SIZE);
178  }
#define JAVACC_STRING_TYPE
Definition: JavaCC.h:16
#define INITIAL_BUFFER_SIZE
Definition: CharStream.h:8
virtual void ReInit(ReaderStream *input_stream, int startline, int startcolumn, int buffersize)
Definition: CharStream.cc:43
JAVACC_CHAR_TYPE * buffer
Definition: CharStream.h:247
ReaderStream * inputStream
Definition: CharStream.h:260
vhdl::parser::CharStream::CharStream ( const JAVACC_STRING_TYPE str,
int  startline,
int  startcolumn,
int  buffersize 
)
inline

Definition at line 180 of file CharStream.h.

181  :
182  bufline(NULL), bufcolumn(NULL), buffer(NULL), bufpos(0), bufsize(0),
183  tokenBegin(0), column(0), line(0), prevCharIsCR(false), prevCharIsLF(false),
184  available(0), maxNextCharInd(0), inBuf(0), tabSize(1), trackLineColumn(true),
185  inputStream(NULL), deleteStream(false) {
186  ReInit(str, startline, startcolumn, buffersize);
187  }
virtual void ReInit(ReaderStream *input_stream, int startline, int startcolumn, int buffersize)
Definition: CharStream.cc:43
JAVACC_CHAR_TYPE * buffer
Definition: CharStream.h:247
ReaderStream * inputStream
Definition: CharStream.h:260
static QCString str
vhdl::parser::CharStream::CharStream ( const JAVACC_STRING_TYPE str,
int  startline,
int  startcolumn 
)
inline

Definition at line 189 of file CharStream.h.

189  :
190  bufline(NULL), bufcolumn(NULL), buffer(NULL), bufpos(0), bufsize(0),
191  tokenBegin(0), column(0), line(0), prevCharIsCR(false), prevCharIsLF(false),
192  available(0), maxNextCharInd(0), inBuf(0), tabSize(1), trackLineColumn(true),
193  inputStream(NULL), deleteStream(false) {
194  ReInit(str, startline, startcolumn, INITIAL_BUFFER_SIZE);
195  }
#define INITIAL_BUFFER_SIZE
Definition: CharStream.h:8
virtual void ReInit(ReaderStream *input_stream, int startline, int startcolumn, int buffersize)
Definition: CharStream.cc:43
JAVACC_CHAR_TYPE * buffer
Definition: CharStream.h:247
ReaderStream * inputStream
Definition: CharStream.h:260
static QCString str
vhdl::parser::CharStream::CharStream ( ReaderStream input_stream,
int  startline,
int  startcolumn,
int  buffersize 
)
inline

Definition at line 197 of file CharStream.h.

198  :
199  bufline(NULL), bufcolumn(NULL), buffer(NULL), bufpos(0), bufsize(0),
200  tokenBegin(0), column(0), line(0), prevCharIsCR(false), prevCharIsLF(false),
201  available(0), maxNextCharInd(0), inBuf(0), tabSize(1), trackLineColumn(true),
202  inputStream(NULL), deleteStream(false) {
203  ReInit(input_stream, startline, startcolumn, INITIAL_BUFFER_SIZE);
204  }
#define INITIAL_BUFFER_SIZE
Definition: CharStream.h:8
virtual void ReInit(ReaderStream *input_stream, int startline, int startcolumn, int buffersize)
Definition: CharStream.cc:43
JAVACC_CHAR_TYPE * buffer
Definition: CharStream.h:247
ReaderStream * inputStream
Definition: CharStream.h:260
vhdl::parser::CharStream::CharStream ( ReaderStream input_stream,
int  startline,
int  startcolumn 
)
inline

Definition at line 206 of file CharStream.h.

206  :
207  bufline(NULL), bufcolumn(NULL), buffer(NULL), bufpos(0), bufsize(0),
208  tokenBegin(0), column(0), line(0), prevCharIsCR(false), prevCharIsLF(false),
209  available(0), maxNextCharInd(0), inBuf(0), tabSize(1), trackLineColumn(true),
210  inputStream(NULL), deleteStream(false) {
211  ReInit(input_stream, startline, startcolumn, INITIAL_BUFFER_SIZE);
212  }
#define INITIAL_BUFFER_SIZE
Definition: CharStream.h:8
virtual void ReInit(ReaderStream *input_stream, int startline, int startcolumn, int buffersize)
Definition: CharStream.cc:43
JAVACC_CHAR_TYPE * buffer
Definition: CharStream.h:247
ReaderStream * inputStream
Definition: CharStream.h:260
vhdl::parser::CharStream::CharStream ( ReaderStream input_stream)
inline

Definition at line 214 of file CharStream.h.

214  :
215  bufline(NULL), bufcolumn(NULL), buffer(NULL), bufpos(0), bufsize(0),
216  tokenBegin(0), column(0), line(0), prevCharIsCR(false), prevCharIsLF(false),
217  available(0), maxNextCharInd(0), inBuf(0), tabSize(1), trackLineColumn(true),
218  inputStream(NULL), deleteStream(false) {
219  ReInit(input_stream, 1, 1, INITIAL_BUFFER_SIZE);
220  }
#define INITIAL_BUFFER_SIZE
Definition: CharStream.h:8
virtual void ReInit(ReaderStream *input_stream, int startline, int startcolumn, int buffersize)
Definition: CharStream.cc:43
JAVACC_CHAR_TYPE * buffer
Definition: CharStream.h:247
ReaderStream * inputStream
Definition: CharStream.h:260

Member Function Documentation

void vhdl::parser::CharStream::adjustBeginLineColumn ( int  newLine,
int  newCol 
)
virtual

Definition at line 73 of file CharStream.cc.

73  {
74  int start = tokenBegin;
75  int len;
76 
77  if (bufpos >= tokenBegin) {
78  len = bufpos - tokenBegin + inBuf + 1;
79  } else {
80  len = bufsize - tokenBegin + bufpos + 1 + inBuf;
81  }
82 
83  int i = 0, j = 0, k = 0;
84  int nextColDiff = 0, columnDiff = 0;
85 
86  while (i < len && bufline[j = start % bufsize] ==
87  bufline[k = (start + 1) % bufsize]) {
88  bufline[j] = newLine;
89  nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
90  bufcolumn[j] = newCol + columnDiff;
91  columnDiff = nextColDiff;
92  i++;
93  start++;
94  }
95 
96  if (i < len) {
97  bufline[j] = newLine++;
98  bufcolumn[j] = newCol + columnDiff;
99 
100  while (i++ < len) {
101  if (bufline[j = start % bufsize] != bufline[(start + 1) % bufsize])
102  bufline[j] = newLine++;
103  else
104  bufline[j] = newLine;
105  start++;
106  }
107  }
108 
109  line = bufline[j];
110  column = bufcolumn[j];
111 }
static void newLine()
std::vector< std::string > column
virtual void vhdl::parser::CharStream::backup ( int  amount)
inlinevirtual

Backs up the input stream by amount steps. Lexer calls this method if it had already read some characters, but could not use them to match a (longer) token. So, they will be used again as the prefix of the next token and it is the implemetation's responsibility to do this right.

Definition at line 66 of file CharStream.h.

66  {
67  inBuf += amount;
68  bufpos -= amount;
69  if (bufpos < 0) {
70  bufpos += bufsize;
71  }
72  }
virtual JAVACC_CHAR_TYPE vhdl::parser::CharStream::BeginToken ( )
inlinevirtual

Returns the next character that marks the beginning of the next token. All characters must remain in the buffer between two successive calls to this method to implement backup correctly.

Definition at line 79 of file CharStream.h.

79  {
80  tokenBegin = -1;
83  return c;
84  }
#define JAVACC_CHAR_TYPE
Definition: JavaCC.h:12
virtual JAVACC_CHAR_TYPE readChar()
Definition: CharStream.h:92
void vhdl::parser::CharStream::DeleteBuffers ( )
virtual

The lexer calls this function to indicate that it is done with the stream and hence implementations can free any resources held by this class.

Definition at line 67 of file CharStream.cc.

67  {
68  delete[] buffer;
69  delete[] bufline;
70  delete[] bufcolumn;
71 }
JAVACC_CHAR_TYPE * buffer
Definition: CharStream.h:247
bool vhdl::parser::CharStream::endOfInput ( )
inline

Definition at line 159 of file CharStream.h.

159  {
160  return inBuf == 0 && bufpos + 1 >= maxNextCharInd && inputStream->endOfInput();
161  }
virtual bool endOfInput()
Definition: JavaCC.h:29
ReaderStream * inputStream
Definition: CharStream.h:260
void vhdl::parser::CharStream::ExpandBuff ( bool  wrapAround)
virtual

Definition at line 113 of file CharStream.cc.

113  {
114  JAVACC_CHAR_TYPE *newbuffer = new JAVACC_CHAR_TYPE[bufsize + 2048];
115  int *newbufline = new int[bufsize + 2048];
116  int *newbufcolumn = new int[bufsize + 2048];
117 
118  if (wrapAround) {
119  ArrayCopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
120  ArrayCopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
121  ArrayCopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
122  ArrayCopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
123  ArrayCopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
124  ArrayCopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
125  bufpos += (bufsize - tokenBegin);
126  } else {
127  ArrayCopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
128  ArrayCopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
129  ArrayCopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
130  bufpos -= tokenBegin;
131  }
132 
134  DeleteBuffers();
135  buffer = newbuffer;
136  bufline = newbufline;
137  bufcolumn = newbufcolumn;
138  bufsize += 2048;
139  available = bufsize;
140  tokenBegin = 0;
141 }
virtual void DeleteBuffers()
Definition: CharStream.cc:67
#define JAVACC_CHAR_TYPE
Definition: JavaCC.h:12
JAVACC_CHAR_TYPE * buffer
Definition: CharStream.h:247
void vhdl::parser::CharStream::FillBuff ( )
virtual

Definition at line 143 of file CharStream.cc.

143  {
144  if (maxNextCharInd == available) {
145  if (available == bufsize) {
146  if (tokenBegin > 2048) {
147  bufpos = maxNextCharInd = 0;
149  } else if (tokenBegin < 0) {
150  bufpos = maxNextCharInd = 0;
151  } else {
152  ExpandBuff(false);
153  }
154  } else if (available > tokenBegin) {
155  available = bufsize;
156  } else if ((tokenBegin - available) < 2048) {
157  ExpandBuff(true);
158  } else {
160  }
161  }
162 
164  if (i > 0) {
165  maxNextCharInd += i;
166  } else {
167  --bufpos;
168  backup(0);
169  if (tokenBegin == -1) {
170  tokenBegin = bufpos;
171  }
172  }
173 }
virtual void ExpandBuff(bool wrapAround)
Definition: CharStream.cc:113
virtual size_t read(JAVACC_CHAR_TYPE *, int, size_t)
Definition: JavaCC.h:28
JAVACC_CHAR_TYPE * buffer
Definition: CharStream.h:247
virtual void backup(int amount)
Definition: CharStream.h:66
ReaderStream * inputStream
Definition: CharStream.h:260
virtual int vhdl::parser::CharStream::getBeginColumn ( )
inlinevirtual

Definition at line 54 of file CharStream.h.

virtual int vhdl::parser::CharStream::getBeginLine ( )
inlinevirtual

Definition at line 55 of file CharStream.h.

55 { return getBufline(tokenBegin); }
int getBufline(int pos)
Definition: CharStream.h:42
int vhdl::parser::CharStream::getBufcolumn ( int  pos)
inlineprivate

Definition at line 35 of file CharStream.h.

35  {
36  if (trackLineColumn && pos>=0) {
37  return bufcolumn[pos];
38  } else {
39  return -1;
40  }
41  }
int vhdl::parser::CharStream::getBufline ( int  pos)
inlineprivate

Definition at line 42 of file CharStream.h.

42  {
43  if (trackLineColumn && pos>=0) {
44  return bufline[pos];
45  } else {
46  return -1;
47  }
48  }
virtual int vhdl::parser::CharStream::getColumn ( )
inlinevirtual

Definition at line 50 of file CharStream.h.

50 { return getBufcolumn(bufpos); }
int getBufcolumn(int pos)
Definition: CharStream.h:35
virtual int vhdl::parser::CharStream::getEndColumn ( )
inlinevirtual

Definition at line 52 of file CharStream.h.

52 { return getBufcolumn(bufpos); }
int getBufcolumn(int pos)
Definition: CharStream.h:35
virtual int vhdl::parser::CharStream::getEndLine ( )
inlinevirtual

Definition at line 53 of file CharStream.h.

53 { return getBufline(bufpos); }
int getBufline(int pos)
Definition: CharStream.h:42
virtual JAVACC_STRING_TYPE vhdl::parser::CharStream::GetImage ( )
inlinevirtual

Returns a string made up of characters from the marked token beginning to the current buffer position. Implementations can return anything that they want to. For example, for efficiency, one might decide to just return NULL, which is a valid implementation.

Definition at line 126 of file CharStream.h.

126  {
127  if (bufpos >= tokenBegin)
129  else
131  }
#define JAVACC_STRING_TYPE
Definition: JavaCC.h:16
JAVACC_CHAR_TYPE * buffer
Definition: CharStream.h:247
virtual int vhdl::parser::CharStream::getLine ( )
inlinevirtual

Definition at line 51 of file CharStream.h.

51 { return getBufline(bufpos); }
int getBufline(int pos)
Definition: CharStream.h:42
virtual JAVACC_STRING_TYPE vhdl::parser::CharStream::GetSuffix ( int  len)
inlinevirtual

Returns an array of characters that make up the suffix of length 'len' for the currently matched token. This is used to build up the matched string for use in actions in the case of MORE. A simple and inefficient implementation of this is as follows :

Definition at line 139 of file CharStream.h.

139  {
140  if ((bufpos + 1) >= len) {
141  return JAVACC_STRING_TYPE(buffer + bufpos - len + 1, len);
142  }
143  return JAVACC_STRING_TYPE(buffer + bufsize - (len - bufpos - 1), len - bufpos - 1).append(buffer, bufpos + 1);
144  }
#define JAVACC_STRING_TYPE
Definition: JavaCC.h:16
JAVACC_CHAR_TYPE * buffer
Definition: CharStream.h:247
int vhdl::parser::CharStream::getTabSize ( int  i)
inline

Definition at line 33 of file CharStream.h.

33 { return tabSize; }
virtual bool vhdl::parser::CharStream::getTrackLineColumn ( )
inlinevirtual

Definition at line 57 of file CharStream.h.

57 { return trackLineColumn; }
virtual JAVACC_CHAR_TYPE vhdl::parser::CharStream::readChar ( )
inlinevirtual

Returns the next character from the selected input. The method of selecting the input is the responsibility of the class implementing this class.

Definition at line 92 of file CharStream.h.

92  {
93  if (inBuf > 0) {
94  --inBuf;
95  ++bufpos;
96  if (bufpos == bufsize) {
97  bufpos = 0;
98  }
99  return buffer[bufpos];
100  }
101 
102  ++bufpos;
103  if (bufpos >= maxNextCharInd) {
104  FillBuff();
105  }
106 
108 
109  if (trackLineColumn) {
110  UpdateLineColumn(c);
111  }
112 
113  return c;
114  }
#define JAVACC_CHAR_TYPE
Definition: JavaCC.h:12
JAVACC_CHAR_TYPE * buffer
Definition: CharStream.h:247
virtual void UpdateLineColumn(JAVACC_CHAR_TYPE c)
Definition: CharStream.cc:175
virtual void FillBuff()
Definition: CharStream.cc:143
void vhdl::parser::CharStream::ReInit ( ReaderStream input_stream,
int  startline,
int  startcolumn,
int  buffersize 
)
virtual

Definition at line 43 of file CharStream.cc.

44  {
45  if (deleteStream) {
46  delete inputStream;
47  }
48 
49  if (buffer != NULL) {
50  DeleteBuffers();
51  }
52 
53  available = bufsize = buffersize;
54  buffer = new JAVACC_CHAR_TYPE[buffersize];
55  bufline = new int[buffersize];
56  bufcolumn = new int[buffersize];
57 
58  column = startcolumn - 1;
59  inputStream = input_stream;
60  line = startline;
61  prevCharIsLF = prevCharIsCR = false;
63  bufpos = -1;
64  deleteStream = false;
65 }
virtual void DeleteBuffers()
Definition: CharStream.cc:67
#define JAVACC_CHAR_TYPE
Definition: JavaCC.h:12
JAVACC_CHAR_TYPE * buffer
Definition: CharStream.h:247
std::vector< std::string > column
ReaderStream * inputStream
Definition: CharStream.h:260
virtual void vhdl::parser::CharStream::ReInit ( ReaderStream input_stream,
int  startline,
int  startcolumn 
)
inlinevirtual

Definition at line 224 of file CharStream.h.

224  {
225  ReInit(input_stream, startline, startcolumn, INITIAL_BUFFER_SIZE);
226  }
#define INITIAL_BUFFER_SIZE
Definition: CharStream.h:8
virtual void ReInit(ReaderStream *input_stream, int startline, int startcolumn, int buffersize)
Definition: CharStream.cc:43
virtual void vhdl::parser::CharStream::ReInit ( ReaderStream input_stream)
inlinevirtual

Definition at line 228 of file CharStream.h.

228  {
229  ReInit(input_stream, 1, 1, INITIAL_BUFFER_SIZE);
230  }
#define INITIAL_BUFFER_SIZE
Definition: CharStream.h:8
virtual void ReInit(ReaderStream *input_stream, int startline, int startcolumn, int buffersize)
Definition: CharStream.cc:43
void vhdl::parser::CharStream::ReInit ( const JAVACC_STRING_TYPE str,
int  startline,
int  startcolumn,
int  buffersize 
)
virtual

Definition at line 36 of file CharStream.cc.

37  {
38  StringReaderStream *stream = new StringReaderStream(str);
39  ReInit(stream, startline, startcolumn, buffersize);
40  deleteStream = true;
41 }
virtual void ReInit(ReaderStream *input_stream, int startline, int startcolumn, int buffersize)
Definition: CharStream.cc:43
static QCString str
virtual void vhdl::parser::CharStream::ReInit ( const JAVACC_STRING_TYPE str,
int  startline,
int  startcolumn 
)
inlinevirtual

Definition at line 235 of file CharStream.h.

236  {
237  ReInit(str, startline, startcolumn, INITIAL_BUFFER_SIZE);
238  }
#define INITIAL_BUFFER_SIZE
Definition: CharStream.h:8
virtual void ReInit(ReaderStream *input_stream, int startline, int startcolumn, int buffersize)
Definition: CharStream.cc:43
static QCString str
void vhdl::parser::CharStream::setTabSize ( int  i)
inline

Definition at line 32 of file CharStream.h.

32 { tabSize = i; }
virtual void vhdl::parser::CharStream::setTrackLineColumn ( bool  val)
inlinevirtual

Definition at line 58 of file CharStream.h.

void vhdl::parser::CharStream::UpdateLineColumn ( JAVACC_CHAR_TYPE  c)
protectedvirtual

Definition at line 175 of file CharStream.cc.

175  {
176  column++;
177  if (prevCharIsLF) {
178  prevCharIsLF = false;
179  column = 1;
180  line++;
181  } else if (prevCharIsCR) {
182  prevCharIsCR = false;
183  if (c == '\n') {
184  prevCharIsLF = true;
185  } else {
186  column = 1;
187  line++;
188  }
189  }
190 
191  switch (c) {
192  case '\r' :
193  prevCharIsCR = true;
194  break;
195  case '\n' :
196  prevCharIsLF = true;
197  break;
198  case '\t' :
199  column--;
200  column += (tabSize - (column % tabSize));
201  break;
202  default :
203  break;
204  }
205 
206  bufline[bufpos] = line;
208 }
std::vector< std::string > column

Member Data Documentation

int vhdl::parser::CharStream::available
protected

Definition at line 255 of file CharStream.h.

int* vhdl::parser::CharStream::bufcolumn
protected

Definition at line 246 of file CharStream.h.

JAVACC_CHAR_TYPE* vhdl::parser::CharStream::buffer
protected

Definition at line 247 of file CharStream.h.

int* vhdl::parser::CharStream::bufline
protected

Definition at line 245 of file CharStream.h.

int vhdl::parser::CharStream::bufpos
protected

Definition at line 248 of file CharStream.h.

int vhdl::parser::CharStream::bufsize
protected

Definition at line 249 of file CharStream.h.

int vhdl::parser::CharStream::column
protected

Definition at line 251 of file CharStream.h.

bool vhdl::parser::CharStream::deleteStream
protected

Definition at line 261 of file CharStream.h.

int vhdl::parser::CharStream::inBuf
protected

Definition at line 257 of file CharStream.h.

ReaderStream* vhdl::parser::CharStream::inputStream
protected

Definition at line 260 of file CharStream.h.

int vhdl::parser::CharStream::line
protected

Definition at line 252 of file CharStream.h.

int vhdl::parser::CharStream::maxNextCharInd
protected

Definition at line 256 of file CharStream.h.

bool vhdl::parser::CharStream::prevCharIsCR
protected

Definition at line 253 of file CharStream.h.

bool vhdl::parser::CharStream::prevCharIsLF
protected

Definition at line 254 of file CharStream.h.

int vhdl::parser::CharStream::tabSize
protected

Definition at line 258 of file CharStream.h.

int vhdl::parser::CharStream::tokenBegin
protected

Definition at line 250 of file CharStream.h.

bool vhdl::parser::CharStream::trackLineColumn
protected

Definition at line 259 of file CharStream.h.


The documentation for this class was generated from the following files: