2 * Copyright (C) 1999 the Free Software Foundation.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
29 #include "treefuncs.h"
37 static GList *class_nodes = NULL;
39 char *chunk_size = NULL;
41 static GList *typestack = NULL;
42 static GList *funcargs = NULL;
43 static GList *checks = NULL;
44 static int has_self = FALSE;
45 static int vararg = FALSE;
47 /* destructor and initializer for variables */
48 static char *destructor = NULL;
49 static int destructor_line = 0;
50 static gboolean destructor_simple = TRUE;
51 static char *initializer = NULL;
52 static int initializer_line = 0;
54 static char *onerror = NULL;
55 static char *defreturn = NULL;
57 static GList *gtktypes = NULL;
59 /* this can be a global as we will only do one function at a time
61 static int the_scope = NO_SCOPE;
66 extern int ccode_line;
77 if(strcmp(yytext,"\n")==0) {
78 out=g_strconcat("Error: ",str," before newline",NULL);
79 } else if(yytext[0]=='\0') {
80 out=g_strconcat("Error: ", str, " at end of input", NULL);
82 char *tmp = g_strdup(yytext);
83 while((p=strchr(tmp, '\n')))
86 out=g_strconcat("Error: ", str, " before '", tmp, "'", NULL);
90 fprintf(stderr, "%s:%d: %s\n", filename, line_no, out);
99 Type *type = typestack->data;
100 typestack = g_list_remove(typestack,typestack->data);
105 push_variable(char *name, int scope, int line_no, char *postfix)
108 Type *type = pop_type();
110 type->postfix = postfix;
112 var = new_variable(scope, type, name, line_no,
113 destructor, destructor_line,
115 initializer, initializer_line);
116 class_nodes = g_list_append(class_nodes, var);
120 push_function(int scope, int method, char *oid, char *id,
121 GString *cbuf, int line_no, int ccode_line,
122 gboolean vararg, GList *flags)
128 g_assert(scope != CLASS_SCOPE);
130 if(method == INIT_METHOD || method == CLASS_INIT_METHOD) {
131 type = (Type *)new_type(g_strdup("void"), NULL, NULL);
136 /* a complicated and ugly test to figure out if we have
137 the wrong number of types for a signal */
138 if((method == SIGNAL_FIRST_METHOD ||
139 method == SIGNAL_LAST_METHOD) &&
140 g_list_length(gtktypes) != g_list_length(funcargs) &&
141 !(g_list_length(funcargs) == 1 &&
142 g_list_length(gtktypes) == 2 &&
143 strcmp(gtktypes->next->data, "NONE")==0)) {
144 print_error(TRUE, _("The number of GTK arguments and "
145 "function arguments for a signal "
146 "don't seem to match"), line_no);
148 if(g_list_length(gtktypes) > 2) {
150 for(li = gtktypes->next; li; li = li->next) {
151 if(strcmp(li->data, "NONE")==0) {
153 _("NONE can only appear in an "
154 "argument list by itself"),
161 c_cbuf = p = cbuf->str;
162 while(p && *p && (*p==' ' || *p=='\t' || *p=='\n' || *p=='\r'))
169 node = new_method(scope, method, type, oid, gtktypes, flags,
170 id, funcargs, onerror, defreturn, c_cbuf, line_no,
171 ccode_line, vararg, method_unique_id++);
175 /*only free segment if we haven't passed it
184 class_nodes = g_list_append(class_nodes, node);
188 free_all_global_state(void)
198 g_list_foreach(gtktypes, (GFunc)g_free, NULL);
199 g_list_free(gtktypes);
202 free_node_list(funcargs);
207 push_funcarg(char *name, char *postfix)
210 Type *type = pop_type();
212 type->postfix = postfix;
214 node = new_funcarg(type, name, checks);
217 funcargs = g_list_append(funcargs, node);
221 push_init_arg(char *name, int is_class)
228 tn = g_strconcat(((Class *)class)->otype,":Class",NULL);
230 tn = g_strdup(((Class *)class)->otype);
232 type = new_type(tn, g_strdup("*"), NULL);
233 node = new_funcarg((Type *)type,name,NULL);
234 funcargs = g_list_prepend(funcargs, node);
243 type = new_type(g_strdup(((Class *)class)->otype), g_strdup("*"), NULL);
244 ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
245 ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
246 node = new_funcarg((Type *)type,id,ch);
247 funcargs = g_list_prepend(funcargs, node);
251 find_var_or_die(const char *id, int line)
256 for(li = class_nodes; li != NULL; li = li->next) {
258 Node *node = li->data;
259 if(node->type != VARIABLE_NODE)
262 if(strcmp(var->id, id)==0)
266 s = g_strdup_printf(_("Variable %s not defined here"), id);
267 print_error(FALSE, s, line);
269 g_assert_not_reached();
274 set_return_value(char *type, char *val)
276 if(strcmp(type, "onerror")==0) {
282 } else if(strcmp(type, "defreturn")==0) {
303 %token CONST VOID STRUCT UNION ENUM THREEDOTS
304 %token SIGNED UNSIGNED LONG SHORT INT FLOAT DOUBLE CHAR
306 %token <id> TOKEN NUMBER TYPETOKEN ARRAY_DIM
307 %token <cbuf> CCODE HTCODE PHCODE HCODE ACODE ATCODE
308 %token <line> PUBLIC PRIVATE PROTECTED CLASSWIDE ARGUMENT VIRTUAL SIGNAL OVERRIDE
312 prog: ccodes class ccodes { ; }
319 Node *node = new_ccode(C_CCODE,($<cbuf>1)->str,
321 nodes = g_list_append(nodes,node);
322 g_string_free($<cbuf>1,FALSE);
325 Node *node = new_ccode(H_CCODE,($<cbuf>1)->str,
327 nodes = g_list_append(nodes,node);
328 g_string_free($<cbuf>1,FALSE);
331 Node *node = new_ccode(HT_CCODE,($<cbuf>1)->str,
333 nodes = g_list_append(nodes,node);
334 g_string_free($<cbuf>1,FALSE);
337 Node *node = new_ccode(PH_CCODE,($<cbuf>1)->str,
339 nodes = g_list_append(nodes,node);
340 g_string_free($<cbuf>1,FALSE);
343 Node *node = new_ccode(A_CCODE,($<cbuf>1)->str,
345 nodes = g_list_append(nodes,node);
346 g_string_free($<cbuf>1,FALSE);
349 Node *node = new_ccode(AT_CCODE,($<cbuf>1)->str,
351 nodes = g_list_append(nodes,node);
352 g_string_free($<cbuf>1,FALSE);
356 ccodes: ccodes ccode { ; }
360 class: classdec '{' classcode '}' {
361 ((Class *)class)->nodes = class_nodes;
363 nodes = g_list_append(nodes,class);
366 ((Class *)class)->nodes = NULL;
368 nodes = g_list_append(nodes,class);
372 classdec: CLASS TYPETOKEN FROM TYPETOKEN chunk {
373 class = new_class($<id>2,$<id>4,chunk_size,NULL);
378 | '(' TOKEN TOKEN ')' {
379 if(strcmp($<id>2,"chunks") == 0) {
380 chunk_size = g_strdup($<id>4);
382 yyerror(_("parse error"));
386 | '(' TOKEN NUMBER ')' {
387 if(strcmp($<id>2,"chunks") == 0) {
388 if(atoi($<id>4) != 0)
389 chunk_size = g_strdup($<id>4);
391 yyerror(_("parse error"));
397 classcode: classcode thing { ; }
407 scope: PUBLIC { the_scope = PUBLIC_SCOPE; }
408 | PRIVATE { the_scope = PRIVATE_SCOPE; }
409 | PROTECTED { the_scope = PROTECTED_SCOPE; }
410 | CLASSWIDE { the_scope = CLASS_SCOPE; }
413 destructor: TOKEN TOKEN {
414 if(strcmp($<id>1, "destroywith")==0) {
417 destructor_line = line_no;
418 destructor_simple = TRUE;
422 yyerror(_("parse error"));
427 if(strcmp($<id>1, "destroy")==0) {
429 destructor = ($<cbuf>3)->str;
430 g_string_free($<cbuf>3, FALSE);
431 destructor_line = ccode_line;
432 destructor_simple = FALSE;
435 g_string_free($<cbuf>3, TRUE);
436 yyerror(_("parse error"));
442 initializer: '=' numtok {
443 initializer = $<id>2;
444 initializer_line = ccode_line;
447 initializer = ($<cbuf>3)->str;
448 initializer_line = ccode_line;
449 g_string_free($<cbuf>3, FALSE);
454 varoptions: destructor initializer { ; }
455 | initializer destructor { ; }
456 | initializer { destructor = NULL; }
457 | destructor { initializer = NULL; }
464 variable: scope type TOKEN varoptions ';' {
465 push_variable($<id>3, the_scope,$<line>1, NULL);
467 | scope type TOKEN ARRAY_DIM varoptions ';' {
468 push_variable($<id>3, the_scope, $<line>1, $<id>4);
471 argument: ARGUMENT flags argtype TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' {
472 if(strcmp($<id>5,"get")==0 &&
473 strcmp($<id>8,"set")==0) {
475 Type *type = pop_type();
476 g_free($<id>5); g_free($<id>8);
477 node = new_argument($<id>3,type,$<list>2,$<id>4,
478 ($<cbuf>7)->str,$<line>6,
479 ($<cbuf>10)->str,$<line>9,
481 g_string_free($<cbuf>7,FALSE);
482 g_string_free($<cbuf>10,FALSE);
483 class_nodes = g_list_append(class_nodes,node);
484 } else if(strcmp($<id>5,"set")==0 &&
485 strcmp($<id>8,"get")==0) {
487 Type *type = pop_type();
488 g_free($<id>5); g_free($<id>8);
489 node = new_argument($<id>3,type,$<list>2,$<id>4,
490 ($<cbuf>10)->str,$<line>9,
491 ($<cbuf>7)->str,$<line>6,
493 g_string_free($<cbuf>10,FALSE);
494 g_string_free($<cbuf>7,FALSE);
495 class_nodes = g_list_append(class_nodes,node);
497 g_free($<id>3); g_free($<id>4);
498 g_free($<id>5); g_free($<id>8);
499 g_list_foreach($<list>2,(GFunc)g_free,NULL);
500 g_string_free($<cbuf>10,TRUE);
501 g_string_free($<cbuf>7,TRUE);
502 yyerror(_("parse error"));
506 | ARGUMENT flags argtype TOKEN TOKEN '{' CCODE ';' {
507 if(strcmp($<id>5,"get")==0) {
509 Type *type = pop_type();
511 node = new_argument($<id>3,type,$<list>2,$<id>4,
512 ($<cbuf>7)->str,$<line>6,
514 g_string_free($<cbuf>7,FALSE);
515 class_nodes = g_list_append(class_nodes,node);
516 } else if(strcmp($<id>5,"set")==0) {
518 Type *type = pop_type();
520 node = new_argument($<id>3,type,$<list>2,$<id>4,
521 NULL,0,($<cbuf>7)->str,
523 g_string_free($<cbuf>7,FALSE);
524 class_nodes = g_list_append(class_nodes,node);
526 g_free($<id>5); g_free($<id>3);
528 g_list_foreach($<list>2,(GFunc)g_free,NULL);
529 g_string_free($<cbuf>7,TRUE);
530 yyerror(_("parse error"));
534 | ARGUMENT flags argtype TOKEN TOKEN {
536 char *get, *set = NULL;
541 if(strcmp($<id>5, "link")!=0 &&
542 strcmp($<id>5, "stringlink")!=0 &&
543 strcmp($<id>5, "objectlink")!=0) {
544 g_free($<id>5); g_free($<id>3);
546 g_list_foreach($<list>2,(GFunc)g_free,NULL);
547 yyerror(_("parse error"));
553 var = find_var_or_die($<id>4, $<line>1);
554 if(var->scope == PRIVATE_SCOPE)
555 root = "self->_priv";
556 else if(var->scope == CLASS_SCOPE)
557 root = "SELF_CLASS(GTK_OBJECT(self)->klass)";
561 if(strcmp($<id>5, "link")==0) {
562 set = g_strdup_printf("%s->%s = ARG;",
564 } else if(strcmp($<id>5, "stringlink")==0) {
565 set = g_strdup_printf("g_free(%s->%s); "
566 "%s->%s = g_strdup(ARG);",
569 } else if(strcmp($<id>5, "objectlink")==0) {
570 set = g_strdup_printf(
572 "gtk_object_unref(GTK_OBJECT(%s->%s)); "
575 "gtk_object_ref(GTK_OBJECT(%s->%s));",
582 g_assert_not_reached();
585 if(strcmp($<id>5, "stringlink")==0) {
586 get = g_strdup_printf("ARG = g_strdup(%s->%s);", root, $<id>4);
588 /* For everything else, get is just straight assignment */
589 get = g_strdup_printf("ARG = %s->%s;", root, $<id>4);
595 type = copy_type(var->vtype);
597 node = new_argument($<id>3, type, $<list>2,
598 $<id>4, get, $<line>1,
599 set, $<line>1, $<line>1);
600 class_nodes = g_list_append(class_nodes,node);
604 argtype: TOKEN '(' TOKEN type ')' {
605 if(strcmp($<id>3,"type")!=0) {
608 yyerror(_("parse error"));
615 typestack = g_list_prepend(typestack,NULL);
619 flags: '(' flaglist ')' { $<list>$ = $<list>2; }
620 | { $<list>$ = NULL; }
623 flaglist: TOKEN '|' flaglist {
624 $<list>$ = g_list_append($<list>3,$<id>1);
627 $<list>$ = g_list_append(NULL,$<id>1);
632 type: specifier_list pointer {
633 Node *node = new_type($<id>1, $<id>2, NULL);
634 typestack = g_list_prepend(typestack,node);
637 Node *node = new_type($<id>1, NULL, NULL);
638 typestack = g_list_prepend(typestack,node);
642 /* The special cases are neccessary to avoid conflicts */
643 specifier_list: spec_list {
650 $<id>$ = g_strconcat("const ", $<id>2, NULL);
654 $<id>$ = g_strconcat($<id>1, " const", NULL);
657 | strunionenum TOKEN {
658 $<id>$ = g_strconcat($<id>1, " ", $<id>2, NULL);
661 | CONST strunionenum TOKEN {
662 $<id>$ = g_strconcat("const ", $<id>2, " ",
666 | strunionenum TOKEN CONST {
667 $<id>$ = g_strconcat($<id>1, " ",
668 $<id>2, " const", NULL);
673 /* The special const cases take care of conflicts ! */
674 spec_list: specifier spec_list {
675 $<id>$ = g_strconcat($<id>1, " ", $<id>2, NULL);
678 | TYPETOKEN spec_list {
679 $<id>$ = g_strconcat($<id>1, " ", $<id>2, NULL);
684 $<id>$ = g_strconcat("const ", $<id>2, NULL);
691 $<id>$ = g_strconcat($<id>1, " const", NULL);
695 $<id>$ = g_strdup($<id>1);
698 $<id>$ = g_strconcat($<id>1, " const", NULL);
702 specifier: VOID { $<id>$ = "void"; }
703 | CHAR { $<id>$ = "char"; }
704 | SHORT { $<id>$ = "short"; }
705 | INT { $<id>$ = "int"; }
706 | LONG { $<id>$ = "long"; }
707 | FLOAT { $<id>$ = "float"; }
708 | DOUBLE { $<id>$ = "double"; }
709 | SIGNED { $<id>$ = "signed"; }
710 | UNSIGNED { $<id>$ = "unsigned"; }
713 strunionenum: STRUCT { $<id>$ = "struct"; }
714 | UNION { $<id>$ = "union"; }
715 | ENUM { $<id>$ = "enum"; }
718 pointer: '*' { $<id>$ = g_strdup("*"); }
719 | '*' CONST { $<id>$ = g_strdup("* const"); }
721 $<id>$ = g_strconcat("*", $<id>2, NULL);
724 | '*' CONST pointer {
725 $<id>$ = g_strconcat("* const", $<id>3, NULL);
730 /* this never sets the_scope */
731 simplesigtype: TOKEN sigtype {
732 if(strcmp($<id>1, "first")==0)
733 $<sigtype>$ = SIGNAL_FIRST_METHOD;
734 else if(strcmp($<id>1, "last")==0)
735 $<sigtype>$ = SIGNAL_LAST_METHOD;
737 yyerror(_("signal must be 'first' or 'last'"));
744 $<sigtype>$ = SIGNAL_LAST_METHOD;
748 /* this always sets the_scope */
749 fullsigtype: scope TOKEN sigtype {
750 if(strcmp($<id>2,"first")==0)
751 $<sigtype>$ = SIGNAL_FIRST_METHOD;
752 else if(strcmp($<id>2,"last")==0)
753 $<sigtype>$ = SIGNAL_LAST_METHOD;
755 yyerror(_("signal must be 'first' or 'last'"));
761 | TOKEN scope sigtype {
762 if(strcmp($<id>1,"first")==0)
763 $<sigtype>$ = SIGNAL_FIRST_METHOD;
764 else if(strcmp($<id>1,"last")==0)
765 $<sigtype>$ = SIGNAL_LAST_METHOD;
767 yyerror(_("signal must be 'first' or 'last'"));
774 $<sigtype>$ = SIGNAL_LAST_METHOD;
777 /* the_scope was default thus public */
778 the_scope = PUBLIC_SCOPE;
782 sigtype: TOKEN '(' tokenlist ')' {
783 gtktypes = g_list_prepend(gtktypes, $<id>1);
787 tokenlist: tokenlist ',' TOKEN {
788 gtktypes = g_list_append(gtktypes, $<id>3);
791 gtktypes = g_list_append(gtktypes, $<id>1);
795 codenocode: '{' CCODE { $<cbuf>$ = $<cbuf>2; }
796 | ';' { $<cbuf>$ = NULL; }
799 /*here CCODE will include the ending '}' */
800 method: SIGNAL flags fullsigtype type TOKEN '(' funcargs ')' returnvals codenocode {
802 yyerror(_("signal without 'self' as "
804 free_all_global_state();
807 if(the_scope == CLASS_SCOPE) {
808 yyerror(_("a method cannot be of class scope"));
809 free_all_global_state();
812 push_function(the_scope, $<sigtype>3,NULL,
813 $<id>5, $<cbuf>10,$<line>1,
814 ccode_line, vararg, $<list>2);
816 | scope SIGNAL flags simplesigtype type TOKEN '(' funcargs ')' returnvals codenocode {
818 yyerror(_("signal without 'self' as "
820 free_all_global_state();
823 if(the_scope == CLASS_SCOPE) {
824 yyerror(_("a method cannot be of class scope"));
825 free_all_global_state();
828 push_function(the_scope, $<sigtype>4, NULL,
829 $<id>6, $<cbuf>11, $<line>2,
830 ccode_line, vararg, $<list>3);
832 | VIRTUAL scope type TOKEN '(' funcargs ')' returnvals codenocode {
834 yyerror(_("virtual method without 'self' as "
836 free_all_global_state();
839 if(the_scope == CLASS_SCOPE) {
840 yyerror(_("a method cannot be of class scope"));
841 free_all_global_state();
844 push_function(the_scope, VIRTUAL_METHOD, NULL, $<id>4,
846 ccode_line, vararg, NULL);
848 | scope VIRTUAL type TOKEN '(' funcargs ')' returnvals codenocode {
850 yyerror(_("virtual method without 'self' as "
852 free_all_global_state();
855 if(the_scope == CLASS_SCOPE) {
856 yyerror(_("a method cannot be of class scope"));
857 free_all_global_state();
860 push_function(the_scope, VIRTUAL_METHOD, NULL, $<id>4,
862 ccode_line, vararg, NULL);
864 | VIRTUAL type TOKEN '(' funcargs ')' returnvals codenocode {
866 yyerror(_("virtual method without 'self' as "
868 free_all_global_state();
871 push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL,
872 $<id>3, $<cbuf>8, $<line>1,
873 ccode_line, vararg, NULL);
875 | OVERRIDE '(' TYPETOKEN ')' type TOKEN '(' funcargs ')' returnvals codenocode {
876 push_function(NO_SCOPE, OVERRIDE_METHOD, $<id>3,
878 $<line>1, ccode_line,
881 | scope type TOKEN '(' funcargs ')' returnvals codenocode {
882 if(the_scope == CLASS_SCOPE) {
883 yyerror(_("a method cannot be of class scope"));
884 free_all_global_state();
887 push_function(the_scope, REGULAR_METHOD, NULL, $<id>3,
888 $<cbuf>8, $<line>1, ccode_line,
891 | TOKEN '(' TOKEN ')' codenocode {
892 if(strcmp($<id>1, "init")==0) {
893 push_init_arg($<id>3,FALSE);
894 push_function(NO_SCOPE, INIT_METHOD, NULL,
895 $<id>1, $<cbuf>5, $<line>2,
896 ccode_line, FALSE, NULL);
897 } else if(strcmp($<id>1, "class_init")==0) {
898 push_init_arg($<id>3,TRUE);
899 push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL,
900 $<id>1, $<cbuf>5, $<line>2,
901 ccode_line, FALSE, NULL);
905 g_string_free($<cbuf>5,TRUE);
906 yyerror(_("parse error "
907 "(untyped blocks must be init or "
914 returnvals: TOKEN retcode {
915 g_free(onerror); onerror = NULL;
916 g_free(defreturn); defreturn = NULL;
917 if(!set_return_value($<id>1, $<id>2)) {
920 yyerror(_("parse error"));
925 | TOKEN retcode TOKEN retcode {
926 g_free(onerror); onerror = NULL;
927 g_free(defreturn); defreturn = NULL;
928 if(!set_return_value($<id>1, $<id>2)) {
929 g_free($<id>1); g_free($<id>2);
930 g_free($<id>3); g_free($<id>4);
931 yyerror(_("parse error"));
934 if(!set_return_value($<id>3, $<id>4)) {
935 onerror = defreturn = NULL;
936 g_free($<id>1); g_free($<id>2);
937 g_free($<id>3); g_free($<id>4);
938 yyerror(_("parse error"));
945 g_free(onerror); onerror = NULL;
946 g_free(defreturn); defreturn = NULL;
950 retcode: numtok { $<id>$ = $<id>1; }
952 $<id>$ = ($<cbuf>3)->str;
953 g_string_free($<cbuf>3, FALSE);
957 funcargs: VOID { vararg = FALSE; has_self = FALSE; }
961 if(strcmp($<id>1,"self")==0)
965 yyerror(_("parse error"));
969 | TOKEN ',' arglist {
971 if(strcmp($<id>1,"self")==0)
975 yyerror(_("parse error"));
979 | arglist { has_self = FALSE; }
982 arglist: arglist1 ',' THREEDOTS { vararg = TRUE; }
983 | arglist1 { vararg = FALSE; }
986 arglist1: arglist1 ',' arg { ; }
991 push_funcarg($<id>2,NULL);
993 | type TOKEN ARRAY_DIM {
994 push_funcarg($<id>2,$<id>3);
996 | type TOKEN '(' TOKEN checklist ')' {
997 if(strcmp($<id>4,"check")!=0) {
998 yyerror(_("parse error"));
1002 push_funcarg($<id>2,NULL);
1004 | type TOKEN ARRAY_DIM '(' TOKEN checklist ')' {
1005 if(strcmp($<id>5,"check")!=0) {
1006 yyerror(_("parse error"));
1010 push_funcarg($<id>2,$<id>3);
1014 checklist: checklist check { ; }
1019 if(strcmp($<id>1,"type")==0) {
1020 Node *node = new_check(TYPE_CHECK,NULL);
1021 checks = g_list_append(checks,node);
1022 } else if(strcmp($<id>1,"null")==0) {
1023 Node *node = new_check(NULL_CHECK,NULL);
1024 checks = g_list_append(checks,node);
1026 yyerror(_("parse error"));
1032 Node *node = new_check(GT_CHECK,$<id>2);
1033 checks = g_list_append(checks,node);
1036 Node *node = new_check(LT_CHECK,$<id>2);
1037 checks = g_list_append(checks,node);
1040 Node *node = new_check(GE_CHECK,$<id>3);
1041 checks = g_list_append(checks,node);
1044 Node *node = new_check(LE_CHECK,$<id>3);
1045 checks = g_list_append(checks,node);
1048 Node *node = new_check(EQ_CHECK,$<id>3);
1049 checks = g_list_append(checks,node);
1052 Node *node = new_check(NE_CHECK,$<id>3);
1053 checks = g_list_append(checks,node);
1057 numtok: NUMBER { $<id>$ = $<id>1; }
1059 $<id>$ = g_strconcat("-",$<id>2,NULL);
1062 | TOKEN { $<id>$ = $<id>1; }