로딩중...
검색중...
일치하는것 없음
by::stelaParser 클래스 참조

Parser for stela configuration language 더 자세히 ...

#include <stelaParser.hpp>

by::stelaParser에 대한 상속 다이어그램 :
by::stelaTokenScanable

Public 멤버 함수

tstr< stelaparse (const std::string &codes)
 Parses the given string of stela code.
 
tstr< stelaparse (const nchar *codes)
 Parses the given C-style string of stela code.
 
tstr< stelaparseFromFile (const std::string &path)
 Parses stela code from the specified file path.
 
tstr< stelaparseFromFile (const nchar *path)
 Parses stela code from the specified C-style file path.
 
stelaTokenDispatchergetDispatcher ()
 
std::vector< ncnt > & getIndents ()
 
nbool isInit () const
 
template<typename T >
void setScan ()
 Sets the scanning mode for the lexer.
 
void rel ()
 
int pushState (int newState)
 Pushes a new Flex scanner state onto the state stack.
 
int popState ()
 Pops a Flex scanner state from the state stack.
 
nint onScan (stelaParser &ps, ZZSTYPE *val, ZZLTYPE *loc, zzscan_t scanner, nbool &isBypass) override
 Handles scanning for the lexer, overriding the base stelaTokenScanable behavior.
 
nint onTokenEndOfFile ()
 Handles the end-of-file token.
 
nint onTokenColon (nint tok)
 Handles the colon token.
 
nint onTokenNewLine (nint tok)
 Handles the newline token.
 
nint onTokenComma (nint tok)
 Handles the comma token.
 
nint onIndent (ncnt col, nint tok)
 Handles an increase in indentation.
 
nint onDedent (ncnt col, nint tok)
 Handles a decrease in indentation.
 
nint onIgnoreIndent (nint tok)
 Handles ignoring indentation (e.g., for inline blocks).
 
nchar onScanUnexpected (const nchar *token)
 Handles an unexpected token encountered during scanning.
 
stelaonDefBlock (stela *stmt)
 
stelaonDefBlock (stela *blk, stela *stmt)
 
stelaonDefBlock ()
 
template<typename T >
stelaonPrimitive (const T &arg)
 Creates a valStela object from a primitive value.
 
verStelaonVer (const std::string &version)
 
stelaonDefProp (const std::string &name, stela &rhs)
 
stelaonDefAssign (const std::string &name, stela *rhs)
 
stelaonDefOrigin (const std::string &name, stela &blk)
 
stelaonDefArray (const stela &elem)
 
stelaonDefArray (stela &as, const stela &elem)
 
stelaonCompilationUnit (stela *blk)
 
void onParseErr (const std::string &msg, const nchar *symbolName)
 Handles a parse error, reporting the message and the symbol where the error occurred.
 
void report (const std::string &msg)
 Reports a message, typically an error or warning, encountered during parsing.
 
nint onScan (stelaParser &ps, ZZSTYPE *val, ZZLTYPE *loc, zzscan_t scanner)
 Default entry point for token scanning.
 
virtual nint onScan (stelaParser &ps, ZZSTYPE *yylval, ZZLTYPE *loc, zzscan_t yyscanner, nbool &isBypass)=0
 Pure virtual method for concrete token scanning implementations.
 
- by::stelaTokenScanable(으)로부터 상속된 Public 멤버 함수
nint onScan (stelaParser &ps, ZZSTYPE *val, ZZLTYPE *loc, zzscan_t scanner)
 Default entry point for token scanning.
 

상세한 설명

Parser for stela configuration language

Entry point for the Stela parsing component. Specify scripts through parse() or parseFromFile(), and the parsed result is returned in Stela structure.

Similar structure to byeol parser

Since the stela language itself is a specialized language of byeol, the parser is also based on the byeol language parser. Since it's a less complex language than byeol, it's recommended to examine this parser code before looking at the core module.

- bison - stelaParser structure

Uses flex and bison, with flex named lowscanner and bison named lowparser. These low-level scanner and parser exist only within the parser component and are never exposed externally. When stelaParser::parse() executes, it runs lowscanner. lowscanner tokenizes and passes tokens to lowparser. When lowparser matches rules on received tokens, it passes events back to stelaParser. Therefore, stelaParser's functions starting with on are event handling functions that define how to create nodes and build the AST.

Indentation Rule

Like the byeol language, stela applies the offside rule, making it very sensitive to indentation. Unlike typical languages, it must count whitespace after newlines. Once indentation is confirmed and determines which scope the code line belongs to, whitespace should be ignored afterward.

멤버 함수 문서화

◆ onDedent()

nint by::stelaParser::onDedent ( ncnt col,
nint tok )

Handles a decrease in indentation.

매개변수
colThe column count of the new indentation level.
tokThe token ID that triggered the dedentation.
반환값
The token ID for DEDENT.

◆ onIgnoreIndent()

nint by::stelaParser::onIgnoreIndent ( nint tok)

Handles ignoring indentation (e.g., for inline blocks).

매개변수
tokThe token ID.
반환값
The token ID.

◆ onIndent()

nint by::stelaParser::onIndent ( ncnt col,
nint tok )

Handles an increase in indentation.

매개변수
colThe column count of the new indentation level.
tokThe token ID that triggered the indentation.
반환값
The token ID for INDENT.

◆ onParseErr()

void by::stelaParser::onParseErr ( const std::string & msg,
const nchar * symbolName )

Handles a parse error, reporting the message and the symbol where the error occurred.

매개변수
msgThe error message.
symbolNameThe name of the symbol causing the error.

◆ onPrimitive()

template<typename T >
stela * by::stelaParser::onPrimitive ( const T & arg)
inline

Creates a valStela object from a primitive value.

템플릿 파라메터
TThe primitive type of the argument (e.g., int, bool, string).
매개변수
argThe primitive value.
반환값
A pointer to a newly created valStela instance.

◆ onScan() [1/3]

nint by::stelaTokenScanable::onScan ( stelaParser & ps,
ZZSTYPE * val,
ZZLTYPE * loc,
zzscan_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.

매개변수
psThe stelaParser instance.
valThe YYSTYPE value pointer for the token.
locThe YYLTYPE location pointer for the token.
scannerThe Flex scanner instance.
반환값
The token ID.

◆ onScan() [2/3]

nint by::stelaParser::onScan ( stelaParser & ps,
ZZSTYPE * val,
ZZLTYPE * loc,
zzscan_t scanner,
nbool & isBypass )
overridevirtual

Handles scanning for the lexer, overriding the base stelaTokenScanable behavior.

매개변수
psThe stelaParser instance.
valThe YYSTYPE value pointer for the token.
locThe YYLTYPE location pointer for the token.
scannerThe Flex scanner instance.
isBypassFlag indicating if indentation bypass is active.
반환값
The token ID.

by::stelaTokenScanable를 구현.

◆ onScan() [3/3]

virtual nint by::stelaTokenScanable::onScan ( stelaParser & ps,
ZZSTYPE * yylval,
ZZLTYPE * loc,
zzscan_t yyscanner,
nbool & isBypass )
virtual

Pure virtual method for concrete token scanning implementations.

매개변수
psThe stelaParser 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.
반환값
The token ID.

by::stelaTokenScanable를 구현.

◆ onScanUnexpected()

nchar by::stelaParser::onScanUnexpected ( const nchar * token)

Handles an unexpected token encountered during scanning.

매개변수
tokenThe unexpected token string.
반환값
The token ID for an error.

◆ onTokenColon()

nint by::stelaParser::onTokenColon ( nint tok)

Handles the colon token.

매개변수
tokThe token ID of the colon.
반환값
The token ID.

◆ onTokenComma()

nint by::stelaParser::onTokenComma ( nint tok)

Handles the comma token.

매개변수
tokThe token ID of the comma.
반환값
The token ID.

◆ onTokenEndOfFile()

nint by::stelaParser::onTokenEndOfFile ( )

Handles the end-of-file token.

반환값
The token ID for end-of-file.

◆ onTokenNewLine()

nint by::stelaParser::onTokenNewLine ( nint tok)

Handles the newline token.

매개변수
tokThe token ID of the newline.
반환값
The token ID.

◆ parse() [1/2]

tstr< stela > by::stelaParser::parse ( const nchar * codes)

Parses the given C-style string of stela code.

매개변수
codesThe stela code as a C-style string.
반환값
A tstr to the parsed stela AST root object, or null on error.

◆ parse() [2/2]

tstr< stela > by::stelaParser::parse ( const std::string & codes)

Parses the given string of stela code.

매개변수
codesThe stela code as a string.
반환값
A tstr to the parsed stela AST root object, or null on error.

◆ parseFromFile() [1/2]

tstr< stela > by::stelaParser::parseFromFile ( const nchar * path)

Parses stela code from the specified C-style file path.

매개변수
pathThe path to the file containing stela code.
반환값
A tstr to the parsed stela AST root object, or null on error.

◆ parseFromFile() [2/2]

tstr< stela > by::stelaParser::parseFromFile ( const std::string & path)

Parses stela code from the specified file path.

매개변수
pathThe path to the file containing stela code.
반환값
A tstr to the parsed stela AST root object, or null on error.

◆ popState()

int by::stelaParser::popState ( )

Pops a Flex scanner state from the state stack.

반환값
The previous state.

◆ pushState()

int by::stelaParser::pushState ( int newState)

Pushes a new Flex scanner state onto the state stack.

매개변수
newStateThe new state to push.
반환값
The new state.

◆ report()

void by::stelaParser::report ( const std::string & msg)

Reports a message, typically an error or warning, encountered during parsing.

매개변수
msgThe message to report.

◆ setScan()

template<typename T >
void by::stelaParser::setScan ( )
inline

Sets the scanning mode for the lexer.

템플릿 파라메터
TThe type of the scanner strategy (e.g., normalScan, indentScan).

이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: