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.
199 lines
9.4 KiB
199 lines
9.4 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>
|
|
|
|
segments = caseInsensitive<"segments">|caseInsensitive<"sections">
|
|
|caseInsensitive<"segment">|caseInsensitive<"section">
|
|
|caseInsensitive<"ticks">|caseInsensitive<"tick">
|
|
|caseInsensitive<"clock">
|
|
|
|
points = caseInsensitive<"points">|caseInsensitive<"pts">|caseInsensitive<"power">
|
|
|
|
experience = caseInsensitive<"experience">
|
|
xp = caseInsensitive<"XP">|caseInsensitive<"EXP">
|
|
ExperienceFull = experience points
|
|
XpResource = ExperienceFull|experience|xp
|
|
|
|
health = caseInsensitive<"health">|caseInsensitive<"life">|caseInsensitive<"hit">
|
|
HealthFull = health points
|
|
hp = caseInsensitive<"HP">
|
|
HpResource = HealthFull|health|hp
|
|
|
|
mind = caseInsensitive<"mind">|caseInsensitive<"magic">|caseInsensitive<"mana">
|
|
MindFull = mind points
|
|
mp = caseInsensitive<"MP">
|
|
MpResource = MindFull|mind|mp
|
|
|
|
item = caseInsensitive<"items">|caseInsensitive<"item">|caseInsensitive<"inventory">
|
|
ItemFull = item points
|
|
ip = caseInsensitive<"IP">
|
|
IpResource = ItemFull|item|ip
|
|
|
|
zero = caseInsensitive<"zero">
|
|
charge = points|caseInsensitive<"charge">|segments
|
|
ZeroFull = zero charge
|
|
zp = caseInsensitive<"ZP">|caseInsensitive<"ZC">
|
|
ZpResource = ZeroFull|zero|zp
|
|
|
|
blood = caseInsensitive<"blood">|caseInsensitive<"grave">
|
|
BloodFull = blood points
|
|
bp = caseInsensitive<"BP">
|
|
BpResource = BloodFull|blood|bp
|
|
|
|
turns = caseInsensitive<"turns">|caseInsensitive<"turn">|caseInsensitive<"actions">|caseInsensitive<"action">
|
|
TurnsFull = turns points
|
|
tp = caseInsensitive<"TP">|caseInsensitive<"AP">
|
|
TpResource = TurnsFull|turns|tp
|
|
|
|
MeteredResource (the name of a metered resource) = segments|XpResource|HpResource|MpResource
|
|
|IpResource|ZpResource|BpResource|TpResource
|
|
|
|
fabula = caseInsensitive<"Fabula">
|
|
ultima = caseInsensitive<"Ultima">
|
|
special = caseInsensitive<"Special">
|
|
fp = caseInsensitive<"FP">
|
|
up = caseInsensitive<"UP">
|
|
sp = caseInsensitive<"SP">
|
|
FabulaFull = fabula points
|
|
UltimaFull = ultima points
|
|
SpecialFull = special points
|
|
FabulaResource = FabulaFull|fabula|fp
|
|
UltimaResource = UltimaFull|ultima|up
|
|
SpecialResource = SpecialFull|special|sp
|
|
SpResource = FabulaResource|UltimaResource|SpecialResource
|
|
|
|
LevelResource = caseInsensitive<"Level">|caseInsensitive<"lvl">|caseInsensitive<"lv">
|
|
|
|
money = caseInsensitive<"Zenit">|caseInsensitive<"z">|caseInsensitive<"gold">|caseInsensitive<"gil">|caseInsensitive<"gp">|caseInsensitive<"g">
|
|
MoneyResource = money
|
|
materials = caseInsensitive<"materials">|caseInsensitive<"mats">|caseInsensitive<"m">
|
|
MaterialsFull = money space materials
|
|
MaterialsResource = MaterialsFull|materials
|
|
|
|
UnmeteredResource (the name of an unmetered resource) = SpResource|LevelResource|MaterialsResource|MoneyResource
|
|
Resource (the name of a resource) = MeteredResource|UnmeteredResource
|
|
|
|
plus = "+"
|
|
minus = "-"
|
|
deltaOperator = plus|minus
|
|
integer (an integer) = digit+
|
|
Delta (a delta) = deltaOperator integer
|
|
|
|
fireElement = caseInsensitive<"fire">|caseInsensitive<"flame">|caseInsensitive<"burn">
|
|
waterElement = caseInsensitive<"water">|caseInsensitive<"poison">|caseInsensitive<"acid">
|
|
lightningElement = caseInsensitive<"lightning">|caseInsensitive<"zap">|caseInsensitive<"electricity">
|
|
|caseInsensitive<"electrical">|caseInsensitive<"electric">|caseInsensitive<"elec">
|
|
|caseInsensitive<"shock">
|
|
earthElement = caseInsensitive<"earth">|caseInsensitive<"rock">|caseInsensitive<"dirt">
|
|
iceElement = caseInsensitive<"ice">|caseInsensitive<"cold">
|
|
windElement = caseInsensitive<"wind">|caseInsensitive<"air">|caseInsensitive<"gust">
|
|
lightElement = caseInsensitive<"light">|caseInsensitive<"holy">
|
|
darkElement = caseInsensitive<"dark">|caseInsensitive<"evil">
|
|
physicalElement = caseInsensitive<"physical">|caseInsensitive<"phys">
|
|
nonElement = caseInsensitive<"nonelemental">|caseInsensitive<"non-elemental">|caseInsensitive<"none">|caseInsensitive<"non">
|
|
healingElement = caseInsensitive<"healing">|caseInsensitive<"heal">|caseInsensitive<"cure">
|
|
elementalType (an element) = fireElement|waterElement
|
|
|lightningElement|earthElement
|
|
|iceElement|windElement
|
|
|lightElement|darkElement
|
|
|physicalElement|nonElement|healingElement
|
|
|
|
absorbAffinity = "??"|caseInsensitive<"drained">|caseInsensitive<"drain">|caseInsensitive<"absorbed">|caseInsensitive<"absorb">
|
|
immuneAffinity = "."|caseInsensitive<"immunity">|caseInsensitive<"blocked">|caseInsensitive<"immune">|caseInsensitive<"block">
|
|
resistAffinity = "..."|caseInsensitive<"resistance">|caseInsensitive<"resisted">|caseInsensitive<"resist">
|
|
vulnerableAffinity = "!!"|caseInsensitive<"vulnerable">|caseInsensitive<"weakness">|caseInsensitive<"weak">
|
|
normalAffinity = caseInsensitive<"normal">
|
|
affinity (an affinity indicator) = vulnerableAffinity|resistAffinity|immuneAffinity|absorbAffinity|normalAffinity
|
|
|
|
meteredSeparator = ~lineCommentStart ~blockCommentStart "/"
|
|
MeteredValue = integer MaxValue
|
|
MaxValue = meteredSeparator integer
|
|
|
|
DeltaOperation = Operands space Resource colon Delta affinity? elementalType?
|
|
DeltaOperationAlternate = Operands colon Delta affinity? Resource? elementalType?
|
|
DeltaOperationAlternate2 = Operands colon Resource Delta affinity? elementalType?
|
|
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
|
|
|
|
StatusOrItemCounterUnwrapped = "x"? integer
|
|
StatusOrItemCounterWrapped = "(" StatusOrItemCounterUnwrapped ")"
|
|
StatusOrItemCounter = StatusOrItemCounterWrapped | StatusOrItemCounterUnwrapped
|
|
StatusOrItemDeltaOperation = Operands colon deltaOperator identifier StatusOrItemCounter?
|
|
StatusOrItemCounterDeltaOperation = Operands colon identifier Delta
|
|
StatusOrItemCounterSetOperation = Operands colon identifier StatusOrItemCounter
|
|
|
|
notNewlineOrComment = ~newline ~lineCommentStart ~blockCommentStart any
|
|
textToEndOfLine = notNewlineOrComment+
|
|
|
|
SetTargetOperation = target (Operands | null)
|
|
SetSourceOperation = source (Operands | null)
|
|
|
|
dodge = caseInsensitive<"dodged">|caseInsensitive<"dodge">
|
|
miss = caseInsensitive<"missed">|caseInsensitive<"miss">
|
|
resist = caseInsensitive<"resisted">|caseInsensitive<"resist">
|
|
fail = caseInsensitive<"failed">|caseInsensitive<"fail">
|
|
block = caseInsensitive<"blocked">|caseInsensitive<"block">
|
|
parry = caseInsensitive<"parried">|caseInsensitive<"parry">
|
|
FailReason = dodge|miss|resist|fail|block|parry
|
|
FailOperation = Operands colon FailReason
|
|
PrintOperation = ">" textToEndOfLine
|
|
|
|
Operation = DeltaOperation | DeltaOperationAlternate | DeltaOperationAlternate2
|
|
| SetMeteredOperation | SetMeteredOperationAlternate | SetMeteredOperationAlternate2
|
|
| SetValueOperation | SetValueOperationAlternate | SetValueOperationAlternate2
|
|
| SetMaxOperation | SetMaxOperationAlternate | SetMaxOperationAlternate2
|
|
| ClearOperation | ClearOperationAlternate | ClearOperationAlternate2
|
|
| StatusOrItemDeltaOperation | StatusOrItemCounterDeltaOperation | StatusOrItemCounterSetOperation
|
|
| SetTargetOperation | SetSourceOperation | FailOperation | 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? colon textToEndOfLine
|
|
BlockEnd = endKeyword textToEndOfLine?
|
|
|
|
Block = BlockStart operationTerminator CodeSegment BlockEnd operationTerminatorOrEnd
|
|
} |