-2**4 теперь возвращает -16
2**3**2 теперь работает
This commit is contained in:
parent
084bc1632a
commit
b4c5ad785e
|
|
@ -911,12 +911,12 @@ namespace PascalABCCompiler
|
||||||
public CodeGenerators.Controller CodeGeneratorsController = null;
|
public CodeGenerators.Controller CodeGeneratorsController = null;
|
||||||
//public LLVMConverter.Controller LLVMCodeGeneratorsController = null;
|
//public LLVMConverter.Controller LLVMCodeGeneratorsController = null;
|
||||||
//public PascalToCppConverter.Controller PABCToCppCodeGeneratorsController = null;
|
//public PascalToCppConverter.Controller PABCToCppCodeGeneratorsController = null;
|
||||||
private SyntaxTree.unit_or_namespace CurrentSyntaxUnit;
|
public SyntaxTree.unit_or_namespace CurrentSyntaxUnit;
|
||||||
private List<CompilationUnit> UnitsToCompile = new List<CompilationUnit>();
|
private List<CompilationUnit> UnitsToCompile = new List<CompilationUnit>();
|
||||||
public Hashtable RecompileList = new Hashtable(StringComparer.OrdinalIgnoreCase);
|
public Hashtable RecompileList = new Hashtable(StringComparer.OrdinalIgnoreCase);
|
||||||
private PascalABCCompiler.TreeRealization.unit_node_list Units;
|
private PascalABCCompiler.TreeRealization.unit_node_list Units;
|
||||||
private Hashtable CycleUnits = new Hashtable();
|
private Hashtable CycleUnits = new Hashtable();
|
||||||
private CompilationUnit CurrentCompilationUnit = null;
|
public CompilationUnit CurrentCompilationUnit = null;
|
||||||
private CompilationUnit FirstCompilationUnit = null;
|
private CompilationUnit FirstCompilationUnit = null;
|
||||||
private bool PCUReadersAndWritersClosed;
|
private bool PCUReadersAndWritersClosed;
|
||||||
public int beginOffset;
|
public int beginOffset;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,12 @@ namespace PascalABCCompiler
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*SyntaxTree.syntax_tree_node SyntaxTree
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}*/
|
||||||
|
|
||||||
uint LinesCompiled
|
uint LinesCompiled
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
||||||
public const string Major = "3";
|
public const string Major = "3";
|
||||||
public const string Minor = "7";
|
public const string Minor = "7";
|
||||||
public const string Build = "1";
|
public const string Build = "1";
|
||||||
public const string Revision = "2683";
|
public const string Revision = "2692";
|
||||||
|
|
||||||
public const string MainVersion = Major + "." + Minor;
|
public const string MainVersion = Major + "." + Minor;
|
||||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
%MINOR%=7
|
|
||||||
%REVISION%=2683
|
|
||||||
%COREVERSION%=1
|
%COREVERSION%=1
|
||||||
|
%REVISION%=2692
|
||||||
|
%MINOR%=7
|
||||||
%MAJOR%=3
|
%MAJOR%=3
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// This CSharp output file generated by Gardens Point LEX
|
// This CSharp output file generated by Gardens Point LEX
|
||||||
// Version: 1.1.3.301
|
// Version: 1.1.3.301
|
||||||
// Machine: DESKTOP-G8V08V4
|
// Machine: DESKTOP-G8V08V4
|
||||||
// DateTime: 27.08.2020 0:13:56
|
// DateTime: 14.09.2020 20:46:21
|
||||||
// UserName: ?????????
|
// UserName: ?????????
|
||||||
// GPLEX input file <ABCPascal.lex>
|
// GPLEX input file <ABCPascal.lex>
|
||||||
// GPLEX frame file <embedded resource>
|
// GPLEX frame file <embedded resource>
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
%type <stn> attribute_declarations
|
%type <stn> attribute_declarations
|
||||||
%type <stn> ot_visibility_specifier
|
%type <stn> ot_visibility_specifier
|
||||||
%type <stn> one_attribute attribute_variable
|
%type <stn> one_attribute attribute_variable
|
||||||
%type <ex> const_factor const_variable_2 const_term const_variable literal_or_number unsigned_number variable_or_literal_or_number
|
%type <ex> const_factor const_factor_without_unary_op const_variable_2 const_term const_variable literal_or_number unsigned_number variable_or_literal_or_number
|
||||||
%type <stn> program_block
|
%type <stn> program_block
|
||||||
%type <ob> optional_var class_attribute class_attributes class_attributes1
|
%type <ob> optional_var class_attribute class_attributes class_attributes1
|
||||||
%type <stn> member_list_section optional_component_list_seq_end
|
%type <stn> member_list_section optional_component_list_seq_end
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
%type <stn> typed_const_list1 typed_const_list optional_expr_list elem_list optional_expr_list_with_bracket expr_list const_elem_list1 /*const_expr_list*/ case_label_list const_elem_list optional_const_func_expr_list elem_list1
|
%type <stn> typed_const_list1 typed_const_list optional_expr_list elem_list optional_expr_list_with_bracket expr_list const_elem_list1 /*const_expr_list*/ case_label_list const_elem_list optional_const_func_expr_list elem_list1
|
||||||
%type <stn> enumeration_id expr_l1_list
|
%type <stn> enumeration_id expr_l1_list
|
||||||
%type <stn> enumeration_id_list
|
%type <stn> enumeration_id_list
|
||||||
%type <ex> const_simple_expr term term1 simple_term typed_const typed_const_plus typed_var_init_expression expr expr_with_func_decl_lambda const_expr elem range_expr const_elem array_const factor relop_expr expr_dq expr_l1 expr_l1_func_decl_lambda expr_l1_for_lambda simple_expr range_term range_factor
|
%type <ex> const_simple_expr term term1 typed_const typed_const_plus typed_var_init_expression expr expr_with_func_decl_lambda const_expr elem range_expr const_elem array_const factor factor_without_unary_op relop_expr expr_dq expr_l1 expr_l1_func_decl_lambda expr_l1_for_lambda simple_expr range_term range_factor
|
||||||
%type <ex> external_directive_ident init_const_expr case_label variable var_reference /*optional_write_expr*/ optional_read_expr simple_expr_or_nothing var_question_point expr_l1_for_question_expr expr_l1_for_new_question_expr
|
%type <ex> external_directive_ident init_const_expr case_label variable var_reference /*optional_write_expr*/ optional_read_expr simple_expr_or_nothing var_question_point expr_l1_for_question_expr expr_l1_for_new_question_expr
|
||||||
%type <ob> for_cycle_type
|
%type <ob> for_cycle_type
|
||||||
%type <ex> format_expr format_const_expr const_expr_or_nothing /* simple_expr_with_deref_or_nothing simple_expr_with_deref expr_l1_for_indexer*/
|
%type <ex> format_expr format_const_expr const_expr_or_nothing /* simple_expr_with_deref_or_nothing simple_expr_with_deref expr_l1_for_indexer*/
|
||||||
|
|
@ -807,7 +807,12 @@ as_is_constexpr
|
||||||
;
|
;
|
||||||
|
|
||||||
power_constexpr
|
power_constexpr
|
||||||
: const_factor tkStarStar const_factor { $$ = new bin_expr($1, $3, $2.type, @$); }
|
: const_factor_without_unary_op tkStarStar const_factor
|
||||||
|
{ $$ = new bin_expr($1, $3, $2.type, @$); }
|
||||||
|
| const_factor_without_unary_op tkStarStar power_constexpr
|
||||||
|
{ $$ = new bin_expr($1,$3,($2).type, @$); }
|
||||||
|
| sign power_constexpr
|
||||||
|
{ $$ = new un_expr($2, $1.type, @$); }
|
||||||
;
|
;
|
||||||
|
|
||||||
const_term
|
const_term
|
||||||
|
|
@ -840,6 +845,13 @@ const_mulop
|
||||||
{ $$ = $1; }
|
{ $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
const_factor_without_unary_op
|
||||||
|
: const_variable
|
||||||
|
{ $$ = $1; }
|
||||||
|
| tkRoundOpen const_expr tkRoundClose
|
||||||
|
{ $$ = $2; }
|
||||||
|
;
|
||||||
|
|
||||||
const_factor
|
const_factor
|
||||||
: const_variable
|
: const_variable
|
||||||
{ $$ = $1; }
|
{ $$ = $1; }
|
||||||
|
|
@ -3858,14 +3870,13 @@ is_type_expr
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
simple_term
|
|
||||||
: factor
|
|
||||||
{ $$ = $1; }
|
|
||||||
;
|
|
||||||
|
|
||||||
power_expr
|
power_expr
|
||||||
: simple_term tkStarStar factor
|
: factor_without_unary_op tkStarStar factor
|
||||||
{ $$ = new bin_expr($1,$3,($2).type, @$); }
|
{ $$ = new bin_expr($1,$3,($2).type, @$); }
|
||||||
|
| factor_without_unary_op tkStarStar power_expr
|
||||||
|
{ $$ = new bin_expr($1,$3,($2).type, @$); }
|
||||||
|
| sign power_expr
|
||||||
|
{ $$ = new un_expr($2, $1.type, @$); }
|
||||||
;
|
;
|
||||||
|
|
||||||
term
|
term
|
||||||
|
|
@ -3924,6 +3935,13 @@ tuple
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
factor_without_unary_op
|
||||||
|
: literal_or_number
|
||||||
|
{ $$ = $1; }
|
||||||
|
| var_reference
|
||||||
|
{ $$ = $1; }
|
||||||
|
;
|
||||||
|
|
||||||
factor
|
factor
|
||||||
: tkNil
|
: tkNil
|
||||||
{
|
{
|
||||||
|
|
@ -3965,8 +3983,7 @@ factor
|
||||||
}
|
}
|
||||||
// ìîæíî ñäåëàòü âû÷èñëåíèå êîíñòàíòû ñ âìîíòèðîâàííûì ìèíóñîì
|
// ìîæíî ñäåëàòü âû÷èñëåíèå êîíñòàíòû ñ âìîíòèðîâàííûì ìèíóñîì
|
||||||
}
|
}
|
||||||
|
$$ = new un_expr($2, $1.type, @$);
|
||||||
$$ = new un_expr($2, $1.type, @$);
|
|
||||||
}
|
}
|
||||||
| tkDeref factor
|
| tkDeref factor
|
||||||
{
|
{
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -283,6 +283,8 @@ script=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
3.7.1.2683
|
3.7.1.2692
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
!define VERSION '3.7.1.2683'
|
!define VERSION '3.7.1.2692'
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ namespace PascalABCCompiler.SyntaxTreeConverters
|
||||||
root.FillParentsInAllChilds();
|
root.FillParentsInAllChilds();
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
var stat = new ABCStatisticsVisitor();
|
// var stat = new ABCStatisticsVisitor();
|
||||||
stat.ProcessNode(root);
|
// stat.ProcessNode(root);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// new range - до всего! До выноса выражения с лямбдой из foreach. 11.07 добавил поиск yields и присваивание pd.HasYield
|
// new range - до всего! До выноса выражения с лямбдой из foreach. 11.07 добавил поиск yields и присваивание pd.HasYield
|
||||||
|
|
|
||||||
|
|
@ -197,6 +197,113 @@ namespace SyntaxVisitors
|
||||||
base.visit(pc);
|
base.visit(pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int CalcHealth(out int NegativePercent, out int PositivePercent)
|
||||||
|
{
|
||||||
|
var stat = this;
|
||||||
|
var Percent = 100;
|
||||||
|
NegativePercent = 0;
|
||||||
|
PositivePercent = 0;
|
||||||
|
|
||||||
|
var diffBlockVarDefs = stat.OutBlockVarDefs; // - stat.InBlockVarDefs;
|
||||||
|
if (diffBlockVarDefs > 0)
|
||||||
|
{
|
||||||
|
NegativePercent += 10; // за первую
|
||||||
|
NegativePercent += (diffBlockVarDefs - 1) * 2; // за оставшиеся
|
||||||
|
if (NegativePercent > 25)
|
||||||
|
NegativePercent = 25;
|
||||||
|
}
|
||||||
|
// For i
|
||||||
|
if (stat.ForsWithoutVar > 0)
|
||||||
|
{
|
||||||
|
NegativePercent += Math.Min(15 + (stat.ForsWithoutVar - 1) * 3, 25);
|
||||||
|
}
|
||||||
|
if (stat.ReadProc > 0)
|
||||||
|
{
|
||||||
|
NegativePercent += Math.Min(15 + (stat.ReadProc - 1) * 2, 20);
|
||||||
|
}
|
||||||
|
if (stat.ProgramKeyword)
|
||||||
|
{
|
||||||
|
NegativePercent += 10;
|
||||||
|
}
|
||||||
|
if (stat.StaticArrays > 0)
|
||||||
|
{
|
||||||
|
NegativePercent += Math.Min(10 + (stat.StaticArrays - 1) * 2, 15);
|
||||||
|
}
|
||||||
|
if (stat.WriteProcWithSpace > 0)
|
||||||
|
{
|
||||||
|
NegativePercent += Math.Min(2 + (stat.WriteProcWithSpace - 1) * 1, 5);
|
||||||
|
}
|
||||||
|
if (stat.OldStrings > 0)
|
||||||
|
{
|
||||||
|
NegativePercent += stat.OldStrings;
|
||||||
|
}
|
||||||
|
if (NegativePercent < 0)
|
||||||
|
NegativePercent = 0;
|
||||||
|
|
||||||
|
Percent -= NegativePercent;
|
||||||
|
|
||||||
|
// Проценты за положительное
|
||||||
|
if (stat.InBlockVarDefs > 0)
|
||||||
|
{
|
||||||
|
PositivePercent += 10; // за первую
|
||||||
|
PositivePercent += (stat.InBlockVarDefs - 1) * 2; // за оставшиеся
|
||||||
|
// этот алгоритм уравновешивает описания внутри и вне. За одинаковое количество дается 0 баллов
|
||||||
|
}
|
||||||
|
if (stat.ForsWithVar != 0)
|
||||||
|
{
|
||||||
|
PositivePercent += Math.Min(stat.ForsWithVar, 4) * 3;
|
||||||
|
}
|
||||||
|
if (stat.InitVarInDef > 0)
|
||||||
|
{
|
||||||
|
PositivePercent += Math.Min(stat.InitVarInDef, 4) * 4;
|
||||||
|
}
|
||||||
|
if (stat.ReadFuncCount > 0)
|
||||||
|
{
|
||||||
|
PositivePercent += Math.Min(stat.ReadFuncCount, 4) * 3;
|
||||||
|
}
|
||||||
|
if (stat.ExtAssignCount > 0)
|
||||||
|
{
|
||||||
|
PositivePercent += Math.Min(stat.ExtAssignCount, 4) * 3;
|
||||||
|
}
|
||||||
|
if (stat.PrintCount > 0)
|
||||||
|
{
|
||||||
|
PositivePercent += Math.Min(stat.PrintCount, 4) * 4;
|
||||||
|
}
|
||||||
|
if (stat.TuplesCount > 0)
|
||||||
|
{
|
||||||
|
PositivePercent += Math.Min(stat.PrintCount, 4) * 5;
|
||||||
|
}
|
||||||
|
if (stat.DynamicArrays > 0)
|
||||||
|
{
|
||||||
|
PositivePercent += Math.Min(stat.PrintCount, 4) * 5;
|
||||||
|
}
|
||||||
|
if (stat.UnpackingAssign > 0)
|
||||||
|
{
|
||||||
|
PositivePercent += Math.Min(stat.UnpackingAssign, 4) * 5;
|
||||||
|
}
|
||||||
|
if (stat.LoopsCount > 0)
|
||||||
|
{
|
||||||
|
PositivePercent += Math.Min(stat.LoopsCount, 4) * 4;
|
||||||
|
}
|
||||||
|
if (stat.ForeachCount > 0)
|
||||||
|
{
|
||||||
|
PositivePercent += Math.Min(stat.ForeachCount, 4) * 4;
|
||||||
|
}
|
||||||
|
if (stat.LambdasCount > 0)
|
||||||
|
{
|
||||||
|
PositivePercent += Math.Min(stat.LambdasCount, 4) * 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
Percent += PositivePercent;
|
||||||
|
if (Percent > 200)
|
||||||
|
Percent = 200;
|
||||||
|
|
||||||
|
if (Percent < 0)
|
||||||
|
Percent = 0;
|
||||||
|
|
||||||
|
return Percent;
|
||||||
|
}
|
||||||
|
|
||||||
/*public override void visit(dot_node dn)
|
/*public override void visit(dot_node dn)
|
||||||
{
|
{
|
||||||
ProcessNode(dn.left);
|
ProcessNode(dn.left);
|
||||||
|
|
|
||||||
9
TestSuite/pow.pas
Normal file
9
TestSuite/pow.pas
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
const a = -2**4;
|
||||||
|
const b = 2**3**2;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Assert(-2**4 = -16);
|
||||||
|
Assert(a = -16);
|
||||||
|
Assert(2**3**2=512);
|
||||||
|
Assert(b=512);
|
||||||
|
end.
|
||||||
|
|
@ -7,7 +7,7 @@ begin
|
||||||
assert(round(2 ** 3 * 3) = 24);
|
assert(round(2 ** 3 * 3) = 24);
|
||||||
assert(round(2.0 ** 3) = 8);
|
assert(round(2.0 ** 3) = 8);
|
||||||
assert(round(2 ** 3.0) = 8);
|
assert(round(2 ** 3.0) = 8);
|
||||||
assert(round(-2 ** 2) = 4);
|
assert(round(-2 ** 2) = -4);
|
||||||
assert(round(-(2 ** 2)) = -4);
|
assert(round(-(2 ** 2)) = -4);
|
||||||
var b: byte := 2;
|
var b: byte := 2;
|
||||||
assert(round(b ** 2) = 4);
|
assert(round(b ** 2) = 4);
|
||||||
|
|
|
||||||
4
VisualPascalABCNET/Form1.Designer.cs
generated
4
VisualPascalABCNET/Form1.Designer.cs
generated
|
|
@ -1760,7 +1760,7 @@ namespace VisualPascalABC
|
||||||
// toolStripStatusLabel5
|
// toolStripStatusLabel5
|
||||||
//
|
//
|
||||||
this.toolStripStatusLabel5.Name = "toolStripStatusLabel5";
|
this.toolStripStatusLabel5.Name = "toolStripStatusLabel5";
|
||||||
this.toolStripStatusLabel5.Size = new System.Drawing.Size(912, 19);
|
this.toolStripStatusLabel5.Size = new System.Drawing.Size(908, 19);
|
||||||
this.toolStripStatusLabel5.Spring = true;
|
this.toolStripStatusLabel5.Spring = true;
|
||||||
this.toolStripStatusLabel5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
this.toolStripStatusLabel5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
//
|
//
|
||||||
|
|
@ -1794,6 +1794,7 @@ namespace VisualPascalABC
|
||||||
//
|
//
|
||||||
// HealthLabel
|
// HealthLabel
|
||||||
//
|
//
|
||||||
|
this.HealthLabel.AutoToolTip = true;
|
||||||
this.HealthLabel.BackColor = System.Drawing.SystemColors.Control;
|
this.HealthLabel.BackColor = System.Drawing.SystemColors.Control;
|
||||||
this.HealthLabel.IsLink = true;
|
this.HealthLabel.IsLink = true;
|
||||||
this.HealthLabel.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
|
this.HealthLabel.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
|
||||||
|
|
@ -1801,6 +1802,7 @@ namespace VisualPascalABC
|
||||||
this.HealthLabel.Name = "HealthLabel";
|
this.HealthLabel.Name = "HealthLabel";
|
||||||
this.HealthLabel.Size = new System.Drawing.Size(19, 19);
|
this.HealthLabel.Size = new System.Drawing.Size(19, 19);
|
||||||
this.HealthLabel.Text = " ";
|
this.HealthLabel.Text = " ";
|
||||||
|
this.HealthLabel.ToolTipText = "Здоровье PascalABC.NET программы";
|
||||||
this.HealthLabel.Click += new System.EventHandler(this.HealthLabel_Click);
|
this.HealthLabel.Click += new System.EventHandler(this.HealthLabel_Click);
|
||||||
//
|
//
|
||||||
// openFileDialog1
|
// openFileDialog1
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ namespace VisualPascalABC
|
||||||
// PascalABCCompiler.StringResourcesLanguage.CurrentLanguageName = PascalABCCompiler.StringResourcesLanguage.AccessibleLanguages[0];
|
// PascalABCCompiler.StringResourcesLanguage.CurrentLanguageName = PascalABCCompiler.StringResourcesLanguage.AccessibleLanguages[0];
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
VisualPABCSingleton.MainForm = this;
|
VisualPABCSingleton.MainForm = this;
|
||||||
WorkbenchStorage.MainProgramThread = System.Threading.Thread.CurrentThread;
|
WorkbenchStorage.MainProgramThread = System.Threading.Thread.CurrentThread;
|
||||||
//images init
|
//images init
|
||||||
|
|
@ -840,8 +840,32 @@ namespace VisualPascalABC
|
||||||
private void StartMenuItem_Click(object sender, EventArgs e)
|
private void StartMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
WorkbenchServiceFactory.RunService.Run(true);
|
WorkbenchServiceFactory.RunService.Run(true);
|
||||||
|
/*if (VisualEnvironmentCompiler.StandartCompiler != null &&
|
||||||
|
VisualEnvironmentCompiler.StandartCompiler.LinesCompiled > 1000)
|
||||||
|
return;
|
||||||
|
var root = VisualEnvironmentCompiler?.StandartCompiler?.CurrentCompilationUnit?.SyntaxTree;
|
||||||
|
|
||||||
|
if (root == null)
|
||||||
|
return;
|
||||||
|
if (VisualEnvironmentCompiler.StandartCompiler.CurrentCompilationUnit.SemanticTree == null)
|
||||||
|
return;
|
||||||
|
var stat = new SyntaxVisitors.ABCStatisticsVisitor();
|
||||||
|
stat.ProcessNode(root);
|
||||||
|
var Percent = stat.CalcHealth(out int n, out int p);
|
||||||
|
|
||||||
|
if (Percent >= 100)
|
||||||
|
{
|
||||||
|
HealthLabel.Text = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
HealthLabel.Text = $"{Percent}%";
|
||||||
|
|
||||||
|
var c = SystemColors.Control;
|
||||||
|
var PM100 = 100 - Percent;
|
||||||
|
HealthLabel.BackColor = Color.FromArgb(c.R - PM100 - 20, c.G - PM100 - 20, c.B - PM100 - 20);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Form1_KeyUp(object sender, KeyEventArgs e)
|
private void Form1_KeyUp(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.KeyData == Keys.F1)
|
if (e.KeyData == Keys.F1)
|
||||||
|
|
@ -978,6 +1002,7 @@ namespace VisualPascalABC
|
||||||
private void miRunNoDebug_Click(object sender, EventArgs e)
|
private void miRunNoDebug_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
WorkbenchServiceFactory.RunService.Run(false);
|
WorkbenchServiceFactory.RunService.Run(false);
|
||||||
|
var root = VisualEnvironmentCompiler.StandartCompiler.CurrentCompilationUnit.SyntaxTree;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<CodeFileDocumentControl, string> lastInputTexts = new Dictionary<CodeFileDocumentControl, string>();
|
Dictionary<CodeFileDocumentControl, string> lastInputTexts = new Dictionary<CodeFileDocumentControl, string>();
|
||||||
|
|
@ -1596,6 +1621,7 @@ namespace VisualPascalABC
|
||||||
return n + " раза";
|
return n + " раза";
|
||||||
else return n + " раз";
|
else return n + " раз";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toolStripButton1_Click(object sender, EventArgs e)
|
private void toolStripButton1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (ABCHealthForm == null)
|
if (ABCHealthForm == null)
|
||||||
|
|
@ -1669,8 +1695,6 @@ namespace VisualPascalABC
|
||||||
// 6. Write(a,' ',b) - за каждую - -1% пока не достгнет -5%
|
// 6. Write(a,' ',b) - за каждую - -1% пока не достгнет -5%
|
||||||
// 7. string[10] - за каждую - -1% . Если минусуется > 100%, то здоровье делать 0%
|
// 7. string[10] - за каждую - -1% . Если минусуется > 100%, то здоровье делать 0%
|
||||||
|
|
||||||
var Percent = 100;
|
|
||||||
var NegativePercent = 0;
|
|
||||||
|
|
||||||
var ShowNegativeInfo = false;
|
var ShowNegativeInfo = false;
|
||||||
if (stat.OutBlockVarDefs > 0 && stat.OutBlockVarDefs > stat.InBlockVarDefs)
|
if (stat.OutBlockVarDefs > 0 && stat.OutBlockVarDefs > stat.InBlockVarDefs)
|
||||||
|
|
@ -1788,103 +1812,9 @@ namespace VisualPascalABC
|
||||||
y += h;
|
y += h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var Percent = stat.CalcHealth(out int NegativePercent, out int PositivePercent);
|
||||||
// Процент здоровья
|
// Процент здоровья
|
||||||
// VarDefs
|
// VarDefs
|
||||||
var diffBlockVarDefs = stat.OutBlockVarDefs; // - stat.InBlockVarDefs;
|
|
||||||
if (diffBlockVarDefs > 0)
|
|
||||||
{
|
|
||||||
NegativePercent += 10; // за первую
|
|
||||||
NegativePercent += (diffBlockVarDefs - 1) * 2; // за оставшиеся
|
|
||||||
if (NegativePercent > 25)
|
|
||||||
NegativePercent = 25;
|
|
||||||
}
|
|
||||||
// For i
|
|
||||||
if (stat.ForsWithoutVar > 0)
|
|
||||||
{
|
|
||||||
NegativePercent += Math.Min(15 + (stat.ForsWithoutVar - 1) * 3, 25);
|
|
||||||
}
|
|
||||||
if (stat.ReadProc > 0)
|
|
||||||
{
|
|
||||||
NegativePercent += Math.Min(15 + (stat.ReadProc - 1) * 2, 20);
|
|
||||||
}
|
|
||||||
if (stat.ProgramKeyword)
|
|
||||||
{
|
|
||||||
NegativePercent += 10;
|
|
||||||
}
|
|
||||||
if (stat.StaticArrays > 0)
|
|
||||||
{
|
|
||||||
NegativePercent += Math.Min(10 + (stat.StaticArrays - 1) * 2, 15);
|
|
||||||
}
|
|
||||||
if (stat.WriteProcWithSpace > 0)
|
|
||||||
{
|
|
||||||
NegativePercent += Math.Min(2 + (stat.WriteProcWithSpace - 1) * 1, 5);
|
|
||||||
}
|
|
||||||
if (stat.OldStrings > 0)
|
|
||||||
{
|
|
||||||
NegativePercent += stat.OldStrings;
|
|
||||||
}
|
|
||||||
if (NegativePercent < 0)
|
|
||||||
NegativePercent = 0;
|
|
||||||
|
|
||||||
Percent -= NegativePercent;
|
|
||||||
|
|
||||||
var PositivePercent = 0;
|
|
||||||
|
|
||||||
// Проценты за положительное
|
|
||||||
if (stat.InBlockVarDefs > 0)
|
|
||||||
{
|
|
||||||
PositivePercent += 10; // за первую
|
|
||||||
PositivePercent += (stat.InBlockVarDefs - 1) * 2; // за оставшиеся
|
|
||||||
// этот алгоритм уравновешивает описания внутри и вне. За одинаковое количество дается 0 баллов
|
|
||||||
}
|
|
||||||
if (stat.ForsWithVar != 0)
|
|
||||||
{
|
|
||||||
PositivePercent += Math.Min(stat.ForsWithVar, 4) * 3;
|
|
||||||
}
|
|
||||||
if (stat.InitVarInDef > 0)
|
|
||||||
{
|
|
||||||
PositivePercent += Math.Min(stat.InitVarInDef, 4) * 4;
|
|
||||||
}
|
|
||||||
if (stat.ReadFuncCount > 0)
|
|
||||||
{
|
|
||||||
PositivePercent += Math.Min(stat.ReadFuncCount, 4) * 3;
|
|
||||||
}
|
|
||||||
if (stat.ExtAssignCount > 0)
|
|
||||||
{
|
|
||||||
PositivePercent += Math.Min(stat.ExtAssignCount, 4) * 3;
|
|
||||||
}
|
|
||||||
if (stat.PrintCount > 0)
|
|
||||||
{
|
|
||||||
PositivePercent += Math.Min(stat.PrintCount, 4) * 4;
|
|
||||||
}
|
|
||||||
if (stat.TuplesCount > 0)
|
|
||||||
{
|
|
||||||
PositivePercent += Math.Min(stat.PrintCount, 4) * 5;
|
|
||||||
}
|
|
||||||
if (stat.DynamicArrays > 0)
|
|
||||||
{
|
|
||||||
PositivePercent += Math.Min(stat.PrintCount, 4) * 5;
|
|
||||||
}
|
|
||||||
if (stat.UnpackingAssign > 0)
|
|
||||||
{
|
|
||||||
PositivePercent += Math.Min(stat.UnpackingAssign, 4) * 5;
|
|
||||||
}
|
|
||||||
if (stat.LoopsCount > 0)
|
|
||||||
{
|
|
||||||
PositivePercent += Math.Min(stat.LoopsCount, 4) * 4;
|
|
||||||
}
|
|
||||||
if (stat.ForeachCount > 0)
|
|
||||||
{
|
|
||||||
PositivePercent += Math.Min(stat.ForeachCount, 4) * 4;
|
|
||||||
}
|
|
||||||
if (stat.LambdasCount > 0)
|
|
||||||
{
|
|
||||||
PositivePercent += Math.Min(stat.LambdasCount, 4) * 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
Percent += PositivePercent;
|
|
||||||
if (Percent > 200)
|
|
||||||
Percent = 200;
|
|
||||||
|
|
||||||
if (!ShowNegativeInfo)
|
if (!ShowNegativeInfo)
|
||||||
{
|
{
|
||||||
|
|
@ -1905,7 +1835,7 @@ namespace VisualPascalABC
|
||||||
else if (Percent < 75)
|
else if (Percent < 75)
|
||||||
pp.BackColor = Color.FromArgb(128, 128, 128);
|
pp.BackColor = Color.FromArgb(128, 128, 128);
|
||||||
else if (Percent < 100)
|
else if (Percent < 100)
|
||||||
pp.BackColor = Color.FromArgb(64+16, 128, 64 + 16);
|
pp.BackColor = Color.FromArgb(64 + 16 + 16, 128, 64 + 16 + 16);
|
||||||
else pp.BackColor = Color.FromArgb(0, 128, 0);
|
else pp.BackColor = Color.FromArgb(0, 128, 0);
|
||||||
|
|
||||||
pp.Paint += (o, ea) =>
|
pp.Paint += (o, ea) =>
|
||||||
|
|
@ -1947,9 +1877,16 @@ namespace VisualPascalABC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HealthLabelClear()
|
||||||
|
{
|
||||||
|
HealthLabel.Text = "";
|
||||||
|
HealthLabel.BackColor = System.Drawing.SystemColors.Control;
|
||||||
|
}
|
||||||
|
|
||||||
private void HealthLabel_Click(object sender, EventArgs e)
|
private void HealthLabel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Process.Start("https://pascalabcnet.github.io/program_health.html");
|
toolStripButton1_Click(this, null);
|
||||||
|
//System.Diagnostics.Process.Start("https://pascalabcnet.github.io/program_health.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tsHelp_Click(object sender, EventArgs e)
|
private void tsHelp_Click(object sender, EventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -307,21 +307,6 @@
|
||||||
d07lxcgmYqk6sX1iENPfdv0Cx/Wod5mP/rvMkCs5SPPOp5qJQ6WOnVOD2IzXiA6B6TRp9PMK470dqLqN
|
d07lxcgmYqk6sX1iENPfdv0Cx/Wod5mP/rvMkCs5SPPOp5qJQ6WOnVOD2IzXiA6B6TRp9PMK470dqLqN
|
||||||
JO8cT/Oxkwa2jmvEz4Mq4ROIn/YrqSJ2nMZWTEFkR8FqVMZSJImFUAKzq534BOJyW/ju7nIk6Q+B49+g
|
JO8cT/Oxkwa2jmvEz4Mq4ROIn/YrqSJ2nMZWTEFkR8FqVMZSJImFUAKzq534BOJyW/ju7nIk6Q+B49+g
|
||||||
+BQZbgAAAABJRU5ErkJggg==
|
+BQZbgAAAABJRU5ErkJggg==
|
||||||
</value>
|
|
||||||
</data>
|
|
||||||
<data name="tstaSelect.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>
|
|
||||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
|
||||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
|
||||||
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
|
|
||||||
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
|
|
||||||
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
|
|
||||||
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
|
|
||||||
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
|
|
||||||
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
|
|
||||||
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
|
|
||||||
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
|
|
||||||
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
|
|
||||||
</value>
|
</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="tsatConsoleApplication.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="tsatConsoleApplication.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
|
@ -354,6 +339,21 @@
|
||||||
saeS2rb7UOgXaTuVTHazh+J2K72OKDpTHEBh1SiuGV8sLLYtFmb8JHwex090zigDU8LZCb1Pl+WA/KsG
|
saeS2rb7UOgXaTuVTHazh+J2K72OKDpTHEBh1SiuGV8sLLYtFmb8JHwex090zigDU8LZCb1Pl+WA/KsG
|
||||||
Jj3zsvDoBzC8JxbusgseC5B9pmAzIK+sn7b772judaPudtCktaO5bRO+rJXG1hc0aJ5T12iipnaIGtUw
|
Jj3zsvDoBzC8JxbusgseC5B9pmAzIK+sn7b772judaPudtCktaO5bRO+rJXG1hc0aJ5T12iipnaIGtUw
|
||||||
5y4qNgNEqeo7yM0rl+jiFeNZnIk7fyOCEhJ+AymIZtFIMC8OAAAAAElFTkSuQmCC
|
5y4qNgNEqeo7yM0rl+jiFeNZnIk7fyOCEhJ+AymIZtFIMC8OAAAAAElFTkSuQmCC
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<data name="tstaSelect.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||||
|
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||||
|
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
|
||||||
|
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
|
||||||
|
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
|
||||||
|
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
|
||||||
|
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
|
||||||
|
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
|
||||||
|
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
|
||||||
|
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
|
||||||
|
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
|
||||||
</value>
|
</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="toolStripButton16.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="toolStripButton16.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
|
@ -681,7 +681,7 @@
|
||||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABK
|
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABK
|
||||||
FQAAAk1TRnQBSQFMAgEBEAEAAbQBAQG0AQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
FQAAAk1TRnQBSQFMAgEBEAEAAcQBAQHEAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||||
AwABQAMAAVADAAEBAQABCAYAARQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
AwABQAMAAVADAAEBAQABCAYAARQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||||
|
|
|
||||||
|
|
@ -388,6 +388,8 @@ namespace VisualPascalABC
|
||||||
|
|
||||||
public void ChangedSelectedTab()
|
public void ChangedSelectedTab()
|
||||||
{
|
{
|
||||||
|
if (HealthLabel.Text != "")
|
||||||
|
HealthLabel.Text = "";
|
||||||
if (BrowserTabSelected)
|
if (BrowserTabSelected)
|
||||||
{
|
{
|
||||||
BottomTabsVisible = true;
|
BottomTabsVisible = true;
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ type
|
||||||
SubStringConstraint = NUnit.Framework.Constraints.SubStringConstraint;
|
SubStringConstraint = NUnit.Framework.Constraints.SubStringConstraint;
|
||||||
TrueConstraint = NUnit.Framework.Constraints.TrueConstraint;
|
TrueConstraint = NUnit.Framework.Constraints.TrueConstraint;
|
||||||
|
|
||||||
|
AssertionException = NUnit.Framework.AssertionException;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue