From bdb01c2c068df326f5a8328ed1492ab1bea388c5 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 20 Jan 2016 19:07:07 +0100 Subject: Renamed Akonadi2 to Sink (except for documentation). --- akonadish/syntaxtree.h | 80 -------------------------------------------------- 1 file changed, 80 deletions(-) delete mode 100644 akonadish/syntaxtree.h (limited to 'akonadish/syntaxtree.h') diff --git a/akonadish/syntaxtree.h b/akonadish/syntaxtree.h deleted file mode 100644 index 468aad3..0000000 --- a/akonadish/syntaxtree.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2014 Aaron Seigo - * - * 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. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#pragma once - -#include "state.h" - -#include -#include -#include - -#include - -class Syntax -{ -public: - typedef QVector List; - - enum Interactivity { - NotInteractive = 0, - EventDriven - }; - - Syntax(); - Syntax(const QString &keyword, - const QString &helpText = QString(), - std::function lambda = std::function(), - Interactivity interactivity = NotInteractive); - - QString keyword; - QString help; - Interactivity interactivity; - std::function lambda; - std::function completer; - - QVector children; -}; - -class SyntaxTree -{ -public: - typedef std::pair Command; - - static SyntaxTree *self(); - - int registerSyntax(std::function f); - Syntax::List syntax() const; - Command match(const QStringList &commands) const; - Syntax::List nearestSyntax(const QStringList &words, const QString &fragment) const; - State &state(); - bool run(const QStringList &commands); - - static QStringList tokenize(const QString &text); - -private: - SyntaxTree(); - - Syntax::List m_syntax; - State m_state; - QTime m_timeElapsed; - static SyntaxTree *s_module; -}; - -#define REGISTER_SYNTAX(name) static const int theTrickFor##name = SyntaxTree::self()->registerSyntax(&name::syntax); -- cgit v1.2.3