Is there a Sublime Text Syntax for Flex and Bison?

后端 未结 5 2452
既然无缘
既然无缘 2021-02-19 13:52

I\'m looking for a syntax in Sublime Text that highlights my Flex and Bison files (or lex/yacc) in a way that makes them readable... Sublime Text automatically chooses Lisp for

相关标签:
5条回答
  • 2021-02-19 14:03

    I haven't found one built specifically for Sublime, but I've found one for TextMate, which Sublime is compatible with.

    Therefore, for Flex highlight, all you need to do is git clone the TextMate's syntax files to your Packages folder.

    Regarding Bison, I've found a syntax for TextMate, but it didn't work very well for me. The one Vaklarados posted worked nicer with my source files.

    0 讨论(0)
  • 2021-02-19 14:03

    Indeed there are:

    • Flex
    • Bison

    It's not so hard to write your own packages for non-typical languages. Just browse the source of other language syntax files and copy-paste-change what you need. Also raises your regex skills to a better level.

    0 讨论(0)
  • 2021-02-19 14:07

    https://github.com/m-happy/Packages/blob/master/Flex/Flex.sublime-syntax

    You can add this file to your sublime package.

    0 讨论(0)
  • 2021-02-19 14:10

    Install Package Control for Sublime Text.

    I found this there: https://sublime.wbond.net/packages/Bison

    Do try it, I found it good enough for my use.

    0 讨论(0)
  • 2021-02-19 14:25

    The one thalesmello posted works well for Flex. For Bison, I've found this one - it's pretty minimal but it's a start:

    https://github.com/Jackneill/sublime-text-packages/tree/master/Packages/Bison

    Please let me know if you find something better!

    edit: I take it back - the Flex one highlights start states & C/C++ code in pink and it looks quite terrible. For basic lex files it looks okay, but it needs work. :)

    edit again: as sonu kumar pointed out, the project has been removed from github. For an alternative you could try the built-in OCamlyacc highlighting (pretty decent), or another alternative: https://bitbucket.org/artyom_smirnov/sublime-text-bison-highlighter (needs some work)

    I'm using Sublime a lot more & do a fair bit of work in Flex/Bison, so I might get around to writing one... one day. :D

    0 讨论(0)
提交回复
热议问题