如何解决“正则表达式匹配器中的堆栈溢出"问题?在emacs中 [英] How to fix "stack overflow in regexp matcher" in emacs

查看:293
本文介绍了如何解决“正则表达式匹配器中的堆栈溢出"问题?在emacs中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Emacs的忠实拥护者,并且经常使用它,尤其是在进行编程和调试(使用Gud)(C/C ++)时.

I'm a big fan of Emacs, and use it a lot, especially while programming and debugging (using gud) (C/C++).

最近我不得不调试一个程序(虽然很简单,但是要对很多数据进行计算(图论)),但是我有一个很烦人的问题. 在程序的逐步执行过程中,出现以下错误:

Recently I had to debug a program (rather simple but that compute on a lot of data (Graph Theory)), but I had a rather annoying problem. During the execution step by step of the program, I get the following error:

error in process filter: Stack overflow in regexp matcher

我进行了一些研究以了解它是什么,然后发现了这篇文章:

I made some research to find out what it was, and I found out this post: Debugging in emacs (with gud) often results in stack overflow error.

据我所知,正则表达式匹配器存在问题,并且程序中的某些内容太长了吗? (我的函数名称确实有异常长且带有很多参数,而且我还使用了异常大的容器.)

So as I understand it, there is a problem with the regexp matcher and the fact that some things in my program are simply too long? (I do have unusually long function name with a lot of parameters and I also use unusually big container.)

我真的很想解决这个问题,但是我对调试Emacs Lisp一无所知,有没有人可以帮助我?

I'd really like to fix this, but I don't know anything about debugging Emacs Lisp, is there anyone to help me ?

这是我从Emacs内部调试器获得的输出: http://pastebin.com/5CKe74e6

Here is the output I get from Emacs internal debbuger : http://pastebin.com/5CKe74e6

我还应该指出,我使用的是Emacs Prelude的个性化版本.

I should also point out, that I use a personalized version of Emacs Prelude.

推荐答案

潜在的问题是正则表达式(regexp)包含太多替代项,并且在应用于(通常为长)文本时,它无法匹配尝试的内容匹配.

The underlying problem is that a regular expression (regexp) contains too many alternatives, and when applied to a (typically long) text it fails to match whatever it tried to match.

在您的情况下,这是正则表达式:

In your case it's the regexp:

"\\([[:alnum:]-_]+\\)=\\({\\|\\[\\|\"\"\\|\"\\(?:[^\\\"]\\|\\\\.\\)*\"\\)"

函数gdb-jsonify-buffer使用哪个.

此正则表达式似乎试图匹配分配.基本上,它与=左边的变量和右边的表达式的一部分匹配. regexp似乎匹配的东西之一是一个字符串,其中包含转义的引号-这始终是一个警告信号,因为Emacs提供了更好的解析字符串的方法.

It looks like this regexp tries to match assignments. Basically, it matches a variable to the left of an = and (part of) an expression to the right. One of the things the regexp seems to match is a string, with containing escaped quotes -- this is always a warning sign as Emacs provides far better methods for parsing strings.

问题可能源于以下事实:此正则表达式是错误的(因此它比字符串更匹配),字符串格式错误或程序仅包含非常大的字符串.

The problem can originate from the fact that this regexp is wrong (so that it matches a lot more than your string), that you have a malformed string, or that your program simply contains a really large string.

我建议您向该软件包的维护者提交错误报告.确保包含引起错误触发的文本.

I would suggest that you file a bug report to the maintainer of that package. Make sure you include the text that caused the error to be triggered.

或者,您可以尝试自己修复此问题.我建议您用找到字符串开头的更简单的正则表达式替换复杂的正则表达式.然后,您可以使用例如(forward-sexp)查找字符串的结尾.

Alternatively, you could make an attempt at fixing this yourself. I would suggest that you replace the complex regexp with a simpler regexp that find the beginning of a string. You could then use, for example, (forward-sexp) to find the end of the string.

这篇关于如何解决“正则表达式匹配器中的堆栈溢出"问题?在emacs中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆