emacs-devel
[Top][All Lists]
Advanced

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

Re: [elpa] externals/pyim 952814a 1/2: * pyim.el (pyim-cregexp-build): h


From: Stefan Monnier
Subject: Re: [elpa] externals/pyim 952814a 1/2: * pyim.el (pyim-cregexp-build): handle the case, when regexp generated is too long.
Date: Mon, 15 Mar 2021 10:12:34 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> +               (stringp rx-string)
> +               ;; FIXME: Emacs seem to can not handle regexp, which length 
> is too big.
> +               (length< rx-string 5000))

The limit is not in the actual string's length but in the generated
compiled-regexp object (it basically compiles regexps to a dedicated
bytecode format whose "jumps" use 16bit relative offsets making it break
down when the bytecode object gets larger than about 32KB).
I suggest you use a test like

    (condition-case nil
        (progn (string-match rx-string "") 'good)
      ;; FIXME: Emacs can't handle regexps whose length is too big :-(
      (error 'bad))


-- Stefan




reply via email to

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