From 4d54a000410cb375b9e164d9de946e1ef0bef3bd Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Fri, 8 Jul 2016 23:19:12 -0400 Subject: [PATCH] [svn merge][r426] Updated C++ syntax highlighting to terminate strings at newline characters. Also fixed a bug that prevented the '--no-rcfile' and '--rcfile' command line options from being used with other options. --- src/usr/bin/diffuse | 5 ++--- src/usr/share/diffuse/syntax/c++.syntax | 12 ++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/usr/bin/diffuse b/src/usr/bin/diffuse index 0802bff..8da266d 100755 --- a/src/usr/bin/diffuse +++ b/src/usr/bin/diffuse @@ -154,7 +154,6 @@ whitespace = ' \t\n\r\x0b\x0c' # escape special glob characters def globEscape(s): - print 'globEscape', repr(s) m = dict([ (c, u'[%s]' % (c, )) for c in u'[]?*' ]) return u''.join([ m.get(c, c) for c in s ]) @@ -8364,9 +8363,9 @@ if __name__ == '__main__': data_dir = make_subdirs(data_dir, subdirs) # load resource files i, rc_files = 1, [] - if argc == 2 and args[1] == '--no-rcfile': + if i < argc and args[i] == '--no-rcfile': i += 1 - elif argc == 3 and args[1] == '--rcfile': + elif i + 1 < argc and args[i] == '--rcfile': i += 1 rc_files.append(args[i]) i += 1 diff --git a/src/usr/share/diffuse/syntax/c++.syntax b/src/usr/share/diffuse/syntax/c++.syntax index d896613..811d268 100644 --- a/src/usr/share/diffuse/syntax/c++.syntax +++ b/src/usr/share/diffuse/syntax/c++.syntax @@ -47,15 +47,15 @@ syntax_pattern cpp cpp c++_cpp '.[^\\/\r\n]*' # char syntax_pattern normal char c++_string "[uUL]?'" -syntax_pattern char normal c++_string "'" -syntax_pattern char char c++_escapedchar '(\\([0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|.))+' -syntax_pattern char char c++_string ".[^\\\\']*" +syntax_pattern char normal c++_string "['\\n]" +syntax_pattern char char c++_escapedchar '(\\([0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|.|\n))+' +syntax_pattern char char c++_string ".[^\\\\\\n']*" # string syntax_pattern normal string c++_string '(u|u8|U|L)?"' -syntax_pattern string normal c++_string '"' -syntax_pattern string string c++_escapedchar '(\\([0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|.))+' -syntax_pattern string string c++_string '.[^\\"]*' +syntax_pattern string normal c++_string '["\n]' +syntax_pattern string string c++_escapedchar '(\\([0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|.|\n))+' +syntax_pattern string string c++_string '.[^\\\n"]*' # raw string syntax_pattern normal raw_string c++_string '(u|u8|U|L)?R"[^\(]*\('