2023-12-18 17:04:21 +00:00
|
|
|
# (*
|
|
|
|
# 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 (`/* */`).
|
|
|
|
# *)
|
|
|
|
|
2023-12-22 19:32:43 +00:00
|
|
|
CommandSpec = {Function | Namespace | Enumeration | Structure } ;
|
|
|
|
|
|
|
|
Function = {DocComment} "fn" Identifier "(" [NamedType {"," NamedType }] ")" [ "->" Type ] ";" ;
|
|
|
|
Namespace = {DocComment} "nasp" Identifier "{" {Function | Namespace | Enumeration | Structure} "}" ;
|
|
|
|
Structure = {DocComment} "struct" Identifier "{" [DocNamedType {"," DocNamedType } [","]] "}" ";";
|
|
|
|
Enumeration = {DocComment} "enum" Identifier "{" [DocIdentifier {"," DocIdentifier} [","]] "}" ";";
|
|
|
|
|
|
|
|
Type = Identifier ["<" Type {"," Type} ">"];
|
|
|
|
|
2023-12-19 16:27:13 +00:00
|
|
|
Identifier = (CHARACTER | "_") { NUMBER | CHARACTER | "_" } ;
|
2023-12-22 19:32:43 +00:00
|
|
|
DocIdentifier = {DocComment} (CHARACTER | "_") { NUMBER | CHARACTER | "_" } ;
|
|
|
|
|
2023-12-18 19:50:58 +00:00
|
|
|
NamedType = Identifier ":" Type;
|
2023-12-22 19:32:43 +00:00
|
|
|
DocNamedType = {DocComment} Identifier ":" Type;
|
|
|
|
|
|
|
|
|
|
|
|
DocComment = "///" {ANYTHING} LineEnding;
|
|
|
|
|
|
|
|
Comment = "//" [ NOT ("/" {ANYTHING} LineEnding) | "//"] {ANYTHING} LineEnding;
|
|
|
|
LineEnding = "\\n" | "\\r" | "\\r\\n";
|
2023-12-18 17:04:21 +00:00
|
|
|
|
|
|
|
# (*
|
|
|
|
# vim: ft=ebnf
|
|
|
|
# *)
|