From 0d0eedb559f66854c7f39546390b9adf6af8199d Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 13 Jun 2019 03:56:31 +0200 Subject: [PATCH 1/8] + enh: TOML Lexer: add "Literal String" and "Number" --- sciXlexers/CharSetX.h | 15 ++- sciXlexers/LexTOML.cxx | 228 +++++++++++++++++++++++++-------- sciXlexers/SciXLexer.h | 18 +-- src/StyleLexers/styleLexTOML.c | 4 +- 4 files changed, 196 insertions(+), 69 deletions(-) diff --git a/sciXlexers/CharSetX.h b/sciXlexers/CharSetX.h index e0e776d5a..b0ae3e320 100644 --- a/sciXlexers/CharSetX.h +++ b/sciXlexers/CharSetX.h @@ -27,17 +27,24 @@ constexpr bool IsLineBreak(const int ch) noexcept { return ((ch == '\n') || (ch == '\r')); } +inline int IsNumber(const Scintilla::StyleContext& sc) { + return Scintilla::IsADigit(sc.ch) || (((sc.ch == '+') || (sc.ch == '-')) && Scintilla::IsADigit(sc.chNext)); +} + constexpr int IsNumHex(const Scintilla::StyleContext& sc) noexcept { - return (sc.chNext == 'x') || (sc.chNext == 'X'); + return (sc.ch == '0') && (sc.chNext == 'x') || (sc.chNext == 'X'); } constexpr int IsNumBinary(const Scintilla::StyleContext& sc) noexcept { - return (sc.chNext == 'b') || (sc.chNext == 'B'); + return (sc.ch == '0') && (sc.chNext == 'b') || (sc.chNext == 'B'); } - inline int IsNumOctal(const Scintilla::StyleContext& sc) { - return Scintilla::IsADigit(sc.chNext) || (sc.chNext == 'o'); + return (sc.ch == '0') && (sc.chNext == 'o') || (sc.chNext == 'O'); +} + +inline int IsNumExponent(const Scintilla::StyleContext& sc) { + return Scintilla::IsADigit(sc.ch) && ((sc.chNext == 'e') || (sc.chNext == 'E')); } inline bool IsAIdentifierChar(const int ch) { diff --git a/sciXlexers/LexTOML.cxx b/sciXlexers/LexTOML.cxx index 568051fcd..bf3f91525 100644 --- a/sciXlexers/LexTOML.cxx +++ b/sciXlexers/LexTOML.cxx @@ -83,7 +83,7 @@ namespace { }; static const char* const tomlWordListDesc[] = { - "TOML", + "true false inf -inf +inf nan -nan +nan", nullptr }; @@ -100,13 +100,16 @@ namespace { LexicalClass lexicalClasses[] = { // Lexer TOML SCLEX_TOML SCE_TOML_: 0, "SCE_TOML_DEFAULT", "default", "Default", - 1, "SCE_TOML_COMMENT", "comment", "Comment", - 2, "SCE_TOML_KEY", "key", "Key", + 1, "SCE_TOML_KEYWORD", "keyword", "Keyword", + 2, "SCE_TOML_COMMENT", "comment", "Comment", 3, "SCE_TOML_SECTION", "section", "Section", - 4, "SCE_TOML_ASSIGNMENT", "assignment", "Assignment", - 5, "SCE_TOML_DEFVAL", "default value", "Default Value", - 6, "SCE_TOML_VALUETYPE", "value type", "Value Type", - 7, "SCE_TOML_PARSINGERROR", "type error", "Type Error", + 4, "SCE_TOML_KEY", "key", "Key", + 5, "SCE_TOML_ASSIGNMENT", "assignment", "Assignment", + 6, "SCE_TOML_VALUE", "value", "Value", + 7, "SCE_TOML_NUMBER", "number", "Number", + 8, "SCE_TOML_STR_BASIC", "string_basic", "Basic String", + 9, "SCE_TOML_STR_LITERAL", "string_basic", "Literal String", + 10, "SCE_TOML_PARSINGERROR", "type_error", "Type Error", }; } // end of namespace @@ -230,6 +233,16 @@ inline bool IsAKeyChar(const int ch) { } // ---------------------------------------------------------------------------- +inline bool IsValidNumEnd(const int ch) { + return ( + IsASpace(ch) || + IsCommentChar(ch) || + (ch == ',') || + (ch == ']') + ); +} +// ---------------------------------------------------------------------------- + static int GetBracketLevel(StyleContext& sc) { @@ -261,6 +274,7 @@ static int GetBracketLevel(StyleContext& sc) // ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument* pAccess) { @@ -268,8 +282,12 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int StyleContext sc(startPos, length, initStyle, styler); bool inSectionDef = false; - bool inMultiLnString = (sc.state == SCE_TOML_STRING); - bool inMultiLnArrayDef = (sc.state == SCE_TOML_ARRAY); + bool inMultiLnString = (sc.state == SCE_TOML_STR_BASIC) || (sc.state == SCE_TOML_STR_LITERAL); + bool inMultiLnArrayDef = (sc.state == SCE_TOML_VALUE); + bool inHex = false; + bool inBin = false; + bool inOct = false; + //bool bFloatHasDot = false; for (; sc.More(); sc.Forward()) { @@ -280,21 +298,19 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int if (sc.atLineStart) { switch (sc.state) { - case SCE_TOML_STRING: + case SCE_TOML_STR_BASIC: + case SCE_TOML_STR_LITERAL: if (!inMultiLnString) { sc.SetState(SCE_TOML_PARSINGERROR); } break; - case SCE_TOML_ARRAY: - if (!inMultiLnArrayDef) { - sc.SetState(SCE_TOML_PARSINGERROR); - } - break; case SCE_TOML_PARSINGERROR: // preserve error break; default: - sc.SetState(SCE_TOML_DEFAULT); // reset + if (!inMultiLnArrayDef) { + sc.SetState(SCE_TOML_DEFAULT); // reset + } break; } } @@ -347,10 +363,12 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int } break; + case SCE_TOML_COMMENT: // eat - rest of line is comment break; + case SCE_TOML_SECTION: if (sc.ch == ']') { inSectionDef = false; @@ -365,6 +383,7 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int } break; + case SCE_TOML_KEY: if (IsASpaceOrTab(sc.ch)) { sc.SetState(SCE_TOML_ASSIGNMENT); // end of key @@ -377,6 +396,7 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int } break; + case SCE_TOML_ASSIGNMENT: if (IsAssignChar(sc.ch)) { sc.ForwardSetState(SCE_TOML_VALUE); @@ -393,48 +413,11 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int case SCE_TOML_VALUE: if (sc.ch == '[') { - sc.SetState(SCE_TOML_ARRAY); inMultiLnArrayDef = true; } else if (sc.ch == ']') { - sc.SetState(SCE_TOML_PARSINGERROR); - } - else if (sc.ch == '"') { - sc.SetState(SCE_TOML_STRING); - if (sc.Match(R"(""")")) { - inMultiLnString = true; - sc.Forward(2); - } - } - break; - - case SCE_TOML_STRING: - if (sc.ch == '\\') { - sc.ForwardSetState(SCE_TOML_STRING); - } - else if (sc.ch == '"') { - if (!inMultiLnString) { - sc.ForwardSetState(SCE_TOML_VALUE); - } - else { - // inMultiLnString - if (sc.Match(R"(""")")) { - sc.Forward(2); - sc.ForwardSetState(SCE_TOML_VALUE); - inMultiLnString = false; - } - else { - sc.SetState(SCE_TOML_PARSINGERROR); - } - } - } - break; - - case SCE_TOML_ARRAY: - if (sc.ch == ']') { int const level = GetBracketLevel(sc); if (level == 0) { - sc.ForwardSetState(SCE_TOML_VALUE); inMultiLnArrayDef = false; } else if (level < 0) { @@ -442,20 +425,153 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int inMultiLnArrayDef = false; } } + else if (IsNumber(sc)) { + sc.SetState(SCE_TOML_NUMBER); + if ((sc.ch == '+') || (sc.ch == '-')) { + sc.Forward(); + } + inHex = IsNumHex(sc); + inBin = IsNumBinary(sc); + inOct = IsNumOctal(sc); + if (inHex || inBin || inOct) { + sc.Forward(2); + } + if (IsNumExponent(sc)) { + sc.Forward(2); + if ((sc.ch == '+') || (sc.ch == '-')) { + sc.Forward(); + } + } + } + else if (sc.ch == '"') { + sc.SetState(SCE_TOML_STR_BASIC); + if (sc.Match(R"(""")")) { + inMultiLnString = true; + sc.Forward(2); + } + } + else if (sc.ch == '\'') { + sc.SetState(SCE_TOML_STR_LITERAL); + if (sc.Match(R"(''')")) { + inMultiLnString = true; + sc.Forward(2); + } + } break; + + case SCE_TOML_NUMBER: + if (sc.ch == '_') { + // eat // TODO: only once + } + else if (inHex || inBin || inOct) { + if (IsValidNumEnd(sc.ch)) { + sc.SetState(SCE_TOML_VALUE); + inHex = false; + inBin = false; + inOct = false; + } + else { + if ((inHex && !IsADigit(sc.ch, 16)) || + (inBin && !IsADigit(sc.ch, 2)) || + (inOct && !IsADigit(sc.ch, 8))) + { + sc.SetState(SCE_TOML_PARSINGERROR); + } + } + } + else if (IsNumExponent(sc)) { + sc.Forward(); + if ((sc.chNext == '+') || (sc.chNext == '-')) { + sc.Forward(); + } + } + else if (sc.ch == '.') { + // eat // TODO: only once + } + else if (IsADigit(sc.ch)) { + // eat + } + else { + if (IsValidNumEnd(sc.ch)) { + sc.SetState(SCE_TOML_VALUE); + inHex = false; + inBin = false; + inOct = false; + } + else { + sc.SetState(SCE_TOML_PARSINGERROR); + } + } + break; + + + case SCE_TOML_STR_BASIC: + case SCE_TOML_STR_LITERAL: + if (sc.ch == '\\') { + if (sc.state != SCE_TOML_STR_BASIC) { + sc.SetState(SCE_TOML_PARSINGERROR); + } + else { + sc.ForwardSetState(sc.state); + } + } + else if (sc.ch == '"') { + if (sc.state == SCE_TOML_STR_BASIC) { + if (!inMultiLnString) { + sc.ForwardSetState(SCE_TOML_VALUE); + } + else { + // inMultiLnString + if (sc.Match(R"(""")")) { + sc.Forward(2); + sc.ForwardSetState(SCE_TOML_VALUE); + inMultiLnString = false; + } + else { + sc.SetState(SCE_TOML_PARSINGERROR); + } + } + } + } + else if (sc.ch == '\'') { + if (sc.state == SCE_TOML_STR_LITERAL) { + if (!inMultiLnString) { + sc.ForwardSetState(SCE_TOML_VALUE); + } + else { + // inMultiLnString + if (sc.Match(R"(''')")) { + sc.Forward(2); + sc.ForwardSetState(SCE_TOML_VALUE); + inMultiLnString = false; + } + else { + sc.SetState(SCE_TOML_PARSINGERROR); + } + } + } + } + break; + + case SCE_TOML_PARSINGERROR: // still parsing error until new line break; + default: sc.SetState(SCE_TOML_PARSINGERROR); // unknown break; } - //if (sc.atLineEnd) { - // // --- - //} + if (sc.atLineEnd) { + if (!inMultiLnArrayDef && !inMultiLnString) { + if (sc.state == SCE_TOML_VALUE) { + sc.ForwardSetState(SCE_TOML_DEFAULT); + } + } + } } sc.Complete(); diff --git a/sciXlexers/SciXLexer.h b/sciXlexers/SciXLexer.h index d8138df0a..a298aa0e9 100644 --- a/sciXlexers/SciXLexer.h +++ b/sciXlexers/SciXLexer.h @@ -43,14 +43,16 @@ #define SCE_TOML_DEFAULT 0 -#define SCE_TOML_COMMENT 1 -#define SCE_TOML_SECTION 2 -#define SCE_TOML_KEY 3 -#define SCE_TOML_ASSIGNMENT 4 -#define SCE_TOML_VALUE 5 -#define SCE_TOML_STRING 6 -#define SCE_TOML_ARRAY 7 -#define SCE_TOML_PARSINGERROR 8 +#define SCE_TOML_KEYWORD 1 +#define SCE_TOML_COMMENT 2 +#define SCE_TOML_SECTION 3 +#define SCE_TOML_KEY 4 +#define SCE_TOML_ASSIGNMENT 5 +#define SCE_TOML_VALUE 6 +#define SCE_TOML_NUMBER 7 +#define SCE_TOML_STR_BASIC 8 +#define SCE_TOML_STR_LITERAL 9 +#define SCE_TOML_PARSINGERROR 10 #endif //_SCIXLEXER_H_ diff --git a/src/StyleLexers/styleLexTOML.c b/src/StyleLexers/styleLexTOML.c index 4e643c053..d4fe9e2af 100644 --- a/src/StyleLexers/styleLexTOML.c +++ b/src/StyleLexers/styleLexTOML.c @@ -13,11 +13,13 @@ SCLEX_TOML, IDS_LEX_TOML_CFG, L"TOML Config", L"toml", L"", &KeyWords_TOML,{ { {STYLE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" }, //{ {SCE_TOML_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" }, + { {SCE_TOML_KEYWORD}, IDS_LEX_STR_63128, L"Keyword", L"fore:#E00000", L"" }, { {SCE_TOML_COMMENT}, IDS_LEX_STR_63127, L"Comment", L"fore:#008000", L"" }, { {SCE_TOML_SECTION}, IDS_LEX_STR_63232, L"Section", L"bold; fore:#000000; back:#FFF1A8; eolfilled", L"" }, { {SCE_TOML_KEY}, IDS_LEX_STR_63348, L"Key", L"bold; fore:#5E608F", L"" }, { {SCE_TOML_ASSIGNMENT}, IDS_LEX_STR_63233, L"Assignment", L"bold; fore:#FF2020", L"" }, { {SCE_TOML_VALUE}, IDS_LEX_STR_63201, L"Value", L"fore:#202020", L"" }, - { {SCE_TOML_STRING}, IDS_LEX_STR_63131, L"String", L"italic; fore:#800000", L"" }, + { {SCE_TOML_NUMBER}, IDS_LEX_STR_63130, L"Number", L"fore:#0000E0", L"" }, + { {MULTI_STYLE(SCE_TOML_STR_BASIC, SCE_TOML_STR_LITERAL,0,0)}, IDS_LEX_STR_63131, L"String", L"italic; fore:#800000", L"" }, { {SCE_TOML_PARSINGERROR}, IDS_LEX_STR_63252, L"Parsing Error", L"fore:#FFFF00; back:#A00000", L"" }, EDITLEXER_SENTINEL } }; From 6d9bbe387a339ff35eca1ef1d7c6d1923f943ed3 Mon Sep 17 00:00:00 2001 From: Akos Keresztes Date: Thu, 13 Jun 2019 09:29:18 +0200 Subject: [PATCH 2/8] Hungarian lang files - strings shortened, changes --- language/np3_hu_hu/dialogs_hu_hu.rc | 16 ++++++++-------- language/np3_hu_hu/menu_hu_hu.rc | 4 ++-- language/np3_hu_hu/strings_hu_hu.rc | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/language/np3_hu_hu/dialogs_hu_hu.rc b/language/np3_hu_hu/dialogs_hu_hu.rc index 08a7a0c16..551e3b189 100644 --- a/language/np3_hu_hu/dialogs_hu_hu.rc +++ b/language/np3_hu_hu/dialogs_hu_hu.rc @@ -86,16 +86,16 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Szve&g keresse:",IDC_STATIC,7,7,46,8 COMBOBOX IDC_FINDTEXT,7,17,192,116,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - CONTROL "&Kisbet/nagybet szmt",IDC_FINDCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,37,53,10 + CONTROL "&Kis-/nagybet szmt",IDC_FINDCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,37,53,10 CONTROL "E&gsz szavakra egyezs",IDC_FINDWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,49,89,10 CONTROL "Sz ele&jre egyezs",IDC_FINDSTART,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,61,110,10 - CONTROL "&Visszaperjel talaktsa",IDC_FINDTRANSFORMBS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,73,85,10 + CONTROL "&Backslash talaktsok",IDC_FINDTRANSFORMBS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,73,85,10 CONTROL "R&egulris kifejezssel",IDC_FINDREGEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,85,96,10 CONTROL "Pont &mindenre egyezik",IDC_DOT_MATCH_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,96,65,10 CONTROL "&Ne menjen krbe",IDC_NOWRAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,37,75,10 CONTROL "Ta&llat utn bezrs",IDC_FINDCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,49,65,10 CONTROL "Tallat&ok jellse",IDC_ALL_OCCURRENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,61,73,10 - CONTROL "&Joker kar. keress",IDC_WILDCARDSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,85,63,10 + CONTROL "&Joker keress",IDC_WILDCARDSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,85,63,10 CONTROL "tltsz md, ha nincs fkuszban ",IDC_TRANSPARENT, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,118,124,10 DEFPUSHBUTTON "&Kv. keresse",IDOK,211,7,55,14 @@ -127,7 +127,7 @@ BEGIN CONTROL "R&egulris kifejezs keresse",IDC_FINDREGEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,114,97,10 CONTROL "Pont &mindenre illeszkedik",IDC_DOT_MATCH_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,125,65,10 CONTROL "Ne keressen kr&ben",IDC_NOWRAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,66,75,10 - CONTROL "Cser&ls utn bezr",IDC_FINDCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,78,77,10 + CONTROL "&Csere utn bezr",IDC_FINDCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,78,77,10 CONTROL "Tallat&ok kiemelse",IDC_ALL_OCCURRENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,90,73,10 CONTROL "&Joker karakteres keress",IDC_WILDCARDSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,114,63,10 CONTROL "Fkuszvesztskor tltsz",IDC_TRANSPARENT, @@ -471,14 +471,14 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "OK",IDOK,245,98,50,14 PUSHBUTTON "Mgsem",IDCANCEL,184,98,50,14 - CONTROL "j mester kulcs megadsa",IDC_PWD_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,60,84,10 + CONTROL "j mesterkulcs megadsa",IDC_PWD_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,60,84,10 EDITTEXT IDC_PWD_EDIT1,17,35,276,12,ES_PASSWORD | ES_AUTOHSCROLL | WS_GROUP EDITTEXT IDC_PWD_EDIT2,17,74,277,12,ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "Nem ktelez mester kulcs:",IDC_STATIC,17,61,72,10,NOT WS_GROUP + LTEXT "Nem ktelez mesterkulcs:",IDC_STATIC,17,61,72,10,NOT WS_GROUP CONTROL "Kdols jelmondat segtsgvel",IDC_PWD_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,21,98,10 - CONTROL "Mester kulcs jrafelhasznlsa",IDC_PWD_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,218,60,76,10 + CONTROL "Mesterkulcs jrafelhasznlsa",IDC_PWD_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,218,60,76,10 GROUPBOX "Jelmondat",IDC_STATIC,7,7,297,108 - CONTROL "Jelmondatok megjelentse",IDC_PWD_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,97,75,10 + CONTROL "Jelmondat megjelentse",IDC_PWD_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,97,75,10 END IDD_MUI_READPW DIALOGEX 0, 0, 299, 81 diff --git a/language/np3_hu_hu/menu_hu_hu.rc b/language/np3_hu_hu/menu_hu_hu.rc index a16249bfd..a8f432143 100644 --- a/language/np3_hu_hu/menu_hu_hu.rc +++ b/language/np3_hu_hu/menu_hu_hu.rc @@ -196,7 +196,7 @@ BEGIN MENUITEM SEPARATOR MENUITEM "&Backtick\tCtrl+6", CMD_EMBRACE4 MENUITEM SEPARATOR - MENUITEM "&Ezzel...\tAlt+Q", IDM_EDIT_ENCLOSESELECTION + MENUITEM "&Egyni...\tAlt+Q", IDM_EDIT_ENCLOSESELECTION END MENUITEM "Sor/Kijells &dupliklsa\tCtrl+D", IDM_EDIT_DUPLINEORSELECTION MENUITEM SEPARATOR @@ -307,7 +307,7 @@ BEGIN MENUITEM "Httrs&zn", IDM_VIEW_HILITCURLN_BACK MENUITEM "K&eret", IDM_VIEW_HILITCURLN_FRAME END - POPUP "El&fordulsok jellse" + POPUP "El&fordulsok kiemelse" BEGIN MENUITEM "&Aktv\tAlt+A", IDM_VIEW_MARKOCCUR_ONOFF MENUITEM SEPARATOR diff --git a/language/np3_hu_hu/strings_hu_hu.rc b/language/np3_hu_hu/strings_hu_hu.rc index 438bde628..f4cea8226 100644 --- a/language/np3_hu_hu/strings_hu_hu.rc +++ b/language/np3_hu_hu/strings_hu_hu.rc @@ -117,7 +117,7 @@ BEGIN IDS_MUI_OPENWITH "Vlassza ki a mappt, ahol a kedvenc alkamazsaira mutat parancsikonok vannak." IDS_MUI_FAVORITES "Vlassza ki a mappt, ahol a kedvenc fjljaira mutat parancsikonok vannak." IDS_MUI_BACKSLASHHELP "Backslash talaktsok\n\n\\a\tFigyelmeztets (BEL, Ascii 7)\n\\b\tBackspace (BS, Ascii 8)\n\\f\tLapdobs (FF, Ascii 12)\n\\n\tj sor (LF, Ascii 10)\n\\r\tKocsi vissza (CR, Ascii 13)\n\\t\tVzszintes Tab (HT, Ascii 9)\n\\v\tFggleges Tab (VT, Ascii 11)\n\\0oo\tOktlis rtk\n\\u####\tHexadecimlis rtk\n\\xhh\tHexadecimal Value\n\\\\\tBackslash" - IDS_MUI_REGEXPHELP "RegExp illeszkeds szintaktika (tbbsoros)\n\n.\tBrmilyen karakterre illeszkedik\n^\tres szveg rgtn j sor utn\n$\tres szveg kzvetlenl a sorvge eltt\n\\<\tSz kezdete\n\\>\tSz vge\n\\b\tSz hatra\n[...]\tKarakterek halmaza ([abc]) vagy intervalluma ([a-z])\n[^...]\tKarakterek, amik NINCSENEK a kszletben vagy az intervallumban\n\\d\t10-es szmrendszeri szm\n\\D\tNem szm kar.\n\\s\tres hely karakterek\n\\S\tNEM res hely karakter\n\\w\t""sz"" karakterek\n\\W\t""nem-sz"" karakter\n\\x\tEscape karakter egybknt specilis jelentssel\n\\xHH\tKarakter HH Hexa kddal\n?\tElzre illeszkedik 0-szor vagy 1-szer\n*\tElzre illeszkedik 0-szor vagy tbbszr\n+\tElzre illeszkedik egyszer vagy tbbszr\n*? or +?\tIsmtlsek illeszkedse lomhn ""?"" and ""+""\n(\tRgi kezdete\n)\tRgi vge\n\\n\tCsernl egy rgira hivatkozik (n = 1-9)\n" + IDS_MUI_REGEXPHELP "RegExp illeszkeds szintaktika (tbbsoros)\n\n.\tBrmilyen karakterre illeszkedik\n^\tres szveg rgtn j sor utn\n$\tres szveg kzvetlenl a sorvge eltt\n\\<\tSz kezdete\n\\>\tSz vge\n\\b\tSz hatra\n[...]\tKarakterek halmaza ([abc]) vagy intervalluma ([a-z])\n[^...]\tKarakterek, amik NINCSENEK a kszletben vagy az intervallumban\n\\d\t10-es szmrendszeri szm\n\\D\tNem szm karakter\n\\s\tres hely karakterek\n\\S\tNEM res hely karakter\n\\w\t""sz"" karakterek\n\\W\t""nem-sz"" karakter\n\\x\tEscape karakter egybknt specilis jelentssel\n\\xHH\tKarakter HH Hexa kddal\n?\tElzre illeszkedik 0-szor vagy 1-szer\n*\tElzre illeszkedik 0-szor vagy tbbszr\n+\tElzre illeszkedik egyszer vagy tbbszr\n*? or +?\tIsmtlsek illeszkedse lomhn ""?"" and ""+""\n(\tRgi kezdete\n)\tRgi vge\n\\n\tCsernl egy rgira hivatkozik (n = 1-9)\n" IDS_MUI_WILDCARDHELP "Joker keress\n\n*\tNulla vagy tbb karakterre illeszkedik.\n?\tPontosan egy karakterre illeszkedik. " END From b3044824e5eff7d60cb327e029ed97972f4bc4d2 Mon Sep 17 00:00:00 2001 From: Akos Keresztes Date: Thu, 13 Jun 2019 09:29:42 +0200 Subject: [PATCH 3/8] Hungarian lang file - more strings to change --- language/np3_hu_hu/dialogs_hu_hu.rc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/language/np3_hu_hu/dialogs_hu_hu.rc b/language/np3_hu_hu/dialogs_hu_hu.rc index 551e3b189..8ce75866e 100644 --- a/language/np3_hu_hu/dialogs_hu_hu.rc +++ b/language/np3_hu_hu/dialogs_hu_hu.rc @@ -256,8 +256,8 @@ CAPTION "F FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL "",IDC_FILEMRU,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,7,255,97 - CONTROL "K&urzor helye megmarad.",IDC_PRESERVECARET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,119,96,10 - CONTROL "&Fjl elzmnylista mentse kilpskor.",IDC_SAVEMRU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,107,96,10 + CONTROL "K&urzor helyt megjegyzi.",IDC_PRESERVECARET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,119,96,10 + CONTROL "&Fjl elzmnyek mentse kilpskor.",IDC_SAVEMRU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,107,96,10 CONTROL "&Keressi minta megjegyzse.",IDC_REMEMBERSEARCHPATTERN, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,130,96,10 PUSHBUTTON "Kihagys",IDC_REMOVE,212,107,50,14,WS_DISABLED @@ -511,9 +511,9 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM CAPTION "Sorok mdostsa" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Szveg a sor &elejre:",IDC_STATIC,7,7,62,8 + LTEXT "Sor &elejre:",IDC_STATIC,7,7,62,8 EDITTEXT 100,7,18,98,14,ES_AUTOHSCROLL - LTEXT "Szveg a sor &vgre:",IDC_STATIC,7,37,68,8 + LTEXT "Sor &vgre:",IDC_STATIC,7,37,68,8 EDITTEXT 101,7,48,98,14,ES_AUTOHSCROLL DEFPUSHBUTTON "OK",IDOK,125,7,50,14 PUSHBUTTON "Mgsem",IDCANCEL,125,24,50,14 From 5e6c5fabec4cb0b013d4422d253994c90f530578 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 13 Jun 2019 09:33:54 +0200 Subject: [PATCH 4/8] + upd: Version update VS2019 : MS Visual C++ 2019 16.1.3 --- Versions/build.txt | 2 +- np3portableapp/_buildname.txt | 2 +- res/Notepad3.exe.manifest.conf | 4 ++-- src/Version.h | 2 +- src/VersionEx.h | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Versions/build.txt b/Versions/build.txt index db88a8627..fc5d14627 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -2250 +2251 diff --git a/np3portableapp/_buildname.txt b/np3portableapp/_buildname.txt index ee7531390..3461eaac5 100644 --- a/np3portableapp/_buildname.txt +++ b/np3portableapp/_buildname.txt @@ -1 +1 @@ -"RC" +"RC2" diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index 378f64896..b06959c8a 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,8 +3,8 @@ - Notepad3 RC + Notepad3 RC2 diff --git a/src/Version.h b/src/Version.h index b715382e4..1d7f84261 100644 --- a/src/Version.h +++ b/src/Version.h @@ -68,7 +68,7 @@ #if defined(_MSC_VER) #if (_MSC_VER >= 1920) #if(_MSC_FULL_VER >= 192127702) - #define VER_CPL MS Visual C++ 2019 v16.1.(0-2) + #define VER_CPL MS Visual C++ 2019 v16.1.(0-3) #elif(_MSC_FULL_VER >= 192027508) #define VER_CPL MS Visual C++ 2019 v16.0.(0-4) #elif(_MSC_FULL_VER >= 192027027) diff --git a/src/VersionEx.h b/src/VersionEx.h index 25fd8d5f8..3cb4a73b3 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -7,8 +7,8 @@ #define SAPPNAME "Notepad3" #define VERSION_MAJOR 5 #define VERSION_MINOR 19 -#define VERSION_REV 611 -#define VERSION_BUILD 2250 +#define VERSION_REV 613 +#define VERSION_BUILD 2251 #define SCINTILLA_VER 416 #define ONIGMO_REGEX_VER 6.2.0 -#define VERSION_PATCH RC +#define VERSION_PATCH RC2 From 81f1bbb9d75735170d32f8bbae698e0759c6b2f4 Mon Sep 17 00:00:00 2001 From: Akos Keresztes Date: Thu, 13 Jun 2019 10:18:01 +0200 Subject: [PATCH 5/8] Typo fix --- language/np3_hu_hu/strings_hu_hu.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/language/np3_hu_hu/strings_hu_hu.rc b/language/np3_hu_hu/strings_hu_hu.rc index f4cea8226..60806d02c 100644 --- a/language/np3_hu_hu/strings_hu_hu.rc +++ b/language/np3_hu_hu/strings_hu_hu.rc @@ -246,7 +246,7 @@ Haszn Notepad3 \t[/?] [...[kdols]] [...[sorvg md]] [/e] [/g] [/m] [/l]\r\n\ \t[/q] [/s] [/d] [/h] [/x] [/c] [/b] [/n] [/r| [/p] [/t] [/i] [/o]\r\n\ \t[/f] [/u] [/v] [/vd] [/y] [/z] [[meghajt:][tvonal]fjlnv[...]]\r\n\r\n\ -fjl\tAz utols paramter kell legyen, alapbl nincsenekidzjelezett szkzk.\r\n\ +fjl\tAz utols paramter kell legyen, alapbl nincsenek idzjelezett szkzk.\r\n\ +\tTbb fjlt is elfogad (idzjelezett szkzkkel).\r\n\ -\tEgy fjlt fogad el paramterknt (idzjelezett szkzk nlkl).\r\n\r\n\ Opcik:\r\n\ From bfa2ab88c04040b33d0bda094352e34fcf815716 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 13 Jun 2019 12:37:37 +0200 Subject: [PATCH 6/8] + fix: don't jump to caret position after toggle fold by mouse-click --- Versions/build.txt | 2 +- res/Notepad3.exe.manifest.conf | 2 +- src/Edit.c | 1 - src/VersionEx.h | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Versions/build.txt b/Versions/build.txt index fc5d14627..7f8dea745 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -2251 +2252 diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index b06959c8a..914ae09c0 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 RC2 diff --git a/src/Edit.c b/src/Edit.c index ea4979867..e88a77bbc 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -8207,7 +8207,6 @@ void __stdcall EditFoldPerformAction(DocLn ln, int mode, FOLD_ACTION action) else { fToggled = _FoldToggleNode(ln, action); } - if (fToggled) { SciCall_ScrollCaret(); } } diff --git a/src/VersionEx.h b/src/VersionEx.h index 3cb4a73b3..e8f9a0d41 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -8,7 +8,7 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 19 #define VERSION_REV 613 -#define VERSION_BUILD 2251 +#define VERSION_BUILD 2252 #define SCINTILLA_VER 416 #define ONIGMO_REGEX_VER 6.2.0 #define VERSION_PATCH RC2 From 4c96bf978852d848d6cf650bf5ab992e9cd81547 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 13 Jun 2019 16:00:49 +0200 Subject: [PATCH 7/8] + add: TOML Lexer : Date-Time highlight & other enhancements + add: some test files for manual checks --- language/common_res.h | 1 + language/np3_af_za/lexer_af_za.rc | 1 + language/np3_be_by/lexer_be_by.rc | 1 + language/np3_de_de/lexer_de_de.rc | 1 + language/np3_en_gb/lexer_en_gb.rc | 1 + language/np3_en_us/lexer_en_us.rc | 1 + language/np3_es_es/lexer_es_es.rc | 1 + language/np3_fr_fr/lexer_fr_fr.rc | 1 + language/np3_hu_hu/lexer_hu_hu.rc | 1 + language/np3_it_it/lexer_it_it.rc | 1 + language/np3_ja_jp/lexer_ja_jp.rc | 1 + language/np3_ko_kr/lexer_ko_kr.rc | 1 + language/np3_nl_nl/lexer_nl_nl.rc | 1 + language/np3_pl_pl/lexer_pl_pl.rc | 1 + language/np3_pt_br/lexer_pt_br.rc | 1 + language/np3_ru_ru/lexer_ru_ru.rc | 1 + language/np3_zh_cn/lexer_zh_cn.rc | 1 + np3portableapp/_buildname.txt | 2 +- res/Notepad3.exe.manifest.conf | 2 +- sciXlexers/LexTOML.cxx | 221 +++++----- sciXlexers/SciXLexer.h | 7 +- src/Notepad3.c | 4 +- src/StyleLexers/styleLexTOML.c | 3 +- src/VersionEx.h | 4 +- test/txtfiles/AHKL.ahk | 142 +++++++ test/txtfiles/Encoding/Cyril2Korean_mix.txt | 12 + .../Encoding/Cyrillic_ANSI_KOI8-R.txt | 12 + .../Korean-Win-949.txt} | 0 test/txtfiles/Encoding/empty.txt | 0 test/txtfiles/NFO/DEADLINE.NFO | 41 ++ test/txtfiles/NFO/PENTIUM.NFO | 23 + test/txtfiles/NFO/jerry.nfo | 189 +++++++++ test/txtfiles/NFO/test.nfo | 26 ++ test/txtfiles/NFO/wwc94.nfo | 148 +++++++ test/txtfiles/Registry.reg | Bin 0 -> 5662 bytes test/txtfiles/Rust.rs | Bin 0 -> 5052 bytes test/txtfiles/TOML.toml | 324 ++++++++++++++ test/txtfiles/TXT/License.txt | 71 ++++ test/txtfiles/TXT/Malayan_Problem.txt | 5 + test/txtfiles/TXT/regex_find.txt | 24 ++ .../strange_chacter_visual_artefacts.txt} | 0 test/txtfiles/python.py | 401 ++++++++++++++++++ test/txtfiles/regex_find.txt | 26 -- 43 files changed, 1566 insertions(+), 138 deletions(-) create mode 100644 test/txtfiles/AHKL.ahk create mode 100644 test/txtfiles/Encoding/Cyril2Korean_mix.txt create mode 100644 test/txtfiles/Encoding/Cyrillic_ANSI_KOI8-R.txt rename test/txtfiles/{korean-Win-949.txt => Encoding/Korean-Win-949.txt} (100%) create mode 100644 test/txtfiles/Encoding/empty.txt create mode 100644 test/txtfiles/NFO/DEADLINE.NFO create mode 100644 test/txtfiles/NFO/PENTIUM.NFO create mode 100644 test/txtfiles/NFO/jerry.nfo create mode 100644 test/txtfiles/NFO/test.nfo create mode 100644 test/txtfiles/NFO/wwc94.nfo create mode 100644 test/txtfiles/Registry.reg create mode 100644 test/txtfiles/Rust.rs create mode 100644 test/txtfiles/TOML.toml create mode 100644 test/txtfiles/TXT/License.txt create mode 100644 test/txtfiles/TXT/Malayan_Problem.txt create mode 100644 test/txtfiles/TXT/regex_find.txt rename test/txtfiles/{strange.txt => TXT/strange_chacter_visual_artefacts.txt} (100%) create mode 100644 test/txtfiles/python.py delete mode 100644 test/txtfiles/regex_find.txt diff --git a/language/common_res.h b/language/common_res.h index e747f152d..44f20c82b 100644 --- a/language/common_res.h +++ b/language/common_res.h @@ -1031,6 +1031,7 @@ #define IDS_LEX_STR_63353 63353 #define IDS_LEX_STR_63354 63354 #define IDS_LEX_STR_63355 63355 +#define IDS_LEX_STR_63356 63356 #define RICHEDIT_CONTROL_VER "RichEdit50W" // RICHEDIT_CONTROL_VER diff --git a/language/np3_af_za/lexer_af_za.rc b/language/np3_af_za/lexer_af_za.rc index 98e71d8cb..187bafc80 100644 --- a/language/np3_af_za/lexer_af_za.rc +++ b/language/np3_af_za/lexer_af_za.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2de In lyn-IME Kleur" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // Afrikaans (South Africa) resources diff --git a/language/np3_be_by/lexer_be_by.rc b/language/np3_be_by/lexer_be_by.rc index 5e404ea2e..a37b026e3 100644 --- a/language/np3_be_by/lexer_be_by.rc +++ b/language/np3_be_by/lexer_be_by.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2nd Inline-IME Color" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // Belarusian (Belarus) resources diff --git a/language/np3_de_de/lexer_de_de.rc b/language/np3_de_de/lexer_de_de.rc index 98759079c..2a0844aa3 100644 --- a/language/np3_de_de/lexer_de_de.rc +++ b/language/np3_de_de/lexer_de_de.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2te Inline-IME Farbe" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // German (Germany) resources diff --git a/language/np3_en_gb/lexer_en_gb.rc b/language/np3_en_gb/lexer_en_gb.rc index 0bee37937..20fb8fc9e 100644 --- a/language/np3_en_gb/lexer_en_gb.rc +++ b/language/np3_en_gb/lexer_en_gb.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2nd Inline-IME Color" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // English (United Kingdom) resources diff --git a/language/np3_en_us/lexer_en_us.rc b/language/np3_en_us/lexer_en_us.rc index 803df5bed..eb091720a 100644 --- a/language/np3_en_us/lexer_en_us.rc +++ b/language/np3_en_us/lexer_en_us.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2nd Inline-IME Color" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // English (United States) resources diff --git a/language/np3_es_es/lexer_es_es.rc b/language/np3_es_es/lexer_es_es.rc index 66884aed6..7ce7429e3 100644 --- a/language/np3_es_es/lexer_es_es.rc +++ b/language/np3_es_es/lexer_es_es.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2nd Inline-IME Color" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // Spanish (Spain, International Sort) resources diff --git a/language/np3_fr_fr/lexer_fr_fr.rc b/language/np3_fr_fr/lexer_fr_fr.rc index d6187e6d5..c4cce1d44 100644 --- a/language/np3_fr_fr/lexer_fr_fr.rc +++ b/language/np3_fr_fr/lexer_fr_fr.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2nd Inline-IME Color" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // French (France) resources diff --git a/language/np3_hu_hu/lexer_hu_hu.rc b/language/np3_hu_hu/lexer_hu_hu.rc index bb7976e4e..0e15c8f67 100644 --- a/language/np3_hu_hu/lexer_hu_hu.rc +++ b/language/np3_hu_hu/lexer_hu_hu.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2nd Inline-IME Color" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // Hungarian (Hungary) resources diff --git a/language/np3_it_it/lexer_it_it.rc b/language/np3_it_it/lexer_it_it.rc index e528ec30f..b3f2cbdd9 100644 --- a/language/np3_it_it/lexer_it_it.rc +++ b/language/np3_it_it/lexer_it_it.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2nd Inline-IME Color" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // Italian (Italy) resources diff --git a/language/np3_ja_jp/lexer_ja_jp.rc b/language/np3_ja_jp/lexer_ja_jp.rc index 6a382a4ad..ab0acbe2c 100644 --- a/language/np3_ja_jp/lexer_ja_jp.rc +++ b/language/np3_ja_jp/lexer_ja_jp.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2 CC͎IMEϊ" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // Japanese (Japan) resources diff --git a/language/np3_ko_kr/lexer_ko_kr.rc b/language/np3_ko_kr/lexer_ko_kr.rc index 9cded27fc..8cd0ae147 100644 --- a/language/np3_ko_kr/lexer_ko_kr.rc +++ b/language/np3_ko_kr/lexer_ko_kr.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2nd Inline-IME " IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // Korean (Korea) resources diff --git a/language/np3_nl_nl/lexer_nl_nl.rc b/language/np3_nl_nl/lexer_nl_nl.rc index 34fddd434..95b97bac0 100644 --- a/language/np3_nl_nl/lexer_nl_nl.rc +++ b/language/np3_nl_nl/lexer_nl_nl.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2nd Inline-IME Color" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // Dutch (Netherlands) resources diff --git a/language/np3_pl_pl/lexer_pl_pl.rc b/language/np3_pl_pl/lexer_pl_pl.rc index 0a131b3f9..9deeab043 100644 --- a/language/np3_pl_pl/lexer_pl_pl.rc +++ b/language/np3_pl_pl/lexer_pl_pl.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2nd Inline-IME Color" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // Polish (Poland) resources diff --git a/language/np3_pt_br/lexer_pt_br.rc b/language/np3_pt_br/lexer_pt_br.rc index 488b02ac6..3a7c2855c 100644 --- a/language/np3_pt_br/lexer_pt_br.rc +++ b/language/np3_pt_br/lexer_pt_br.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2nd Inline-IME Color" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // Portuguese (Brazil) resources diff --git a/language/np3_ru_ru/lexer_ru_ru.rc b/language/np3_ru_ru/lexer_ru_ru.rc index 625ca5ad2..fbf4475f3 100644 --- a/language/np3_ru_ru/lexer_ru_ru.rc +++ b/language/np3_ru_ru/lexer_ru_ru.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "2nd Inline-IME Color" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // Russian (Russia) resources diff --git a/language/np3_zh_cn/lexer_zh_cn.rc b/language/np3_zh_cn/lexer_zh_cn.rc index 12fd2ea32..16374d76d 100644 --- a/language/np3_zh_cn/lexer_zh_cn.rc +++ b/language/np3_zh_cn/lexer_zh_cn.rc @@ -446,6 +446,7 @@ BEGIN IDS_LEX_STR_63353 "ѡ뷨ѡıɫ" IDS_LEX_STR_63354 "Multi Edit Indicator" IDS_LEX_STR_63355 "2nd Multi Edit Indicator" + IDS_LEX_STR_63356 "Date-Time" END #endif // Chinese (Simplified, PRC) resources diff --git a/np3portableapp/_buildname.txt b/np3portableapp/_buildname.txt index 3461eaac5..e698eff6a 100644 --- a/np3portableapp/_buildname.txt +++ b/np3portableapp/_buildname.txt @@ -1 +1 @@ -"RC2" +"Oniguruma" diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index 914ae09c0..cdb30d52b 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -6,5 +6,5 @@ version="5.19.613.2252" type="win32" /> - Notepad3 RC2 + Notepad3 Oniguruma diff --git a/sciXlexers/LexTOML.cxx b/sciXlexers/LexTOML.cxx index bf3f91525..c6fcc83de 100644 --- a/sciXlexers/LexTOML.cxx +++ b/sciXlexers/LexTOML.cxx @@ -54,24 +54,6 @@ namespace { return SCE_TOML_VALUE; } - inline bool IsFuncName(const char* str) { - const char* identifiers[] = { - "proc", - "func", - "macro", - "method", - "template", - "iterator", - "converter" - }; - for (const char* id : identifiers) { - if (strcmp(str, id) == 0) { - return true; - } - } - return false; - } - struct OptionsTOML { bool fold; bool foldCompact; @@ -82,8 +64,8 @@ namespace { } }; - static const char* const tomlWordListDesc[] = { - "true false inf -inf +inf nan -nan +nan", + static const char* const tomlWordListsDesc[] = { + "Keyword", nullptr }; @@ -93,7 +75,7 @@ namespace { DefineProperty("fold", &OptionsTOML::fold, "FOLD COMMENT"); DefineProperty("fold.compact", &OptionsTOML::foldCompact, "FOLDCOMPACT COMMENT"); - DefineWordListSets(tomlWordListDesc); + DefineWordListSets(tomlWordListsDesc); } }; @@ -115,15 +97,24 @@ namespace { } // end of namespace class LexerTOML : public DefaultLexer { - CharacterSet setWord; + + CharacterSet validKey; + //CharacterSet validKeyWord; + CharacterSet validNumberEnd; + CharacterSet chDateTime; + WordList keywords; + OptionsTOML options; OptionSetTOML osTOML; public: LexerTOML() : DefaultLexer(lexicalClasses, ELEMENTS(lexicalClasses)) - , setWord(CharacterSet::setAlphaNum, "_", 0x80, true) + , validKey(CharacterSet::setAlphaNum, "_.", 0x80, false) + //, validKeyWord(CharacterSet::setAlphaNum, "_", 0x80, false) + , validNumberEnd(CharacterSet::setNone, " \t\n\v\f\r#,)}]", 0x80, false) + , chDateTime(CharacterSet::setNone, "-:TZ", 0x80, false) { } virtual ~LexerTOML() { } @@ -172,11 +163,8 @@ public: // -------------------------------------------------------------------------- Sci_Position SCI_METHOD PropertySet(const char* key, const char* val) override; - Sci_Position SCI_METHOD WordListSet(int n, const char* wl) override; - void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument* pAccess) override; - void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument* pAccess) override; }; @@ -205,7 +193,6 @@ Sci_Position SCI_METHOD LexerTOML::WordListSet(int n, const char* wl) if (wordListN) { WordList wlNew; wlNew.Set(wl); - if (*wordListN != wlNew) { wordListN->Set(wl); firstModification = 0; @@ -228,51 +215,71 @@ constexpr bool IsAssignChar(const int ch) noexcept { } // ---------------------------------------------------------------------------- -inline bool IsAKeyChar(const int ch) { - return (IsAlphaNumeric(ch) || ch == '_'); -} -// ---------------------------------------------------------------------------- - -inline bool IsValidNumEnd(const int ch) { - return ( - IsASpace(ch) || - IsCommentChar(ch) || - (ch == ',') || - (ch == ']') - ); -} -// ---------------------------------------------------------------------------- - - -static int GetBracketLevel(StyleContext& sc) +static int GetBracketLevel(StyleContext& sc, const bool stopAtLnBreak = false) { Sci_Position const posCurrent = static_cast(sc.currentPos); - bool ignore = false; int iBracketLevel = -1; + int inInlTbl = 0; Sci_Position i = 0; - while ((--i + posCurrent) >= 0) + while (((--i + posCurrent) >= 0)) { - if (sc.GetRelative(i) == '"') { - ignore = !ignore; // toggle string + int const ch = sc.GetRelative(i); + + if (stopAtLnBreak && IsLineBreak(ch)) { + break; } - else if (!ignore) { - if (IsAssignChar(sc.GetRelative(i))) { - break; // must be within assignment - } - else if (sc.GetRelative(i) == ']') { - --iBracketLevel; - } - else if (sc.GetRelative(i) == '[') { - ++iBracketLevel; - } + + if (ch == '}') { + ++inInlTbl; + } + else if (ch == '{') { + --inInlTbl; + } + + if (IsAssignChar(ch) && (inInlTbl == 0)) { + break; // must be the assignment begin + } + else if (ch == ']') { + --iBracketLevel; + } + else if (ch == '[') { + ++iBracketLevel; } } return iBracketLevel; } // ---------------------------------------------------------------------------- +static bool IsDateTimeStr(StyleContext& sc, const CharacterSet& validCh, const CharacterSet& valEnd) +{ + Sci_Position const posCurrent = static_cast(sc.currentPos); + Sci_Position const posEnd = static_cast(sc.lineStartNext); + + Sci_Position i = 0; + bool bDateTimeFlag = false; + + while ((++i + posCurrent) < posEnd) + { + int const ch = sc.GetRelative(i); + + if (!Scintilla::IsADigit(ch) && !validCh.Contains(ch) && (ch != '.')) { + if (valEnd.Contains(ch)) { + return bDateTimeFlag; + } + else { + return false; + } + } + if (validCh.Contains(ch)) { + bDateTimeFlag = true; + } + } + return bDateTimeFlag; +} +// ---------------------------------------------------------------------------- + // ---------------------------------------------------------------------------- @@ -283,7 +290,7 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int bool inSectionDef = false; bool inMultiLnString = (sc.state == SCE_TOML_STR_BASIC) || (sc.state == SCE_TOML_STR_LITERAL); - bool inMultiLnArrayDef = (sc.state == SCE_TOML_VALUE); + bool inMultiLnArrayDef = false; bool inHex = false; bool inBin = false; bool inOct = false; @@ -296,6 +303,7 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int // check if in the middle of a line continuation ... // -------------------------------------------------- if (sc.atLineStart) { + inMultiLnArrayDef = (GetBracketLevel(sc) >= 0); switch (sc.state) { case SCE_TOML_STR_BASIC: @@ -355,7 +363,7 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int sc.SetState(SCE_TOML_SECTION); inSectionDef = true; } - else if (IsAKeyChar(sc.ch)) { + else if (validKey.Contains(sc.ch)) { sc.SetState(SCE_TOML_KEY); } else { @@ -371,7 +379,9 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int case SCE_TOML_SECTION: if (sc.ch == ']') { - inSectionDef = false; + if (GetBracketLevel(sc, true) == 0) { + inSectionDef = false; + } } else if (IsCommentChar(sc.ch)) { if (!inSectionDef) { @@ -391,7 +401,7 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int else if (IsAssignChar(sc.ch)) { sc.SetState(SCE_TOML_ASSIGNMENT); } - else if (!IsAKeyChar(sc.ch)) { + else if (!validKey.Contains(sc.ch)) { sc.SetState(SCE_TOML_PARSINGERROR); } break; @@ -426,21 +436,26 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int } } else if (IsNumber(sc)) { - sc.SetState(SCE_TOML_NUMBER); - if ((sc.ch == '+') || (sc.ch == '-')) { - sc.Forward(); + if (IsDateTimeStr(sc, chDateTime, validNumberEnd)) { + sc.SetState(SCE_TOML_DATETIME); } - inHex = IsNumHex(sc); - inBin = IsNumBinary(sc); - inOct = IsNumOctal(sc); - if (inHex || inBin || inOct) { - sc.Forward(2); - } - if (IsNumExponent(sc)) { - sc.Forward(2); + else { + sc.SetState(SCE_TOML_NUMBER); if ((sc.ch == '+') || (sc.ch == '-')) { sc.Forward(); } + inHex = IsNumHex(sc); + inBin = IsNumBinary(sc); + inOct = IsNumOctal(sc); + if (inHex || inBin || inOct) { + sc.Forward(2); + } + if (IsNumExponent(sc)) { + sc.Forward(2); + if ((sc.ch == '+') || (sc.ch == '-')) { + sc.Forward(); + } + } } } else if (sc.ch == '"') { @@ -465,7 +480,7 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int // eat // TODO: only once } else if (inHex || inBin || inOct) { - if (IsValidNumEnd(sc.ch)) { + if (validNumberEnd.Contains(sc.ch)) { sc.SetState(SCE_TOML_VALUE); inHex = false; inBin = false; @@ -493,7 +508,7 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int // eat } else { - if (IsValidNumEnd(sc.ch)) { + if (validNumberEnd.Contains(sc.ch)) { sc.SetState(SCE_TOML_VALUE); inHex = false; inBin = false; @@ -506,30 +521,33 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int break; - case SCE_TOML_STR_BASIC: - case SCE_TOML_STR_LITERAL: - if (sc.ch == '\\') { - if (sc.state != SCE_TOML_STR_BASIC) { - sc.SetState(SCE_TOML_PARSINGERROR); + case SCE_TOML_DATETIME: + if (!IsADigit(sc.ch) && !chDateTime.Contains(sc.ch) && (sc.ch != '.')) { + if (validNumberEnd.Contains(sc.ch)) { + sc.SetState(SCE_TOML_VALUE); } else { - sc.ForwardSetState(sc.state); + sc.SetState(SCE_TOML_PARSINGERROR); } } - else if (sc.ch == '"') { + break; + + + case SCE_TOML_STR_BASIC: + case SCE_TOML_STR_LITERAL: + if (sc.ch == '"') { if (sc.state == SCE_TOML_STR_BASIC) { - if (!inMultiLnString) { - sc.ForwardSetState(SCE_TOML_VALUE); - } - else { - // inMultiLnString - if (sc.Match(R"(""")")) { - sc.Forward(2); + if (sc.chPrev != '\\') { + if (!inMultiLnString) { sc.ForwardSetState(SCE_TOML_VALUE); - inMultiLnString = false; } else { - sc.SetState(SCE_TOML_PARSINGERROR); + // inMultiLnString + if (sc.Match(R"(""")")) { + sc.Forward(2); + sc.ForwardSetState(SCE_TOML_VALUE); + inMultiLnString = false; + } } } } @@ -546,9 +564,6 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int sc.ForwardSetState(SCE_TOML_VALUE); inMultiLnString = false; } - else { - sc.SetState(SCE_TOML_PARSINGERROR); - } } } } @@ -556,7 +571,7 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int case SCE_TOML_PARSINGERROR: - // still parsing error until new line + // keep parsing error until new line break; @@ -565,13 +580,13 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int break; } - if (sc.atLineEnd) { - if (!inMultiLnArrayDef && !inMultiLnString) { - if (sc.state == SCE_TOML_VALUE) { - sc.ForwardSetState(SCE_TOML_DEFAULT); - } - } - } + //~if (sc.atLineEnd) { + //~ if (!inMultiLnArrayDef && !inMultiLnString) { + //~ if (sc.state == SCE_TOML_VALUE) { + //~ sc.ForwardSetState(SCE_TOML_DEFAULT); + //~ } + //~ } + //~} } sc.Complete(); @@ -666,7 +681,7 @@ void SCI_METHOD LexerTOML::Fold(Sci_PositionU startPos, Sci_Position length, int } // ---------------------------------------------------------------------------- -LexerModule lmTOML(SCLEX_TOML, LexerTOML::LexerFactoryTOML, "toml", tomlWordListDesc); +LexerModule lmTOML(SCLEX_TOML, LexerTOML::LexerFactoryTOML, "toml", tomlWordListsDesc); // ---------------------------------------------------------------------------- diff --git a/sciXlexers/SciXLexer.h b/sciXlexers/SciXLexer.h index a298aa0e9..972fba9a8 100644 --- a/sciXlexers/SciXLexer.h +++ b/sciXlexers/SciXLexer.h @@ -50,9 +50,10 @@ #define SCE_TOML_ASSIGNMENT 5 #define SCE_TOML_VALUE 6 #define SCE_TOML_NUMBER 7 -#define SCE_TOML_STR_BASIC 8 -#define SCE_TOML_STR_LITERAL 9 -#define SCE_TOML_PARSINGERROR 10 +#define SCE_TOML_DATETIME 8 +#define SCE_TOML_STR_BASIC 9 +#define SCE_TOML_STR_LITERAL 10 +#define SCE_TOML_PARSINGERROR 11 #endif //_SCIXLEXER_H_ diff --git a/src/Notepad3.c b/src/Notepad3.c index 256e6b329..a1629f6f5 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -3163,7 +3163,7 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam) i == SCLEX_SQL || i == SCLEX_PERL || i == SCLEX_PYTHON || i == SCLEX_PROPERTIES ||i == SCLEX_CONF || i == SCLEX_POWERSHELL || i == SCLEX_BATCH || i == SCLEX_DIFF || i == SCLEX_BASH || i == SCLEX_TCL || i == SCLEX_AU3 || i == SCLEX_LATEX || i == SCLEX_AHKL || i == SCLEX_RUBY || i == SCLEX_CMAKE || i == SCLEX_MARKDOWN || - i == SCLEX_YAML || i == SCLEX_REGISTRY || i == SCLEX_NIMROD) && !ro); + i == SCLEX_YAML || i == SCLEX_REGISTRY || i == SCLEX_NIMROD || i == SCLEX_TOML) && !ro); EnableCmd(hmenu, CMD_CTRLENTER, !ro); EnableCmd(hmenu, IDM_EDIT_INSERT_TAG, !ro); @@ -4573,6 +4573,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case SCLEX_YAML: case SCLEX_COFFEESCRIPT: case SCLEX_NIMROD: + case SCLEX_TOML: EditToggleLineComments(Globals.hwndEdit, L"#", true); break; case SCLEX_ASM: @@ -4636,6 +4637,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case SCLEX_JSON: case SCLEX_REGISTRY: case SCLEX_NIMROD: + case SCLEX_TOML: break; case SCLEX_HTML: case SCLEX_XML: diff --git a/src/StyleLexers/styleLexTOML.c b/src/StyleLexers/styleLexTOML.c index d4fe9e2af..4e2cfdead 100644 --- a/src/StyleLexers/styleLexTOML.c +++ b/src/StyleLexers/styleLexTOML.c @@ -4,7 +4,7 @@ //KEYWORDLIST KeyWords_TOML = EMPTY_KEYWORDLIST; KEYWORDLIST KeyWords_TOML = { - "Keyword", + "false inf nan table true", // Keyword "", "", "", "", "", "", "", "" }; @@ -20,6 +20,7 @@ SCLEX_TOML, IDS_LEX_TOML_CFG, L"TOML Config", L"toml", L"", { {SCE_TOML_ASSIGNMENT}, IDS_LEX_STR_63233, L"Assignment", L"bold; fore:#FF2020", L"" }, { {SCE_TOML_VALUE}, IDS_LEX_STR_63201, L"Value", L"fore:#202020", L"" }, { {SCE_TOML_NUMBER}, IDS_LEX_STR_63130, L"Number", L"fore:#0000E0", L"" }, + { {SCE_TOML_DATETIME}, IDS_LEX_STR_63356, L"Date-Time", L"fore:#950095", L"" }, { {MULTI_STYLE(SCE_TOML_STR_BASIC, SCE_TOML_STR_LITERAL,0,0)}, IDS_LEX_STR_63131, L"String", L"italic; fore:#800000", L"" }, { {SCE_TOML_PARSINGERROR}, IDS_LEX_STR_63252, L"Parsing Error", L"fore:#FFFF00; back:#A00000", L"" }, EDITLEXER_SENTINEL } }; diff --git a/src/VersionEx.h b/src/VersionEx.h index e8f9a0d41..f8300f6a8 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -10,5 +10,5 @@ #define VERSION_REV 613 #define VERSION_BUILD 2252 #define SCINTILLA_VER 416 -#define ONIGMO_REGEX_VER 6.2.0 -#define VERSION_PATCH RC2 +#define ONIGURUMA_REGEX_VER 6.9.2 +#define VERSION_PATCH Oniguruma diff --git a/test/txtfiles/AHKL.ahk b/test/txtfiles/AHKL.ahk new file mode 100644 index 000000000..715d3b540 --- /dev/null +++ b/test/txtfiles/AHKL.ahk @@ -0,0 +1,142 @@ +; ============================================================================= +; Regression Tests Notepad3 Gui +; Needs files in a Test Directory: +; Notepad3.exe and Notepad3.ini (from distrib) +; Execute: AutoHotkeyU32.exe "TestAhkNotepad3.ahk" +; ============================================================================= +#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. +; #Warn ; Enable warnings to assist with detecting common errors. +SendMode Input ; Recommended for new scripts due to its superior speed and reliability. +SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. +SetBatchLines, -1 +StringCaseSense, Off +CoordMode, Pixel, Screen +; ============================================================================= + +v_NP3Name = Notepad3 +v_NP3TestDir = %A_WorkingDir%\_TESTDIR +v_NP3IniFile = %v_NP3Name%.ini + +stdout := FileOpen("*", "w") +v_ExitCode := 0 + +; ============================================================================= + +Run, %v_NP3TestDir%/%v_NP3Name%.exe %v_NP3TestDir%/%v_NP3IniFile%, , UseErrorLevel, v_Notepad3_PID +v_ErrLevel = %ErrorLevel% +if (v_ErrLevel != 0) +{ + stdout.WriteLine("*** ERROR: " . v_NP3Name . "could not be launched.") + v_ExitCode := 1 + Goto LABEL_END +} +; ----------------------------------------------------------------------------- + +GoSub CHECK_NP3_STARTS +Sleep, 500 +GoSub CHECK_WIN_TITLE +Sleep, 500 +GoSub CHECK_ABOUT_BOX + + +Goto LABEL_END +; ============================================================================= + +; ============================================================================= +CHECK_NP3_STARTS: +; check that NP3 starts up +WinWait ahk_pid %v_Notepad3_PID%, , 10 +v_ErrLevel = %ErrorLevel% +if (v_ErrLevel != 0) +{ + stdout.WriteLine("*** ERROR: " . v_NP3Name . "'s seems not to start in time ???") + v_ExitCode := 2 + Goto LABEL_END +} +Return +; ============================================================================= + +; ============================================================================= +CHECK_WIN_TITLE: +; check Main Window Title +WinGetTitle, v_NP3Title, ahk_pid %v_Notepad3_PID% + +IfNotInString, v_NP3Title, %v_NP3Name% +{ + v_ExitCode := 3 + stdout.WriteLine("*** ERROR: " . v_NP3Name . " missing in Title: " . v_NP3Title) +} +IfNotInString, v_NP3Title, %v_NP3IniFile% +{ + v_ExitCode := 3 + stdout.WriteLine("*** ERROR: " . v_NP3IniFile . " missing in Title: " . v_NP3Title) +} +IfNotInString, v_NP3Title, %v_NP3TestDir% +{ + v_ExitCode := 3 + stdout.WriteLine("*** ERROR: " . v_NP3TestDir . " missing in Title: " . v_NP3Title) +} +If (v_ExitCode != 0) +{ + Goto LABEL_END +} +Return +; ============================================================================= + +; ============================================================================= +CHECK_ABOUT_BOX: +; check About DlgBox +WinActivate, ahk_pid %v_Notepad3_PID% + +; This will select File->Open in Notepad: +WinMenuSelectItem, ahk_pid %v_Notepad3_PID%, , Help, About... + +WinWait, About %v_NP3Name%, , 3 +v_ErrLevel = %ErrorLevel% +if (v_ErrLevel != 0) +{ + v_ExitCode := 4 + stdout.WriteLine("*** ERROR: " . v_NP3Name . "'s About Box is not displayed!") + Goto LABEL_END +} +WinActivate ; About Box +;ControlFocus, OK, About %v_NP3Name% + ControlClick, OK, About %v_NP3Name% +;Send {Enter} +WinWaitClose, About %v_NP3Name%, , 2 +v_ErrLevel = %ErrorLevel% +if (v_ErrLevel != 0) +{ + v_ExitCode := 5 + stdout.WriteLine("*** ERROR: " . v_NP3Name . "'s About Box can not be closed!") + Goto LABEL_END +} +Return +; ============================================================================= + +; ============================================================================= +LABEL_END: +WinClose ahk_pid %v_Notepad3_PID%, , 2 +v_ErrLevel = %ErrorLevel% +if (v_ErrLevel != 0) +{ + v_ExitCode := 99 + stdout.WriteLine("*** ERROR: " . v_NP3Name . "can not be closed!") +} +; ------------------------------------- +WinWaitClose ahk_pid %v_Notepad3_PID% +v_ErrLevel = %ErrorLevel% +if (v_ErrLevel != 0) +{ + v_ExitCode := 111 + ; FORCED Kill / HANGUP +} +; ------------------------------------- +if (v_ExitCode != 0) +{ + stdout.WriteLine("*** ERROR: Testing " . v_NP3Name . " exit with: " . v_ExitCode) + ExitApp, %v_ExitCode% +} +stdout.WriteLine("Testing " . v_NP3Name . ": All tests PASSED.") +ExitApp, 0 +; ============================================================================= diff --git a/test/txtfiles/Encoding/Cyril2Korean_mix.txt b/test/txtfiles/Encoding/Cyril2Korean_mix.txt new file mode 100644 index 000000000..5c14ca742 --- /dev/null +++ b/test/txtfiles/Encoding/Cyril2Korean_mix.txt @@ -0,0 +1,12 @@ +п я р с т у Я ж в ь ы з ш э щ ч ъ Ю А Б Ц Д Е Ф Г Х И Й К Л М Н О +п я р с т у Я ж в ь ы з ш э щ ч ъ Ю А Б Ц Д Е Ф Г Х И Й К Л М Н О +п я р с т у Я ж в ь ы з ш э щ ч ъ Ю А Б Ц Д Е Ф Г Х И Й К Л М Н О + +있을 것이다. 우선 인력 물적교류가 없이 기술교류가 Ю +있을 것이다. 우선 인력 물적교류가 없이 기술교류가 Ю +있을 것이다. 우선 인력 물적교류가 없이 기술교류가 Ю + +п я р с т у Я ж в ь ы з ш э щ ч ъ Ю А Б Ц Д Е Ф Г Х И Й К Л М Н О +п я р с т у Я ж в ь ы з ш э щ ч ъ Ю А Б Ц Д Е Ф Г Х И Й К Л М Н О +п я р с т у Я ж в ь ы з ш э щ ч ъ Ю А Б Ц Д Е Ф Г Х И Й К Л М Н О +п я р с т у Я ж в ь ы з ш э щ ч ъ Ю А Б Ц Д Е Ф Г Х И Й К Л М Н О diff --git a/test/txtfiles/Encoding/Cyrillic_ANSI_KOI8-R.txt b/test/txtfiles/Encoding/Cyrillic_ANSI_KOI8-R.txt new file mode 100644 index 000000000..6acd6bd34 --- /dev/null +++ b/test/txtfiles/Encoding/Cyrillic_ANSI_KOI8-R.txt @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/test/txtfiles/korean-Win-949.txt b/test/txtfiles/Encoding/Korean-Win-949.txt similarity index 100% rename from test/txtfiles/korean-Win-949.txt rename to test/txtfiles/Encoding/Korean-Win-949.txt diff --git a/test/txtfiles/Encoding/empty.txt b/test/txtfiles/Encoding/empty.txt new file mode 100644 index 000000000..e69de29bb diff --git a/test/txtfiles/NFO/DEADLINE.NFO b/test/txtfiles/NFO/DEADLINE.NFO new file mode 100644 index 000000000..94e69e985 --- /dev/null +++ b/test/txtfiles/NFO/DEADLINE.NFO @@ -0,0 +1,41 @@ + + + + + ۲ + ۱ + + ۲ + ۲ ۱ ۲ + ۲ ۲ ۲ ۰ ۲ ۲ ۲ ۲۲ ۲ + ۲ ۲ ۲ ۲۰ ۲ ۲ ۲ ۲ ۲ ۲ ۲ + ۲ ۲ ۲ ۲ ۲ ۲ ۲ ۲ ۲ ۲ + ۲ ۲ ۱ ۲۲ ۲ ۲ ۱ ۱ ۲ ۱ + ۱ ۱ ۱ ۲ ۱ ۱ ۱ ۱ ۱ ۱ ۲ ۱ + ۱ ۱ ۱ ۱ ۲ ۱ ۱ ۱ ۰ ۱ ۲ ۱ + ۱ ۱ ۰ ۱ ۱ ۱ ۱ ۱ ۰ ۱ ۱ ۰ + ۰ ۰ ۰ ۱ ۰ ۰ ۰ ۰ ۰ ۱ ۰ + ۰ ۰ ۰ ۰ ۰ ۰ ۰ ۰ ۰ ۰ ۰ + ۰۰ ۰ ۰ ۰۰ ۰ ۰ ۰ + ۰ ۰ ۰ ۰ + + D E A D L i N E + + NODE I : 416-xxx-xxxx (USR. 28.8k Dual Standard) + NODE II : 416-xxx-xxxx (USR. 28.8k Dual Standard) + NODE III : 416-xxx-xxxx (USR. 28.8k Dual Standard) + + 0-2 Days OnLy, 4.8 GIG ONLINE! + PCB V15.1 CUSTOMIZED! + + Sysop : Lover Boy + Management Sysop : Violent Soldier + File-Co-Sysop : Urlord; Maverick; John Lennon + File-Support : Sidewinder + PPe/Hacker Co. : The File Pullutor + AnSi Artist : Wolffy Boy + + Distribution Sites : (CAN.) TVB, CAE, CIA, TSC, DEATH + (H.K.) SAMUEL WORKS!, NICE BBS! + + diff --git a/test/txtfiles/NFO/PENTIUM.NFO b/test/txtfiles/NFO/PENTIUM.NFO new file mode 100644 index 000000000..7cc0872fa --- /dev/null +++ b/test/txtfiles/NFO/PENTIUM.NFO @@ -0,0 +1,23 @@ + + + *RiNgDoWn* DOMINATORS WHQ +45 39-660-609! *RiNgDoWn* + + ͻ ͻ ͻ ͻ ͻ ͻ ͻ ͻ + ͻ ͼ ͻ ͼ ͼ ͻ + ͻ ͻ ͻ ͻ ͻ ͻ + ͼ ͼ + ͼ + ͻ ͼ + ͼ ͼ ͼ ͼ ͼ ͼ ͼ ͼ ͼ ͼ + The Next Generation of WareZ! + + *RiNgDoWn* DOMINATORS WHQ +45 39-660-609! *RiNgDoWn* + + Sysop: MAGIC + + Node 1 - 16K8 Dual! --^^RINGDOWN^^-- Node 2 - 16K8 Dual! + Node 3 - Dominators PRIVATE + + DOMINATORS WORLD HQ! + TRSI/FAITH DANISH HQ + Nup: SHITFACE diff --git a/test/txtfiles/NFO/jerry.nfo b/test/txtfiles/NFO/jerry.nfo new file mode 100644 index 000000000..462d0d709 --- /dev/null +++ b/test/txtfiles/NFO/jerry.nfo @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -ZED NITRO/DEAD WEIGHT- + + + + + IJIJIJIJ + + + + + ۲ ۲ ۲ ۲ ۲ ۲ ۲ + ߱ + + ܰ + + + ܰ + ܱ + ߰ + + + + DEAD WEIGHT Present + + Product...< Tom and Jerry Arcade From Hi Tech Expression > + + Released..< 6/29/93 > Rating....< 4/10 > + + Supplier..< Parity Error > Packaged..< Parity Error > + + Disk/Kb...< 1 Disk / 200 K > Cracker...< None Needed > + + GrafX Support: [x] EGA [x] VGA [ ] SVGA [ ] Windows [ ] None + Sound Support: [x] Beeper [x] Adlib [x] Sblaster [x] Roland [ ] None + + + + + + + + İ[ Release Note ]Ŀ + + From the makers of Rollerblade Racer. It is an arcade game based + upon the Tom and Jerry cartoon series. It is a nintendo like + horizontal movement game where you collect hearts and all that, + just like all those nintendo games. Anyway, will put out docs for it + shortly. + + + + Greetings goes to: FaCeLeSS, Dr. Detergent + : Group Greets to: Razor 1911, THG, TDT, Skillion, Public Enemy : + | Courier Groups: SWAT, United couriers, Exodus, Malice | + İİ + + D.E.A.D W.E.I.G.H.T + + [ SR.STAFF ] + + Capt Bligh , Parity Error + + [ MEMBERS ] + + Boba Fett , Dark Spectre , Fletch , Neuro Basher + Sir Real , Stingray , Tank , Zed Nitro + + [ Courier Coordinator ] + + General Protocol, CyberChrist + + [ COURIERS ] + + Dark Spyre, Loki, Lord Cyric, The Invid, Blackie + Dealer, Kinky o Nepal, Keef Steel, Black Widow + NightShade, StormBlade, Weapon X, The Cardinal + Der Schatten, MEGA, The Plague, Maniac, Sonic, Sox + + + + + + + + İ[ DEAD WEIGHT BOARDS ]İĿ + Name Number w/Nodes Sysop(s) Position + IJIJ + + [ All HQs ] + + THE BOUNTY XXX-XXX-XXXX 1 Capt Bligh WORLD HQ + : METAL ADDICTION 514-XXX-XXXX 1 Zed Nitro CANADIAN HQ : + | STREET SPYDRS 713-XXX-XXXX 4 Maverick COURIER HQ | + | UNDERGROUND PUB +358-X-XXXXXX 1 Kinky o Nepal FINLAND HQ | + İİĴ + [ MEMBER BOARDS ] + Ĵ + Distant Lands 613-XXX-XXXX 1 General Prot. Member Board + Ride The Ligntening 713-852-2928 1 Stingray Member Board + Bad Medicine 604-XXX-XXXX 2 Boba Fett Member Board + Ĵ + [ SITES ] + Ĵ + Alien Nation 813-493-1871 1 Evil Enforcer Dist. Site + Bedlam 313-699-2718 3 Mr.Bill Dist. Site + Enchanted Grove 502-893-7414 1 Draken Dist. Site + Jurassic Park 619-756-5229 1 Targa Dist. Site + Outland BBS 509-468-9808 1 Gadget Dist. Site + The Trash Heap 405-751-1604 1 Greaser Dist. Site + Underground Oasis 201-818-4894 3 Mister Twister Dist. Site + Vanishing Point 604-599-5711 1 Kodiak Dist. Site + + + PLEASE NOTE + + We are now accepting applications, please pick up an appcliation at + any DEAD WEIGHT HQ , or contact us at our P.O.Box + + + DEAD WEIGHT + P.O Box 6623 + Katy, TX 77491-6623 + + + Or Call: + + Ride The Lightning + (713)852-2928 + V32bis Only + + Name: Guest + Password: Wannabe + + + Or Call: + + 1-800-333-4876 Extension 301 + and leave a message on our VMB + Be sure to leave a voice number + where you can be reached. + + + + + + + + diff --git a/test/txtfiles/NFO/test.nfo b/test/txtfiles/NFO/test.nfo new file mode 100644 index 000000000..fe2c83356 --- /dev/null +++ b/test/txtfiles/NFO/test.nfo @@ -0,0 +1,26 @@ + + ͻ + + ͹ + + + Test + + + ͹ + + ͼ + + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, + sed diam nonumy eirmod tempor invidunt ut labore et dolore + magna aliquyam erat, sed diam voluptua. + At vero eos et accusam et justo duo dolores et ea rebum. + Stet clita kasd gubergren, no sea takimata sanctus est + Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, + consetetur sadipscing elitr, + sed diam nonumy eirmod tempor invidunt ut labore et + dolore magna aliquyam erat, sed diam voluptua. + At vero eos et accusam et justo duo dolores et ea rebum. + Stet clita kasd gubergren, no sea takimata sanctus est + Lorem ipsum dolor sit amet. + \ No newline at end of file diff --git a/test/txtfiles/NFO/wwc94.nfo b/test/txtfiles/NFO/wwc94.nfo new file mode 100644 index 000000000..01727ae0f --- /dev/null +++ b/test/txtfiles/NFO/wwc94.nfo @@ -0,0 +1,148 @@ + + ߱ ߲߱ ߲ ߰ + ߱ + ۲ ۲ ۲ + ܰ + ݰ۲ ݰݰ۲ ݰ ݰ + ۲ ۲ ۲ ۲ + ۱ݲ۲޲ ۱ݲ۲޲ ݲ + ۱ ۰ ۱ ۰ ݱ + ݰ޲ް۲ݰ ݰ޲ް۲ݰݰް ް + ޱܱܱ߱ ޱܱܱ߱ ޱ ߱ + ۲޲޲ ۲޲޲ ޲ܲ + ޱ ޱ ߰ ED + ߲ iCE + + - ] W O R L D W I D E C O U R I E R S [ - + " Join the rising force in PC Couriering " + + ** WORLD WIDE ** + + + ۱ܰ E M B E R S ۲۲ + ߲ ۲ + + + ۰ + + S E N I O R S T A F F + \ + SHADOWKEEPER COOKIE MONSTER EXTRA CREDIT ۰ + + + + ۱ܰWORLD WIDE COURIERS '94۲۲ + ߲ ۲ + + + + ۱ܰ ۲۲ + ߲ O U R I E R S ۲ + + + + ۰ + KRYPTON POLARIS BUSTER HYMAN MYXLPLIX THE HOBBIT + DR. STUPID MR. EMT iMAGE THE PROWLER RAVEN AGENT-X ۰ + ZONE MASTER CASTOR SOUL LEADER KNIGHT SABER + + ۰ + C O U R I E R C O O R D I N A T O R S + \ + WORLD WIDE COURIERING '94 CREW ۰ + + S I T E C O O R D I N A T O R S + \ + + ۰ + ۰ + + ۱ܰWORLD WIDE COURIERS '94۲۲ + ߲ ۲ + + + + H E A D Q U A R T E R S + + + THE GRAVE YARD (World) (xXx)XxX-xXxX ShadowKeeper + THE BACK ROOM (Eastern) (xXx)XxX-xXxX Nomadd + ޲ SHADOW REALM (Canadian) (xXx)XxX-xXxX Shadow Hunter ޲ + + + + + + + + H E A D Q U A R T E R S + + THE GRAVEYARD (World) 2 NODES XXX.XXX.XXXX ShadowKeeper + THE BACK ROOM (Eastern) 2 NODES XXX.XXX.XXXX Nomadd + SHADOW REALM (Canadian) XXX.XXX.XXXX Shadow Hunter + + + U S D I S T R I B U T I O N S I T E S + + 11TH HOUR BBS 7 NODES 313.XXX.XXXX Marco Polo + FADE TO BLACK 2 NODES 612.XXX.XXXX Ningauble + LEGATO TIMES 2 NODES 702.XXX.XXXX Sonny + X MARKS THE SPOT 909.XXX.XXXX The Armored Saint + DEAD MAN'S BLUFF 310.XXX.XXXX The Overlord + SEA OF HATE 319.XXX.XXXX Toilet Bowl + CABLE ACCESS CHANNEL 10 513.XXX.XXXX Wayne + INTOXIFORNICATION 713.XXX.XXXX Hi Fi Del + KISS OF DEATH 518.XXX.XXXX Rogue + OPTICAL XEROX 314.XXX.XXXX Druidic Priest + GROUND ZERO 4 NODES 707.XXX.XXXX Tagger + + + C A N A D I A N D I S T R I B U T I O N + + BOILING NITROGEN 416.XXX.XXXX Hoodlem + HYDROGEN PLACE 613.XXX.XXXX Lord Nuke + THE GARDEN 705.XXX.XXXX Death Carnage + + E U R O D I S T R I B U T I O N + Information Not Avilable + + M O R E S I T E S - C O M I N G S O O N! + + + + + R e a c h i n g O u t A c r o s s T h e W o r l d ! + + + + + + + + + + + LogaN/iCE + ۲ ۲ + ۱ ۱ + ۰ ۰ + + W o r l d W i d e C o u r i e r s + + NEWS/INFORMATION + + + + Interested in becoming a Site or a Courier for WWC; + Contact Extra Credit on any of the WWC HQ's. If you can't + get onto these boards then your not worthy of becoming a courier + or a site. You can leave Extra Credit E-mail at 714-999-5556, + leave him mail at the matrix prompt. + + Greets: UC, SpectruM, QuantuM, CrimsoN, RiSC + THG, iNC, TDT, TRSI, PTG, RZR, FLT, PiL, PE, NX, MGK, RGB, and you! + + + + (c) WWC '94 + diff --git a/test/txtfiles/Registry.reg b/test/txtfiles/Registry.reg new file mode 100644 index 0000000000000000000000000000000000000000..8349ae37e6d47a70401dabfc1187f1b486804c54 GIT binary patch literal 5662 zcmc&&YflqF6uqBK{12P`45Sr{#l%D?B@#plEgIt*Q`!X^3neWTs`0O@=gi&P+1L)7;U3{ zg?33cq=4tKJaX?xc_oKf^FcmKMNUEQ1g$qxNBdN2_&$*cBV5fLy3zraV`-or;&wg<2b6=h;*ir@2Ue$P?Ly)J56H^AxRh*ry_8e6Qo(mMy&Nn6dBr z*U_%vDPiUgq_5(C3u9&Z2^;Nzd&D&kH)myHHE{SPuk&^bfcsN9z`S?P_JarH z;265>B}jXTZ_~&Ca%}(!9XxBmec2&h^}2i{9zr8SM4c}5({p%KZJ(o`TEBuN;t>WO z0+-_)GWz%7*JVs6ado6U`TsxM;YYw1#o<2J18`l-vrNzYF?< zL@RYz&STo5N0{1k7gWx%f|@ixXKZ2~pk_z7}JQx#0@F zO8V1tgGP16Mx&@+(snq=YVN*N(zf^?Zr+1O=B(*7HX(U=C3!hQRH5dHJ=J@E=fZaELus?%41c~p5!?PGo&IJ|>zR1s?!x0{Kdc>Y7l zR?y=!iz)2QqqYidFoLlL7|!*u5-Jh%oaJ+7p83}08bi!<``CPXayo{EVxG%7UHyI) z+;@=`E|3xbC2}o_uj?c$^YoIfE7BDrvk`OG0rDs#BkQC)cdpq+eN?~+f&7Fxt;O)) z3hdBJDizHRzOtV;#w^-JB<4A_E?DpWYOF!xs^vHy(YA^Mpjt z30!Tg(rt{m$xD?+dI2$%zD0Crf1ix?=$vWu$0=yfG&&{F_jt!~l!r+h7C-oo<_&ti)Cp~J3uN7dCVJYlxb&$`DdAiH5m&tHt!TQ=Tv z{%Ysi<I2efg*1f%-VJN?#|^GNj;ZcvEy!Cd5fzjQN~f;+t#2vRs${k>g|MC&{s@< E0H*O-n*aa+ literal 0 HcmV?d00001 diff --git a/test/txtfiles/Rust.rs b/test/txtfiles/Rust.rs new file mode 100644 index 0000000000000000000000000000000000000000..7036b1588f0c03d97ea172fc6ef672b456af0d0a GIT binary patch literal 5052 zcmd6rUr!rH6vgLtEA=}pkxC3C2D>j+TJlo0%1cp{wofQU1`M?Xw&gWxXq0^Pw&yq3 zmzi0w9r9M8-SzIw+&|}@d+!YY{2T5<6UL#|eHkvp3;iv^C`?b z?WVCwm_?aChe^1R9-D`pE9s~ub)=DL=!HGKeTW)r{o;@LOFc)j=vq2n==Y~^sta2e z;jP|}b)g@-eIBw*k4u_JTawd{l3nLclrhwJsomGkr3nj{S~U$jvh+##T^dKSX&i0( zpnDTOO2Q9u=3E#prO`Zosrk<`?Wf^LmSbUEc+2{+bXYXHZE-}vZY1o88wj}Pr(q!3 zrSI;Cubpf5GW@w(`FiyRepAW&Oa3M4{cs_RW^n{m+qkx6-^%*yaQ5K4S?94w$1KdH z1?+eA%PeuJu)-z!6MigZ1@`vjaVdYDGrrEBze*!Gv6iU7IApN$IK0%o8);wfPe;!! zI1l%dHkK@B`K4@ek6rqvr)zEGKQSIFzB#&Gh;5Q( z-(gE0kBgO!_(Dv!^Pvt0TK^>U<#)2^$rfg`ty%YI_`maLC=WMtz3tIsVoWJsd<^l66?n zu8EuUw7*k3pB2@#J)`~J6YH?&Oj_ORE9Dq9+iLtz%8Z4wcA;^vTJ(YI_)aacI$u9j zyGAQv&f_fkxYgdzdvqeJsMud_J@v5BpLMWgKb6dTnf0vH3HCazEq$;zyOR}(4ZLxU z!nwZEyGN?&RAV2p-N5^ZcTc0(va4QiRh3Acx4sd#=dpsbC-CZ9R&%d5Ui+z_Xr&6W zs@*HER`H%_oLJY+SR{A z(WHP&LekJlc&1L6vTGeN_d4a+AY$nCA5_=p42wC*KhL0bOl`MFpFNY0+xlV`=7-@> zcKjy1CgKLTbDt^_M2h}&FGT5|*D)INIP*f--staMbBs}B1G(wDSL`7_VET@}gQ)vp zI(zDbmfu8^4!F?W_M_wo-|866h3@P!kw!I`M$LWYdM?%3bEY|)*t5QW*u*BsIrk^w zYaGtU(yjs~cE=>=X7`-!+|0do`@kthX&iSui3Mh-=k>bxaIo8wCia6|W6tBgcB<^l zZQt_c5{AmtT*7uQ9F=xPcAZ`-S;c9i>r|4*n$toZ(z&Awl~|UaH8^RcE<}F6j+JK= znFurKPw%AfQq1HOK;GPm_vewze1WfaI^er;x*xlgof6P$73WUR>FVrIWwob@I>`j8 zB9-$h>LuGP^Vrwh$!Dp0-0Sq*P9}Ro{Z3jyekA*I&X&Gg52hPk#*-DhO?*jTev}?6 z0Oy0hHG(Z;$!z2uteV98MKPPGZz(R+(O@^9YkaYaR+48>5Y)Wr&Z zUAa}V=jw^%43-#M+njA9auVykS-huJ)>G}>Pe;z_6OA9QEH%G#?$knq9h_;b#J6;I zW92uxO1^`hpTa=X&KK(z9%>!7x#UXRd)&(X@U75c=bKiyaRD#uu+(`nkW7Ky>WL}2PyqW%7Iqy35DBiP8Ats7?c?RbAFKpH;VB@cEP-~yM${AgY}hf zG~04xq6)!pI%V<>NpwTw8i;#!F!r=D^3K`L6ykrSizj`+{v)!h-IX!Os*JBLcW3_9 zWxf+%ZX%Yx+Um`xm}jLVU%Rf~*6hk_q?N1KRpYUZky)J2sUkDk4qNG8^+TrS-KWI3 wtWQ>P_QQU}p~S;ZHE1O!`4|YXV`*0CQz85tzp>}3Mr+Noz5Y(jZLHGuAHWs1`2YX_ literal 0 HcmV?d00001 diff --git a/test/txtfiles/TOML.toml b/test/txtfiles/TOML.toml new file mode 100644 index 000000000..218c369e8 --- /dev/null +++ b/test/txtfiles/TOML.toml @@ -0,0 +1,324 @@ +# This is a TOML document. - encoding:UTF-8 + +title = "TOML Example" + +[owner] +name = "Tom Preston-Werner" +dob = 1979-05-27T07:32:00-08:00 # First class dates + +[database] +server = "192.168.1.1" +ports = [ 8001, 8001, 8002 ] +connection_max = 5000 +enabled = true + +[servers] + + # Indentation (tabs and/or spaces) is allowed but not required + [servers.alpha] + ip = "10.0.0.1" + dc = "eqdc10" + + [servers.beta] + ip = "10.0.0.2" + dc = "eqdc10" + +[clients] +data = [ ["gamma", "delta"], [1, 2] ] + + +[strings] +str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF." + +str1 = """ +Roses are red +Violets are blue""" + +# On a Unix system, the above multi-line string will most likely be the same as: +str2 = "Roses are red\nViolets are blue" + +# On a Windows system, it will most likely be equivalent to: +str3 = "Roses are red\r\nViolets are blue" + +# The following strings are byte-for-byte equivalent: +str1 = "The quick brown fox jumps over the lazy dog." + +str2 = """ +The quick brown \ + + + fox jumps over \ + the lazy dog.""" + +str3 = """\ + The quick brown \ + fox jumps over \ + the lazy dog.\ + """ + +### String Literals ### +regex2 = '''I [dw]on't need \d{2} apples''' + +lines = ''' +The first newline is +trimmed in raw strings. + All other whitespace + is preserved. +''' + +# What you see is what you get. +winpath = 'C:\Users\nodejs\templates' +winpath2 = '\\ServerX\admin$\system32\' +quoted = 'Tom "Dubs" Preston-Werner' +regex = '<\i\c*\s*>' + +str4 = """ +Roses are red +Violets are blue""" + + +[numbers] + +int1 = +99 +int2 = 42 +int3 = 0 +int4 = -17 +int5 = 1_000 +int6 = 5_349_221 +int7 = 1_2_3_4_5 # VALID but discouraged + +# hexadecimal with prefix `0x` +hex1 = 0xDEADBEEF +hex2 = 0xdeadbeef +hex3 = 0xdead_beef + +# octal with prefix `0o` +oct1 = 0o01234567 +oct2 = 0o755 # useful for Unix file permissions + +# binary with prefix `0b` +bin1 = 0b11010110 + +# fractional +flt1 = +1.0 +flt2 = 3.1415 +flt3 = -0.01 + +# exponent +flt4 = 5e+22 +flt5 = 1e6 +flt6 = -2E-2 + +# both +flt7 = 6.626e-34 +flt8 = 224_617.445_991_228 +# infinity +sf1 = inf # positive infinity +sf2 = +inf # positive infinity +sf3 = -inf # negative infinity + +# not a number +sf4 = nan # actual sNaN/qNaN encoding is implementation specific +sf5 = +nan # same as `nan` +sf6 = -nan # valid, actual encoding is implementation specific + +# boolean +bool1 = true +bool2 = false + +[date time] + +# Offset Date-Time ( RFC 3339 : http://tools.ietf.org/html/rfc3339 ) +odt1 = 1979-05-27T07:32:00Z +odt2 = 1979-05-27T00:32:00-07:00 +odt3 = 1979-05-27T00:32:00.999999-07:00 +# readability +odt4 = 1979-05-27 07:32:00Z + +# Local Date-Time ( +ldt1 = 1979-05-27T07:32:00 +ldt2 = 1979-05-27T00:32:00.999999 + +# Local Date +ld1 = 1979-05-27 + +# Local Time +lt1 = 07:32:00 +lt2 = 00:32:00.999999 + +[array] + +arr1 = [ 1, 2, 3 ] +arr2 = [ "red", "yellow", "green" ] +arr3 = [ [ 1, 2 ], [3, 4, 5] ] +arr4 = [ "all", 'strings', """are the same""", '''type'''] +arr5 = [ [ 1, 2 ], ["a", "b", "c"] ] + +arr6 = [ 1, 2.0 ] # INVALID + +arr7 = [ + 1, 2, 3 +] + +# Line breaks are OK when inside arrays +hosts = [ + "alpha", + "omega", + "echo" # Comments at evry time +] + +arr8 = [ + 1, + 2, # this is ok +] + + +# This is a special Section [table] definitions +[table] +# Under that, and until the next table or EOF are the key/values of that table. +# Key/value pairs within tables are not guaranteed to be in any specific order. + +[table-1] +key1 = "some string" +key2 = 123 + +[table-2] +key1 = "another string" +key2 = 456 + +[dog."tater.man"] +type.name = "pug" +# In JSON land, that would give you the following structure: +# { "dog": { "tater.man": { "type": { "name": "pug" } } } } + +[a.b.c] # this is best practice +[ d.e.f ] # same as [d.e.f] +[ g . h . i ] # same as [g.h.i] +[ j . "ʞ" . 'l' ] # same as [j."ʞ".'l'] + +# [x] you +# [x.y] don't +# [x.y.z] need these +[x.y.z.w] # for this to work + +# DO NOT DO THIS + +[a] +b = 1 + +[a] +c = 2 + +# DO NOT DO THIS EITHER + +[a] +b = 1 + +[a.b] +c = 2 + +# Inline Table +name = { first = "Tom", last = "Preston-Werner" } +point = { x = 1, y = 2 } +animal = { type.name = "pug" } + +[name] +first = "Tom" +last = "Preston-Werner" + +[point] +x = 1 +y = 2 + +[animal] +type.name = "pug" + + + +# Array of Tables +[[products]] +name = "Hammer" +sku = 738594937 + +[[products]] + +[[products]] +name = "Nail" +sku = 284758393 +color = "gray" + +# In JSON land, that would give you the following structure: +# { +# "products": [ +# { "name": "Hammer", "sku": 738594937 }, +# { }, +# { "name": "Nail", "sku": 284758393, "color": "gray" } +# ] +# } +# +# + +[[fruit]] + name = "apple" + + [fruit.physical] + color = "red" + shape = "round" + + [[fruit.variety]] + name = "red delicious" + + [[fruit.variety]] + name = "granny smith" + +[[fruit]] + name = "banana" + + [[fruit.variety]] + name = "plantain" + +# In JSON land, that would give you the following structure: +# { +# "fruit": [ +# { +# "name": "apple", +# "physical": { +# "color": "red", +# "shape": "round" +# }, +# "variety": [ +# { "name": "red delicious" }, +# { "name": "granny smith" } +# ] +# }, +# { +# "name": "banana", +# "variety": [ +# { "name": "plantain" } +# ] +# } +# ] +# } +# + +# INVALID TOML DOC +fruit = [] + +[[fruit]] # Not allowed + +# INVALID TOML DOC +[[fruit]] + name = "apple" + + [[fruit.variety]] + name = "red delicious" + + # This table conflicts with the previous table + [fruit.variety] + name = "granny smith" + +points = [ { x = 1, y = 2, z = 3 }, + { x = 7, y = 8, z = 9 }, + { x = 2, y = 4, z = 8 } ] + + \ No newline at end of file diff --git a/test/txtfiles/TXT/License.txt b/test/txtfiles/TXT/License.txt new file mode 100644 index 000000000..7cec00797 --- /dev/null +++ b/test/txtfiles/TXT/License.txt @@ -0,0 +1,71 @@ +Notepad3 and MiniPath Copyright © 2008-2016 Rizonesoft, All rights reserved. +https://www.rizonesoft.com + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. +3. Neither the name of Florian Balmer nor the names of its contributors may be +used to endorse or promote products derived from this software without specific +prior written permission. + + 01 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + 02 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + 03 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + 04 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + 05 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + 06 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + 07 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + 08 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + 09 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + 10 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +================================================== +License for Scintilla and SciTE +================================================== +Copyright 1998-2002 by Neil Hodgson + +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that +the above copyright notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting documentation. + +NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NEIL +HODGSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY +DAMAGESWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +================================================== +License for Onigmo (Oniguruma-mod) RegEx Engine +================================================== +Copyright (c) 2002-2009 K.Kosako +Copyright (c) 2011-2014 K.Takata +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +OF SUCH DAMAGE. \ No newline at end of file diff --git a/test/txtfiles/TXT/Malayan_Problem.txt b/test/txtfiles/TXT/Malayan_Problem.txt new file mode 100644 index 000000000..4e6616691 --- /dev/null +++ b/test/txtfiles/TXT/Malayan_Problem.txt @@ -0,0 +1,5 @@ +\u0D19\u0D4d\u0D19 +\u0D19\u0D4d\u0D19 +ങ്ങ +ങ്ങ +ങ്ങ diff --git a/test/txtfiles/TXT/regex_find.txt b/test/txtfiles/TXT/regex_find.txt new file mode 100644 index 000000000..a70a351eb --- /dev/null +++ b/test/txtfiles/TXT/regex_find.txt @@ -0,0 +1,24 @@ +# ======================================================= +# Manual Test +# ----------------------------------------------------------------------------------------------- +# In "Find Text" / "Replace Text" Dialog and RegEx chosen: +# RegEx: "(\d\d)\s\1" ( w/o the double quotes) +# => "can't "Find Previous" this string" +# Remark: but, "Find Next" is working. +# ======================================================= + +03 03 04 05 06 07 08 09 +03 03 04 05 06 07 08 09 +03 03 04 05 06 07 08 09 +03 03 04 05 06 07 08 09 +03 03 04 05 06 07 08 09 +03 03 04 05 06 07 08 09 +03 03 04 05 06 07 08 09 +03 03 04 05 06 07 08 09 +03 03 04 05 06 07 08 09 +03 03 04 05 06 07 08 09 +03 03 04 05 06 07 08 09 +03 03 04 05 06 07 08 09 +03 03 04 05 06 07 08 09 +03 03 04 05 06 07 08 09 +03 03 04 05 06 07 08 09 diff --git a/test/txtfiles/strange.txt b/test/txtfiles/TXT/strange_chacter_visual_artefacts.txt similarity index 100% rename from test/txtfiles/strange.txt rename to test/txtfiles/TXT/strange_chacter_visual_artefacts.txt diff --git a/test/txtfiles/python.py b/test/txtfiles/python.py new file mode 100644 index 000000000..5adc92bfe --- /dev/null +++ b/test/txtfiles/python.py @@ -0,0 +1,401 @@ +# -*- coding: utf-8 -*- +# ----------------------------------------------------------------------------- +""" +Utilities and Helpers for General Tasks +""" +import sys +import os +import stat +import getpass +import shutil +import tempfile +import logging + +from datetime import datetime + +# ============================================================================= + +WRITE_TO_LOGFILE = False +DEFAULT_LOG_LEVEL = logging.INFO +LOG_DIR_CONFIG_FILENAME = "_DBMIG_TMP_DIR_CFG.ini" + +# ============================================================================= + +# TODO: unique keys should not be empty +_NOT_NULL_EXCEPTION_LIST = [('deductions', 'imrestype_ref'), + ('queue lengths', 'imrestype_ref'), + ('neighbour networkpoint distances', 'traffic network'), + ('occupations', 'day'), + ('tb_loc_prop', 'internal_id')] + #('flighttypes', 'bgcolor_ref'), + #('managedstations', 'routings_ref'), + #('routings', 'classification_ref'), + #('routings', 'timezone_ref')] + +# force FK references to be not null +_NOT_NULL_FK_REF_LIST = ['managedstations'] + +# ============================================================================= + +def eprint(strg): + """ print to stderr """ + print(strg, file=sys.stderr) + sys.stderr.flush() + +# ============================================================================= + +def is_ascii(strg): + """ is_ascii() """ + #~return all(ord(c) < 128 for c in strg) + try: + strg.encode('ascii') + except UnicodeEncodeError: + return False + return True + + +def is_mbcs(strg): + """ is_ascii() """ + try: + strg.encode('mbcs') + except UnicodeEncodeError: + return False + return True + +# ============================================================================= + +def check_read_access(input_file): + """ check_read_access """ + if not os.path.isfile(input_file): + eprint("Input file ({}) not found!".format(input_file)) + return False + + if not os.access(input_file, os.R_OK): + eprint("Input file ({}) is not readable!".format(input_file)) + return False + + return True + +# ============================================================================= + + +def check_write_access(output_path): + """ check_write_access """ + from tempfile import NamedTemporaryFile + + # check if file exists + if os.path.isfile(output_path): + + if not os.access(output_path, os.W_OK): + eprint("Output file ({}) is not writable!".format(output_path)) + return False + try: + os.rename(output_path, output_path) # hack alert + except OSError as err: + eprint("Error on write access: {}".format(err)) + return False + + else: # check if directory is writable + try: + out_dir = os.path.dirname(output_path) + with NamedTemporaryFile(dir=out_dir, delete=True) as tmpfile: + tmpfile.write(b'blahblub') + tmpfile.flush() + except OSError as err: + eprint("Error on write access: {}".format(err)) + return False + + return True + +# ============================================================================= + + +def compose_log_file_path(db_path=None,aprefix="PY"): + """ compose_log_file_path() """ + + global WRITE_TO_LOGFILE + log_file_dir = None + log_file_path = None + + try: + # assuming this is deterministic + cfg_log_path = os.path.join(tempfile.gettempdir(), LOG_DIR_CONFIG_FILENAME) + if os.path.isfile(cfg_log_path): + with open(cfg_log_path, 'r') as file: + log_file_dir = file.readline() + except OSError as err: + eprint("Error on reading file '{file}' : {err}".format(file=cfg_log_path, err=err)) + log_file_dir = None + except: # pylint: disable=bare-except + eprint("Error on composing logfile path!") + log_file_dir = None + finally: + if log_file_dir: + WRITE_TO_LOGFILE = True + if db_path and not log_file_dir: + log_file_dir = os.path.dirname(db_path) + + if not (log_file_dir and os.path.isdir(log_file_dir)): + return None + + if not check_write_access(log_file_dir): + eprint("No write access to: '{dir}!'".format(dir=log_file_dir)) + return None + + if db_path: + base_name = "_".join([aprefix, os.path.basename(db_path)]) + else: + # no logfile specified, but log_file_dir given: make temp name + tmp_path = tempfile.NamedTemporaryFile(prefix=aprefix, suffix="") + base_name = os.path.basename(tmp_path.name) + + time_stamp = datetime.now().strftime("%Y-%m-%d_%H%M%S.%f")[:-3] + pid_str = "{}".format(os.getpid()) + log_file_name = ".".join([base_name[:16], getpass.getuser(), pid_str, time_stamp, "log"]) + + return os.path.join(log_file_dir, log_file_name) + + +# ============================================================================= + +MAIN_LOGGER = "thePLPythonMainLogger" + +def create_logger(log_file_path=None): + """ create_logger() """ + if WRITE_TO_LOGFILE and log_file_path: + have_write_access = check_write_access(log_file_path) + else: + have_write_access = False + # create logger + logger = logging.getLogger(MAIN_LOGGER) + # create file handler which logs even debug messages + if have_write_access: + try: + if os.path.isfile(log_file_path): + os.remove(log_file_path) + file_handler = logging.FileHandler(log_file_path, 'w', encoding='UTF-8') + file_handler.setLevel(logging.NOTSET) + except OSError as err: + # don't use eprint() cause this will trigger error meassage in Planning + print("Exception: Can not remove old logfile {}!".format(log_file_path)) + have_write_access = false + # create console handler with a higher log level + con_stdout_handler = logging.StreamHandler(stream=sys.stdout) + con_stdout_handler.setLevel(logging.NOTSET) + con_stderr_handler = logging.StreamHandler(stream=sys.stderr) + con_stderr_handler.setLevel(logging.ERROR) + # create formatter and add it to the handlers + #formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") + formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s") + if have_write_access: + file_handler.setFormatter(formatter) + con_stdout_handler.setFormatter(formatter) + con_stderr_handler.setFormatter(formatter) + # add the handlers to the logger + if have_write_access: + logger.addHandler(file_handler) + logger.addHandler(con_stdout_handler) + logger.addHandler(con_stderr_handler) + # set default loglevel + logger.setLevel(DEFAULT_LOG_LEVEL) + return logger + +# ----------------------------------------------------------------------------- + +def get_main_logger(): + """ get_main_logger() """ + return logging.getLogger(MAIN_LOGGER) + +# ----------------------------------------------------------------------------- + +def flush_logger(): + """ flush_logger() """ + logger = get_main_logger() + for handler in logger.handlers: + handler.flush() + +# ============================================================================= + + +def add_read_permission(pathname, who='u'): + """Add "read" permission to specified path. + """ + mode = os.stat(pathname).st_mode + mode_map = { + 'u': stat.S_IRUSR, + 'g': stat.S_IRGRP, + 'o': stat.S_IROTH, + 'a': stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH, + } + for w in who: + mode |= mode_map[w] + os.chmod(pathname, mode) + +# ----------------------------------------------------------------------------- + +def add_write_permission(pathname, who='u'): + """Add "write" permission to specified path. + """ + mode = os.stat(pathname).st_mode + mode_map = { + 'u': stat.S_IWUSR, + 'g': stat.S_IWGRP, + 'o': stat.S_IWOTH, + 'a': stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH, + } + for w in who: + mode |= mode_map[w] + os.chmod(pathname, mode) + +# ----------------------------------------------------------------------------- + +def add_execute_permission(pathname, who='u'): + """Add "write" permission to specified path. + """ + mode = os.stat(pathname).st_mode + mode_map = { + 'u': stat.S_IXUSR, + 'g': stat.S_IXGRP, + 'o': stat.S_IXOTH, + 'a': stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH, + } + for w in who: + mode |= mode_map[w] + os.chmod(pathname, mode) + +# ============================================================================= + + +def get_ordered_unique_list(seq, rev=False): + """ get_ordered_unique_list() """ + return sorted(set(seq), reverse=rev) + +# ----------------------------------------------------------------------------- + + +def get_missing_elements(sorted_list_of_int, start=None, end=None): + """ get_missing_elements() + call: list(migutils.get_missing_elements(migutils.get_ordered_unique_list(seq))) + """ + if not start: + start = 0 + if not end: + end = len(sorted_list_of_int) - 1 + + if (end - start) <= 1: + if (sorted_list_of_int[end] - sorted_list_of_int[start]) > 1: + yield from range(sorted_list_of_int[start] + 1, sorted_list_of_int[end]) + return + + index = start + (end - start) // 2 + + # is the lower half consecutive? + consecutive_low = sorted_list_of_int[index] == (sorted_list_of_int[start] + (index - start)) + if not consecutive_low: + yield from get_missing_elements(sorted_list_of_int, start, index) + + # is the upper part consecutive? + consecutive_high = sorted_list_of_int[index] == (sorted_list_of_int[end] - (end - index)) + if not consecutive_high: + yield from get_missing_elements(sorted_list_of_int, index, end) + +# ----------------------------------------------------------------------------- + +def create_temp_filecopy(logger, fpath, fprefix="py_", fsuffix=".tmp"): + """ create_temp_filecopy + """ + #~tmp_file_name = db_path + ".tmp_{0}.mdb".format(os.getlogin()) + tmp_file = tempfile.NamedTemporaryFile(prefix=fprefix, suffix=fsuffix) + tmp_file_name = tmp_file.name + tmp_file.close() # deletes tmp file + logger.info("Creating temporary copy %r.", tmp_file_name) + copy_path = shutil.copy2(fpath, tmp_file_name) + if not os.path.isfile(copy_path): + logger.error("Can not create a temp. copy of '%r'.", fpath) + return None + add_read_permission(copy_path, 'a') + add_write_permission(copy_path, 'a') + return copy_path + +# ----------------------------------------------------------------------------- + +# ============================================================================= + +class CiDict(dict): + """ Case-Insensitive dictionary + """ + + class Key(str): + """ Key """ + def __init__(self, key): + """ __init__""" + str.__init__(key) + + def __hash__(self): + """ __hash__""" + return hash(self.lower()) + + def __eq__(self, other): + """ __eq__""" + return self.lower() == other.lower() + + # ------------------------------------------------ + + def __init__(self, data=None): + """ C'tor of CiDict """ + super(CiDict, self).__init__() + if data is None: + data = {} + for (key, val) in data.items(): + self[key] = val + + def __contains__(self, key): + """ __contains__ """ + key = self.Key(key) + return super(CiDict, self).__contains__(key) + + def __delitem__(self, key): + """ __delitem__ """ + key = self.Key(key) + return super(CiDict, self).__delitem__(key) + + def __setitem__(self, key, value): + """ __setitem__ """ + key = self.Key(key) + super(CiDict, self).__setitem__(key, value) + + def __getitem__(self, key): + """ __getitem__ """ + key = self.Key(key) + return super(CiDict, self).__getitem__(key) + +# ========================================================================= + + +def indent_xml(elem, level=0, last=False): + """ indent_xml(): text tail """ + _tab = "\t" + _tail = "\n" + (level * _tab) + _text = _tail + _tab + + if elem: + if not elem.text or not elem.text.strip(): elem.text = _text + + # recursion + for el in elem[:-1]: indent_xml(el, level+1) + + # last item + if level: + for el in elem[-1:]: indent_xml(el, level, True) + else: + for el in elem[-1:]: indent_xml(el, 1, True) + + if not elem.tail or not elem.tail.strip(): elem.tail = "\n" if last else _tail + + else: + if not elem.tail or not elem.tail.strip(): elem.tail = _tail + +# ============================================================================= + + +# ============================================================================= diff --git a/test/txtfiles/regex_find.txt b/test/txtfiles/regex_find.txt deleted file mode 100644 index 4ab58ab40..000000000 --- a/test/txtfiles/regex_find.txt +++ /dev/null @@ -1,26 +0,0 @@ -In "Find Text" dialog (or "Replace Text" and Regular expression search box ticked), -I can't "Find Previous" this string - -(\d\d)\s\1 - -on this text (for example): - -03 03 04 05 06 07 08 09 -03 03 04 05 06 07 08 09 -03 03 04 05 06 07 08 09 -03 03 04 05 06 07 08 09 -03 03 04 05 06 07 08 09 -03 03 04 05 06 07 08 09 -03 03 04 05 06 07 08 09 -03 03 04 05 06 07 08 09 -03 03 04 05 06 07 08 09 -03 03 04 05 06 07 08 09 -03 03 04 05 06 07 08 09 -03 03 04 05 06 07 08 09 -03 03 04 05 06 07 08 09 -03 03 04 05 06 07 08 09 -03 03 04 05 06 07 08 09 - -but, "Find Next" is working. - -In Notepad2 and Notepad2BE works fine. \ No newline at end of file From c61559dc0fda4df2e98c21dd1950a2f612b8ed7d Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 13 Jun 2019 17:53:29 +0200 Subject: [PATCH 8/8] + add: TOML Lexer: Quoted Key handling --- sciXlexers/LexTOML.cxx | 106 +++++++++++++++++++++++++++++++++++----- test/txtfiles/TOML.toml | 15 ++++++ 2 files changed, 110 insertions(+), 11 deletions(-) diff --git a/sciXlexers/LexTOML.cxx b/sciXlexers/LexTOML.cxx index c6fcc83de..5dd65c27d 100644 --- a/sciXlexers/LexTOML.cxx +++ b/sciXlexers/LexTOML.cxx @@ -111,7 +111,7 @@ class LexerTOML : public DefaultLexer { public: LexerTOML() : DefaultLexer(lexicalClasses, ELEMENTS(lexicalClasses)) - , validKey(CharacterSet::setAlphaNum, "_.", 0x80, false) + , validKey(CharacterSet::setAlphaNum, R"(-_.)", 0x80, false) //, validKeyWord(CharacterSet::setAlphaNum, "_", 0x80, false) , validNumberEnd(CharacterSet::setNone, " \t\n\v\f\r#,)}]", 0x80, false) , chDateTime(CharacterSet::setNone, "-:TZ", 0x80, false) @@ -281,6 +281,32 @@ static bool IsDateTimeStr(StyleContext& sc, const CharacterSet& validCh, const C // ---------------------------------------------------------------------------- +static bool IsLookAheadLineEmpty(StyleContext& sc) +{ + Sci_Position const posCurrent = static_cast(sc.currentPos); + Sci_Position const posEnd = static_cast(sc.lineStartNext); + + Sci_Position i = 0; + bool bLHLineEmpty = true; + + while ((++i + posCurrent) < posEnd) + { + int const ch = sc.GetRelative(i); + + if (!Scintilla::IsASpace(ch)) { + if (IsCommentChar(ch)) { + break; // ignore rest of line + } + bLHLineEmpty = false; + break; + } + } + return bLHLineEmpty; +} +// ---------------------------------------------------------------------------- + + + // ---------------------------------------------------------------------------- void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument* pAccess) @@ -288,13 +314,18 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int Accessor styler(pAccess, nullptr); StyleContext sc(startPos, length, initStyle, styler); + bool inSQuotedKey = false; + bool inDQuotedKey = false; + bool inInnerQKey = false; + bool inSectionDef = false; + bool inMultiLnString = (sc.state == SCE_TOML_STR_BASIC) || (sc.state == SCE_TOML_STR_LITERAL); bool inMultiLnArrayDef = false; + bool inHex = false; bool inBin = false; bool inOct = false; - //bool bFloatHasDot = false; for (; sc.More(); sc.Forward()) { @@ -304,6 +335,7 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int // -------------------------------------------------- if (sc.atLineStart) { inMultiLnArrayDef = (GetBracketLevel(sc) >= 0); + inSQuotedKey = inDQuotedKey = inInnerQKey = false; // clear switch (sc.state) { case SCE_TOML_STR_BASIC: @@ -312,6 +344,9 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int sc.SetState(SCE_TOML_PARSINGERROR); } break; + case SCE_TOML_ASSIGNMENT: + sc.SetState(SCE_TOML_PARSINGERROR); + break; case SCE_TOML_PARSINGERROR: // preserve error break; @@ -366,8 +401,18 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int else if (validKey.Contains(sc.ch)) { sc.SetState(SCE_TOML_KEY); } - else { - sc.SetState(SCE_TOML_PARSINGERROR); + else { // not valid - maybe quoted + if (sc.ch == '"') { + inDQuotedKey = true; + sc.SetState(SCE_TOML_KEY); + } + else if (sc.ch == '\'') { + inSQuotedKey = true; + sc.SetState(SCE_TOML_KEY); + } + else { + sc.SetState(SCE_TOML_PARSINGERROR); + } } break; @@ -395,24 +440,63 @@ void SCI_METHOD LexerTOML::Lex(Sci_PositionU startPos, Sci_Position length, int case SCE_TOML_KEY: - if (IsASpaceOrTab(sc.ch)) { - sc.SetState(SCE_TOML_ASSIGNMENT); // end of key + if ((sc.ch == '"') && inDQuotedKey) { + if (inInnerQKey) { + sc.SetState(SCE_TOML_PARSINGERROR); + } + else { + sc.ForwardSetState(SCE_TOML_ASSIGNMENT); // end of key + } + } + else if ((sc.ch == '\'') && inSQuotedKey) { + if (inInnerQKey) { + sc.SetState(SCE_TOML_PARSINGERROR); + } + else { + sc.ForwardSetState(SCE_TOML_ASSIGNMENT); // end of key + } + } + else if (IsASpaceOrTab(sc.ch)) { + if (!(inSQuotedKey || inDQuotedKey || inInnerQKey)) { + sc.SetState(SCE_TOML_ASSIGNMENT); // end of key + } + // else eat } else if (IsAssignChar(sc.ch)) { - sc.SetState(SCE_TOML_ASSIGNMENT); + if (!(inSQuotedKey || inDQuotedKey || inInnerQKey)) { + sc.SetState(SCE_TOML_ASSIGNMENT); + } + // else eat } - else if (!validKey.Contains(sc.ch)) { - sc.SetState(SCE_TOML_PARSINGERROR); + else if (validKey.Contains(sc.ch)) { + // eat + } + else { + if ((sc.ch == '"') && inSQuotedKey) { + inInnerQKey = !inInnerQKey; //toggle + } + else if ((sc.ch == '\'') && inDQuotedKey) { + inInnerQKey = !inInnerQKey; //toggle + } + else if (!(inSQuotedKey || inDQuotedKey || inInnerQKey)) { + sc.SetState(SCE_TOML_PARSINGERROR); + } + // else eat } break; case SCE_TOML_ASSIGNMENT: if (IsAssignChar(sc.ch)) { - sc.ForwardSetState(SCE_TOML_VALUE); + if (!IsLookAheadLineEmpty(sc)) { + sc.ForwardSetState(SCE_TOML_VALUE); + } + else { + sc.SetState(SCE_TOML_PARSINGERROR); + } // fall through case SCE_TOML_VALUE: } - else if (IsASpaceOrTab(sc.ch)) { + else if (IsASpace(sc.ch)) { break; // OK } else { diff --git a/test/txtfiles/TOML.toml b/test/txtfiles/TOML.toml index 218c369e8..5f9171e35 100644 --- a/test/txtfiles/TOML.toml +++ b/test/txtfiles/TOML.toml @@ -26,6 +26,21 @@ enabled = true [clients] data = [ ["gamma", "delta"], [1, 2] ] +[keys] + +key = "value" +key = # INVALID +key = "value" +bare_key = "value" +bare-key = "value" +1234 = "value" + +"127.0.0.1" = "value" +"character encoding" = "value" +"ʎǝʞ" = "value" +'key2' = "value" +'quoted "value"' = "value" + [strings] str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."