| 📦 Turbo Golo d710c1b k33g 17h ago | 1 | module demo.LexerOnly |
| 2 | |
| 3 | # This file is coloured and does NOT run. GoloScript's lexer reads every token |
| 4 | # below — token/token.go and lexer/lexer.go name them — and its parser then |
| 5 | # refuses them, as of v0.1.1. Turbo Golo colours what the lexer reads, so a |
| 6 | # coloured token is not a promise that the interpreter will accept it. |
| 7 | |
| 8 | # The local keyword: read as LOCAL, refused by the parser in a declaration. |
| 9 | local function hidden = |x| -> x + 1 |
| 10 | |
| 11 | function main = |args| { |
| 12 | # The long and float suffixes: read as numbers, refused by the parser. |
| 13 | let long = 42L |
| 14 | let float = 3.14F |
| 15 | let small = 2.0f |
| 16 | |
| 17 | # A character literal: read as CHAR, refused by the parser. |
| 18 | let c = 'x' |
| 19 | |
| 20 | # The range operator: read as .., refused by the parser. |
| 21 | let r = 1..3 |
| 22 | |
| 23 | # Two word operators the parser does not yet place in an expression. |
| 24 | let v = null orIfNull 0 |
| 25 | let t = c oftype String.class |
| 26 | } |