Sublime Forum

Help with custom syntax?


For sublime text 3 I am trying to follow:

to create a Pseudocode formatting for something basic, as just highlighting particular words, such as while loops, for loops, functions, as in the word function, logical expressions and variable declarations (always forget what these are called, int, string etc…)

I try to look through github for a decent FULL .sublime-syntax file but could not find one. Can anyone help me break this down, perhaps create me a very basic template of a .sublime-syntax file so I can better understand how it works?



You might want to look at the default packages repository. All of the syntax definitions built into Sublime are there.



I don’t understand why these have so many files aside from LaTeX.sublime-syntax for example though? What are all these other files for? Which would be the most simple one to look at to get an idea, in order to achieve my goals overall?



If you’re trying to come up with your first syntax you can safely ignore all of the other resources in those packages for the time being. They all add various integrations between the language and Sublime (adding new commands, adding to the menu, adding build system options, specifying what symbols appear in the symbol list, etc) but they all rely on the syntax definition. As such you should probably focus more on the syntax aspect first and the rest will come more easily later.

What sort of syntax are you trying to create? is it based on something similar to one of the existing languages? Something like the Diff and Pascal syntaxes are pretty simple examples of syntaxes so working through how those work may help you get more familiar with what the documentation is telling you.

1 Like


I am trying to create pseudocode syntax similar to this: