Fix floats and doubles
This commit is contained in:
parent
84192c69db
commit
842a2b8f0c
4 changed files with 11 additions and 7 deletions
|
@ -50,6 +50,7 @@ enum TagType {
|
|||
bool isQuoted = false;
|
||||
bool isNumeric = true; // Assume true until proven otherwise
|
||||
bool isAlpha = true; // Assume true until proven otherwise
|
||||
bool hasDecimalPoint = false;
|
||||
StringBuffer buffer = StringBuffer();
|
||||
|
||||
while (reader.canRead) {
|
||||
|
@ -102,10 +103,13 @@ enum TagType {
|
|||
|
||||
buffer.write(current);
|
||||
|
||||
// Check if current character is a digit or numeric suffix
|
||||
if (!RegExp(r'^[0-9]$').hasMatch(current) &&
|
||||
!RegExp(r'^[sSbBiIlLfFdD]$').hasMatch(current)) {
|
||||
isNumeric = false; // Not purely numeric with possible suffix
|
||||
// Updated check to allow digits, decimal points, and numeric suffixes
|
||||
if (!RegExp(r'^[0-9]$').hasMatch(current)) {
|
||||
if (current == '.' && !hasDecimalPoint) {
|
||||
hasDecimalPoint = true; // Allow only one decimal point
|
||||
} else if (!RegExp(r'^[sSbBiIlLfFdD]$').hasMatch(current)) {
|
||||
isNumeric = false; // Not purely numeric or allowed decimal/suffix
|
||||
}
|
||||
}
|
||||
|
||||
// Check if current character is purely alphabetical
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue