Browse Source

Further cleanup of is_token_char

pipelines/353213535
eidheim 4 years ago
parent
commit
80cb893f0f
  1. 4
      src/ctags.cpp
  2. 3
      src/source_base.cpp
  3. 2
      src/source_base.hpp
  4. 4
      src/source_generic.cpp
  5. 2
      src/source_generic.hpp

4
src/ctags.cpp

@ -99,7 +99,7 @@ Ctags::Location Ctags::get_location(const std::string &line_, bool add_markup, b
location.symbol = line.substr(0, symbol_end); location.symbol = line.substr(0, symbol_end);
if(9 < location.symbol.size() && location.symbol[8] == ' ' && starts_with(location.symbol, "operator")) { if(9 < location.symbol.size() && location.symbol[8] == ' ' && starts_with(location.symbol, "operator")) {
auto &chr = location.symbol[9]; auto &chr = location.symbol[9];
if(!((chr >= 'A' && chr <= 'Z') || (chr >= 'a' && chr <= 'z') || (chr >= '0' && chr <= '9') || chr == '_' || static_cast<unsigned char>(chr) >= 128)) if(!((chr >= 'A' && chr <= 'Z') || (chr >= 'a' && chr <= 'z') || (chr >= '0' && chr <= '9') || chr == '_' || chr == '$' || static_cast<unsigned char>(chr) >= 128))
location.symbol.erase(8, 1); location.symbol.erase(8, 1);
} }
@ -215,7 +215,7 @@ std::vector<std::string> Ctags::get_type_parts(const std::string &type) {
size_t text_start = std::string::npos; size_t text_start = std::string::npos;
for(size_t c = 0; c < type.size(); ++c) { for(size_t c = 0; c < type.size(); ++c) {
auto &chr = type[c]; auto &chr = type[c];
if((chr >= 'A' && chr <= 'Z') || (chr >= 'a' && chr <= 'z') || (chr >= '0' && chr <= '9') || chr == '_' || static_cast<unsigned char>(chr) >= 128 || chr == '~') { if((chr >= 'A' && chr <= 'Z') || (chr >= 'a' && chr <= 'z') || (chr >= '0' && chr <= '9') || chr == '_' || chr == '$' || static_cast<unsigned char>(chr) >= 128 || chr == '~') {
if(text_start == std::string::npos) if(text_start == std::string::npos)
text_start = c; text_start = c;
} }

3
src/source_base.cpp

@ -860,7 +860,8 @@ Gtk::TextIter Source::BaseView::get_tabs_end_iter() {
} }
bool Source::BaseView::is_token_char(gunichar chr) { bool Source::BaseView::is_token_char(gunichar chr) {
return (chr >= 'A' && chr <= 'Z') || (chr >= 'a' && chr <= 'z') || (chr >= '0' && chr <= '9') || chr == '_' || chr == '$' || chr >= 128; return (chr >= 'A' && chr <= 'Z') || (chr >= 'a' && chr <= 'z') || (chr >= '0' && chr <= '9') || chr == '_' || chr == '$' || chr >= 128 ||
(language_id == "css" && chr == '-');
} }
std::pair<Gtk::TextIter, Gtk::TextIter> Source::BaseView::get_token_iters(Gtk::TextIter iter) { std::pair<Gtk::TextIter, Gtk::TextIter> Source::BaseView::get_token_iters(Gtk::TextIter iter) {

2
src/source_base.hpp

@ -171,7 +171,7 @@ namespace Source {
Gtk::TextIter get_tabs_end_iter(); Gtk::TextIter get_tabs_end_iter();
public: public:
virtual bool is_token_char(gunichar chr); bool is_token_char(gunichar chr);
protected: protected:
std::pair<Gtk::TextIter, Gtk::TextIter> get_token_iters(Gtk::TextIter iter); std::pair<Gtk::TextIter, Gtk::TextIter> get_token_iters(Gtk::TextIter iter);

4
src/source_generic.cpp

@ -52,10 +52,6 @@ Source::GenericView::~GenericView() {
autocomplete.thread.join(); autocomplete.thread.join();
} }
bool Source::GenericView::is_token_char(gunichar chr) {
return Source::BaseView::is_token_char(chr) || (language_id == "css" && chr == '-');
}
void Source::GenericView::parse_language_file(bool &has_context_class, const boost::property_tree::ptree &pt) { void Source::GenericView::parse_language_file(bool &has_context_class, const boost::property_tree::ptree &pt) {
bool case_insensitive = false; bool case_insensitive = false;
for(auto &node : pt) { for(auto &node : pt) {

2
src/source_generic.hpp

@ -11,8 +11,6 @@ namespace Source {
GenericView(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language> &language); GenericView(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language> &language);
~GenericView(); ~GenericView();
bool is_token_char(gunichar chr) override;
private: private:
void parse_language_file(bool &has_context_class, const boost::property_tree::ptree &pt); void parse_language_file(bool &has_context_class, const boost::property_tree::ptree &pt);

Loading…
Cancel
Save