OOPS-read test file examples (was Re: X3 employee example with semantic actions
Larry Evans <[email protected]> Tue, 5 Jun 2018 19:17:58 -0500
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
On 06/05/2018 06:58 PM, Larry Evans wrote:
> On 06/05/2018 01:38 PM, Maarten Verhage wrote:
> [snip]
>> In the meantime I've learned by fortunate accident that the parser
>> directive
>> **raw** will provide me the iterator range I'm after. As a general
>> remark on
>> this. It is nice if you can immediately understand the facilities
>> provided
>> in a documentation page like the Parser Directives. If you don't little
>> effort is made to properly present the ideas behind these facilities.
>> Maybe
>> the Spirit developers are annoyed by what they might consider as naive
>> questions about obvious things in this mailing list. While I believe
>> that if
>> you improve the documentation and explain for with purpose you provide
>> facilities people can much faster understand it, and the amount of
>> "stupid"
>> questions can be heavily reduced.
>>
> To supply a real life use case for what's described in the above
> paragraph, I've looked at the doc for raw as expressed in the xml
> generated from:
>
> https://github.com/boostorg/spirit/tree/develop/doc/x3
>
> That contains:
>
> raw[a]
>
> boost::iterator_range<I>
>
> Presents the transduction of a as an iterator range
>
> From this I infer that an interator_range<I> is produced
> where I is the Iterator to the parsers.
>
> But how do I use this. Grep'ing for raw shows:
>
> -*- mode: compilation; default-directory:
> "~/prog_dev/boost/releases/ro/boost_1_67_0/sandbox/lje/spirit-experiments/include/boost/spirit/home/x3/"
> -*-
> Compilation started at Tue Jun 5 18:43:54
>
> find . -name \*.hpp -exec grep -e '\<raw\>' {} \; -ls
> auto const raw = raw_gen{};
> 9109799 12 -rw-rw-r-- 1 evansl evansl 2534 Jan 19 14:59
> ./directive/raw.hpp
> // attr==raw_attribute_type, action wants iterator_range (see
> raw.hpp)
> 9049853 16 -rw-rw-r-- 1 evansl evansl 4718 Jun 4 22:09
> ./core/action.hpp
> #include <boost/spirit/home/x3/directive/raw.hpp>
> 9109791 12 -rw-rw-r-- 1 evansl evansl 1286 Jan 19 14:59
> ./directive.hpp
>
> Compilation finished at Tue Jun 5 18:43:54
>
> so, a brief look at that code still didn't clear things up; so,
> Please, Maarten, could you post the code where you make use
> of raw so I wouldn't have to further guess how to do it?
>
> -hopefully,
> Larry
>
Got clue from reading the test raw.cpp test file:
https://github.com/boostorg/spirit/blob/develop/test/x3/raw.cpp
translated what was learned to the employee example here:
https://gist.github.com/cppljevans/0f4351f127c2e651d8094877a9510e5a#file-x3-employee-raw-cpp
Is that about what you mean by use of raw?
-regards,
Larry
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general