How to match unicode characters with boost::spirit?

前端 未结 3 977
轻奢々
轻奢々 2021-01-02 05:48

How can I match utf8 unicode characters using boost::spirit?

For example, I want to recognize all characters in this string:

$ echo \"На         


        
3条回答
  •  长发绾君心
    2021-01-02 06:07

    I haven't got much experience with it, but apparently Spirit (SVN trunk version) supports Unicode.

    #define BOOST_SPIRIT_UNICODE // We'll use unicode (UTF8) all throughout
    

    See, e.g. the sexpr parser sample which is in the scheme demo.

    BOOST_ROOT/libs/spirit/example/scheme
    

    I believe this is based on the demo from a presentation by Bryce Lelbach1, which specifically showcases:

    • wchar support
    • utree attributes (still experimental)
    • s-expressions

    There is an online article about S-expressions and variant.


    1 In case it is indeed, here is the video from that presentation and the slides (pdf) as found here (odp)

提交回复
热议问题