mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Task: Migrated from Nibbler to Pig
This commit is contained in:
parent
a456228e98
commit
cdfd92ed9b
1 changed files with 13 additions and 13 deletions
26
src/Task.cpp
26
src/Task.cpp
|
@ -39,7 +39,7 @@
|
|||
#include <Lexer.h>
|
||||
#ifdef PRODUCT_TASKWARRIOR
|
||||
#include <Context.h>
|
||||
#include <Nibbler.h>
|
||||
#include <Pig.h>
|
||||
#endif
|
||||
#include <ISO8601.h>
|
||||
#ifdef PRODUCT_TASKWARRIOR
|
||||
|
@ -576,24 +576,24 @@ void Task::parse (const std::string& input)
|
|||
|
||||
if (input[0] == '[')
|
||||
{
|
||||
Nibbler n (input);
|
||||
Pig pig (input);
|
||||
std::string line;
|
||||
if (n.skip ('[') &&
|
||||
n.getUntil (']', line) &&
|
||||
n.skip (']') &&
|
||||
(n.skip ('\n') || n.depleted ()))
|
||||
if (pig.skip ('[') &&
|
||||
pig.getUntil (']', line) &&
|
||||
pig.skip (']') &&
|
||||
(pig.skip ('\n') || pig.eos ()))
|
||||
{
|
||||
if (line.length () == 0)
|
||||
throw std::string (STRING_RECORD_EMPTY);
|
||||
|
||||
Nibbler nl (line);
|
||||
Pig attLine (line);
|
||||
std::string name;
|
||||
std::string value;
|
||||
while (!nl.depleted ())
|
||||
while (!attLine.eos ())
|
||||
{
|
||||
if (nl.getUntil (':', name) &&
|
||||
nl.skip (':') &&
|
||||
nl.getQuoted ('"', value))
|
||||
if (attLine.getUntil (':', name) &&
|
||||
attLine.skip (':') &&
|
||||
attLine.getQuoted ('"', value))
|
||||
{
|
||||
#ifdef PRODUCT_TASKWARRIOR
|
||||
legacyAttributeMap (name);
|
||||
|
@ -605,11 +605,11 @@ void Task::parse (const std::string& input)
|
|||
data[name] = decode (json::decode (value));
|
||||
}
|
||||
|
||||
nl.skip (' ');
|
||||
attLine.skip (' ');
|
||||
}
|
||||
|
||||
std::string remainder;
|
||||
nl.getUntilEOS (remainder);
|
||||
attLine.getRemainder (remainder);
|
||||
if (remainder.length ())
|
||||
throw std::string (STRING_RECORD_JUNK_AT_EOL);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue