From fa2af3085711373ded83f7965f389fcca3d11634 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 6 May 2014 21:26:30 -0400 Subject: [PATCH] A3t - Implemented ::findPlainArgs, for locating words that can be promoted to patterns. --- src/A3t.cpp | 19 +++++++++++++++++++ src/A3t.h | 1 + 2 files changed, 20 insertions(+) diff --git a/src/A3t.cpp b/src/A3t.cpp index baf639780..44f1a6c6d 100644 --- a/src/A3t.cpp +++ b/src/A3t.cpp @@ -148,6 +148,8 @@ Tree* A3t::parse () findFilter (); findModifications (); + findPlainArgs (); + validate (); return _tree; @@ -1184,6 +1186,23 @@ void A3t::findModifications () } } +//////////////////////////////////////////////////////////////////////////////// +// This is a called after parsing. The intention is to find plain arguments that +// are not otherwise recognized, and potentially promote them to patterns. +void A3t::findPlainArgs () +{ + std::vector ::iterator i; + for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i) + { + if ((*i)->hasTag ("FILTER") && + (*i)->hasTag ("ORIGINAL") && // TODO Wrong, can come in through alias/filter + (*i)->countTags () == 2) + { + std::cout << "# plain arg '" << (*i)->attribute ("raw") << "'\n"; + } + } +} + //////////////////////////////////////////////////////////////////////////////// // Validate the parse tree. void A3t::validate () diff --git a/src/A3t.h b/src/A3t.h index fc9e24509..4f2b3795a 100644 --- a/src/A3t.h +++ b/src/A3t.h @@ -71,6 +71,7 @@ private: void findOperator (); void findFilter (); void findModifications (); + void findPlainArgs (); void validate (); private: