66 lines
828 B
Plaintext
66 lines
828 B
Plaintext
/**
|
|
# Syntax
|
|
|
|
Relevant pages: [Packages](packages.html)
|
|
*/
|
|
|
|
|
|
[start]
|
|
kotlinFile
|
|
: preamble toplevelObject*
|
|
;
|
|
|
|
[start]
|
|
script
|
|
: preamble expression*
|
|
;
|
|
|
|
preamble
|
|
: fileAnnotations? packageHeader? import*
|
|
;
|
|
|
|
fileAnnotations
|
|
: fileAnnotation*
|
|
;
|
|
|
|
fileAnnotation
|
|
: "[" "file" ":" annotationEntry+ "]"
|
|
;
|
|
|
|
packageHeader
|
|
: modifiers "package" SimpleName{"."} SEMI?
|
|
;
|
|
|
|
import
|
|
: "import" SimpleName{"."} ("." "*" | "as" SimpleName)? SEMI?
|
|
;
|
|
|
|
/**
|
|
See [Imports](packages.html#imports)
|
|
*/
|
|
|
|
toplevelObject
|
|
: package
|
|
: class
|
|
: object
|
|
: function
|
|
: property
|
|
: typedef
|
|
;
|
|
|
|
package
|
|
: "package" SimpleName{"."} "{"
|
|
import*
|
|
toplevelObject*
|
|
"}"
|
|
;
|
|
|
|
/**
|
|
See [Packages](packages.html)
|
|
*/
|
|
|
|
[undocumented]
|
|
typedef
|
|
: modifiers "type" SimpleName (typeParameters typeConstraints)? "=" type
|
|
;
|