Exemple #1
0
 public static NeuNumberLiteralExpression ParseNumberLiteralExpression(
     this NeuParser parser,
     ISourceLocation start,
     NeuNumberLiteral lit)
 {
     return(new NeuNumberLiteralExpression(
                children: new Node[] { lit },
                start: start,
                end: parser.Tokenizer.GetLocation()));
 }
    public static NeuOperation Execute(
        this NeuInterpreter interpreter,
        NeuNumberLiteral numberLiteral)
    {
        switch (numberLiteral)
        {
        case NeuFloatLiteral floatLiteral:

            return(new NeuFloat(floatLiteral.Value));

        ///

        case NeuIntegerLiteral integerLiteral:

            return(new NeuInteger(integerLiteral.Value));

        ///

        default:

            throw new Exception();
        }
    }