Sublime Forum

Help with custom syntax?

#1

For sublime text 3 I am trying to follow:

https://www.sublimetext.com/docs/3/syntax.html

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?

0 Likes

#2

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

0 Likes

#3

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?

0 Likes

#4

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

#5

I am trying to create pseudocode syntax similar to this: https://blog.usejournal.com/how-to-write-pseudocode-a-beginners-guide-29956242698

0 Likes