[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#183621: marked as done (spim: Backslash support too weak)



Your message dated Fri, 3 Oct 2008 20:26:44 +0100
with message-id <200810031926.m93JQiRG017530@kmos.homeip.net>
and subject line spim has been removed from Debian, closing #183621
has caused the Debian Bug report #183621,
regarding spim: Backslash support too weak
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
183621: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=183621
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: spim
Version: 6.5-1
Severity: wishlist

Support for \t and many other is lacking.  Hexadecimal is supported
only in upper case.  Backslashes are not supported equally inside
strings and outside strings.  So I'm suggesting the following patch
that makes it support more ISO C escapes.  (The maybe surprising
changes in the regexp are there to pacify Emacs' font-lock-mode).

--- /tmp/spim-6.5/scanner.l	2003-01-05 01:09:01.000000000 +0100
+++ scanner.l	2003-03-06 09:26:17.000000000 +0100
@@ -1,8 +1,8 @@
-%{
+%{                                                     -*- C -*-
 /* SPIM S20 MIPS simulator.
    Lexical scanner.

-   Copyright (C) 1990-2003 by James Larus (larus@cs.wisc.edu).
+   Copyright (C) 1990-1997, 2003 by James Larus (larus@cs.wisc.edu).
    ALL RIGHTS RESERVED.

    SPIM is distributed under the following conditions:
@@ -65,9 +65,11 @@
 #ifdef __STDC__
 static int check_keyword (YY_CHAR *id, int allow_pseudo_ops);
 static YY_CHAR *copy_str (YY_CHAR *str, int chop);
+static YY_CHAR scan_escape (YY_CHAR **str);
 #else
 static int check_keyword ();
 static YY_CHAR *copy_str ();
+static YY_CHAR scan_escape (YY_CHAR **str);
 #endif


@@ -251,7 +253,7 @@
 			}


-\"(([^"])|(\\\"))*\"	{
+\"(([^""])|(\\\"))*\"	{
 			  if (current_line == NULL)
 			    {
 			      current_line_no = line_no;
@@ -261,7 +263,7 @@
 			  return (Y_STR);
 			}

-\'(([^'])|(\\[^']))\'	{
+\'(([^''])|(\\[^'']))\'	{
 			  if (current_line == NULL)
 			    {
 			      current_line_no = line_no;
@@ -270,19 +272,8 @@

 			    if (*(yytext + 1) == '\\')
 			      {
-				switch (*(yytext + 2))
-				  {
-				  case 'n':
-				    yylval.i = (int) '\n';
-				    return (Y_INT);
-
-				  case 't':
-				    yylval.i = (int) '\t';
-				    return (Y_INT);
-
-				  default:
-				    yyerror ("Bad character \\X");
-				  }
+				YY_CHAR *escape = yytext + 1;
+				yylval.i = (int) scan_escape (&escape);
 			      }
 			    else
 			      {
@@ -360,6 +351,63 @@
 }


+/* A backslash has just been read, return the character designated
+   by *STR.  */
+
+#ifdef __STDC__
+static YY_CHAR
+scan_escape (YY_CHAR **str)
+#else
+static YY_CHAR
+scan_escape (str)
+     YY_CHAR **str;
+#endif
+{
+  YY_CHAR first = **str;
+  *str += 1;
+  switch (first)
+    {
+    case 'a': return '\a';
+    case 'b': return '\b';
+    case 'f': return '\f';
+    case 'n': return '\n';
+    case 'r': return '\r';
+    case 't': return '\t';
+    case '\\': return '\\';
+    case '"': return '"';
+    case '\'': return '\'';
+
+    case 'x':
+    case 'X':
+      {
+	YY_CHAR c1 = **str, c2 = *(*str + 1);
+	int b = 0;
+
+	if ('0' <= c1 && c1 <= '9') b = c1 - '0';
+	else if ('A' <= c1 && c1 <= 'F') b = c1 - 'A' + 10;
+	else if ('a' <= c1 && c1 <= 'f') b = c1 - 'a' + 10;
+	else yyerror ("Bad character in \\X construct in string");
+
+	b <<= 4;
+	if ('0' <= c2 && c2 <= '9') b += c2 - '0';
+	else if ('A' <= c2 && c2 <= 'F') b += c2 - 'A' + 10;
+	else if ('a' <= c2 && c2 <= 'f') b += c2 - 'a' + 10;
+	else yyerror ("Bad character in \\X construct in string");
+
+	*str += 2;
+	return (YY_CHAR) b;
+      }
+
+    default:
+      {
+	char message[] = "Bad character \\X";
+	message[strlen (message) - 1] = first;
+	yyerror (message);
+      }
+    }
+}
+
+
 /* Return a freshly-allocated copy of STRING with the last CHOP
    characters removed. */

@@ -378,54 +426,11 @@

   for (n = new_str; *str != '\0' && new_len > 0; new_len -= 1)
     if (*str == '\\')
-      switch (*(str + 1))
-	{
-	case 'n':
-	  {
-	    *n ++ = '\n';
-	    str += 2;
-	    new_len -= 1;
-	    continue;
-	  }
-	case 't':
-	  {
-	    *n ++ = '\t';
-	    str += 2;
-	    new_len -= 1;
-	    continue;
-	  }
-	case '"':
-	  {
-	    *n ++ = '"';
-	    str += 2;
-	    new_len -= 1;
-	    continue;
-	  }
-	case 'X':
-	  {
-	    YY_CHAR c1 = *(str + 2), c2 = *(str + 3);
-	    int b = 0;
-
-	    if ('0' <= c1 && c1 <= '9') b = c1 - '0';
-	    else if ('A' <= c1 && c1 <= 'F') b = c1 - 'A' + 10;
-	    else yyerror ("Bad character in \\X construct in string");
-
-	    b <<= 4;
-	    if ('0' <= c2 && c2 <= '9') b += c2 - '0';
-	    else if ('A' <= c2 && c2 <= 'F') b += c2 - 'A' + 10;
-	    else yyerror ("Bad character in \\X construct in string");
-
-	    *n ++ = (YY_CHAR) b;
-	    str += 4;
-	    new_len -= 3;
-	    continue;
-	  }
-	default:
-	  {
-	    *n ++ = *str ++;
-	    continue;
-	  }
-	}
+      {
+	YY_CHAR *first = ++str;
+	*n ++ = scan_escape (&str);
+	new_len -= str - first;
+      }
     else
       *n ++ = *str ++;



-- System Information
Debian Release: testing/unstable
Kernel Version: Linux nostromo 2.4.20 #4 jeu fév 27 14:06:02 CET 2003 i686 unknown unknown GNU/Linux

Versions of the packages spim depends on:
ii  libc6          2.3.1-14       GNU C Library: Shared libraries and Timezone
ii  libxaw7        4.2.1-6        X Athena widget set library
ii  xlibs          4.2.1-6        X Window System client libraries


--- End Message ---
--- Begin Message ---
Version: 7.3-1+rm

The spim package has been removed from Debian testing, unstable and
experimental, so I am now closing the bugs that were still opened
against it.

For more information about this package's removal, read
http://bugs.debian.org/354501 . That bug might give the reasons why
this package was removed, and suggestions of possible replacements.

Don't hesitate to reply to this mail if you have any question.

Thank you for your contribution to Debian.

--
Marco Rodrigues
http://Marco.Tondela.org


--- End Message ---

Reply to: