|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61525 - trunk/libs/spirit/example/scheme/qi
From: hartmut.kaiser_at_[hidden]
Date: 2010-04-23 21:53:29
Author: hkaiser
Date: 2010-04-23 21:53:27 EDT (Fri, 23 Apr 2010)
New Revision: 61525
URL: http://svn.boost.org/trac/boost/changeset/61525
Log:
Spirit: prefixed all Qi parser component names with 'qi:'
Text files modified:
trunk/libs/spirit/example/scheme/qi/component_names.hpp | 8 +++++-
trunk/libs/spirit/example/scheme/qi/qiexpr_generator.hpp | 19 +++++++++--------
trunk/libs/spirit/example/scheme/qi/qiexpr_parser.hpp | 41 ++++++++++++++++++++-------------------
3 files changed, 37 insertions(+), 31 deletions(-)
Modified: trunk/libs/spirit/example/scheme/qi/component_names.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/qi/component_names.hpp (original)
+++ trunk/libs/spirit/example/scheme/qi/component_names.hpp 2010-04-23 21:53:27 EDT (Fri, 23 Apr 2010)
@@ -15,7 +15,8 @@
{
// character parsers
"char_"
- , "alnum", "alpha", "blank", "cntrl", "digit", "graph", "print", "punct"
+ , "alnum", "alpha", "blank", "cntrl", "digit", "graph"
+ , "print", "punct"
, "space", "xdigit"
, "lower", "upper"
@@ -64,7 +65,10 @@
, "omit", "raw"
// encoding
- , "ascii", "standard", "standard_wide", "iso8859_1", "unicode"
+ , "ascii", "standard", "standard_wide", "iso8859_1"
+#if defined BOOST_SPIRIT_UNICODE
+ , "unicode"
+#endif
, 0
};
Modified: trunk/libs/spirit/example/scheme/qi/qiexpr_generator.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/qi/qiexpr_generator.hpp (original)
+++ trunk/libs/spirit/example/scheme/qi/qiexpr_generator.hpp 2010-04-23 21:53:27 EDT (Fri, 23 Apr 2010)
@@ -53,24 +53,24 @@
;
alternative =
- &symbol(std::string("|"))
+ &symbol(std::string("qi:|"))
<< '(' << strict[permutation % '|'] << ')'
| permutation
;
permutation =
- &symbol(std::string("^"))
+ &symbol(std::string("qi:^"))
<< '(' << strict[sequence % '^'] << ')'
| sequence
;
sequence =
- &symbol(std::string(">>"))
+ &symbol(std::string("qi:>>"))
<< '(' << strict[term % ">>"] << ')'
| term
;
- term %=
+ term =
strict[
unary << '(' << repeat(1)[alternative] << ')'
| primitive2 << '(' << literal << ',' << literal << ')'
@@ -88,20 +88,21 @@
nil = eps;
// fill the symbol tables with all known primitive parser names
+ std::string name("qi:");
for (char const* const* p = primitives0; *p; ++p)
- primitive0.add(utf8_symbol(*p));
+ primitive0.add(utf8_symbol(name + *p));
for (char const* const* p = primitives1; *p; ++p)
- primitive1.add(utf8_symbol(*p));
+ primitive1.add(utf8_symbol(name + *p));
for (char const* const* p = primitives2; *p; ++p)
- primitive2.add(utf8_symbol(*p));
+ primitive2.add(utf8_symbol(name + *p));
for (char const* const* p = unary_names; *p; ++p)
- unary.add(utf8_symbol(*p));
+ unary.add(utf8_symbol(name + *p));
for (char const* const* p = directives0; *p; ++p)
- directive0.add(utf8_symbol(*p));
+ directive0.add(utf8_symbol(name + *p));
BOOST_SPIRIT_DEBUG_NODE(start);
BOOST_SPIRIT_DEBUG_NODE(alternative);
Modified: trunk/libs/spirit/example/scheme/qi/qiexpr_parser.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/qi/qiexpr_parser.hpp (original)
+++ trunk/libs/spirit/example/scheme/qi/qiexpr_parser.hpp 2010-04-23 21:53:27 EDT (Fri, 23 Apr 2010)
@@ -151,24 +151,24 @@
make_list_type make_directive = detail::make_list_node("");
- make_list_type make_sequence = detail::make_list_node(">>");
- make_list_type make_permutation = detail::make_list_node("^");
- make_list_type make_alternative = detail::make_list_node("|");
-
- make_list_type make_kleene = detail::make_list_node("*");
- make_list_type make_plus = detail::make_list_node("+");
- make_list_type make_optional = detail::make_list_node("-");
- make_list_type make_and_pred = detail::make_list_node("&");
- make_list_type make_not_pred = detail::make_list_node("!");
+ make_list_type make_sequence = detail::make_list_node("qi:>>");
+ make_list_type make_permutation = detail::make_list_node("qi:^");
+ make_list_type make_alternative = detail::make_list_node("qi:|");
+
+ make_list_type make_kleene = detail::make_list_node("qi:*");
+ make_list_type make_plus = detail::make_list_node("qi:+");
+ make_list_type make_optional = detail::make_list_node("qi:-");
+ make_list_type make_and_pred = detail::make_list_node("qi:&");
+ make_list_type make_not_pred = detail::make_list_node("qi:!");
- make_list_type make_literal = detail::make_list_node("lit");
+ make_list_type make_literal = detail::make_list_node("qi:lit");
start = -alternative;
// A | B
alternative =
permutation [ _val = _1 ]
- >> *( '|' >> permutation [ make_alternative(_val, _1) ] )
+ >> *( "|" >> permutation [ make_alternative(_val, _1) ] )
;
// A ^ B
@@ -185,11 +185,11 @@
// unary operators
unary_term =
- '*' >> unary_term [ make_kleene(_val, _1) ]
- | '+' >> unary_term [ make_plus(_val, _1) ]
- | '-' >> unary_term [ make_optional(_val, _1) ]
- | '&' >> unary_term [ make_and_pred(_val, _1) ]
- | '!' >> unary_term [ make_not_pred(_val, _1) ]
+ "*" >> unary_term [ make_kleene(_val, _1) ]
+ | "+" >> unary_term [ make_plus(_val, _1) ]
+ | "-" >> unary_term [ make_optional(_val, _1) ]
+ | "&" >> unary_term [ make_and_pred(_val, _1) ]
+ | "!" >> unary_term [ make_not_pred(_val, _1) ]
| term [ _val = _1 ]
;
@@ -223,30 +223,31 @@
;
// fill the symbol tables with all known primitive parser names
+ std::string name("qi:");
for (char const* const* p = primitives0; *p; ++p)
{
utree u;
- u.push_back(utf8_symbol(*p));
+ u.push_back(utf8_symbol(name + *p));
primitive0.add(*p, u);
}
for (char const* const* p = primitives1; *p; ++p)
{
utree u;
- u.push_back(utf8_symbol(*p));
+ u.push_back(utf8_symbol(name + *p));
primitive1.add(*p, u);
}
for (char const* const* p = primitives2; *p; ++p)
{
utree u;
- u.push_back(utf8_symbol(*p));
+ u.push_back(utf8_symbol(name + *p));
primitive2.add(*p, u);
}
for (char const* const* p = directives0; *p; ++p)
{
- utree u = utree(utf8_symbol(*p));
+ utree u = utree(utf8_symbol(name + *p));
directive0.add(*p, u);
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk