From 4bea07107120af050d98410a2a4b3103e21f6144 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 25 Feb 2022 21:41:10 +0100 Subject: [PATCH] mini: parse numbers --- repl/src/parse.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/repl/src/parse.ts b/repl/src/parse.ts index c365ccad..37a5c4dd 100644 --- a/repl/src/parse.ts +++ b/repl/src/parse.ts @@ -101,10 +101,11 @@ export function patternifyAST(ast: any): any { return ast.source_; } const { start, end } = ast.location_; + const value = !isNaN(Number(ast.source_)) ? Number(ast.source_) : ast.source_; // return ast.source_; // the following line expects the shapeshifter to wrap this in withLocationOffset // because location_ is only relative to the mini string, but we need it relative to whole code - return pure(ast.source_).withLocation({ start, end }); + return pure(value).withLocation({ start, end }); } return patternifyAST(ast.source_); case 'stretch':