unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [elpa] externals/pyim 952814a 1/2: * pyim.el (pyim-cregexp-build): handle the case, when regexp generated is too long.
       [not found] ` <20210315075709.C859C20DFD@vcs0.savannah.gnu.org>
@ 2021-03-15 14:12   ` Stefan Monnier
  2021-03-16  3:25     ` tumashu
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2021-03-15 14:12 UTC (permalink / raw)
  To: emacs-devel; +Cc: Feng Shu

> +               (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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re:Re: [elpa] externals/pyim 952814a 1/2: * pyim.el (pyim-cregexp-build): handle the case, when regexp generated is too long.
  2021-03-15 14:12   ` [elpa] externals/pyim 952814a 1/2: * pyim.el (pyim-cregexp-build): handle the case, when regexp generated is too long Stefan Monnier
@ 2021-03-16  3:25     ` tumashu
  0 siblings, 0 replies; 2+ messages in thread
From: tumashu @ 2021-03-16  3:25 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel@gnu.org

















At 2021-03-15 22:12:34, "Stefan Monnier" <monnier@iro.umontreal.ca> wrote:
>> +               (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))
>

Merged, thanks!
>
>-- Stefan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-16  3:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210315075708.17408.32347@vcs0.savannah.gnu.org>
     [not found] ` <20210315075709.C859C20DFD@vcs0.savannah.gnu.org>
2021-03-15 14:12   ` [elpa] externals/pyim 952814a 1/2: * pyim.el (pyim-cregexp-build): handle the case, when regexp generated is too long Stefan Monnier
2021-03-16  3:25     ` tumashu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).