_ps1.0_lexer.cpp

来自「赫赫大名的 OGRE 游戏引擎」· C++ 代码 · 共 1,876 行 · 第 1/4 页

CPP
1,876
字号

      169,  168,  167,  166,  165,  164,  163,  162,  161,  160,
       82,  159,   82,   82,  158,  157,  153,  152,  151,  150,
      149,  148,  147,  144,  143,  137,  136,  115,  114,  109,
      100,   96,   95,   91,   90,   89,   88,   87,   86,   85,
       81,   80,   59,   76,   73,   70,   69,   68,   67,   66,
       65,   64,   61,   60,   30,   59,   56,   52,   47,   44,
       42,   41,   38,   30,  230,    5,  230,  230,  230,  230,
      230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
      230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
      230,  230,  230,  230,  230,  230,  230,  230,  230,  230,

      230,  230,  230,  230,  230,  230,  230
    } ;

static yyconst short int yy_chk[408] =
    {   0,
        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,    3,    3,    3,   10,    3,    3,    3,    3,    3,
        3,    3,    7,    7,    7,    8,    8,    8,   12,   17,
      228,   19,   12,   10,   20,   20,   23,   23,   17,   22,
       22,   22,   22,   19,  226,   10,   25,   10,   19,   10,
       28,   25,   33,   22,   28,   28,   29,   29,   29,   30,
       30,   30,   32,   32,   32,   25,   35,   35,   37,   37,

      224,   33,   36,   36,   36,   36,   39,   25,   40,   25,
       39,   25,  218,   33,   43,   33,  217,   33,   34,   34,
       34,   34,   34,   34,   51,   43,   53,   40,  216,   55,
       62,   62,   71,   71,  113,   51,  113,   53,  215,   40,
       55,   40,   81,   40,   62,  214,   71,   74,   74,   62,
       62,   71,   71,   86,   81,   76,   76,   77,   77,   81,
       85,   74,   76,   87,   76,   86,   74,   74,   76,   88,
       86,   77,   89,   85,   95,   87,   77,   77,   90,   91,
       87,   88,   96,  213,   89,  100,   88,   95,  109,   89,
       90,   91,  110,  110,   96,   90,   91,  212,  100,   96,

      120,  109,  120,  123,  126,  123,  126,  129,  132,  129,
      132,  135,  142,  135,  142,  179,  179,  201,  211,  202,
      201,  202,  202,  203,  202,  210,  209,  208,  207,  203,
      231,  206,  231,  232,  232,  232,  233,  233,  234,  234,
      235,  205,  235,  235,  235,  235,  199,  196,  194,  192,
      190,  188,  186,  184,  182,  181,  180,  178,  177,  176,
      175,  174,  173,  172,  171,  170,  169,  168,  167,  166,
      165,  164,  163,  162,  161,  160,  159,  158,  157,  155,
      154,  153,  152,  151,  150,  149,  148,  147,  146,  145,
      144,  143,  141,  140,  139,  138,  137,  136,  134,  133,

      131,  130,  128,  127,  125,  124,  122,  121,  119,  118,
      117,  116,  115,  114,  112,  111,  108,  107,  105,  104,
      103,  102,  101,   99,   98,   94,   93,   84,   83,   78,
       75,   73,   72,   70,   69,   68,   67,   66,   64,   63,
       61,   60,   57,   54,   52,   50,   49,   48,   47,   46,
       45,   44,   42,   41,   31,   27,   24,   21,   18,   16,
       15,   14,   11,    9,    5,  230,  230,  230,  230,  230,
      230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
      230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
      230,  230,  230,  230,  230,  230,  230,  230,  230,  230,

      230,  230,  230,  230,  230,  230,  230
    } ;

static yy_state_type yy_last_accepting_state;
static char *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 yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "ps1.0_tokens.l"
#define INITIAL 0
/* definitions */
#line 7 "ps1.0_tokens.l"

#include <stdlib.h>
#include <list>
#include <vector>

#include "ps1.0_program.h"

using namespace std;
using namespace ps10;

#include "_ps1.0_parser.h"

#ifdef _WIN32
# include <windows.h>
#endif

#include <GL/gl.h>
#include <GL/glext.h>
#include "nvparse_errors.h"
#include "nvparse_externs.h"


#define YY_INPUT(buf,result,max_size)                            \
{                                                                \
	int c = *myin++;                                             \
	result = (c == 0) ? YY_NULL : (buf[0] = c, 1);               \
}

#define YY_ALWAYS_INTERACTIVE 1

//#define DBG_MESG(msg, line)  	errors.set(msg, line)
#define DBG_MESG(msg, line)

static char buf[80];


#define DEFSTATE 1

/* end of definitions */
#line 589 "_ps1.0_lexer.cpp"

/* Macros after this point can all be overridden by user definitions in
 * section 1.
 */

#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int yywrap YY_PROTO(( void ));
#else
extern int yywrap YY_PROTO(( void ));
#endif
#endif

#ifndef YY_NO_UNPUT
static void yyunput YY_PROTO(( int c, char *buf_ptr ));
#endif

#ifndef yytext_ptr
static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
#endif

#ifdef YY_NEED_STRLEN
static int yy_flex_strlen YY_PROTO(( yyconst char * ));
#endif

#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput YY_PROTO(( void ));
#else
static int input YY_PROTO(( void ));
#endif
#endif

#if YY_STACK_USED
static int yy_start_stack_ptr = 0;
static int yy_start_stack_depth = 0;
static int *yy_start_stack = 0;
#ifndef YY_NO_PUSH_STATE
static void yy_push_state YY_PROTO(( int new_state ));
#endif
#ifndef YY_NO_POP_STATE
static void yy_pop_state YY_PROTO(( void ));
#endif
#ifndef YY_NO_TOP_STATE
static int 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( yytext, yyleng, 1, 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 ( yy_current_buffer->yy_is_interactive ) \
		{ \
		int c = '*', n; \
		for ( n = 0; n < max_size && \
			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
			buf[n] = (char) c; \
		if ( c == '\n' ) \
			buf[n++] = (char) c; \
		if ( c == EOF && ferror( yyin ) ) \
			YY_FATAL_ERROR( "input in flex scanner failed" ); \
		result = n; \
		} \
	else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
		  && ferror( yyin ) ) \
		YY_FATAL_ERROR( "input in flex scanner failed" );
#endif

/* No semi-colon after return; correct usage is to write "yyterminate();" -
 * we don't want an extra ';' after the "return" because that will cause
 * some compilers to complain about unreachable statements.
 */
#ifndef yyterminate
#define 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) 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 yylex YY_PROTO(( void ))
#endif

/* Code executed at the beginning of each rule, after yytext and 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 yy_state_type yy_current_state;
	register char *yy_cp = NULL, *yy_bp = NULL;
	register int yy_act;

#line 48 "ps1.0_tokens.l"


#line 743 "_ps1.0_lexer.cpp"

	if ( yy_init )
		{
		yy_init = 0;

#ifdef YY_USER_INIT
		YY_USER_INIT;
#endif

		if ( ! yy_start )
			yy_start = 1;	/* first start state */

		if ( ! yyin )
			yyin = stdin;

		if ( ! yyout )
			yyout = stdout;

		if ( ! yy_current_buffer )
			yy_current_buffer =
				yy_create_buffer( yyin, YY_BUF_SIZE );

		yy_load_buffer_state();
		}

	while ( 1 )		/* loops until end-of-file is reached */
		{
		yy_cp = yy_c_buf_p;

		/* Support of yytext. */
		*yy_cp = yy_hold_char;

		/* yy_bp points to the position in yy_ch_buf of the start of
		 * the current run.
		 */
		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 >= 231 )
					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_base[yy_current_state] != 366 );

yy_find_action:
		yy_act = yy_accept[yy_current_state];
		if ( yy_act == 0 )
			{ /* have to back up */
			yy_cp = yy_last_accepting_cpos;
			yy_current_state = yy_last_accepting_state;
			yy_act = yy_accept[yy_current_state];
			}

		YY_DO_BEFORE_ACTION;


do_action:	/* This label is used only to access EOF actions. */


		switch ( yy_act )
	{ /* beginning of action switch */
			case 0: /* must back up */
			/* undo the effects of YY_DO_BEFORE_ACTION */
			*yy_cp = yy_hold_char;
			yy_cp = yy_last_accepting_cpos;
			yy_current_state = yy_last_accepting_state;
			goto yy_find_action;

case 1:
#line 51 "ps1.0_tokens.l"
case 2:
YY_RULE_SETUP
#line 51 "ps1.0_tokens.l"
{
			    char ch;
			    while ((ch = yyinput()) != '\n')
					;
				line_number++;
				DBG_MESG("dbg: comment, NEWLINE", line_number-1);
				return NEWLINE;
			}
	YY_BREAK
case 3:
#line 61 "ps1.0_tokens.l"
case 4:
#line 62 "ps1.0_tokens.l"
case 5:
YY_RULE_SETUP
#line 62 "ps1.0_tokens.l"
{
				ps10_lval.fval = (float)atof(yytext);
				// debug
				DBG_MESG("dbg: NUMBER", line_number);
				return NUMBER;
			}
	YY_BREAK
case 6:
YY_RULE_SETUP
#line 72 "ps1.0_tokens.l"
{
				// debug
				DBG_MESG("dbg: DEF", line_number);
				BEGIN DEFSTATE;
				return DEF;
			}
	YY_BREAK
case 7:
#line 81 "ps1.0_tokens.l"
case 8:
#line 82 "ps1.0_tokens.l"
case 9:
#line 83 "ps1.0_tokens.l"
case 10:
YY_RULE_SETUP
#line 83 "ps1.0_tokens.l"
{
				sprintf(buf, "dbg: REG = %s", yytext);
				// debug
				DBG_MESG(buf, line_number);
				ps10_lval.sval = new string(yytext);
				return REG;
			}
	YY_BREAK
case 11:
#line 92 "ps1.0_tokens.l"
case 12:
#line 93 "ps1.0_tokens.l"
case 13:
#line 94 "ps1.0_tokens.l"
case 14:
#line 95 "ps1.0_tokens.l"
case 15:
#line 96 "ps1.0_tokens.l"
case 16:
#line 97 "ps1.0_tokens.l"
case 17:
#line 98 "ps1.0_tokens.l"
case 18:
YY_RULE_SETUP
#line 98 "ps1.0_tokens.l"
{
				sprintf(buf, "dbg: BLENDOP = %s", yytext);
				// debug
				DBG_MESG(buf, line_number);
				ps10_lval.sval = new string(yytext);
				return BLENDOP;
			}
	YY_BREAK
case 19:
#line 107 "ps1.0_tokens.l"
case 20:
#line 108 "ps1.0_tokens.l"
case 21:
#line 109 "ps1.0_tokens.l"
case 22:
#line 110 "ps1.0_tokens.l"
case 23:
#line 111 "ps1.0_tokens.l"
case 24:
#line 112 "ps1.0_tokens.l"
case 25:
#line 113 "ps1.0_tokens.l"
case 26:
#line 114 "ps1.0_tokens.l"
case 27:
#line 115 "ps1.0_tokens.l"
case 28:
#line 116 "ps1.0_tokens.l"
case 29:
#line 117 "ps1.0_tokens.l"
case 30:
#line 118 "ps1.0_tokens.l"
case 31:
YY_RULE_SETUP
#line 118 "ps1.0_tokens.l"
{
				sprintf(buf, "dbg: ADDROP = %s", yytext);
				// debug
				DBG_MESG(buf, line_number);
				ps10_lval.sval = new string(yytext);
				return ADDROP;
			}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?