Package com.scriptbasic.lexer.elements
Class Decimal
java.lang.Object
com.scriptbasic.lexer.elements.AbstractElementAnalyzer
com.scriptbasic.lexer.elements.Decimal
- All Implemented Interfaces:
LexicalElementAnalyzer
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.scriptbasic.lexer.elements.AbstractElementAnalyzer
getReader
-
Constructor Details
-
Decimal
-
-
Method Details
-
read
Read a decimal number from the input. The next character following the number is left in the input stream to be available for the nextgetReader().get().A decimal number does NOT have
+or-sign, because that would cause trouble parsing expressions. It contains digits, optionally decimal point and exponent part following 'e' or 'E'.Some languages allow formats like
1.or.12. This parser does not allow such unreadable format. If there is a decimal point then there has to be a digit on each side.The returned lexeme will be double if there is decimal point or exponent part or both, even if the resulting value could be presented as long. Thus
1.12E2is a double number and not a long containing112.- Specified by:
readin interfaceLexicalElementAnalyzer- Specified by:
readin classAbstractElementAnalyzer- Returns:
- the lexical element containing the long or double value
-