public static void Compile(ByteCodeCompiler bcc, ParserContext parser, ByteBuffer buffer, NegativeSign negativeSign, bool outputUsed) { if (!outputUsed) { throw new ParserException(negativeSign, "This expression does nothing."); } bcc.CompileExpression(parser, buffer, negativeSign.Root, true); buffer.Add(negativeSign.FirstToken, OpCode.NEGATIVE_SIGN); }
protected abstract void TranslateNegativeSign(List <string> output, NegativeSign negativeSign);
protected override void TranslateNegativeSign(List <string> output, NegativeSign negativeSign) { output.Add("-("); this.TranslateExpression(output, negativeSign.Root); output.Add(")"); }