--- filetype: freebasic detect: filename: "(\\.bas$|\\.bi$)" rules: # Statements / keywords - statement: "\\b(IF|THEN|ELSE|ELSEIF|ENDIF|FOR|TO|STEP|NEXT|WHILE|WEND|DO\ |LOOP|UNTIL|SELECT|CASE|IS|AS|DEFAULT|ENDSELECT|EXIT|CONTINUE|RETURN|GOTO\ |CONST|DIM|REDIM|STATIC|TYPE|ENDTYPE|ENUM|ENDENUM|SUB|END\\s+SUB|FUNCTION\ |END\\s+FUNCTION|DECLARE|OPTION|EXPLICIT|NAMESPACE|END\\s+NAMESPACE|END\ |USINGABS|SGN|INT|FIX|SIN|COS|TAN|ATN|EXP|LOG|SQR|RND|LEN|MID|LEFT\ |RIGHT|TRIM|LTRIM|RTRIM|SPACE|STRING|CHR|ASC|VAL|FORMAT|INSTR|INSTRREV\ |UCASE|LCASE|REPLACE|SPLIT|JOIN|STRPTR|VARPTR|LEN|CURDIR|DIR|ENVIRON\ |FREEFILE|LOF|LOC|SEEK|PUT|GET|PRINT|INPUT|LINE|WRITE|OPEN|CLOSE|MKDIR\ |RMDIR|KILL|NAME|CHDIR|FILES|BEEP|SLEEP|TIMER|DATE|TIME|NOW|PSET|LINE\ |CIRCLE|PAINT|VIEW|WINDOW|SCREEN|WIDTH|COLOR|CLS|LOCATE|PCOPY|PMAP|POINT\ |PALETTE|RGB|RGBA|AND|OR|NOT|POINTER|ABS|EXTERN|END\\s+EXTERN\ |CONSTRUCTOR|END\\s+CONSTRUCTOR)\\b" - statement: "\\b(if|then|else|elseif|endif|for|to|step|next|while|wend|do\ |loop|until|select|case|is|as|default|endselect|exit|continue|return|goto\ |const|dim|redim|static|type|endtype|enum|endenum|sub|end\\s+sub|function\ |end\\s+function|declare|option|explicit|namespace|end\\s+namespace|end\ |usingabs|sgn|int|fix|sin|cos|tan|atn|exp|log|sqr|rnd|len|mid|left\ |right|trim|ltrim|rtrim|space|string|chr|asc|val|format|instr|instrrev\ |ucase|lcase|replace|split|join|strptr|varptr|len|curdir|dir|environ\ |freefile|lof|loc|seek|put|get|print|input|line|write|open|close|mkdir\ |rmdir|kill|name|chdir|files|beep|sleep|timer|date|time|now|pset|line\ |circle|paint|view|window|screen|width|color|cls|locate|pcopy|pmap|point\ |palette|rgb|rgba|and|or|not|pointer|abs|extern|end\\s+extern\ |constructor|end\\s+constructor)\\b" # Types - type: "\\b(INTEGER|LONG|ULONG|BYTE|UBYTE|SHORT|USHORT|SINGLE|DOUBLE\ |BOOLEAN|STRING|ZSTRING|WSTRING|VARIANT|ANY|OBJECT|PRINT|PTR)\\b" - type: "\\b(integer|long|ulong|byte|ubyte|short|ushort|single|double\ |boolean|string|zstring|wstring|variant|any|object|print|ptr)\\b" # Numbers - constant.number: "\\b\\d+(\\.\\d+)?([eE][+-]?\\d+)?\\b" - constant.number: "&H[0-9A-Fa-f]+" - constant.number: "&O[0-7]+" - constant.number: "&B[01]+" # Strings (double-quoted and single-quoted) - constant.string: "\"([^\"\\\\]|\\\\.)*\"" - constant.string: "'([^'\\\\]|\\\\.)*'" # Boolean / Null constants - constant.language: "\\b(TRUE|FALSE|NULL|NOTHING)\\b" - constant.language: "\\b(true|false|null|nothing)\\b" # Comments (single line and REM) - comment.line: "'[^\n]*" - comment.line: "\\bREM\\b[^\n]*" - comment.line: "\\brem\\b[^\n]*" # Block comments style (like C-style in FreeBASIC) - comment.block: "/\\*.*\\*/" # Symbols - symbol: "\\+|\\-|\\*|\\/|\\=|\\<>|\\<|\\>|\\<=|\\>=|\\(|\\)|\\[|\\]|,|:" # Preprocessor directives - preproc: "^\\s*#(INCLUDE|DEFINE|IFDEF|ELSE|ENDIF|ENDMACRO|MACRO\ |ERROR|ELSEIF|PRINT|UNDEF|IFNDEF|IF|INCLIB)\\b" - preproc: "^\\s*#(include|define|ifdef|else|endif|endmacro|macro\ |error|elseif|print|undef|ifndef|if|inclib)\\b"