From 923639283d2bae0b82cb605fa4680a3058c9d973 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 25 Jul 2012 12:13:38 +0200 Subject: Add support for defining indexes New db pragma qualifier: index. New tests: common/index, mysql/index, pgsql/index. --- odb/lookup.cxx | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'odb/lookup.cxx') diff --git a/odb/lookup.cxx b/odb/lookup.cxx index c6b40b1..b3e0551 100644 --- a/odb/lookup.cxx +++ b/odb/lookup.cxx @@ -48,6 +48,7 @@ namespace lookup tree scope, string& name, bool is_type, + bool trailing_scope, tree* end_scope) { tree id; @@ -78,7 +79,24 @@ namespace lookup ptt = tt; tt = l.next (tl, &tn); - bool last (tt != CPP_SCOPE); + bool last (true); + if (tt == CPP_SCOPE) + { + // If trailing scope names are allowed, then we also need to + // check what's after the scope. + // + if (trailing_scope) + { + ptt = tt; + tt = l.next (tl, &tn); + + if (tt == CPP_NAME) + last = false; + } + else + last = false; + } + tree decl = lookup_qualified_name (scope, id, last && is_type, false); // If this is the first component in the name, then also search the @@ -110,8 +128,11 @@ namespace lookup name += "::"; - ptt = tt; - tt = l.next (tl, &tn); + if (!trailing_scope) + { + ptt = tt; + tt = l.next (tl, &tn); + } } return scope; -- cgit v1.1