This adds a lexer for the Forth programming language.
Since this is a bit of an unusual language (lacking a rigid structure and syntax), there is a bit of a balancing act going on between accuracy and usability. The highlighting rules follow conventions that most editors with Forth support also follow (e.g. considering control structures such as IF/THEN and DO/LOOP as keywords, and considering words such as :, CREATE and VARIABLE as defining words, with the next word highlighted as the function name).
When working with more fancy code constructs that switch between compiler modes, or when creating higher order defining words, some of these highlights will inevitably be incorrect. These inaccuracies are usually limited to (the first word following) parsing words and should not "break the highlighting" for any larger parts of the codebase.
This adds a lexer for the Forth programming language.
Since this is a bit of an unusual language (lacking a rigid structure and syntax), there is a bit of a balancing act going on between accuracy and usability. The highlighting rules follow conventions that most editors with Forth support also follow (e.g. considering control structures such as
IF/THEN
andDO/LOOP
as keywords, and considering words such as:
,CREATE
andVARIABLE
as defining words, with the next word highlighted as the function name).When working with more fancy code constructs that switch between compiler modes, or when creating higher order defining words, some of these highlights will inevitably be incorrect. These inaccuracies are usually limited to (the first word following) parsing words and should not "break the highlighting" for any larger parts of the codebase.