blob: b0fe25823cd70de0af47cd5dd6467feafe37309a [file] [log] [blame] [edit]
/**
# Lexical structure
*/
[helper]
LongSuffix
: "L"
;
IntegerLiteral
: DecimalLiteral LongSuffix?
: HexadecimalLiteral LongSuffix?
: BinaryLiteral LongSuffix?
;
[helper]
Digit
: ["0".."9"]
;
DecimalLiteral
: Digit
: Digit (Digit | "_")* Digit
;
FloatLiteral
: <Java double literal>
;
[helper]
HexDigit
: Digit | ["A".."F", "a".."f"]
;
HexadecimalLiteral
: "0" ("x" | "X") HexDigit
: "0" ("x" | "X") HexDigit (HexDigit | "_")* HexDigit
;
[helper]
BinaryDigit
: ("0" | "1")
;
BinaryLiteral
: "0" ("b" | "B") BinaryDigit
: "0" ("b" | "B") BinaryDigit (BinaryDigit | "_")* BinaryDigit
CharacterLiteral
: <character as in Java>
;
/**
See [Basic types](basic-types.html)
*/
NoEscapeString
: <"""-quoted string>
;
RegularStringPart
: <any character other than backslash, quote, $ or newline>
;
ShortTemplateEntryStart
: "$"
;
EscapeSequence
: UnicodeEscapeSequence | RegularEscapeSequence
;
UnicodeEscapeSequence
: "\u" HexDigit{4}
;
RegularEscapeSequence
: "\" <any character other than newline>
;
/**
See [String templates](basic-types.html#string-templates)
*/
SEMI
: <semicolon or newline>
;
SimpleName
: <java identifier>
: "`" <java identifier> "`"
;
/**
See [Java interoperability](java-interop.html)
*/
LabelName
: SimpleName
;
/**
See [Returns and jumps](returns.html)
*/
/* Symbols:
[](){}<>
,
.
:
<= >= == != === !==
+ - * / %
=
+= -= *= /= %=
++ -- !
&& || -- may be just & and |
=>
..
?
?:
?.
*/
/* Keywords:
package
as
type
class
this
val
var
fun
extension
for
null
typeof
new
true
false
is
in
throw
return
break
continue
object
if
else
while
do
when
out
ref
try
Soft:
where -- in class, function and type headers
by -- in a class header (Delegation specifier)
get, set -- in a property definition
import
final
abstract
enum
open
annotation
override
private
public
internal
protected
catch
finally
*/