Modify assembler to ignore carriage returns in input.
authorPeter Avalos <pavalos@dragonflybsd.org>
Thu, 5 Jul 2007 05:41:50 +0000 (05:41 +0000)
committerPeter Avalos <pavalos@dragonflybsd.org>
Thu, 5 Jul 2007 05:41:50 +0000 (05:41 +0000)
Obtained-from: FreeBSD

sys/dev/disk/aic7xxx/aicasm/aicasm_macro_scan.l
sys/dev/disk/aic7xxx/aicasm/aicasm_scan.l

index 360c405..a265b95 100644 (file)
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_macro_scan.l#7 $
+ * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_macro_scan.l#8 $
  *
- * $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l,v 1.1.2.3 2002/09/27 15:46:28 gibbs Exp $
- * $DragonFly: src/sys/dev/disk/aic7xxx/aicasm/aicasm_macro_scan.l,v 1.4 2006/04/22 16:15:26 dillon Exp $
+ * $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l,v 1.5 2003/12/16 23:54:07 gibbs Exp $
+ * $DragonFly: src/sys/dev/disk/aic7xxx/aicasm/aicasm_macro_scan.l,v 1.5 2007/07/05 05:41:50 pavalos Exp $
  */
 
 #include <sys/types.h>
@@ -81,6 +81,7 @@ MCARG         [^(), \t]+
 \n                     {
                                ++yylineno;
                        }
+\r                     ;
 <ARGLIST>{SPACE}       ;
 <ARGLIST>\(            {
                                parren_count++;
index 7101be0..8d02e62 100644 (file)
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_scan.l#18 $
+ * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_scan.l#19 $
  *
- * $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_scan.l,v 1.13.2.6 2002/09/27 15:46:28 gibbs Exp $
- * $DragonFly: src/sys/dev/disk/aic7xxx/aicasm/aicasm_scan.l,v 1.4 2006/04/22 16:15:26 dillon Exp $
+ * $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_scan.l,v 1.22 2003/12/16 23:54:07 gibbs Exp $
+ * $DragonFly: src/sys/dev/disk/aic7xxx/aicasm/aicasm_scan.l,v 1.5 2007/07/05 05:41:50 pavalos Exp $
  */
 
 #include <sys/types.h>
@@ -94,6 +94,7 @@ MBODY         ((\\[^\n])*[^\n\\]*)+
 
 %%
 \n                     { ++yylineno; }
+\r                     ;
 "/*"                   { BEGIN COMMENT;  /* Enter comment eating state */ }
 <COMMENT>"/*"          { fprintf(stderr, "Warning! Comment within comment."); }
 <COMMENT>\n            { ++yylineno; }
@@ -121,6 +122,7 @@ if[ \t]*\(          {
                                }
                        }
 <CEXPR>\n              { ++yylineno; }
+<CEXPR>\r              ;
 <CEXPR>[^()\n]+        {
                                char *yptr;
 
@@ -366,6 +368,7 @@ else                        { return T_ELSE; }
                                /* Eat escaped newlines. */
                                ++yylineno;
                        }
+<MACROBODY>\r          ;
 <MACROBODY>\n          {
                                /* Macros end on the first unescaped newline. */
                                BEGIN INITIAL;
@@ -376,10 +379,17 @@ else                      { return T_ELSE; }
                        }
 <MACROBODY>{MBODY}     {
                                char *yptr;
+                               char c;
 
                                yptr = yytext;
-                               while (*yptr)
-                                       *string_buf_ptr++ = *yptr++;
+                               while (c = *yptr++) {
+                                       /*
+                                        * Strip carriage returns.
+                                        */
+                                       if (c == '\r')
+                                               continue;
+                                       *string_buf_ptr++ = c;
+                               }
                        }
 {WORD}\(               {
                                char *yptr;