summaryrefslogtreecommitdiffstats
path: root/languages/ada/backgroundparser.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /languages/ada/backgroundparser.cpp
downloadtdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz
tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/ada/backgroundparser.cpp')
-rw-r--r--languages/ada/backgroundparser.cpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/languages/ada/backgroundparser.cpp b/languages/ada/backgroundparser.cpp
new file mode 100644
index 00000000..f94f3216
--- /dev/null
+++ b/languages/ada/backgroundparser.cpp
@@ -0,0 +1,77 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Roberto Raggi *
+ * roberto@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "backgroundparser.h"
+#include "problemreporter.h"
+#include "AdaLexer.hpp"
+#include "AdaParser.hpp"
+#include "AdaAST.hpp"
+#include <kdebug.h>
+#include <qfile.h>
+
+#include <config.h>
+
+#include <sstream>
+
+BackgroundParser::BackgroundParser( ProblemReporter* reporter,
+ const QString& source,
+ const QString& filename )
+ : m_reporter( reporter ),
+ m_source( source.unicode(), source.length() ),
+ m_fileName( filename )
+{
+}
+
+BackgroundParser::~BackgroundParser()
+{
+}
+
+void BackgroundParser::run()
+{
+ QCString _fn = QFile::encodeName(m_fileName);
+ std::string fn( _fn.data() );
+
+ std::istringstream stream( m_source.utf8().data() );
+
+ AdaLexer lexer( stream );
+ lexer.setFilename( fn );
+ lexer.setProblemReporter( m_reporter );
+
+ AdaParser parser( lexer );
+ parser.setFilename( fn );
+ parser.setProblemReporter( m_reporter );
+
+ // make an ast factory
+ antlr::ASTFactory ast_factory;
+ // initialize and put it in the parser...
+ parser.initializeASTFactory (ast_factory);
+ parser.setASTFactory (&ast_factory);
+ // parser.setASTNodeType ("RefAdaAST");
+
+ try{
+ lexer.resetErrors();
+ parser.resetErrors();
+
+ parser.compilation_unit();
+
+ } catch( antlr::ANTLRException& ex ){
+ kdDebug() << "*exception*: " << ex.toString().c_str() << endl;
+ m_reporter->reportError( QString::fromLatin1( ex.getMessage().c_str() ),
+ m_fileName,
+ lexer.getLine(),
+ lexer.getColumn() );
+ }
+
+ kdDebug() << "BackgroundParser::run() FINISHED." << endl;
+}
+
+
+