#include <senf/Utils/Phoenix.hh>
-///////////////////////////////ih.p////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
namespace senf {
namespace console {
::phoenix::function<PositionOf> const positionOf;
- ///////////////////////////////////////////////////////////////////////////
+ //-/////////////////////////////////////////////////////////////////////////////////////////////
// Grammar
template <class ParseDispatcher>
struct CommandGrammar : boost_spirit::grammar<CommandGrammar<ParseDispatcher> >
{
- ///////////////////////////////////////////////////////////////////////////
+ //-/////////////////////////////////////////////////////////////////////////////////////////
// Start rules
enum { CommandParser, SkipParser, ArgumentsParser, PathParser };
- ///////////////////////////////////////////////////////////////////////////
+ //-/////////////////////////////////////////////////////////////////////////////////////////
// The parse context (variables needed while parsing)
typedef Token::TokenType TokenType;
Context & context;
- ///////////////////////////////////////////////////////////////////////////
+ //-/////////////////////////////////////////////////////////////////////////////////////////
// Configuration
bool incremental;
- ///////////////////////////////////////////////////////////////////////////
+ //-/////////////////////////////////////////////////////////////////////////////////////////
// Dispatching semantic actions
ParseDispatcher & dispatcher;
- //////////////////////////////////////////////////////////////////////////
+ //-/////////////////////////////////////////////////////////////////////////////////////////
// charachter sets
static boost_spirit::chset<> special_p;
static boost_spirit::chset<> word_p;
static boost_spirit::distinct_parser<> keyword_p;
- ///////////////////////////////////////////////////////////////////////////
+ //-/////////////////////////////////////////////////////////////////////////////////////////
// Errors
enum Errors {
QuoteExpected
};
- ///////////////////////////////////////////////////////////////////////////
+ //-/////////////////////////////////////////////////////////////////////////////////////////
CommandGrammar(ParseDispatcher & d, Context & c)
: context(c), incremental(false), dispatcher(d) {}
boost_spirit::rule<Scanner>,
boost_spirit::rule<Scanner> >
{
- boost_spirit::rule<Scanner> command, path, argument, word, string, hexstring, token,
- punctuation, hexbyte, balanced_tokens, simple_argument, complex_argument, builtin,
- skip, statement, relpath, abspath, arguments, group_start, group_close,
- statement_end, opt_path;
+ boost_spirit::rule<Scanner> command, path, argument, word, string, hexstring,
+ word_or_string, token, punctuation, hexbyte, balanced_tokens, simple_argument,
+ complex_argument, builtin, skip, statement, relpath, abspath, arguments,
+ group_start, group_close, statement_end, opt_path;
definition(CommandGrammar const & self)
{
assertion<Errors> closing_paren_expected (ClosingParenExpected);
assertion<Errors> quote_expected (QuoteExpected);
- ///////////////////////////////////////////////////////////////////
+ //-/////////////////////////////////////////////////////////////////////////////////
// Spirit grammar
//
// Syntax summary:
;
relpath
- = ( word [ push_back(path_, token_) ]
+ = ( word_or_string [ push_back(path_, token_) ]
% +ch_p('/') )
>> ( ! (+ch_p('/') ) [ push_back(path_, construct_<Token>()) ] )
;
pos_) ]
;
+ word_or_string
+ = word
+ | string
+ ;
+
hexbyte
= uint_parser<char, 16, 2, 2>()
[ push_back(str_, arg1) ]
= self.space_p | comment_p('#')
;
- ///////////////////////////////////////////////////////////////////
+ //-/////////////////////////////////////////////////////////////////////////////////
start_parsers(
command, // CommandParser
}}}
-///////////////////////////////ih.e////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
#endif
\f