%This is provided as an example of a language support file for Tcode. % In this file, the faked language is called Lex %Tcode.tex sets \catcode`@=11 and doesn't set it back (in actual language files, there %is always something later that also needs @). Do as you please by the end of this file. \input Tcode.tex %The core \ThisIsLanguage{Lex} \input Tutils-fastfonts-1.tex %In case this is used with Latex, for considerably faster font switch in the snippets. Comment % this out if you don't like it. There is also a "2" version that is needed if you use either of \Cbold % \itlight or \itbold within any of the format definitions below. In this example, they only set color. %%--------------------------------------------------------------------------------------------- \DeclareCommentChar{%} % % introduces line comments \DeclareString %This makes "some text" be recognised as a String. \DeclareDelimited{'}{String} % 'some text' or 'a' are also Strings, or at least formatted as strings. %Add here any normal (to TeX) characters that function as letters. Digits need not be included. % \def\OtherCharsInIdent{\catcode`@=11 } %And here those that are special to TeX % \def\SpecialCharsInIdent{\catcode`\_=11} %This is Tcode's default definition. \unless\ifdefined\color \input pdfcolor-rg.tex %Comment out if you prefer to include a colour package later \fi %%--------------------------------------------------------------------------------------------- %\input Lexhighlighting_1.tex %Rather than writing the definitions directly here \input highlighting_common.tex %You should include this. It selects \DefineColor according to what colour package (or none) has been loaded \DefineColor{dark-blue}{0, 0, 0.5} \DefineColor{red}{1, 0, 0} \DefineColor{comment}{0.4, 0.52, 0.4} \DefineColor{macro}{0.5, 0.2, 0} \DefineColor{function}{0.45, 0.1, 0.6} \TcodeDefineFormat{Keyword}{\color{dark-blue}} \TcodeDefineFormat{Comment}{\color{comment}} \TcodeDefineFormat{String}{\color{red}} \TcodeDefineFormat{Function}{\color{function}} \TcodeDefineFormat{Macro}{\color{macro}} %%--------------------------------------------------------------------------------------------- %\input Lexwords.tex %Rather than writing them directly here \MakeWord{if}{Keyword} \MakeWord{else}{Keyword} \MakeWord{for}{Keyword} \MakeWord{int}{Keyword} \MakeWord{return}{Keyword} \MakeWord{end}{Keyword} \MakeWord{time}{Function} \MakeWord{sqrt}{Function} \MakeWord{trim}{Function} \MakeWord{swap}{Macro} \MakeWord{select}{Macro} .