X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/82a02edec66cecb6ab494865736e5d75519b81db..66170b30c7577168b02b9980304f35026a94de1a:/Highlight.cpp diff --git a/Highlight.cpp b/Highlight.cpp index 371722e..2587d19 100644 --- a/Highlight.cpp +++ b/Highlight.cpp @@ -53,9 +53,10 @@ struct CYColor { } }; -void CYLexerHighlight(const char *data, size_t size, std::ostream &output) { +void CYLexerHighlight(const char *data, size_t size, std::ostream &output, bool ignore) { CYStream stream(data, data + size); CYDriver driver(stream); + driver.commented_ = true; size_t offset(0); cy::position current; @@ -82,11 +83,24 @@ void CYLexerHighlight(const char *data, size_t size, std::ostream &output) { } Skip(data, size, output, offset, current, location.begin); - if (color.code_ != 0) + + if (color.code_ != 0) { + if (ignore) + output << CYIgnoreStart; output << "\e[" << (color.bold_ ? '1' : '0') << ";" << color.code_ << "m"; + if (ignore) + output << CYIgnoreEnd; + } + Skip(data, size, output, offset, current, location.end); - if (color.code_ != 0) + + if (color.code_ != 0) { + if (ignore) + output << CYIgnoreStart; output << "\e[0m"; + if (ignore) + output << CYIgnoreEnd; + } } output.write(data + offset, size - offset);