Category: IGI (in-game GUI) — Code editor
The IGI code editor colours text by following a .lang file: a small text file that says what the language's comments, strings, numbers and words look like, and what colour each is. Load one with igiLoadLanguage, or pass the same text to igiDefineLanguage. If something in it is wrong, the rest still works, and igiLanguageErrors tells you what and on which line.
Ready-made files are in userlibs\languages: bamboobasic.lang, cpp.lang, lua.lang, wgsl.lang and hlsl.lang. Copying one is the easiest way to start a new language.
; mylang.lang - lines starting with ; are comments name = MyScript caseSensitive = no lineComment = ; // ; one or more blockComment = /* */ ; a start and an end; can run over lines string = " \ ; the quote, then the escape character (if any) numbers = decimal hex:$ hex:0x binary:% identifier = A-Za-z_ : A-Za-z0-9_ ; first character : the rest pattern = #\w+ : preprocessor ; a regular expression : the group it colours as [keywords] If Then Else EndIf While Wend Function EndFunction Return [types] Int String Double [colours] keywords = 86 156 214 types = 78 201 176 preprocessor = 197 134 192 comment = 106 153 85 background = 30 30 30
Settings go at the top, before any [section], as name = value. Anything after a ; with a space before it is a comment (except on pattern lines).
| Setting | What it does |
| name | The language's name (shown in error messages). |
| caseSensitive | yes or no. With no, IF,
If and if are all the same keyword. Starts as yes. |
| lineComment | What starts a comment that runs to the end of the line. Give several separated by spaces, or repeat the setting. |
| blockComment | The start and end of a comment that can run over several
lines, such as /* */ or Lua's --[[ ]]. Repeat it for more than one
kind. |
| string | A quote character (or text), then optionally the escape character
that lets the quote appear inside the string. string = " \ is C's;
string = " has no escape. Repeat it for more kinds of quote. Strings end at the end
of the line if they aren't closed. |
| numbers | Which numbers to colour: decimal (42,
3.14, .5, 1e-3), hex:prefix and
binary:prefix. numbers = decimal hex:$ binary:% is BambooBasic's. Starts
as decimal only. |
| identifier | The characters a word can start with, then :, then the
characters it can go on with. Ranges like A-Z work. Starts as
A-Za-z_ : A-Za-z0-9_. |
| pattern | A regular expression (ECMAScript, as in JavaScript), then
space : space and the group to colour the match as. For things words and numbers can't
describe, such as #include, @group or SV_Target. Patterns
are tried in the order they're written, and only match where a token starts. |
Any [section] other than [colours] is a group of words: write the words after it, separated by spaces, on as many lines as you like. The section's name is the group's name; use any names and as many groups as you want ([keywords], [types], [functions], [constants]…). A pattern can colour as a group too.
In [colours] each line is a name and a colour as three numbers 0-255 (red, green, blue). The names are your groups, plus:
| Name | Colours | Starts as |
| text | everything else (names that aren't in a group) | 220 220 220 |
| comment | comments | 106 153 85 |
| string | strings | 206 145 120 |
| number | numbers | 181 206 168 |
| operator | punctuation: + - ( ) , : and so on | 200 200 200 |
| background | the editor's background | 30 30 30 |
| gutter | behind the line numbers | 26 26 26 |
| linenumber | the line numbers | 133 133 133 |
| currentline | the caret's line | 42 42 42 |
| selection | selected text | 38 79 120 |
| caret | the caret | 255 255 255 |
A group with no colour of its own gets one in turn, in the order the groups are written: blue, teal, yellow, purple, light blue, gold, red, green.
At each point in a line the editor tries, in this order: the end of a block comment it's inside; the start of a block comment; a line comment; a string; the patterns; a number; a word (looked up in the groups); and anything else is an operator. Knowing the order helps when two rules could both match.
bamboobasic.lang is made from the IDE's keyword list and the runtime's function list, with the IDE's colours, so it colours code the way the IDE does.
BambooBasic © 2026 Michael Denathorn