Ryan Molden | 7 Nov 18:03
Picon
Gravatar

Fields of type lex::char_

Sorry if this is duplicated, I originally sent it two days ago but I never saw it appear back in my inbox as a list message (I actually haven't seen *any* messages to this list yet...is it still active?), nor have I seen any follow-up, so I thought I would send it again in case I hadn't been properly registered as one allowed to send mail when I sent it the first time.

I am having some problems having fields on my lexer of type lex::char_, specifically I get the following errors in Visual Studio 2010 SP1 with Boost 1.47
 
C2146: syntax error : missing ';' before identifier 'simple'
C2886: 'boost::spirit::standard::char_' : symbol cannot be used in a member using-declaration
C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C2146: syntax error : missing ';' before identifier 'simple'
C2886: 'boost::spirit::standard::char_' : symbol cannot be used in a member using-declaration
C4430: missing type specifier - int assumed. Note: C++ does not support default-int
 
This is with the following simplified repro
 
#include <boost/spirit/include/lex_lexertl.hpp>
 
namespace lex = boost::spirit::lex;
 
template <typename Lexer>
struct lexer : lex::lexer<Lexer>
{
    lexer()
    {
        simple = lex::char_('.');
        this->self += simple;
 
        //This works, but I need/want to store the char_ object so I can later reference its token ID from the parser level:
        //this->self += lex::char_('.');
        //
        //as does this (though in my real lexer I have LOTS of token_defs and as I add more the compile time gets worse and worse):
        //
        //this->self += lex::token_def<>('.');
    }
    lex::char_ simple;
};
 
struct token_processor
{
    template <typename Token>
    bool operator()(Token const& t) const
    {
        return true;
    }
};
 
int main(int argc, char**argv[])
{
    std::string str (".");
    char const* first = str.c_str();
    char const* last = &first[str.size()];
 
    lexer<lex::lexertl::actor_lexer<> > l;
    bool r = lex::tokenize(first, last, l, token_processor());
    
    return 0;
}
 
Is this a Visual Studio 'issue' or something I am doing wrong?
 
Ryan
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Spirit-devel mailing list
Spirit-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spirit-devel
Daniel James | 2 Nov 09:50
Picon

Missing documentation file.

Hi,

The spirit repository doc build is failing at the moment, it looks
like 'libs/spirit/repository/doc/what_s_new.qbk' is missing in trunk.

------------------------------------------------------------------------------
RSA&#174; Conference 2012
Save $700 by Nov 18
Register now&#33;
http://p.sf.net/sfu/rsa-sfdev2dev1
TONGARI | 27 Oct 18:18
Picon
Gravatar

Patch for qi::seek[] doc

Hi list,


There's an issue I overlooked in qi::seek[], in conjunction with sequence (i.e. a >> b) and skipping.

Consequently, I decided to change my seek.cpp example, adding one note to the doc that guides the users to deal with the case.

The complexity section is also modified, I hope I get it right this time.


Thanks!



Attachment (seek_doc.patch): application/octet-stream, 4092 bytes
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning <at> Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Spirit-devel mailing list
Spirit-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spirit-devel
TONGARI | 26 Oct 20:19
Picon
Gravatar

[website] Please fix the link to nabble.

Hi,


The nabble link in the support page:



Thanks.
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning <at> Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Spirit-devel mailing list
Spirit-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spirit-devel
Picon
Favicon

Strange behaviour of boost::spirit::get_current_line

Hello.

When content in range [current, upper_bound) contains multiple lines, get_current_line(lower_bound,
current, upper_bound) returns iterator range, which includes all lines after current excluding last.
Is this behaviour correct? I think,
the returning of only one current line is more expecting behaviour. The patch for that behaviour is attached.

Thanks.
Attachment (line_pos_iterator.patch): text/x-diff, 817 bytes
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning <at> Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Spirit-devel mailing list
Spirit-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spirit-devel
Daniel James | 16 Oct 11:53
Picon

Move generated spirit docs to the sandbox

Hi,

I removed the fusion docs from trunk a while back, and replaced them
with a redirect to the sourceforge sandbox. I think we agreed to do
this for spirit as well, but I didn't at the time as I hadn't set up
the index yet, but I set that up a little while ago, you can see the
documentation at:

http://boost-sandbox.sourceforge.net/libs/spirit/doc/html/index.html

So, is it okay to go ahead with this? I haven't noticed any comments
on the fusion change. Obviously, I'll make sure they're included
correctly in the beta (which should happen automatically).

Daniel

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
TONGARI | 28 Sep 22:03
Picon
Gravatar

Proposal for qi::seek[] directive, next step?

Hi,


In the thread:

I've proposed this directive, and I'd like to know your opinions.
Though Thomas Bernard had provided another interesting idea, I'm not proposing that ATM.
 
If you consider to accept this component, please let me know and tell me the next step to take (e.g. submission).


Thanks.
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Spirit-devel mailing list
Spirit-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spirit-devel
Julien Peeters | 7 Aug 15:19

New feature in Spirit.Lex

Hi readers,

Sorry for people who will receive this email twice, but I didn't know 
where is the best place to post this email.

Yesturday I've started using Spirit.Lex for building a simple 
source-code comment separator. For a given source file, the scanner 
would seperate code from comments matching a special start pattern (here 
"/*>"). Previously I wrote it using OCamllex, which is a very brillant 
lexer from the OCaml toolset.

Indeed, writing such a comment separator with OCamllex is very easy 
thanks to a specific feature that I would call "multi-context" lexer (I 
don't know the real name of this feature). But it is quiet hard to 
implement is using Spirit, at least using my current knowlegde of it. As 
much I understand, implementing it using Spirit would required to use a 
state variable to select the context in witch the lexer is in when it 
consumes some token. However, this not prevent from matching (and 
consuming) tokens that do not belong to the context.

Finally, I aim to use Spirit.Lex because OCamllex has some limitations. 
In particular, it does not allow dynamic addition of patterns, like Flex 
if I am not wrong. Then, one lexer must be generated for each comment 
patterns (e.g. when adding support for other languages than C/C++).

So as to illustrate my words, here is a code sample of what I did using 
OCamllex:

 >>> START OF SAMPLE CODE

{
   type expr = Code of string | SpecialComment of string

   let buffer = Buffer.create 32
}

let blank        = [' ' '\013' '\009' '\012']
let nl           = ['\010']
let not_nl       = [^ '\010']
let blank_nl     = [' ' '\013' '\009' '\012' '\010']
let not_blank_nl = [^ ' ' '\013' '\009' '\012' '\010']

rule main state = parse
   | blank* "/*>" blank_nl* "*/"
       {
         main state lexbuf
       }

   | blank* "/*>" blank_nl*
       {
         let state2 =
           if Buffer.length buffer > 0 then begin
             let code = Code (Buffer.contents buffer) in
             let _ = Buffer.reset buffer in
               code :: state
           end else
             state
         in
         let state3 = (special_comment lexbuf) :: state2 in
           main state3 lexbuf
       }

   | _ as c
       {
         Buffer.add_char buffer c;
         main state lexbuf
       }

   | eof
       {
         if Buffer.length buffer > 0 then
           let code = Buffer.contents buffer in
             Buffer.reset buffer;
             (Code code)::state
         else
           state
       }

and special_comment = parse
   | "*/" nl+
       {
         let com = SpecialComment (Buffer.contents buffer) in
           Buffer.reset buffer;
           com
       }

   | nl nl+ blank_nl*
       {
         Buffer.add_string buffer "\n\n";
         special_comment lexbuf
       }

   | blank_nl+
       {
         Buffer.add_char buffer ' ';
         special_comment lexbuf
       }

   | not_blank_nl as c
       {
         Buffer.add_char buffer c;
         special_comment lexbuf
       }

{
   let main () =
     let lexbuf = Lexing.from_channel stdin in
     let result = main [] lexbuf in
       List.iter
         ( fun item ->
             match item with
               | Code str -> Printf.fprintf stdout "<code>%s</code>" str
               | SpecialComment str -> Printf.fprintf stderr 
"<special>%s</special>" str )
         result

   let _ = main ()
}

<<< END OF SAMPLE CODE

There are two rules: main and special_comment. The lexer starts in the 
main rule when it is first called. When the pattern "/*>" is matched, 
the lexer switches in the special_comment rule and returns when the 
pattern "*/" is matched.

The purpose of this post is to ask to the Spirit developers if the 
current implementation allows such a "multi-context" construct. If it's 
the case I would appreciate any help for that. If it's not, I would 
consider starting and/or participating to the implementation of this 
feature if you consider it's relevant. However, I would need some help 
at the beginning because I am new to Spirit.Lex internals.

In terms of implementation, I think it is like building as many macro 
states as there are rule in the semantic of Ocamllex. Each macro state 
is itself a state machine in the semantic of Spirit.Lex. Then, semantic 
actions of the lexer can allow to jump (or switch) between macro states.

Feel free to ask any question if I was not clear enough or if you are 
not familiar with OCaml/OCamllex syntax ans semantics.

Best regards,

Julien.

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
Robert Nelson | 22 May 01:56
Picon

[Spirit Devel] TRUNK IS BROKEN

I just updated to trunk and I believe that an update to proto is
causing serious problems

Thanks
--Robert Nelson

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
Robert Nelson | 7 May 02:52
Picon

[Spirit Devel] bug in karma_rule.hpp

To reduce compiler includes, I attempted to use karma_rule.hpp instead
of the the full blown karma.hpp

The following minimal program fails to compile on boost trunk:

#include <boost/spirit/include/karma_rule.hpp>

int main()
{
}

Thanks
--Robert Nelson

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
Michael Roper | 19 Apr 06:51
Picon

mini-xml

I am trying to extend the Mini-XML example that is in the Spirit::Qi
documentation. I am having trouble with parsing elements with
attributes. The grammar and the rule declarations follow.

            text = lexeme[+(char_ - '<')        [_val += _1]];
            node = (xml | text)                 [_val = _1];

	    Name  = NameStartChar *(NameChar);
	    NameStartChar = qi::char_("a-zA-Z_");
	    Digit = qi::char_("0-9");

	    NameChar      = (NameStartChar | '-' | '.' | ':' | Digit);
	

            start_tag =
                    '<'
	            >>  Name
		    >>  *(wspc >> attribute)
		    >> -wspc
		    >> '>';

	    wspc = ('\r'|'\t'|'\n'|' ');

	    attribute = Name >> '=' >> AttValue;

	    AttValue = "'" >> -Name >> "'";

            end_tag =
                    "</"
                >>  string(_r1)
                >>  '>'
            ;

            xml =
                    start_tag                   [at_c<0>(_val) = _1]
                >>  *node                       [push_back(at_c<1>(_val), _1)]
                >>  end_tag(at_c<0>(_val))
            ;
        }

      qi::rule<Iterator, mini_xml(), ascii::space_type> xml;
      qi::rule<Iterator, mini_xml_node(), ascii::space_type> node;
      qi::rule<Iterator, std::string(), ascii::space_type> text;
      qi::rule<Iterator, std::string(), ascii::space_type> start_tag;
      qi::rule<Iterator, void(std::string), ascii::space_type> end_tag;
      qi::rule<Iterator, std::string()> Name;
      qi::rule<Iterator, std::string()> NameStartChar;
      qi::rule<Iterator, std::string()> Digit;
      qi::rule<Iterator, std::string()> NameChar;
      qi::rule<Iterator, std::string()> wspc;
      qi::rule<Iterator, std::string()> attribute;
      qi::rule<Iterator, std::string()> AttValue;

Thanks very much for your time,
Michael.

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev

Gmane