OpenMD 3.1
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
antlr::TokenStreamHiddenTokenFilter Class Reference

This object filters a token stream coming from a lexer or another TokenStream so that only certain token channels get transmitted to the parser. More...

#include <TokenStreamHiddenTokenFilter.hpp>

+ Inheritance diagram for antlr::TokenStreamHiddenTokenFilter:

Public Member Functions

 TokenStreamHiddenTokenFilter (TokenStream &input)
 This object filters a token stream coming from a lexer or another TokenStream so that only certain token channels get transmitted to the parser.
 
BitSet getDiscardMask () const
 
RefToken getHiddenAfter (RefToken t)
 Return a ptr to the hidden token appearing immediately after token t in the input stream.
 
RefToken getHiddenBefore (RefToken t)
 Return a ptr to the hidden token appearing immediately before token t in the input stream.
 
BitSet getHideMask () const
 
RefToken getInitialHiddenToken ()
 Return the first hidden token if one appears before any monitored token.
 
void hide (int m)
 
void hide (const BitSet &mask)
 
RefToken nextToken ()
 Return the next monitored token.
 
- Public Member Functions inherited from antlr::TokenStreamBasicFilter
 TokenStreamBasicFilter (TokenStream &input_)
 This object is a TokenStream that passes through all tokens except for those that you tell it to discard.
 
void discard (int ttype)
 
void discard (const BitSet &mask)
 

Protected Member Functions

void consume ()
 
RefToken LA (int i)
 

Protected Attributes

BitSet hideMask
 
RefToken lastHiddenToken
 track tail of hidden list emanating from previous monitored token
 
RefToken firstHidden
 
- Protected Attributes inherited from antlr::TokenStreamBasicFilter
BitSet discardMask
 The set of token types to discard.
 
TokenStreaminput
 The input stream.
 

Detailed Description

This object filters a token stream coming from a lexer or another TokenStream so that only certain token channels get transmitted to the parser.

Any of the channels can be filtered off as "hidden" channels whose tokens can be accessed from the parser.

Definition at line 25 of file TokenStreamHiddenTokenFilter.hpp.

Constructor & Destructor Documentation

◆ TokenStreamHiddenTokenFilter()

antlr::TokenStreamHiddenTokenFilter::TokenStreamHiddenTokenFilter ( TokenStream & input)

This object filters a token stream coming from a lexer or another TokenStream so that only certain token channels get transmitted to the parser.

Any of the channels can be filtered off as "hidden" channels whose tokens can be accessed from the parser.

Definition at line 22 of file TokenStreamHiddenTokenFilter.cpp.

Member Function Documentation

◆ consume()

void antlr::TokenStreamHiddenTokenFilter::consume ( )
protected

Definition at line 27 of file TokenStreamHiddenTokenFilter.cpp.

◆ getDiscardMask()

BitSet antlr::TokenStreamHiddenTokenFilter::getDiscardMask ( ) const

Definition at line 58 of file TokenStreamHiddenTokenFilter.cpp.

◆ getHiddenAfter()

RefToken antlr::TokenStreamHiddenTokenFilter::getHiddenAfter ( RefToken t)

Return a ptr to the hidden token appearing immediately after token t in the input stream.

Definition at line 66 of file TokenStreamHiddenTokenFilter.cpp.

References getHiddenAfter().

Referenced by getHiddenAfter().

◆ getHiddenBefore()

RefToken antlr::TokenStreamHiddenTokenFilter::getHiddenBefore ( RefToken t)

Return a ptr to the hidden token appearing immediately before token t in the input stream.

Definition at line 74 of file TokenStreamHiddenTokenFilter.cpp.

References getHiddenBefore().

Referenced by getHiddenBefore().

◆ getHideMask()

BitSet antlr::TokenStreamHiddenTokenFilter::getHideMask ( ) const

Definition at line 79 of file TokenStreamHiddenTokenFilter.cpp.

◆ getInitialHiddenToken()

RefToken antlr::TokenStreamHiddenTokenFilter::getInitialHiddenToken ( )

Return the first hidden token if one appears before any monitored token.

Definition at line 87 of file TokenStreamHiddenTokenFilter.cpp.

◆ hide() [1/2]

void antlr::TokenStreamHiddenTokenFilter::hide ( const BitSet & mask)

Definition at line 97 of file TokenStreamHiddenTokenFilter.cpp.

◆ hide() [2/2]

void antlr::TokenStreamHiddenTokenFilter::hide ( int m)

Definition at line 92 of file TokenStreamHiddenTokenFilter.cpp.

◆ LA()

RefToken antlr::TokenStreamHiddenTokenFilter::LA ( int i)
protected

Definition at line 102 of file TokenStreamHiddenTokenFilter.cpp.

◆ nextToken()

RefToken antlr::TokenStreamHiddenTokenFilter::nextToken ( void )
virtual

Return the next monitored token.

Test the token following the monitored token. If following is another monitored token, save it for the next invocation of nextToken (like a single lookahead token) and return it then. If following is unmonitored, nondiscarded (hidden) channel token, add it to the monitored token.

Note: EOF must be a monitored Token.

Reimplemented from antlr::TokenStreamBasicFilter.

Definition at line 117 of file TokenStreamHiddenTokenFilter.cpp.

References antlr::TokenStreamBasicFilter::discardMask, and lastHiddenToken.

Member Data Documentation

◆ firstHidden

RefToken antlr::TokenStreamHiddenTokenFilter::firstHidden
protected

Definition at line 39 of file TokenStreamHiddenTokenFilter.hpp.

◆ hideMask

BitSet antlr::TokenStreamHiddenTokenFilter::hideMask
protected

Definition at line 28 of file TokenStreamHiddenTokenFilter.hpp.

◆ lastHiddenToken

RefToken antlr::TokenStreamHiddenTokenFilter::lastHiddenToken
protected

track tail of hidden list emanating from previous monitored token

Definition at line 37 of file TokenStreamHiddenTokenFilter.hpp.

Referenced by nextToken().


The documentation for this class was generated from the following files: