Anarres-Mud-Driver
view release on metacpan or search on metacpan
Compiler/lexer.c view on Meta::CPAN
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 5, 5, 5,
5, 5, 26, 32, 5, 6, 6, 6, 6, 6,
145, 32, 6, 7, 7, 7, 7, 120, 26, 7,
8, 8, 8, 8, 37, 37, 8, 9, 9, 9,
9, 9, 10, 10, 10, 10, 10, 11, 11, 11,
11, 12, 12, 12, 12, 98, 7, 13, 13, 13,
13, 39, 39, 8, 14, 14, 14, 14, 17, 20,
9, 17, 20, 28, 30, 10, 24, 24, 24, 24,
31, 28, 81, 47, 44, 30, 47, 63, 63, 31,
31, 36, 70, 28, 34, 34, 34, 34, 35, 35,
35, 35, 36, 44, 50, 58, 61, 50, 58, 61,
65, 100, 117, 65, 100, 117, 60, 34, 56, 68,
68, 68, 68, 56, 105, 105, 105, 105, 106, 106,
106, 106, 56, 56, 56, 56, 107, 107, 107, 107,
56, 125, 125, 125, 49, 56, 45, 43, 56, 56,
56, 56, 56, 56, 56, 56, 86, 86, 86, 86,
42, 38, 33, 29, 25, 21, 86, 86, 19, 15,
0, 0, 86, 86, 86, 86, 86, 86, 86, 86,
115, 115, 115, 115, 0, 0, 0, 0, 0, 0,
115, 0, 0, 0, 0, 0, 115, 115, 115, 134,
134, 134, 134, 134, 134, 135, 135, 135, 135, 135,
135, 136, 136, 136, 136, 136, 136, 137, 137, 137,
137, 137, 137, 138, 138, 139, 139, 140, 140, 0,
140, 140, 141, 141, 141, 141, 141, 141, 142, 0,
142, 142, 142, 143, 143, 143, 143, 143, 143, 144,
144, 144, 0, 144, 144, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133
} ;
static amd_yy_state_type amd_yy_last_accepting_state;
static char *amd_yy_last_accepting_cpos;
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
*/
#define REJECT reject_used_but_not_detected
#define amd_yymore() amd_yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *amd_yytext;
#line 1 "lexer.yy"
#define INITIAL 0
#line 2 "lexer.yy"
#include <stdio.h>
#include <stdlib.h>
#include "compiler.h"
#include "parser.h"
#define YY_DECL int amd_yylex(AMD_YYSTYPE *amd_yylval, amd_parse_param_t *param)
static int amd_yyinteger(AMD_YYSTYPE *lvalp);
static int amd_yyidentifier(AMD_YYSTYPE *lvalp, amd_parse_param_t *param);
#define YY_NO_INPUT 1
#define YY_NO_UNPUT 1
#define YY_NO_TOP_STATE 1
/* %option debug */
#define CODE 1
#define BLANK 2
#define STRING 3
#define PPLINE 4
#define CCOMMENT 5
#define CPPCOMMENT 6
#line 514 "lex.yy.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int amd_yywrap YY_PROTO(( void ));
#else
extern int amd_yywrap YY_PROTO(( void ));
#endif
#endif
#ifndef YY_NO_UNPUT
static void amd_yyunput YY_PROTO(( int c, char *buf_ptr ));
#endif
#ifndef amd_yytext_ptr
static void amd_yy_flex_strncpy YY_PROTO(( char *, amd_yyconst char *, int ));
#endif
#ifdef YY_NEED_STRLEN
static int amd_yy_flex_strlen YY_PROTO(( amd_yyconst char * ));
#endif
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int amd_yyinput YY_PROTO(( void ));
#else
static int input YY_PROTO(( void ));
#endif
#endif
#if YY_STACK_USED
static int amd_yy_start_stack_ptr = 0;
static int amd_yy_start_stack_depth = 0;
static int *amd_yy_start_stack = 0;
#ifndef YY_NO_PUSH_STATE
static void amd_yy_push_state YY_PROTO(( int new_state ));
#endif
#ifndef YY_NO_POP_STATE
static void amd_yy_pop_state YY_PROTO(( void ));
#endif
#ifndef YY_NO_TOP_STATE
static int amd_yy_top_state YY_PROTO(( void ));
#endif
#else
#define YY_NO_PUSH_STATE 1
#define YY_NO_POP_STATE 1
#define YY_NO_TOP_STATE 1
#endif
#ifdef YY_MALLOC_DECL
YY_MALLOC_DECL
#else
#if __STDC__
#ifndef __cplusplus
#include <stdlib.h>
#endif
#else
/* Just try to get by without declaring the routines. This will fail
* miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
* or sizeof(void*) != sizeof(int).
*/
#endif
#endif
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif
/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO (void) fwrite( amd_yytext, amd_yyleng, 1, amd_yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
* is returned in "result".
*/
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
if ( amd_yy_current_buffer->amd_yy_is_interactive ) \
{ \
int c = '*', n; \
for ( n = 0; n < max_size && \
(c = getc( amd_yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
if ( c == '\n' ) \
buf[n++] = (char) c; \
if ( c == EOF && ferror( amd_yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
result = n; \
} \
else if ( ((result = fread( buf, 1, max_size, amd_yyin )) == 0) \
&& ferror( amd_yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" );
#endif
/* No semi-colon after return; correct usage is to write "amd_yyterminate();" -
* we don't want an extra ';' after the "return" because that will cause
* some compilers to complain about unreachable statements.
*/
#ifndef amd_yyterminate
#define amd_yyterminate() return YY_NULL
#endif
/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif
/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) amd_yy_fatal_error( msg )
#endif
/* Default declaration of generated scanner - a define so the user can
* easily add parameters.
*/
#ifndef YY_DECL
#define YY_DECL int amd_yylex YY_PROTO(( void ))
#endif
/* Code executed at the beginning of each rule, after amd_yytext and amd_yyleng
* have been set up.
*/
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif
#define YY_RULE_SETUP \
YY_USER_ACTION
YY_DECL
{
register amd_yy_state_type amd_yy_current_state;
Compiler/lexer.c view on Meta::CPAN
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
if ( amd_yy_current_buffer->amd_yy_buffer_status == YY_BUFFER_EOF_PENDING )
/* don't do the read, it's not guaranteed to return an EOF,
* just force an EOF
*/
amd_yy_current_buffer->amd_yy_n_chars = amd_yy_n_chars = 0;
else
{
int num_to_read =
amd_yy_current_buffer->amd_yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
#ifdef YY_USES_REJECT
YY_FATAL_ERROR(
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
#else
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = amd_yy_current_buffer;
int amd_yy_c_buf_p_offset =
(int) (amd_yy_c_buf_p - b->amd_yy_ch_buf);
if ( b->amd_yy_is_our_buffer )
{
int new_size = b->amd_yy_buf_size * 2;
if ( new_size <= 0 )
b->amd_yy_buf_size += b->amd_yy_buf_size / 8;
else
b->amd_yy_buf_size *= 2;
b->amd_yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
amd_yy_flex_realloc( (void *) b->amd_yy_ch_buf,
b->amd_yy_buf_size + 2 );
}
else
/* Can't grow it, we don't own it. */
b->amd_yy_ch_buf = 0;
if ( ! b->amd_yy_ch_buf )
YY_FATAL_ERROR(
"fatal error - scanner input buffer overflow" );
amd_yy_c_buf_p = &b->amd_yy_ch_buf[amd_yy_c_buf_p_offset];
num_to_read = amd_yy_current_buffer->amd_yy_buf_size -
number_to_move - 1;
#endif
}
if ( num_to_read > YY_READ_BUF_SIZE )
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
YY_INPUT( (&amd_yy_current_buffer->amd_yy_ch_buf[number_to_move]),
amd_yy_n_chars, num_to_read );
amd_yy_current_buffer->amd_yy_n_chars = amd_yy_n_chars;
}
if ( amd_yy_n_chars == 0 )
{
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
amd_yyrestart( amd_yyin );
}
else
{
ret_val = EOB_ACT_LAST_MATCH;
amd_yy_current_buffer->amd_yy_buffer_status =
YY_BUFFER_EOF_PENDING;
}
}
else
ret_val = EOB_ACT_CONTINUE_SCAN;
amd_yy_n_chars += number_to_move;
amd_yy_current_buffer->amd_yy_ch_buf[amd_yy_n_chars] = YY_END_OF_BUFFER_CHAR;
amd_yy_current_buffer->amd_yy_ch_buf[amd_yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
amd_yytext_ptr = &amd_yy_current_buffer->amd_yy_ch_buf[0];
return ret_val;
}
/* amd_yy_get_previous_state - get the state just before the EOB char was reached */
static amd_yy_state_type amd_yy_get_previous_state()
{
register amd_yy_state_type amd_yy_current_state;
register char *amd_yy_cp;
amd_yy_current_state = amd_yy_start;
for ( amd_yy_cp = amd_yytext_ptr + YY_MORE_ADJ; amd_yy_cp < amd_yy_c_buf_p; ++amd_yy_cp )
{
register YY_CHAR amd_yy_c = (*amd_yy_cp ? amd_yy_ec[YY_SC_TO_UI(*amd_yy_cp)] : 1);
if ( amd_yy_accept[amd_yy_current_state] )
{
amd_yy_last_accepting_state = amd_yy_current_state;
amd_yy_last_accepting_cpos = amd_yy_cp;
}
while ( amd_yy_chk[amd_yy_base[amd_yy_current_state] + amd_yy_c] != amd_yy_current_state )
{
amd_yy_current_state = (int) amd_yy_def[amd_yy_current_state];
if ( amd_yy_current_state >= 134 )
amd_yy_c = amd_yy_meta[(unsigned int) amd_yy_c];
}
amd_yy_current_state = amd_yy_nxt[amd_yy_base[amd_yy_current_state] + (unsigned int) amd_yy_c];
}
return amd_yy_current_state;
}
/* amd_yy_try_NUL_trans - try to make a transition on the NUL character
*
* synopsis
* next_state = amd_yy_try_NUL_trans( current_state );
*/
#ifdef YY_USE_PROTOS
static amd_yy_state_type amd_yy_try_NUL_trans( amd_yy_state_type amd_yy_current_state )
#else
static amd_yy_state_type amd_yy_try_NUL_trans( amd_yy_current_state )
amd_yy_state_type amd_yy_current_state;
#endif
{
register int amd_yy_is_jam;
register char *amd_yy_cp = amd_yy_c_buf_p;
register YY_CHAR amd_yy_c = 1;
if ( amd_yy_accept[amd_yy_current_state] )
{
amd_yy_last_accepting_state = amd_yy_current_state;
amd_yy_last_accepting_cpos = amd_yy_cp;
}
while ( amd_yy_chk[amd_yy_base[amd_yy_current_state] + amd_yy_c] != amd_yy_current_state )
{
amd_yy_current_state = (int) amd_yy_def[amd_yy_current_state];
if ( amd_yy_current_state >= 134 )
amd_yy_c = amd_yy_meta[(unsigned int) amd_yy_c];
}
amd_yy_current_state = amd_yy_nxt[amd_yy_base[amd_yy_current_state] + (unsigned int) amd_yy_c];
amd_yy_is_jam = (amd_yy_current_state == 133);
return amd_yy_is_jam ? 0 : amd_yy_current_state;
}
#ifndef YY_NO_UNPUT
#ifdef YY_USE_PROTOS
static void amd_yyunput( int c, register char *amd_yy_bp )
#else
static void amd_yyunput( c, amd_yy_bp )
int c;
register char *amd_yy_bp;
#endif
{
register char *amd_yy_cp = amd_yy_c_buf_p;
/* undo effects of setting up amd_yytext */
*amd_yy_cp = amd_yy_hold_char;
if ( amd_yy_cp < amd_yy_current_buffer->amd_yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
register int number_to_move = amd_yy_n_chars + 2;
register char *dest = &amd_yy_current_buffer->amd_yy_ch_buf[
amd_yy_current_buffer->amd_yy_buf_size + 2];
register char *source =
&amd_yy_current_buffer->amd_yy_ch_buf[number_to_move];
while ( source > amd_yy_current_buffer->amd_yy_ch_buf )
*--dest = *--source;
amd_yy_cp += (int) (dest - source);
amd_yy_bp += (int) (dest - source);
amd_yy_current_buffer->amd_yy_n_chars =
amd_yy_n_chars = amd_yy_current_buffer->amd_yy_buf_size;
if ( amd_yy_cp < amd_yy_current_buffer->amd_yy_ch_buf + 2 )
YY_FATAL_ERROR( "flex scanner push-back overflow" );
}
*--amd_yy_cp = (char) c;
amd_yytext_ptr = amd_yy_bp;
amd_yy_hold_char = *amd_yy_cp;
amd_yy_c_buf_p = amd_yy_cp;
}
#endif /* ifndef YY_NO_UNPUT */
#ifdef __cplusplus
static int amd_yyinput()
#else
static int input()
#endif
{
int c;
*amd_yy_c_buf_p = amd_yy_hold_char;
if ( *amd_yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
{
/* amd_yy_c_buf_p now points to the character we want to return.
* If this occurs *before* the EOB characters, then it's a
* valid NUL; if not, then we've hit the end of the buffer.
*/
if ( amd_yy_c_buf_p < &amd_yy_current_buffer->amd_yy_ch_buf[amd_yy_n_chars] )
/* This was really a NUL. */
*amd_yy_c_buf_p = '\0';
else
{ /* need more input */
int offset = amd_yy_c_buf_p - amd_yytext_ptr;
++amd_yy_c_buf_p;
switch ( amd_yy_get_next_buffer() )
{
case EOB_ACT_LAST_MATCH:
/* This happens because amd_yy_g_n_b()
* sees that we've accumulated a
* token and flags that we need to
* try matching the token before
* proceeding. But for input(),
* there's no matching to consider.
* So convert the EOB_ACT_LAST_MATCH
* to EOB_ACT_END_OF_FILE.
*/
/* Reset buffer status. */
amd_yyrestart( amd_yyin );
/* fall through */
case EOB_ACT_END_OF_FILE:
{
if ( amd_yywrap() )
return EOF;
if ( ! amd_yy_did_buffer_switch_on_eof )
YY_NEW_FILE;
#ifdef __cplusplus
return amd_yyinput();
#else
return input();
#endif
}
case EOB_ACT_CONTINUE_SCAN:
( run in 3.100 seconds using v1.01-cache-2.11-cpan-98e64b0badf )