function <- memberFunction / constructor
memberFunction <- prefix returnType functionName template* '(' (',' / parameter)* ')' suffix
constructor <- 'explicit'? functionName '(' (',' / parameter)* ')' 'noexcept'?
functionName <- (operator / symbol)
operator <- < 'operator'('()' / [!+-=*/\\<>&]{1,2}) >
prefix <- < 'inline'? 'static'? 'explicit'? 'virtual'? >
suffix <- 'const'? 'noexcept'? 'mutable'? ('='[ ]?'0')?
returnType <- (templatedType / type)
templatedType <- 'const'? symbol '<' (templatedType / type / ',')* '>' ([ &*]+)?
template <- '<' (type / template)* '>'
parameter <- (gParameter / nonParameter)
gParameter <- (templatedType / type) (symbolWithVal / symbol)
nonParameter <- type
type <- <'const'? [ ]* [0-9a-zA-Z_:&*]+ ([ &*]+)?>
symbol <- <[a-zA-Z_][0-9a-zA-Z_:]*>
symbolWithVal <- symbol ('=' lexValue)
lexValue <- ('{' (lexValue / ',' / value)* '}') / value
value <- string / number / constexpr
string <- '"' (!'"' .)* '"'
constexpr <- < ( templatedType / type ) ('::' symbol '()')? >
number <- < [0-9]+ '.'? [0-9]* [uf]? >
%whitespace <- [ \t]*
懂的自然懂
最新推荐文章于 2022-03-18 11:55:51 发布