add lexer and parser for export function binding generation
This commit is contained in:
parent
99383779b3
commit
ef5d1760a3
23
CodeGen/BMapBindings/ExpFctsLexer.g4
Normal file
23
CodeGen/BMapBindings/ExpFctsLexer.g4
Normal file
|
@ -0,0 +1,23 @@
|
|||
lexer grammar ExpFctsLexer;
|
||||
|
||||
// keywords
|
||||
EXPFCTS_EXPORT: 'LIBCMO_EXPORT' ;
|
||||
EXPFCTS_FILE_DECL: 'BMPARAM_FILE_DECL' ;
|
||||
EXPFCTS_MESHTRANS_DECL: 'BMPARAM_MESHTRANS_DECL' ;
|
||||
EXPFCTS_OBJECT_DECL: 'BMPARAM_OBJECT_DECL' ;
|
||||
EXPFCTS_PARAM_IN: 'BMPARAM_IN' ;
|
||||
EXPFCTS_PARAM_OUT: 'BMPARAM_OUT' ;
|
||||
|
||||
// symbols
|
||||
EXPFCTS_LPARENTHESES: '(' ;
|
||||
EXPFCTS_RPARENTHESES: ')' ;
|
||||
EXPFCTS_COMMA: ',' ;
|
||||
EXPFCTS_SEMICOLON: ';' ;
|
||||
EXPFCTS_STAR: '*' ;
|
||||
EXPFCTS_DOUBLE_COLON: '::' ;
|
||||
|
||||
// identifider
|
||||
EXPFCTS_IDENTIFIER: [_a-zA-Z][_a-zA-Z0-9]* ;
|
||||
|
||||
// remove whitespace and line break
|
||||
EXPFCTS_WS: [ \t\n\r\f]+ -> skip ;
|
21
CodeGen/BMapBindings/ExpFctsParser.g4
Normal file
21
CodeGen/BMapBindings/ExpFctsParser.g4
Normal file
|
@ -0,0 +1,21 @@
|
|||
parser grammar ExpFctsParser;
|
||||
options { tokenVocab = ExpFctsLexer; }
|
||||
|
||||
program: fctDecl* ;
|
||||
|
||||
fctDecl
|
||||
: EXPFCTS_EXPORT varType EXPFCTS_IDENTIFIER '(' (fctArg (',' fctArg)*)? ')' ';'
|
||||
;
|
||||
|
||||
fctArg
|
||||
: EXPFCTS_FILE_DECL '(' EXPFCTS_IDENTIFIER ')' # fctArgFileDecl
|
||||
| EXPFCTS_MESHTRANS_DECL '(' EXPFCTS_IDENTIFIER ')' #fctArgMeshTransDecl
|
||||
| EXPFCTS_OBJECT_DECL '(' EXPFCTS_IDENTIFIER ',' EXPFCTS_IDENTIFIER ')' # fctArgObjDecl
|
||||
| EXPFCTS_PARAM_IN '(' varType ',' EXPFCTS_IDENTIFIER ')' # fctArgParamIn
|
||||
| EXPFCTS_PARAM_OUT '(' varType ',' EXPFCTS_IDENTIFIER ')' # fctArgParamOut
|
||||
;
|
||||
|
||||
varType
|
||||
: EXPFCTS_IDENTIFIER ('::' EXPFCTS_IDENTIFIER)* '*'?
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user