$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: jono (jp_at_[hidden])
Date: 2008-01-22 20:04:25
hello possums!
i have the following rules declared in a spirit grammar definition  
(using boost 1.8.4 ).....
//-----------------------
        typedef typename lexeme_scanner<ScannerT>::type lexeme_scanner_t;
        rule<lexeme_scanner_t>
             legal_initial_p
            ,legal_p
            ;
//-----------------------
and initialized in definition::definition() ....
//-----------------------
    legal_initial_p = alpha_p | ch_p('_')
            |'<'|'>'|'='|'?'|'/'|'*'|'&'|'-'|'+'|'%'
            |'!'|'$'|':'|'@'
            ;
    legal_p = legal_initial_p | digit_p | ch_p('.')
        ;
//-----------------------
the above code compiles and functions as expected under MSVC 7.1 but 
causes g++  4.1.1 to hang. 
if i use type rule<ScannerT> for legal_p and legal_initial_p, the code 
compiles on both, but doesn't work properly.
i'm using |dynamic_distinct_parser ||so i can handle the '.' character 
as a syntactic token in certain contexts.
|||//---------------------- |some declarations ...
||
    struct keywords : symbols<Object> { ... } keywords_p;
||    ||dynamic_distinct_parser<ScannerT> keyword_p;
|||||
//----------------------|some definitions ...|
|
    ||chset<> distinct(chset<>(legal_ident) | chset<>("0-9"));
    distinct_directive<> keyword_d(distinct);
    distinct_parser<> keyword_p(distinct);
||||
||   ||rule<ScannerT, object_closure::context_t> ||Symbol_p =   
                lexeme_d    [ ( legal_initial_p >> *legal_p ) - 
keywords_p  ]           
                            [ Symbol_p.value_ = intern_(arg1, arg2) ]
                ;
||
|||    dot_p = keyword_p(".");
//----------------------
|// ....
||it's quite possible there's a better way to do the parsing, but it was 
fiddly, and i don't have any more time to mess with it.
(the rest of the grammar is a recursive scheme reader, hence the closures)
i would be very grateful for any suggestions as to what might be causing 
g++ to go walkabout!
cheers,
jono
jp_at_[hidden]
|
|
|