Loading...
Searching...
No Matches
by::tokenScan Class Reference

Base class for token scanning strategies. More...

#include <tokenScan.hpp>

Inheritance diagram for by::tokenScan:
by::tokenScanable by::indentScan by::normalScan

Public Member Functions

virtual nint onScan (parser &ps, YYSTYPE *yylval, YYLTYPE *loc, yyscan_t yyscanner, nbool &isBypass) override
 Pure virtual method for concrete token scanning implementations.
 
nint onScan (parser &ps, YYSTYPE *val, YYLTYPE *loc, yyscan_t scanner)
 Default entry point for token scanning.
 
virtual nint onScan (parser &ps, YYSTYPE *yylval, YYLTYPE *loc, yyscan_t yyscanner, nbool &isBypass)=0
 Pure virtual method for concrete token scanning implementations.
 
- Public Member Functions inherited from by::tokenScanable
nint onScan (parser &ps, YYSTYPE *val, YYLTYPE *loc, yyscan_t scanner)
 Default entry point for token scanning.
 

Detailed Description

Base class for token scanning strategies.

parser dynamically switches scan modes to precisely measure indentation as mentioned in its documentation. tokenScan represents one such scan mode strategy.

Command Tokens

Among tokens, there are command tokens like SCAN_AGAIN and SCAN_EXIT that give commands to the scanner or parser. See the // mode: section in the middle of lowparser.y for details.

isBypass

In the case of IndentScan, most tokens are ignored and it focuses only on counting how many spaces there are. However, if multiple tokens were pushed from the previous line, it operates in bypass mode internally. In this case, it skips the indentation counting operation and reads and returns the stored tokens as is.

Member Function Documentation

◆ onScan() [1/3]

nint by::tokenScanable::onScan ( parser & ps,
YYSTYPE * val,
YYLTYPE * loc,
yyscan_t scanner )

Default entry point for token scanning.

This non-virtual method acts as a wrapper that internally dispatches to the pure virtual onScan method, which must be implemented by concrete scanner strategies.

Parameters
psThe parser instance.
valThe YYSTYPE value pointer for the token.
locThe YYLTYPE location pointer for the token.
scannerThe Flex scanner instance.
Returns
The token ID.

◆ onScan() [2/3]

nint by::tokenScan::onScan ( parser & ps,
YYSTYPE * yylval,
YYLTYPE * loc,
yyscan_t yyscanner,
nbool & isBypass )
overridevirtual

Pure virtual method for concrete token scanning implementations.

Parameters
psThe parser instance.
yylvalThe YYSTYPE value pointer for the token.
locThe YYLTYPE location pointer for the token.
yyscannerThe Flex scanner instance.
isBypassFlag indicating if indentation bypass is active.
Returns
The token ID.

Implements by::tokenScanable.

Reimplemented in by::normalScan, and by::indentScan.

◆ onScan() [3/3]

virtual nint by::tokenScanable::onScan ( parser & ps,
YYSTYPE * yylval,
YYLTYPE * loc,
yyscan_t yyscanner,
nbool & isBypass )
virtual

Pure virtual method for concrete token scanning implementations.

Parameters
psThe parser instance.
yylvalThe YYSTYPE value pointer for the token.
locThe YYLTYPE location pointer for the token.
yyscannerThe Flex scanner instance.
isBypassFlag indicating if indentation bypass is active.
Returns
The token ID.

Implements by::tokenScanable.


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