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