Skip to content
Permalink
Browse files

Multiple "dots" in numbers should create multiple floating point numbers

>> 0.17583681.41125407852.0 // HoldForm // FullForm

HoldForm(Times(Times(0.17583681, 0.41125407852), 0.0))
  • Loading branch information
axkr committed Dec 14, 2019
1 parent db9943b commit 189f03add883fcba832dc6b62140e3ad49e51bd6
@@ -599,6 +599,12 @@ protected void getNextToken() throws SyntaxError {
fToken = TT_DIGIT;
return;
}
if (fCurrentChar == '.') {
if (Character.isDigit(charAtPosition())) {
fToken = TT_DIGIT;
return;
}
}
if (fCurrentChar == '(') {
if (isValidPosition()) {
if (charAtPosition() == '*') {
@@ -697,23 +703,23 @@ protected void getNextToken() throws SyntaxError {
fToken = TT_OPERATOR;
return;
}
if (fCurrentChar == '.') {
if (isValidPosition()) {
if (Character.isDigit(fCurrentChar)) {
// don't increment fCurrentPosition (see
// getNumberString())
fToken = TT_DIGIT; // floating-point number
break;
}
}
break;
} else {
if (Characters.CharacterNamesMap.containsKey(String.valueOf(fCurrentChar))) {
fToken = TT_IDENTIFIER;
return;
}
throwSyntaxError("unexpected character: '" + fCurrentChar + "'");
// if (fCurrentChar == '.') {
// if (isValidPosition()) {
// if (Character.isDigit(fCurrentChar)) {
// // don't increment fCurrentPosition (see
// // getNumberString())
// fToken = TT_DIGIT; // floating-point number
// break;
// }
// }
// break;
// } else {
if (Characters.CharacterNamesMap.containsKey(String.valueOf(fCurrentChar))) {
fToken = TT_IDENTIFIER;
return;
}
throwSyntaxError("unexpected character: '" + fCurrentChar + "'");
// }
}

if (fToken == TT_EOF) {
@@ -816,7 +822,8 @@ protected void getNextToken() throws SyntaxError {
numFormat = Integer.parseInt(
new String(fInputString, startPosition, fCurrentPosition - startPosition - 1));
if (numFormat <= 0 || numFormat > 36) {
throwSyntaxError("Base " + numFormat + "^^... is invalid. Only bases between 1 and 36 are allowed");
throwSyntaxError(
"Base " + numFormat + "^^... is invalid. Only bases between 1 and 36 are allowed");
}
fCurrentPosition++;
startPosition = fCurrentPosition;
@@ -4809,6 +4809,9 @@ public void testDo() {
}

public void testDot() {
check("0.17583681.41125407852.0 // HoldForm // FullForm", //
"HoldForm(Times(Times(0.17583681, 0.41125407852), 0.0))");

check("Dot({a,b,c})", //
"{a,b,c}");
check("Dot({{1, 2}, {3, 4}, {5, 6}})", //

0 comments on commit 189f03a

Please sign in to comment.
You can’t perform that action at this time.