X-Git-Url: http://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/1656cfade4879af0cb003e3847e58264caa5781f..b17287deb56775a49030d738d8c8c0e9cd15f9fe:/src/parse.y diff --git a/src/parse.y b/src/parse.y index a6892e9..63f0a7a 100644 --- a/src/parse.y +++ b/src/parse.y @@ -104,7 +104,8 @@ push_variable(char *name, int scope, int line_no, char *postfix) static void push_function(int scope, int method, char *oid, char *id, char *onerror, - GString *cbuf,int line_no, int ccode_line, int vararg) + GString *cbuf, int line_no, int ccode_line, gboolean vararg, + GList *flags) { Node *node; Type *type; @@ -138,8 +139,9 @@ push_function(int scope, int method, char *oid, char *id, char *onerror, } else c_cbuf = NULL; - node = new_method(scope,method,type,oid,gtktypes,id,funcargs, - onerror,c_cbuf,line_no,ccode_line,vararg); + node = new_method(scope, method, type, oid, gtktypes, flags, + id, funcargs, onerror, c_cbuf, line_no, + ccode_line, vararg); if(cbuf) g_string_free(cbuf, @@ -212,7 +214,7 @@ push_self(char *id) %token ONERROR %token TOKEN NUMBER TYPETOKEN ARRAY_DIM -%token CCODE HTCODE PHCODE HCODE +%token CCODE HTCODE PHCODE HCODE ACODE ATCODE %token PUBLIC PRIVATE PROTECTED ARGUMENT VIRTUAL SIGNAL OVERRIDE %% @@ -247,6 +249,18 @@ ccode: CCODE { nodes = g_list_append(nodes,node); g_string_free($1,FALSE); } + | ACODE { + Node *node = new_ccode(A_CCODE,($1)->str, + ccode_line); + nodes = g_list_append(nodes,node); + g_string_free($1,FALSE); + } + | ATCODE { + Node *node = new_ccode(AT_CCODE,($1)->str, + ccode_line); + nodes = g_list_append(nodes,node); + g_string_free($1,FALSE); + } ; ccodes: ccodes ccode { ; } @@ -290,7 +304,7 @@ variable: scope type TOKEN ';' { push_variable($3,the_scope,$1,$4); } ; -argument: ARGUMENT argflags argtype TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' { +argument: ARGUMENT flags argtype TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' { if(strcmp($5,"get")==0 && strcmp($8,"set")==0) { Node *node; @@ -325,7 +339,7 @@ argument: ARGUMENT argflags argtype TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' { YYERROR; } } - | ARGUMENT argflags argtype TOKEN TOKEN '{' CCODE ';' { + | ARGUMENT flags argtype TOKEN TOKEN '{' CCODE ';' { if(strcmp($5,"get")==0) { Node *node; Type *type = pop_type(); @@ -370,7 +384,7 @@ argtype: TOKEN '(' TOKEN type ')' { } ; -argflags: '(' flaglist ')' { $$ = $2; } +flags: '(' flaglist ')' { $$ = $2; } | { $$ = NULL; } ; @@ -544,25 +558,25 @@ codenocode: '{' CCODE { $$ = $2; } ; /*here CCODE will include the ending '}' */ -method: SIGNAL fullsigtype type TOKEN '(' funcargs ')' onerror codenocode { +method: SIGNAL flags fullsigtype type TOKEN '(' funcargs ')' onerror codenocode { if(!has_self) { yyerror(_("signal without 'self' as " "first parameter")); YYERROR; } - push_function(the_scope, $2,NULL, - $4, $8, $9,$1, - ccode_line,vararg); + push_function(the_scope, $3,NULL, + $5, $9, $10,$1, + ccode_line, vararg, $2); } - | scope SIGNAL simplesigtype type TOKEN '(' funcargs ')' onerror codenocode { + | scope SIGNAL flags simplesigtype type TOKEN '(' funcargs ')' onerror codenocode { if(!has_self) { yyerror(_("signal without 'self' as " "first parameter")); YYERROR; } - push_function(the_scope, $3,NULL, - $5, $9, $10,$2, - ccode_line,vararg); + push_function(the_scope, $4, NULL, + $6, $10, $11, $2, + ccode_line, vararg, $3); } | VIRTUAL scope type TOKEN '(' funcargs ')' onerror codenocode { if(!has_self) { @@ -571,8 +585,8 @@ method: SIGNAL fullsigtype type TOKEN '(' funcargs ')' onerror codenocode { YYERROR; } push_function(the_scope, VIRTUAL_METHOD, NULL, $4, - $8, $9,$1, - ccode_line,vararg); + $8, $9, $1, + ccode_line, vararg, NULL); } | scope VIRTUAL type TOKEN '(' funcargs ')' onerror codenocode { if(!has_self) { @@ -581,8 +595,8 @@ method: SIGNAL fullsigtype type TOKEN '(' funcargs ')' onerror codenocode { YYERROR; } push_function(the_scope, VIRTUAL_METHOD, NULL, $4, - $8, $9,$2, - ccode_line,vararg); + $8, $9, $2, + ccode_line, vararg, NULL); } | VIRTUAL type TOKEN '(' funcargs ')' onerror codenocode { if(!has_self) { @@ -591,31 +605,31 @@ method: SIGNAL fullsigtype type TOKEN '(' funcargs ')' onerror codenocode { YYERROR; } push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL, - $3, $7, $8,$1, - ccode_line,vararg); + $3, $7, $8, $1, + ccode_line, vararg, NULL); } | OVERRIDE '(' TYPETOKEN ')' type TOKEN '(' funcargs ')' onerror codenocode { push_function(NO_SCOPE, OVERRIDE_METHOD, $3, $6, $10, $11, - $1,ccode_line, - vararg); + $1, ccode_line, + vararg, NULL); } | scope type TOKEN '(' funcargs ')' onerror codenocode { push_function(the_scope, REGULAR_METHOD, NULL, $3, - $7, $8,$1,ccode_line, - vararg); + $7, $8, $1, ccode_line, + vararg, NULL); } | TOKEN '(' TOKEN ')' codenocode { if(strcmp($1,"init")==0) { push_init_arg($3,FALSE); push_function(NO_SCOPE, INIT_METHOD, NULL, - $1, NULL, $5,$2, - ccode_line,FALSE); + $1, NULL, $5, $2, + ccode_line, FALSE, NULL); } else if(strcmp($1,"class_init")==0) { push_init_arg($3,TRUE); push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL, - $1, NULL, $5,$2, - ccode_line,FALSE); + $1, NULL, $5, $2, + ccode_line, FALSE, NULL); } else { g_free($1); g_free($3);