+ g_list_free($<list>2);
+ yyerror(_("parse error"));
+ YYERROR;
+ }
+
+ type = pop_type();
+
+ var = find_var_or_die($<id>4, $<line>1);
+ if(var->scope == PRIVATE_SCOPE)
+ root = "self->_priv";
+ else if(var->scope == CLASS_SCOPE) {
+ root = "SELF_GET_CLASS(self)";
+ if(no_self_alias)
+ error_print(GOB_ERROR, $<line>1,
+ _("Self aliases needed when autolinking to a classwide member"));
+ } else
+ root = "self";
+
+ if(strcmp($<id>6, "link")==0) {
+ set = g_strdup_printf("%s->%s = ARG;",
+ root, $<id>4);
+ } else if(strcmp($<id>6, "stringlink")==0) {
+ set = g_strdup_printf("g_free (%s->%s); "
+ "%s->%s = g_strdup (ARG);",
+ root, $<id>4,
+ root, $<id>4);
+ } else if(strcmp($<id>6, "objectlink")==0) {
+ set = g_strdup_printf(
+ "if (ARG != NULL) "
+ "g_object_ref (G_OBJECT (ARG)); "
+ "if (%s->%s != NULL) "
+ "g_object_unref (G_OBJECT (%s->%s)); "
+ "%s->%s = ARG;",
+ root, $<id>4,
+ root, $<id>4,
+ root, $<id>4);
+ } else {
+ g_assert_not_reached();
+ }
+
+ get = g_strdup_printf("ARG = %s->%s;", root, $<id>4);
+
+ g_free ($<id>6);
+
+ if (type == NULL)
+ type = (Type *)node_copy ((Node *)var->vtype);
+
+ node = node_new (ARGUMENT_NODE,
+ "gtktype:steal", $<id>3,
+ "atype:steal", type,
+ "flags:steal", $<list>2,
+ "name:steal", $<id>4,
+ "get:steal", get,
+ "get_line", $<line>1,
+ "set:steal", set,
+ "set_line", $<line>1,
+ "line_no", $<line>1,
+ NULL);
+
+ if ($<id>5 != NULL) {
+ Argument *arg = (Argument *)node;
+ export_accessors (arg->name,
+ arg->get != NULL, arg->get_line,
+ arg->set != NULL, arg->set_line,
+ arg->atype,
+ arg->gtktype,
+ arg->line_no);
+ g_free ($<id>5);
+ }
+
+ class_nodes = g_list_append (class_nodes, node);
+ }
+ ;
+
+export: '(' TOKEN ')' {
+ if (strcmp ($<id>2, "export")!=0) {
+ g_free ($<id>2);
+ yyerror (_("parse error"));
+ YYERROR;
+ }
+ $<id>$ = $<id>2;
+ }
+ | {
+ $<id>$ = NULL;
+ }
+ ;
+
+property: PROPERTY TOKEN TOKEN param_spec TOKEN '{' CCODE TOKEN '{' CCODE ';' {
+ ensure_property ();
+ node_set ((Node *)property,
+ "line_no", $<line>1,
+ "gtktype:steal", debool ($<id>2),
+ "name:steal", $<id>3,
+ NULL);
+ if (strcmp ($<id>5, "get") == 0 &&
+ strcmp ($<id>8, "set") == 0) {
+ node_set ((Node *)property,
+ "get:steal", ($<cbuf>7)->str,
+ "get_line", $<line>6,
+ "set:steal", ($<cbuf>10)->str,
+ "set_line", $<line>9,
+ NULL);
+ g_string_free ($<cbuf>7, FALSE);
+ g_string_free ($<cbuf>10, FALSE);
+ g_free ($<id>5);
+ g_free ($<id>8);
+ } else if (strcmp ($<id>5, "set") == 0 &&
+ strcmp ($<id>8, "get") == 0) {
+ node_set ((Node *)property,
+ "get:steal", ($<cbuf>10)->str,
+ "get_line", $<line>9,
+ "set:steal", ($<cbuf>7)->str,
+ "set_line", $<line>6,
+ NULL);
+ g_string_free ($<cbuf>7, FALSE);
+ g_string_free ($<cbuf>10, FALSE);
+ g_free ($<id>5);
+ g_free ($<id>8);
+ } else {
+ g_string_free ($<cbuf>7, TRUE);
+ g_string_free ($<cbuf>10, TRUE);
+ g_free ($<id>5);
+ g_free ($<id>8);
+ node_free ((Node *)property);
+ property = NULL;
+ yyerror (_("parse error"));
+ YYERROR;
+ }
+ property_link_and_export ((Node *)property);
+ if (property != NULL) {
+ class_nodes = g_list_append (class_nodes,
+ property);
+ property = NULL;
+ }
+ }
+ | PROPERTY TOKEN TOKEN param_spec TOKEN '{' CCODE ';' {
+ ensure_property ();
+ node_set ((Node *)property,
+ "line_no", $<line>1,
+ "gtktype:steal", debool ($<id>2),
+ "name:steal", $<id>3,
+ NULL);
+ if (strcmp ($<id>5, "get") == 0) {
+ node_set ((Node *)property,
+ "get:steal", ($<cbuf>7)->str,
+ "get_line", $<line>6,
+ NULL);
+ g_string_free ($<cbuf>7, FALSE);
+ g_free ($<id>5);
+ } else if (strcmp ($<id>5, "set") == 0) {
+ node_set ((Node *)property,
+ "set:steal", ($<cbuf>7)->str,
+ "set_line", $<line>6,
+ NULL);
+ g_string_free ($<cbuf>7, FALSE);
+ g_free ($<id>5);
+ } else {
+ g_string_free ($<cbuf>7, TRUE);
+ g_free ($<id>5);
+ node_free ((Node *)property);
+ property = NULL;
+ yyerror (_("parse error"));
+ YYERROR;
+ }
+ property_link_and_export ((Node *)property);
+ if (property != NULL) {
+ class_nodes = g_list_append (class_nodes,
+ property);
+ property = NULL;
+ }
+ }
+ | PROPERTY TOKEN TOKEN param_spec ';' {
+ ensure_property ();
+ node_set ((Node *)property,
+ "line_no", $<line>1,
+ "gtktype:steal", debool ($<id>2),
+ "name:steal", $<id>3,
+ NULL);
+ property_link_and_export ((Node *)property);
+ if (property != NULL) {
+ class_nodes = g_list_append (class_nodes,
+ property);
+ property = NULL;
+ }
+ }
+ ;
+
+param_spec: '(' param_spec_list ')' { ; }
+ | { ; }
+ ;
+
+param_spec_list: param_spec_list ',' param_spec_value { ; }
+ | param_spec_value { ; }
+ ;
+
+string: STRING { $<id>$ = $<id>1; }
+ | TOKEN '(' STRING ')' {
+ if (strcmp ($<id>1, "_") != 0) {
+ g_free ($<id>1);
+ yyerror(_("parse error"));
+ YYERROR;
+ }
+ g_free ($<id>1);
+ $<id>$ = g_strconcat ("_(", $<id>3, ")", NULL);
+ g_free ($<id>3);
+ }
+ ;
+
+anyval: numtok { $<id>$ = $<id>1; }
+ | string { $<id>$ = $<id>1; }
+ ;
+
+param_spec_value: NICK '=' string {
+ ensure_property ();
+ node_set ((Node *)property,
+ "nick:steal", $<id>3,
+ NULL);
+ }
+ | BLURB '=' string {
+ ensure_property ();
+ node_set ((Node *)property,
+ "blurb:steal", $<id>3,
+ NULL);
+ }
+ | MAXIMUM '=' numtok {
+ ensure_property ();
+ node_set ((Node *)property,
+ "maximum:steal", $<id>3,
+ NULL);
+ }
+ | MINIMUM '=' numtok {
+ ensure_property ();
+ node_set ((Node *)property,
+ "minimum:steal", $<id>3,
+ NULL);
+ }
+ | DEFAULT_VALUE '=' anyval {
+ ensure_property ();
+ node_set ((Node *)property,
+ "default_value:steal", $<id>3,
+ NULL);
+ }
+ | FLAGS '=' flaglist {
+ ensure_property ();
+ node_set ((Node *)property,
+ "flags:steal", $<list>3,
+ NULL);
+ }
+ | TYPE '=' type {
+ Type *type = pop_type ();
+ ensure_property ();
+ node_set ((Node *)property,
+ "ptype:steal", type,
+ NULL);
+ }
+ | FLAGS_TYPE '=' TOKEN {
+ ensure_property ();
+ node_set ((Node *)property,
+ "extra_gtktype:steal", $<id>3,
+ NULL);
+ }
+ | ENUM_TYPE '=' TOKEN {
+ ensure_property ();
+ node_set ((Node *)property,
+ "extra_gtktype:steal", $<id>3,
+ NULL);
+ }
+ | PARAM_TYPE '=' TOKEN {
+ ensure_property ();
+ node_set ((Node *)property,
+ "extra_gtktype:steal", $<id>3,
+ NULL);
+ }
+ | BOXED_TYPE '=' TOKEN {
+ ensure_property ();
+ node_set ((Node *)property,
+ "extra_gtktype:steal", $<id>3,
+ NULL);
+ }
+ | OBJECT_TYPE '=' TOKEN {
+ ensure_property ();
+ node_set ((Node *)property,
+ "extra_gtktype:steal", $<id>3,
+ NULL);
+ }
+ | TOKEN {
+ ensure_property ();
+ if (strcmp ($<id>1, "link") == 0) {
+ g_free($<id>1);
+ node_set ((Node *)property,
+ "link", TRUE,
+ NULL);
+ } else if (strcmp ($<id>1, "export") == 0) {
+ g_free($<id>1);
+ node_set ((Node *)property,
+ "export", TRUE,
+ NULL);
+ } else {
+ g_free($<id>1);
+ yyerror(_("parse error"));
+ YYERROR;
+ }
+ }
+ ;
+
+argtype: TOKEN '(' TOKEN type ')' {
+ if(strcmp($<id>3,"type")!=0) {
+ g_free($<id>1);
+ g_free($<id>3);