bug-idutils
[Top][All Lists]
Advanced

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

[bug-idutils] [patch #5537] Patch for lisp scanner...


From: Claudio Fontana
Subject: [bug-idutils] [patch #5537] Patch for lisp scanner...
Date: Mon, 20 Nov 2006 04:11:07 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0

Follow-up Comment #1, patch #5537 (project idutils):

Hello,

> When running "mkid" on the emacs source, EMACS_PRETEST_22_0_90 
> to be exact, mkid chokes on "lisp/add-log.el". 

Yes, thanks for catching this.

> It looks like one of the regexps trips up the scanner.
> Changing the scanner so "[]" are part of id tokens fixes the 
> problem. 

I do not think however that it is the proper solution.
Looking in detail revealed that the problem appears well before
the 'loop' where the scanner gets trapped.
It happens as soon as the ?\" sequence is not properly recognized
as character constant (thanks Karl), and as consequence, what follows is
considered quoted (the " after \ is taken as starting a string):

        (when (= (char-after (point)) ?\")
             (forward-sexp 1)
             (search-forward ","))
             (skip-syntax-forward " ")
             (buffer-substring-no-properties
             (point)
             (progn (search-forward ",")
             (forward-char -1)
             (skip-syntax-backward " ")
             (point))))
        (if (looking-at "^[+-]")

the consequences are obvious only later, as the scanner tries
to scan ^[+-] instead of jumping past it since it is quoted.

I suggest this fix for the main problem:

--- scanners.c  19 Oct 2006 13:00:09 -0000      1.19
+++ scanners.c  20 Nov 2006 03:57:11 -0000
@@ -1643,7 +1643,19 @@
          }
       } while ( (c != EOF) && (c != '"'));
       goto top;
-      
+
+    case '?':                  /* character constant */
+    cconstant:
+      do {
+       c = getc(in_FILE);
+       if (c == '\\' || c == '-')
+         {
+           c = getc(in_FILE);
+           goto cconstant;
+         }
+      } while (c != EOF && !isspace(c));
+    goto top;
+
     case '.':
     case '+': case '-':
       id = scanner_buffer;


however, the scanner should not lock even if given ^[+-]
so another fix for that is needed.
The problem for this separate issue is probably in the elisp [] extension
handling, though I did not look into it in detail yet.

Claudio
 


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?5537>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]