Hi everyone.
I've just started using Notepad++ and find it wonderful. I found a problem in user language syntax hilighting because it does not allow escape characters in strings (as in " \" "). I modified the lexer to allow them (patch attached), but I did not provide a patch for the user interface. You have to modify userDefineLang.xml to include the escape chars at the end of the delimiters (so that, for example, you have the value <"00"00\00>). I hope the setting is not lost when modifying the definition using the GUI.
I hope I have been useful.
Good to know this is a request that many more users have. Now you have created an solution, it would be great if it the feature would be implemented.
We have a workbench to create DSL's and we generate userDefineLang.xml files to support Notepad++ users, but are limited in supporting Strings now.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi everyone.
I've just started using Notepad++ and find it wonderful. I found a problem in user language syntax hilighting because it does not allow escape characters in strings (as in " \" "). I modified the lexer to allow them (patch attached), but I did not provide a patch for the user interface. You have to modify userDefineLang.xml to include the escape chars at the end of the delimiters (so that, for example, you have the value <"00"00\00>). I hope the setting is not lost when modifying the definition using the GUI.
I hope I have been useful.
Thank you,
Ignazio
---
--- LexUser.cxx.orig 2008-02-10 00:08:36.000000000 +0100
+++ LexUser.cxx 2008-04-17 15:25:20.723681800 +0200
@@ -238,11 +238,13 @@
char delimOpen[3];
char delimClose[3];
-
+ char delimEscape[3];
+
for (int i = 0 ; i < 3 ; i++)
{
delimOpen[i] = keywords.words[0][i] == '0'?'\0':keywords.words[0][i];
delimClose[i] = keywords.words[0][i+3] == '0'?'\0':keywords.words[0][i+3];
+ delimEscape[i] = (strlen(keywords.words[0]) < 9 || keywords.words[0][i+6] == '0') ? '\0' : keywords.words[0][i+6];
}
StyleContext sc(startPos, length, initStyle, styler);
@@ -262,21 +264,21 @@
case SCE_USER_DELIMITER1 :
{
- if (delimClose[0] && (sc.ch == delimClose[0]))
+ if (delimClose[0] && (sc.ch == delimClose[0]) && chPrevNonWhite != delimEscape[0])
sc.ForwardSetState(SCE_USER_DEFAULT);
break;
}
case SCE_USER_DELIMITER2 :
{
- if (delimClose[0] && (sc.ch == delimClose[1]))
+ if (delimClose[0] && (sc.ch == delimClose[1]) && chPrevNonWhite != delimEscape[1])
sc.ForwardSetState(SCE_USER_DEFAULT);
break;
}
case SCE_USER_DELIMITER3 :
{
- if (delimClose[0] && (sc.ch == delimClose[2]))
+ if (delimClose[0] && (sc.ch == delimClose[2]) && chPrevNonWhite != delimEscape[2])
sc.ForwardSetState(SCE_USER_DEFAULT);
break;
}
Good to know this is a request that many more users have. Now you have created an solution, it would be great if it the feature would be implemented.
We have a workbench to create DSL's and we generate userDefineLang.xml files to support Notepad++ users, but are limited in supporting Strings now.