From 3799b5dc9cfb470e9101bd0f45c51d52a98626d8 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 24 May 2014 14:44:19 -0400 Subject: [PATCH] A3t - Added ::getLimit to find the 'limit:n' pseudo attribute. --- src/A3t.cpp | 20 ++++++++++++++++++++ src/A3t.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/src/A3t.cpp b/src/A3t.cpp index 3f724065f..7f8a2d7d2 100644 --- a/src/A3t.cpp +++ b/src/A3t.cpp @@ -588,6 +588,26 @@ const std::vector A3t::getWords () const return words; } +//////////////////////////////////////////////////////////////////////////////// +std::string A3t::getLimit () const +{ + std::vector ::const_iterator i; + for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i) + { + // Parser override operator. + if ((*i)->attribute ("raw") == "TERMINATED") + break; + + if ((*i)->hasTag ("PSEUDO") && + (*i)->attribute ("name") == "limit") + { + return (*i)->attribute ("raw"); + } + } + + return "0"; +} + //////////////////////////////////////////////////////////////////////////////// // /pattern/ --> description ~ pattern void A3t::findPattern () diff --git a/src/A3t.h b/src/A3t.h index 13aa7e212..a2b45476b 100644 --- a/src/A3t.h +++ b/src/A3t.h @@ -61,6 +61,8 @@ public: const std::vector getWords () const; // TODO Extract modifications + std::string getLimit () const; + private: void findTerminator (); void findPattern ();