Class Digraphs

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

public final class Digraphs extends Object
Provides the facility of digraph substitution.

In general, digraphs are sequences of two characters that appear in source code and should be treated as if they were single characters. In the C programming language, any digraph must always represent a full token by itself. The following table lists all valid operator or punctuator tokens represented with digraphs:

Tokens represented with digraphs.
TokenEquivalent
<:[
:>]
<%{
%>}
%:#
%:%:##

Note that both %:# and #%: are not equivalent to token ## or %:%:.

See Also:
  • Method Details

    • toDirective

      public static TokenType toDirective(Transcriber x)
      Substitutes a number sign (with which the preprocessing directive starts) for the character sequence that the specified transcriber stores in its builder.
      Parameters:
      x - The transcriber.
      Returns:
      The token type (TokenType.DIRECTIVE).
    • toUnknownDoubleNumberSign

      public static TokenType toUnknownDoubleNumberSign(Transcriber x)
      Substitutes a double number sign (that appears other than in the macro declaration) for the character sequence that the specified transcriber stores in its builder.
      Parameters:
      x - The transcriber.
      Returns:
      The token type (TokenType.UNKNOWN).
    • toStringificationOperator

      public static TokenType toStringificationOperator(Transcriber x)
      Substitutes a number sign (a preprocessing stringification operator #) for the character sequence that the specified transcriber stores in its builder.
      Parameters:
      x - The transcriber.
      Returns:
      The token type (TokenType.OPERATOR).
    • toTokenPastingOperator

      public static TokenType toTokenPastingOperator(Transcriber x)
      Substitutes a double number sign (a preprocessing token-pasting operator ##) for the character sequence that the specified transcriber stores in its builder.
      Parameters:
      x - The transcriber.
      Returns:
      The token type (TokenType.OPERATOR).
    • toRightBracket

      public static TokenType toRightBracket(Transcriber x)
      Substitutes a right bracket for the character sequence that the specified transcriber stores in its builder.
      Parameters:
      x - The transcriber.
      Returns:
      The token type (TokenType.PUNCTUATOR).
    • toLeftBracket

      public static TokenType toLeftBracket(Transcriber x)
      Substitutes a left bracket for the character sequence that the specified transcriber stores in its builder.
      Parameters:
      x - The transcriber.
      Returns:
      The token type (TokenType.PUNCTUATOR).
    • toLeftBrace

      public static TokenType toLeftBrace(Transcriber x)
      Substitutes a left brace for the character sequence that the specified transcriber stores in its builder.
      Parameters:
      x - The transcriber.
      Returns:
      The token type (TokenType.PUNCTUATOR).
    • toRightBrace

      public static TokenType toRightBrace(Transcriber x)
      Substitutes a right brace for the character sequence that the specified transcriber stores in its builder.
      Parameters:
      x - The transcriber.
      Returns:
      The token type (TokenType.PUNCTUATOR).