public class Decimal extends AbstractElementAnalyzer
Constructor and Description |
---|
Decimal() |
Modifier and Type | Method and Description |
---|---|
LexicalElement |
read()
Read a decimal number from the input.
|
getReader, setReader
public LexicalElement read() throws LexicalException
getReader().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.12E2
is a double number and not a long containing
112
.
read
in interface LexicalElementAnalyzer
read
in class AbstractElementAnalyzer
LexicalException
Copyright © 2013 Verhas and Verhas Software Craftsmen. All Rights Reserved.