more ProOpen and PostOpen hook points
[nedit-bw.git] / full-single-quoted.patch
blobcc88df22d6796c3da0bd776b308b2e2ddb48b805
1 Subject: allow newlines in single quoted string
3 This allows a newline to be inside a single quoted string, i.e.
5 str = 'hello
6 word
8 also adds syntax pattern for single quoted string and updates escape chars for
9 double quoted string.
11 ---
13 source/highlightData.c | 4 +++-
14 source/parse.y | 7 +++++--
15 2 files changed, 8 insertions(+), 3 deletions(-)
17 diff --quilt old/source/parse.y new/source/parse.y
18 --- old/source/parse.y
19 +++ new/source/parse.y
20 @@ -1035,8 +1035,11 @@ static int scanString(void)
21 handleBackslash = (stopper == '\"');
22 len = 0;
23 InPtr++;
24 - while (*InPtr != '\0' && *InPtr != '\n') {
25 - if (*InPtr == stopper) {
26 + while (*InPtr) {
27 + if (*InPtr == '\n' && handleBackslash) {
28 + break;
29 + }
30 + else if (*InPtr == stopper) {
31 char *endPtr = InPtr++;
32 skipWhitespace();
33 /* is this followed by another string literal? */
34 diff --quilt old/source/highlightData.c new/source/highlightData.c
35 --- old/source/highlightData.c
36 +++ new/source/highlightData.c
37 @@ -557,8 +557,10 @@ static char *DefaultPatternSets[] = {
38 Keyword:\"<(?:break|continue|define|delete|do|else|for|if|in|return|while)>\":::Keyword::\n\
39 Braces:\"[{}\\[\\]()<>,.:;~!&|^%*/?=+-]\":::Keyword::\n\
40 Global Variable:\"\\$[A-Za-z0-9_]+\":::Identifier1::\n\
41 + String sq:\"'\":\"'\"::String::\n\
42 String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
43 - String Escape Char:\"\\\\(?:.|\\n)\":::Text Escape:String:\n\
44 + String Escape Char:\"\\\\(?:[\\\\\"\"ntbrfave\\n]|[xX][0-9a-fA-F]{1,2}|0*[0-7]{1,3})\":::Text Escape:String:\n\
45 + String Escape Char Error:\"\\\\.\":::Flag:String:\n\
46 Numeric Const:\"(?<!\\Y)-?[0-9]+>\":::Numeric Const::\n\
47 Macro Definition:\"(?<=define)\\s+\\w+\":::Subroutine1::\n\
48 Custom Macro:\"\\w+(?=\\s*(?:\\\\\\n)?\\s*[\\(])\":::Subroutine1::\n\