+ fix: YAML identifier (colon with white-space)

+ chg: JSON Lexer
This commit is contained in:
RaiKoHoff 2020-01-27 10:17:06 +01:00
parent 4abdcddede
commit 3d5b9d0bd7
9 changed files with 40 additions and 29 deletions

View File

@ -39,7 +39,7 @@ SettingsVersion=4
;UseOldStyleBraceMatching=0
;WebTemplate1=https://google.com/search?q=%s
;WebTemplate2=https://en.wikipedia.org/w/index.php?search=%s
;ExtendedWhiteSpaceChars=:
;ExtendedWhiteSpaceChars=
;AutoCompleteWordCharSet=
;AutoCompleteFillUpChars=
;LineCommentPostfixStrg=

View File

@ -1 +1 @@
2714
2715

View File

@ -1059,6 +1059,9 @@
#define IDS_LEX_STR_63361 63361
#define IDS_LEX_STR_63362 63362
#define IDS_LEX_STR_63363 63363
#define IDS_LEX_STR_63364 63364
#define IDS_LEX_STR_63365 63365
#define IDS_LEX_STR_63366 63366
#define IDS_LEX_CSV_COL_0 63400
#define IDS_LEX_CSV_COL_1 63401

View File

@ -461,6 +461,9 @@ BEGIN
IDS_LEX_STR_63361 "Substitution"
IDS_LEX_STR_63362 "Modifier"
IDS_LEX_STR_63363 "Tag"
IDS_LEX_STR_63364 "Property Name"
IDS_LEX_STR_63365 "LD Keyword"
IDS_LEX_STR_63366 "ESC Sequence"
END
STRINGTABLE

View File

@ -3,7 +3,7 @@
<assemblyIdentity
name="Notepad3"
processorArchitecture="*"
version="5.20.125.2714"
version="5.20.127.2715"
type="win32"
/>
<description>Notepad3 BETA</description>

View File

@ -122,7 +122,8 @@ static void ColouriseYAMLLine(
styler.ColourTo(endPos, SCE_YAML_COMMENT);
return;
//} else if (lineBuffer[i] == ':' && !bInQuotes) {
} else if (lineBuffer[i] == ':' && !bInQuotes && ((i+1) < lengthLine && lineBuffer[i+1] == ' ')) {
} else if (lineBuffer[i] == ':' && !bInQuotes &&
(((i+1) < lengthLine) && isspacechar(lineBuffer[i+1]))) {
styler.ColourTo(startLine + i - 1, SCE_YAML_IDENTIFIER);
styler.ColourTo(startLine + i, SCE_YAML_OPERATOR);
// Non-folding scalar

View File

@ -101,19 +101,19 @@ public:
// Functions for classifying characters
inline bool IsASpace(int ch) {
constexpr bool IsASpace(int ch) {
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
}
inline bool IsASpaceOrTab(int ch) {
constexpr bool IsASpaceOrTab(int ch) {
return (ch == ' ') || (ch == '\t');
}
inline bool IsADigit(int ch) {
constexpr bool IsADigit(int ch) {
return (ch >= '0') && (ch <= '9');
}
inline bool IsADigit(int ch, int base) {
constexpr bool IsADigit(int ch, int base) {
if (base <= 10) {
return (ch >= '0') && (ch < '0' + base);
} else {
@ -123,23 +123,23 @@ inline bool IsADigit(int ch, int base) {
}
}
inline bool IsASCII(int ch) {
constexpr bool IsASCII(int ch) {
return (ch >= 0) && (ch < 0x80);
}
inline bool IsLowerCase(int ch) {
constexpr bool IsLowerCase(int ch) {
return (ch >= 'a') && (ch <= 'z');
}
inline bool IsUpperCase(int ch) {
constexpr bool IsUpperCase(int ch) {
return (ch >= 'A') && (ch <= 'Z');
}
inline bool IsUpperOrLowerCase(int ch) {
constexpr bool IsUpperOrLowerCase(int ch) {
return IsUpperCase(ch) || IsLowerCase(ch);
}
inline bool IsAlphaNumeric(int ch) {
constexpr bool IsAlphaNumeric(int ch) {
return
((ch >= '0') && (ch <= '9')) ||
((ch >= 'a') && (ch <= 'z')) ||
@ -150,19 +150,19 @@ inline bool IsAlphaNumeric(int ch) {
* Check if a character is a space.
* This is ASCII specific but is safe with chars >= 0x80.
*/
inline bool isspacechar(int ch) {
constexpr bool isspacechar(int ch) {
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
}
inline bool iswordchar(int ch) {
constexpr bool iswordchar(int ch) {
return IsAlphaNumeric(ch) || ch == '.' || ch == '_';
}
inline bool iswordstart(int ch) {
constexpr bool iswordstart(int ch) {
return IsAlphaNumeric(ch) || ch == '_';
}
inline bool isoperator(int ch) {
constexpr bool isoperator(int ch) {
if (IsAlphaNumeric(ch))
return false;
if (ch == '%' || ch == '^' || ch == '&' || ch == '*' ||

View File

@ -3,24 +3,28 @@
// ----------------------------------------------------------------------------
KEYWORDLIST KeyWords_JSON = {
"false null true",
"@base @container @context @graph @id @index @language @list @reverse @set @type @value @vocab",
"Infinity NaN false null true",
"@base @container @context @direction @graph @id @import @included @index @json @language @list @nest @none "
"@prefix @propagate @protected @reverse @set @type @value @version @vocab",
NULL,
};
EDITLEXER lexJSON = {
SCLEX_JSON, IDS_LEX_JSON, L"JSON", L"json; eslintrc; jshintrc; jsonld; har; ipynb; wxcp; arcconfig", L"",
SCLEX_JSON, IDS_LEX_JSON, L"JSON", L"json; har; ipynb; wxcp; jshintrc; eslintrc; babelrc; prettierrc; stylelintrc; jsonld; jsonc; arcconfig; arclint; jscop", L"",
&KeyWords_JSON, {
{ {STYLE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },
//{ {SCE_C_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },
{ {SCE_C_COMMENT}, IDS_LEX_STR_63127, L"Comment", L"fore:#646464", L"" },
{ {SCE_C_WORD}, IDS_LEX_STR_63128, L"Keyword", L"bold; fore:#A46000", L"" },
{ {SCE_C_IDENTIFIER}, IDS_LEX_STR_63129, L"Identifier", L"", L"" },
{ {SCE_JSON_STRING}, IDS_LEX_STR_63131, L"String", L"fore:#008000", L"" },
{ {SCE_C_REGEX}, IDS_LEX_STR_63135, L"Regex", L"fore:#006633; back:#FFF1A8", L"" },
//{ {SCE_JSON_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },
{ {MULTI_STYLE(SCE_JSON_LINECOMMENT,SCE_JSON_BLOCKCOMMENT,0,0)}, IDS_LEX_STR_63127, L"Comment", L"fore:#646464", L"" },
{ {SCE_JSON_KEYWORD}, IDS_LEX_STR_63128, L"Keyword", L"bold; fore:#957000", L"" },
{ {SCE_JSON_LDKEYWORD}, IDS_LEX_STR_63365, L"LD Keyword", L"bold; fore:#A61D04", L"" },
{ {MULTI_STYLE(SCE_JSON_STRING,SCE_JSON_STRINGEOL,0,0)}, IDS_LEX_STR_63131, L"String", L"fore:#008000", L"" },
//{ {SCE_C_REGEX}, IDS_LEX_STR_63135, L"Regex", L"fore:#006633; back:#FFF1A8", L"" },
{ {SCE_JSON_NUMBER}, IDS_LEX_STR_63130, L"Number", L"fore:#FF0000", L"" },
{ {SCE_C_OPERATOR}, IDS_LEX_STR_63132, L"Operator", L"fore:#B000B0", L"" },
{ {SCE_JSON_OPERATOR}, IDS_LEX_STR_63132, L"Operator", L"fore:#B000B0", L"" },
{ {SCE_JSON_PROPERTYNAME}, IDS_LEX_STR_63364, L"Property Name", L"fore:#002697", L"" },
{ {SCE_JSON_ESCAPESEQUENCE}, IDS_LEX_STR_63366, L"ESC Sequence", L"fore:#0B982E", L"" },
{ {SCE_JSON_ERROR}, IDS_LEX_STR_63252, L"Parsing Error", L"fore:#FFFF00; back:#A00000; eolfilled", L"" },
EDITLEXER_SENTINEL } };
/*

View File

@ -8,8 +8,8 @@
#define SAPPNAME "Notepad3"
#define VERSION_MAJOR 5
#define VERSION_MINOR 20
#define VERSION_REV 125
#define VERSION_BUILD 2714
#define VERSION_REV 127
#define VERSION_BUILD 2715
#define SCINTILLA_VER 430
#define ONIGURUMA_REGEX_VER 6.9.4
#define UCHARDET_VER 2018.09.27