Class SourceChars

java.lang.Object
com.maroontress.clione.impl.SourceChars

public final class SourceChars extends Object
The factory of SourceChar objects.
  • Method Details

    • eof

      public static SourceChar eof()
      Returns EOF.
      Returns:
      EOF (that is SourceChar.STATIC_EOF).
    • eof

      public static SourceChar eof(Collection<SourceChar> children)
      Returns a new SourceChar 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:

      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 the children is empty.
    • of

      public static SourceChar of(Collection<SourceChar> children, SourceChar c)
      Returns a new SourceChar 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 the children is empty.
    • of

      public static SourceChar of(SourceChar first, SourceChar second, SourceChar third, char c)
      Returns a new SourceChar 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

      public static SourceChar of(SourceChar first, SourceChar second, char c)
      Returns a new SourceChar 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

      public static SourceChar of(char c, int column, int line)
      Returns a new SourceChar 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.