From 5b9d30c088108e7c3a85dfe1c2e6a2ad2eee23aa Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 12 Dec 2015 06:50:58 +0000 Subject: Optimize the dynregex case where the expression refers directly to a regex option --- src/command_manager.hh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/command_manager.hh') 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; +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; + +template +TokenList parse(StringView line); + class CommandManager : public Singleton { public: -- cgit v1.2.3