-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#967: Added CTPG script options parser
- Loading branch information
Showing
17 changed files
with
361 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
exaudfclient/base/javacontainer/script_options/scriptoptionlinesparserlegacy.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
cc_library( | ||
name = "scriptoptionlinesparser", | ||
hdrs = ["scriptoptionlines.h"], | ||
srcs = ["scriptoptionlines.cc","scriptoptionlines.h"], | ||
copts= ["-fno-lto"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
cc_library( | ||
name = "scriptoptionlinesparser_ctpg", | ||
hdrs = ["scriptoptionlines_ctpg.h"], | ||
srcs = ["scriptoptionlines_ctpg.cc","ctpg.hpp"], | ||
copts= ["-fno-lto"], | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
exaudfclient/base/script_options_parser/ctpg/scriptoptionlines_ctpg.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#ifndef SCRIPTOPTIONLINESCTPG_H | ||
#define SCRIPTOPTIONLINESCTPG_H | ||
|
||
#include <string> | ||
#include <functional> | ||
#include <vector> | ||
#include <map> | ||
#include <ostream> | ||
|
||
namespace ExecutionGraph | ||
{ | ||
|
||
namespace OptionsLineParser | ||
{ | ||
|
||
namespace CTPG | ||
{ | ||
|
||
class ParserResult; | ||
|
||
struct ScriptOption { | ||
std::string value; | ||
size_t idx_in_source; | ||
size_t size; | ||
|
||
bool operator==(const ScriptOption & right) const { | ||
return value == right.value && idx_in_source == right.idx_in_source && size == right.size; | ||
} | ||
friend void PrintTo(const ScriptOption& option, std::ostream* os) { | ||
*os << "(" << option.value << "," << option.idx_in_source << "," << option.size << ")"; | ||
} | ||
}; | ||
|
||
using options_t = std::vector<ScriptOption>; | ||
|
||
using options_map_t = std::map<std::string, options_t>; | ||
|
||
/*! | ||
* \brief extractOptionLine Extracts syntactically valid option lines of form %<option> <values> [<values>] from UDF scripts. | ||
* | ||
* \param code Reference to string where the script code is stored. | ||
* \param result Result of all found options. | ||
* \param throwException Function to be called to throw exception. | ||
* | ||
*/ | ||
void parseOptions(const std::string& code, options_map_t & result, std::function<void(const char*)> throwException); | ||
|
||
} //namespace CTPG | ||
|
||
} // namespace OptionsLineParser | ||
|
||
} // namespace ExecutionGraph | ||
|
||
#endif // SCRIPTOPTIONLINESCTPG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cc_test( | ||
name = "script-options-ctpg-parser-test", | ||
srcs = ["script_option_lines_test.cpp"], | ||
deps = [ | ||
"//base/script_options_parser/ctpg:scriptoptionlinesparser_ctpg", | ||
"@googletest//:gtest_main", | ||
], | ||
) |
Oops, something went wrong.