Is there a good Emacs mode or method for lex/flex/yacc/bison files?

帅比萌擦擦* 提交于 2019-12-21 06:48:44

问题


Editing lex or yacc files with Emacs is a nuisance: if I use C mode the indenting goes wrong, and if I don't use C mode I can't use indenting. Does anyone have a trick, a method, or an editing mode to get around it?


回答1:


It's not entirely what you want but there is a very excelent Bison mode for Emacs.

http://www.emacswiki.org/emacs/BisonMode

This is a better link:

http://ftp.lip6.fr/pub/emacs/elisp-archive/incoming/bison-mode.el.gz

Since Yacc and bison are so closely related I don't find it lacking too much. Though I do most of my work with Antlr anymore.




回答2:


Looks like Matz (of Ruby fame) wrote a yacc(/bison) mode. Have a look at http://www.rubyist.net/~matz/a/yacc.el




回答3:


How about this one?

http://borkware.com/quickies/single?id=73

or this one

http://www.cs.utah.edu/dept/old/texinfo/emacs19/emacs_26.html#SEC184




回答4:


I generally toggle between Makefile mode, text mode, and C mode depending on which line I am on. If you want better, you should write the mode!



来源:https://stackoverflow.com/questions/2166680/is-there-a-good-emacs-mode-or-method-for-lex-flex-yacc-bison-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!