patch-2.4.9 linux/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l

Next file: linux/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
Previous file: linux/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.8/linux/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l linux/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l
@@ -29,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: //depot/src/aic7xxx/aicasm/aicasm_scan.l#4 $
+ * $Id: //depot/src/aic7xxx/aicasm/aicasm_scan.l#5 $
  *
  * $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_scan.l,v 1.13 2000/09/22 22:19:54 gibbs Exp $
  */
@@ -54,6 +54,7 @@
 char string_buf[MAX_STR_CONST];
 char *string_buf_ptr;
 int  parren_count;
+int  quote_count;
 %}
 
 PATH		[-/A-Za-z0-9_.]*[./][-/A-Za-z0-9_.]*
@@ -63,6 +64,7 @@
 %x COMMENT
 %x CEXPR
 %x INCLUDE
+%x STRING
 
 %%
 \n			{ ++yylineno; }
@@ -94,8 +96,9 @@
 			}
 <CEXPR>\n		{ ++yylineno; }
 <CEXPR>[^()\n]+	{
-				char *yptr = yytext;
+				char *yptr;
 
+				yptr = yytext;
 				while (*yptr != '\0') {
 					/* Remove duplicate spaces */
 					if (*yptr == '\t')
@@ -109,6 +112,25 @@
 				}
 			}
 
+VERSION			{ return T_VERSION; }
+\"			{
+				string_buf_ptr = string_buf;
+				BEGIN STRING;
+			}
+<STRING>[^"]+		{
+				char *yptr;
+
+				yptr = yytext;
+				while (*yptr)
+					*string_buf_ptr++ = *yptr++;
+			}
+<STRING>\"		{
+				/* All done */
+				BEGIN INITIAL;
+				*string_buf_ptr = '\0';
+				yylval.str = string_buf;
+				return T_STRING;
+			}
 {SPACE}			;
 
 	/* Register/SCB/SRAM definition keywords */
@@ -175,7 +197,7 @@
 else			{ return T_ELSE; }
 
 	/* Allowed Symbols */
-[-+,:()~|&."{};<>[\]!]	{ return yytext[0]; }
+[-+,:()~|&."{};<>[\]!=]	{ return yytext[0]; }
 
 	/* Number processing */
 0[0-7]*			{
@@ -194,17 +216,36 @@
 			}
 
 	/* Include Files */
-#include		{ return T_INCLUDE; BEGIN INCLUDE;}
-<INCLUDE>[<>\"]		{ return yytext[0]; }
-<INCLUDE>{PATH}		{ yylval.str = strdup(yytext); return T_PATH; }
-<INCLUDE>;		{ BEGIN INITIAL; return yytext[0]; }
+#include{SPACE}		{
+				BEGIN INCLUDE;
+				quote_count = 0;
+				return T_INCLUDE;
+			}
+<INCLUDE>[<]		{ return yytext[0]; }
+<INCLUDE>[>]		{ BEGIN INITIAL; return yytext[0]; }
+<INCLUDE>[\"]		{
+				if (quote_count != 0)
+					BEGIN INITIAL;
+				quote_count++;
+				return yytext[0];
+			}
 <INCLUDE>.		{ stop("Invalid include line", EX_DATAERR); }
 
 	/* For parsing C include files with #define foo */
 #define			{ yylval.value = TRUE; return T_CONST; }
 	/* Throw away macros */
 #define[^\n]*[()]+[^\n]* ;
-{PATH}			{ yylval.str = strdup(yytext); return T_PATH; }
+<INITIAL,INCLUDE>{PATH}	{
+				char *yptr;
+
+				yptr = yytext;
+				string_buf_ptr = string_buf;
+				while (*yptr)
+					*string_buf_ptr++ = *yptr++;
+				yylval.str = string_buf;
+				*string_buf_ptr = '\0';
+				return T_PATH;
+			}
 
 {WORD}			{ yylval.sym = symtable_get(yytext);  return T_SYMBOL; }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)