You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
4.6 KiB
99 lines
4.6 KiB
FabulaDSL {
|
|
CodeSegment = (Block | CompleteOperation | EmptyLines)*
|
|
|
|
identifier (an identifier) = identifierStart identifierContinue+
|
|
identifierStart = "_" | "$" | letter
|
|
identifierContinue = identifierStart | digit
|
|
|
|
newline = "\n"
|
|
EmptyLines = operationTerminator+
|
|
|
|
nonNewlineSpace = ~newline space
|
|
spaces := (nonNewlineSpace|blockComment)*
|
|
|
|
target = "@"
|
|
source = "&"
|
|
null = "-"
|
|
colon = ":"
|
|
|
|
operand (an operand) = identifier | target | source
|
|
comma = ","
|
|
Operands (operands) = nonemptyListOf<operand, comma>
|
|
|
|
experienceResource = caseInsensitive<"XP">|caseInsensitive<"EXP">
|
|
meteredResource (the name of a metered resource) = caseInsensitive<"HP">|caseInsensitive<"MP">|caseInsensitive<"IP">|caseInsensitive<"ZP">|caseInsensitive<"BP">|caseInsensitive<"Turns">|experienceResource
|
|
spResource = caseInsensitive<"FP">|caseInsensitive<"UP">|caseInsensitive<"SP">
|
|
moneyResource = caseInsensitive<"Zenit">|caseInsensitive<"z">
|
|
materialsResource = caseInsensitive<"materials">|caseInsensitive<"mats">|caseInsensitive<"m">
|
|
levelResource = caseInsensitive<"Level">|caseInsensitive<"lv">
|
|
unmeteredResource (the name of an unmetered resource) = spResource|moneyResource|materialsResource|levelResource|caseInsensitive<"order">
|
|
resource (the name of a resource) = meteredResource|unmeteredResource
|
|
|
|
deltaOperator = "+"|"-"
|
|
integer (an integer) = digit+
|
|
Delta (a delta) = deltaOperator integer
|
|
|
|
element = caseInsensitive<"fire">|caseInsensitive<"water">|caseInsensitive<"poison">|caseInsensitive<"lightning">|caseInsensitive<"earth">|caseInsensitive<"ice">|caseInsensitive<"wind">|caseInsensitive<"light">|caseInsensitive<"dark">|caseInsensitive<"physical">
|
|
affinity = "??"|"..."|"."|"!!"
|
|
|
|
meteredSeparator = ~lineCommentStart ~blockCommentStart "/"
|
|
MeteredValue = integer MaxValue
|
|
MaxValue = meteredSeparator integer
|
|
|
|
DeltaOperation = Operands space resource colon Delta affinity? element?
|
|
DeltaOperationAlternate = Operands colon Delta affinity? resource? element?
|
|
DeltaOperationAlternate2 = Operands colon resource Delta affinity? element?
|
|
SetMeteredOperation = Operands space meteredResource colon MeteredValue
|
|
SetMeteredOperationAlternate = Operands colon MeteredValue meteredResource
|
|
SetMeteredOperationAlternate2 = Operands colon meteredResource MeteredValue
|
|
SetValueOperation = Operands space resource colon integer
|
|
SetValueOperationAlternate = Operands colon integer resource
|
|
SetValueOperationAlternate2 = Operands colon resource integer
|
|
SetMaxOperation = Operands space meteredResource colon MaxValue
|
|
SetMaxOperationAlternate = Operands colon MaxValue meteredResource
|
|
SetMaxOperationAlternate2 = Operands colon meteredResource MaxValue
|
|
ClearOperation = Operands space resource colon null
|
|
ClearOperationAlternate = Operands colon null resource
|
|
ClearOperationAlternate2 = Operands colon resource null
|
|
|
|
StatusDeltaOperation = Operands colon deltaOperator identifier
|
|
|
|
notNewlineOrComment = ~newline ~lineCommentStart ~blockCommentStart any
|
|
textToEndOfLine = notNewlineOrComment+
|
|
|
|
SetTargetOperation = target (Operands | null)
|
|
SetSourceOperation = source (Operands | null)
|
|
|
|
PrintOperation = ">" textToEndOfLine
|
|
|
|
Operation = DeltaOperation | DeltaOperationAlternate | DeltaOperationAlternate2
|
|
| SetMeteredOperation | SetMeteredOperationAlternate | SetMeteredOperationAlternate2
|
|
| SetValueOperation | SetValueOperationAlternate | SetValueOperationAlternate2
|
|
| SetMaxOperation | SetMaxOperationAlternate | SetMaxOperationAlternate2
|
|
| ClearOperation | ClearOperationAlternate | ClearOperationAlternate2
|
|
| StatusDeltaOperation
|
|
| SetTargetOperation | SetSourceOperation | PrintOperation
|
|
|
|
silentOperator = "~"
|
|
|
|
lineCommentStart = "//"
|
|
lineComment = lineCommentStart textToEndOfLine (newline | end)
|
|
|
|
blockCommentStart = "/*"
|
|
blockCommentEnd = "*/"
|
|
|
|
blockCommentCharacter = ~blockCommentEnd any
|
|
blockCommentText = blockCommentCharacter*
|
|
blockComment = blockCommentStart blockCommentText blockCommentEnd
|
|
|
|
operationTerminator = newline | lineComment
|
|
operationTerminatorOrEnd = operationTerminator | end
|
|
CompleteOperation = silentOperator? Operation operationTerminatorOrEnd
|
|
|
|
beginKeyword = caseInsensitive<"begin">
|
|
endKeyword = caseInsensitive<"end">
|
|
BlockStart = silentOperator? beginKeyword SetSourceOperation? SetTargetOperation? textToEndOfLine
|
|
BlockEnd = endKeyword textToEndOfLine?
|
|
|
|
Block = BlockStart operationTerminator CodeSegment BlockEnd operationTerminatorOrEnd
|
|
} |