"error!=NULL && *error != NULL" upon return from callbacks,
it is only then that its valid to check for *error for error
conditions.
-
+ (g_markup_parse_context_parse): Add comment processing.
+
Only release one element of the list.
* test/markup.c: Incorporate the kind of code that is used in Mono
* "return to caller" and only at end parse this would be a fatal
* error.
*
- * Not that it matters to Mono, but it is very simple to change.
+ * Not that it matters to Mono, but it is very simple to change, there
+ * is a tricky situation: there are a few places where we check p+n
+ * in the source, and that would have to change to be progressive, instead
+ * of depending on the string to be complete at that point, so we would
+ * have to introduce extra states to cope with that.
*
* Author:
* Miguel de Icaza (miguel@novell.com)
START_ELEMENT,
TEXT,
FLUSH_TEXT,
- CLOSING_ELEMENT
+ CLOSING_ELEMENT,
+ COMMENT
} ParseState;
struct _GMarkupParseContext {
set_error ("Unfinished element");
goto fail;
}
+
+ if (*p == '!' && (p+2 < end) && (p [1] == '-') && (p [2] == '-')){
+ context->state = COMMENT;
+ p += 2;
+ break;
+ }
+
if (!(isascii (*p) && isalpha (*p))){
set_error ("Expected an element name");
goto fail;
break;
}
+ case COMMENT:
+ if (*p != '-')
+ break;
+ if (p+2 < end && (p [1] == '-') && (p [2] == '>')){
+ context->state = TEXT;
+ p += 2;
+ break;
+ }
+
+
case FLUSH_TEXT:
if (context->parser.text != NULL){
context->parser.text (context, context->text->str, context->text->len,
{
AppConfigInfo *info;
- info = domain_test ("<configuration><startup><requiredRuntime version=\"v1\"></requiredRuntime></startup></configuration>");
+ info = domain_test ("<configuration><!--hello--><startup><!--world--><requiredRuntime version=\"v1\"><!--r--></requiredRuntime></startup></configuration>");
if (info->required_runtime == NULL)
return FAILED ("No required runtime section");
if (strcmp (info->required_runtime, "v1") != 0)
return FAILED ("Got a runtime version %s, expected v1", info->required_runtime);
domain_free (info);
- info = domain_test ("<configuration><startup><requiredRuntime version=\"v1\"/></configuration>");
+ info = domain_test ("<configuration><startup><requiredRuntime version=\"v1\"/><!--comment--></configuration><!--end-->");
if (info->required_runtime == NULL)
return FAILED ("No required runtime section on auto-close section");
if (strcmp (info->required_runtime, "v1") != 0)
return FAILED ("Got a runtime version %s, expected v1", info->required_runtime);
domain_free (info);
- info = domain_test ("<configuration><startup><supportedRuntime version=\"v1\"><supportedRuntime version=\"v2\"/></startup></configuration>");
+ info = domain_test ("<!--start--><configuration><startup><supportedRuntime version=\"v1\"/><!--middle--><supportedRuntime version=\"v2\"/></startup></configuration>");
if ((strcmp ((char*)info->supported_runtimes->data, "v1") == 0)){
if (info->supported_runtimes->next == NULL)
return FAILED ("Expected 2 supported runtimes");