public override void Resolve(MmlResolveContext ctx, MmlDataType type)
        {
            // multiplication cannot be straightforward. Number * Length must be Length,
            // but the number must not be converted to a length e.g. "1" must not be
            // interpreted as %{$__base_count}. Actually Length * Length must be invalid.

            Left.Resolve (ctx, MmlDataType.Number);
            Right.Resolve (ctx, type);
            if (type == MmlDataType.Length)
                ResolvedValue = new MmlLength ((int) (Left.DoubleValue * Right.DoubleValue)) { IsValueByStep = true };
            else
                ResolvedValue = Left.DoubleValue * Right.DoubleValue;
        }
 public override void Resolve(MmlResolveContext ctx, MmlDataType type)
 {
     Left.Resolve (ctx, type);
     Right.Resolve (ctx, type);
     if (type == MmlDataType.Length)
         ResolvedValue = new MmlLength ((int) (Left.DoubleValue + Right.DoubleValue)) { IsValueByStep = true };
     else
         ResolvedValue = Left.DoubleValue + Right.DoubleValue;
 }
示例#3
0
void case_45()
#line 358 "src/mml_parser.jay"
{
		var n = (MmlToken) yyVals[0+yyTop];
		var l = new MmlLength (-1 * (int) (double) MmlValueExpr.GetTypedValue (n.Value, MmlDataType.Number)) { IsValueByStep = true };
		yyVal = new MmlConstantExpr (MmlDataType.Length, l);
	}