git://www.ginac.de
/
ginac.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1261c54
)
Parser can parse (some) floating point numbers now.
author
Alexei Sheplyakov
<varg@theor.jinr.ru>
Sun, 14 Sep 2008 02:01:53 +0000
(06:01 +0400)
committer
Alexei Sheplyakov
<varg@theor.jinr.ru>
Fri, 19 Sep 2008 09:15:50 +0000
(13:15 +0400)
ginac/parser/lexer.cpp
patch
|
blob
|
history
diff --git
a/ginac/parser/lexer.cpp
b/ginac/parser/lexer.cpp
index d8c49b8cf4b35da972b19074b506aa0380c3725e..7c3e6c84aecf5ac6d62db29452de77f981791a95 100644
(file)
--- a/
ginac/parser/lexer.cpp
+++ b/
ginac/parser/lexer.cpp
@@
-35,13
+35,23
@@
int lexer::gettok()
return token_type::identifier;
}
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 (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;
}
return token_type::number;
}