turbo-editors/turbo-golopublic Fork 0
v1.0.2
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-golo.git
git clone ssh://git@rickub.com/turbo-editors/turbo-golo.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

📦 Turbo Golo d710c1b · on v1.0.2 · k33g · 12h ago
lexer-only.golo · 26 lines · 882 BText Blame HistoryRaw
 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
}