// file : build2/test/script/parser -*- C++ -*- // copyright : Copyright (c) 2014-2016 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file #ifndef BUILD2_TEST_SCRIPT_PARSER #define BUILD2_TEST_SCRIPT_PARSER #include #include #include #include #include #include namespace build2 { namespace test { namespace script { class lexer; class runner; class parser: protected build2::parser { public: // Issue diagnostics and throw failed in case of an error. // void parse (istream&, const path& name, target& test, target& script, runner&); // Recursive descent parser. // // Each parse function receives the token/type from which it should // start consuming. On return the token/type should contain the first // token that has not been consumed. For *_line() functions this is // the newline. // protected: void parse_script (token&, token_type&); void parse_script_line (token&, token_type&); void parse_variable_line (token&, token_type&, string); void parse_test_line (token&, token_type&, names_type, location); command_exit parse_command_exit (token&, token_type&); string parse_here_document (token&, token_type&, const string&); // Customization hooks. // protected: virtual lookup lookup_variable (name&&, string&&, const location&) override; protected: using base_parser = build2::parser; lexer* lexer_; script* script_; runner* runner_; }; } } } #endif // BUILD2_TEST_SCRIPT_PARSER