[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re:Re: [elpa] externals/pyim 952814a 1/2: * pyim.el (pyim-cregexp-build)
From: |
tumashu |
Subject: |
Re:Re: [elpa] externals/pyim 952814a 1/2: * pyim.el (pyim-cregexp-build): handle the case, when regexp generated is too long. |
Date: |
Tue, 16 Mar 2021 11:25:31 +0800 (CST) |
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