From 78da4ffb90b2b59cebb9242ce0a782872d8a8387 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Thu, 29 Oct 2015 23:32:07 -0400 Subject: [PATCH] Nibbler: Removed unused ::getName method --- src/Nibbler.cpp | 32 -------------------------------- src/Nibbler.h | 1 - test/nibbler.t.cpp | 33 +-------------------------------- 3 files changed, 1 insertion(+), 65 deletions(-) diff --git a/src/Nibbler.cpp b/src/Nibbler.cpp index 0e216965f..ae496999b 100644 --- a/src/Nibbler.cpp +++ b/src/Nibbler.cpp @@ -535,38 +535,6 @@ bool Nibbler::getOneOf ( return false; } -//////////////////////////////////////////////////////////////////////////////// -// A name is a string of alpha-numeric characters. -bool Nibbler::getName (std::string& result) -{ - auto i = _cursor; - - if (i < _length) - { - if (! Lexer::isDigit ((*_input)[i]) && - ! ispunct ((*_input)[i]) && - ! Lexer::isWhitespace ((*_input)[i])) - { - ++i; - while (i < _length && - ((*_input)[i] == '_' || ! ispunct ((*_input)[i])) && - ! Lexer::isWhitespace ((*_input)[i])) - { - ++i; - } - } - - if (i > _cursor) - { - result = _input->substr (_cursor, i - _cursor); - _cursor = i; - return true; - } - } - - return false; -} - //////////////////////////////////////////////////////////////////////////////// // A word is a contiguous string of non-space, non-digit, non-punct characters. bool Nibbler::getWord (std::string& result) diff --git a/src/Nibbler.h b/src/Nibbler.h index a08ea1f80..577f3564a 100644 --- a/src/Nibbler.h +++ b/src/Nibbler.h @@ -62,7 +62,6 @@ public: bool getLiteral (const std::string&); bool getPartialUUID (std::string&); bool getOneOf (const std::vector &, std::string&); - bool getName (std::string&); bool getWord (std::string&); bool skipN (const int quantity = 1); diff --git a/test/nibbler.t.cpp b/test/nibbler.t.cpp index 71c1196b3..1e240b822 100644 --- a/test/nibbler.t.cpp +++ b/test/nibbler.t.cpp @@ -35,7 +35,7 @@ Context context; //////////////////////////////////////////////////////////////////////////////// int main (int, char**) { - UnitTest t (306); + UnitTest t (286); // Ensure environment has no influence. unsetenv ("TASKDATA"); @@ -445,37 +445,6 @@ int main (int, char**) t.is (s, "three", " 'threefour': getOneOf () -> three"); t.notok (n.getOneOf (options, s), " 'four': getOneOf () -> false"); - // bool getName (std::string&); - t.diag ("Nibbler::getName"); - n = Nibbler ("a1 one one.two 9 foo_bar"); - t.ok (n.getName (s), "'a1 one one.two 9 foo_bar' getName -> ok"); - t.is (s, "a1", " ' one one.two 9 foo_bar' getName -> 'a1'"); - t.ok (n.skipWS (), " 'one one.two 9 foo_bar' skipWS -> ok"); - - t.ok (n.getName (s), " 'one one.two 9 foo_bar' getName -> ok"); - t.is (s, "one", " ' one.two 9 foo_bar' getName -> 'one'"); - t.ok (n.skipWS (), " 'one.two 9 foo_bar' skipWS -> ok"); - - t.ok (n.getName (s), " 'one.two 9 foo_bar' getName -> ok"); - t.is (s, "one", " '.two 9 foo_bar' getName -> 'one'"); - t.ok (n.skip ('.'), " 'two 9 foo_bar' skip . -> ok"); - - t.ok (n.getName (s), " 'two 9 foo_bar' getName -> ok"); - t.is (s, "two", " ' 9 foo_bar' getName -> 'two'"); - t.ok (n.skipWS (), " '9 foo_bar' skipWS -> ok"); - - t.notok (n.getName (s), " '9 foo_bar' getName -> not ok"); - t.ok (n.skip ('9'), " ' foo_bar' skip 9 -> ok"); - t.ok (n.skipWS (), " 'foo_bar' skipWS -> ok"); - - t.ok (n.getName (s), " 'foo_bar' getName -> ok"); - t.is (s, "foo_bar", " '' getName -> 'foo_bar'"); - t.ok (n.depleted (), "depleted"); - - n = Nibbler ("entrée"); - t.ok (n.getName (s), "'entrée' -> ok"); - t.is (s, "entrée", "'entrée' -> 'entrée'"); - // bool getWord (std::string&); t.diag ("Nibbler::getWord"); n = Nibbler ("one two th3ee");