This is lev_lex.c in view mode; [Download] [Up]
#define FLEX_COMPRESSED /* A lexical scanner generated by flex */ /* scanner skeleton version: * $Header: flex.skel,v 2.0 89/06/20 15:49:46 vern Locked $ */ #include <stdio.h> #define FLEX_SCANNER /* amount of stuff to slurp up with each read */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif #ifndef YY_BUF_SIZE #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of input buffer */ #endif /* returned upon end-of-file */ #define YY_END_TOK 0 /* copy whatever the last rule matched to the standard output */ #define ECHO fputs( yytext, yyout ) /* gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifdef atarist static __st_read(fd, buf, size) int fd; char *buf; int size; { int r, num = 0; char *from; if ((r = read(fd, buf, size)) < 0) return r; from = buf; while (r-- > 0) { if (*from == '\r') from++; else { *buf++ = *from++; num++; } } return num; } #define YY_INPUT(buf,result,max_size) \ if ( (result = __st_read( fileno(yyin), buf, max_size )) < 0 ) \ YY_FATAL_ERROR( "read() in flex scanner failed" ); #else #define YY_INPUT(buf,result,max_size) \ if ( (result = read( fileno(yyin), buf, max_size )) < 0 ) \ YY_FATAL_ERROR( "read() in flex scanner failed" ); #endif #define YY_NULL 0 #define yyterminate() return ( YY_NULL ) /* report a fatal error */ #define YY_FATAL_ERROR(msg) \ { \ fputs( msg, stderr ); \ putc( '\n', stderr ); \ exit( 1 ); \ } /* default yywrap function - always treat EOF as an EOF */ #define yywrap() 1 /* enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN */ #define BEGIN yy_start = 1 + 2 * /* action number for EOF rule of a given start state */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* special action meaning "start processing a new file" */ #define YY_NEW_FILE goto new_file /* default declaration of generated scanner - a define so the user can * easily add parameters */ #ifdef __STDC__ #define YY_DECL int yylex( void ) #else #define YY_DECL int yylex() #endif /* code executed at the end of each rule */ #define YY_BREAK break; #define YY_END_OF_BUFFER_CHAR 0 /* done after the current pattern has been matched and before the * corresponding action - sets up yytext */ #define YY_DO_BEFORE_ACTION \ yytext = yy_bp; \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; /* returns the length of the matched text */ #define yyleng (int)(yy_cp - yy_bp) #define EOB_ACT_RESTART_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* return all but the first 'n' matched characters back to the input stream */ #define yyless(n) \ { \ *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \ yy_c_buf_p = yy_cp = yy_bp + n; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } #define unput(c) yyunput( c, yy_bp ) #define YY_USER_ACTION FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; char *yytext; #ifndef __STDC__ #define const #endif # line 1 "lev_comp.l" #define INITIAL 0 # line 2 "lev_comp.l" /* SCCS Id: @(#)lev_lex.c 3.0 90/01/04 /* Copyright (c) 1989 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ #define LEV_LEX_C /* block some unused #defines to avoid overloading some cpp's */ #define MONDATA_H /* comment this line for pre-compiled headers */ #define MONFLAG_H /* comment this line for pre-compiled headers */ #include "hack.h" #include "lev_comp.h" #include "sp_lev.h" /* Most of these don't exist in flex, yywrap is macro and * yyunput is properly declared in flex.skel. */ #ifndef FLEX_SCANNER int FDECL (yyback, (int *, int)); int NDECL (yylook); int NDECL (yyinput); int NDECL (yywrap); int NDECL (yylex); int FDECL (yyunput, (int)); int FDECL (yyoutput, (int)); #endif #ifdef MSDOS #undef exit #endif /* this doesn't always get put in lev_comp.h * (esp. when using older versions of bison) */ extern YYSTYPE yylval; #ifdef MACOS #undef putchar #undef putc #undef printf #undef Printf #define Printf printf # ifdef LSC #define putc(c,stream) (fputc(c,stream)) #define putchar(c) (fputc(c,stdout)) # endif #endif int line_number = 1; /* This is *** UGLY *** but I can't think a better way to do it * I really need a huge buffer to scan maps... */ #undef YYLMAX #define YYLMAX 2048 #define MAPC 1 # line 61 "lev_comp.l" #define YY_END_OF_BUFFER 57 typedef int yy_state_type; static const short int yy_accept[274] = { 0, 0, 0, 0, 0, 57, 55, 53, 52, 55, 55, 50, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 1, 53, 55, 55, 55, 53, 0, 51, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 3, 0, 1, 53, 0, 0, 1, 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 21, 10, 0, 0, 0, 0, 0, 0, 0, 49, 28, 36, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 30, 7, 0, 18, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 35, 47, 0, 0, 0, 45, 0, 0, 0, 0, 0, 27, 0, 34, 0, 37, 0, 29, 42, 0, 0, 0, 19, 0, 0, 0, 8, 0, 14, 40, 26, 38, 23, 24, 0, 0, 25, 32, 31, 46, 0, 0, 0, 0, 9, 0, 0, 33, 44, 2, 0, 6, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 17, 0, 15, 16, 0 } ; static const char yy_ec[128] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 5, 6, 1, 1, 1, 7, 1, 1, 1, 8, 1, 8, 8, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 1, 1, 1, 1, 1, 1, 10, 11, 12, 13, 14, 1, 15, 1, 16, 17, 18, 19, 20, 21, 22, 23, 1, 24, 25, 26, 1, 27, 28, 1, 29, 30, 1, 8, 1, 1, 31, 1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 1, 48, 49, 50, 51, 1, 52, 1, 1, 1, 8, 8, 8, 1, 1 } ; static const char yy_meta[53] = { 0, 1, 1, 2, 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 const short int yy_base[277] = { 0, 0, 47, 51, 74, 343, 344, 54, 344, 337, 0, 332, 321, 38, 325, 54, 51, 316, 326, 61, 312, 292, 24, 48, 288, 301, 49, 286, 50, 46, 288, 34, 51, 284, 53, 293, 325, 91, 344, 100, 106, 306, 124, 103, 321, 344, 318, 315, 297, 300, 311, 298, 306, 291, 287, 295, 294, 297, 292, 297, 289, 300, 71, 259, 262, 262, 274, 259, 252, 254, 250, 264, 250, 265, 253, 246, 81, 255, 259, 262, 248, 254, 243, 239, 242, 245, 344, 238, 283, 344, 92, 344, 132, 140, 272, 344, 148, 344, 274, 259, 254, 261, 267, 265, 264, 252, 245, 261, 261, 257, 252, 248, 232, 237, 218, 225, 216, 219, 215, 218, 212, 344, 211, 344, 218, 210, 208, 211, 206, 219, 209, 219, 217, 212, 210, 199, 344, 208, 197, 243, 225, 220, 344, 232, 228, 227, 221, 211, 212, 224, 224, 213, 212, 344, 344, 188, 184, 185, 194, 193, 179, 191, 344, 344, 344, 190, 175, 176, 177, 183, 187, 344, 184, 173, 168, 172, 177, 165, 344, 344, 204, 344, 189, 186, 187, 344, 200, 195, 192, 181, 186, 184, 344, 344, 160, 158, 154, 344, 166, 165, 163, 166, 149, 344, 146, 344, 151, 344, 158, 344, 344, 170, 176, 167, 344, 171, 165, 173, 344, 156, 344, 344, 344, 344, 344, 344, 138, 142, 344, 344, 344, 344, 181, 170, 153, 163, 344, 165, 97, 344, 344, 344, 164, 344, 344, 168, 150, 160, 151, 155, 157, 146, 147, 153, 344, 143, 136, 146, 147, 141, 127, 135, 131, 344, 127, 113, 112, 109, 101, 344, 98, 344, 344, 344, 173, 62, 175 } ; static const short int yy_def[277] = { 0, 273, 1, 1, 1, 273, 273, 273, 273, 274, 275, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 276, 273, 273, 273, 273, 273, 276, 273, 274, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 276, 273, 273, 273, 273, 273, 273, 273, 276, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 0, 273, 273, 273 } ; static const short int yy_nxt[397] = { 0, 6, 7, 8, 7, 9, 6, 10, 6, 11, 12, 6, 6, 13, 6, 14, 6, 6, 6, 15, 16, 17, 18, 6, 19, 6, 20, 6, 6, 6, 6, 6, 21, 22, 23, 24, 25, 6, 6, 6, 6, 6, 6, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 43, 40, 43, 40, 49, 54, 50, 46, 52, 41, 80, 37, 53, 40, 63, 58, 64, 55, 81, 59, 40, 38, 39, 77, 42, 70, 40, 60, 65, 71, 75, 66, 41, 72, 82, 67, 40, 78, 37, 73, 76, 83, 85, 40, 86, 90, 43, 91, 92, 43, 93, 43, 93, 91, 93, 112, 93, 55, 93, 139, 127, 246, 93, 247, 248, 113, 104, 272, 93, 93, 271, 95, 96, 128, 96, 93, 96, 270, 43, 91, 92, 269, 93, 268, 93, 267, 96, 91, 93, 266, 93, 265, 93, 96, 93, 95, 96, 264, 96, 263, 96, 93, 93, 262, 261, 260, 259, 258, 257, 93, 96, 256, 255, 254, 253, 252, 251, 96, 44, 44, 88, 88, 250, 249, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 89, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 47, 97, 45, 94, 89, 87, 84, 79, 74, 69, 68, 62, 61, 57, 56, 51, 48, 47, 45, 273, 5, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273 } ; static const short int yy_chk[397] = { 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 7, 3, 7, 3, 13, 16, 13, 275, 15, 3, 31, 2, 15, 3, 22, 19, 22, 16, 31, 19, 3, 4, 4, 29, 4, 26, 4, 19, 23, 26, 28, 23, 4, 26, 32, 23, 4, 29, 4, 26, 28, 32, 34, 4, 34, 37, 39, 39, 39, 43, 39, 43, 39, 40, 40, 62, 40, 37, 40, 90, 76, 238, 39, 238, 238, 62, 90, 270, 40, 39, 268, 42, 42, 76, 42, 40, 42, 267, 92, 92, 92, 266, 92, 265, 92, 264, 42, 93, 93, 262, 93, 261, 93, 42, 92, 96, 96, 260, 96, 259, 96, 92, 93, 258, 257, 256, 255, 253, 252, 93, 96, 251, 250, 249, 248, 247, 246, 96, 274, 274, 276, 276, 245, 242, 237, 235, 234, 233, 232, 227, 226, 219, 217, 216, 215, 213, 212, 211, 208, 206, 204, 202, 201, 200, 199, 198, 196, 195, 194, 191, 190, 189, 188, 187, 186, 184, 183, 182, 180, 177, 176, 175, 174, 173, 172, 170, 169, 168, 167, 166, 165, 161, 160, 159, 158, 157, 156, 155, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 141, 140, 139, 138, 137, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 122, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 94, 88, 87, 85, 84, 83, 82, 81, 80, 79, 78, 77, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 44, 41, 36, 35, 33, 30, 27, 25, 24, 21, 20, 18, 17, 14, 12, 11, 9, 5, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273 } ; /* the intent behind this definition is that it'll catch * any uses of REJECT which flex missed */ #define REJECT reject_used_but_not_detected static char *yy_more_pos = (char *) 0; #define yymore() (yy_more_pos = yy_bp) /* these variables are all declared out here so that section 3 code can * manipulate them */ static char *yy_c_buf_p; /* points to current character in buffer */ static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* true when we've seen an EOF for the current input file */ static int yy_eof_has_been_seen; static int yy_n_chars; /* number of characters read into yy_ch_buf */ /* yy_ch_buf has to be 2 characters longer than YY_BUF_SIZE because we need * to put in 2 end-of-buffer characters (this is explained where it is * done) at the end of yy_ch_buf */ static char yy_ch_buf[YY_BUF_SIZE + 2]; /* yy_hold_char holds the character lost when yytext is formed */ static char yy_hold_char; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; #ifdef __STDC__ static yy_state_type yy_get_previous_state( void ); static int yy_get_next_buffer( void ); static void yyunput( int c, char *buf_ptr ); static int input( void ); static void yyrestart( FILE *input_file ); #else static yy_state_type yy_get_previous_state(); static int yy_get_next_buffer(); static void yyunput(); static int input(); static void yyrestart(); #endif YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; if ( yy_init ) { if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; new_file: /* this is where we enter upon encountering an end-of-file and * yywrap() indicating that we should continue processing */ /* we put in the '\n' and start reading from [1] so that an * initial match-at-newline will be true. */ yy_ch_buf[0] = '\n'; yy_n_chars = 1; /* we always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yy_eof_has_been_seen = 0; yytext = yy_c_buf_p = &yy_ch_buf[1]; yy_hold_char = *yy_c_buf_p; yy_init = 0; } 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. */ if ( yy_more_pos ) { yy_bp = yy_more_pos; yy_more_pos = (char *) 0; } else yy_bp = yy_cp; yy_current_state = yy_start; if ( yy_bp[-1] == '\n' ) ++yy_current_state; do { register char yy_c = yy_ec[*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 = yy_def[yy_current_state]; if ( yy_current_state >= 274 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_current_state != 273 ); yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; /* bogus while loop to let YY_BACK_TRACK, EOB_ACT_LAST_MATCH, * and EOF actions branch here without introducing an optimizer- * daunting goto */ while ( 1 ) { yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; YY_USER_ACTION; #ifdef FLEX_DEBUG fprintf( stderr, "--accepting rule #%d (\"%s\")\n", yy_act, yytext ); #endif do_action: /* this label is used only to access EOF actions */ switch ( yy_act ) { case 0: /* must backtrack */ /* 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; continue; /* go to "YY_DO_BEFORE_ACTION" */ case 1: # line 62 "lev_comp.l" { line_number++; yymore(); } YY_BREAK case 2: # line 63 "lev_comp.l" { BEGIN 0; line_number++; yytext[yyleng-7] = 0; /* Discard \nENDMAP */ yylval.map = (char *) alloc(strlen(yytext)+1); strcpy(yylval.map, yytext); return MAP_ID; } YY_BREAK case 3: # line 70 "lev_comp.l" { line_number++; } YY_BREAK case 4: # line 71 "lev_comp.l" return MAZE_ID; YY_BREAK case 5: # line 72 "lev_comp.l" return LEVEL_ID; YY_BREAK case 6: # line 73 "lev_comp.l" return GEOMETRY_ID; YY_BREAK case 7: # line 74 "lev_comp.l" { BEGIN MAPC; line_number++; } YY_BREAK case 8: # line 75 "lev_comp.l" return OBJECT_ID; YY_BREAK case 9: # line 76 "lev_comp.l" return MONSTER_ID; YY_BREAK case 10: # line 77 "lev_comp.l" return TRAP_ID; YY_BREAK case 11: # line 78 "lev_comp.l" return DOOR_ID; YY_BREAK case 12: # line 79 "lev_comp.l" return DRAWBRIDGE_ID; YY_BREAK case 13: # line 80 "lev_comp.l" return MAZEWALK_ID; YY_BREAK case 14: # line 81 "lev_comp.l" return REGION_ID; YY_BREAK case 15: # line 82 "lev_comp.l" return RANDOM_OBJECTS_ID; YY_BREAK case 16: # line 83 "lev_comp.l" return RANDOM_MONSTERS_ID; YY_BREAK case 17: # line 84 "lev_comp.l" return RANDOM_PLACES_ID; YY_BREAK case 18: # line 85 "lev_comp.l" return ALTAR_ID; YY_BREAK case 19: # line 86 "lev_comp.l" return LADDER_ID; YY_BREAK case 20: # line 87 "lev_comp.l" return NON_DIGGABLE_ID; YY_BREAK case 21: # line 88 "lev_comp.l" return ROOM_ID; YY_BREAK case 22: # line 89 "lev_comp.l" { yylval.i=D_ISOPEN; return DOOR_STATE; } YY_BREAK case 23: # line 90 "lev_comp.l" { yylval.i=D_CLOSED; return DOOR_STATE; } YY_BREAK case 24: # line 91 "lev_comp.l" { yylval.i=D_LOCKED; return DOOR_STATE; } YY_BREAK case 25: # line 92 "lev_comp.l" { yylval.i=D_NODOOR; return DOOR_STATE; } YY_BREAK case 26: # line 93 "lev_comp.l" { yylval.i=D_BROKEN; return DOOR_STATE; } YY_BREAK case 27: # line 94 "lev_comp.l" { yylval.i=W_NORTH; return DIRECTION; } YY_BREAK case 28: # line 95 "lev_comp.l" { yylval.i=W_EAST; return DIRECTION; } YY_BREAK case 29: # line 96 "lev_comp.l" { yylval.i=W_SOUTH; return DIRECTION; } YY_BREAK case 30: # line 97 "lev_comp.l" { yylval.i=W_WEST; return DIRECTION; } YY_BREAK case 31: # line 98 "lev_comp.l" { yylval.i = -1; return RANDOM_TYPE; } YY_BREAK case 32: # line 99 "lev_comp.l" return O_REGISTER; YY_BREAK case 33: # line 100 "lev_comp.l" return M_REGISTER; YY_BREAK case 34: # line 101 "lev_comp.l" return P_REGISTER; YY_BREAK case 35: # line 102 "lev_comp.l" return A_REGISTER; YY_BREAK case 36: # line 103 "lev_comp.l" { yylval.i=1; return LEFT_OR_RIGHT; } YY_BREAK case 37: # line 104 "lev_comp.l" { yylval.i=3; return LEFT_OR_RIGHT; } YY_BREAK case 38: # line 105 "lev_comp.l" { yylval.i=2; return CENTER; } YY_BREAK case 39: # line 106 "lev_comp.l" { yylval.i=1; return TOP_OR_BOT; } YY_BREAK case 40: # line 107 "lev_comp.l" { yylval.i=3; return TOP_OR_BOT; } YY_BREAK case 41: # line 108 "lev_comp.l" { yylval.i=1; return LIGHT_STATE; } YY_BREAK case 42: # line 109 "lev_comp.l" { yylval.i=0; return LIGHT_STATE; } YY_BREAK case 43: # line 110 "lev_comp.l" { yylval.i=A_LAW; return ALIGNMENT; } YY_BREAK case 44: # line 111 "lev_comp.l" { yylval.i=A_NEUTRAL; return ALIGNMENT; } YY_BREAK case 45: # line 112 "lev_comp.l" { yylval.i=A_CHAOS; return ALIGNMENT; } YY_BREAK case 46: # line 113 "lev_comp.l" { yylval.i=1; return ALTAR_TYPE; } YY_BREAK case 47: # line 114 "lev_comp.l" { yylval.i=0; return ALTAR_TYPE; } YY_BREAK case 48: # line 115 "lev_comp.l" { yylval.i=1; return UP_OR_DOWN; } YY_BREAK case 49: # line 116 "lev_comp.l" { yylval.i=0; return UP_OR_DOWN; } YY_BREAK case 50: # line 117 "lev_comp.l" { yylval.i=atoi(yytext); return INTEGER; } YY_BREAK case 51: # line 118 "lev_comp.l" { yytext[yyleng-1] = 0; /* Discard the trailing \" */ yylval.map = (char *) alloc(strlen(yytext+1)+1); strcpy(yylval.map, yytext+1); /* Discard the first \" */ return STRING; } YY_BREAK case 52: # line 122 "lev_comp.l" { line_number++; } YY_BREAK case 53: # line 123 "lev_comp.l" ; YY_BREAK case 54: # line 124 "lev_comp.l" { yylval.i = yytext[1]; return CHAR; } YY_BREAK case 55: # line 125 "lev_comp.l" { return yytext[0]; } YY_BREAK case 56: # line 126 "lev_comp.l" ECHO; YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(MAPC): yyterminate(); case YY_END_OF_BUFFER: /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yytext = yy_bp; switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { if ( yywrap() ) { /* note: because we've taken care in * yy_get_next_buffer() to have set up yytext, * we can now set up yy_c_buf_p so that if some * total hoser (like flex itself) wants * to call the scanner after we return the * YY_NULL, it'll still work - another YY_NULL * will get returned. */ yy_c_buf_p = yytext; yy_act = YY_STATE_EOF((yy_start - 1) / 2); goto do_action; } else YY_NEW_FILE; } break; case EOB_ACT_RESTART_SCAN: yy_c_buf_p = yytext; yy_hold_char = *yy_c_buf_p; break; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext; continue; /* go to "YY_DO_BEFORE_ACTION" */ } break; default: printf( "action # %d\n", yy_act ); YY_FATAL_ERROR( "fatal flex scanner internal error" ); } break; /* exit bogus while loop */ } } } /* yy_get_next_buffer - try to read in new buffer * * synopsis * int yy_get_next_buffer(); * * returns a code representing an action * EOB_ACT_LAST_MATCH - * EOB_ACT_RESTART_SCAN - restart the scanner * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() { register char *dest = yy_ch_buf; register char *source = yytext - 1; /* copy prev. char, too */ register int number_to_move, i; int ret_val; if ( yy_c_buf_p != &yy_ch_buf[yy_n_chars + 1] ) { YY_FATAL_ERROR( "NULL in input" ); /*NOTREACHED*/ } /* try to read more data */ /* first move last chars to start of buffer */ number_to_move = yy_c_buf_p - yytext; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_eof_has_been_seen ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_n_chars = 0; else { int num_to_read = YY_BUF_SIZE - number_to_move - 1; if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* read in more data */ YY_INPUT( (&yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); } if ( yy_n_chars == 0 ) { if ( number_to_move == 1 ) ret_val = EOB_ACT_END_OF_FILE; else ret_val = EOB_ACT_LAST_MATCH; yy_eof_has_been_seen = 1; } else ret_val = EOB_ACT_RESTART_SCAN; yy_n_chars += number_to_move; yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; /* yytext begins at the second character in * yy_ch_buf; the first character is the one which * preceded it before reading in the latest buffer; * it needs to be kept around in case it's a * newline, so yy_get_previous_state() will have * with '^' rules active */ yytext = &yy_ch_buf[1]; return ( ret_val ); } /* yy_get_previous_state - get the state just before the EOB char was reached * * synopsis * yy_state_type yy_get_previous_state(); */ static yy_state_type yy_get_previous_state() { register yy_state_type yy_current_state; register char *yy_cp; register char *yy_bp = yytext; yy_current_state = yy_start; if ( yy_bp[-1] == '\n' ) ++yy_current_state; for ( yy_cp = yytext; yy_cp < yy_c_buf_p; ++yy_cp ) { register char yy_c = yy_ec[*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 = yy_def[yy_current_state]; if ( yy_current_state >= 274 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return ( yy_current_state ); } #ifdef __STDC__ static void yyunput( int c, register char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; register char *yy_bp; #endif { register char *yy_cp = yy_c_buf_p; *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ if ( yy_cp < yy_ch_buf + 2 ) { /* need to shift things up to make room */ register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */ register char *dest = &yy_ch_buf[YY_BUF_SIZE + 2]; register char *source = &yy_ch_buf[number_to_move]; while ( source > yy_ch_buf ) *--dest = *--source; yy_cp += dest - source; yy_bp += dest - source; if ( yy_cp < yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } if ( yy_cp > yy_bp && yy_cp[-1] == '\n' ) yy_cp[-2] = '\n'; *--yy_cp = c; YY_DO_BEFORE_ACTION; /* set up yytext again */ } static int input() { int c; char *yy_cp = yy_c_buf_p; *yy_cp = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* need more input */ yytext = yy_c_buf_p; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { /* this code, unfortunately, is somewhat redundant with * that above */ case EOB_ACT_END_OF_FILE: { if ( yywrap() ) { yy_c_buf_p = yytext; return ( EOF ); } yy_ch_buf[0] = '\n'; yy_n_chars = 1; yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yy_eof_has_been_seen = 0; yytext = yy_c_buf_p = &yy_ch_buf[1]; yy_hold_char = *yy_c_buf_p; return ( input() ); } break; case EOB_ACT_RESTART_SCAN: yy_c_buf_p = yytext; break; case EOB_ACT_LAST_MATCH: YY_FATAL_ERROR( "unexpected last match in input()" ); } } c = *yy_c_buf_p; yy_hold_char = *++yy_c_buf_p; return ( c ); } #ifdef __STDC__ static void yyrestart( FILE *input_file ) #else static void yyrestart( input_file ) FILE *input_file; #endif { if ( yyin != stdin ) fclose( yyin ); yyin = input_file; yy_init = 1; } # line 126 "lev_comp.l" #ifdef AMIGA long *alloc(n) unsigned n; { return ((long *)malloc (n)); } #endif
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.