X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FParse.ih;h=9a62aa7e525dc1bc6fcb0fab23620b37367fe736;hb=fe92380af7b511d398290e4ab0c535025006b57b;hp=2f7c80d373afc3689e358fb52a189fdfcedab826;hpb=5e9e6057a4e5c1241ff3f1b75b0f797eb570725d;p=senf.git diff --git a/Console/Parse.ih b/Console/Parse.ih index 2f7c80d..9a62aa7 100644 --- a/Console/Parse.ih +++ b/Console/Parse.ih @@ -42,6 +42,11 @@ namespace senf { namespace console { namespace detail { +#ifndef DOXYGEN + + /////////////////////////////////////////////////////////////////////////// + // append_a + struct append_action { template @@ -56,16 +61,15 @@ namespace detail { template inline boost::spirit::ref_value_actor append_a(T & ref) - { - return boost::spirit::ref_value_actor(ref); - } + { return boost::spirit::ref_value_actor(ref); } template inline boost::spirit::ref_const_ref_actor append_a(T & ref, Value const & value) - { - return boost::spirit::ref_const_ref_actor(ref, value); - } + { return boost::spirit::ref_const_ref_actor(ref, value); } + + /////////////////////////////////////////////////////////////////////////// + // Grammar template struct CommandGrammar : boost::spirit::grammar > @@ -136,7 +140,8 @@ namespace detail { special_p ("/(){};"), // Characters which are returned as punctuation tokens - punctuation_p (",="), + // (only allowed within '()') + punctuation_p (",=/{};"), // Whitespace characters space_p (" \t\n\r"), @@ -163,7 +168,7 @@ namespace detail { // Syntax summary: // This is EBNF with some minor tweaks to accommodate C++ syntax // - // * and + precede their argument + // * and + like EBNF but they precede their argument // >> is followed by // ! optional // a % b match any number of a's separated by b @@ -188,7 +193,7 @@ namespace detail { // // Aligned to the right at column 50 are semantic actions. // - // For clarity, I have used 'ch_p' explicitly throughout even though it is auxiliary + // For clarity, I have used 'ch_p' explicitly throughout even though it is optional // in most cases. // // More info is in the Boost.Spirit documentation @@ -208,11 +213,16 @@ namespace detail { >> path >> eps_p [ self.dispatch(&PD::builtin_cd, boost::ref(self.context.path)) ] - | keyword_p("ls") + | keyword_p("ls") >> ! path >> eps_p [ self.dispatch(&PD::builtin_ls, boost::ref(self.context.path)) ] | keyword_p("exit") [ self.dispatch(&PD::builtin_exit) ] + + | keyword_p("help") + >> ! path + >> eps_p [ self.dispatch(&PD::builtin_help, + boost::ref(self.context.path)) ] ; block @@ -280,9 +290,8 @@ namespace detail { abspath = ch_p('/') [ push_back_a(self.context.path, "") ] - >> ! ( ( word [ push_back_a(self.context.path) ] - % ch_p('/') ) - >> ( ! ch_p('/') [ push_back_a(self.context.path,"") ] ) ) + >> ( relpath + | eps_p [ push_back_a(self.context.path, "") ] ) ; balanced_tokens @@ -345,6 +354,10 @@ namespace detail { }; }; + + +#endif + }}} ///////////////////////////////ih.e////////////////////////////////////////