From 4e7c8d76cb13d99e219b68e03508bf435b3766f4 Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Sun, 26 Nov 2017 19:27:00 +0100 Subject: [PATCH] valadoc: Drop custom SourceLocation --- libvaladoc/Makefile.am | 1 - .../documentation/gtkdocmarkdownscanner.vala | 8 ++--- libvaladoc/documentation/wikiscanner.vala | 8 ++--- .../valadocdocumentationimporter.vala | 4 +-- .../valadocdocumentationimporterscanner.vala | 8 ++--- libvaladoc/parser/sourcelocation.vala | 35 ------------------- libvaladoc/parser/token.vala | 12 +++---- .../libvaladoc/parser/generic-scanner.vala | 2 +- 8 files changed, 21 insertions(+), 57 deletions(-) delete mode 100644 libvaladoc/parser/sourcelocation.vala diff --git a/libvaladoc/Makefile.am b/libvaladoc/Makefile.am index 7499a7ada..271c88ae0 100644 --- a/libvaladoc/Makefile.am +++ b/libvaladoc/Makefile.am @@ -138,7 +138,6 @@ libvaladoc_la_VALASOURCES = \ parser/rule.vala \ parser/scanner.vala \ parser/sequencerule.vala \ - parser/sourcelocation.vala \ parser/stubrule.vala \ parser/token.vala \ parser/tokentype.vala \ diff --git a/libvaladoc/documentation/gtkdocmarkdownscanner.vala b/libvaladoc/documentation/gtkdocmarkdownscanner.vala index 944d8cede..6df58d07d 100644 --- a/libvaladoc/documentation/gtkdocmarkdownscanner.vala +++ b/libvaladoc/documentation/gtkdocmarkdownscanner.vala @@ -713,12 +713,12 @@ public class Valadoc.Gtkdoc.MarkdownScanner : GLib.Object, Valadoc.Scanner { } } - private SourceLocation get_begin () { - return SourceLocation (_last_line, get_line_start_column () + _last_column); + private Vala.SourceLocation get_begin () { + return Vala.SourceLocation (_index, _last_line, get_line_start_column () + _last_column); } - private SourceLocation get_end (int offset = 0) { - return SourceLocation (_line, get_line_start_column () + _column + offset); + private Vala.SourceLocation get_end (int offset = 0) { + return Vala.SourceLocation (_index, _line, get_line_start_column () + _column + offset); } public int get_line_start_column () { diff --git a/libvaladoc/documentation/wikiscanner.vala b/libvaladoc/documentation/wikiscanner.vala index 625a77ab7..f0c32d224 100644 --- a/libvaladoc/documentation/wikiscanner.vala +++ b/libvaladoc/documentation/wikiscanner.vala @@ -295,12 +295,12 @@ public class Valadoc.WikiScanner : Object, Scanner { return 0; } - private SourceLocation get_begin () { - return SourceLocation (_last_line, get_line_start_column () + _last_column); + private Vala.SourceLocation get_begin () { + return Vala.SourceLocation (_index, _last_line, get_line_start_column () + _last_column); } - private SourceLocation get_end (int offset = 0) { - return SourceLocation (_line, get_line_start_column () + _column + offset); + private Vala.SourceLocation get_end (int offset = 0) { + return Vala.SourceLocation (_index, _line, get_line_start_column () + _column + offset); } private void emit_current_word () throws ParserError { diff --git a/libvaladoc/importer/valadocdocumentationimporter.vala b/libvaladoc/importer/valadocdocumentationimporter.vala index 5505896fe..0663bab1e 100644 --- a/libvaladoc/importer/valadocdocumentationimporter.vala +++ b/libvaladoc/importer/valadocdocumentationimporter.vala @@ -35,7 +35,7 @@ public class Valadoc.Importer.ValadocDocumentationImporter : DocumentationImport private string _filename; private string _cname; private StringBuilder _comment; - private SourceLocation _comment_location; + private Vala.SourceLocation _comment_location; protected Content.ContentFactory factory; @@ -127,7 +127,7 @@ public class Valadoc.Importer.ValadocDocumentationImporter : DocumentationImport } private void add_documentation (string _symbol_name, StringBuilder? comment, string filename, - SourceLocation src_ref) + Vala.SourceLocation src_ref) { Api.Node? symbol = null; diff --git a/libvaladoc/importer/valadocdocumentationimporterscanner.vala b/libvaladoc/importer/valadocdocumentationimporterscanner.vala index ec52fddab..5f46d4b2e 100644 --- a/libvaladoc/importer/valadocdocumentationimporterscanner.vala +++ b/libvaladoc/importer/valadocdocumentationimporterscanner.vala @@ -158,12 +158,12 @@ public class Valadoc.Importer.ValadocDocumentationScanner : Object, Scanner { return 0; } - private SourceLocation get_begin () { - return SourceLocation (_last_line, get_line_start_column () + _last_column); + private Vala.SourceLocation get_begin () { + return Vala.SourceLocation (_index, _last_line, get_line_start_column () + _last_column); } - private SourceLocation get_end (int offset = 0) { - return SourceLocation (_line, get_line_start_column () + _column + offset); + private Vala.SourceLocation get_end (int offset = 0) { + return Vala.SourceLocation (_index, _line, get_line_start_column () + _column + offset); } private void emit_current_word () throws ParserError { diff --git a/libvaladoc/parser/sourcelocation.vala b/libvaladoc/parser/sourcelocation.vala deleted file mode 100644 index 51b5bc1f9..000000000 --- a/libvaladoc/parser/sourcelocation.vala +++ /dev/null @@ -1,35 +0,0 @@ -/* sourcelocation.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 - */ - - -/** - * Represents a position in a source file. - */ -public struct Valadoc.SourceLocation { - public int line; - public int column; - - public SourceLocation (int _line, int _column) { - line = _line; - column = _column; - } -} diff --git a/libvaladoc/parser/token.vala b/libvaladoc/parser/token.vala index 52833b24e..97581c28a 100644 --- a/libvaladoc/parser/token.vala +++ b/libvaladoc/parser/token.vala @@ -23,14 +23,14 @@ public class Valadoc.Token : Object { - public Token.from_type (TokenType type, SourceLocation begin, SourceLocation end, string? val = null) { + public Token.from_type (TokenType type, Vala.SourceLocation begin, Vala.SourceLocation end, string? val = null) { _type = type; _begin = begin; _end = end; _value = val; } - public Token.from_word (string word, SourceLocation begin, SourceLocation end) { + public Token.from_word (string word, Vala.SourceLocation begin, Vala.SourceLocation end) { _word = word; _begin = begin; _end = end; @@ -38,8 +38,8 @@ public class Valadoc.Token : Object { private TokenType? _type = null; private string? _word = null; - private SourceLocation _begin; - private SourceLocation _end; + private Vala.SourceLocation _begin; + private Vala.SourceLocation _end; private string? _value; public bool is_word { @@ -82,13 +82,13 @@ public class Valadoc.Token : Object { } } - public SourceLocation begin { + public Vala.SourceLocation begin { get { return _begin; } } - public SourceLocation end { + public Vala.SourceLocation end { get { return _end; } diff --git a/valadoc/tests/libvaladoc/parser/generic-scanner.vala b/valadoc/tests/libvaladoc/parser/generic-scanner.vala index 183bd5e96..d3dc2a0f9 100644 --- a/valadoc/tests/libvaladoc/parser/generic-scanner.vala +++ b/valadoc/tests/libvaladoc/parser/generic-scanner.vala @@ -35,7 +35,7 @@ public class TestScanner : Object, Valadoc.Scanner { } private void emit_token (Valadoc.TokenType type) throws Valadoc.ParserError { - Valadoc.SourceLocation loc = SourceLocation (pos, pos); + Vala.SourceLocation loc = Vala.SourceLocation (null, pos, pos); parser.accept_token (new Token.from_type (type, loc, loc)); } -- 2.47.2