From e688176310118dfea2a2550838a12001b342af4f Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 25 Jun 2014 22:04:56 -0400 Subject: [PATCH] Parser - Plain arguments may only be upgraded to search patterns if they cannot be split into multiple lexemes, and do not canonicalize to an attribute name. --- src/Parser.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/Parser.cpp b/src/Parser.cpp index 98845e40b..53afd409e 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -1439,22 +1439,26 @@ void Parser::findPlainArgs () std::string raw = (*i)->attribute ("raw"); std::vector lexed; Lexer::token_split (lexed, raw); - if (lexed.size () == 1) { - // This tag also prevents further expanѕion. - (*i)->tag ("PATTERN"); + // Furthermore, the word must not canonicalize to an attribute name. + std::string canonical; + if (! canonicalize (canonical, "attribute", raw)) + { + // This tag also prevents further expanѕion. + (*i)->tag ("PATTERN"); - Tree* branch = (*i)->addBranch (new Tree ("argPat")); - branch->attribute ("raw", "description"); + Tree* branch = (*i)->addBranch (new Tree ("argPat")); + branch->attribute ("raw", "description"); - branch = (*i)->addBranch (new Tree ("argPat")); - branch->attribute ("raw", "~"); - branch->tag ("OP"); + branch = (*i)->addBranch (new Tree ("argPat")); + branch->attribute ("raw", "~"); + branch->tag ("OP"); - branch = (*i)->addBranch (new Tree ("argPat")); - branch->attribute ("raw", raw); - branch->tag ("STRING"); + branch = (*i)->addBranch (new Tree ("argPat")); + branch->attribute ("raw", raw); + branch->tag ("STRING"); + } } } }