CppCommentState

This state will either delegate to a comment-handling state, or return a token with just a slash in it.

Extends: GenericCommentState

Description

The CppCommentState class allows you to create a state that will either delegate to a comment-handling state, or return a token with just a slash in it.

Fields

STAR

Represents a star (*) char

protected final int STAR = ‘*’

SLASH

Represents a forward slash (/) char.

protected final int STAR = ‘*’

Instance methods

getMultiLineComment

Ignores everything up to a closing star and slash, and then returns the tokenizer’s next token.

protected String getMultiLineComment(IScanner scanner)

  • scanner: IScanner - scanner
  • returns: string - comment

getSingleLineComment

Ignores everything up to an end-of-line, and then returns the tokenizer’s next token.

protected String getSingleLineComment(IScanner scanner)

  • scanner: IScanner - scanner
  • returns: String - comment

nextToken

Either delegates to a comment-handling state, or returns a token with just a slash in it.

public Token nextToken(IScanner scanner, ITokenizer tokenizer) throws Exception

  • scanner: IScanner - text string to be tokenized.
  • tokenizer: ITokenizer - tokenizer class that controls the process.
  • returns: Token - next token from the top of the stream.