From ba6ac20ec912cf4a004ea194bb3cace83f053dc6 Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Fri, 3 Jan 2020 11:03:46 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=D1=8B=20=D0=BB?= =?UTF-8?q?=D0=B8=D1=88=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B1=D0=B5?= =?UTF-8?q?=D0=BB=D1=8B=20=D0=BF=D1=80=D0=B8=20=D0=B3=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20CodeTemplates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit StructuredObjectToString - правильный вывод Dictionary --- .../PascalABCParserNewSaushkin/ABCPascal.cs | 6 +++--- .../ABCPascalYacc.cs | 6 +++--- Parsers/PascalABCParserNewSaushkin/PABC.ymc | 12 +++++++----- .../IB/CodeCompletion/CodeCompletionActions.cs | 8 ++++++++ .../CodeTemplatesPlugin/CodeTemplatesForm.cs | 12 ++++++++++-- bin/Lib/PABCSystem.pas | 18 +++++++++++++++++- 6 files changed, 48 insertions(+), 14 deletions(-) diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs index c70d451a0..6c68f1081 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs @@ -1,9 +1,9 @@ // // This CSharp output file generated by Gardens Point LEX // Version: 1.1.3.301 -// Machine: DESKTOP-P4NLNB1 -// DateTime: 12/30/2019 12:27:08 PM -// UserName: fatco +// Machine: DESKTOP-G8V08V4 +// DateTime: 01.01.2020 22:55:53 +// UserName: ????????? // GPLEX input file // GPLEX frame file // diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs index a905efa9e..dfcd90fe0 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs @@ -1,9 +1,9 @@ // (see accompanying GPPGcopyright.rtf) // GPPG version 1.3.6 -// Machine: DESKTOP-P4NLNB1 -// DateTime: 12/30/2019 12:27:10 PM -// UserName: fatco +// Machine: DESKTOP-G8V08V4 +// DateTime: 01.01.2020 22:55:53 +// UserName: ????????? // Input file // options: no-lines gplex diff --git a/Parsers/PascalABCParserNewSaushkin/PABC.ymc b/Parsers/PascalABCParserNewSaushkin/PABC.ymc index 18dc964d6..9563aa01b 100644 --- a/Parsers/PascalABCParserNewSaushkin/PABC.ymc +++ b/Parsers/PascalABCParserNewSaushkin/PABC.ymc @@ -1,16 +1,18 @@ lex=ABCPascal.lex yacc=ABCPascal.y -lexGen=H:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\Gplex.exe -yaccGen=H:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gppg.exe +lexGen=D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\Gplex.exe +yaccGen=D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gppg.exe lexGenOpt=/unicode yaccGenOpt=/gplex useCustomScript script= -"H:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gplex.exe" /unicode "H:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.lex" +"D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gplex.exe" /unicode "D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.lex" + +"D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gppg.exe" /no-lines /gplex "D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.y" + +"D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\convert4.exe" -"H:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gppg.exe" /no-lines /gplex "H:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.y" -"H:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\convert4.exe" diff --git a/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionActions.cs b/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionActions.cs index f09036939..fce47fa40 100644 --- a/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionActions.cs +++ b/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionActions.cs @@ -356,6 +356,14 @@ namespace VisualPascalABC StringBuilder sb = new StringBuilder(); IDocument doc = textArea.Document; + if (textArea.SelectionManager.HasSomethingSelected) // удаление выделенного + { + var isel = textArea.SelectionManager.SelectionCollection[0]; + textArea.Caret.Line = isel.StartPosition.Line; + textArea.Caret.Column = isel.StartPosition.Column; + textArea.SelectionManager.RemoveSelectedText(); + } + int line = textArea.Caret.Line; int col = textArea.Caret.Column; string name = templateManager.GetTemplateHeader(pattern); diff --git a/VisualPlugins/CodeTemplatesPlugin/CodeTemplatesForm.cs b/VisualPlugins/CodeTemplatesPlugin/CodeTemplatesForm.cs index 7be8f195c..2c5fd615b 100644 --- a/VisualPlugins/CodeTemplatesPlugin/CodeTemplatesForm.cs +++ b/VisualPlugins/CodeTemplatesPlugin/CodeTemplatesForm.cs @@ -11,6 +11,7 @@ using System.Windows.Forms; using VisualPascalABC; using System.Text.RegularExpressions; using ICSharpCode.TextEditor.Document; +using ICSharpCode.TextEditor; namespace CodeTemplatesPlugin { @@ -133,13 +134,20 @@ namespace CodeTemplatesPlugin if (m.Groups[1].Value.Length > 0) { var Curr = GetLine(ta.Caret.Line); - if (Curr.Length < m.Groups[1].Index) + if (Curr.Length > m.Groups[1].Index) { ta.Caret.Column = Curr.Length; - ta.InsertString(new string(' ', m.Groups[1].Index - Curr.Length)); + ta.InsertString(new string(' ', Curr.Length - m.Groups[1].Index)); } ta.Caret.Column = m.Groups[1].Index; + + var doc = ta.Document; + var tl_beg = new TextLocation(ta.Caret.Column, ta.Caret.Line); + int offset = doc.PositionToOffset(tl_beg); + + if (Curr.Length > ta.Caret.Column && Curr.Substring(ta.Caret.Column).TrimEnd().Length == 0) + doc.Remove(offset, Curr.Length - ta.Caret.Column); } } var Next = GetNextLine(ta.Caret.Line); diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index 83662f5ee..6adf57870 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -1995,33 +1995,40 @@ function KV(key: TKey; value: TVal): KeyValuePair; //>> Вспомогательные функции для pattern matching # // ----------------------------------------------------- +///-- function __TypeCheckAndAssignForIsMatch(obj: object; var res: T): boolean; +///-- function __WildCardsTupleEqual( first: Tuple; second: Tuple; elemsToCompare: sequence of integer): boolean; +///-- function __WildCardsTupleEqual( first: Tuple; second: Tuple; elemsToCompare: sequence of integer): boolean; +///-- function __WildCardsTupleEqual( first: Tuple; second: Tuple; elemsToCompare: sequence of integer): boolean; +///-- function __WildCardsTupleEqual( first: Tuple; second: Tuple; elemsToCompare: sequence of integer): boolean; +///-- function __WildCardsTupleEqual( first: Tuple; second: Tuple; elemsToCompare: sequence of integer): boolean; +///-- function __WildCardsTupleEqual( first: Tuple; second: Tuple; @@ -3497,7 +3504,16 @@ begin var sb := new StringBuilder(); var g := (o as System.Collections.IEnumerable).GetEnumerator(); - var isdictorset := o.GetType.Name.Equals('Dictionary`2') or o.GetType.Name.Equals('SortedDictionary`2') or (o.GetType = typeof(TypedSet)) or o.GetType.Name.Equals('HashSet`1') or o.GetType.Name.Equals('SortedSet`1'); + var otype := o.GetType; + + //var isdictorset := otype.Name.Equals('Dictionary`2') or otype.Name.Equals('SortedDictionary`2') or otype.Name.Equals('HashSet`1') or otype.Name.Equals('SortedSet`1'); + var isdictorset := o.GetType.IsGenericType and + ((otype.GetGenericTypeDefinition = typeof(Dictionary<,>)) + or (otype.GetGenericTypeDefinition = typeof(SortedDictionary<,>)) + or (otype.GetGenericTypeDefinition = typeof(HashSet<>)) + or (otype.GetGenericTypeDefinition = typeof(SortedSet<>))); + isdictorset := isdictorset or (otype = typeof(TypedSet)); + if isdictorset then sb.Append('{') else sb.Append('[');