#line 2 "scanner.cc"
#line 4 "scanner.cc"
#define YY_INT_ALIGNED short int
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
#define yyFlexLexer ExampleFlexLexer
#ifndef FLEXINT_H
#define FLEXINT_H
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif
#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif
#ifndef INT8_MIN
#define INT8_MIN (-128)
#endif
#ifndef INT16_MIN
#define INT16_MIN (-32767-1)
#endif
#ifndef INT32_MIN
#define INT32_MIN (-2147483647-1)
#endif
#ifndef INT8_MAX
#define INT8_MAX (127)
#endif
#ifndef INT16_MAX
#define INT16_MAX (32767)
#endif
#ifndef INT32_MAX
#define INT32_MAX (2147483647)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX (255U)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX (65535U)
#endif
#ifndef UINT32_MAX
#define UINT32_MAX (4294967295U)
#endif
#endif
#include <iostream>
#include <errno.h>
#include <cstdlib>
#include <cstring>
#ifdef __cplusplus
#define YY_USE_CONST
#else
#if defined (__STDC__)
#define YY_USE_CONST
#endif
#endif
#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif
#define YY_NULL 0
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
#define BEGIN (yy_start) = 1 + 2 *
#define YY_START (((yy_start) - 1) / 2)
#define YYSTATE YY_START
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
#define YY_NEW_FILE yyrestart( yyin )
#define YY_END_OF_BUFFER_CHAR 0
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE 16384
#endif
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
extern int yyleng;
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n)
#define yyless(n) \
do \
{ \
\
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
*yy_cp = (yy_hold_char); \
YY_RESTORE_YY_MORE_OFFSET \
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; \
} \
while ( 0 )
#define unput(c) yyunput( c, (yytext_ptr) )
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
{
std::istream* yy_input_file;
char *yy_ch_buf;
char *yy_buf_pos;
yy_size_t yy_buf_size;
int yy_n_chars;
int yy_is_our_buffer;
int yy_is_interactive;
int yy_at_bol;
int yy_bs_lineno;
int yy_bs_column;
int yy_fill_buffer;
int yy_buffer_status;
#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
#define YY_BUFFER_EOF_PENDING 2
};
#endif
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
: NULL)
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
void *Examplealloc (yy_size_t );
void *Examplerealloc (void *,yy_size_t );
void Examplefree (void * );
#define yy_new_buffer yy_create_buffer
#define yy_set_interactive(is_interactive) \
{ \
if ( ! YY_CURRENT_BUFFER ){ \
yyensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
yy_create_buffer( yyin, YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
#define yy_set_bol(at_bol) \
{ \
if ( ! YY_CURRENT_BUFFER ){\
yyensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
yy_create_buffer( yyin, YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
#define FLEX_DEBUG
typedef unsigned char YY_CHAR;
#define yytext_ptr yytext
#include <FlexLexer.h>
#define YY_DO_BEFORE_ACTION \
(yytext_ptr) = yy_bp; \
\
yyleng = (size_t) (yy_cp - yy_bp); \
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
\
(yy_c_buf_p) = yy_cp;
#define YY_NUM_RULES 7
#define YY_END_OF_BUFFER 8
struct yy_trans_info
{
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[15] =
{ 0,
0, 0, 8, 6, 4, 5, 1, 3, 4, 2,
1, 3, 2, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 4, 4, 5, 1, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 1, 1, 1,
1, 1, 1, 1, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
1, 1, 1, 1, 4, 1, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1
} ;
static yyconst flex_int32_t yy_meta[8] =
{ 0,
1, 1, 1, 2, 2, 2, 2
} ;
static yyconst flex_int16_t yy_base[16] =
{ 0,
0, 0, 15, 16, 12, 16, 3, 0, 11, 6,
0, 0, 5, 16, 8
} ;
static yyconst flex_int16_t yy_def[16] =
{ 0,
14, 1, 14, 14, 14, 14, 14, 15, 14, 14,
7, 15, 14, 0, 14
} ;
static yyconst flex_int16_t yy_nxt[24] =
{ 0,
4, 5, 6, 4, 4, 7, 8, 10, 11, 12,
13, 13, 9, 9, 14, 3, 14, 14, 14, 14,
14, 14, 14
} ;
static yyconst flex_int16_t yy_chk[24] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 7, 7, 15,
13, 10, 9, 5, 3, 14, 14, 14, 14, 14,
14, 14, 14
} ;
static yyconst flex_int16_t yy_rule_linenum[7] =
{ 0,
61, 66, 71, 77, 82, 88
} ;
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
#line 1 "scanner.ll"
#line 5 "scanner.ll"
#include <string>
#include "scanner.h"
typedef example::Parser::token token;
typedef example::Parser::token_type token_type;
#define yyterminate() return token::END
#define YY_NO_UNISTD_H
#line 48 "scanner.ll"
#define YY_USER_ACTION yylloc->columns(yyleng);
#line 523 "scanner.cc"
#define INITIAL 0
#ifndef YY_NO_UNISTD_H
#include <unistd.h>
#endif
#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * );
#endif
#ifndef YY_NO_INPUT
#endif
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif
#ifndef ECHO
#define ECHO LexerOutput( yytext, yyleng )
#endif
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
\
\
\
if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
YY_FATAL_ERROR( "input in flex scanner failed" );
#endif
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) LexerError( msg )
#endif
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1
#define YY_DECL int yyFlexLexer::yylex()
#endif
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif
#ifndef YY_BREAK
#define YY_BREAK break;
#endif
#define YY_RULE_SETUP \
YY_USER_ACTION
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
#line 51 "scanner.ll"
yylloc->step();
#line 691 "scanner.cc"
if ( !(yy_init) )
{
(yy_init) = 1;
#ifdef YY_USER_INIT
YY_USER_INIT;
#endif
if ( ! (yy_start) )
(yy_start) = 1;
if ( ! yyin )
yyin = & std::cin;
if ( ! yyout )
yyout = & std::cout;
if ( ! YY_CURRENT_BUFFER ) {
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
yy_create_buffer( yyin, YY_BUF_SIZE );
}
yy_load_buffer_state( );
}
while ( 1 )
{
yy_cp = (yy_c_buf_p);
*yy_cp = (yy_hold_char);
yy_bp = yy_cp;
yy_current_state = (yy_start);
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
(yy_last_accepting_cpos) = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 15 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_current_state != 14 );
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);
yy_find_action:
yy_act = yy_accept[yy_current_state];
YY_DO_BEFORE_ACTION;
do_action:
if ( yy_flex_debug )
{
if ( yy_act == 0 )
std::cerr << "--scanner backing up\n";
else if ( yy_act < 7 )
std::cerr << "--accepting rule at line " << yy_rule_linenum[yy_act] <<
"(\"" << yytext << "\")\n";
else if ( yy_act == 7 )
std::cerr << "--accepting default rule (\"" << yytext << "\")\n";
else if ( yy_act == 8 )
std::cerr << "--(end of buffer or a NUL)\n";
else
std::cerr << "--EOF (start condition " << YY_START << ")\n";
}
switch ( yy_act )
{
case 0:
*yy_cp = (yy_hold_char);
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);
goto yy_find_action;
case 1:
YY_RULE_SETUP
#line 61 "scanner.ll"
{
yylval->integerVal = atoi(yytext);
return token::INTEGER;
}
YY_BREAK
case 2:
YY_RULE_SETUP
#line 66 "scanner.ll"
{
yylval->doubleVal = atof(yytext);
return token::DOUBLE;
}
YY_BREAK
case 3:
YY_RULE_SETUP
#line 71 "scanner.ll"
{
yylval->stringVal = new std::string(yytext, yyleng);
return token::STRING;
}
YY_BREAK
case 4:
YY_RULE_SETUP
#line 77 "scanner.ll"
{
yylloc->step();
}
YY_BREAK
case 5:
YY_RULE_SETUP
#line 82 "scanner.ll"
{
yylloc->lines(yyleng); yylloc->step();
return token::EOL;
}
YY_BREAK
case 6:
YY_RULE_SETUP
#line 88 "scanner.ll"
{
return static_cast<token_type>(*yytext);
}
YY_BREAK
case 7:
YY_RULE_SETUP
#line 94 "scanner.ll"
ECHO;
YY_BREAK
#line 856 "scanner.cc"
case YY_STATE_EOF(INITIAL):
yyterminate();
case YY_END_OF_BUFFER:
{
int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
*yy_cp = (yy_hold_char);
YY_RESTORE_YY_MORE_OFFSET
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
{
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
}
if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
{
yy_state_type yy_next_state;
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state( );
yy_next_state = yy_try_NUL_trans( yy_current_state );
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
if ( yy_next_state )
{
yy_cp = ++(yy_c_buf_p);
yy_current_state = yy_next_state;
goto yy_match;
}
else
{
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);
goto yy_find_action;
}
}
else switch ( yy_get_next_buffer( ) )
{
case EOB_ACT_END_OF_FILE:
{
(yy_did_buffer_switch_on_eof) = 0;
if ( yywrap( ) )
{
(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
yy_act = YY_STATE_EOF(YY_START);
goto do_action;
}
else
{
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
}
break;
}
case EOB_ACT_CONTINUE_SCAN:
(yy_c_buf_p) =
(yytext_ptr) + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state( );
yy_cp = (yy_c_buf_p);
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
goto yy_match;
case EOB_ACT_LAST_MATCH:
(yy_c_buf_p) =
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
yy_current_state = yy_get_previous_state( );
yy_cp = (yy_c_buf_p);
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
goto yy_find_action;
}
break;
}
default:
YY_FATAL_ERROR(
"fatal flex scanner internal error--no action found" );
}
}
}
yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
{
yyin = arg_yyin;
yyout = arg_yyout;
yy_c_buf_p = 0;
yy_init = 0;
yy_start = 0;
yy_flex_debug = 0;
yylineno = 1;
yy_did_buffer_switch_on_eof = 0;
yy_looking_for_trail_begin = 0;
yy_more_flag = 0;
yy_more_len = 0;
yy_more_offset = yy_prev_more_offset = 0;
yy_start_stack_ptr = yy_start_stack_depth = 0;
yy_start_stack = NULL;
yy_buffer_stack = 0;
yy_buffer_stack_top = 0;
yy_buffer_stack_max = 0;
yy_state_buf = 0;
}
yyFlexLexer::~yyFlexLexer()
{
delete [] yy_state_buf;
Examplefree(yy_start_stack );
yy_delete_buffer( YY_CURRENT_BUFFER );
Examplefree(yy_buffer_stack );
}
void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
{
if ( new_in )
{
yy_delete_buffer( YY_CURRENT_BUFFER );
yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
}
if ( new_out )
yyout = new_out;
}
#ifdef YY_INTERACTIVE
int yyFlexLexer::LexerInput( char* buf, int )
#else
int yyFlexLexer::LexerInput( char* buf, int max_size )
#endif
{
if ( yyin->eof() || yyin->fail() )
return 0;
#ifdef YY_INTERACTIVE
yyin->get( buf[0] );
if ( yyin->eof() )
return 0;
if ( yyin->bad() )
return -1;
return 1;
#else
(void) yyin->read( buf, max_size );
if ( yyin->bad() )
return -1;
else
return yyin->gcount();
#endif
}
void yyFlexLexer::LexerOutput( const char* buf, int size )
{
(void) yyout->write( buf, size );
}
int yyFlexLexer::yy_get_next_buffer()
{
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
register char *source = (yytext_ptr);
register int number_to_move, i;
int ret_val;
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
YY_FATAL_ERROR(
"fatal flex scanner internal error--end of buffer missed" );
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
{
if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
{
return EOB_ACT_END_OF_FILE;
}
else
{
return EOB_ACT_LAST_MATCH;
}
}
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
else
{
int num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
{
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
int yy_c_buf_p_offset =
(int) ((yy_c_buf_p) - b->yy_ch_buf);
if ( b->yy_is_our_buffer )
{
int new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
else
b->yy_buf_size *= 2;
b->yy_ch_buf = (char *)
Examplerealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
}
else
b->yy_ch_buf = 0;
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
"fatal error - scanner input buffer overflow" );
(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
number_to_move - 1;
}
if ( num_to_read > YY_READ_BUF_SIZE )
num_to_read = YY_READ_BUF_SIZE;
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
(yy_n_chars), (size_t) num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
if ( (yy_n_chars) == 0 )
{
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
yyrestart( yyin );
}
else
{
ret_val = EOB_ACT_LAST_MATCH;
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
YY_BUFFER_EOF_PENDING;
}
}
else
ret_val = EOB_ACT_CONTINUE_SCAN;
if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) Examplerealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
}
(yy_n_chars) += number_to_move;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
return ret_val;
}
yy_state_type yyFlexLexer::yy_get_previous_state()
{
register yy_state_type yy_current_state;
register char *yy_cp;
yy_current_state = (yy_start);
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
{
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
(yy_last_accepting_cpos) = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 15 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
}
return yy_current_state;
}
yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
{
register int yy_is_jam;
register char *yy_cp = (yy_c_buf_p);
register YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
(yy_last_accepting_cpos) = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 15 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 14);
return yy_is_jam ? 0 : yy_current_state;
}
void yyFlexLexer::yyunput( int c, register char* yy_bp)
{
register char *yy_cp;
yy_cp = (yy_c_buf_p);
*yy_cp = (yy_hold_char);
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
{
register int number_to_move = (yy_n_chars) + 2;
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
register char *source =
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
*--dest = *--source;
yy_cp += (int) (dest - source);
yy_bp += (int) (dest - source);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
YY_FATAL_ERROR( "flex scanner push-back overflow" );
}
*--yy_cp = (char) c;
(yytext_ptr) = yy_bp;
(yy_hold_char) = *yy_cp;
(yy_c_buf_p) = yy_cp;
}
int yyFlexLexer::yyinput()
{
int c;
*(yy_c_buf_p) = (yy_hold_char);
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
{
if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
*(yy_c_buf_p) = '\0';
else
{
int offset = (yy_c_buf_p) - (yytext_ptr);
++(yy_c_buf_p);
switch ( yy_get_next_buffer( ) )
{
case EOB_ACT_LAST_MATCH:
yyrestart( yyin );
case EOB_ACT_END_OF_FILE:
{
if ( yywrap( ) )
return EOF;
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
#ifdef __cplusplus
return yyinput();
#else
return input();
#endif
}
case EOB_ACT_CONTINUE_SCAN:
(yy_c_buf_p) = (yytext_ptr) + offset;
break;
}
}
}
c = *(unsigned char *) (yy_c_buf_p);
*(yy_c_buf_p) = '\0';
(yy_hold_char) = *++(yy_c_buf_p);
return c;
}
@param
@note@c
void yyFlexLexer::yyrestart( std::istream* input_file )
{
if ( ! YY_CURRENT_BUFFER ){
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
yy_create_buffer( yyin, YY_BUF_SIZE );
}
yy_init_buffer( YY_CURRENT_BUFFER, input_file );
yy_load_buffer_state( );
}
@param
void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
{
TODO
yyensure_buffer_stack ();
if ( YY_CURRENT_BUFFER == new_buffer )
return;
if ( YY_CURRENT_BUFFER )
{
*(yy_c_buf_p) = (yy_hold_char);
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
YY_CURRENT_BUFFER_LVALUE = new_buffer;
yy_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
void yyFlexLexer::yy_load_buffer_state()
{
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
(yy_hold_char) = *(yy_c_buf_p);
}
@param
@param@c
@return
YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
{
YY_BUFFER_STATE b;
b = (YY_BUFFER_STATE) Examplealloc(sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_buf_size = size;
b->yy_ch_buf = (char *) Examplealloc(b->yy_buf_size + 2 );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_is_our_buffer = 1;
yy_init_buffer( b, file );
return b;
}
@param
void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
{
if ( ! b )
return;
if ( b == YY_CURRENT_BUFFER )
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
Examplefree((void *) b->yy_ch_buf );
Examplefree((void *) b );
}
extern "C" int isatty (int );
void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
{
int oerrno = errno;
yy_flush_buffer( b );
b->yy_input_file = file;
b->yy_fill_buffer = 1;
if (b != YY_CURRENT_BUFFER){
b->yy_bs_lineno = 1;
b->yy_bs_column = 0;
}
b->yy_is_interactive = 0;
errno = oerrno;
}
@param@c
void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
{
if ( ! b )
return;
b->yy_n_chars = 0;
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
b->yy_buf_pos = &b->yy_ch_buf[0];
b->yy_at_bol = 1;
b->yy_buffer_status = YY_BUFFER_NEW;
if ( b == YY_CURRENT_BUFFER )
yy_load_buffer_state( );
}
@param
void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
{
if (new_buffer == NULL)
return;
yyensure_buffer_stack();
if ( YY_CURRENT_BUFFER )
{
*(yy_c_buf_p) = (yy_hold_char);
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
if (YY_CURRENT_BUFFER)
(yy_buffer_stack_top)++;
YY_CURRENT_BUFFER_LVALUE = new_buffer;
yy_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
void yyFlexLexer::yypop_buffer_state (void)
{
if (!YY_CURRENT_BUFFER)
return;
yy_delete_buffer(YY_CURRENT_BUFFER );
YY_CURRENT_BUFFER_LVALUE = NULL;
if ((yy_buffer_stack_top) > 0)
--(yy_buffer_stack_top);
if (YY_CURRENT_BUFFER) {
yy_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
}
void yyFlexLexer::yyensure_buffer_stack(void)
{
int num_to_alloc;
if (!(yy_buffer_stack)) {
num_to_alloc = 1;
(yy_buffer_stack) = (struct yy_buffer_state**)Examplealloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
);
if ( ! (yy_buffer_stack) )
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
(yy_buffer_stack_max) = num_to_alloc;
(yy_buffer_stack_top) = 0;
return;
}
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
int grow_size = 8 ;
num_to_alloc = (yy_buffer_stack_max) + grow_size;
(yy_buffer_stack) = (struct yy_buffer_state**)Examplerealloc
((yy_buffer_stack),
num_to_alloc * sizeof(struct yy_buffer_state*)
);
if ( ! (yy_buffer_stack) )
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
(yy_buffer_stack_max) = num_to_alloc;
}
}
void yyFlexLexer::yy_push_state( int new_state )
{
if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
{
yy_size_t new_size;
(yy_start_stack_depth) += YY_START_STACK_INCR;
new_size = (yy_start_stack_depth) * sizeof( int );
if ( ! (yy_start_stack) )
(yy_start_stack) = (int *) Examplealloc(new_size );
else
(yy_start_stack) = (int *) Examplerealloc((void *) (yy_start_stack),new_size );
if ( ! (yy_start_stack) )
YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
}
(yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
BEGIN(new_state);
}
void yyFlexLexer::yy_pop_state()
{
if ( --(yy_start_stack_ptr) < 0 )
YY_FATAL_ERROR( "start-condition stack underflow" );
BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
}
int yyFlexLexer::yy_top_state()
{
return (yy_start_stack)[(yy_start_stack_ptr) - 1];
}
#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif
void yyFlexLexer::LexerError( yyconst char msg[] )
{
std::cerr << msg << std::endl;
exit( YY_EXIT_FAILURE );
}
#undef yyless
#define yyless(n) \
do \
{ \
\
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
yytext[yyleng] = (yy_hold_char); \
(yy_c_buf_p) = yytext + yyless_macro_arg; \
(yy_hold_char) = *(yy_c_buf_p); \
*(yy_c_buf_p) = '\0'; \
yyleng = yyless_macro_arg; \
} \
while ( 0 )
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
{
register int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s )
{
register int n;
for ( n = 0; s[n]; ++n )
;
return n;
}
#endif
void *Examplealloc (yy_size_t size )
{
return (void *) malloc( size );
}
void *Examplerealloc (void * ptr, yy_size_t size )
{
return (void *) realloc( (char *) ptr, size );
}
void Examplefree (void * ptr )
{
free( (char *) ptr );
}
#define YYTABLES_NAME "yytables"
#line 94 "scanner.ll"
namespace example {
Scanner::Scanner(std::istream* in,
std::ostream* out)
: ExampleFlexLexer(in, out)
{
}
Scanner::~Scanner()
{
}
void Scanner::set_debug(bool b)
{
yy_flex_debug = b;
}
}
#ifdef yylex
#undef yylex
#endif
int ExampleFlexLexer::yylex()
{
std::cerr << "in ExampleFlexLexer::yylex() !" << std::endl;
return 0;
}
int ExampleFlexLexer::yywrap()
{
return 1;
}