|
|
@ -203,9 +203,6 @@ interpreter.addAttribute<NumberSign>("sign", { |
|
|
|
minus(_: TerminalNode): NumberSign.Negative { |
|
|
|
minus(_: TerminalNode): NumberSign.Negative { |
|
|
|
return NumberSign.Negative |
|
|
|
return NumberSign.Negative |
|
|
|
}, |
|
|
|
}, |
|
|
|
StatusOrItemCounterDeltaOperation(operands: NonterminalNode, colon: NonterminalNode, identifier: NonterminalNode, delta: NonterminalNode): NumberSign { |
|
|
|
|
|
|
|
return (delta as InterpreterNode).sign |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
_iter(): never { |
|
|
|
_iter(): never { |
|
|
|
throw Error(`No idea what to say ${this.ctorName} iteration node's number sign is`) |
|
|
|
throw Error(`No idea what to say ${this.ctorName} iteration node's number sign is`) |
|
|
|
}, |
|
|
|
}, |
|
|
@ -282,10 +279,16 @@ interpreter.addAttribute<number>("numberValue", { |
|
|
|
} |
|
|
|
} |
|
|
|
return (counter.child(0)).numberValue |
|
|
|
return (counter.child(0)).numberValue |
|
|
|
}, |
|
|
|
}, |
|
|
|
StatusOrItemCounterDeltaOperation(operands: NonterminalNode, colon: NonterminalNode, identifier: NonterminalNode, delta: NonterminalNode): number { |
|
|
|
StatusOrItemCounterDeltaOperation(operands: NonterminalNode, wordSep: NonterminalNode, identifier: NonterminalNode, sep: NonterminalNode, delta: NonterminalNode): number { |
|
|
|
|
|
|
|
return (delta as InterpreterNode).numberValue |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
StatusOrItemCounterDeltaOperationAlternate(operands: NonterminalNode, colon: NonterminalNode, delta: NonterminalNode, _identifier: NonterminalNode): number { |
|
|
|
|
|
|
|
return (delta as InterpreterNode).numberValue |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
StatusOrItemCounterDeltaOperationAlternate2(operands: NonterminalNode, colon: NonterminalNode, identifier: NonterminalNode, delta: NonterminalNode): number { |
|
|
|
return (delta as InterpreterNode).numberValue |
|
|
|
return (delta as InterpreterNode).numberValue |
|
|
|
}, |
|
|
|
}, |
|
|
|
StatusOrItemCounterSetOperation(operands: NonterminalNode, colon: NonterminalNode, identifier: NonterminalNode, counter: NonterminalNode): number { |
|
|
|
StatusOrItemCounterSetOperation(operands: NonterminalNode, wordSep: NonterminalNode, identifier: NonterminalNode, sep: NonterminalNode, counter: NonterminalNode): number { |
|
|
|
return (counter as InterpreterNode).numberValue |
|
|
|
return (counter as InterpreterNode).numberValue |
|
|
|
}, |
|
|
|
}, |
|
|
|
_iter(): never { |
|
|
|
_iter(): never { |
|
|
@ -324,10 +327,16 @@ interpreter.addAttribute<string>("identifier", { |
|
|
|
StatusOrItemRemoveOperation(_arg0: NonterminalNode, _arg1: NonterminalNode, _arg2: NonterminalNode, identifier: NonterminalNode): string { |
|
|
|
StatusOrItemRemoveOperation(_arg0: NonterminalNode, _arg1: NonterminalNode, _arg2: NonterminalNode, identifier: NonterminalNode): string { |
|
|
|
return (identifier as InterpreterNode).identifier; |
|
|
|
return (identifier as InterpreterNode).identifier; |
|
|
|
}, |
|
|
|
}, |
|
|
|
StatusOrItemCounterDeltaOperation(operands: NonterminalNode, colon: NonterminalNode, identifier: NonterminalNode, _delta: NonterminalNode): string { |
|
|
|
StatusOrItemCounterDeltaOperation(operands: NonterminalNode, wordSep: NonterminalNode, identifier: NonterminalNode, sep: NonterminalNode, _delta: NonterminalNode): string { |
|
|
|
|
|
|
|
return (identifier as InterpreterNode).identifier |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
StatusOrItemCounterDeltaOperationAlternate(operands: NonterminalNode, _sep: NonterminalNode, _delta: NonterminalNode, identifier: NonterminalNode): string { |
|
|
|
return (identifier as InterpreterNode).identifier |
|
|
|
return (identifier as InterpreterNode).identifier |
|
|
|
}, |
|
|
|
}, |
|
|
|
StatusOrItemCounterSetOperation(operands: NonterminalNode, colon: NonterminalNode, identifier: NonterminalNode, _counter: NonterminalNode): string { |
|
|
|
StatusOrItemCounterDeltaOperationAlternate2(operands: NonterminalNode, _sep: NonterminalNode, identifier: NonterminalNode, _delta: NonterminalNode): string { |
|
|
|
|
|
|
|
return (identifier as InterpreterNode).identifier |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
StatusOrItemCounterSetOperation(operands: NonterminalNode, wordSep: NonterminalNode, identifier: NonterminalNode, sep: NonterminalNode, _delta: NonterminalNode): string { |
|
|
|
return (identifier as InterpreterNode).identifier |
|
|
|
return (identifier as InterpreterNode).identifier |
|
|
|
}, |
|
|
|
}, |
|
|
|
_iter(): never { |
|
|
|
_iter(): never { |
|
|
@ -602,10 +611,16 @@ interpreter.addAttribute<Operands>("operands", { |
|
|
|
SetValueOperationAlternate2(operands: NonterminalNode, _colon: NonterminalNode, _resource: NonterminalNode, _value: NonterminalNode): Operands { |
|
|
|
SetValueOperationAlternate2(operands: NonterminalNode, _colon: NonterminalNode, _resource: NonterminalNode, _value: NonterminalNode): Operands { |
|
|
|
return (operands as InterpreterNode).operands |
|
|
|
return (operands as InterpreterNode).operands |
|
|
|
}, |
|
|
|
}, |
|
|
|
StatusOrItemCounterDeltaOperation(operands: NonterminalNode, _colon: NonterminalNode, _statusOrItem: NonterminalNode, _delta: NonterminalNode): Operands { |
|
|
|
StatusOrItemCounterDeltaOperation(operands: NonterminalNode, _wordSep: NonterminalNode, _statusOrItem: NonterminalNode, _sep: NonterminalNode, _delta: NonterminalNode): Operands { |
|
|
|
|
|
|
|
return (operands as InterpreterNode).operands |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
StatusOrItemCounterDeltaOperationAlternate(operands: NonterminalNode, _sep: NonterminalNode, _delta: NonterminalNode, _statusOrItem: NonterminalNode): Operands { |
|
|
|
return (operands as InterpreterNode).operands |
|
|
|
return (operands as InterpreterNode).operands |
|
|
|
}, |
|
|
|
}, |
|
|
|
StatusOrItemCounterSetOperation(operands: NonterminalNode, _colon: NonterminalNode, _statusOrItem: NonterminalNode, _value: NonterminalNode): Operands { |
|
|
|
StatusOrItemCounterDeltaOperationAlternate2(operands: NonterminalNode, _sep: NonterminalNode, _statusOrItem: NonterminalNode, _delta: NonterminalNode): Operands { |
|
|
|
|
|
|
|
return (operands as InterpreterNode).operands |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
StatusOrItemCounterSetOperation(operands: NonterminalNode, _wordSep: NonterminalNode, _statusOrItem: NonterminalNode, _sep: NonterminalNode, _value: NonterminalNode): Operands { |
|
|
|
return (operands as InterpreterNode).operands |
|
|
|
return (operands as InterpreterNode).operands |
|
|
|
}, |
|
|
|
}, |
|
|
|
StatusOrItemAddOperation(operands: NonterminalNode, _colon: NonterminalNode, _delta: NonterminalNode, _statusOrItem: NonterminalNode, _counter: IterationNode): Operands { |
|
|
|
StatusOrItemAddOperation(operands: NonterminalNode, _colon: NonterminalNode, _delta: NonterminalNode, _statusOrItem: NonterminalNode, _counter: IterationNode): Operands { |
|
|
@ -737,10 +752,10 @@ interpreter.addAttribute<number>("currentValue", { |
|
|
|
SetMeteredOperationAlternate2(operands: NonterminalNode, colon: NonterminalNode, resource: NonterminalNode, value: NonterminalNode): number { |
|
|
|
SetMeteredOperationAlternate2(operands: NonterminalNode, colon: NonterminalNode, resource: NonterminalNode, value: NonterminalNode): number { |
|
|
|
return (value as InterpreterNode).currentValue; |
|
|
|
return (value as InterpreterNode).currentValue; |
|
|
|
}, |
|
|
|
}, |
|
|
|
StatusOrItemAddOperation(operands: NonterminalNode, colon: NonterminalNode, deltaOperator: NonterminalNode, identifier: NonterminalNode, counter: NonterminalNode): number { |
|
|
|
StatusOrItemAddOperation(operands: NonterminalNode, sep: NonterminalNode, deltaOperator: NonterminalNode, identifier: NonterminalNode, counter: NonterminalNode): number { |
|
|
|
return (counter as InterpreterNode).numberValue |
|
|
|
return (counter as InterpreterNode).numberValue |
|
|
|
}, |
|
|
|
}, |
|
|
|
StatusOrItemCounterSetOperation(operands: NonterminalNode, colon: NonterminalNode, identifier: NonterminalNode, counter: NonterminalNode): number { |
|
|
|
StatusOrItemCounterSetOperation(operands: NonterminalNode, wordSep: NonterminalNode, identifier: NonterminalNode, sep: NonterminalNode, counter: NonterminalNode): number { |
|
|
|
return (counter as InterpreterNode).numberValue |
|
|
|
return (counter as InterpreterNode).numberValue |
|
|
|
}, |
|
|
|
}, |
|
|
|
_iter(): never { |
|
|
|
_iter(): never { |
|
|
@ -996,6 +1011,22 @@ function EvaluateClear(node: EvaluationNode): EvaluationContext { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function EvaluateStatusCounterDelta(node: EvaluationNode): EvaluationContext { |
|
|
|
|
|
|
|
const ctx = node.args.ctx |
|
|
|
|
|
|
|
const operands = evaluateOperands(node.operands, ctx) |
|
|
|
|
|
|
|
const statusOrItemId = node.identifier |
|
|
|
|
|
|
|
const stacks = node.numberValue |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
...ctx, |
|
|
|
|
|
|
|
game: { |
|
|
|
|
|
|
|
...ctx.game, |
|
|
|
|
|
|
|
characters: ctx.game.characters.map((c) => |
|
|
|
|
|
|
|
operands.has(c.id) ? CharacterStatuses.applyStatusDelta(c, statusOrItemId, stacks) : c), |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
interpreter.addOperation<EvaluationContext>("evaluate(ctx)", { |
|
|
|
interpreter.addOperation<EvaluationContext>("evaluate(ctx)", { |
|
|
|
CodeSegment(items: IterationNode): EvaluationContext { |
|
|
|
CodeSegment(items: IterationNode): EvaluationContext { |
|
|
|
let ctx = (this as EvaluationNode).args.ctx |
|
|
|
let ctx = (this as EvaluationNode).args.ctx |
|
|
@ -1094,6 +1125,16 @@ interpreter.addOperation<EvaluationContext>("evaluate(ctx)", { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
StatusOrItemCounterDeltaOperation(_arg0: NonterminalNode, _arg1: NonterminalNode, _arg2: NonterminalNode, _arg3: NonterminalNode, _arg4: NonterminalNode): EvaluationContext { |
|
|
|
|
|
|
|
return EvaluateStatusCounterDelta(this as EvaluationNode) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
StatusOrItemCounterDeltaOperationAlternate(_arg0: NonterminalNode, _arg1: NonterminalNode, _arg2: NonterminalNode, _arg3: NonterminalNode): EvaluationContext { |
|
|
|
|
|
|
|
return EvaluateStatusCounterDelta(this as EvaluationNode) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
StatusOrItemCounterDeltaOperationAlternate2(_arg0: NonterminalNode, _arg1: NonterminalNode, _arg2: NonterminalNode, _arg3: NonterminalNode): EvaluationContext { |
|
|
|
|
|
|
|
return EvaluateStatusCounterDelta(this as EvaluationNode) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
ClearOperation(_arg0: NonterminalNode, _arg1: NonterminalNode, _arg2: NonterminalNode, _arg3: NonterminalNode, _arg4: NonterminalNode): EvaluationContext { |
|
|
|
ClearOperation(_arg0: NonterminalNode, _arg1: NonterminalNode, _arg2: NonterminalNode, _arg3: NonterminalNode, _arg4: NonterminalNode): EvaluationContext { |
|
|
|
return EvaluateClear(this as EvaluationNode); |
|
|
|
return EvaluateClear(this as EvaluationNode); |
|
|
|
}, |
|
|
|
}, |
|
|
|