35 lines
1.1 KiB
EBNF
35 lines
1.1 KiB
EBNF
|
|
|
|
# (*
|
|
# Trixy is fully whitespace independent, this means that you can
|
|
# interleave whitespace in the definitions.
|
|
# The same applies to comments:
|
|
# - Line comments (`// \n`) and
|
|
# - Block comments (`/* */`).
|
|
# *)
|
|
|
|
CommandSpec = {Function | Namespace | Enumeration | Structure } ;
|
|
|
|
Function = {DocComment} "fn" Identifier "(" [NamedType {"," NamedType }] ")" [ "->" Type ] ";" ;
|
|
Namespace = {DocComment} "mod" Identifier "{" {Function | Namespace | Enumeration | Structure} "}" ;
|
|
Structure = {DocComment} "struct" Identifier "{" [DocNamedType {"," DocNamedType } [","]] "}";
|
|
Enumeration = {DocComment} "enum" Identifier "{" [DocIdentifier {"," DocIdentifier} [","]] "}";
|
|
|
|
Type = Identifier ["<" Type {"," Type} ">"];
|
|
|
|
Identifier = (CHARACTER | "_") { NUMBER | CHARACTER | "_" } ;
|
|
DocIdentifier = {DocComment} (CHARACTER | "_") { NUMBER | CHARACTER | "_" } ;
|
|
|
|
NamedType = Identifier ":" Type;
|
|
DocNamedType = {DocComment} Identifier ":" Type;
|
|
|
|
|
|
DocComment = "///" {ANYTHING} LineEnding;
|
|
|
|
Comment = "//" [ NOT ("/" {ANYTHING} LineEnding) | "//"] {ANYTHING} LineEnding;
|
|
LineEnding = "\\n" | "\\r" | "\\r\\n";
|
|
|
|
# (*
|
|
# vim: ft=ebnf
|
|
# *)
|