{"id":697,"date":"2009-12-10T22:39:36","date_gmt":"2009-12-11T06:39:36","guid":{"rendered":"http:\/\/boost-spirit.com\/home\/?page_id=697"},"modified":"2009-12-15T07:49:11","modified_gmt":"2009-12-15T15:49:11","slug":"from-spirit-2-0-beta-to-spirit-2-1","status":"publish","type":"page","link":"http:\/\/boost-spirit.com\/home\/articles\/spirit2-1-release\/from-spirit-2-0-beta-to-spirit-2-1\/","title":{"rendered":"Porting Spirit 2.0 (beta) to Spirit 2.1"},"content":{"rendered":"<p>Spirit 2 has undergone lots of revisions from its inception to what you are seeing now. An early beta\u00a0 release, dubbed Spirit 2 beta, was included as part of Boost 1.39. The adventurous among you started using it as soon as it was released. Spirit 2.1 is essentially the same as Spirit2 beta apart from some cosmetic differences and QOI changes. For the sake of those who started using Spirit from 2.0 beta, here&#8217;s what&#8217;s changed:<\/p>\n<ol>\n<li>Namespace spirit::arg_names ceased to exist. All the<span style=\"font-family: monospace;\"> <\/span>placeholders (_0&#8230;_N, _r1&#8230;_rN, _val, _a&#8230;_j) are now in boost::spirit.<\/li>\n<li>Components in boost::spirit that are used by qi (and karma) are hoisted<span style=\"font-family: monospace;\"> <\/span>into qi and karma. So, you don&#8217;t have to<span style=\"font-family: monospace;\"> <\/span>memorize which component lives in boost::spirit::qi (or karma) or the outer<span style=\"font-family: monospace;\"> <\/span>boost::spirit namespace. Example:\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\nusing boost::spirit::qi::int_;\r\nusing boost::spirit::qi::lit;\r\nusing boost::spirit::qi::unused_type;\r\nusing boost::spirit::qi::_1;\r\nusing boost::spirit::qi::omit;\r\n<\/pre>\n<\/li>\n<li>There are multiple versions of char_ and no_case in different<span style=\"font-family: monospace;\"> <\/span>&#8220;char encoding&#8221; namespaces. For example, there is boost::spirit::ascii::char_ and boost::spirit::iso8859_1::char_.<\/li>\n<li>wchar ceases to exist. Use standard_wide::char_ instead.<\/li>\n<li>xxx(f) where xxx is a spirit parser and\u00a0 f is a callable function, is possible everywhere.<span style=\"font-family: monospace;\"> <\/span>for example: char_(phoenix::var(ch)).<\/li>\n<li>repeat, repeat(from, to), repeat(from, inf) is implemented.<\/li>\n<li>All traits are in spirit::traits. There is no spirit::qi::traits.<\/li>\n<li>Error handling now uses the spirit::info class instead of std::string<span style=\"font-family: monospace;\"> <\/span>for the &#8220;what&#8221; part. There&#8217;s support for printing out the info<span style=\"font-family: monospace;\"> <\/span>(i.e. operator&lt;&lt;) so, code should run as usual. spirit::info is<span style=\"font-family: monospace;\"> <\/span>UTF8 savvy, with additional features to make it easy and more powerful to provide error messages.<\/li>\n<li> Changed parameter sequence of <code><span>qi<\/span><span>::<\/span><span>phrase_parse<\/span><\/code>,         <code><span>qi<\/span><span>::<\/span><span>phrase_match<\/span><\/code>, <code><span>karma<\/span><span>::<\/span><span>generate_delimited<\/span><\/code>,         and <code><span>match_delimited<\/span><\/code>. The         attribute is now always the last parameter.<\/li>\n<\/ol>\n<p>The list above enumerates the most important changes you need to know in order to port your Spirit 2.0 beta code over to Spirit 2.1. There are more smaller details here and there. For more info see: <a href=\"http:\/\/boost-spirit.com\/home\/spirit2\/libs\/spirit\/doc\/html\/index.html\">What&#8217;s New<\/a>.<\/p>\n<div class=\"sharedaddy sd-sharing-enabled\"><div class=\"robots-nocontent sd-block sd-social sd-social-icon-text sd-sharing\"><h3 class=\"sd-title\">Share this:<\/h3><div class=\"sd-content\"><ul><li><a href=\"#\" class=\"sharing-anchor sd-button share-more\"><span>Share<\/span><\/a><\/li><li class=\"share-end\"><\/li><\/ul><div class=\"sharing-hidden\"><div class=\"inner\" style=\"display: none;\"><ul><li class=\"share-facebook\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-facebook-697\" class=\"share-facebook sd-button share-icon\" href=\"http:\/\/boost-spirit.com\/home\/articles\/spirit2-1-release\/from-spirit-2-0-beta-to-spirit-2-1\/?share=facebook\" target=\"_blank\" title=\"Click to share on Facebook\" ><span>Facebook<\/span><\/a><\/li><li class=\"share-twitter\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-twitter-697\" class=\"share-twitter sd-button share-icon\" href=\"http:\/\/boost-spirit.com\/home\/articles\/spirit2-1-release\/from-spirit-2-0-beta-to-spirit-2-1\/?share=twitter\" target=\"_blank\" title=\"Click to share on Twitter\" ><span>Twitter<\/span><\/a><\/li><li class=\"share-end\"><\/li><li class=\"share-pinterest\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-pinterest-697\" class=\"share-pinterest sd-button share-icon\" href=\"http:\/\/boost-spirit.com\/home\/articles\/spirit2-1-release\/from-spirit-2-0-beta-to-spirit-2-1\/?share=pinterest\" target=\"_blank\" title=\"Click to share on Pinterest\" ><span>Pinterest<\/span><\/a><\/li><li class=\"share-linkedin\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-linkedin-697\" class=\"share-linkedin sd-button share-icon\" href=\"http:\/\/boost-spirit.com\/home\/articles\/spirit2-1-release\/from-spirit-2-0-beta-to-spirit-2-1\/?share=linkedin\" target=\"_blank\" title=\"Click to share on LinkedIn\" ><span>LinkedIn<\/span><\/a><\/li><li class=\"share-end\"><\/li><li class=\"share-reddit\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"\" class=\"share-reddit sd-button share-icon\" href=\"http:\/\/boost-spirit.com\/home\/articles\/spirit2-1-release\/from-spirit-2-0-beta-to-spirit-2-1\/?share=reddit\" target=\"_blank\" title=\"Click to share on Reddit\" ><span>Reddit<\/span><\/a><\/li><li class=\"share-tumblr\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"\" class=\"share-tumblr sd-button share-icon\" href=\"http:\/\/boost-spirit.com\/home\/articles\/spirit2-1-release\/from-spirit-2-0-beta-to-spirit-2-1\/?share=tumblr\" target=\"_blank\" title=\"Click to share on Tumblr\" ><span>Tumblr<\/span><\/a><\/li><li class=\"share-end\"><\/li><li class=\"share-end\"><\/li><\/ul><\/div><\/div><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Spirit 2 has undergone lots of revisions from its inception to what you are seeing now. An early beta\u00a0 release, dubbed Spirit 2 beta, was included as part of Boost 1.39. The adventurous among you started using it as soon as it was released. Spirit 2.1 is essentially the same as Spirit2 beta apart from [&hellip;]<\/p>\n<div class=\"sharedaddy sd-sharing-enabled\"><div class=\"robots-nocontent sd-block sd-social sd-social-icon-text sd-sharing\"><h3 class=\"sd-title\">Share this:<\/h3><div class=\"sd-content\"><ul><li><a href=\"#\" class=\"sharing-anchor sd-button share-more\"><span>Share<\/span><\/a><\/li><li class=\"share-end\"><\/li><\/ul><div class=\"sharing-hidden\"><div class=\"inner\" style=\"display: none;\"><ul><li class=\"share-facebook\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-facebook-697\" class=\"share-facebook sd-button share-icon\" href=\"http:\/\/boost-spirit.com\/home\/articles\/spirit2-1-release\/from-spirit-2-0-beta-to-spirit-2-1\/?share=facebook\" target=\"_blank\" title=\"Click to share on Facebook\" ><span>Facebook<\/span><\/a><\/li><li class=\"share-twitter\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-twitter-697\" class=\"share-twitter sd-button share-icon\" href=\"http:\/\/boost-spirit.com\/home\/articles\/spirit2-1-release\/from-spirit-2-0-beta-to-spirit-2-1\/?share=twitter\" target=\"_blank\" title=\"Click to share on Twitter\" ><span>Twitter<\/span><\/a><\/li><li class=\"share-end\"><\/li><li class=\"share-pinterest\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-pinterest-697\" class=\"share-pinterest sd-button share-icon\" href=\"http:\/\/boost-spirit.com\/home\/articles\/spirit2-1-release\/from-spirit-2-0-beta-to-spirit-2-1\/?share=pinterest\" target=\"_blank\" title=\"Click to share on Pinterest\" ><span>Pinterest<\/span><\/a><\/li><li class=\"share-linkedin\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-linkedin-697\" class=\"share-linkedin sd-button share-icon\" href=\"http:\/\/boost-spirit.com\/home\/articles\/spirit2-1-release\/from-spirit-2-0-beta-to-spirit-2-1\/?share=linkedin\" target=\"_blank\" title=\"Click to share on LinkedIn\" ><span>LinkedIn<\/span><\/a><\/li><li class=\"share-end\"><\/li><li class=\"share-reddit\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"\" class=\"share-reddit sd-button share-icon\" href=\"http:\/\/boost-spirit.com\/home\/articles\/spirit2-1-release\/from-spirit-2-0-beta-to-spirit-2-1\/?share=reddit\" target=\"_blank\" title=\"Click to share on Reddit\" ><span>Reddit<\/span><\/a><\/li><li class=\"share-tumblr\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"\" class=\"share-tumblr sd-button share-icon\" href=\"http:\/\/boost-spirit.com\/home\/articles\/spirit2-1-release\/from-spirit-2-0-beta-to-spirit-2-1\/?share=tumblr\" target=\"_blank\" title=\"Click to share on Tumblr\" ><span>Tumblr<\/span><\/a><\/li><li class=\"share-end\"><\/li><li class=\"share-end\"><\/li><\/ul><\/div><\/div><\/div><\/div><\/div>","protected":false},"author":2,"featured_media":0,"parent":377,"menu_order":4,"comment_status":"open","ping_status":"open","template":"","meta":{"_s2mail":"","spay_email":""},"jetpack_shortlink":"https:\/\/wp.me\/PIHdZ-bf","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/boost-spirit.com\/home\/wp-json\/wp\/v2\/pages\/697"}],"collection":[{"href":"http:\/\/boost-spirit.com\/home\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/boost-spirit.com\/home\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/boost-spirit.com\/home\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/boost-spirit.com\/home\/wp-json\/wp\/v2\/comments?post=697"}],"version-history":[{"count":11,"href":"http:\/\/boost-spirit.com\/home\/wp-json\/wp\/v2\/pages\/697\/revisions"}],"predecessor-version":[{"id":704,"href":"http:\/\/boost-spirit.com\/home\/wp-json\/wp\/v2\/pages\/697\/revisions\/704"}],"up":[{"embeddable":true,"href":"http:\/\/boost-spirit.com\/home\/wp-json\/wp\/v2\/pages\/377"}],"wp:attachment":[{"href":"http:\/\/boost-spirit.com\/home\/wp-json\/wp\/v2\/media?parent=697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}