diff Bison-Flex/BasicCompiler-StackBase/UTF8/script-scanner.cc @ 3:3cea2e8a0e4b

add function goto
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 10 May 2011 10:48:02 +0900
parents fbe42292d479
children
line wrap: on
line diff
--- a/Bison-Flex/BasicCompiler-StackBase/UTF8/script-scanner.cc	Tue May 10 06:43:55 2011 +0900
+++ b/Bison-Flex/BasicCompiler-StackBase/UTF8/script-scanner.cc	Tue May 10 10:48:02 2011 +0900
@@ -9,7 +9,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 33
+#define YY_FLEX_SUBMINOR_VERSION 35
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -31,7 +31,7 @@
 
 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
-#if __STDC_VERSION__ >= 199901L
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  * if you want the limit (max/min) macros for int types. 
@@ -94,11 +94,12 @@
 
 #else	/* ! __cplusplus */
 
-#if __STDC__
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
 
 #define YY_USE_CONST
 
-#endif	/* __STDC__ */
+#endif	/* defined (__STDC__) */
 #endif	/* ! __cplusplus */
 
 #ifdef YY_USE_CONST
@@ -152,7 +153,12 @@
 typedef struct yy_buffer_state *YY_BUFFER_STATE;
 #endif
 
-extern int yyleng;
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+extern yy_size_t yyleng;
 
 extern FILE *yyin, *yyout;
 
@@ -178,16 +184,6 @@
 
 #define unput(c) yyunput( c, (yytext_ptr)  )
 
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef unsigned int yy_size_t;
-#endif
-
 #ifndef YY_STRUCT_YY_BUFFER_STATE
 #define YY_STRUCT_YY_BUFFER_STATE
 struct yy_buffer_state
@@ -205,7 +201,7 @@
 	/* Number of characters read into yy_ch_buf, not including EOB
 	 * characters.
 	 */
-	int yy_n_chars;
+	yy_size_t yy_n_chars;
 
 	/* Whether we "own" the buffer - i.e., we know we created it,
 	 * and can realloc() it to grow it, and should free() it to
@@ -275,8 +271,8 @@
 
 /* yy_hold_char holds the character lost when yytext is formed. */
 static char yy_hold_char;
-static int yy_n_chars;		/* number of characters read into yy_ch_buf */
-int yyleng;
+static yy_size_t yy_n_chars;		/* number of characters read into yy_ch_buf */
+yy_size_t yyleng;
 
 /* Points to current character in buffer. */
 static char *yy_c_buf_p = (char *) 0;
@@ -304,7 +300,7 @@
 
 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );
 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );
-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len  );
+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len  );
 
 void *yyalloc (yy_size_t  );
 void *yyrealloc (void *,yy_size_t  );
@@ -336,7 +332,7 @@
 
 /* Begin user sect3 */
 
-#define yywrap() 1
+#define yywrap(n) 1
 #define YY_SKIP_YYWRAP
 
 typedef unsigned char YY_CHAR;
@@ -367,8 +363,8 @@
 	*yy_cp = '\0'; \
 	(yy_c_buf_p) = yy_cp;
 
-#define YY_NUM_RULES 31
-#define YY_END_OF_BUFFER 32
+#define YY_NUM_RULES 32
+#define YY_END_OF_BUFFER 33
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -376,16 +372,16 @@
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[75] =
+static yyconst flex_int16_t yy_accept[79] =
     {   0,
-        0,    0,   29,   29,   32,   28,   24,   18,   28,   19,
-        2,   26,   25,   17,   19,   19,   19,   27,   28,   28,
-       27,   27,   27,   27,   27,   27,   27,   27,   29,   30,
-       24,   21,   25,   23,   20,   22,   27,   16,    1,   27,
-       27,   27,    4,   27,   27,   27,   27,   27,    9,   27,
-       27,   29,   27,   13,    8,   27,   27,   27,    3,   27,
-       27,   27,    6,   27,   10,   27,   14,    5,   12,   27,
-        7,   15,   11,    0
+        0,    0,   30,   30,   33,   29,   25,   19,   29,   20,
+        2,   27,   26,   16,   20,   20,   20,   28,   29,   29,
+       28,   28,   28,   28,   28,   28,   28,   28,   28,   30,
+       31,   25,   22,   26,   24,   21,   23,   28,   18,    1,
+       28,   28,   28,   28,    4,   28,   28,   28,   28,   28,
+        9,   28,   28,   30,   28,   13,    8,   28,   28,   28,
+       28,    3,   28,   28,   28,    6,   28,   17,   10,   28,
+       14,    5,   12,   28,    7,   15,   11,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -401,8 +397,8 @@
        14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
         1,   15,    1,   16,   14,    1,   17,   14,   14,   18,
 
-       19,   20,   14,   21,   22,   14,   14,   23,   24,   25,
-       26,   27,   14,   28,   29,   30,   14,   14,   31,   32,
+       19,   20,   21,   22,   23,   14,   14,   24,   25,   26,
+       27,   28,   14,   29,   30,   31,   14,   14,   32,   33,
        14,   14,    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,
@@ -420,70 +416,74 @@
         1,    1,    1,    1,    1
     } ;
 
-static yyconst flex_int32_t yy_meta[33] =
+static yyconst flex_int32_t yy_meta[34] =
     {   0,
         1,    1,    2,    1,    1,    1,    1,    3,    3,    1,
         1,    1,    1,    3,    1,    1,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
-        3,    3
+        3,    3,    3
     } ;
 
-static yyconst flex_int16_t yy_base[78] =
+static yyconst flex_int16_t yy_base[82] =
     {   0,
-        0,    0,   83,   82,   84,   87,   81,   87,   70,   87,
-       87,   87,   25,   87,   69,   68,   67,    0,   75,   72,
-       12,   50,   55,   55,   45,   19,   18,   21,    0,   87,
-       70,   87,   37,   87,   87,   87,    0,   87,   87,   42,
-       52,   41,    0,   36,   45,   41,   41,   45,    0,   38,
-       40,    0,   42,   38,    0,   29,   33,   39,    0,   31,
-       37,   31,    0,   33,    0,   21,    0,    0,    0,   24,
-        0,    0,    0,   87,   46,   38,   49
+        0,    0,   87,   86,   88,   91,   85,   91,   74,   91,
+       91,   91,   26,   91,   73,   72,   71,    0,   79,   76,
+       12,   53,   52,   58,   58,   47,   20,   18,   22,    0,
+       91,   73,   91,   34,   91,   91,   91,    0,   91,   91,
+       44,   55,   43,   40,    0,   37,   46,   42,   42,   47,
+        0,   39,   41,    0,   44,   39,    0,   34,   29,   33,
+       40,    0,   31,   38,   31,    0,   34,    0,    0,   22,
+        0,    0,    0,   33,    0,    0,    0,   91,   45,   47,
+       48
     } ;
 
-static yyconst flex_int16_t yy_def[78] =
+static yyconst flex_int16_t yy_def[82] =
     {   0,
-       74,    1,   75,   75,   74,   74,   74,   74,   74,   74,
-       74,   74,   74,   74,   74,   74,   74,   76,   74,   74,
-       76,   76,   76,   76,   76,   76,   76,   76,   77,   74,
-       74,   74,   74,   74,   74,   74,   76,   74,   74,   76,
-       76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
-       76,   77,   76,   76,   76,   76,   76,   76,   76,   76,
-       76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
-       76,   76,   76,    0,   74,   74,   74
+       78,    1,   79,   79,   78,   78,   78,   78,   78,   78,
+       78,   78,   78,   78,   78,   78,   78,   80,   78,   78,
+       80,   80,   80,   80,   80,   80,   80,   80,   80,   81,
+       78,   78,   78,   78,   78,   78,   78,   80,   78,   78,
+       80,   80,   80,   80,   80,   80,   80,   80,   80,   80,
+       80,   80,   80,   81,   80,   80,   80,   80,   80,   80,
+       80,   80,   80,   80,   80,   80,   80,   80,   80,   80,
+       80,   80,   80,   80,   80,   80,   80,    0,   78,   78,
+       78
     } ;
 
-static yyconst flex_int16_t yy_nxt[120] =
+static yyconst flex_int16_t yy_nxt[125] =
     {   0,
         6,    7,    8,    9,    6,   10,   11,   12,   13,   14,
        15,   16,   17,   18,   19,   20,   18,   18,   21,   22,
-       18,   23,   18,   18,   24,   18,   25,   26,   18,   27,
-       28,   18,   33,   33,   40,   46,   41,   47,   48,   50,
-       37,   51,   73,   49,   33,   33,   29,   29,   29,   52,
-       72,   52,   71,   70,   69,   68,   67,   66,   65,   64,
-       63,   62,   61,   60,   59,   58,   57,   56,   55,   54,
-       53,   31,   45,   44,   43,   42,   39,   38,   36,   35,
-       34,   32,   31,   74,   30,   30,    5,   74,   74,   74,
-       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,
+       23,   18,   24,   18,   18,   25,   18,   26,   27,   18,
+       28,   29,   18,   34,   34,   41,   48,   42,   49,   50,
+       52,   34,   34,   53,   51,   30,   30,   30,   54,   38,
+       54,   77,   76,   75,   74,   73,   72,   71,   70,   69,
+       68,   67,   66,   65,   64,   63,   62,   61,   60,   59,
+       58,   57,   56,   55,   32,   47,   46,   45,   44,   43,
+       40,   39,   37,   36,   35,   33,   32,   78,   31,   31,
+        5,   78,   78,   78,   78,   78,   78,   78,   78,   78,
 
-       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,
-       74,   74,   74,   74,   74,   74,   74,   74,   74
+       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,
+       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,
+       78,   78,   78,   78
     } ;
 
-static yyconst flex_int16_t yy_chk[120] =
+static yyconst flex_int16_t yy_chk[125] =
     {   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,   13,   13,   21,   26,   21,   26,   27,   28,
-       76,   28,   70,   27,   33,   33,   75,   75,   75,   77,
-       66,   77,   64,   62,   61,   60,   58,   57,   56,   54,
-       53,   51,   50,   48,   47,   46,   45,   44,   42,   41,
-       40,   31,   25,   24,   23,   22,   20,   19,   17,   16,
-       15,    9,    7,    5,    4,    3,   74,   74,   74,   74,
-       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,
+        1,    1,    1,   13,   13,   21,   27,   21,   27,   28,
+       29,   34,   34,   29,   28,   79,   79,   79,   81,   80,
+       81,   74,   70,   67,   65,   64,   63,   61,   60,   59,
+       58,   56,   55,   53,   52,   50,   49,   48,   47,   46,
+       44,   43,   42,   41,   32,   26,   25,   24,   23,   22,
+       20,   19,   17,   16,   15,    9,    7,    5,    4,    3,
+       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,
 
-       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,
-       74,   74,   74,   74,   74,   74,   74,   74,   74
+       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,
+       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,
+       78,   78,   78,   78
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -544,6 +544,35 @@
 
 static int yy_init_globals (void );
 
+/* Accessor methods to globals.
+   These are made visible to non-reentrant scanners for convenience. */
+
+int yylex_destroy (void );
+
+int yyget_debug (void );
+
+void yyset_debug (int debug_flag  );
+
+YY_EXTRA_TYPE yyget_extra (void );
+
+void yyset_extra (YY_EXTRA_TYPE user_defined  );
+
+FILE *yyget_in (void );
+
+void yyset_in  (FILE * in_str  );
+
+FILE *yyget_out (void );
+
+void yyset_out  (FILE * out_str  );
+
+yy_size_t yyget_leng (void );
+
+char *yyget_text (void );
+
+int yyget_lineno (void );
+
+void yyset_lineno (int line_number  );
+
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
  */
@@ -584,7 +613,7 @@
 /* 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 )
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -595,7 +624,7 @@
 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
 		{ \
 		int c = '*'; \
-		size_t n; \
+		yy_size_t n; \
 		for ( n = 0; n < max_size && \
 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
 			buf[n] = (char) c; \
@@ -686,7 +715,7 @@
 
 	std::string string_buffer;
 
-#line 690 "script-scanner.cc"
+#line 719 "script-scanner.cc"
 
 	if ( !(yy_init) )
 		{
@@ -739,13 +768,13 @@
 			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 >= 75 )
+				if ( yy_current_state >= 79 )
 					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 != 74 );
+		while ( yy_current_state != 78 );
 		yy_cp = (yy_last_accepting_cpos);
 		yy_current_state = (yy_last_accepting_state);
 
@@ -841,55 +870,60 @@
 return token::TK_PRINT;
 	YY_BREAK
 case 16:
-/* rule 16 can match eol */
 YY_RULE_SETUP
-#line 66 "script-scanner.ll"
-yylloc->lines();
+#line 65 "script-scanner.ll"
+return token::TK_COLON;
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 68 "script-scanner.ll"
-return token::TK_NEWLINE;
+#line 66 "script-scanner.ll"
+return token::TK_GOTO;
 	YY_BREAK
 case 18:
 /* rule 18 can match eol */
 YY_RULE_SETUP
-#line 69 "script-scanner.ll"
-{ yylloc->lines(); return token::TK_NEWLINE; }
+#line 68 "script-scanner.ll"
+yylloc->lines();
 	YY_BREAK
 case 19:
+/* rule 19 can match eol */
 YY_RULE_SETUP
-#line 70 "script-scanner.ll"
-return yy::script_parser::token_type(yytext[0]);
+#line 71 "script-scanner.ll"
+{ yylloc->lines(); return token::TK_NEWLINE; }
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
 #line 72 "script-scanner.ll"
-return token::TK_EQ;
+return yy::script_parser::token_type(yytext[0]);
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 73 "script-scanner.ll"
-return token::TK_NE;
+#line 74 "script-scanner.ll"
+return token::TK_EQ;
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 74 "script-scanner.ll"
-return token::TK_GE;
+#line 75 "script-scanner.ll"
+return token::TK_NE;
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 75 "script-scanner.ll"
-return token::TK_LE;
+#line 76 "script-scanner.ll"
+return token::TK_GE;
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
 #line 77 "script-scanner.ll"
-yylloc->step();
+return token::TK_LE;
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 78 "script-scanner.ll"
+#line 79 "script-scanner.ll"
+yylloc->step();
+	YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 80 "script-scanner.ll"
 {
 						errno = 0;
 						long n = strtol(yytext, NULL, 10);
@@ -899,38 +933,38 @@
 						return token::TK_IVAL;
 					}
 	YY_BREAK
-case 26:
+case 27:
 YY_RULE_SETUP
-#line 86 "script-scanner.ll"
+#line 88 "script-scanner.ll"
 {
 						yylval->ival = 0;
 						return token::TK_IVAL;
 					}
 	YY_BREAK
-case 27:
+case 28:
 YY_RULE_SETUP
-#line 90 "script-scanner.ll"
+#line 92 "script-scanner.ll"
 {
 						yylval->sval = new std::string(yytext);
 						return token::TK_IDENTIFIER;
 					}
 	YY_BREAK
-case 28:
+case 29:
 YY_RULE_SETUP
-#line 94 "script-scanner.ll"
+#line 96 "script-scanner.ll"
 driver.error(*yylloc, "この文字を識別子で使用することはできません。");
 	YY_BREAK
 
 
-case 29:
+case 30:
 YY_RULE_SETUP
-#line 97 "script-scanner.ll"
+#line 99 "script-scanner.ll"
 
 	YY_BREAK
-case 30:
-/* rule 30 can match eol */
+case 31:
+/* rule 31 can match eol */
 YY_RULE_SETUP
-#line 98 "script-scanner.ll"
+#line 100 "script-scanner.ll"
 {
 						yylloc->lines();
 						yylloc->step();
@@ -938,12 +972,12 @@
 					}
 	YY_BREAK
 
-case 31:
+case 32:
 YY_RULE_SETUP
-#line 104 "script-scanner.ll"
+#line 106 "script-scanner.ll"
 ECHO;
 	YY_BREAK
-#line 947 "script-scanner.cc"
+#line 981 "script-scanner.cc"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(COMMENT):
 	yyterminate();
@@ -1131,7 +1165,7 @@
 
 	else
 		{
-			int num_to_read =
+			yy_size_t num_to_read =
 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
 		while ( num_to_read <= 0 )
@@ -1145,7 +1179,7 @@
 
 			if ( b->yy_is_our_buffer )
 				{
-				int new_size = b->yy_buf_size * 2;
+				yy_size_t new_size = b->yy_buf_size * 2;
 
 				if ( new_size <= 0 )
 					b->yy_buf_size += b->yy_buf_size / 8;
@@ -1176,7 +1210,7 @@
 
 		/* Read in more data. */
 		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-			(yy_n_chars), (size_t) num_to_read );
+			(yy_n_chars), num_to_read );
 
 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 		}
@@ -1200,6 +1234,14 @@
 	else
 		ret_val = EOB_ACT_CONTINUE_SCAN;
 
+	if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+		/* Extend the array by 50%, plus the number we really need. */
+		yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((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;
@@ -1229,7 +1271,7 @@
 		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 >= 75 )
+			if ( yy_current_state >= 79 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1257,11 +1299,11 @@
 	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 >= 75 )
+		if ( yy_current_state >= 79 )
 			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 == 74);
+	yy_is_jam = (yy_current_state == 78);
 
 	return yy_is_jam ? 0 : yy_current_state;
 }
@@ -1290,7 +1332,7 @@
 
 		else
 			{ /* need more input */
-			int offset = (yy_c_buf_p) - (yytext_ptr);
+			yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
 			++(yy_c_buf_p);
 
 			switch ( yy_get_next_buffer(  ) )
@@ -1314,7 +1356,7 @@
 				case EOB_ACT_END_OF_FILE:
 					{
 					if ( yywrap( ) )
-						return EOF;
+						return 0;
 
 					if ( ! (yy_did_buffer_switch_on_eof) )
 						YY_NEW_FILE;
@@ -1562,7 +1604,7 @@
  */
 static void yyensure_buffer_stack (void)
 {
-	int num_to_alloc;
+	yy_size_t num_to_alloc;
     
 	if (!(yy_buffer_stack)) {
 
@@ -1574,7 +1616,9 @@
 		(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
 								(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;
@@ -1592,6 +1636,8 @@
 								((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()" );
 
 		/* zero only the new slots.*/
 		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -1656,7 +1702,7 @@
 /** Get the length of the current token.
  * 
  */
-int yyget_leng  (void)
+yy_size_t yyget_leng  (void)
 {
         return yyleng;
 }
@@ -1804,7 +1850,7 @@
 
 #define YYTABLES_NAME "yytables"
 
-#line 104 "script-scanner.ll"
+#line 106 "script-scanner.ll"