src/lexerScanner.cpp

changeset 126
c5858c0cd476
parent 119
bdf8d46c145f
child 133
dbbdb870c835
equal deleted inserted replaced
125:85814c0918c5 126:c5858c0cd476
26 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #include <cstdio> 29 #include <cstdio>
30 #include <cstdlib> 30 #include <cstdlib>
31 #include <cassert>
32 #include <cstring> 31 #include <cstring>
33 #include <string> 32 #include <string>
34 #include "lexerScanner.h" 33 #include "lexerScanner.h"
35 #include "lexer.h" 34 #include "lexer.h"
36 35
126 fsize = ftell (fp); 125 fsize = ftell (fp);
127 rewind (fp); 126 rewind (fp);
128 m_data = new char[fsize]; 127 m_data = new char[fsize];
129 m_position = m_lineBreakPosition = &m_data[0]; 128 m_position = m_lineBreakPosition = &m_data[0];
130 bytes = fread (m_data, 1, fsize, fp); 129 bytes = fread (m_data, 1, fsize, fp);
131 assert (bytes >= fsize); 130 ASSERT_GT_EQ (bytes, fsize)
132 } 131 }
133 132
134 // ============================================================================= 133 // =============================================================================
135 // 134 //
136 LexerScanner::~LexerScanner() 135 LexerScanner::~LexerScanner()
289 288
290 // ============================================================================= 289 // =============================================================================
291 // 290 //
292 String LexerScanner::getTokenString (ETokenType a) 291 String LexerScanner::getTokenString (ETokenType a)
293 { 292 {
294 assert ((int) a <= gLastNamedToken); 293 ASSERT_LT_EQ (a, gLastNamedToken);
295 return gTokenStrings[a]; 294 return gTokenStrings[a];
296 } 295 }
297 296
298 // ============================================================================= 297 // =============================================================================
299 // 298 //

mercurial