openquest/openquest-lib/src/syntax/legacy/v1_0_1/quest_v2.pest

55 lines
799 B
Plaintext

// Quest 1.1c Syntax (PreQC + QC Syntax)
quest = {
"quest" ~ key_name ~ "begin"
~ (define | define_group | state)*
~ "end"
}
// Global substitution definitions
define = {
"define" ~ key ~ value
}
define_group = {
"define" ~ "group" ~
key ~ value ~ WHITE_SPACE
}
// Sections
state = {
"state" ~ key_name ~ "begin"
~ (when | when_with)*
~ "end"
}
function = {
"function" ~ "(" ~ value ~ ")"
~ "end"
}
when = {
"when" ~ value ~ "begin"
~ ANY*
~ "end"
}
when_with = {
"when" ~ value ~ "with" ~ value ~ "begin"
~ ANY*
~ "end"
}
// Properties
key_name = _{
((ASCII_ALPHA ~ "_") | ASCII_ALPHA)+
}
key = { ASCII_ALPHANUMERIC+ }
value = { ASCII_DIGIT+ }
COMMENT = _{ "--" ~ (!"\n" ~ ANY)* }
WHITESPACE = _{ " " | "\t" | NEWLINE }