The attached patch adds support for highlighting of multi-line
preprocessor statements, and subclasses the c_comment state to account
for having to escape newlines.
--
Tim Retout <[EMAIL PROTECTED]>
Add support for highlighting of multi-line C preprocessor statements.
-- Tim Retout <[EMAIL PROTECTED]> Thu, 25 Oct 2007 22:12:33 +0100
diff --git a/states/hl/c_ppline.st b/states/hl/c_ppline.st
index 2bde859..b3fcf40 100644
--- a/states/hl/c_ppline.st
+++ b/states/hl/c_ppline.st
@@ -12,7 +12,7 @@ state c_ppline extends CHighlight
/\/\*/ {
comment_face (true);
language_print ($0);
- call (c_comment);
+ call (c_ppline_comment);
comment_face (false);
}
/* Include line. */
@@ -51,6 +51,9 @@ state c_ppline extends CHighlight
call (c_ppline_tokensequence);
return;
}
+ /\\\\\n/ {
+ language_print ($0);
+ }
/\n/ {
language_print ($0);
return;
@@ -81,6 +84,9 @@ state c_ppline_include extends CHighlight
call (c_ppline_comments_strings_chars);
return;
}
+ /\\\\\n/ {
+ language_print ($0);
+ }
/\n/ {
language_print ($0);
return;
@@ -106,6 +112,9 @@ state c_ppline_define extends CHighlight
call (c_ppline_comments_strings_chars);
return;
}
+ /\\\\\n/ {
+ language_print ($0);
+ }
/\n/ {
language_print ($0);
return;
@@ -118,7 +127,7 @@ state c_ppline_comments_strings_chars extends CHighlight
/\/\*/ {
comment_face (true);
language_print ($0);
- call (c_comment);
+ call (c_ppline_comment);
comment_face (false);
}
/* String constants. */
@@ -134,6 +143,9 @@ state c_ppline_comments_strings_chars extends CHighlight
language_print ($0);
string_face (false);
}
+ /\\\\\n/ {
+ language_print ($0);
+ }
/\n/ {
language_print ($0);
return;
@@ -146,7 +158,7 @@ state c_ppline_tokensequence extends CHighlight
/\/\*/ {
comment_face (true);
language_print ($0);
- call (c_comment);
+ call (c_ppline_comment);
comment_face (false);
}
/* String constants. */
@@ -181,6 +193,20 @@ state c_ppline_tokensequence extends CHighlight
language_print ($0);
variable_name_face (false);
}
+ /\\\\\n/ {
+ language_print ($0);
+ }
+ /\n/ {
+ language_print ($0);
+ return;
+ }
+}
+
+/* Comments within pre-processor directives need escaped newlines. */
+state c_ppline_comment extends c_comment {
+ /\\\\\n/ {
+ language_print ($0);
+ }
/\n/ {
language_print ($0);
return;