jed-users mailing list

[2004 Date Index] [2004 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

python patch


Hello,

this patch lets triple quoted strings in Python get highlighted as comments.
--- lib/pymode.sl
+++ lib/pymode.sl
@@ -484,6 +484,7 @@
 define_syntax ('"', '"', $1);			% quoted strings
 define_syntax ('\'', '"', $1);			% quoted strings
 %define_syntax ('\'', '\'', $1);			% quoted characters
+define_syntax ("\"\"\"", "\"\"\"", '%', $1);			% quoted strings
 define_syntax ('\\', '\\', $1);			% continuations
 define_syntax ("0-9a-zA-Z_", 'w', $1);		% words
 define_syntax ("-+0-9a-fA-FjJlLxX.", '0', $1);	% Numbers

--- src/indent.c
+++ src/indent.c
@@ -260,6 +260,19 @@
 	  }
 
 	/* Search for a string delimiter, char delimiter, or comment start. */
+	if ((ch == com_start_char)
+	    && (comment_start != NULL)
+	    && (p + table->comment_start_len <= pmax)
+	    && (0 == strncmp ((char *) p, comment_start,
+			      table->comment_start_len)))
+	  {
+	     p = find_comment_end (table, p + table->comment_start_len, pmax);
+	     if (p == NULL)
+	       return JED_LINE_IN_COMMENT;
+
+	     continue;
+	  }
+
 	if (syntax[ch] & (STRING_SYNTAX))
 	  {
 	     p = find_string_end (table, p + 1, pmax, ch);
@@ -288,18 +301,6 @@
 	     continue;
 	  }
 
-	if ((ch == com_start_char)
-	    && (comment_start != NULL)
-	    && (p + table->comment_start_len <= pmax)
-	    && (0 == strncmp ((char *) p, comment_start,
-			      table->comment_start_len)))
-	  {
-	     p = find_comment_end (table, p + table->comment_start_len, pmax);
-	     if (p == NULL)
-	       return JED_LINE_IN_COMMENT;
-
-	     continue;
-	  }
 
 	if (_jed_is_eol_comment_start (table, l, p, pmax, NULL))
 	  return JED_LINE_HAS_EOL_COMMENT;

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2004 date index] [2004 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]