mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Code Cleanup
- Eliminated obsolete Lisp code.
This commit is contained in:
parent
f1525df48a
commit
4245d83812
5 changed files with 8 additions and 253 deletions
|
@ -5,13 +5,13 @@ set (task_SRCS API.cpp API.h Att.cpp Att.h Cmd.cpp Cmd.h Color.cpp Color.h
|
|||
Config.cpp Config.h Context.cpp Context.h Date.cpp Date.h
|
||||
Directory.cpp Directory.h Duration.cpp Duration.h File.cpp
|
||||
File.h Filter.cpp Filter.h feedback.cpp Grid.cpp Grid.h Hooks.cpp
|
||||
Hooks.h JSON.cpp JSON.h Keymap.cpp Keymap.h Lisp.cpp Lisp.h
|
||||
Location.cpp Location.h Nibbler.cpp Nibbler.h Path.cpp Path.h
|
||||
Permission.cpp Permission.h Record.cpp Record.h Rectangle.cpp
|
||||
Rectangle.h Sequence.cpp Sequence.h Subst.cpp Subst.h TDB.cpp
|
||||
TDB.h Table.cpp Table.h Task.cpp Task.h Taskmod.cpp Taskmod.h
|
||||
Thread.cpp Thread.h Timer.cpp Timer.h Transport.cpp Transport.h
|
||||
TransportSSH.cpp TransportSSH.h TransportRSYNC.cpp TransportRSYNC.h
|
||||
Hooks.h JSON.cpp JSON.h Keymap.cpp Keymap.h Location.cpp
|
||||
Location.h Nibbler.cpp Nibbler.h Path.cpp Path.h Permission.cpp
|
||||
Permission.h Record.cpp Record.h Rectangle.cpp Rectangle.h
|
||||
Sequence.cpp Sequence.h Subst.cpp Subst.h TDB.cpp TDB.h Table.cpp
|
||||
Table.h Task.cpp Task.h Taskmod.cpp Taskmod.h Thread.cpp Thread.h
|
||||
Timer.cpp Timer.h Transport.cpp Transport.h TransportSSH.cpp
|
||||
TransportSSH.h TransportRSYNC.cpp TransportRSYNC.h
|
||||
TransportCurl.cpp TransportCurl.h Tree.cpp Tree.h burndown.cpp
|
||||
command.cpp custom.cpp dependency.cpp diag.cpp edit.cpp
|
||||
export.cpp history.cpp i18n.h import.cpp interactive.cpp
|
||||
|
|
125
src/Lisp.cpp
125
src/Lisp.cpp
|
@ -1,125 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include "Lisp.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Lisp::Lisp ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Lisp::~Lisp ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Tree* Lisp::parse (const std::string& input)
|
||||
{
|
||||
Tree* root = new Tree ("root");
|
||||
if (root)
|
||||
{
|
||||
Nibbler n (input);
|
||||
parseNode (root, n);
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Grammar
|
||||
// node ::= '(' list ')'
|
||||
// list ::= item [[space item] ...]
|
||||
// item ::= word | node
|
||||
void Lisp::parseNode (Tree* parent, Nibbler& n)
|
||||
{
|
||||
// Work on a stack-based copy, to allow backtracking.
|
||||
Nibbler attempt (n);
|
||||
|
||||
if (attempt.skip ('('))
|
||||
{
|
||||
Tree* b = new Tree ("");
|
||||
parent->addBranch (b);
|
||||
|
||||
parseList (b, attempt);
|
||||
if (attempt.skip (')'))
|
||||
{
|
||||
n = attempt;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw std::string ("Error: malformed node");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Lisp::parseList (Tree* parent, Nibbler& n)
|
||||
{
|
||||
// Work on a stack-based copy, to allow backtracking.
|
||||
Nibbler attempt (n);
|
||||
|
||||
parseItem (parent, attempt);
|
||||
|
||||
while (attempt.skip (' '))
|
||||
parseItem (parent, attempt);
|
||||
|
||||
n = attempt;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Lisp::parseItem (Tree* parent, Nibbler& n)
|
||||
{
|
||||
// Work on a stack-based copy, to allow backtracking.
|
||||
Nibbler attempt (n);
|
||||
|
||||
if (attempt.next () == '(')
|
||||
parseNode (parent, attempt);
|
||||
else
|
||||
parseWord (parent, attempt);
|
||||
|
||||
n = attempt;
|
||||
return;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// A word is any group of non-whitespace followed by a space or ')'.
|
||||
void Lisp::parseWord (Tree* parent, Nibbler& n)
|
||||
{
|
||||
// Work on a stack-based copy, to allow backtracking.
|
||||
Nibbler attempt (n);
|
||||
|
||||
std::string word;
|
||||
if (attempt.getUntilOneOf (" )", word))
|
||||
{
|
||||
parent->tag (word);
|
||||
n = attempt;
|
||||
return;
|
||||
}
|
||||
|
||||
throw std::string ("Error: failed to parse word");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
54
src/Lisp.h
54
src/Lisp.h
|
@ -1,54 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef INCLUDED_LISP
|
||||
#define INCLUDED_LISP
|
||||
|
||||
#include <string>
|
||||
#include "Tree.h"
|
||||
#include "Nibbler.h"
|
||||
|
||||
class Lisp
|
||||
{
|
||||
public:
|
||||
Lisp ();
|
||||
Lisp (const Lisp&);
|
||||
Lisp& operator= (const Lisp&);
|
||||
~Lisp ();
|
||||
|
||||
Tree* parse (const std::string&);
|
||||
|
||||
private:
|
||||
void parseNode (Tree*, Nibbler&);
|
||||
void parseList (Tree*, Nibbler&);
|
||||
void parseItem (Tree*, Nibbler&);
|
||||
void parseWord (Tree*, Nibbler&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue