From 3324b2f0f035490940b1a9d7cf5dc210776f6d87 Mon Sep 17 00:00:00 2001 From: Alexei Sheplyakov Date: Sun, 14 Sep 2008 06:01:53 +0400 Subject: [PATCH] Parser can parse (some) floating point numbers now. --- ginac/parser/lexer.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ginac/parser/lexer.cpp b/ginac/parser/lexer.cpp index d8c49b8c..7c3e6c84 100644 --- a/ginac/parser/lexer.cpp +++ b/ginac/parser/lexer.cpp @@ -35,13 +35,23 @@ int lexer::gettok() return token_type::identifier; } - // Number: [0-9.]+ + // Number: [0-9]+([.][0-9]*(eE[+-][0-9]+)*)* if (isdigit(c) || c == '.') { str = ""; do { str += c; c = input->get(); } while (isdigit(c) || c == '.'); + if (c == 'E' || c == 'e') { + str += 'E'; + c = input->get(); + if (isdigit(c)) + str += '+'; + do { + str += c; + c = input->get(); + } while (isdigit(c)); + } return token_type::number; } -- 2.44.0