RetroArch/tools/com-parser/grammar.txt

31 lines
936 B
Plaintext

Program <- (Function / Comment / Line)* EndOfFile
Function <- _ ReturnType _ '(' _ FunctionName _ ')'_ Parameters
Parameters <- '('_ This _ ','? _ ( _ Param _ ','?)*_ ');'
FunctionName <- CallType _ '*' _ <Name>
This <- Type _ 'This'
Param <- InOut? _ Type _ Name _ ArraySize?
ReturnType <- <Type>
Type <- (TypeQualifier _)? Name Pointer?
TypeQualifier <- 'const'
~CallType <- '__export'? ('STDMETHODCALLTYPE' / 'STDMETHODVCALLTYPE' / 'STDAPICALLTYPE' / 'STDAPIVCALLTYPE' / '__cdecl' / '__stdcall')
~InOut <- '_'Name
ArraySize <- '[' _ <Number?> _ ']'
Pointer <- _<('*'/'const '/'const')+>
Name <- <([a-z]/[A-Z]/'_'/[0-9])+>
Number <- <[0-9]+>
~Line <- <(!EndOfLine !EndOfFile .)*> (EndOfLine / EndOfFile)
~EndOfStatement <- ';'
~EndOfLine <- '\r\n' / '\n' / '\r'
EndOfFile <- !.
End <- EndOfLine / EndOfFile
~_ <- (Comment / [ \t\r\n])*
Indent <- [ \t]
~Space <- [ \t]
Comment <- [ \t]*<('/*' (!'*/' .)* '*/' / '//') Line>