diff options
author | Colin Walters <walters@verbum.org> | 2010-07-07 18:18:37 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2010-07-08 14:42:54 -0400 |
commit | 017727630d09a854b1c1a4767066fb675b139de9 (patch) | |
tree | 015b9692d2225f1dbe6c6bacb37aae7ff8c54f82 /girepository/girparser.c | |
parent | cb268efadd68c0d67965e683a26966d760cd33ca (diff) | |
download | gobject-introspection-017727630d09a854b1c1a4767066fb675b139de9.tar.gz |
Move doc to toplevel element, write <any> for unknown containers
Moving to <doc> allows us to better preserve whitespace. XML has no
facility for whitespace-preserving attributes.
Second, for arrays and lists, both types with unknown element_type can
occur in the current scanner; it's least wrong if we write out an
<any> type.
Diffstat (limited to 'girepository/girparser.c')
-rw-r--r-- | girepository/girparser.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/girepository/girparser.c b/girepository/girparser.c index 5efe7fde..678edcc3 100644 --- a/girepository/girparser.c +++ b/girepository/girparser.c @@ -76,6 +76,7 @@ typedef enum STATE_ALIAS, /* 30 */ STATE_TYPE, STATE_ATTRIBUTE, + STATE_DOC, STATE_PASSTHROUGH } ParseState; @@ -1958,6 +1959,22 @@ end_type (ParseContext *ctx) } static gboolean +start_doc (GMarkupParseContext *context, + const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + ParseContext *ctx, + GError **error) +{ + if (strcmp (element_name, "doc") != 0 || ctx->node_stack == NULL) + return FALSE; + + state_switch (ctx, STATE_DOC); + + return TRUE; +} + +static gboolean start_attribute (GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, @@ -2570,6 +2587,9 @@ start_element_handler (GMarkupParseContext *context, attribute_names, attribute_values, ctx, error)) goto out; + else if (start_doc (context, element_name, attribute_names, + attribute_values, ctx, error)) + goto out; break; case 'e': @@ -3207,6 +3227,13 @@ end_element_handler (GMarkupParseContext *context, } break; + case STATE_DOC: + if (strcmp ("doc", element_name) == 0) + { + state_switch (ctx, ctx->prev_state); + } + break; + case STATE_PASSTHROUGH: ctx->unknown_depth -= 1; if (ctx->unknown_depth == 0) |