diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-12-12 06:50:58 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-12-12 06:50:58 +0000 |
| commit | 5b9d30c088108e7c3a85dfe1c2e6a2ad2eee23aa (patch) | |
| tree | 3be0e26f6cca75711ecdba3b4e45ab75a9d87c51 /src/command_manager.hh | |
| parent | 1ed866dbf09955abfbb46a7068a8a8dc2c6a9847 (diff) | |
Optimize the dynregex case where the expression refers directly to a regex option
Diffstat (limited to 'src/command_manager.hh')
| -rw-r--r-- | src/command_manager.hh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/command_manager.hh b/src/command_manager.hh index 2251e8b7..dbc87e81 100644 --- a/src/command_manager.hh +++ b/src/command_manager.hh @@ -61,6 +61,44 @@ private: using CommandInfo = std::pair<String, String>; +struct Token +{ + enum class Type + { + Raw, + RawQuoted, + RawEval, + ShellExpand, + RegisterExpand, + OptionExpand, + ValExpand, + ArgExpand, + CommandSeparator + }; + Token() : m_type(Type::Raw) {} + + Token(Type type, ByteCount b, ByteCount e, CharCoord coord, String str = "") + : m_type(type), m_begin(b), m_end(e), m_coord(coord), m_content(std::move(str)) {} + + Type type() const { return m_type; } + ByteCount begin() const { return m_begin; } + ByteCount end() const { return m_end; } + CharCoord coord() const { return m_coord; } + const String& content() const { return m_content; } + +private: + Type m_type; + ByteCount m_begin; + ByteCount m_end; + CharCoord m_coord; + String m_content; +}; + +using TokenList = Vector<Token>; + +template<bool throw_on_unterminated> +TokenList parse(StringView line); + class CommandManager : public Singleton<CommandManager> { public: |
