SourceChar
objects.-
Method Summary
Modifier and TypeMethodDescriptionstatic SourceChar
eof()
Returns EOF.static SourceChar
eof
(Collection<SourceChar> children) Returns a newSourceChar
object representing EOF with the specified child characters.static SourceChar
of
(char c, int column, int line) Returns a newSourceChar
object that has no child characters (that is a leaf character).static SourceChar
of
(SourceChar first, SourceChar second, char c) Returns a newSourceChar
object that has the specified child characters.static SourceChar
of
(SourceChar first, SourceChar second, SourceChar third, char c) Returns a newSourceChar
object that has the specified child characters.static SourceChar
of
(Collection<SourceChar> children, SourceChar c) Returns a newSourceChar
object that has the specified child characters.
-
Method Details
-
eof
Returns EOF.- Returns:
- EOF (that is
SourceChar.STATIC_EOF
).
-
eof
Returns a newSourceChar
object representing EOF with the specified child characters.In some cases, EOF can have its child characters. For example, the EOF that follows a backslash followed by a newline character has to have them as its child characters, as follows:
int a = 0;\[NL] [EOF]
where
[NL]
and[EOF]
represent a newline character and EOF, respectively.The object this method returns behaves as follows:
- The
SourceChar.isEof()
method returnstrue
- The
SourceChar.toChar()
method throw anIllegalStateException
- The
SourceChar.getSpan()
method returns the span of the specified child characters - The
SourceChar.getChildren()
method returns the specified child characters
Note that the EOF this method returns is an immutable object.
- Parameters:
children
- The non-empty collection containing the child characters.- Returns:
- The new EOF.
- Throws:
IllegalArgumentException
- If thechildren
is empty.
- The
-
of
Returns a newSourceChar
object that has the specified child characters.Typically, this method is to create the character that follows a backslash followed by a newline character.
Note that the character this method returns is an immutable object.
- Parameters:
children
- The non-empty collection containing the child characters other than the last child character.c
- The character that represents both the last child character and the new character itself.- Returns:
- The new
SourceChar
object. - Throws:
IllegalArgumentException
- If thechildren
is empty.
-
of
Returns a newSourceChar
object that has the specified child characters.Typically, this method is to create the character which is substituted for any trigraph sequence.
Note that the character this method returns is an immutable object.
- Parameters:
first
- The first child character.second
- The second child character.third
- The third child character.c
- The character that represents the new character.- Returns:
- The new
SourceChar
object.
-
of
Returns a newSourceChar
object that has the specified child characters.Typically, this method is to create the character which is substituted for any digraph sequence.
Note that the character this method returns is an immutable object.
- Parameters:
first
- The first child character.second
- The second child character.c
- The character that represents the new character.- Returns:
- The new
SourceChar
object.
-
of
Returns a newSourceChar
object that has no child characters (that is a leaf character).Note that the character this method returns is an immutable object.
- Parameters:
c
- The character that represents the new character.column
- The column number of the character.line
- The line number of the character.- Returns:
- The new
SourceChar
object.
-