From a8588da4c619abcafde892ffb9359e2c84d13eed Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Thu, 7 Sep 2017 09:56:40 +0200 Subject: [PATCH] valadoc: Drop custom MarkupReader --- libvaladoc/Makefile.am | 5 +- .../importer/girdocumentationimporter.vala | 58 ++- libvaladoc/importer/internalidregistrar.vala | 26 +- libvaladoc/markupreader.vala | 334 ------------------ libvaladoc/markupsourcelocation.vala | 39 -- libvaladoc/markuptokentype.vala | 51 --- valadoc/tests/libvaladoc/markupreader.vala | 42 +-- 7 files changed, 65 insertions(+), 490 deletions(-) delete mode 100644 libvaladoc/markupreader.vala delete mode 100644 libvaladoc/markupsourcelocation.vala delete mode 100644 libvaladoc/markuptokentype.vala diff --git a/libvaladoc/Makefile.am b/libvaladoc/Makefile.am index 2a09d5d07..7499a7ada 100644 --- a/libvaladoc/Makefile.am +++ b/libvaladoc/Makefile.am @@ -11,6 +11,7 @@ AM_CFLAGS = \ $(GLIB_CFLAGS) \ $(GMODULE_CFLAGS) \ -I$(top_srcdir)/gee \ + -I$(top_srcdir)/vala \ $(NULL) AM_VALAFLAGS = \ @@ -33,9 +34,6 @@ libvaladoc_la_VALASOURCES = \ gtkdocmarkupwriter.vala \ devhelp-markupwriter.vala \ ctyperesolver.vala \ - markupsourcelocation.vala \ - markuptokentype.vala \ - markupreader.vala \ gtkdocrenderer.vala \ documentation/commentscanner.vala \ documentation/documentation.vala \ @@ -186,6 +184,7 @@ libvaladoc.vala.stamp: $(libvaladoc_la_VALASOURCES) --vapidir $(top_srcdir)/vapi --pkg gmodule-2.0 \ --vapidir $(top_srcdir)/vapi --pkg libgvc \ --vapidir $(top_srcdir)/gee --pkg gee \ + --vapidir $(top_srcdir)/vala --pkg vala \ --pkg config \ $(filter %.vala %.c,$^) touch $@ diff --git a/libvaladoc/importer/girdocumentationimporter.vala b/libvaladoc/importer/girdocumentationimporter.vala index e64dfc684..8e4b6d4c0 100644 --- a/libvaladoc/importer/girdocumentationimporter.vala +++ b/libvaladoc/importer/girdocumentationimporter.vala @@ -34,13 +34,12 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { } } - private MarkupTokenType current_token; - private MarkupSourceLocation begin; - private MarkupSourceLocation end; - private MarkupReader reader; + private Vala.MarkupTokenType current_token; + private Vala.SourceLocation begin; + private Vala.SourceLocation end; + private Vala.MarkupReader reader; private DocumentationParser parser; - private ErrorReporter reporter; private Api.SourceFile file; private string parent_c_identifier; @@ -60,14 +59,13 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { ErrorReporter reporter) { base (tree, modules, settings); - this.reporter = reporter; this.parser = parser; } public override void process (string source_file) { this.file = new Api.SourceFile (new Api.Package (Path.get_basename (source_file), true, null), source_file, null, null); - this.reader = new MarkupReader (source_file, reporter); + this.reader = new Vala.MarkupReader (source_file); // xml prolog next (); @@ -162,34 +160,32 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { } private void warning (string message) { - reporter.warning (this.file.relative_path, this.begin.line, this.begin.column, this.end.column, - this.reader.get_line_content (this.begin.line), message); + Vala.Report.warning (new Vala.SourceReference ((Vala.SourceFile) file.data, begin, end), message); } private void error (string message) { - reporter.error (this.file.relative_path, this.begin.line, this.begin.column, this.end.column, - this.reader.get_line_content (this.begin.line), message); + Vala.Report.error (new Vala.SourceReference ((Vala.SourceFile) file.data, begin, end), message); } private void next () { current_token = reader.read_token (out begin, out end); // Skip (only generated by valac) - if (current_token == MarkupTokenType.START_ELEMENT && reader.name == "annotation") { + if (current_token == Vala.MarkupTokenType.START_ELEMENT && reader.name == "annotation") { next (); // MarkupTokenType.END_ELEMENT, annotation next (); } } private void start_element (string name) { - if (current_token != MarkupTokenType.START_ELEMENT || reader.name != name) { + if (current_token != Vala.MarkupTokenType.START_ELEMENT || reader.name != name) { // error error ("expected start element of `%s'".printf (name)); } } private void end_element (string name) { - if (current_token != MarkupTokenType.END_ELEMENT || reader.name != name) { + if (current_token != Vala.MarkupTokenType.END_ELEMENT || reader.name != name) { // error error ("expected end element of `%s'".printf (name)); } @@ -207,7 +203,7 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { } next (); - while (current_token == MarkupTokenType.START_ELEMENT) { + while (current_token == Vala.MarkupTokenType.START_ELEMENT) { if (reader.name == "namespace") { parse_namespace (); } else if (reader.name == "include") { @@ -251,11 +247,11 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { int level = 1; while (level > 0) { - if (current_token == MarkupTokenType.START_ELEMENT) { + if (current_token == Vala.MarkupTokenType.START_ELEMENT) { level++; - } else if (current_token == MarkupTokenType.END_ELEMENT) { + } else if (current_token == Vala.MarkupTokenType.END_ELEMENT) { level--; - } else if (current_token == MarkupTokenType.EOF) { + } else if (current_token == Vala.MarkupTokenType.EOF) { error ("unexpected end of file"); break; } @@ -267,7 +263,7 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { start_element ("namespace"); next (); - while (current_token == MarkupTokenType.START_ELEMENT) { + while (current_token == Vala.MarkupTokenType.START_ELEMENT) { if (reader.name == "alias") { parse_alias (); } else if (reader.name == "enumeration") { @@ -321,7 +317,7 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { next (); - if (current_token == MarkupTokenType.TEXT) { + if (current_token == Vala.MarkupTokenType.TEXT) { comment = new Api.GirSourceComment (reader.content, file, begin.line, begin.column, end.line, end.column); next (); @@ -379,7 +375,7 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { Api.SourceComment? comment = null; - if (current_token == MarkupTokenType.TEXT) { + if (current_token == Vala.MarkupTokenType.TEXT) { comment = new Api.SourceComment (reader.content, file, begin.line, begin.column, end.line, end.column); next (); @@ -397,7 +393,7 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { Api.GirSourceComment? comment = parse_symbol_doc (); attach_comment (this.parent_c_identifier, comment); - while (current_token == MarkupTokenType.START_ELEMENT) { + while (current_token == Vala.MarkupTokenType.START_ELEMENT) { if (reader.name == "member") { parse_enumeration_member (); } else if (reader.name == "function") { @@ -515,7 +511,7 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { attach_comment (this.parent_c_identifier, comment); } - while (current_token == MarkupTokenType.START_ELEMENT) { + while (current_token == Vala.MarkupTokenType.START_ELEMENT) { if (reader.name == "field") { parse_field (); } else if (reader.name == "constructor") { @@ -545,7 +541,7 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { Api.GirSourceComment? comment = parse_symbol_doc (); attach_comment (this.parent_c_identifier, comment); - while (current_token == MarkupTokenType.START_ELEMENT) { + while (current_token == Vala.MarkupTokenType.START_ELEMENT) { if (reader.name == "implements") { skip_element (); } else if (reader.name == "constant") { @@ -585,7 +581,7 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { Api.GirSourceComment? comment = parse_symbol_doc (); attach_comment (this.parent_c_identifier, comment); - while (current_token == MarkupTokenType.START_ELEMENT) { + while (current_token == Vala.MarkupTokenType.START_ELEMENT) { if (reader.name == "prerequisite") { skip_element (); } else if (reader.name == "field") { @@ -688,7 +684,7 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { string[] param_names = new string[0]; int array_length_ret = -1; - if (current_token == MarkupTokenType.START_ELEMENT && reader.name == "return-value") { + if (current_token == Vala.MarkupTokenType.START_ELEMENT && reader.name == "return-value") { Api.SourceComment? return_comment; parse_return_value (out return_comment, out array_length_ret); if (return_comment != null) { @@ -701,11 +697,11 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { } - if (current_token == MarkupTokenType.START_ELEMENT && reader.name == "parameters") { + if (current_token == Vala.MarkupTokenType.START_ELEMENT && reader.name == "parameters") { start_element ("parameters"); next (); - if (current_token == MarkupTokenType.START_ELEMENT && reader.name == "instance-parameter") { + if (current_token == Vala.MarkupTokenType.START_ELEMENT && reader.name == "instance-parameter") { string instance_param_name = reader.get_attribute ("name"); next (); @@ -724,7 +720,7 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { } } - for (int pcount = 0; current_token == MarkupTokenType.START_ELEMENT; pcount++) { + for (int pcount = 0; current_token == Vala.MarkupTokenType.START_ELEMENT; pcount++) { Api.SourceComment? param_comment; int array_length_pos; int destroy_pos; @@ -787,7 +783,7 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { // TODO: process comments - while (current_token == MarkupTokenType.START_ELEMENT) { + while (current_token == Vala.MarkupTokenType.START_ELEMENT) { if (reader.name == "field") { parse_field (); } else if (reader.name == "constructor") { @@ -821,7 +817,7 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter { Api.GirSourceComment? comment = parse_symbol_doc (); attach_comment (this.parent_c_identifier, comment); - while (current_token == MarkupTokenType.START_ELEMENT) { + while (current_token == Vala.MarkupTokenType.START_ELEMENT) { if (reader.name == "field") { parse_field (); } else if (reader.name == "constructor") { diff --git a/libvaladoc/importer/internalidregistrar.vala b/libvaladoc/importer/internalidregistrar.vala index c92cf3f06..8bad9ab1e 100644 --- a/libvaladoc/importer/internalidregistrar.vala +++ b/libvaladoc/importer/internalidregistrar.vala @@ -48,37 +48,41 @@ public class Valadoc.Importer.InternalIdRegistrar { public void read_index_sgml_file (string filename, string? index_sgml_online, ErrorReporter reporter) { - MarkupSourceLocation begin; - MarkupSourceLocation end; - MarkupTokenType token; + Vala.SourceLocation begin; + Vala.SourceLocation end; + Vala.MarkupTokenType token; string base_path = index_sgml_online ?? realpath (filename); - var reader = new MarkupReader (filename, reporter); + var reader = new Vala.MarkupReader (filename); - while ((token = reader.read_token (out begin, out end)) != MarkupTokenType.EOF) { - if (token == MarkupTokenType.START_ELEMENT && reader.name == "ONLINE") { + while ((token = reader.read_token (out begin, out end)) != Vala.MarkupTokenType.EOF) { + if (token == Vala.MarkupTokenType.START_ELEMENT && reader.name == "ONLINE") { if (index_sgml_online == null) { base_path = reader.get_attribute ("href"); if (base_path == null) { - reporter.error (filename, begin.line, begin.column, end.column, reader.get_line_content (begin.line), "missing attribute `href' in "); + //reporter.error (filename, begin.line, begin.column, end.column, reader.get_line_content (begin.line), "missing attribute `href' in "); + Vala.Report.error (null, "missing attribute `href' in "); } } - } else if (token == MarkupTokenType.START_ELEMENT && reader.name == "ANCHOR") { + } else if (token == Vala.MarkupTokenType.START_ELEMENT && reader.name == "ANCHOR") { string id = reader.get_attribute ("id"); if (id == null) { - reporter.error (filename, begin.line, begin.column, end.column, reader.get_line_content (begin.line), "missing attribute `id' in "); + //reporter.error (filename, begin.line, begin.column, end.column, reader.get_line_content (begin.line), "missing attribute `id' in "); + Vala.Report.error (null, "missing attribute `id' in "); } string href = reader.get_attribute ("href"); if (href == null) { - reporter.error (filename, begin.line, begin.column, end.column, reader.get_line_content (begin.line), "missing attribute `href' in "); + //reporter.error (filename, begin.line, begin.column, end.column, reader.get_line_content (begin.line), "missing attribute `href' in "); + Vala.Report.error (null, "missing attribute `href' in "); } else if (index_sgml_online != null) { href = Path.get_basename (href); } map.set (id, Path.build_path ("/", base_path, href)); } else { - reporter.error (filename, begin.line, begin.column, end.column, reader.get_line_content (begin.line), "expected element of or "); + //reporter.error (filename, begin.line, begin.column, end.column, reader.get_line_content (begin.line), "expected element of or "); + Vala.Report.error (null, "expected element of or "); } } } diff --git a/libvaladoc/markupreader.vala b/libvaladoc/markupreader.vala deleted file mode 100644 index c2e10a494..000000000 --- a/libvaladoc/markupreader.vala +++ /dev/null @@ -1,334 +0,0 @@ -/* markupreader.vala - * - * Copyright (C) 2008-2009 Jürg Billeter - * Copyright (C) 2011 Florian Brosch - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: - * Jürg Billeter - */ - - -/** - * Simple reader for a subset of XML. - */ -public class Valadoc.MarkupReader : Object { - public string filename { - private set; - get; - } - - public string name { - private set; - get; - } - - public string content { - private set; - get; - } - - private MappedFile mapped_file; - - private string[] lines; - private char* begin; - private char* current; - private char* end; - - private int line; - private int column; - - private Vala.Map attributes = new Vala.HashMap (str_hash, str_equal); - private bool empty_element; - - private ErrorReporter reporter; - - public MarkupReader.from_string (string filename, string content, ErrorReporter reporter) { - this.filename = filename; - this.reporter = reporter; - - lines = content.split ("\n"); - begin = content; - end = begin + content.length; - current = begin; - - column = 1; - line = 1; - } - - public MarkupReader (string filename, ErrorReporter reporter) { - this.filename = filename; - this.reporter = reporter; - - try { - mapped_file = new MappedFile (filename, false); - begin = mapped_file.get_contents (); - lines = ((string) begin).split ("\n"); - end = begin + mapped_file.get_length (); - - current = begin; - - line = 1; - column = 1; - } catch (FileError e) { - reporter.simple_error (null, "Unable to map file '%s': %s", filename, e.message); - } - } - - public string? get_line_content (int line_nr) { - if (this.lines.length > line_nr) { - return this.lines[line_nr]; - } - - return null; - } - - public string? get_attribute (string attr) { - return attributes[attr]; - } - - /* - * Returns a copy of the current attributes. - * - * @return map of current attributes - */ - public Vala.Map get_attributes () { - var result = new Vala.HashMap (str_hash, str_equal); - foreach (var key in attributes.get_keys ()) { - result.set (key, attributes.get (key)); - } - return result; - } - - private string read_name () { - char* begin = current; - while (current < end) { - if (current[0] == ' ' || current[0] == '\t' || current[0] == '>' - || current[0] == '/' || current[0] == '=' || current[0] == '\n') { - break; - } - unichar u = ((string) current).get_char_validated ((long) (end - current)); - if (u != (unichar) (-1)) { - current += u.to_utf8 (null); - } else { - reporter.simple_error ("%s:%d".printf (filename, line), - "invalid UTF-8 character"); - } - } - if (current == begin) { - // syntax error: invalid name - } - return ((string) begin).substring (0, (int) (current - begin)); - } - - public MarkupTokenType read_token (out MarkupSourceLocation token_begin, out MarkupSourceLocation token_end) { - attributes.clear (); - - if (empty_element) { - empty_element = false; - token_begin = MarkupSourceLocation (begin, line, column); - token_end = MarkupSourceLocation (begin, line, column); - return MarkupTokenType.END_ELEMENT; - } - - content = null; - name = null; - - space (); - - MarkupTokenType type = MarkupTokenType.NONE; - char* begin = current; - token_begin = MarkupSourceLocation (begin, line, column); - - if (current >= end) { - type = MarkupTokenType.EOF; - } else if (current[0] == '<') { - current++; - if (current >= end) { - // error - } else if (current[0] == '?') { - // processing instruction - } else if (current[0] == '!') { - // comment or doctype - current++; - if (current < end - 1 && current[0] == '-' && current[1] == '-') { - // comment - current += 2; - while (current < end - 2) { - if (current[0] == '-' && current[1] == '-' && current[2] == '>') { - // end of comment - current += 3; - break; - } else if (current[0] == '\n') { - line++; - column = 0; - } - current++; - } - - // ignore comment, read next token - return read_token (out token_begin, out token_end); - } - } else if (current[0] == '/') { - type = MarkupTokenType.END_ELEMENT; - current++; - name = read_name (); - if (current >= end || current[0] != '>') { - // error - } - current++; - } else { - type = MarkupTokenType.START_ELEMENT; - name = read_name (); - space (); - while (current < end && current[0] != '>' && current[0] != '/') { - string attr_name = read_name (); - if (current >= end || current[0] != '=') { - // error - } - current++; - // FIXME allow single quotes - if (current >= end || current[0] != '"') { - // error - } - current++; - - string attr_value = text ('"', false); - - if (current >= end || current[0] != '"') { - // error - } - current++; - attributes.set (attr_name, attr_value); - space (); - } - if (current[0] == '/') { - empty_element = true; - current++; - space (); - } else { - empty_element = false; - } - if (current >= end || current[0] != '>') { - // error - } - current++; - } - } else { - space (); - - if (current[0] != '<') { - content = text ('<', true); - } else { - // no text - // read next token - return read_token (out token_begin, out token_end); - } - - type = MarkupTokenType.TEXT; - } - - token_end = MarkupSourceLocation (current, line, column - 1); - - return type; - } - - private string text (char end_char, bool rm_trailing_whitespace) { - StringBuilder content = new StringBuilder (); - char* text_begin = current; - char* last_linebreak = current; - - while (current < end && current[0] != end_char) { - unichar u = ((string) current).get_char_validated ((long) (end - current)); - if (u == (unichar) (-1)) { - reporter.simple_error ("%s:%d".printf (filename, line), - "invalid UTF-8 character"); - } else if (u == '&') { - char* next_pos = current + u.to_utf8 (null); - if (((string) next_pos).has_prefix ("amp;")) { - content.append (((string) text_begin).substring (0, (int) (current - text_begin))); - content.append_c ('&'); - current += 5; - text_begin = current; - } else if (((string) next_pos).has_prefix ("quot;")) { - content.append (((string) text_begin).substring (0, (int) (current - text_begin))); - content.append_c ('"'); - current += 6; - text_begin = current; - } else if (((string) next_pos).has_prefix ("apos;")) { - content.append (((string) text_begin).substring (0, (int) (current - text_begin))); - content.append_c ('\''); - current += 6; - text_begin = current; - } else if (((string) next_pos).has_prefix ("lt;")) { - content.append (((string) text_begin).substring (0, (int) (current - text_begin))); - content.append_c ('<'); - current += 4; - text_begin = current; - } else if (((string) next_pos).has_prefix ("gt;")) { - content.append (((string) text_begin).substring (0, (int) (current - text_begin))); - content.append_c ('>'); - current += 4; - text_begin = current; - } else if (((string) next_pos).has_prefix ("percnt;")) { - content.append (((string) text_begin).substring (0, (int) (current - text_begin))); - content.append_c ('%'); - current += 8; - text_begin = current; - } else { - current += u.to_utf8 (null); - } - } else { - if (u == '\n') { - line++; - column = 0; - last_linebreak = current; - } - - current += u.to_utf8 (null); - column++; - } - } - - if (text_begin != current) { - content.append (((string) text_begin).substring (0, (int) (current - text_begin))); - } - - column += (int) (current - last_linebreak); - - // Removes trailing whitespace - if (rm_trailing_whitespace) { - char* str_pos = ((char*)content.str) + content.len; - for (str_pos--; str_pos > ((char*)content.str) && str_pos[0].isspace(); str_pos--); - content.erase ((ssize_t) (str_pos-((char*) content.str) + 1), -1); - } - - return content.str; - } - - private void space () { - while (current < end && current[0].isspace ()) { - if (current[0] == '\n') { - line++; - column = 0; - } - current++; - column++; - } - } -} - - diff --git a/libvaladoc/markupsourcelocation.vala b/libvaladoc/markupsourcelocation.vala deleted file mode 100644 index af7dff1b2..000000000 --- a/libvaladoc/markupsourcelocation.vala +++ /dev/null @@ -1,39 +0,0 @@ -/* valasourcelocation.vala - * - * Copyright (C) 2008 Jürg Billeter - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: - * Jürg Billeter - */ - -using GLib; - -/** - * Represents a position in a source file. - */ -public struct Valadoc.MarkupSourceLocation { - public char* pos; - public int line; - public int column; - - public MarkupSourceLocation (char* _pos, int _line, int _column) { - pos = _pos; - line = _line; - column = _column; - } -} - diff --git a/libvaladoc/markuptokentype.vala b/libvaladoc/markuptokentype.vala deleted file mode 100644 index d2dcad74f..000000000 --- a/libvaladoc/markuptokentype.vala +++ /dev/null @@ -1,51 +0,0 @@ -/* markuptokentype.vala - * - * Copyright (C) 2008-2009 Jürg Billeter - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: - * Jürg Billeter - */ - - -public enum Valadoc.MarkupTokenType { - NONE, - COMMENT, - START_ELEMENT, - END_ELEMENT, - TEXT, - EOF; - - public string to_string () { - switch (this) { - case START_ELEMENT: - return "start element"; - - case END_ELEMENT: - return "end element"; - - case TEXT: - return "text"; - - case EOF: - return "end of file"; - - default: - return "unknown token type"; - } - } -} - diff --git a/valadoc/tests/libvaladoc/markupreader.vala b/valadoc/tests/libvaladoc/markupreader.vala index 3681b7e99..363e4b462 100644 --- a/valadoc/tests/libvaladoc/markupreader.vala +++ b/valadoc/tests/libvaladoc/markupreader.vala @@ -36,12 +36,12 @@ public static void positive_1 () { """; - var reader = new MarkupReader.from_string ("testfile", content, reporter); + var reader = new Vala.MarkupReader.from_string ("testfile", content); assert (reader.filename == "testfile"); - MarkupSourceLocation begin; - MarkupSourceLocation end; - MarkupTokenType token; + Vala.SourceLocation begin; + Vala.SourceLocation end; + Vala.MarkupTokenType token; token = reader.read_token (out begin, out end); @@ -49,7 +49,7 @@ public static void positive_1 () { token = reader.read_token (out begin, out end); - assert (token == MarkupTokenType.START_ELEMENT); + assert (token == Vala.MarkupTokenType.START_ELEMENT); assert (reader.name == "root-element"); assert (reader.content == null); assert (reader.get_attributes ().size == 0); @@ -59,7 +59,7 @@ public static void positive_1 () { assert (end.line == 2); token = reader.read_token (out begin, out end); - assert (token == MarkupTokenType.START_ELEMENT); + assert (token == Vala.MarkupTokenType.START_ELEMENT); assert (reader.name == "subelement"); assert (reader.content == null); assert (reader.get_attributes ().size == 2); @@ -71,7 +71,7 @@ public static void positive_1 () { assert (end.line == 3); token = reader.read_token (out begin, out end); - assert (token == MarkupTokenType.TEXT); + assert (token == Vala.MarkupTokenType.TEXT); assert (reader.name == null); assert (reader.content == "my text"); assert (reader.get_attributes ().size == 0); @@ -81,7 +81,7 @@ public static void positive_1 () { assert (end.line == 3); token = reader.read_token (out begin, out end); - assert (token == MarkupTokenType.END_ELEMENT); + assert (token == Vala.MarkupTokenType.END_ELEMENT); assert (reader.name == "subelement"); assert (reader.content == null); assert (reader.get_attributes ().size == 0); @@ -91,7 +91,7 @@ public static void positive_1 () { assert (end.line == 3); token = reader.read_token (out begin, out end); - assert (token == MarkupTokenType.START_ELEMENT); + assert (token == Vala.MarkupTokenType.START_ELEMENT); assert (reader.name == "simpletag1"); assert (reader.content == null); assert (reader.get_attributes ().size == 2); @@ -103,7 +103,7 @@ public static void positive_1 () { assert (end.line == 4); token = reader.read_token (out begin, out end); - assert (token == MarkupTokenType.END_ELEMENT); + assert (token == Vala.MarkupTokenType.END_ELEMENT); assert (reader.name == "simpletag1"); assert (reader.content == null); assert (reader.get_attributes ().size == 0); @@ -113,7 +113,7 @@ public static void positive_1 () { assert (end.line == 4); token = reader.read_token (out begin, out end); - assert (token == MarkupTokenType.START_ELEMENT); + assert (token == Vala.MarkupTokenType.START_ELEMENT); assert (reader.name == "simpletag2"); assert (reader.content == null); assert (reader.get_attributes ().size == 1); @@ -124,7 +124,7 @@ public static void positive_1 () { assert (end.line == 5); token = reader.read_token (out begin, out end); - assert (token == MarkupTokenType.END_ELEMENT); + assert (token == Vala.MarkupTokenType.END_ELEMENT); assert (reader.name == "simpletag2"); assert (reader.content == null); assert (reader.get_attributes ().size == 0); @@ -134,7 +134,7 @@ public static void positive_1 () { assert (end.line == 5); token = reader.read_token (out begin, out end); - assert (token == MarkupTokenType.START_ELEMENT); + assert (token == Vala.MarkupTokenType.START_ELEMENT); assert (reader.name == "simpletag3"); assert (reader.content == null); assert (reader.get_attributes ().size == 0); @@ -144,7 +144,7 @@ public static void positive_1 () { assert (end.line == 6); token = reader.read_token (out begin, out end); - assert (token == MarkupTokenType.END_ELEMENT); + assert (token == Vala.MarkupTokenType.END_ELEMENT); assert (reader.name == "simpletag3"); assert (reader.content == null); assert (reader.get_attributes ().size == 0); @@ -154,7 +154,7 @@ public static void positive_1 () { assert (end.line == 6); token = reader.read_token (out begin, out end); - assert (token == MarkupTokenType.END_ELEMENT); + assert (token == Vala.MarkupTokenType.END_ELEMENT); assert (reader.name == "root-element"); assert (reader.content == null); assert (reader.get_attributes ().size == 0); @@ -164,7 +164,7 @@ public static void positive_1 () { assert (end.line == 7); token = reader.read_token (out begin, out end); - assert (token == MarkupTokenType.EOF); + assert (token == Vala.MarkupTokenType.EOF); assert (reader.name == null); assert (reader.content == null); assert (reader.get_attributes ().size == 0); @@ -180,15 +180,15 @@ public static void positive_2 () { string content = "AA BB & "' < > %"; - var reader = new MarkupReader.from_string ("testfile", content, reporter); + var reader = new Vala.MarkupReader.from_string ("testfile", content); assert (reader.filename == "testfile"); - MarkupSourceLocation begin; - MarkupSourceLocation end; - MarkupTokenType token; + Vala.SourceLocation begin; + Vala.SourceLocation end; + Vala.MarkupTokenType token; token = reader.read_token (out begin, out end); - assert (token == MarkupTokenType.TEXT); + assert (token == Vala.MarkupTokenType.TEXT); assert (reader.content == "AA BB & \"' < > %"); assert (reader.name == null); assert (reader.get_attributes ().size == 0); -- 2.47.2