Class DirectiveParseKit

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

public final class DirectiveParseKit extends Object
Provides the feature to parse a preprocessor directive.

This class reads characters from the source specified in the constructor and parses them as preprocessor directives. The #include directive is parsed specially.

  • Constructor Details

    • DirectiveParseKit

      public DirectiveParseKit(Source source, Set<String> reservedWords)
      Constructs a new instance.
      Parameters:
      source - The source.
      reservedWords - The set of reserved words.
  • Method Details

    • addDirectiveTokens

      public void addDirectiveTokens(List<Token> list) throws IOException
      Adds tokens of the directive to the specified list.
      Parameters:
      list - The list of tokens.
      Throws:
      IOException - if an I/O error occurs.
    • addIncludeDirectiveTokens

      public void addIncludeDirectiveTokens(List<Token> list) throws IOException
      Adds tokens of the include directive to the specified list.
      Parameters:
      list - The list of tokens.
      Throws:
      IOException - if an I/O error occurs.
    • addLineDirectiveTokens

      public void addLineDirectiveTokens(List<Token> list) throws IOException
      Adds tokens of the line directive to the specified list.
      Parameters:
      list - The list of tokens.
      Throws:
      IOException - if an I/O error occurs.
    • newDirectiveChildToken

      public Token newDirectiveChildToken() throws IOException
      Returns the next token of the directive.
      Returns:
      The next token.
      Throws:
      IOException - if an I/O error occurs.
    • newIncludeDirectiveChildToken

      public Token newIncludeDirectiveChildToken() throws IOException
      Returns the next token of the include directive.
      Returns:
      The next token.
      Throws:
      IOException - if an I/O error occurs.
    • newLineDirectiveChildToken

      public Token newLineDirectiveChildToken() throws IOException
      Returns the next token of the line directive.
      Returns:
      The next token.
      Throws:
      IOException - if an I/O error occurs.