[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdev-php] parser: Port parser/ from kdebug to qcdebug.
From: Milian Wolff <mail () milianw ! de>
Date: 2014-09-09 19:48:59
Message-ID: E1XRRPP-0007zf-7W () scm ! kde ! org
[Download RAW message or body]
Git commit 602a91afb1447dc793f67a471f135f5c6be8e107 by Milian Wolff.
Committed on 09/09/2014 at 19:48.
Pushed by mwolff into branch 'master'.
Port parser/ from kdebug to qcdebug.
M +2 -1 parser/CMakeLists.txt
A +22 -0 parser/parserdebug.cpp [License: LGPL (v2)]
A +26 -0 parser/parserdebug.h [License: LGPL (v2)]
M +3 -2 parser/parsesession.cpp
M +3 -3 parser/php.g
M +1 -1 parser/phplexer.cpp
M +3 -2 parser/test/lexertest.cpp
http://commits.kde.org/kdev-php/602a91afb1447dc793f67a471f135f5c6be8e107
diff --git a/parser/CMakeLists.txt b/parser/CMakeLists.txt
index 25b06d1..a746565 100644
--- a/parser/CMakeLists.txt
+++ b/parser/CMakeLists.txt
@@ -3,7 +3,8 @@ add_subdirectory(test)
set(parser_STAT_SRCS
phplexer.cpp
parsesession.cpp
- )
+ parserdebug.cpp
+)
kdevpgqt_generate(parser_SRCS php NAMESPACE Php DEBUG_VISITOR TOKEN_TEXT
"${php_SOURCE_DIR}/parser/php.g"
diff --git a/parser/parserdebug.cpp b/parser/parserdebug.cpp
new file mode 100644
index 0000000..d4adf6f
--- /dev/null
+++ b/parser/parserdebug.cpp
@@ -0,0 +1,22 @@
+/* This file is part of KDevelop
+
+ Copyright 2014 Milian Wolff <mail@milianw.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "parserdebug.h"
+
+Q_LOGGING_CATEGORY(PARSER, "kdev-php-parser")
\ No newline at end of file
diff --git a/parser/parserdebug.h b/parser/parserdebug.h
new file mode 100644
index 0000000..b32045e
--- /dev/null
+++ b/parser/parserdebug.h
@@ -0,0 +1,26 @@
+/* This file is part of KDevelop
+
+ Copyright 2014 Milian Wolff <mail@milianw.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef PARSERDEBUG_H
+#define PARSERDEBUG_H
+
+#include <QLoggingCategory>
+Q_DECLARE_LOGGING_CATEGORY(PARSER)
+
+#endif /* PARSERDEBUG_H */
diff --git a/parser/parsesession.cpp b/parser/parsesession.cpp
index a52a0db..21adec1 100644
--- a/parser/parsesession.cpp
+++ b/parser/parsesession.cpp
@@ -22,6 +22,7 @@
#include "kdev-pg-memory-pool.h"
#include "kdev-pg-token-stream.h"
+#include "parserdebug.h"
#include <QFile>
#include <QTextCodec>
@@ -125,12 +126,12 @@ bool ParseSession::parse(Php::StartAst** ast)
StartAst* phpAst;
bool matched = parser->parseStart(&phpAst);
if (matched) {
- kDebug() << "Successfully parsed";
+ qCDebug(PARSER) << "Successfully parsed";
*ast = phpAst;
} else {
*ast = 0;
parser->expectedSymbol(AstNode::StartKind, "start");
- kDebug() << "Couldn't parse content";
+ qCDebug(PARSER) << "Couldn't parse content";
}
m_problems << parser->problems();
delete parser;
diff --git a/parser/php.g b/parser/php.g
index b3e49f0..7a03ed5 100644
--- a/parser/php.g
+++ b/parser/php.g
@@ -73,7 +73,7 @@ namespace KDevelop
%parser_declaration_header "language/duchain/problem.h"
%parser_declaration_header "phplexer.h"
-%parser_bits_header "kdebug.h"
+%parser_bits_header "parserdebug.h"
------------------------------------------------------------
-- Enumeration types for additional AST members,
@@ -1083,8 +1083,8 @@ void Parser::expectedSymbol(int /*expectedSymbol*/, const \
QString& name) qint64 col;
qint64 index = tokenStream->index()-1;
Token &token = tokenStream->at(index);
- kDebug() << "token starts at:" << token.begin;
- kDebug() << "index is:" << index;
+ qCDebug(PARSER) << "token starts at:" << token.begin;
+ qCDebug(PARSER) << "index is:" << index;
tokenStream->startPosition(index, &line, &col);
QString tokenValue = tokenText(token.begin, token.end);
qint64 eLine;
diff --git a/parser/phplexer.cpp b/parser/phplexer.cpp
index 463b5f6..8d75428 100644
--- a/parser/phplexer.cpp
+++ b/parser/phplexer.cpp
@@ -28,7 +28,7 @@
#include <QtCore/QRegExp>
#include <QtCore/QDebug>
-#include <iostream>
+#include "parserdebug.h"
namespace Php
{
diff --git a/parser/test/lexertest.cpp b/parser/test/lexertest.cpp
index 7804367..af83204 100644
--- a/parser/test/lexertest.cpp
+++ b/parser/test/lexertest.cpp
@@ -24,6 +24,7 @@
#include "parsesession.h"
#include "phplexer.h"
#include "phptokentext.h"
+#include "../parserdebug.h"
QTEST_MAIN(Php::LexerTest)
namespace Php
@@ -282,7 +283,7 @@ void LexerTest::testCommonStringTokens()
{
// all these should have open_tag followed by constant encapsed string
foreach ( const QString& code, QStringList() << "<?php ''" << "<?php \"\"" << \
"<?php '" << "<?php \"" ) {
- kDebug() << code;
+ qCDebug(PARSER) << code;
TokenStream* ts = tokenize(code, true);
QCOMPARE((int)ts->size(), 2);
@@ -448,7 +449,7 @@ TokenStream* LexerTest::tokenize(const QString& unit, bool debug, \
int initialSta qint64 endLine;
qint64 endColumn;
tokenStream->endPosition(i, &endLine, &endColumn);
- kDebug() << tokenText(t.kind)
+ qCDebug(PARSER) << tokenText(t.kind)
<< unit.mid(t.begin, t.end - t.begin + 1).replace('\n', "\\n")
<< QString("[%0-%1] - \
[%2-%3]").arg(beginLine).arg(beginColumn).arg(endLine).arg(endColumn); ++i;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic