#include "src/trace_processor/perfetto_sql/engine/perfetto_sql_parser.h"
#include <algorithm>
#include <cctype>
#include <functional>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "perfetto/base/compiler.h"
#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/ext/base/flat_hash_map.h"
#include "perfetto/ext/base/string_utils.h"
#include "src/trace_processor/perfetto_sql/engine/perfetto_sql_preprocessor.h"
#include "src/trace_processor/sqlite/sql_source.h"
#include "src/trace_processor/sqlite/sqlite_tokenizer.h"
namespace perfetto {
namespace trace_processor {
namespace {
Token;
Statement;
enum class State { … };
bool KeywordEqual(std::string_view expected, std::string_view actual) { … }
bool TokenIsSqliteKeyword(std::string_view keyword, SqliteTokenizer::Token t) { … }
bool TokenIsCustomKeyword(std::string_view keyword, SqliteTokenizer::Token t) { … }
bool IsValidModuleWord(const std::string& word) { … }
bool ValidateModuleName(const std::string& name) { … }
}
PerfettoSqlParser::PerfettoSqlParser(
SqlSource source,
const base::FlatHashMap<std::string, PerfettoSqlPreprocessor::Macro>&
macros)
: … { … }
bool PerfettoSqlParser::Next() { … }
bool PerfettoSqlParser::ParseIncludePerfettoModule(
Token first_non_space_token) { … }
bool PerfettoSqlParser::ParseCreatePerfettoTableOrView(
bool replace,
Token first_non_space_token,
TableOrView table_or_view) { … }
bool PerfettoSqlParser::ParseCreatePerfettoIndex(bool replace,
Token first_non_space_token) { … }
bool PerfettoSqlParser::ParseDropPerfettoIndex(
SqliteTokenizer::Token first_non_space_token) { … }
bool PerfettoSqlParser::ParseCreatePerfettoFunction(
bool replace,
Token first_non_space_token) { … }
bool PerfettoSqlParser::ParseCreatePerfettoMacro(bool replace) { … }
bool PerfettoSqlParser::ParseRawArguments(std::vector<RawArgument>& args) { … }
bool PerfettoSqlParser::ParseArguments(
std::vector<sql_argument::ArgumentDefinition>& args) { … }
std::optional<sql_argument::ArgumentDefinition>
PerfettoSqlParser::ResolveRawArgument(RawArgument arg) { … }
bool PerfettoSqlParser::ErrorAtToken(const SqliteTokenizer::Token& token,
const char* error,
...) { … }
}
}