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