Merge branch 'master' into features/patterns
# Conflicts: # Parsers/PascalABCParserNewSaushkin/ABCPascal.cs # Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs # Parsers/PascalABCParserNewSaushkin/Keywords.cs # SyntaxTree/tree/AbstractVisitor.cs # SyntaxTreeConverters/StandardSyntaxConverter.cs # TestSuite/CompilationSamples/PABCSystem.pas # TestSuite/intellisense_tests/PABCSystem.pas # bin/Lib/PABCSystem.pas
This commit is contained in:
commit
597ef862bc
36
.gitignore
vendored
Normal file
36
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
.vs
|
||||
|
||||
*/**/bin
|
||||
bin/Lib/*.pcu
|
||||
bin/Lib/*.xml
|
||||
bin/Lib/*.dll
|
||||
bin/*.dll
|
||||
bin/*.pdb
|
||||
bin/*.config
|
||||
bin/*.xml
|
||||
|
||||
TestSuite/CompilationSamples/*.xml
|
||||
TestSuite/exe
|
||||
TestSuite/formatter_tests/output
|
||||
|
||||
ReleaseGenerators/*.pdb
|
||||
ReleaseGenerators/PABCRtl/*.dll
|
||||
ReleaseGenerators/PABCRtl/*.pcu
|
||||
ReleaseGenerators/PABCRtl/*.pdb
|
||||
|
||||
**/obj
|
||||
|
||||
ReleaseGenerators/RebuildStandartModules.exe
|
||||
TestSuite/CompilationSamples/ClientServer.pas
|
||||
TestSuite/CompilationSamples/PABCExtensions.pas
|
||||
TestSuite/CompilationSamples/PT4MakerNetX.pas
|
||||
TestSuite/CompilationSamples/Speech.pas
|
||||
TestSuite/CompilationSamples/Робот.pas
|
||||
TestSuite/CompilationSamples/Чертежник.pas
|
||||
bin/PascalABCNET.exe
|
||||
bin/System.Data.dll.txt
|
||||
bin/System.Xml.dll.txt
|
||||
bin/System.dll.txt
|
||||
bin/mscorlib.txt
|
||||
bin/pabcnetc.exe
|
||||
bin/pabcnetcclear.exe
|
||||
|
|
@ -1680,25 +1680,30 @@ namespace CodeFormatters
|
|||
}
|
||||
|
||||
public override void visit(class_members _class_members)
|
||||
{
|
||||
{
|
||||
if (_class_members.access_mod != null && _class_members.access_mod.source_context != null)
|
||||
{
|
||||
bool already_off = true;
|
||||
if (_class_members.members.Count > 0 && _class_members.members[0].source_context != null && _class_members.access_mod.source_context.end_position.line_num == _class_members.members[0].source_context.begin_position.line_num)
|
||||
declaration first_decl = null;
|
||||
if (_class_members.members.Count > 0)
|
||||
first_decl = _class_members.members[0];
|
||||
if (first_decl is short_func_definition)
|
||||
first_decl = (first_decl as short_func_definition).procdef;
|
||||
if (first_decl != null && first_decl.source_context != null && _class_members.access_mod.source_context.end_position.line_num == first_decl.source_context.begin_position.line_num)
|
||||
IncOffset();
|
||||
else
|
||||
already_off = false;
|
||||
visit_node(_class_members.access_mod);
|
||||
if (_class_members.members.Count > 0)
|
||||
sb.Append(" ");
|
||||
if (first_decl != null && !(_class_members.members[0] is short_func_definition))
|
||||
sb.Append(" ");
|
||||
if (!already_off)
|
||||
IncOffset();
|
||||
}
|
||||
else
|
||||
IncOffset();
|
||||
IncOffset();
|
||||
foreach (declaration decl in _class_members.members)
|
||||
{
|
||||
visit_node(decl);
|
||||
{
|
||||
visit_node(decl);
|
||||
}
|
||||
DecOffset();
|
||||
}
|
||||
|
|
@ -1736,7 +1741,7 @@ namespace CodeFormatters
|
|||
}
|
||||
if (_class_definition.body != null)
|
||||
{
|
||||
if (!(/*(_class_definition.keyword == class_keyword.Record || _class_definition.keyword == class_keyword.TemplateRecord) &&*/ (_class_definition.body.class_def_blocks.Count == 0 || _class_definition.body.class_def_blocks[0].members != null && _class_definition.body.class_def_blocks[0].members.Count == 0) && _class_definition.class_parents == null))
|
||||
if (!((_class_definition.body.class_def_blocks.Count == 0 || _class_definition.body.class_def_blocks[0].members != null && _class_definition.body.class_def_blocks[0].members.Count == 0) && _class_definition.class_parents == null))
|
||||
{
|
||||
class_pred = false;
|
||||
visit_node(_class_definition.body);
|
||||
|
|
@ -2741,6 +2746,7 @@ namespace CodeFormatters
|
|||
multiline_stack_push(_short_func_definition);
|
||||
|
||||
add_space_after = true;
|
||||
add_space_before = true;
|
||||
add_newline_after = false;
|
||||
visit_node(_short_func_definition.procdef.proc_header);
|
||||
bool tmp_in_procedure = in_procedure;
|
||||
|
|
|
|||
|
|
@ -425,8 +425,10 @@ namespace CodeCompletion
|
|||
}
|
||||
SymInfo[] elems = null;
|
||||
if (si == null) return null;
|
||||
if (pattern == null || pattern == "") elems = si.GetNamesInAllTopScopes(all_names, new ExpressionVisitor(si, visitor), false);
|
||||
else elems = si.GetNamesInAllTopScopes(all_names, new ExpressionVisitor(si, visitor), false);
|
||||
if (pattern == null || pattern == "")
|
||||
elems = si.GetNamesInAllTopScopes(all_names, new ExpressionVisitor(si, visitor), false);
|
||||
else
|
||||
elems = si.GetNamesInAllTopScopes(all_names, new ExpressionVisitor(si, visitor), false);
|
||||
List<SymInfo> result_names = new List<SymInfo>();
|
||||
if (elems == null) return null;
|
||||
for (int i = 0; i < elems.Length; i++)
|
||||
|
|
@ -522,7 +524,7 @@ namespace CodeCompletion
|
|||
if (elems == null) return null;
|
||||
for (int i = 0; i < elems.Length; i++)
|
||||
{
|
||||
if (!elems[i].name.StartsWith("$") && (elems[i].kind == SymbolKind.Class || elems[i].kind == SymbolKind.Namespace) && elems[i].kind != SymbolKind.Interface)
|
||||
if (!elems[i].name.StartsWith("$") && (elems[i].kind == SymbolKind.Class || elems[i].kind == SymbolKind.Struct || elems[i].kind == SymbolKind.Namespace) && elems[i].kind != SymbolKind.Interface)
|
||||
{
|
||||
if (expr != null && si != null && si is ElementScope &&
|
||||
string.Compare(elems[i].name, (si as ElementScope).sc.si.name, true) == 0)
|
||||
|
|
@ -930,7 +932,16 @@ namespace CodeCompletion
|
|||
else if (ss is TypeScope)
|
||||
ss.AddDocumentation(UnitDocCache.GetDocumentation(ss as TypeScope));
|
||||
else if (ss is ProcScope)
|
||||
ss.AddDocumentation(UnitDocCache.GetDocumentation(ss as ProcScope));
|
||||
{
|
||||
ProcScope ps = ss as ProcScope;
|
||||
if (ps.original_function != null)
|
||||
ps = ps.original_function;
|
||||
if (ps is CompiledMethodScope)
|
||||
ss.AddDocumentation(AssemblyDocCache.GetDocumentation((ps as CompiledMethodScope).mi));
|
||||
else
|
||||
ss.AddDocumentation(UnitDocCache.GetDocumentation(ps));
|
||||
}
|
||||
|
||||
else if (ss is InterfaceUnitScope)
|
||||
ss.AddDocumentation(UnitDocCache.GetDocumentation(ss as InterfaceUnitScope));
|
||||
else if (ss is ElementScope && string.IsNullOrEmpty(ss.si.description) && (ss as ElementScope).sc is TypeScope)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -444,206 +444,206 @@ namespace CodeCompletion
|
|||
|
||||
eval_stack.Push(res);
|
||||
}
|
||||
|
||||
public void EvalMult()
|
||||
{
|
||||
RetValue right = eval_stack.Pop();
|
||||
RetValue left = eval_stack.Pop();
|
||||
RetValue res = new RetValue();
|
||||
if (left.prim_val != null && right.prim_val != null)
|
||||
{
|
||||
TypeCode lcode = Type.GetTypeCode(left.prim_val.GetType());
|
||||
TypeCode rcode = Type.GetTypeCode(right.prim_val.GetType());
|
||||
switch (lcode)
|
||||
{
|
||||
case TypeCode.Int32:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (int)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (int)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (int)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (int)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((int)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (int)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (int)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (int)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (int)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.UInt64)((int)left.prim_val) * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (int)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Double:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (double)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (double)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (double)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (double)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((double)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (double)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (double)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (double)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (double)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (double)left.prim_val * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (double)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Byte:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (byte)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (byte)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (byte)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (byte)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((byte)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (byte)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (byte)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (byte)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (byte)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (byte)left.prim_val * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (byte)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Int16:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (System.Int16)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (System.Int16)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (System.Int16)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (System.Int16)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.Int16)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (System.Int16)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (System.Int16)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (System.Int16)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (System.Int16)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.UInt64)((System.Int16)left.prim_val) * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (System.Int16)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Int64:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (System.Int64)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (System.Int64)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (System.Int64)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (System.Int64)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.Int64)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (System.Int64)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (System.Int64)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (System.Int64)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (System.Int64)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.Int64)left.prim_val * (System.Int64)((System.UInt64)right.prim_val); break;
|
||||
case TypeCode.Single : res.prim_val = (System.Int64)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TypeCode.SByte:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (System.SByte)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (System.SByte)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (System.SByte)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (System.SByte)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.SByte)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (System.SByte)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (System.SByte)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (System.SByte)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (System.SByte)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.UInt64)((System.SByte)left.prim_val) * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (System.SByte)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.UInt16:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (System.UInt16)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (System.UInt16)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (System.UInt16)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (System.UInt16)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.UInt16)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (System.UInt16)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (System.UInt16)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (System.UInt16)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (System.UInt16)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.UInt16)left.prim_val * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (System.UInt16)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.UInt32:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (System.UInt32)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (System.UInt32)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (System.UInt32)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (System.UInt32)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.UInt32)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (System.UInt32)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (System.UInt32)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (System.UInt32)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (System.UInt32)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.UInt32)left.prim_val * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (System.UInt32)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.UInt64:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (System.UInt64)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (System.UInt64)left.prim_val * (System.UInt64)((int)right.prim_val); break;
|
||||
case TypeCode.Double : res.prim_val = (System.UInt64)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (long)((System.UInt64)left.prim_val) * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.UInt64)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (System.UInt64)left.prim_val * (System.UInt64)((System.Int16)right.prim_val); break;
|
||||
case TypeCode.SByte : res.prim_val = (System.UInt64)left.prim_val * (System.UInt64)((sbyte)right.prim_val); break;
|
||||
case TypeCode.UInt16 : res.prim_val = (System.UInt64)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (System.UInt64)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.UInt64)left.prim_val * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (System.UInt64)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Single:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (System.Single)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (System.Single)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (System.Single)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (System.Single)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.Single)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (System.Single)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (System.Single)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (System.Single)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (System.Single)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.Single)left.prim_val * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (System.Single)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
eval_stack.Push(res);
|
||||
}
|
||||
|
||||
public void EvalMult()
|
||||
{
|
||||
RetValue right = eval_stack.Pop();
|
||||
RetValue left = eval_stack.Pop();
|
||||
RetValue res = new RetValue();
|
||||
if (left.prim_val != null && right.prim_val != null)
|
||||
{
|
||||
TypeCode lcode = Type.GetTypeCode(left.prim_val.GetType());
|
||||
TypeCode rcode = Type.GetTypeCode(right.prim_val.GetType());
|
||||
switch (lcode)
|
||||
{
|
||||
case TypeCode.Int32:
|
||||
{
|
||||
switch (rcode)
|
||||
{
|
||||
case TypeCode.Byte: res.prim_val = (int)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32: res.prim_val = (int)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double: res.prim_val = (int)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64: res.prim_val = (int)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((int)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16: res.prim_val = (int)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte: res.prim_val = (int)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16: res.prim_val = (int)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32: res.prim_val = (int)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64: res.prim_val = (System.UInt64)((int)left.prim_val) * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single: res.prim_val = (int)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Double:
|
||||
{
|
||||
switch (rcode)
|
||||
{
|
||||
case TypeCode.Byte: res.prim_val = (double)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32: res.prim_val = (double)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double: res.prim_val = (double)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64: res.prim_val = (double)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((double)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16: res.prim_val = (double)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte: res.prim_val = (double)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16: res.prim_val = (double)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32: res.prim_val = (double)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64: res.prim_val = (double)left.prim_val * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single: res.prim_val = (double)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Byte:
|
||||
{
|
||||
switch (rcode)
|
||||
{
|
||||
case TypeCode.Byte: res.prim_val = (byte)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32: res.prim_val = (byte)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double: res.prim_val = (byte)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64: res.prim_val = (byte)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((byte)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16: res.prim_val = (byte)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte: res.prim_val = (byte)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16: res.prim_val = (byte)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32: res.prim_val = (byte)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64: res.prim_val = (byte)left.prim_val * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single: res.prim_val = (byte)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Int16:
|
||||
{
|
||||
switch (rcode)
|
||||
{
|
||||
case TypeCode.Byte: res.prim_val = (System.Int16)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32: res.prim_val = (System.Int16)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double: res.prim_val = (System.Int16)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64: res.prim_val = (System.Int16)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.Int16)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16: res.prim_val = (System.Int16)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte: res.prim_val = (System.Int16)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16: res.prim_val = (System.Int16)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32: res.prim_val = (System.Int16)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64: res.prim_val = (System.UInt64)((System.Int16)left.prim_val) * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single: res.prim_val = (System.Int16)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Int64:
|
||||
{
|
||||
switch (rcode)
|
||||
{
|
||||
case TypeCode.Byte: res.prim_val = (System.Int64)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32: res.prim_val = (System.Int64)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double: res.prim_val = (System.Int64)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64: res.prim_val = (System.Int64)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.Int64)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16: res.prim_val = (System.Int64)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte: res.prim_val = (System.Int64)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16: res.prim_val = (System.Int64)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32: res.prim_val = (System.Int64)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64: res.prim_val = (System.Int64)left.prim_val * (System.Int64)((System.UInt64)right.prim_val); break;
|
||||
case TypeCode.Single: res.prim_val = (System.Int64)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TypeCode.SByte:
|
||||
{
|
||||
switch (rcode)
|
||||
{
|
||||
case TypeCode.Byte: res.prim_val = (System.SByte)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32: res.prim_val = (System.SByte)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double: res.prim_val = (System.SByte)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64: res.prim_val = (System.SByte)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.SByte)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16: res.prim_val = (System.SByte)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte: res.prim_val = (System.SByte)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16: res.prim_val = (System.SByte)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32: res.prim_val = (System.SByte)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64: res.prim_val = (System.UInt64)((System.SByte)left.prim_val) * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single: res.prim_val = (System.SByte)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.UInt16:
|
||||
{
|
||||
switch (rcode)
|
||||
{
|
||||
case TypeCode.Byte: res.prim_val = (System.UInt16)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32: res.prim_val = (System.UInt16)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double: res.prim_val = (System.UInt16)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64: res.prim_val = (System.UInt16)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.UInt16)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16: res.prim_val = (System.UInt16)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte: res.prim_val = (System.UInt16)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16: res.prim_val = (System.UInt16)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32: res.prim_val = (System.UInt16)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64: res.prim_val = (System.UInt16)left.prim_val * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single: res.prim_val = (System.UInt16)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.UInt32:
|
||||
{
|
||||
switch (rcode)
|
||||
{
|
||||
case TypeCode.Byte: res.prim_val = (System.UInt32)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32: res.prim_val = (System.UInt32)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double: res.prim_val = (System.UInt32)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64: res.prim_val = (System.UInt32)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.UInt32)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16: res.prim_val = (System.UInt32)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte: res.prim_val = (System.UInt32)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16: res.prim_val = (System.UInt32)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32: res.prim_val = (System.UInt32)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64: res.prim_val = (System.UInt32)left.prim_val * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single: res.prim_val = (System.UInt32)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.UInt64:
|
||||
{
|
||||
switch (rcode)
|
||||
{
|
||||
case TypeCode.Byte: res.prim_val = (System.UInt64)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32: res.prim_val = (System.UInt64)left.prim_val * (System.UInt64)((int)right.prim_val); break;
|
||||
case TypeCode.Double: res.prim_val = (System.UInt64)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64: res.prim_val = (long)((System.UInt64)left.prim_val) * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.UInt64)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16: res.prim_val = (System.UInt64)left.prim_val * (System.UInt64)((System.Int16)right.prim_val); break;
|
||||
case TypeCode.SByte: res.prim_val = (System.UInt64)left.prim_val * (System.UInt64)((sbyte)right.prim_val); break;
|
||||
case TypeCode.UInt16: res.prim_val = (System.UInt64)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32: res.prim_val = (System.UInt64)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64: res.prim_val = (System.UInt64)left.prim_val * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single: res.prim_val = (System.UInt64)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Single:
|
||||
{
|
||||
switch (rcode)
|
||||
{
|
||||
case TypeCode.Byte: res.prim_val = (System.Single)left.prim_val * (byte)right.prim_val; break;
|
||||
case TypeCode.Int32: res.prim_val = (System.Single)left.prim_val * (int)right.prim_val; break;
|
||||
case TypeCode.Double: res.prim_val = (System.Single)left.prim_val * (double)right.prim_val; break;
|
||||
case TypeCode.Int64: res.prim_val = (System.Single)left.prim_val * (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.Single)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16: res.prim_val = (System.Single)left.prim_val * (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte: res.prim_val = (System.Single)left.prim_val * (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16: res.prim_val = (System.Single)left.prim_val * (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32: res.prim_val = (System.Single)left.prim_val * (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64: res.prim_val = (System.Single)left.prim_val * (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single: res.prim_val = (System.Single)left.prim_val * (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
eval_stack.Push(res);
|
||||
}
|
||||
|
||||
public void EvalDiv()
|
||||
{
|
||||
|
|
@ -652,192 +652,7 @@ namespace CodeCompletion
|
|||
RetValue res = new RetValue();
|
||||
if (left.prim_val != null && right.prim_val != null)
|
||||
{
|
||||
TypeCode lcode = Type.GetTypeCode(left.prim_val.GetType());
|
||||
TypeCode rcode = Type.GetTypeCode(right.prim_val.GetType());
|
||||
switch (lcode)
|
||||
{
|
||||
case TypeCode.Int32:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (int)left.prim_val / (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (int)left.prim_val / (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (int)left.prim_val / (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (int)left.prim_val / (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((int)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (int)left.prim_val / (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (int)left.prim_val / (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (int)left.prim_val / (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (int)left.prim_val / (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.UInt64)((int)left.prim_val) / (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (int)left.prim_val / (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Double:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (double)left.prim_val / (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (double)left.prim_val / (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (double)left.prim_val / (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (double)left.prim_val / (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((double)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (double)left.prim_val / (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (double)left.prim_val / (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (double)left.prim_val / (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (double)left.prim_val / (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (double)left.prim_val / (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (double)left.prim_val / (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Byte:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (byte)left.prim_val / (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (byte)left.prim_val / (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (byte)left.prim_val / (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (byte)left.prim_val / (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((byte)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (byte)left.prim_val / (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (byte)left.prim_val / (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (byte)left.prim_val / (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (byte)left.prim_val / (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (byte)left.prim_val / (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (byte)left.prim_val / (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Int16:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (System.Int16)left.prim_val / (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (System.Int16)left.prim_val / (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (System.Int16)left.prim_val / (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (System.Int16)left.prim_val / (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.Int16)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (System.Int16)left.prim_val / (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (System.Int16)left.prim_val / (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (System.Int16)left.prim_val / (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (System.Int16)left.prim_val / (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.UInt64)((System.Int16)left.prim_val) / (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (System.Int16)left.prim_val / (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Int64:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (System.Int64)left.prim_val / (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (System.Int64)left.prim_val / (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (System.Int64)left.prim_val / (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (System.Int64)left.prim_val / (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.Int64)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (System.Int64)left.prim_val / (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (System.Int64)left.prim_val / (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (System.Int64)left.prim_val / (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (System.Int64)left.prim_val / (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.Int64)left.prim_val / (System.Int64)((System.UInt64)right.prim_val); break;
|
||||
case TypeCode.Single : res.prim_val = (System.Int64)left.prim_val / (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TypeCode.SByte:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (System.SByte)left.prim_val / (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (System.SByte)left.prim_val / (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (System.SByte)left.prim_val / (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (System.SByte)left.prim_val / (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.SByte)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (System.SByte)left.prim_val / (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (System.SByte)left.prim_val / (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (System.SByte)left.prim_val / (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (System.SByte)left.prim_val / (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.UInt64)((System.SByte)left.prim_val) / (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (System.SByte)left.prim_val / (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.UInt16:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (System.UInt16)left.prim_val / (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (System.UInt16)left.prim_val / (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (System.UInt16)left.prim_val / (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (System.UInt16)left.prim_val / (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.UInt16)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (System.UInt16)left.prim_val / (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (System.UInt16)left.prim_val / (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (System.UInt16)left.prim_val / (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (System.UInt16)left.prim_val / (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.UInt16)left.prim_val / (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (System.UInt16)left.prim_val / (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.UInt32:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (System.UInt32)left.prim_val / (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (System.UInt32)left.prim_val / (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (System.UInt32)left.prim_val / (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (System.UInt32)left.prim_val / (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.UInt32)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (System.UInt32)left.prim_val / (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (System.UInt32)left.prim_val / (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (System.UInt32)left.prim_val / (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (System.UInt32)left.prim_val / (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.UInt32)left.prim_val / (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (System.UInt32)left.prim_val / (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.UInt64:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (System.UInt64)left.prim_val / (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (System.UInt64)left.prim_val / (System.UInt64)((int)right.prim_val); break;
|
||||
case TypeCode.Double : res.prim_val = (System.UInt64)left.prim_val / (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (long)((System.UInt64)left.prim_val) / (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.UInt64)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (System.UInt64)left.prim_val / (System.UInt64)((System.Int16)right.prim_val); break;
|
||||
case TypeCode.SByte : res.prim_val = (System.UInt64)left.prim_val / (System.UInt64)((sbyte)right.prim_val); break;
|
||||
case TypeCode.UInt16 : res.prim_val = (System.UInt64)left.prim_val / (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (System.UInt64)left.prim_val / (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.UInt64)left.prim_val / (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (System.UInt64)left.prim_val / (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCode.Single:
|
||||
{
|
||||
switch(rcode)
|
||||
{
|
||||
case TypeCode.Byte : res.prim_val = (System.Single)left.prim_val / (byte)right.prim_val; break;
|
||||
case TypeCode.Int32 : res.prim_val = (System.Single)left.prim_val / (int)right.prim_val; break;
|
||||
case TypeCode.Double : res.prim_val = (System.Single)left.prim_val / (double)right.prim_val; break;
|
||||
case TypeCode.Int64 : res.prim_val = (System.Single)left.prim_val / (long)right.prim_val; break;
|
||||
//case TypeCode.String : res.prim_val = ((System.Single)left.prim_val).ToString() + (string)right.prim_val; break;
|
||||
case TypeCode.Int16 : res.prim_val = (System.Single)left.prim_val / (System.Int16)right.prim_val; break;
|
||||
case TypeCode.SByte : res.prim_val = (System.Single)left.prim_val / (sbyte)right.prim_val; break;
|
||||
case TypeCode.UInt16 : res.prim_val = (System.Single)left.prim_val / (System.UInt16)right.prim_val; break;
|
||||
case TypeCode.UInt32 : res.prim_val = (System.Single)left.prim_val / (System.UInt32)right.prim_val; break;
|
||||
case TypeCode.UInt64 : res.prim_val = (System.Single)left.prim_val / (System.UInt64)right.prim_val; break;
|
||||
case TypeCode.Single : res.prim_val = (System.Single)left.prim_val / (System.Single)right.prim_val; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
res.prim_val = Convert.ToDouble(left.prim_val) / Convert.ToDouble(right.prim_val);
|
||||
eval_stack.Push(res);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ namespace CodeCompletion
|
|||
if (returned_scope == null)
|
||||
returned_scope = returned_scopes[0];
|
||||
}
|
||||
if (returned_scope == null && entry_scope.topScope == null)
|
||||
/*if (returned_scope == null && entry_scope.topScope == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -313,17 +313,13 @@ namespace CodeCompletion
|
|||
try
|
||||
{
|
||||
returned_scope = entry_scope.topScope.FindNameInAnyOrder(_ident.name);
|
||||
/*if (ret_scope != null)
|
||||
{
|
||||
if (!ret_scope.IsInScope(ret_scope.loc,_ident.source_context.begin_position.line_num,_ident.source_context.begin_position.column_num))
|
||||
ret_scope = null;
|
||||
}*/
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (returned_scope != null)
|
||||
{
|
||||
if (returned_scope is ProcScope)
|
||||
|
|
@ -930,14 +926,26 @@ namespace CodeCompletion
|
|||
}
|
||||
if (good_procs.Count > 0)
|
||||
{
|
||||
int ind = 0;
|
||||
if (obj != null)
|
||||
{
|
||||
for (int i = 0; i < good_procs.Count; i++)
|
||||
{
|
||||
TypeScope param_type = good_procs[i].parameters[0].sc as TypeScope;
|
||||
if (param_type.original_type != null)
|
||||
param_type = param_type.original_type;
|
||||
if (good_procs[i].IsExtension && param_type.IsEqual(obj))
|
||||
{
|
||||
ind = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (obj.GetElementType() != null && good_procs[0].IsExtension && !(good_procs[0].parameters[0].sc is TemplateParameterScope))
|
||||
obj = obj.GetElementType();
|
||||
arg_types2.Insert(0, obj);
|
||||
}
|
||||
|
||||
return good_procs[0].GetInstance(arg_types2);
|
||||
return good_procs[ind].GetInstance(arg_types2);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1008,10 +1016,13 @@ namespace CodeCompletion
|
|||
ProcScope proc = ss as ProcScope;
|
||||
if (_method_call.dereferencing_value is dot_node)
|
||||
{
|
||||
bool tmp = by_dot;
|
||||
by_dot = true;
|
||||
(_method_call.dereferencing_value as dot_node).left.visit(this);
|
||||
if (returned_scope is ElementScope)
|
||||
returned_scope = (returned_scope as ElementScope).sc;
|
||||
obj = returned_scope as TypeScope;
|
||||
by_dot = tmp;
|
||||
if (obj != null && proc.parameters != null && proc.parameters.Count > 0 && !(proc.parameters[0].sc is TemplateParameterScope || proc.parameters[0].sc is UnknownScope))
|
||||
{
|
||||
TypeScope param_type = proc.parameters[0].sc as TypeScope;
|
||||
|
|
@ -1235,7 +1246,7 @@ namespace CodeCompletion
|
|||
|
||||
public override void visit(procedure_call _procedure_call)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_procedure_call.func_name.visit(this);
|
||||
}
|
||||
|
||||
public override void visit(class_predefinition _class_predefinition)
|
||||
|
|
@ -1692,7 +1703,40 @@ namespace CodeCompletion
|
|||
public override void visit(ident_with_templateparams node)
|
||||
{
|
||||
node.name.visit(this);
|
||||
if (this.returned_scope != null)
|
||||
if (returned_scopes.Count > 0 && returned_scopes[0] is ProcScope)
|
||||
{
|
||||
ProcScope ps = returned_scopes[0] as ProcScope;
|
||||
List<TypeScope> template_params = new List<TypeScope>();
|
||||
foreach (type_definition td in node.template_params.params_list)
|
||||
{
|
||||
td.visit(this);
|
||||
if (returned_scope is TypeScope)
|
||||
template_params.Add(returned_scope as TypeScope);
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
returned_scopes[0] = ps.GetInstance(template_params);
|
||||
}
|
||||
else if (returned_scope is ProcScope)
|
||||
{
|
||||
ProcScope ps = returned_scope as ProcScope;
|
||||
List<TypeScope> template_params = new List<TypeScope>();
|
||||
foreach (type_definition td in node.template_params.params_list)
|
||||
{
|
||||
td.visit(this);
|
||||
if (returned_scope is TypeScope)
|
||||
template_params.Add(returned_scope as TypeScope);
|
||||
else
|
||||
{
|
||||
returned_scope = ps;
|
||||
return;
|
||||
}
|
||||
}
|
||||
returned_scope = ps.GetInstance(template_params);
|
||||
}
|
||||
/*else if (this.returned_scope != null)
|
||||
{
|
||||
if (this.returned_scope is TypeScope)
|
||||
{
|
||||
|
|
@ -1706,7 +1750,7 @@ namespace CodeCompletion
|
|||
}
|
||||
returned_scope = ts.GetInstance(instances);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public override void visit(bracket_expr _bracket_expr)
|
||||
|
|
|
|||
|
|
@ -68,7 +68,15 @@ namespace CodeCompletion
|
|||
if (cur_scope == null)
|
||||
cur_scope = tmp;
|
||||
foreach (statement stmt in _statement_list.subnodes)
|
||||
{
|
||||
IBaseScope tmp2 = cur_scope;
|
||||
cur_scope = cur_scope.FindScopeByLocation(stmt.source_context.begin_position.line_num, stmt.source_context.begin_position.column_num);
|
||||
if (cur_scope == null)
|
||||
cur_scope = tmp2;
|
||||
stmt.visit(this);
|
||||
cur_scope = tmp2;
|
||||
}
|
||||
|
||||
cur_scope = tmp;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -384,31 +384,38 @@ namespace CodeCompletion
|
|||
tmp_ts = tmp_ts.baseScope;
|
||||
}
|
||||
if (ts.implemented_interfaces != null && !(ts is ArrayScope && !(ts as ArrayScope).is_dynamic_arr))
|
||||
foreach (TypeScope int_ts in ts.implemented_interfaces)
|
||||
{
|
||||
TypeScope int_ts2 = int_ts;
|
||||
if (int_ts is CompiledScope && (int_ts as CompiledScope).CompiledType.IsGenericType && !(int_ts as CompiledScope).CompiledType.IsGenericTypeDefinition)
|
||||
int_ts2 = TypeTable.get_compiled_type((int_ts as CompiledScope).CompiledType.GetGenericTypeDefinition());
|
||||
if (extension_methods.TryGetValue(int_ts2, out meths))
|
||||
List<TypeScope> implemented_interfaces = new List<TypeScope>();
|
||||
implemented_interfaces.AddRange(ts.implemented_interfaces);
|
||||
if (ts is ArrayScope)
|
||||
implemented_interfaces.Add((ts as ArrayScope).ilist);
|
||||
foreach (TypeScope int_ts in implemented_interfaces)
|
||||
{
|
||||
lst.AddRange(meths);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (TypeScope t in extension_methods.Keys)
|
||||
TypeScope int_ts2 = int_ts;
|
||||
if (int_ts is CompiledScope && (int_ts as CompiledScope).CompiledType.IsGenericType && !(int_ts as CompiledScope).CompiledType.IsGenericTypeDefinition)
|
||||
int_ts2 = TypeTable.get_compiled_type((int_ts as CompiledScope).CompiledType.GetGenericTypeDefinition());
|
||||
if (extension_methods.TryGetValue(int_ts2, out meths))
|
||||
{
|
||||
if (t.GenericTypeDefinition == int_ts2.GenericTypeDefinition || t.IsEqual(int_ts2) ||
|
||||
(t is ArrayScope && int_ts2.IsArray && t.Rank == int_ts2.Rank) ||
|
||||
(int_ts2 is ArrayScope && t.IsArray && int_ts2.Rank == t.Rank) ||
|
||||
t is FileScope && int_ts2 is FileScope)
|
||||
{
|
||||
lst.AddRange(extension_methods[t]);
|
||||
//break;
|
||||
}
|
||||
lst.AddRange(meths);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (TypeScope t in extension_methods.Keys)
|
||||
{
|
||||
if (t.GenericTypeDefinition == int_ts2.GenericTypeDefinition || t.IsEqual(int_ts2) ||
|
||||
(t is ArrayScope && int_ts2.IsArray && t.Rank == int_ts2.Rank) ||
|
||||
(int_ts2 is ArrayScope && t.IsArray && int_ts2.Rank == t.Rank) ||
|
||||
t is FileScope && int_ts2 is FileScope)
|
||||
{
|
||||
lst.AddRange(extension_methods[t]);
|
||||
//break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (this.used_units != null)
|
||||
for (int i = 0; i < this.used_units.Count; i++)
|
||||
|
|
@ -443,7 +450,8 @@ namespace CodeCompletion
|
|||
|
||||
public void AddUsedUnit(SymScope unit)
|
||||
{
|
||||
used_units.Add(unit);
|
||||
if (this.si.name != "PABCSystem")
|
||||
used_units.Add(unit);
|
||||
}
|
||||
|
||||
public virtual string GetFullName()
|
||||
|
|
@ -645,7 +653,10 @@ namespace CodeCompletion
|
|||
{
|
||||
res = ss;
|
||||
SymScope tmp = ss.FindScopeByLocation(line, column);
|
||||
if (tmp != null) return res = tmp;
|
||||
if (tmp != null)
|
||||
return tmp;
|
||||
else
|
||||
return res;
|
||||
}
|
||||
else if (!(ss is CompiledScope))
|
||||
{
|
||||
|
|
@ -672,6 +683,15 @@ namespace CodeCompletion
|
|||
return lst.ToArray();
|
||||
}
|
||||
|
||||
protected bool IsClassMember(SymScope scope)
|
||||
{
|
||||
if (scope is ProcScope && (scope as ProcScope).declaringType != null)
|
||||
return true;
|
||||
if (scope is ElementScope && (scope as ElementScope).declaringUnit is TypeScope)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected bool IsAfterDefinition(int def_line, int def_col)
|
||||
{
|
||||
if (cur_line == -1 || cur_col == -1) return true;
|
||||
|
|
@ -791,7 +811,7 @@ namespace CodeCompletion
|
|||
{
|
||||
if (string.Compare(ss.loc.doc.file_name, loc.doc.file_name, true) == 0 && this != ss)
|
||||
{
|
||||
if (IsAfterDefinition(ss.loc.begin_line_num, ss.loc.begin_column_num))
|
||||
if (IsClassMember(ss) || IsAfterDefinition(ss.loc.begin_line_num, ss.loc.begin_column_num))
|
||||
{
|
||||
return ss;
|
||||
}
|
||||
|
|
@ -809,7 +829,7 @@ namespace CodeCompletion
|
|||
{
|
||||
if (string.Compare(ss.loc.doc.file_name, loc.doc.file_name, !CodeCompletionController.CurrentParser.LanguageInformation.CaseSensitive) == 0 && this != ss)
|
||||
{
|
||||
if (IsAfterDefinition(ss.loc.begin_line_num, ss.loc.begin_column_num))
|
||||
if (IsClassMember(ss) || IsAfterDefinition(ss.loc.begin_line_num, ss.loc.begin_column_num))
|
||||
{
|
||||
return ss;
|
||||
}
|
||||
|
|
@ -1303,12 +1323,17 @@ namespace CodeCompletion
|
|||
|
||||
public override SymScope FindName(string s)
|
||||
{
|
||||
if (string.Compare(si.name, s, true) == 0)
|
||||
return this;
|
||||
return sc.FindNameOnlyInType(s);
|
||||
}
|
||||
|
||||
public override List<SymScope> FindOverloadNames(string name)
|
||||
{
|
||||
return sc.FindOverloadNamesOnlyInType(name);
|
||||
List<SymScope> names = sc.FindOverloadNames(name);
|
||||
if (topScope != null)
|
||||
names.AddRange(topScope.FindOverloadNames(name));
|
||||
return names;
|
||||
}
|
||||
|
||||
public override TypeScope GetElementType()
|
||||
|
|
@ -1735,6 +1760,7 @@ namespace CodeCompletion
|
|||
public bool is_extension = false;
|
||||
public List<string> generic_params;
|
||||
public List<string> generic_args;
|
||||
public ProcScope original_function;
|
||||
|
||||
public ProcScope()
|
||||
{
|
||||
|
|
@ -1795,6 +1821,14 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
public bool OfTypeInstance
|
||||
{
|
||||
get
|
||||
{
|
||||
return original_function != null || declaringType != null && declaringType.instances != null && declaringType.instances.Count > 0;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsStatic
|
||||
{
|
||||
get
|
||||
|
|
@ -1883,6 +1917,7 @@ namespace CodeCompletion
|
|||
return this;
|
||||
ProcScope instance = new ProcScope(this.name, this.topScope, this.is_constructor);
|
||||
instance.is_extension = this.is_extension;
|
||||
instance.original_function = this;
|
||||
instance.loc = this.loc;
|
||||
instance.body_loc = this.body_loc;
|
||||
instance.parameters = new List<ElementScope>(this.parameters.Count);
|
||||
|
|
@ -1915,7 +1950,8 @@ namespace CodeCompletion
|
|||
gen_args.RemoveRange(i, gen_args.Count - i);
|
||||
}
|
||||
instance.si = this.si;
|
||||
instance.return_type = this.return_type.GetInstance(gen_args);
|
||||
if (this.return_type != null)
|
||||
instance.return_type = this.return_type.GetInstance(gen_args);
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
|
@ -2660,7 +2696,9 @@ namespace CodeCompletion
|
|||
TypeScope original_type = actType;
|
||||
if (actType.original_type != null)
|
||||
original_type = actType.original_type;
|
||||
return original_type.GetInstance(gen_args);
|
||||
TypeScope ts = original_type.GetInstance(gen_args);
|
||||
ts.aliased = true;
|
||||
return ts;
|
||||
}
|
||||
|
||||
public override void AddIndexer(TypeScope ts)
|
||||
|
|
@ -2881,6 +2919,7 @@ namespace CodeCompletion
|
|||
public TypeScope[] indexes;
|
||||
private bool _is_dynamic_arr = false;
|
||||
private bool _is_multi_dyn_arr = false;
|
||||
internal TypeScope ilist;
|
||||
|
||||
public ArrayScope()
|
||||
{
|
||||
|
|
@ -2914,7 +2953,8 @@ namespace CodeCompletion
|
|||
lst.Add(elementType);
|
||||
this.implemented_interfaces = new List<TypeScope>();
|
||||
this.implemented_interfaces.Add(CompiledScope.get_type_instance(typeof(IEnumerable<>), lst));
|
||||
this.implemented_interfaces.Add(CompiledScope.get_type_instance(typeof(IList<>), lst));
|
||||
ilist = CompiledScope.get_type_instance(typeof(IList<>), lst);
|
||||
//this.implemented_interfaces.Add(CompiledScope.get_type_instance(typeof(IList<>), lst));
|
||||
}
|
||||
this.si = new SymInfo("$" + this.ToString(), SymbolKind.Type, this.ToString());
|
||||
this.members = new List<SymScope>();
|
||||
|
|
@ -3050,6 +3090,8 @@ namespace CodeCompletion
|
|||
|
||||
public override SymScope FindName(string name)
|
||||
{
|
||||
if (string.Compare(si.name, name, true) == 0)
|
||||
return this;
|
||||
if (!is_dynamic_arr && !IsMultiDynArray)
|
||||
return null;
|
||||
SymScope sc = null;
|
||||
|
|
@ -3130,26 +3172,17 @@ namespace CodeCompletion
|
|||
if (ts is NullTypeScope && is_dynamic_arr)
|
||||
return true;
|
||||
ArrayScope arrs = ts as ArrayScope;
|
||||
if (ts is CompiledScope && (ts as CompiledScope).IsArray)
|
||||
{
|
||||
return this.elementType.IsEqual(ts.GetElementType());
|
||||
}
|
||||
if (arrs == null || !arrs.is_dynamic_arr)
|
||||
if (ts is TypeSynonim) return this.IsEqual((ts as TypeSynonim).actType);
|
||||
else return false;
|
||||
if (arrs.elementType == null) return true;
|
||||
if (!this.elementType.IsEqual(arrs.elementType)) return false;
|
||||
return true;
|
||||
if (this.indexes == null && arrs.indexes == null) return true;//?????
|
||||
if (this.indexes != null && arrs.indexes != null)
|
||||
{
|
||||
if (this.indexes.Length != arrs.indexes.Length) return false;
|
||||
for (int i = 0; i < this.indexes.Length; i++)
|
||||
if (this.indexes[i] == null && arrs.indexes[i] == null)
|
||||
continue;
|
||||
else if (this.indexes[i] == null && arrs.indexes[i] != null || this.indexes[i] != null && arrs.indexes[i] == null)
|
||||
return false;
|
||||
else
|
||||
if (!this.indexes[i].IsEqual(arrs.indexes[i])) return false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public override ProcScope GetConstructor()
|
||||
|
|
@ -3789,6 +3822,12 @@ namespace CodeCompletion
|
|||
{
|
||||
ts.elementType = internalInstance(this.elementType, gen_args);
|
||||
}
|
||||
if (implemented_interfaces != null)
|
||||
{
|
||||
ts.implemented_interfaces = new List<TypeScope>();
|
||||
for (int j = 0; j < this.implemented_interfaces.Count; j++)
|
||||
ts.implemented_interfaces.Add(internalInstance(this.implemented_interfaces[j], gen_args));
|
||||
}
|
||||
if (this.indexers != null && this.indexers.Count > 0)
|
||||
{
|
||||
ts.indexers = new List<TypeScope>();
|
||||
|
|
@ -3898,6 +3937,8 @@ namespace CodeCompletion
|
|||
return true;
|
||||
if (this.IsGenericParameter && ts.IsGenericParameter && this.Name == ts.Name)
|
||||
return true;
|
||||
if (ts is TemplateParameterScope)
|
||||
return true;
|
||||
TypeScope tmp = this.baseScope;
|
||||
while (tmp != null)
|
||||
if (tmp.IsEqual(ts))
|
||||
|
|
@ -4894,8 +4935,8 @@ namespace CodeCompletion
|
|||
sc.generic_params.Add(gen_args[i].si.name);
|
||||
sc.instances.Add(this.instances[i].GetInstance(gen_args));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
for (int i = 0; i < gen_args.Count; i++)
|
||||
|
|
@ -4904,6 +4945,10 @@ namespace CodeCompletion
|
|||
sc.generic_params.Add(gen_args[i].si.name);
|
||||
sc.instances.Add(gen_args[i]);
|
||||
}
|
||||
sc.implemented_interfaces = new List<TypeScope>();
|
||||
if (this.implemented_interfaces != null)
|
||||
for (int i = 0; i < this.implemented_interfaces.Count; i++)
|
||||
sc.implemented_interfaces.Add(this.implemented_interfaces[i].GetInstance(gen_args));
|
||||
sc.si.description = sc.GetDescription();
|
||||
return sc;
|
||||
}
|
||||
|
|
@ -5058,6 +5103,8 @@ namespace CodeCompletion
|
|||
public override bool IsConvertable(TypeScope ts)
|
||||
{
|
||||
CompiledScope cs = ts as CompiledScope;
|
||||
if (ts == null)
|
||||
return true;
|
||||
if (ts is NullTypeScope && !ctn.IsValueType)
|
||||
return true;
|
||||
if (cs == null)
|
||||
|
|
@ -5104,6 +5151,10 @@ namespace CodeCompletion
|
|||
|
||||
if (this.ctn.IsSubclassOf(cs.ctn))
|
||||
return true;
|
||||
if (implemented_interfaces != null)
|
||||
foreach (TypeScope interf in implemented_interfaces)
|
||||
if (interf.IsEqual(ts))
|
||||
return true;
|
||||
TypeCode code1 = Type.GetTypeCode(this.ctn);
|
||||
TypeCode code2 = Type.GetTypeCode(cs.ctn);
|
||||
bool left = false;
|
||||
|
|
@ -6696,7 +6747,10 @@ namespace CodeCompletion
|
|||
|
||||
public override SymInfo[] GetNames()
|
||||
{
|
||||
return return_type.GetNames();
|
||||
if (return_type != null)
|
||||
return return_type.GetNames();
|
||||
else
|
||||
return new SymInfo[0];
|
||||
}
|
||||
|
||||
// public override SymInfo[] GetNames(ExpressionVisitor ev)
|
||||
|
|
@ -6706,7 +6760,10 @@ namespace CodeCompletion
|
|||
|
||||
public override SymScope FindName(string name)
|
||||
{
|
||||
return return_type.FindName(name);
|
||||
if (return_type != null)
|
||||
return return_type.FindName(name);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public override SymScope FindNameOnlyInType(string name)
|
||||
|
|
|
|||
|
|
@ -369,8 +369,13 @@ namespace CodeCompletion
|
|||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')==test_str);
|
||||
|
||||
int num_param = 0;
|
||||
|
||||
test_str = "()->(obj as string).Trim";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw);
|
||||
assert(s.Trim('\n', ' ', '\t') == "(obj as string).Trim");
|
||||
|
||||
int num_param = 0;
|
||||
//testirovanie nazhatija skobki
|
||||
test_str = "writeln";
|
||||
off = test_str.Length;
|
||||
|
|
@ -460,8 +465,14 @@ namespace CodeCompletion
|
|||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "test; \n sin";
|
||||
|
||||
test_str = "()->(obj as string).Trim";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
assert(s == "(obj as string).Trim");
|
||||
assert(num_param == 0);
|
||||
|
||||
test_str = "test; \n sin";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "sin");
|
||||
|
|
@ -653,8 +664,15 @@ namespace CodeCompletion
|
|||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "new RGB");
|
||||
assert(num_param == 2);
|
||||
|
||||
string str = null;
|
||||
|
||||
test_str = "Power(10 div 2";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, ',', ref num_param);
|
||||
assert(s.Trim(' ', '\n', '\t') == "Power");
|
||||
assert(num_param == 2);
|
||||
|
||||
string str = null;
|
||||
//mouse hover
|
||||
test_str = "sin(2)";
|
||||
off = 1;
|
||||
|
|
|
|||
|
|
@ -119,7 +119,8 @@ namespace CodeCompletion
|
|||
private static ProcScope char_smeq;
|
||||
private static ProcScope char_gr;
|
||||
private static ProcScope char_greq;
|
||||
|
||||
private static ProcScope char_plus;
|
||||
|
||||
private static ProcScope string_plus;
|
||||
private static ProcScope string_eq;
|
||||
private static ProcScope string_noteq;
|
||||
|
|
@ -798,7 +799,7 @@ namespace CodeCompletion
|
|||
int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, int64_plus);
|
||||
int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, int64_minus);
|
||||
int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, int64_mul);
|
||||
int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.div_name, int64_div);
|
||||
int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.idiv_name, int64_div);
|
||||
int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name, int64_mod);
|
||||
int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shl_name, int64_shl);
|
||||
int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name, int64_shr);
|
||||
|
|
@ -968,6 +969,23 @@ namespace CodeCompletion
|
|||
ps.AddParameter(right);
|
||||
char_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, ps);
|
||||
|
||||
ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, char_type);
|
||||
char_plus = ps;
|
||||
left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
|
||||
right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
|
||||
ps.return_type = string_type;
|
||||
ps.AddParameter(left);
|
||||
ps.AddParameter(right);
|
||||
char_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, ps);
|
||||
|
||||
ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, char_type);
|
||||
left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
|
||||
right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, char_type);
|
||||
ps.return_type = string_type;
|
||||
ps.AddParameter(left);
|
||||
ps.AddParameter(right);
|
||||
char_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, ps);
|
||||
|
||||
//string type
|
||||
ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, string_type);
|
||||
string_plus = ps;
|
||||
|
|
|
|||
|
|
@ -260,6 +260,24 @@ namespace PascalABCCompiler
|
|||
|
||||
}
|
||||
|
||||
public class IncludeNamespaceInUnit: CompilerCompilationError
|
||||
{
|
||||
public IncludeNamespaceInUnit(string FileName, SyntaxTree.SourceContext sc)
|
||||
: base(string.Format(StringResources.Get("COMPILATIONERROR_INCLUDE_NAMESPACE_IN_UNIT")), FileName)
|
||||
{
|
||||
this.source_context = sc;
|
||||
}
|
||||
}
|
||||
|
||||
public class NamespaceModuleExpected : CompilerCompilationError
|
||||
{
|
||||
public NamespaceModuleExpected(SyntaxTree.SourceContext sc)
|
||||
: base(string.Format(StringResources.Get("COMPILATIONERROR_NAMESPACE_MODULE_EXPECTED")))
|
||||
{
|
||||
this.source_context = sc;
|
||||
}
|
||||
}
|
||||
|
||||
public class MainResourceNotAllowed : CompilerCompilationError
|
||||
{
|
||||
public MainResourceNotAllowed(TreeRealization.location sl)
|
||||
|
|
@ -1789,7 +1807,7 @@ namespace PascalABCCompiler
|
|||
//Console.WriteLine("Compile Implementation "+UnitName);//DEBUG
|
||||
//TODO: Избавиться от преобразования типа.
|
||||
|
||||
AddNamespaces(CurrentUnit.ImplementationUsingNamespaceList, CurrentUnit.PossibleNamespaces, true);
|
||||
AddNamespaces(CurrentUnit.ImplementationUsingNamespaceList, CurrentUnit.PossibleNamespaces, true, null);
|
||||
|
||||
#if DEBUG
|
||||
if (InternalDebug.SemanticAnalysis)
|
||||
|
|
@ -2645,8 +2663,8 @@ namespace PascalABCCompiler
|
|||
{
|
||||
TreeRealization.location loc = cd.location;
|
||||
SyntaxTree.SourceContext sc = null;
|
||||
if (loc!=null)
|
||||
sc = new SyntaxTree.SourceContext(loc.begin_line_num,loc.begin_column_num,loc.end_line_num,loc.end_column_num,0,0);
|
||||
if (loc != null)
|
||||
sc = new SyntaxTree.SourceContext(loc.begin_line_num, loc.begin_column_num, loc.end_line_num, loc.end_column_num, 0, 0);
|
||||
string UnitName = null;
|
||||
try
|
||||
{
|
||||
|
|
@ -2656,7 +2674,7 @@ namespace PascalABCCompiler
|
|||
{
|
||||
throw;
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new InvalidAssemblyPathError(CurrentCompilationUnit.SyntaxTree.file_name, sc);
|
||||
}
|
||||
|
|
@ -2670,9 +2688,146 @@ namespace PascalABCCompiler
|
|||
}
|
||||
else
|
||||
//throw new DLLReadingError(UnitName);
|
||||
throw new AssemblyReadingError(CurrentCompilationUnit.SyntaxTree.file_name,UnitName,sc);
|
||||
throw new AssemblyReadingError(CurrentCompilationUnit.SyntaxTree.file_name, UnitName, sc);
|
||||
}
|
||||
|
||||
|
||||
private bool HasIncludeNamespacesDirective(CompilationUnit Unit)
|
||||
{
|
||||
var directives = ConvertDirectives(Unit.SyntaxTree);
|
||||
foreach (TreeRealization.compiler_directive cd in directives)
|
||||
{
|
||||
if (cd.name.ToLower() == TreeConverter.compiler_string_consts.include_namespace_directive)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private Dictionary<string, SyntaxTree.syntax_namespace_node> IncludeNamespaces(CompilationUnit Unit)
|
||||
{
|
||||
if (HasIncludeNamespacesDirective(Unit) && Unit.SyntaxTree is SyntaxTree.unit_module && (Unit.SyntaxTree as SyntaxTree.unit_module).unit_name.HeaderKeyword != SyntaxTree.UnitHeaderKeyword.Library)
|
||||
throw new IncludeNamespaceInUnit(CurrentCompilationUnit.SyntaxTree.file_name, CurrentCompilationUnit.SyntaxTree.source_context);
|
||||
var directives = ConvertDirectives(Unit.SyntaxTree);
|
||||
SyntaxTree.unit_module main_library = Unit.SyntaxTree as SyntaxTree.unit_module;
|
||||
SyntaxTree.program_module main_program = Unit.SyntaxTree as SyntaxTree.program_module;
|
||||
List<string> files = new List<string>();
|
||||
|
||||
foreach (TreeRealization.compiler_directive cd in directives)
|
||||
{
|
||||
if (cd.name.ToLower() == TreeConverter.compiler_string_consts.include_namespace_directive)
|
||||
{
|
||||
string directive = cd.directive.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar);
|
||||
|
||||
if (directive == "*.pas" || directive.EndsWith(Path.DirectorySeparatorChar + "*.pas"))
|
||||
{
|
||||
string dir = Path.Combine(Path.GetDirectoryName(Unit.SyntaxTree.file_name), directive.Replace(Path.DirectorySeparatorChar + "*.pas", ""));
|
||||
foreach (string file in Directory.EnumerateFiles(dir, "*.pas"))
|
||||
files.Add(file);
|
||||
}
|
||||
else
|
||||
files.Add(Path.Combine(Path.GetDirectoryName(Unit.SyntaxTree.file_name), directive));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Dictionary<string, SyntaxTree.syntax_namespace_node> namespaces = new Dictionary<string, SyntaxTree.syntax_namespace_node>();
|
||||
List<SyntaxTree.unit_or_namespace> namespace_modules = new List<SyntaxTree.unit_or_namespace>();
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
throw new FileNotFound(file);
|
||||
SyntaxTree.compilation_unit tree = GetNamespaceSyntaxTree(file);
|
||||
if (!(tree is SyntaxTree.unit_module))
|
||||
throw new NamespaceModuleExpected(tree.source_context);
|
||||
SyntaxTree.unit_module unit = tree as SyntaxTree.unit_module;
|
||||
if (unit.unit_name.HeaderKeyword != SyntaxTree.UnitHeaderKeyword.Namespace)
|
||||
throw new NamespaceModuleExpected(unit.unit_name.source_context);
|
||||
if (unit.implementation_part != null)
|
||||
throw new NamespaceModuleExpected(unit.implementation_part.source_context);
|
||||
if (unit.finalization_part != null)
|
||||
throw new NamespaceModuleExpected(unit.finalization_part.source_context);
|
||||
if (unit.initialization_part != null && unit.initialization_part.list.Count > 0)
|
||||
throw new NamespaceModuleExpected(unit.initialization_part.source_context);
|
||||
SyntaxTree.syntax_namespace_node ns = null;
|
||||
if (!namespaces.TryGetValue(unit.unit_name.idunit_name.name, out ns))
|
||||
{
|
||||
ns = new SyntaxTree.syntax_namespace_node(unit.unit_name.idunit_name.name);
|
||||
ns.referenced_units = new TreeRealization.unit_node_list();
|
||||
namespaces[unit.unit_name.idunit_name.name] = ns;
|
||||
}
|
||||
if (unit.interface_part.interface_definitions != null)
|
||||
{
|
||||
foreach (SyntaxTree.declaration decl in unit.interface_part.interface_definitions.defs)
|
||||
{
|
||||
ns.defs.Add(decl);
|
||||
}
|
||||
if (unit.interface_part.uses_modules != null)
|
||||
{
|
||||
checkDuplicateUsesUnit(unit.interface_part.uses_modules.units);
|
||||
foreach (SyntaxTree.unit_or_namespace name_space in unit.interface_part.uses_modules.units)
|
||||
{
|
||||
if (IsPossibleNamespace(name_space, false))
|
||||
{
|
||||
ns.referenced_units.AddElement(new TreeRealization.namespace_unit_node(GetNamespace(name_space)));
|
||||
}
|
||||
else
|
||||
{
|
||||
namespace_modules.Add(name_space);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (string s in namespaces.Keys)
|
||||
{
|
||||
if (main_library != null)
|
||||
main_library.interface_part.interface_definitions.Insert(0, namespaces[s]);
|
||||
else
|
||||
main_program.program_block.defs.Insert(0, namespaces[s]);
|
||||
}
|
||||
SyntaxTree.uses_list main_uses = null;
|
||||
if (main_library != null)
|
||||
{
|
||||
if (main_library.interface_part.uses_modules != null)
|
||||
main_uses = main_library.interface_part.uses_modules;
|
||||
}
|
||||
else if (main_program.used_units != null)
|
||||
main_uses = main_program.used_units;
|
||||
if (main_uses == null)
|
||||
main_uses = new SyntaxTree.uses_list();
|
||||
Dictionary<string, string> dict = new Dictionary<string, string>();
|
||||
foreach (SyntaxTree.unit_or_namespace name_space in namespace_modules)
|
||||
{
|
||||
string name = SyntaxTree.Utils.IdentListToString(name_space.name.idents, ".").ToLower();
|
||||
if (!dict.ContainsKey(name))
|
||||
{
|
||||
main_uses.Add(name_space);
|
||||
dict.Add(name, name);
|
||||
}
|
||||
}
|
||||
if (main_library != null)
|
||||
main_library.interface_part.uses_modules = main_uses;
|
||||
else
|
||||
main_program.used_units = main_uses;
|
||||
return namespaces;
|
||||
}
|
||||
|
||||
private SyntaxTree.compilation_unit GetNamespaceSyntaxTree(string FileName)
|
||||
{
|
||||
string SourceText = GetSourceFileText(FileName);
|
||||
List<string> DefinesList = new List<string>();
|
||||
if (!compilerOptions.Debug && !compilerOptions.ForDebugging)
|
||||
DefinesList.Add("RELEASE");
|
||||
else
|
||||
DefinesList.Add("DEBUG");
|
||||
SyntaxTree.compilation_unit SyntaxTree = InternalParseText(FileName, SourceText, errorsList, warnings, DefinesList);
|
||||
if (errorsList.Count > 0)
|
||||
throw errorsList[0];
|
||||
SyntaxTree = syntaxTreeConvertersController.Convert(SyntaxTree) as SyntaxTree.compilation_unit;
|
||||
return SyntaxTree;
|
||||
}
|
||||
|
||||
public TreeRealization.unit_node_list GetReferences(CompilationUnit Unit)
|
||||
{
|
||||
//TODO переделать, ConvertDirectives определена дважды и вызывается дважды!
|
||||
|
|
@ -2763,9 +2918,9 @@ namespace PascalABCCompiler
|
|||
return new TreeRealization.using_namespace(SyntaxTree.Utils.IdentListToString(_name_space.name.idents, "."));
|
||||
}
|
||||
|
||||
private TreeRealization.using_namespace GetNamespace(TreeRealization.using_namespace_list using_list, string full_namespace_name, SyntaxTree.unit_or_namespace _name_space, bool possible_is_unit)
|
||||
private TreeRealization.using_namespace GetNamespace(TreeRealization.using_namespace_list using_list, string full_namespace_name, SyntaxTree.unit_or_namespace _name_space, bool possible_is_unit, Dictionary<string, SyntaxTree.syntax_namespace_node> pabc_namespaces)
|
||||
{
|
||||
if (!NetHelper.NetHelper.NamespaceExists(full_namespace_name))
|
||||
if (!NetHelper.NetHelper.NamespaceExists(full_namespace_name) && !(pabc_namespaces != null && pabc_namespaces.ContainsKey(full_namespace_name)))
|
||||
{
|
||||
if (possible_is_unit)
|
||||
if (!full_namespace_name.Contains("."))
|
||||
|
|
@ -2775,16 +2930,16 @@ namespace PascalABCCompiler
|
|||
return new TreeRealization.using_namespace(full_namespace_name);
|
||||
}
|
||||
|
||||
public void AddNamespaces(TreeRealization.using_namespace_list using_list, List<SyntaxTree.unit_or_namespace> namespaces, bool possible_is_units)
|
||||
public void AddNamespaces(TreeRealization.using_namespace_list using_list, List<SyntaxTree.unit_or_namespace> namespaces, bool possible_is_units, Dictionary<string, SyntaxTree.syntax_namespace_node> pabc_namespaces)
|
||||
{
|
||||
foreach (SyntaxTree.unit_or_namespace ns in namespaces)
|
||||
using_list.AddElement(GetNamespace(using_list, SyntaxTree.Utils.IdentListToString(ns.name.idents, "."), ns, possible_is_units));
|
||||
using_list.AddElement(GetNamespace(using_list, SyntaxTree.Utils.IdentListToString(ns.name.idents, "."), ns, possible_is_units, pabc_namespaces));
|
||||
}
|
||||
|
||||
public void AddNamespaces(TreeRealization.using_namespace_list using_list, SyntaxTree.using_list ul)
|
||||
{
|
||||
if (ul != null)
|
||||
AddNamespaces(using_list, ul.namespaces, false);
|
||||
AddNamespaces(using_list, ul.namespaces, false, null);
|
||||
}
|
||||
|
||||
public SyntaxTree.using_list GetInterfaceSyntaxUsingList(SyntaxTree.compilation_unit cu)
|
||||
|
|
@ -2912,19 +3067,6 @@ namespace PascalABCCompiler
|
|||
string SourceFileName = FindSourceFileName(Path.Combine(Path.GetDirectoryName(UnitName), Path.GetFileNameWithoutExtension(UnitName)));
|
||||
try
|
||||
{
|
||||
//TODO: подумать как это нормально сделать
|
||||
/*if (CompilerOptions.Debug)
|
||||
{
|
||||
PCUReader.PCUFileHeadState PCUFileHeadState = PCUReader.GetPCUFileHeadState(UnitName);
|
||||
if (PCUFileHeadState.IsPCUFile &&
|
||||
PCUFileHeadState.SupportedVersion &&
|
||||
!PCUFileHeadState.IncludetDebugInfo &&
|
||||
SourceFileName != null)
|
||||
{
|
||||
//перекомпилируем файл для получения отладочной информации
|
||||
throw new Exception("");
|
||||
}
|
||||
}*/
|
||||
if ((CurrentUnit = ReadPCU(UnitName)) != null)
|
||||
{
|
||||
Units.AddElement(CurrentUnit.SemanticTree);
|
||||
|
|
@ -2979,6 +3121,7 @@ namespace PascalABCCompiler
|
|||
if (errorsList.Count == 0) // SSM 2/05/16 - для преобразования синтаксических деревьев извне
|
||||
{
|
||||
CurrentUnit.SyntaxTree = syntaxTreeConvertersController.Convert(CurrentUnit.SyntaxTree) as SyntaxTree.compilation_unit;
|
||||
|
||||
}
|
||||
|
||||
if (errorsList.Count == 0 && need_gen_doc(CurrentUnit.SyntaxTree))
|
||||
|
|
@ -3053,7 +3196,7 @@ namespace PascalABCCompiler
|
|||
}
|
||||
}
|
||||
TreeRealization.unit_node_list References = GetReferences(CurrentUnit);
|
||||
|
||||
var namespaces = IncludeNamespaces(CurrentUnit);
|
||||
if (SyntaxUsesList != null)
|
||||
{
|
||||
|
||||
|
|
@ -3098,9 +3241,9 @@ namespace PascalABCCompiler
|
|||
|
||||
CurrentUnit.InterfaceUsedUnits.AddRange(References);
|
||||
|
||||
AddNamespaces(CurrentUnit.InterfaceUsingNamespaceList, CurrentUnit.PossibleNamespaces, true);
|
||||
AddNamespaces(CurrentUnit.InterfaceUsingNamespaceList, CurrentUnit.PossibleNamespaces, true, namespaces);
|
||||
AddNamespaces(CurrentUnit.InterfaceUsingNamespaceList, GetInterfaceSyntaxUsingList(CurrentUnit.SyntaxTree));
|
||||
|
||||
|
||||
//Console.WriteLine("Compile Interface "+UnitName);//DEBUG
|
||||
#if DEBUG
|
||||
if (InternalDebug.SemanticAnalysis)
|
||||
|
|
@ -3163,7 +3306,7 @@ namespace PascalABCCompiler
|
|||
|
||||
CurrentCompilationUnit = CurrentUnit;
|
||||
|
||||
AddNamespaces(CurrentUnit.ImplementationUsingNamespaceList, CurrentUnit.PossibleNamespaces, true);
|
||||
AddNamespaces(CurrentUnit.ImplementationUsingNamespaceList, CurrentUnit.PossibleNamespaces, true, namespaces);
|
||||
AddNamespaces(CurrentUnit.ImplementationUsingNamespaceList, GetImplementationSyntaxUsingList(CurrentUnit.SyntaxTree));
|
||||
|
||||
if (!interfcompile)
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ICSharpCode.NRefactory">
|
||||
<HintPath>..\bin\ICSharpCode.NRefactory.dll</HintPath>
|
||||
<HintPath>..\Libraries\ICSharpCode.NRefactory.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Dynamic, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
|
||||
|
|
@ -105,7 +105,7 @@
|
|||
</Reference>
|
||||
<Reference Include="Microsoft.Scripting, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\bin\Microsoft.Scripting.dll</HintPath>
|
||||
<HintPath>..\Libraries\Microsoft.Scripting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
|
|
|
|||
|
|
@ -477,9 +477,10 @@ namespace PascalABCCompiler.PCU
|
|||
type_node tn = GetSpecialTypeReference(names[i].offset);
|
||||
if (tn is compiled_type_node)
|
||||
{
|
||||
if ((tn as compiled_type_node).scope == null)
|
||||
(tn as compiled_type_node).init_scope();
|
||||
(tn as compiled_type_node).scope.AddSymbol(names[i].name, si);
|
||||
compiled_type_node ctn = tn as compiled_type_node;
|
||||
if (ctn.scope == null)
|
||||
ctn.init_scope();
|
||||
ctn.scope.AddSymbol(names[i].name, si);
|
||||
}
|
||||
else if (tn is generic_instance_type_node)
|
||||
tn.Scope.AddSymbol(names[i].name, si);
|
||||
|
|
@ -2532,12 +2533,6 @@ namespace PascalABCCompiler.PCU
|
|||
private void RestoreAllFields(common_type_node ctn)
|
||||
{
|
||||
//восстанавливаем все методы
|
||||
|
||||
//(ssyy) Внимание!!! Данный код удваивает все методы!
|
||||
//Я изменил его.
|
||||
//DarkStar - посмотри: NETGenerator после этого кода
|
||||
//дважды переводит каждую функцию.
|
||||
//DarkStar: Да, Ты прав!. Метод я переписал.
|
||||
string[] mnames = class_names[ctn];
|
||||
WrappedClassScope wcs = ctn.scope as WrappedClassScope;
|
||||
foreach (string mname in mnames)
|
||||
|
|
@ -2908,10 +2903,6 @@ namespace PascalABCCompiler.PCU
|
|||
for (int i=0; i<num_nest_funcs; i++)
|
||||
cnfn.functions_nodes_list.AddElement(GetNestedFunction());
|
||||
//br.ReadInt32();//code;
|
||||
if (cnfn.name == "*")
|
||||
{
|
||||
|
||||
}
|
||||
cnfn.loc = ReadDebugInfo();
|
||||
cnfn.function_code = (restore_code /*|| cnfn.is_generic_function*/) ? GetCode(br.ReadInt32()) : new wrapped_function_body(this, br.ReadInt32());
|
||||
cnfn.ConnectedToType = ConnectedToType;
|
||||
|
|
|
|||
|
|
@ -824,7 +824,13 @@ namespace PascalABCCompiler.PCU
|
|||
{
|
||||
name_array[i] = new NameRef(cur_cnn.functions[i - j].name, i);
|
||||
if (cur_cnn.functions[i - j].ConnectedToType != null)
|
||||
{
|
||||
name_array[i].special_scope = 1;
|
||||
if (cur_cnn.functions[i - j].return_value_type != null)
|
||||
name_array[i].symbol_kind = symbol_kind.sk_overload_function;
|
||||
else
|
||||
name_array[i].symbol_kind = symbol_kind.sk_overload_procedure;
|
||||
}
|
||||
pools[cur_cnn.functions[i - j]] = name_array[i];
|
||||
}
|
||||
j = i;
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ using System.Runtime.CompilerServices;
|
|||
internal static class RevisionClass
|
||||
{
|
||||
public const string Major = "3";
|
||||
public const string Minor = "2";
|
||||
public const string Minor = "3";
|
||||
public const string Build = "0";
|
||||
public const string Revision = "1504";
|
||||
public const string Revision = "1541";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%MINOR%=2
|
||||
%REVISION%=1504
|
||||
%COREVERSION%=0
|
||||
%REVISION%=1541
|
||||
%MINOR%=3
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
54
InstallerSamples/Graph3D/All3DPrimitives.pas
Normal file
54
InstallerSamples/Graph3D/All3DPrimitives.pas
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
uses Graph3D;
|
||||
|
||||
begin
|
||||
Window.Title := '3D-ďđčěčňčâű';
|
||||
|
||||
//var a := Any(0,0,0,Colors.Red);
|
||||
//a.MoveOn(-5,2,0);
|
||||
|
||||
var rr := Rectangle3D(-3.5,-2,0,3,2,Colors.MediumPurple);
|
||||
rr.Rotate(v3d(0,1,0),30);
|
||||
|
||||
var ńňđĺëęč := CoordinateSystem(2);
|
||||
|
||||
var Ar := Arrow(3,0,0,0,0,2,Colors.Tan);
|
||||
|
||||
var p := P3D(5,-5,0);
|
||||
var t := TruncatedCone(p,2,0.9,0.7,False,Colors.Red);
|
||||
p := p.MoveX(-2);
|
||||
TruncatedCone(p,2,0.9,0.7,Colors.BlueViolet);
|
||||
p := p.MoveX(-2);
|
||||
Cylinder(p,2,0.9,False,Colors.Crimson);
|
||||
p := p.MoveX(-2);
|
||||
var cc := Cylinder(p,2,0.9,Colors.Chocolate);
|
||||
p := p.MoveX(-2);
|
||||
var ęîíóń := Cone(p,2.5,0.9,Colors.DarkGreen);
|
||||
p := p.MoveX(-2);
|
||||
var c := Sphere(p.MoveZ(0.7),1,Colors.Crimson);
|
||||
Text3D(p.MoveZ(2.3),'Ńôĺđŕ',0.7);
|
||||
|
||||
p := P3D(5,-2,0);
|
||||
var ÷ŕéíčę := Teapot(p.MoveZ(0.9),Colors.ForestGreen);
|
||||
//÷ŕéíčę.Rotate(V3D(0,1,0),45);
|
||||
var bb := BillboardText(p.Move(2,0,0.7),'Billboard'+NewLine + '"×ŕéíčę"',12);
|
||||
p := p.MoveX(-2.75);
|
||||
var cb := Cube(p.MoveZ(0.75),1.5,Colors.DodgerBlue);
|
||||
cb.Scale(1.2);
|
||||
cb.Rotate(V3D(0,0,1),45);
|
||||
p := p.MoveX(-2.75);
|
||||
var b := Box(p,Sz3D(2,1,1),Colors.PaleGreen);
|
||||
b.Rotate(V3D(0,1,0),-30);
|
||||
p := P3D(5,1,0);
|
||||
var ýëëčďńîčä := Ellipsoid(p.MoveZ(0.6),1.3,0.8,0.6,Colors.Violet);
|
||||
p := p.MoveX(-7);
|
||||
var pp := Tube(p,2,0.7,0.5,Colors.DodgerBlue);
|
||||
//View3D.Save('a2.jpg');
|
||||
|
||||
{while True do
|
||||
begin
|
||||
÷ŕéíčę.Rotate(V3D(0,0,1),10.8);
|
||||
ýëëčďńîčä.Rotate(V3D(0,0,1),-5.8);
|
||||
ńňđĺëęč.Rotate(V3D(0,0,1),1);
|
||||
Sleep(50);
|
||||
end;}
|
||||
end.
|
||||
BIN
InstallerSamples/Graph3D/Earth.jpg
Normal file
BIN
InstallerSamples/Graph3D/Earth.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 437 KiB |
25
InstallerSamples/Graph3D/EarthImageMaterial.pas
Normal file
25
InstallerSamples/Graph3D/EarthImageMaterial.pas
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
uses Graph3D;
|
||||
|
||||
begin
|
||||
View3D.Title := 'Âðàùåíèå Çåìëè';
|
||||
View3D.CameraMode := CameraMode.Inspect;
|
||||
View3D.ShowCoordinateSystem := False;
|
||||
View3D.ShowGridLines := False;
|
||||
View3D.ShowViewCube := False;
|
||||
View3D.ShowCameraInfo := False;
|
||||
View3D.BackgroundColor := Colors.Black;
|
||||
|
||||
var c := Sphere(0,0,0,5,Colors.Wheat);
|
||||
c.Material := ImageMaterial('Earth.jpg');
|
||||
var gr := 0;
|
||||
var dgr := 1;
|
||||
while True do
|
||||
begin
|
||||
c.Rotate(V3D(0,0,1),1);
|
||||
Sleep(10);
|
||||
gr += dgr;
|
||||
if (gr<=0) or (gr>=255) then
|
||||
dgr := - dgr;
|
||||
View3D.BackgroundColor := RGB(gr,gr,gr);
|
||||
end;
|
||||
end.
|
||||
16
InstallerSamples/Graph3D/pr3.pas
Normal file
16
InstallerSamples/Graph3D/pr3.pas
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
uses Graph3D;
|
||||
|
||||
begin
|
||||
View3D.Title := 'Äâèãàéòå ÷àéíèê ïðè ïîìîùè ñòðåëîê';
|
||||
var t := Teapot(0, 0, 1, Colors.Green);
|
||||
OnKeyDown := k -> begin
|
||||
case k of
|
||||
Key.Left: t.X += 1;
|
||||
Key.Right: t.X -= 1;
|
||||
Key.Down: t.Y += 1;
|
||||
Key.Up: t.Y -= 1;
|
||||
Key.PageUp: t.Z += 1;
|
||||
Key.PageDown: t.Z -= 1;
|
||||
end;
|
||||
end;
|
||||
end.
|
||||
22
InstallerSamples/Graph3D/pr4_Planes.pas
Normal file
22
InstallerSamples/Graph3D/pr4_Planes.pas
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
uses Graph3D;
|
||||
|
||||
begin
|
||||
View3D.ShowGridLines := False;
|
||||
|
||||
Camera.Position := P3D(12,16,24);
|
||||
Camera.LookDirection := Camera.Position.Multiply(-1).ToVector3D;
|
||||
|
||||
var sz := 12;
|
||||
var alpha := 100;
|
||||
var planeXZ := Rectangle3D(0,0,0,sz,sz,V3D(0,1,0),Colors.Green.ChangeAlpha(alpha));
|
||||
var planeXY := Rectangle3D(0,0,0,sz,sz,V3D(0,0,1),Colors.Blue.ChangeAlpha(alpha));
|
||||
var planeYZ := Rectangle3D(0,0,0,sz,sz,V3D(1,0,0),V3D(0,1,0),Colors.Red.ChangeAlpha(alpha));
|
||||
BillboardText(sz/2,sz/2,0,'XY',20);
|
||||
BillboardText(0,sz/2,sz/2,'YZ',20);
|
||||
BillboardText(sz/2,0,sz/2,'XZ',20);
|
||||
var len := 8;
|
||||
CoordinateSystem(len,0.3);
|
||||
BillboardText(len+0.5,0,0,'X',20);
|
||||
BillboardText(0,len+0.5,0,'Y',20);
|
||||
BillboardText(0,0,len+0.5,'Z',20);
|
||||
end.
|
||||
27
InstallerSamples/Graph3D/pr5_cam.pas
Normal file
27
InstallerSamples/Graph3D/pr5_cam.pas
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
uses Graph3D;
|
||||
|
||||
begin
|
||||
Window.Title := 'Âðàùåíèå êàìåðû';
|
||||
var tp := Teapot(0,0,2,Colors.Green);
|
||||
tp.Scale(2);
|
||||
Camera.Position := P3D(8,16,20);
|
||||
Camera.LookDirection := Camera.Position.Multiply(-1).ToVector3D;
|
||||
var d := 26.0;
|
||||
{loop 200 do
|
||||
begin
|
||||
Sleep(20);
|
||||
Camera.SetDistanse(d);
|
||||
d -= 0.05;
|
||||
end;}
|
||||
var t := 0.0;
|
||||
while True do
|
||||
begin
|
||||
Sleep(10);
|
||||
Camera.Position := P3D(15*cos(t),15*sin(t),10);
|
||||
Camera.UpDirection := V3D(0,0,1);
|
||||
//Camera.LookDirection := Camera.Position.Multiply(-1).ToVector3D;
|
||||
t += 2*Pi/360/2;
|
||||
end;
|
||||
|
||||
Camera.LookDirection := Camera.Position.Multiply(-1).ToVector3D;
|
||||
end.
|
||||
23
InstallerSamples/Graph3D/Часы.pas
Normal file
23
InstallerSamples/Graph3D/Часы.pas
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
uses Graph3D;
|
||||
|
||||
begin
|
||||
View3D.ShowGridLines := False;
|
||||
var Öèôåðáëàò := Cylinder(0,0,-0.4,0.2,6,Colors.DeepPink);
|
||||
var Ñåê := Arrow(0,0,0,0,-5.5,0,0.2,Colors.Yellow);
|
||||
var Ìèí := Arrow(0,0,0,0,-6.0,0,0.3,Colors.Red);
|
||||
|
||||
var a := 0;
|
||||
var r := 5.8;
|
||||
loop 60 do
|
||||
begin
|
||||
Sphere(r*cos(a*Pi/180),r*sin(a*Pi/180),-0.2,0.1,Colors.White);
|
||||
a += 6;
|
||||
end;
|
||||
|
||||
while True do
|
||||
begin
|
||||
Sleep(10);
|
||||
Ñåê.Rotate(v3D(0,0,1),-6);
|
||||
Ìèí.Rotate(v3D(0,0,1),-6/60);
|
||||
end;
|
||||
end.
|
||||
15
InstallerSamples/Graphics/GraphWPF/ArcSector.pas
Normal file
15
InstallerSamples/Graphics/GraphWPF/ArcSector.pas
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
uses GraphWPF;
|
||||
|
||||
begin
|
||||
Window.Title := 'Äóãè è ñåêòîðû';
|
||||
var (x,y) := (200,Window.Height/2);
|
||||
Circle(x,y,5);
|
||||
for var i:=1 to 18*2 do
|
||||
Arc(x,y,5*i,0,10*i);
|
||||
(x,y) := (600,Window.Height/2);
|
||||
for var i:=1 to 12 do
|
||||
begin
|
||||
Brush.Color := RandomColor;
|
||||
Sector(x,y,180,30*(i-1),30*i);
|
||||
end;
|
||||
end.
|
||||
12
InstallerSamples/Graphics/GraphWPF/Clock.pas
Normal file
12
InstallerSamples/Graphics/GraphWPF/Clock.pas
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
uses GraphWPF;
|
||||
|
||||
begin
|
||||
Window.Title := 'Öèôðîâûå ÷àñû';
|
||||
Font.Size := 180;
|
||||
while True do
|
||||
begin
|
||||
DrawText(Window.ClientRect,System.DateTime.Now.ToLongTimeString,Colors.Red);
|
||||
Sleep(1000);
|
||||
Window.Clear;
|
||||
end;
|
||||
end.
|
||||
36
InstallerSamples/Graphics/GraphWPF/CurjaMurja.pas
Normal file
36
InstallerSamples/Graphics/GraphWPF/CurjaMurja.pas
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
uses GraphWPF;
|
||||
|
||||
begin
|
||||
Window.Title := 'Âñÿêàÿ Êóðüÿ Ìóðüÿ';
|
||||
Pen.Width := 0.5;
|
||||
Brush.Color := RGB(128,200,100);
|
||||
Ellipse(100,100,30,20);
|
||||
Brush.Color := RandomColor;
|
||||
Circle(170,100,20);
|
||||
Brush.Color := RandomColor;
|
||||
Rectangle(220,80,70,50);
|
||||
Line(220,80,220+70,80+50);
|
||||
//DrawImage(200,140,'cofe.jpg');
|
||||
Brush.Color := RGB(200,200,255);
|
||||
Polygon(Arr(Pnt(20,20),Pnt(20,120),Pnt(120,20)));
|
||||
Brush.Color := Colors.Black;
|
||||
for var i:=0 to 400 do
|
||||
Rectangle(1+2*i,2,0,0);
|
||||
Font.Size := 30;
|
||||
Font.Color := Colors.Red;
|
||||
TextOut(0,0,'Hello');
|
||||
Font.Size := 40;
|
||||
Font.Color := Colors.Blue;
|
||||
Font.Name := 'Times New Roman';
|
||||
Font.Style := FontStyle.BoldItalic;
|
||||
TextOut(200,0,'Ïðèâåò');
|
||||
Sleep(1000);
|
||||
Window.Save('1.png');
|
||||
Window.Title := 'Ñîõðàíèëè';
|
||||
Sleep(1000);
|
||||
Window.Clear;
|
||||
Window.Title := 'Î÷èñòèëè';
|
||||
Sleep(1000);
|
||||
Window.Load('1.png');
|
||||
Window.Title := 'Çàãðóçèëè';
|
||||
end.
|
||||
11
InstallerSamples/Graphics/GraphWPF/DrawGraphic.pas
Normal file
11
InstallerSamples/Graphics/GraphWPF/DrawGraphic.pas
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
uses GraphWPF;
|
||||
|
||||
begin
|
||||
Window.Title := 'Ãðàôèêè ôóíêöèé';
|
||||
var ww := Window.Width / 2;
|
||||
var hh := Window.Height / 2;
|
||||
DrawGraph(x -> sin(4 * x) + cos(3 * x), -5, 5, 0, 0, ww, hh);
|
||||
DrawGraph(x -> x * x, -5, 5, ww - 1, 0, ww, hh);
|
||||
DrawGraph(x -> exp(x), -5, 5, 0, hh-1, ww, hh);
|
||||
DrawGraph(x -> x*cos(2*x-1), -5, 5, ww - 1, hh-1, ww, hh);
|
||||
end.
|
||||
7
InstallerSamples/Graphics/GraphWPF/EllRectInWindow.pas
Normal file
7
InstallerSamples/Graphics/GraphWPF/EllRectInWindow.pas
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
uses GraphWPF;
|
||||
|
||||
begin
|
||||
Pen.Width := 1;
|
||||
Rectangle(0,0,Window.Width-1,Window.Height-1);
|
||||
Ellipse((Window.Width-1)/2,(Window.Height-1)/2,(Window.Width-1)/2,(Window.Height-1)/2);
|
||||
end.
|
||||
14
InstallerSamples/Graphics/GraphWPF/Ellipses.pas
Normal file
14
InstallerSamples/Graphics/GraphWPF/Ellipses.pas
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
uses GraphWPF;
|
||||
|
||||
begin
|
||||
Window.Title := 'Ðèñîâàíèå ýëëèïñîâ';
|
||||
Pen.Width := 1;
|
||||
var n := 20000;
|
||||
for var i:=1 to n do
|
||||
begin
|
||||
if i mod 10000 = 0 then
|
||||
Println(i,MillisecondsDelta);
|
||||
Brush.Color := RandomColor;
|
||||
Ellipse(Random(800),Random(600),Random(20),Random(20));
|
||||
end;
|
||||
end.
|
||||
16
InstallerSamples/Graphics/GraphWPF/anim1.pas
Normal file
16
InstallerSamples/Graphics/GraphWPF/anim1.pas
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
uses GraphWPF;
|
||||
|
||||
begin
|
||||
Window.Title := 'Ïðîñòàÿ àíèìàöèÿ';
|
||||
var x := 30;
|
||||
Brush.Color := Colors.Beige;
|
||||
Circle(x,50,20);
|
||||
loop 600 do
|
||||
begin
|
||||
Sleep(10);
|
||||
Window.Clear;
|
||||
x += 1;
|
||||
Circle(x,50,20);
|
||||
Window.Title := '' + (Milliseconds div 100)/10;
|
||||
end;
|
||||
end.
|
||||
25
InstallerSamples/Graphics/GraphWPF/anim2.pas
Normal file
25
InstallerSamples/Graphics/GraphWPF/anim2.pas
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
uses GraphWPF;
|
||||
|
||||
begin
|
||||
Window.Title := 'Îòðàæåíèå øàðèêà. Âåùåñòâåííîå íàïðàâëåíèå äâèæåíèÿ';
|
||||
Brush.Color := Colors.Beige;
|
||||
var x := 400.0;
|
||||
var y := 300.0;
|
||||
var dx := 2.1;
|
||||
var dy := -1.2;
|
||||
Circle(x,y,20);
|
||||
while True do
|
||||
begin
|
||||
Sleep(10);
|
||||
Window.Clear;
|
||||
x += dx;
|
||||
y += dy;
|
||||
if not x.Between(0,Window.Width) then
|
||||
dx := -dx;
|
||||
if not y.Between(0,Window.Height) then
|
||||
dy := -dy;
|
||||
Circle(x,y,20);
|
||||
if Milliseconds>2000 then
|
||||
Window.Title := 'Ñåêóíäû: ' + (Milliseconds div 100)/10;
|
||||
end;
|
||||
end.
|
||||
45
InstallerSamples/Graphics/GraphWPF/anim4.pas
Normal file
45
InstallerSamples/Graphics/GraphWPF/anim4.pas
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
uses GraphWPF;
|
||||
|
||||
function RandomReal(a,b: real): real := Random*(b-a)+a;
|
||||
|
||||
type
|
||||
BallInfo = auto class
|
||||
x,y,r,dx,dy: real;
|
||||
c: Color;
|
||||
procedure Move := (x,y) := (x+dx,y+dy);
|
||||
procedure Draw := FillCircle(x,y,r,c);
|
||||
procedure CheckDirection;
|
||||
begin
|
||||
if not x.Between(r,Window.Width-r) then
|
||||
dx := -dx;
|
||||
if not y.Between(r,Window.Height-r) then
|
||||
dy := -dy;
|
||||
end;
|
||||
procedure Step;
|
||||
begin
|
||||
Move;
|
||||
CheckDirection;
|
||||
Draw;
|
||||
end;
|
||||
class function CreateRandomBallArray(n: integer): array of BallInfo;
|
||||
begin
|
||||
var rr := 20;
|
||||
Result := ArrGen(n,i->new BallInfo(RandomReal(rr,Window.Width-rr),
|
||||
RandomReal(rr,Window.Height-rr),RandomReal(5,15),
|
||||
RandomReal(-3,3),RandomReal(-3,3),RandomColor));
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
Window.Title := 'Îòðàæåíèå øàðèêîâ. Àíèìàöèÿ íà îñíîâå êàäðà';
|
||||
|
||||
var n := 1000;
|
||||
var a := BallInfo.CreateRandomBallArray(n);
|
||||
|
||||
BeginFrameBasedAnimation(()->
|
||||
foreach var ball in a do
|
||||
ball.Step
|
||||
);
|
||||
|
||||
//BeginFrameBasedAnimation(()->a.ForEach(ball->ball.Step));
|
||||
end.
|
||||
6
InstallerSamples/Graphics/GraphWPF/mouse1.pas
Normal file
6
InstallerSamples/Graphics/GraphWPF/mouse1.pas
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
uses GraphWPF;
|
||||
|
||||
begin
|
||||
OnMouseDown := (x,y,mb) -> if mb=1 then Circle(x,y,5);
|
||||
OnKeyDown := k -> Print(k);
|
||||
end.
|
||||
10
InstallerSamples/Graphics/GraphWPF/mouse2.pas
Normal file
10
InstallerSamples/Graphics/GraphWPF/mouse2.pas
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
uses GraphWPF;
|
||||
|
||||
begin
|
||||
Window.Title := 'Ðèñîâàíèå ìûøüþ';
|
||||
Pen.Color := Colors.Blue;
|
||||
Pen.Width := 3;
|
||||
OnMouseDown := (x,y,mb) -> MoveTo(x,y);
|
||||
OnMouseMove := (x,y,mb) -> if mb=1 then LineTo(x,y);
|
||||
OnKeyDown := k -> if k = Key.Space then Window.Save('a.png');
|
||||
end.
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
uses GraphWPF;
|
||||
|
||||
procedure ÂñåÒî÷êèÌíîãîóãîëüíèêà(x0,y0,r: real; n: integer);
|
||||
begin
|
||||
var q := Partition(0,2*Pi,n).Select(a->Pnt(x0 + r * Cos(a), y0 - r * Sin(a)));
|
||||
q.Cartesian(q).ForEach(p->Line(p[0].x,p[0].y,p[1].x,p[1].y,RandomColor));
|
||||
end;
|
||||
|
||||
begin
|
||||
Pen.Width := 0.5;
|
||||
ÂñåÒî÷êèÌíîãîóãîëüíèêà(400,300,290,30)
|
||||
end.
|
||||
30
InstallerSamples/Graphics/GraphWPF/ВыравниваниеТекста1.pas
Normal file
30
InstallerSamples/Graphics/GraphWPF/ВыравниваниеТекста1.pas
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
uses GraphWPF;
|
||||
|
||||
begin
|
||||
Window.Title := 'Âûðàâíèâàíèå øðèôòà';
|
||||
Font.Size := 20;
|
||||
var (x,y) := (200,200);
|
||||
var (w,h) := (400,200);
|
||||
DrawRectangle(x,y,w,h);
|
||||
DrawText(x,y,w,h,'LeftTop',Alignment.LeftTop);
|
||||
DrawText(x,y,w,h,'LeftCenter',Alignment.LeftCenter);
|
||||
DrawText(x,y,w,h,'LeftBottom',Alignment.LeftBottom);
|
||||
DrawText(x,y,w,h,'CenterTop',Alignment.CenterTop);
|
||||
DrawText(x,y,w,h,'Center');
|
||||
DrawText(x,y,w,h,'CenterBottom',Alignment.CenterBottom);
|
||||
DrawText(x,y,w,h,'RightTop',Alignment.RightTop);
|
||||
DrawText(x,y,w,h,'RightCenter',Alignment.RightCenter);
|
||||
DrawText(x,y,w,h,'RightBottom',Alignment.RightBottom);
|
||||
// Âûðàâíèâàíèå îòíîñèòåëüíî òî÷êè
|
||||
TextOut(150,100,'PointRightBottom',Alignment.RightBottom);
|
||||
TextOut(150,100,'PointRightTop',Alignment.RightTop);
|
||||
TextOut(150,100,'PointLeftTop',Alignment.LeftTop);
|
||||
TextOut(150,100,'PointLeftBottom',Alignment.LeftBottom);
|
||||
FillCircle(150,100,5,Colors.Red);
|
||||
TextOut(600,100,'PointCenterTop',Alignment.CenterTop);
|
||||
TextOut(600,100,'PointCenterBottom',Alignment.CenterBottom);
|
||||
FillCircle(600,100,5,Colors.Red);
|
||||
TextOut(400,500,'PointLeftCenter',Alignment.LeftCenter);
|
||||
TextOut(400,500,'PointRightCenter',Alignment.RightCenter);
|
||||
FillCircle(400,500,5,Colors.Red);
|
||||
end.
|
||||
34
InstallerSamples/Graphics/GraphWPF/ВыравниваниеТекста2.pas
Normal file
34
InstallerSamples/Graphics/GraphWPF/ВыравниваниеТекста2.pas
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
uses GraphWPF;
|
||||
|
||||
begin
|
||||
Window.Title := 'Âûðàâíèâàíèå øðèôòà';
|
||||
Font.Size := 20;
|
||||
|
||||
var sc := 40;
|
||||
SetMathematicCoords;
|
||||
|
||||
var (x,y) := (-5,-2);
|
||||
var (w,h) := (10,4);
|
||||
DrawRectangle(x,y,w,h);
|
||||
DrawText(x,y,w,h,'LeftTop',Alignment.LeftTop);
|
||||
DrawText(x,y,w,h,'LeftCenter',Alignment.LeftCenter);
|
||||
DrawText(x,y,w,h,'LeftBottom',Alignment.LeftBottom);
|
||||
DrawText(x,y,w,h,'CenterTop',Alignment.CenterTop);
|
||||
DrawText(x,y,w,h,'Center');
|
||||
DrawText(x,y,w,h,'CenterBottom',Alignment.CenterBottom);
|
||||
DrawText(x,y,w,h,'RightTop',Alignment.RightTop);
|
||||
DrawText(x,y,w,h,'RightCenter',Alignment.RightCenter);
|
||||
DrawText(x,y,w,h,'RightBottom',Alignment.RightBottom);
|
||||
// Âûðàâíèâàíèå îòíîñèòåëüíî òî÷êè
|
||||
TextOut(-5,5,'PointRightBottom',Alignment.RightBottom);
|
||||
TextOut(-5,5,'PointRightTop',Alignment.RightTop);
|
||||
TextOut(-5,5,'PointLeftTop',Alignment.LeftTop);
|
||||
TextOut(-5,5,'PointLeftBottom',Alignment.LeftBottom);
|
||||
FillCircle(-5,5,0.1,Colors.Red);
|
||||
TextOut(5,5,'PointCenterTop',Alignment.CenterTop);
|
||||
TextOut(5,5,'PointCenterBottom',Alignment.CenterBottom);
|
||||
FillCircle(5,5,0.1,Colors.Red);
|
||||
TextOut(5,-5,'PointLeftCenter',Alignment.LeftCenter);
|
||||
TextOut(5,-5,'PointRightCenter',Alignment.RightCenter);
|
||||
FillCircle(5,-5,0.1,Colors.Red);
|
||||
end.
|
||||
20
InstallerSamples/Graphics/GraphWPF/Многоугольник.pas
Normal file
20
InstallerSamples/Graphics/GraphWPF/Многоугольник.pas
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
uses GraphWPF;
|
||||
|
||||
procedure Ìíîãîóãîëüíèê(x0,y0,r: real; n: integer);
|
||||
begin
|
||||
var a := Pi / 2;
|
||||
MoveTo(x0 + r * Cos(a), y0 - r * Sin(a));
|
||||
loop n do
|
||||
begin
|
||||
a += 2 * Pi / n;
|
||||
//FillCircle(x0 + r * Cos(a), y0 - r * Sin(a),3,Colors.Black);
|
||||
LineTo(x0 + r * Cos(a), y0 - r * Sin(a));
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
var (x0,y0) := (400.0,300.0);
|
||||
var r := 30.0;
|
||||
for var n := 3 to 11 do
|
||||
Ìíîãîóãîëüíèê(x0,y0,r+(n-3)*30,n)
|
||||
end.
|
||||
19
InstallerSamples/Graphics/GraphWPF/Светофор.pas
Normal file
19
InstallerSamples/Graphics/GraphWPF/Светофор.pas
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
uses GraphWPF;
|
||||
|
||||
procedure Ñâåòîôîð(x,y,r: real);
|
||||
begin
|
||||
Rectangle(x,y,4*r,10*r,Colors.LightGray);
|
||||
x += 2*r;
|
||||
y += 2*r;
|
||||
var dy := 3*r;
|
||||
|
||||
Circle(x,y,r,Colors.Red);
|
||||
Circle(x,y + dy,r,Colors.Yellow);
|
||||
Circle(x,y + 2*dy,r,Colors.Green);
|
||||
end;
|
||||
|
||||
begin
|
||||
Pen.Width := 2;
|
||||
Window.Title := 'Ñâåòîôîð';
|
||||
Ñâåòîôîð(150,40,50);
|
||||
end.
|
||||
18
InstallerSamples/Graphics/GraphWPF/Система координат.pas
Normal file
18
InstallerSamples/Graphics/GraphWPF/Система координат.pas
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
uses GraphWPF;
|
||||
|
||||
begin
|
||||
Window.Title := 'Ñèñòåìà êîîðäèíàò';
|
||||
Font.Size := 20;
|
||||
|
||||
// SetMathematicCoords; // òàê òîæå ìîæíî
|
||||
// SetMathematicCoords(-10,10); // òàê òîæå ìîæíî
|
||||
SetMathematicCoords(-10,10,-9.2);
|
||||
DrawGrid;
|
||||
|
||||
Print('Âèäèìûå êîîðäèíàòû:',XMin,XMax,YMin,YMax);
|
||||
|
||||
Polygon(Arr((-3,2),(2,1),(-2,-4)),ARGB(100,255,228,196));
|
||||
TextOut(-3,2,'A(-3,2)',Alignment.RightBottom);
|
||||
TextOut(2,1,'B(2,1)',Alignment.LeftBottom);
|
||||
TextOut(-2,-4,'C(-2,-4)',Alignment.CenterTop);
|
||||
end.
|
||||
16
InstallerSamples/Graphics/GraphWPF/ТаблицаУмножения.pas
Normal file
16
InstallerSamples/Graphics/GraphWPF/ТаблицаУмножения.pas
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
uses GraphWPF;
|
||||
|
||||
begin
|
||||
Window.Title := 'Òàáëèöà óìíîæåíèÿ';
|
||||
Font.Size := 16;
|
||||
var n := 9;
|
||||
var w := 40;
|
||||
var (x0,y0) := (50,50);
|
||||
for var i:=0 to n-1 do
|
||||
for var j:=0 to n-1 do
|
||||
begin
|
||||
var (xx,yy) := (x0+i*w,y0+j*w);
|
||||
Rectangle(xx,yy,w,w);
|
||||
DrawText(xx,yy,w,w,(i+1)*(j+1));
|
||||
end;
|
||||
end.
|
||||
Binary file not shown.
|
|
@ -193,14 +193,16 @@ namespace PascalABCCompiler.NETGenerator
|
|||
return true;
|
||||
}
|
||||
|
||||
public void EnterSafeBlock()
|
||||
public bool EnterSafeBlock()
|
||||
{
|
||||
bool tmp = safe_block;
|
||||
safe_block = true;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public void LeaveSafeBlock()
|
||||
public void LeaveSafeBlock(bool value)
|
||||
{
|
||||
safe_block = false;
|
||||
safe_block = value;
|
||||
}
|
||||
|
||||
protected void MarkSequencePoint(SemanticTree.ILocation Location)
|
||||
|
|
@ -1258,7 +1260,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
private void AddTypeWithoutConvert(ICommonTypeNode t)
|
||||
{
|
||||
if (helper.GetTypeReference(t) != null) return;
|
||||
TypeBuilder tb = mb.DefineType(cur_unit + "." + t.name, ConvertAttributes(t), null, new Type[0]);
|
||||
TypeBuilder tb = mb.DefineType(BuildTypeName(t.name), ConvertAttributes(t), null, new Type[0]);
|
||||
helper.AddType(t, tb);
|
||||
//(ssyy) обрабатываем generics
|
||||
if (t.is_generic_type_definition)
|
||||
|
|
@ -1862,6 +1864,13 @@ namespace PascalABCCompiler.NETGenerator
|
|||
}
|
||||
}
|
||||
|
||||
private string BuildTypeName(string type_name)
|
||||
{
|
||||
if (type_name.IndexOf(".") == -1)
|
||||
return cur_unit + "." + type_name;
|
||||
return type_name;
|
||||
}
|
||||
|
||||
//Перевод заголовка типа
|
||||
private void ConvertTypeHeader(ICommonTypeNode value)
|
||||
{
|
||||
|
|
@ -1924,7 +1933,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
ta = TypeAttributes.Public;
|
||||
if (value.type_access_level == type_access_level.tal_internal)
|
||||
ta = TypeAttributes.NotPublic;
|
||||
EnumBuilder emb = mb.DefineEnum(cur_unit + "." + value.name, ta, TypeFactory.Int32Type);
|
||||
EnumBuilder emb = mb.DefineEnum(BuildTypeName(value.name), ta, TypeFactory.Int32Type);
|
||||
//int num = 0;
|
||||
foreach (IClassConstantDefinitionNode ccfn in value.constants)
|
||||
{
|
||||
|
|
@ -1938,7 +1947,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
{
|
||||
if (not_exist)
|
||||
{
|
||||
tb = mb.DefineType(cur_unit + "." + value.name, ta, null, interfaces);
|
||||
tb = mb.DefineType(BuildTypeName(value.name), ta, null, interfaces);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2351,7 +2360,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
funcs.Add(func); //здесь наверное дублирование
|
||||
MethodBuilder tmp = cur_meth;
|
||||
cur_meth = methb;
|
||||
ConvertCommonFunctionConstantDefinitions(func.constants);
|
||||
|
||||
//если функция не содержит вложенных процедур, то
|
||||
//переводим переменные как локальные
|
||||
if (func.functions_nodes.Length > 0)
|
||||
|
|
@ -2413,6 +2422,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
il = cur_meth.GetILGenerator();
|
||||
smi.Push(mi);
|
||||
funcs.Add(func);
|
||||
ConvertCommonFunctionConstantDefinitions(func.constants);
|
||||
if (func.functions_nodes.Length == 0)
|
||||
ConvertLocalVariables(func.var_definition_nodes);
|
||||
|
||||
|
|
@ -5326,7 +5336,10 @@ namespace PascalABCCompiler.NETGenerator
|
|||
{
|
||||
if (save_debug_info)
|
||||
{
|
||||
MarkSequencePoint(value.LeftLogicalBracketLocation);
|
||||
if (gen_left_brackets)
|
||||
MarkSequencePoint(value.LeftLogicalBracketLocation);
|
||||
else
|
||||
il.MarkSequencePoint(doc, 0xFeeFee, 0xFeeFee, 0xFeeFee, 0xFeeFee);
|
||||
//il.MarkSequencePoint(doc,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF);
|
||||
il.Emit(OpCodes.Nop);
|
||||
}
|
||||
|
|
@ -5368,14 +5381,16 @@ namespace PascalABCCompiler.NETGenerator
|
|||
|
||||
public override void visit(SemanticTree.IStatementsListNode value)
|
||||
{
|
||||
//TODO: переделать. придумать как.
|
||||
IStatementNode[] statements = value.statements;
|
||||
if (save_debug_info)
|
||||
{
|
||||
MarkSequencePoint(value.LeftLogicalBracketLocation);
|
||||
//il.MarkSequencePoint(doc,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF);
|
||||
if (gen_left_brackets || value.LeftLogicalBracketLocation == null)
|
||||
MarkSequencePoint(value.LeftLogicalBracketLocation);
|
||||
else
|
||||
il.MarkSequencePoint(doc, 0xFeeFee, 0xFeeFee, 0xFeeFee, 0xFeeFee);
|
||||
il.Emit(OpCodes.Nop);
|
||||
}
|
||||
IStatementNode[] statements = value.statements;
|
||||
|
||||
ILocalBlockVariableNode[] localVariables = value.LocalVariables;
|
||||
for (int i = 0; i < localVariables.Length; i++)
|
||||
{
|
||||
|
|
@ -5482,11 +5497,9 @@ namespace PascalABCCompiler.NETGenerator
|
|||
}
|
||||
|
||||
private bool gen_right_brackets = true;
|
||||
private bool gen_left_brackets = true;
|
||||
public override void visit(SemanticTree.IForNode value)
|
||||
{
|
||||
//if (save_debug_info)
|
||||
// MarkSequencePoint(value.Location);
|
||||
|
||||
Label l1 = il.DefineLabel();
|
||||
Label l2 = il.DefineLabel();
|
||||
Label lcont = il.DefineLabel();
|
||||
|
|
@ -5507,18 +5520,14 @@ namespace PascalABCCompiler.NETGenerator
|
|||
labels.Push(lbreak);
|
||||
clabels.Push(lcont);
|
||||
bool tmp_rb = gen_right_brackets;
|
||||
bool tmp_lb = gen_left_brackets;
|
||||
gen_right_brackets = false;
|
||||
gen_left_brackets = false;
|
||||
ConvertStatement(value.body);
|
||||
gen_right_brackets = tmp_rb;
|
||||
|
||||
gen_left_brackets = tmp_lb;
|
||||
il.MarkLabel(lcont);
|
||||
|
||||
//tmp = save_debug_info;
|
||||
//save_debug_info = false;
|
||||
//if (save_debug_info) MarkForCicles(value.Location, value.increment_statement.Location);
|
||||
tmp = save_debug_info;
|
||||
//if (save_debug_info) MarkSequencePoint(il, value.initialization_statement.Location.begin_line_num, 0, value.initialization_statement.Location.begin_line_num,20);
|
||||
//save_debug_info = false;
|
||||
|
||||
if (value.init_while_expr == null)
|
||||
{
|
||||
|
|
@ -5527,7 +5536,6 @@ namespace PascalABCCompiler.NETGenerator
|
|||
ConvertStatement(value.increment_statement);
|
||||
save_debug_info = tmp;
|
||||
}
|
||||
//save_debug_info = tmp;
|
||||
il.MarkLabel(l1);
|
||||
MarkSequencePoint(il, value.increment_statement.Location);
|
||||
value.while_expr.visit(this);
|
||||
|
|
@ -5545,10 +5553,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
il.Emit(OpCodes.Br, l2);
|
||||
il.MarkLabel(l3);
|
||||
}
|
||||
//if (value.IsBoolCycle)
|
||||
//ConvertStatement(value.increment_statement);
|
||||
il.MarkLabel(lbreak);
|
||||
//il.Emit(OpCodes.Pop);
|
||||
labels.Pop();
|
||||
clabels.Pop();
|
||||
}
|
||||
|
|
@ -5586,7 +5591,10 @@ namespace PascalABCCompiler.NETGenerator
|
|||
il.Emit(OpCodes.Brfalse, FalseLabel);
|
||||
labels.Push(FalseLabel);//break
|
||||
clabels.Push(TrueLabel);//continue
|
||||
bool tmp_lb = gen_left_brackets;
|
||||
gen_left_brackets = false;
|
||||
ConvertStatement(value.body);
|
||||
gen_left_brackets = tmp_lb;
|
||||
il.Emit(OpCodes.Br, TrueLabel);
|
||||
il.MarkLabel(FalseLabel);
|
||||
clabels.Pop();
|
||||
|
|
@ -5596,9 +5604,9 @@ namespace PascalABCCompiler.NETGenerator
|
|||
public override void visit(SemanticTree.ITryBlockNode value)
|
||||
{
|
||||
Label exBl = il.BeginExceptionBlock();
|
||||
EnterSafeBlock();
|
||||
var safe_block = EnterSafeBlock();
|
||||
ConvertStatement(value.TryStatements);
|
||||
LeaveSafeBlock();
|
||||
LeaveSafeBlock(safe_block);
|
||||
if (value.ExceptionFilters.Length != 0)
|
||||
{
|
||||
foreach (SemanticTree.IExceptionFilterBlockNode iefbn in value.ExceptionFilters)
|
||||
|
|
@ -5622,17 +5630,17 @@ namespace PascalABCCompiler.NETGenerator
|
|||
{
|
||||
il.Emit(OpCodes.Pop);
|
||||
}
|
||||
EnterSafeBlock();
|
||||
safe_block = EnterSafeBlock();
|
||||
ConvertStatement(iefbn.ExceptionHandler);
|
||||
LeaveSafeBlock();
|
||||
LeaveSafeBlock(safe_block);
|
||||
}
|
||||
}
|
||||
if (value.FinallyStatements != null)
|
||||
{
|
||||
il.BeginFinallyBlock();
|
||||
EnterSafeBlock();
|
||||
safe_block = EnterSafeBlock();
|
||||
ConvertStatement(value.FinallyStatements);
|
||||
LeaveSafeBlock();
|
||||
LeaveSafeBlock(safe_block);
|
||||
}
|
||||
il.EndExceptionBlock();
|
||||
}
|
||||
|
|
@ -5647,7 +5655,10 @@ namespace PascalABCCompiler.NETGenerator
|
|||
public override void visit(IGotoStatementNode value)
|
||||
{
|
||||
Label lab = helper.GetLabel(value.label, il);
|
||||
il.Emit(OpCodes.Br, lab);
|
||||
if (safe_block)
|
||||
il.Emit(OpCodes.Leave, lab);
|
||||
else
|
||||
il.Emit(OpCodes.Br, lab);
|
||||
}
|
||||
|
||||
private Stack<Label> if_stack = new Stack<Label>();
|
||||
|
|
@ -10352,10 +10363,11 @@ namespace PascalABCCompiler.NETGenerator
|
|||
}
|
||||
labels.Push(leave_label);
|
||||
clabels.Push(l2);
|
||||
EnterSafeBlock();
|
||||
var safe_block = EnterSafeBlock();
|
||||
ConvertStatement(value.Body);
|
||||
LeaveSafeBlock();
|
||||
MarkSequencePoint(value.Location);
|
||||
LeaveSafeBlock(safe_block);
|
||||
//MarkSequencePoint(value.Location);
|
||||
il.MarkSequencePoint(doc, 0xFeeFee, 0xFeeFee, 0xFeeFee, 0xFeeFee);
|
||||
il.MarkLabel(l2);
|
||||
if (lb.LocalType.IsValueType)
|
||||
il.Emit(OpCodes.Ldloca, lb);
|
||||
|
|
@ -10371,6 +10383,8 @@ namespace PascalABCCompiler.NETGenerator
|
|||
|
||||
il.EndExceptionBlock();
|
||||
il.MarkLabel(leave_label);
|
||||
labels.Pop();
|
||||
clabels.Pop();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1047,6 +1047,21 @@ namespace PascalABCCompiler
|
|||
private void VisitCommonNamespaceFunctionCall(common_namespace_function_call en)
|
||||
{
|
||||
CheckInfiniteRecursion(en);
|
||||
if ((en.function_node.name == "Reset" || en.function_node.name == "Rewrite" || en.function_node.name == "Assign") && en.function_node.comprehensive_namespace.namespace_name == "PABCSystem")
|
||||
{
|
||||
expression_node p = en.parameters[0];
|
||||
switch (p.semantic_node_type)
|
||||
{
|
||||
case semantic_node_type.local_variable_reference: IncreaseNumAssVar((local_variable_reference)p); break;
|
||||
case semantic_node_type.local_block_variable_reference: IncreaseNumAssVar((local_block_variable_reference)p); break;
|
||||
case semantic_node_type.namespace_variable_reference: IncreaseNumAssVar((namespace_variable_reference)p); break;
|
||||
case semantic_node_type.class_field_reference: VisitExpression((p as class_field_reference).obj); IncreaseNumAssField((class_field_reference)p); break;
|
||||
case semantic_node_type.static_class_field_reference: IncreaseNumAssField((static_class_field_reference)p); break;
|
||||
case semantic_node_type.common_parameter_reference: IncreaseNumAssParam((common_parameter_reference)p); break;
|
||||
case semantic_node_type.deref_node: CheckAssign(((dereference_node)p).deref_expr); break;
|
||||
case semantic_node_type.simple_array_indexing: VisitSimpleArrayIndexing((simple_array_indexing)p); break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < en.parameters.Count; i++)
|
||||
{
|
||||
CheckVarParameter(en.parameters[i], en.function_node, i);
|
||||
|
|
|
|||
|
|
@ -1021,7 +1021,7 @@ namespace PascalABCCompiler.Parsers
|
|||
_diapason_expr.right.visit(this);
|
||||
}
|
||||
|
||||
public void visit(var_def_list_for_record _var_def_list)
|
||||
public override void visit(var_def_list_for_record _var_def_list)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -53,7 +53,8 @@ namespace PascalABCCompiler.Parsers
|
|||
Colon,
|
||||
Punkt,
|
||||
ThrowNew,
|
||||
CommonKeyword
|
||||
CommonKeyword,
|
||||
CommonExpressionKeyword
|
||||
}
|
||||
public class Keyword
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
//
|
||||
// This CSharp output file generated by Gardens Point LEX
|
||||
// Version: 1.1.3.301
|
||||
// Machine: ALEXANDER-PC
|
||||
// DateTime: 23.07.2017 22:31:24
|
||||
// UserName: Alexander
|
||||
// Machine: DESKTOP-A6LT9RI
|
||||
// DateTime: 29.09.2017 13:47:41
|
||||
// UserName: ?????????
|
||||
// GPLEX input file <ABCPascal.lex>
|
||||
// GPLEX frame file <embedded resource>
|
||||
//
|
||||
|
|
@ -1943,11 +1943,11 @@ string cur_yytext = yytext;
|
|||
case (int)Tokens.tkTo:
|
||||
case (int)Tokens.tkDownto:
|
||||
case (int)Tokens.tkUnit:
|
||||
case (int)Tokens.tkNamespace:
|
||||
case (int)Tokens.tkLibrary:
|
||||
case (int)Tokens.tkExternal:
|
||||
case (int)Tokens.tkYield:
|
||||
case (int)Tokens.tkSequence:
|
||||
case (int)Tokens.tkMatch:
|
||||
yylval = new Union();
|
||||
yylval.ti = new token_info(cur_yytext,currentLexLocation);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -348,6 +348,7 @@ UNICODEARROW \x890
|
|||
case (int)Tokens.tkTo:
|
||||
case (int)Tokens.tkDownto:
|
||||
case (int)Tokens.tkUnit:
|
||||
case (int)Tokens.tkNamespace:
|
||||
case (int)Tokens.tkLibrary:
|
||||
case (int)Tokens.tkExternal:
|
||||
case (int)Tokens.tkYield:
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
%token <ti> tkParseModeExpression tkParseModeStatement tkParseModeType tkBegin tkEnd
|
||||
%token <ti> tkAsmBody tkILCode tkError INVISIBLE
|
||||
%token <ti> tkRepeat tkUntil tkDo tkComma tkFinally tkTry
|
||||
%token <ti> tkInitialization tkFinalization tkUnit tkLibrary tkExternal tkParams
|
||||
%token <ti> tkInitialization tkFinalization tkUnit tkLibrary tkExternal tkParams tkNamespace
|
||||
%token <op> tkAssign tkPlusEqual tkMinusEqual tkMultEqual tkDivEqual tkMinus tkPlus tkSlash tkStar tkEqual tkGreater tkGreaterEqual tkLower tkLowerEqual
|
||||
%token <op> tkNotEqual tkCSharpStyleOr tkArrow tkOr tkXor tkAnd tkDiv tkMod tkShl tkShr tkNot tkAs tkIn tkIs tkImplicit tkExplicit tkAddressOf tkDeref
|
||||
%token <id> tkDirectiveName tkIdentifier
|
||||
|
|
@ -117,7 +117,7 @@
|
|||
%type <stn> property_specifiers
|
||||
%type <stn> array_defaultproperty
|
||||
%type <stn> meth_modificators optional_method_modificators optional_method_modificators1
|
||||
%type <id> meth_modificator
|
||||
%type <id> meth_modificator property_modificator
|
||||
%type <stn> proc_call
|
||||
%type <stn> proc_func_constr_destr_decl proc_func_decl inclass_proc_func_decl inclass_proc_func_decl_noclass constr_destr_decl inclass_constr_destr_decl
|
||||
%type <stn> method_decl proc_func_constr_destr_decl_with_attr proc_func_decl_noclass
|
||||
|
|
@ -363,6 +363,10 @@ unit_header
|
|||
{
|
||||
$$ = NewUnitHeading(new ident($1.text, @1), $2, @$);
|
||||
}
|
||||
| tkNamespace ident_or_keyword_pointseparator_list tkSemiColon optional_head_compiler_directives
|
||||
{
|
||||
$$ = NewNamespaceHeading(new ident($1.text, @1), $2 as ident_list, @$);
|
||||
}
|
||||
;
|
||||
|
||||
unit_key_word
|
||||
|
|
@ -647,6 +651,14 @@ var_decl_sect
|
|||
{
|
||||
$$ = ($1 as variable_definitions).Add($2 as var_def_statement, @$);
|
||||
}
|
||||
/* | tkVar tkRoundOpen identifier tkComma ident_list tkRoundClose tkAssign expr tkSemiColon
|
||||
{
|
||||
if ($7.type != Operators.Assignment)
|
||||
parsertools.AddErrorFromResource("ONLY_BASE_ASSIGNMENT_FOR_TUPLE",@6);
|
||||
($5 as ident_list).Insert(0,$3);
|
||||
$5.source_context = LexLocation.MergeAll(@1,@2,@3,@4,@5,@6);
|
||||
$$ = new assign_var_tuple($5 as ident_list, $8, @$);
|
||||
}*/
|
||||
;
|
||||
|
||||
const_decl
|
||||
|
|
@ -1766,7 +1778,16 @@ simple_prim_property_definition
|
|||
simple_property_definition
|
||||
: tkProperty qualified_identifier property_interface property_specifiers tkSemiColon array_defaultproperty
|
||||
{
|
||||
$$ = NewSimplePropertyDefinition($2 as method_name, $3 as property_interface, $4 as property_accessors, $6 as property_array_default, @$);
|
||||
$$ = NewSimplePropertyDefinition($2 as method_name, $3 as property_interface, $4 as property_accessors, proc_attribute.attr_none, $6 as property_array_default, @$);
|
||||
}
|
||||
| tkProperty qualified_identifier property_interface property_specifiers tkSemiColon property_modificator tkSemiColon array_defaultproperty
|
||||
{
|
||||
proc_attribute pa = proc_attribute.attr_none;
|
||||
if ($6.name.ToLower() == "virtual")
|
||||
pa = proc_attribute.attr_virtual;
|
||||
else if ($6.name.ToLower() == "override")
|
||||
pa = proc_attribute.attr_override;
|
||||
$$ = NewSimplePropertyDefinition($2 as method_name, $3 as property_interface, $4 as property_accessors, pa, $8 as property_array_default, @$);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -2322,6 +2343,18 @@ var_stmt
|
|||
{
|
||||
$$ = new var_statement($2 as var_def_statement, @$);
|
||||
}
|
||||
| tkRoundOpen tkVar identifier tkComma var_ident_list tkRoundClose tkAssign expr
|
||||
{
|
||||
($5 as ident_list).Insert(0,$3);
|
||||
($5 as syntax_tree_node).source_context = LexLocation.MergeAll(@1,@2,@3,@4,@5,@6);
|
||||
$$ = new assign_var_tuple($5 as ident_list, $8, @$);
|
||||
}
|
||||
| tkVar tkRoundOpen identifier tkComma ident_list tkRoundClose tkAssign expr
|
||||
{
|
||||
($5 as ident_list).Insert(0,$3);
|
||||
$5.source_context = LexLocation.MergeAll(@1,@2,@3,@4,@5,@6);
|
||||
$$ = new assign_var_tuple($5 as ident_list, $8, @$);
|
||||
}
|
||||
;
|
||||
|
||||
assignment
|
||||
|
|
@ -2337,22 +2370,6 @@ assignment
|
|||
($4 as syntax_tree_node).source_context = LexLocation.MergeAll(@1,@2,@3,@4,@5);
|
||||
$$ = new assign_tuple($4 as addressed_value_list, $7, @$);
|
||||
}
|
||||
| tkRoundOpen tkVar identifier tkComma var_ident_list tkRoundClose assign_operator expr
|
||||
{
|
||||
if ($7.type != Operators.Assignment)
|
||||
parsertools.AddErrorFromResource("ONLY_BASE_ASSIGNMENT_FOR_TUPLE",@6);
|
||||
($5 as ident_list).Insert(0,$3);
|
||||
($5 as syntax_tree_node).source_context = LexLocation.MergeAll(@1,@2,@3,@4,@5,@6);
|
||||
$$ = new assign_var_tuple($5 as ident_list, $8, @$);
|
||||
}
|
||||
| tkVar tkRoundOpen identifier tkComma ident_list tkRoundClose assign_operator expr
|
||||
{
|
||||
if ($7.type != Operators.Assignment)
|
||||
parsertools.AddErrorFromResource("ONLY_BASE_ASSIGNMENT_FOR_TUPLE",@6);
|
||||
($5 as ident_list).Insert(0,$3);
|
||||
$5.source_context = LexLocation.MergeAll(@1,@2,@3,@4,@5,@6);
|
||||
$$ = new assign_var_tuple($5 as ident_list, $8, @$);
|
||||
}
|
||||
;
|
||||
|
||||
variable_list
|
||||
|
|
@ -3367,6 +3384,13 @@ meth_modificator
|
|||
{ $$ = $1; }
|
||||
;
|
||||
|
||||
property_modificator
|
||||
: tkVirtual
|
||||
{ $$ = $1; }
|
||||
| tkOverride
|
||||
{ $$ = $1; }
|
||||
;
|
||||
|
||||
property_specifier_directives
|
||||
: tkRead
|
||||
{ $$ = $1; }
|
||||
|
|
@ -3523,6 +3547,8 @@ keyword
|
|||
{ $$ = $1; }
|
||||
| tkLibrary
|
||||
{ $$ = $1; }
|
||||
| tkNamespace
|
||||
{ $$ = $1; }
|
||||
| tkExternal
|
||||
{ $$ = $1; }
|
||||
| tkParams
|
||||
|
|
|
|||
|
|
@ -794,9 +794,9 @@ namespace PascalABCSavParser
|
|||
return ntr.names[0];
|
||||
else
|
||||
{
|
||||
var dn = new dot_node(ntr.names[0], ntr.names[1]);
|
||||
var dn = new dot_node(ntr.names[0], ntr.names[1], ntr.names[0].source_context.Merge(ntr.names[1].source_context));
|
||||
for (var i = 2; i < ntr.names.Count; i++)
|
||||
dn = new dot_node(dn, ntr.names[i]);
|
||||
dn = new dot_node(dn, ntr.names[i],dn.source_context.Merge(ntr.names[i].source_context));
|
||||
dn.source_context = ntr.source_context;
|
||||
return dn;
|
||||
}
|
||||
|
|
@ -808,6 +808,7 @@ namespace PascalABCSavParser
|
|||
if (en is dot_node)
|
||||
{
|
||||
var dn = en as dot_node;
|
||||
var sc = dn.source_context;
|
||||
var ids = new List<ident>();
|
||||
ids.Add(dn.right as ident);
|
||||
while (dn.left is dot_node)
|
||||
|
|
@ -817,7 +818,7 @@ namespace PascalABCSavParser
|
|||
}
|
||||
ids.Add(dn.left as ident);
|
||||
ids.Reverse();
|
||||
return new named_type_reference(ids, dn.source_context);
|
||||
return new named_type_reference(ids, sc);
|
||||
}
|
||||
this.AddErrorFromResource("TYPE_NAME_EXPECTED", en.source_context);
|
||||
return null;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -142,6 +142,7 @@ namespace GPPGParserScanner
|
|||
keywords.Add(Convert("sequence"), (int)Tokens.tkSequence);
|
||||
keywords.Add(Convert("yield"), (int)Tokens.tkYield);
|
||||
keywords.Add(Convert("match"), (int)Tokens.tkMatch);
|
||||
keywords.Add(Convert("namespace"), (int)Tokens.tkNamespace);
|
||||
}
|
||||
|
||||
static Keywords()
|
||||
|
|
|
|||
|
|
@ -292,7 +292,6 @@
|
|||
</tag>
|
||||
<tag value="Ключевые слова">
|
||||
<name value="meth_modificator" />
|
||||
<name value="property_specifier_directives" />
|
||||
<name value="non_reserved" />
|
||||
<name value="visibility_specifier" />
|
||||
<name value="keyword" />
|
||||
|
|
|
|||
|
|
@ -1,16 +1,20 @@
|
|||
lex=ABCPascal.lex
|
||||
yacc=ABCPascal.y
|
||||
lexGen=J:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\Gplex.exe
|
||||
yaccGen=J:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gppg.exe
|
||||
lexGen=H:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\Gplex.exe
|
||||
yaccGen=H:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gppg.exe
|
||||
lexGenOpt=/unicode
|
||||
yaccGenOpt=/gplex
|
||||
useCustomScript
|
||||
script=
|
||||
"J:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gplex.exe" /unicode "J:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.lex"
|
||||
"H:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gplex.exe" /unicode "H:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.lex"
|
||||
|
||||
"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"
|
||||
|
||||
|
||||
|
||||
"J:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gppg.exe" /no-lines /gplex "J:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.y"
|
||||
|
||||
"J:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\convert4.exe"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,21 @@ namespace GPPGParserScanner
|
|||
return un;
|
||||
}
|
||||
|
||||
public unit_name NewNamespaceHeading(ident unitkeyword, ident_list nname, LexLocation loc)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < nname.idents.Count; i++)
|
||||
{
|
||||
sb.Append(nname.idents[i]);
|
||||
if (i < nname.idents.Count - 1)
|
||||
sb.Append(".");
|
||||
}
|
||||
ident uname = new ident(sb.ToString());
|
||||
var un = new unit_name(uname, UnitHeaderKeyword.Unit, loc);
|
||||
un.HeaderKeyword = UnitHeaderKeyword.Namespace;
|
||||
return un;
|
||||
}
|
||||
|
||||
public procedure_header NewProcedureHeader(attribute_list attrlist, procedure_header nprh, procedure_attribute forw, LexLocation loc)
|
||||
{
|
||||
if (nprh.proc_attributes == null)
|
||||
|
|
@ -180,10 +195,12 @@ namespace GPPGParserScanner
|
|||
return nsnpd;
|
||||
}
|
||||
|
||||
public simple_property NewSimplePropertyDefinition(method_name qualified_identifier, property_interface property_interface, property_accessors property_specifiers, property_array_default array_defaultproperty, LexLocation loc)
|
||||
public simple_property NewSimplePropertyDefinition(method_name qualified_identifier, property_interface property_interface, property_accessors property_specifiers, proc_attribute virt_over_none_attr, property_array_default array_defaultproperty, LexLocation loc)
|
||||
{
|
||||
var nnspd = new simple_property();
|
||||
nnspd.property_name = qualified_identifier.meth_name;
|
||||
var nnspd = new simple_property();
|
||||
nnspd.virt_over_none_attr = virt_over_none_attr;
|
||||
|
||||
nnspd.property_name = qualified_identifier.meth_name;
|
||||
if (property_interface != null)
|
||||
{
|
||||
nnspd.parameter_list = property_interface.parameter_list;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="ICSharpCode.NRefactory">
|
||||
<HintPath>..\..\bin\ICSharpCode.NRefactory.dll</HintPath>
|
||||
<HintPath>..\..\Libraries\ICSharpCode.NRefactory.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26228.9
|
||||
VisualStudioVersion = 15.0.26430.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VisualPascalABCNET", "VisualPascalABCNET", "{26843C5D-9D7E-4C2C-AC14-2D227FA5592E}"
|
||||
EndProject
|
||||
|
|
@ -41,8 +41,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SyntaxTreeVisualisator", "V
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PT4Provider", "VisualPlugins\PT4Provider\PT4Provider.csproj", "{4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SCharpLanguageConverter", "VisualPlugins\SCharpLanguageConverter\SCharpLanguageConverter.csproj", "{8F44EF8C-C487-4D23-B028-55935466DC36}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelpBuilder", "VisualPlugins\HelpBuilder\HelpBuilder.csproj", "{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{F8CE2712-826B-450B-A72F-D32D80C99858}"
|
||||
|
|
@ -199,16 +197,6 @@ Global
|
|||
{4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{8F44EF8C-C487-4D23-B028-55935466DC36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8F44EF8C-C487-4D23-B028-55935466DC36}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8F44EF8C-C487-4D23-B028-55935466DC36}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{8F44EF8C-C487-4D23-B028-55935466DC36}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{8F44EF8C-C487-4D23-B028-55935466DC36}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{8F44EF8C-C487-4D23-B028-55935466DC36}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8F44EF8C-C487-4D23-B028-55935466DC36}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8F44EF8C-C487-4D23-B028-55935466DC36}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{8F44EF8C-C487-4D23-B028-55935466DC36}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{8F44EF8C-C487-4D23-B028-55935466DC36}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
|
|
@ -456,7 +444,6 @@ Global
|
|||
{A36031B7-D3D1-4372-B478-07621069602E} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7}
|
||||
{1437FD01-0741-4912-8035-6BDFEAA45626} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7}
|
||||
{4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7}
|
||||
{8F44EF8C-C487-4D23-B028-55935466DC36} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7}
|
||||
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7}
|
||||
{1E42361A-EDA3-4872-88AF-A3AAF600D36D} = {F8CE2712-826B-450B-A72F-D32D80C99858}
|
||||
{A25D26FB-3043-4BCF-833E-E3F4C3BE795E} = {F8CE2712-826B-450B-A72F-D32D80C99858}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,9 @@
|
|||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ICSharpCode.TextEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=4d61825e8dd49f1a, processorArchitecture=MSIL" />
|
||||
<Reference Include="ICSharpCode.TextEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=4d61825e8dd49f1a, processorArchitecture=MSIL">
|
||||
<HintPath>..\Libraries\ICSharpCode.TextEditor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Данный документ описывает условия распространения продукта PascalABC.NET (версия 3.2).
|
||||
Данный документ описывает условия распространения продукта PascalABC.NET (версия 3.3).
|
||||
Копия лицензии GNU LGPL прилагается в конце этого файла.
|
||||
|
||||
ВАЖНЕЙШИЕ УСЛОВИЯ РАСПРОСТРАНЕНИЯ ПРОДУКТА PascalABC.NET
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Next, we describe the terms under which PascalABC.NET (version 3.2) is distributed.
|
||||
Next, we describe the terms under which PascalABC.NET (version 3.3) is distributed.
|
||||
A copy of the GNU GPL is appended to this file.
|
||||
|
||||
IMPORTANT PascalABC.NET LICENSE TERMS
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
[=PascalABC]
|
||||
[0]
|
||||
uses PT4;
|
||||
[1-999]
|
||||
|
||||
[1-999]
|
||||
begin
|
||||
Task('%{task}');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
[=PascalABC]
|
||||
[0]
|
||||
[1-999]
|
||||
|
||||
begin
|
||||
|
||||
end.
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -5,6 +5,9 @@
|
|||
|
||||
ExecWait '"$INSTDIR\ExecHide.exe" "$INSTDIR\gacutil.exe" /u "PABCRtl32"'
|
||||
ExecWait '"$INSTDIR\ExecHide.exe" "$INSTDIR\gacutil.exe" /i "$INSTDIR\Lib\PABCRtl32.dll"'
|
||||
|
||||
ExecWait '"$INSTDIR\ExecHide.exe" "$INSTDIR\gacutil.exe" /u "HelixToolkit.Wpf"'
|
||||
ExecWait '"$INSTDIR\ExecHide.exe" "$INSTDIR\gacutil.exe" /i "$INSTDIR\Lib\HelixToolkit.Wpf.dll"'
|
||||
;\MikhailoMMX
|
||||
Delete "$INSTDIR\gacutil.exe"
|
||||
Delete "$INSTDIR\gacutil.exe.config"
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.2.0.1504'
|
||||
!define VERSION '3.3.0.1541'
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@ uses
|
|||
PABCSystem, PABCExtensions, __RedirectIOMode, __RunMode, ABCButtons, ABCHouse, ABCObjects,
|
||||
ABCSprites, Colors, CRT, DMCollect, DMTaskMaker, DMZadan, Drawman,
|
||||
DrawManField, Events, FilesOperations, GraphABC,
|
||||
GraphABCHelper, IniFile, PointerTools, PointRect, PT4, PT4MakerNetX, Robot, RobotField,
|
||||
GraphABCHelper,
|
||||
Graph3D,
|
||||
GraphWPF,
|
||||
IniFile, PointerTools, PointRect, PT4, PT4MakerNetX, Robot, RobotField,
|
||||
RobotTaskMaker, RobotZadan, Sockets, Utils, VCL, Timers, PT4Exam, PT4TaskMakerNET, RBDMUtils,
|
||||
Collections, Arrays, Core, FormsABC, MPI, ClientServer, OpenGL, Speech;
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@
|
|||
File ..\bin\Lib\FilesOperations.pcu
|
||||
File ..\bin\Lib\FormsABC.pcu
|
||||
File ..\bin\Lib\GraphABC.pcu
|
||||
File ..\bin\Lib\GraphWPF.pcu
|
||||
File ..\bin\Lib\Graph3D.pcu
|
||||
File ..\bin\Lib\GraphABCHelper.pcu
|
||||
File ..\bin\Lib\IniFile.pcu
|
||||
File ..\bin\Lib\PABCSystem.pcu
|
||||
|
|
@ -106,7 +108,8 @@
|
|||
File ..\bin\Lib\PT4MakerNetX.pcu
|
||||
File ..\bin\Lib\Speech.pcu
|
||||
File ..\bin\Lib\PABCRtl.dll
|
||||
File ..\bin\Lib\PABCRtl32.dll
|
||||
File ..\bin\Lib\PABCRtl32.dll
|
||||
File ..\bin\Lib\HelixToolkit.Wpf.dll
|
||||
|
||||
${AddFile} "__RedirectIOMode.pcu"
|
||||
${AddFile} "__RunMode.pcu"
|
||||
|
|
@ -128,6 +131,8 @@
|
|||
${AddFile} "FormsABC.pcu"
|
||||
${AddFile} "GOLDParserEngine.pcu"
|
||||
${AddFile} "GraphABC.pcu"
|
||||
${AddFile} "GraphWPF.pcu"
|
||||
${AddFile} "Graph3D.pcu"
|
||||
${AddFile} "GraphABCHelper.pcu"
|
||||
${AddFile} "IniFile.pcu"
|
||||
${AddFile} "PABCSystem.pcu"
|
||||
|
|
@ -153,9 +158,12 @@
|
|||
${AddFile} "OpenGL.pcu"
|
||||
${AddFile} "PT4MakerNetX.pcu"
|
||||
${AddFile} "Speech.pcu"
|
||||
${AddFile} "PABCRtl.dll"
|
||||
${AddFile} "PABCRtl.pdb"
|
||||
Push "Lib\PABCRtl.dll"
|
||||
${AddFile} "PABCRtl.dll"
|
||||
${AddFile} "HelixToolkit.Wpf.dll"
|
||||
${AddFile} "PABCRtl.pdb"
|
||||
Push "Lib\PABCRtl.dll"
|
||||
Call NGEN
|
||||
Push "Lib\HelixToolkit.Wpf.dll"
|
||||
Call NGEN
|
||||
|
||||
SetOutPath "$INSTDIR\LibSource"
|
||||
|
|
@ -177,6 +185,8 @@
|
|||
File ..\bin\Lib\FilesOperations.pas
|
||||
File ..\bin\Lib\FormsABC.pas
|
||||
File ..\bin\Lib\GraphABC.pas
|
||||
File ..\bin\Lib\GraphWPF.pas
|
||||
File ..\bin\Lib\Graph3D.pas
|
||||
File ..\bin\Lib\GraphABCHelper.pas
|
||||
File ..\bin\Lib\IniFile.pas
|
||||
File ..\bin\Lib\PABCSystem.pas
|
||||
|
|
@ -224,6 +234,8 @@
|
|||
${AddFile} "FilesOperations.pas"
|
||||
${AddFile} "FormsABC.pas"
|
||||
${AddFile} "GraphABC.pas"
|
||||
${AddFile} "GraphWPF.pas"
|
||||
${AddFile} "Graph3D.pas"
|
||||
${AddFile} "GraphABCHelper.pas"
|
||||
${AddFile} "IniFile.pas"
|
||||
${AddFile} "PABCSystem.pas"
|
||||
|
|
|
|||
|
|
@ -1149,6 +1149,12 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
}
|
||||
|
||||
public virtual void visit(base_syntax_namespace_node _syntax_namespace_node)
|
||||
{
|
||||
DefaultVisit(_syntax_namespace_node);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1669,6 +1669,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
_simple_property.array_default = _read_node() as property_array_default;
|
||||
_simple_property.parameter_list = _read_node() as property_parameter_list;
|
||||
_simple_property.attr = (definition_attribute)br.ReadByte();
|
||||
_simple_property.virt_over_none_attr = (proc_attribute)br.ReadByte();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2184,6 +2184,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
_simple_property.parameter_list.visit(this);
|
||||
}
|
||||
bw.Write((byte)_simple_property.attr);
|
||||
bw.Write((byte)_simple_property.virt_over_none_attr);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15961,7 +15961,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
|
||||
|
||||
///<summary>
|
||||
///property property_name[parameter_list]:property_type index index_expression accessors;array_default;
|
||||
///property property_name[parameter_list]:property_type index index_expression accessors; [virtual;] array_default;
|
||||
///</summary>
|
||||
[Serializable]
|
||||
public partial class simple_property : declaration
|
||||
|
|
@ -15978,7 +15978,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public simple_property(ident _property_name,type_definition _property_type,expression _index_expression,property_accessors _accessors,property_array_default _array_default,property_parameter_list _parameter_list,definition_attribute _attr)
|
||||
public simple_property(ident _property_name,type_definition _property_type,expression _index_expression,property_accessors _accessors,property_array_default _array_default,property_parameter_list _parameter_list,definition_attribute _attr,proc_attribute _virt_over_none_attr)
|
||||
{
|
||||
this._property_name=_property_name;
|
||||
this._property_type=_property_type;
|
||||
|
|
@ -15987,13 +15987,14 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
this._array_default=_array_default;
|
||||
this._parameter_list=_parameter_list;
|
||||
this._attr=_attr;
|
||||
this._virt_over_none_attr=_virt_over_none_attr;
|
||||
FillParentsInDirectChilds();
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public simple_property(ident _property_name,type_definition _property_type,expression _index_expression,property_accessors _accessors,property_array_default _array_default,property_parameter_list _parameter_list,definition_attribute _attr,SourceContext sc)
|
||||
public simple_property(ident _property_name,type_definition _property_type,expression _index_expression,property_accessors _accessors,property_array_default _array_default,property_parameter_list _parameter_list,definition_attribute _attr,proc_attribute _virt_over_none_attr,SourceContext sc)
|
||||
{
|
||||
this._property_name=_property_name;
|
||||
this._property_type=_property_type;
|
||||
|
|
@ -16002,6 +16003,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
this._array_default=_array_default;
|
||||
this._parameter_list=_parameter_list;
|
||||
this._attr=_attr;
|
||||
this._virt_over_none_attr=_virt_over_none_attr;
|
||||
source_context = sc;
|
||||
FillParentsInDirectChilds();
|
||||
}
|
||||
|
|
@ -16012,6 +16014,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
protected property_array_default _array_default;
|
||||
protected property_parameter_list _parameter_list;
|
||||
protected definition_attribute _attr;
|
||||
protected proc_attribute _virt_over_none_attr;
|
||||
|
||||
///<summary>
|
||||
///
|
||||
|
|
@ -16118,6 +16121,21 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
public proc_attribute virt_over_none_attr
|
||||
{
|
||||
get
|
||||
{
|
||||
return _virt_over_none_attr;
|
||||
}
|
||||
set
|
||||
{
|
||||
_virt_over_none_attr=value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Создает копию узла </summary>
|
||||
public override syntax_tree_node Clone()
|
||||
|
|
@ -16162,6 +16180,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
copy.parameter_list.Parent = copy;
|
||||
}
|
||||
copy.attr = attr;
|
||||
copy.virt_over_none_attr = virt_over_none_attr;
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
|
@ -16328,7 +16347,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public index_property(ident _property_name,type_definition _property_type,expression _index_expression,property_accessors _accessors,property_array_default _array_default,property_parameter_list _parameter_list,definition_attribute _attr,formal_parameters _property_parametres,default_indexer_property_node _is_default)
|
||||
public index_property(ident _property_name,type_definition _property_type,expression _index_expression,property_accessors _accessors,property_array_default _array_default,property_parameter_list _parameter_list,definition_attribute _attr,proc_attribute _virt_over_none_attr,formal_parameters _property_parametres,default_indexer_property_node _is_default)
|
||||
{
|
||||
this._property_name=_property_name;
|
||||
this._property_type=_property_type;
|
||||
|
|
@ -16337,6 +16356,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
this._array_default=_array_default;
|
||||
this._parameter_list=_parameter_list;
|
||||
this._attr=_attr;
|
||||
this._virt_over_none_attr=_virt_over_none_attr;
|
||||
this._property_parametres=_property_parametres;
|
||||
this._is_default=_is_default;
|
||||
FillParentsInDirectChilds();
|
||||
|
|
@ -16345,7 +16365,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public index_property(ident _property_name,type_definition _property_type,expression _index_expression,property_accessors _accessors,property_array_default _array_default,property_parameter_list _parameter_list,definition_attribute _attr,formal_parameters _property_parametres,default_indexer_property_node _is_default,SourceContext sc)
|
||||
public index_property(ident _property_name,type_definition _property_type,expression _index_expression,property_accessors _accessors,property_array_default _array_default,property_parameter_list _parameter_list,definition_attribute _attr,proc_attribute _virt_over_none_attr,formal_parameters _property_parametres,default_indexer_property_node _is_default,SourceContext sc)
|
||||
{
|
||||
this._property_name=_property_name;
|
||||
this._property_type=_property_type;
|
||||
|
|
@ -16354,6 +16374,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
this._array_default=_array_default;
|
||||
this._parameter_list=_parameter_list;
|
||||
this._attr=_attr;
|
||||
this._virt_over_none_attr=_virt_over_none_attr;
|
||||
this._property_parametres=_property_parametres;
|
||||
this._is_default=_is_default;
|
||||
source_context = sc;
|
||||
|
|
@ -16436,6 +16457,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
copy.parameter_list.Parent = copy;
|
||||
}
|
||||
copy.attr = attr;
|
||||
copy.virt_over_none_attr = virt_over_none_attr;
|
||||
if (property_parametres != null)
|
||||
{
|
||||
copy.property_parametres = (formal_parameters)property_parametres.Clone();
|
||||
|
|
|
|||
|
|
@ -494,19 +494,19 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
|
||||
public partial class var_def_statement
|
||||
{
|
||||
public var_def_statement(ident_list vars, type_definition vars_type) : this(vars, vars_type, null, definition_attribute.None, false)
|
||||
public var_def_statement(ident_list vars, type_definition vars_type, SourceContext sc = null) : this(vars, vars_type, null, definition_attribute.None, false, sc)
|
||||
{ }
|
||||
|
||||
public var_def_statement(ident_list vars, type_definition vars_type, expression iv) : this(vars, vars_type, iv, definition_attribute.None, false)
|
||||
public var_def_statement(ident_list vars, type_definition vars_type, expression iv, SourceContext sc = null) : this(vars, vars_type, iv, definition_attribute.None, false, sc)
|
||||
{ }
|
||||
|
||||
public var_def_statement(ident id, type_definition type) : this(new ident_list(id), type)
|
||||
public var_def_statement(ident id, type_definition type, SourceContext sc = null) : this(new ident_list(id), type, sc)
|
||||
{ }
|
||||
|
||||
public var_def_statement(ident id, type_definition type, expression iv) : this(new ident_list(id), type, iv)
|
||||
public var_def_statement(ident id, type_definition type, expression iv, SourceContext sc = null) : this(new ident_list(id), type, iv,sc)
|
||||
{ }
|
||||
|
||||
public var_def_statement(ident id, expression iv) : this(new ident_list(id), null, iv)
|
||||
public var_def_statement(ident id, expression iv, SourceContext sc = null) : this(new ident_list(id), null, iv, sc)
|
||||
{ }
|
||||
|
||||
public var_def_statement(ident id, string type) : this(new ident_list(id), new named_type_reference(type))
|
||||
|
|
@ -1045,7 +1045,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
public partial class simple_property
|
||||
{
|
||||
public simple_property(ident name, type_definition type, property_accessors accessors, SourceContext sc = null)
|
||||
: this(name, type, null, accessors, null, null, definition_attribute.None,sc)
|
||||
: this(name, type, null, accessors, null, null, definition_attribute.None,proc_attribute.attr_none,sc)
|
||||
{ }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
|
||||
public enum WhileCycleType { While, DoWhile };
|
||||
|
||||
public enum UnitHeaderKeyword { Unit, Library }
|
||||
public enum UnitHeaderKeyword { Unit, Library, Namespace }
|
||||
|
||||
public enum JumpStmtType { Return, Break, Continue };
|
||||
public enum SwitchPartType { Switch, Case, Default };
|
||||
|
|
@ -173,7 +173,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
|
||||
public enum for_cycle_type {to,downto};
|
||||
|
||||
public enum proc_attribute {attr_override, attr_forward, attr_virtual, attr_overload, attr_reintroduce, attr_abstract, attr_static, attr_extension };
|
||||
public enum proc_attribute {attr_override, attr_forward, attr_virtual, attr_overload, attr_reintroduce, attr_abstract, attr_static, attr_extension, attr_none }; // attr_none íóæíî äëÿ ñâîéñòâ êîãäà virtual È override íå óêàçûâàåòñÿ
|
||||
|
||||
public enum definition_attribute {None, Static, Const};
|
||||
|
||||
|
|
@ -388,5 +388,21 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
}
|
||||
|
||||
public class base_syntax_namespace_node: declaration
|
||||
{
|
||||
string _name;
|
||||
List<declaration> _defs;
|
||||
uses_list _uses_modules;
|
||||
|
||||
public base_syntax_namespace_node(string name)
|
||||
{
|
||||
_name = name;
|
||||
_defs = new List<declaration>();
|
||||
}
|
||||
|
||||
public string name { get => _name; set => _name = value; }
|
||||
public List<declaration> defs { get => _defs; set => _defs = value; }
|
||||
public uses_list uses_modules { get => _uses_modules; set => _uses_modules = value; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<NodeGeneratorData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<SyntaxNodes>
|
||||
<SyntaxNode Name="syntax_tree_node">
|
||||
<Fields>
|
||||
<ExtendedField Name="source_context" Type="SourceContext" CreateVariable="false" DeleteVariable="false" />
|
||||
</Fields>
|
||||
<Methods />
|
||||
<Tags>
|
||||
<CategoryIndices />
|
||||
<TagIndices />
|
||||
</Tags>
|
||||
</SyntaxNode>
|
||||
<SyntaxNode Name="expression" BaseName="declaration">
|
||||
<Fields />
|
||||
<Methods />
|
||||
|
|
@ -23,6 +13,16 @@
|
|||
</TagIndices>
|
||||
</Tags>
|
||||
</SyntaxNode>
|
||||
<SyntaxNode Name="syntax_tree_node">
|
||||
<Fields>
|
||||
<ExtendedField Name="source_context" Type="SourceContext" CreateVariable="false" DeleteVariable="false" />
|
||||
</Fields>
|
||||
<Methods />
|
||||
<Tags>
|
||||
<CategoryIndices />
|
||||
<TagIndices />
|
||||
</Tags>
|
||||
</SyntaxNode>
|
||||
<SyntaxNode Name="statement" BaseName="declaration">
|
||||
<Fields />
|
||||
<Methods />
|
||||
|
|
@ -1014,6 +1014,7 @@
|
|||
<SyntaxField Name="array_default" SyntaxType="property_array_default" />
|
||||
<SyntaxField Name="parameter_list" SyntaxType="property_parameter_list" />
|
||||
<ExtendedField Name="attr" Type="definition_attribute" CreateVariable="false" DeleteVariable="false" />
|
||||
<ExtendedField Name="virt_over_none_attr" Type="proc_attribute" CreateVariable="false" DeleteVariable="false" />
|
||||
</Fields>
|
||||
<Methods />
|
||||
<Tags>
|
||||
|
|
@ -3966,7 +3967,7 @@
|
|||
<HelpData Key="simple_const_definition" Value="" />
|
||||
<HelpData Key="simple_const_definition." Value="" />
|
||||
<HelpData Key="simple_const_definition.simple_const_definition(ident name, expression value, SourceContext sc)" Value="" />
|
||||
<HelpData Key="simple_property" Value="property property_name[parameter_list]:property_type index index_expression accessors;array_default;" />
|
||||
<HelpData Key="simple_property" Value="property property_name[parameter_list]:property_type index index_expression accessors; [virtual;] array_default;" />
|
||||
<HelpData Key="simple_property." Value="" />
|
||||
<HelpData Key="simple_property.accessors" Value="" />
|
||||
<HelpData Key="simple_property.array_default" Value="" />
|
||||
|
|
@ -3977,6 +3978,7 @@
|
|||
<HelpData Key="simple_property.property_type" Value="" />
|
||||
<HelpData Key="simple_property.simple_property(ident _property_name,type_definition _property_type,expression _index_expression,property_accessors _accessors,property_array_default _array_default,property_parameter_list _parameter_list,definition_attribute _attr)" Value="" />
|
||||
<HelpData Key="simple_property.simple_property(ident name, type_definition type, property_accessors accessors): this(name, type, null, accessors, null, null, definition_attribute.None)" Value="" />
|
||||
<HelpData Key="simple_property.virt_over_none_attr" Value="" />
|
||||
<HelpData Key="sizeof_operator" Value="" />
|
||||
<HelpData Key="sizeof_operator." Value="" />
|
||||
<HelpData Key="sizeof_operator.expr" Value="" />
|
||||
|
|
|
|||
|
|
@ -33,6 +33,20 @@ namespace PascalABCCompiler.SyntaxTreeConverters
|
|||
// assign_tuple и assign_var_tuple
|
||||
AssignTuplesDesugarVisitor.New.ProcessNode(root);
|
||||
|
||||
/*#if DEBUG
|
||||
try
|
||||
{
|
||||
//root.visit(new SimplePrettyPrinterVisitor(@"d:\\zzz4.txt"));
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif*/
|
||||
|
||||
|
||||
|
||||
// slice_expr и slice_expr_question
|
||||
SliceDesugarVisitor.New.ProcessNode(root);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,12 +48,47 @@ namespace SyntaxVisitors.SugarVisitors
|
|||
visit(asstup.expr);
|
||||
}
|
||||
|
||||
public void ReplaceAssignVarTupleUsingParent(assign_var_tuple from, IEnumerable<declaration> to, Desc d = Desc.DirectDescendants)
|
||||
{
|
||||
foreach (var x in to)
|
||||
x.Parent = from.Parent;
|
||||
var sl = from.Parent as declarations;
|
||||
if (sl != null)
|
||||
{
|
||||
sl.ReplaceInList(from, to);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void visit(assign_var_tuple assvartup)
|
||||
{
|
||||
var tname = "#temp_var" + UniqueNumStr();
|
||||
if (assvartup.Parent is declarations ds)
|
||||
{
|
||||
var ld = new List<declaration>();
|
||||
ld.Add(new semantic_check_sugared_statement_node(typeof(assign_var_tuple), new List<syntax_tree_node> { assvartup.idents, assvartup.expr }, assvartup.source_context)); // Это нужно для проверок на этапе преобразования в семантику
|
||||
|
||||
var vd = new variable_definitions();
|
||||
var tt1 = new var_def_statement(new ident(tname), assvartup.expr);
|
||||
vd.Add(tt1);
|
||||
|
||||
var nn = assvartup.idents.idents.Count();
|
||||
for (var i = 0; i < nn; i++)
|
||||
{
|
||||
var a = new var_def_statement(assvartup.idents.idents[i],
|
||||
new dot_node(new ident(tname), new ident("Item" + (i + 1).ToString())),
|
||||
assvartup.idents.idents[i].source_context);
|
||||
vd.Add(a);
|
||||
}
|
||||
ld.Add(vd);
|
||||
ReplaceAssignVarTupleUsingParent(assvartup,ld);
|
||||
visit(assvartup.expr);
|
||||
return;
|
||||
}
|
||||
|
||||
var sl = new List<statement>();
|
||||
sl.Add(new semantic_check_sugared_statement_node(typeof(assign_var_tuple), new List<syntax_tree_node> { assvartup.idents, assvartup.expr }, assvartup.source_context)); // Это нужно для проверок на этапе преобразования в семантику
|
||||
|
||||
var tname = "#temp_var" + UniqueNumStr();
|
||||
var tt = new var_statement(new ident(tname), assvartup.expr); // тут для assvartup.expr внутри повторно вызывается convert_strong, это плохо, но если там лямбда, то иначе - с semantic_addr_value - не работает!!!
|
||||
sl.Add(tt); // он же помещается в новое синтаксическое дерево
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -9,6 +9,7 @@ unit PT4;
|
|||
// Copyright (c) 2014-2015 М.Э.Абрамян, дополнения к версии 4.13
|
||||
// Copyright (c) 2015 М.Э.Абрамян, дополнения к версии 4.14
|
||||
// Copyright (c) 2016 М.Э.Абрамян, дополнения к версии 4.15
|
||||
// Copyright (c) 2017 Ì.Ý.Àáðàìÿí, äîïîëíåíèÿ ê âåðñèè 4.17
|
||||
// Электронный задачник Programming Taskbook Copyright (c)М.Э.Абрамян, 1998-2017
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -133,32 +134,6 @@ function ReadlnPNode: PNode;
|
|||
/// Возвращает введенное значение типа Node
|
||||
function ReadlnNode: Node;
|
||||
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ çíà÷åíèé òèïà integer, ââåäåííûõ ñ êëàâèàòóðû
|
||||
function ReadInteger2: (integer,integer);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ çíà÷åíèé òèïà real, ââåäåííûõ ñ êëàâèàòóðû
|
||||
function ReadReal2: (real,real);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ çíà÷åíèé òèïà char, ââåäåííûõ ñ êëàâèàòóðû
|
||||
function ReadChar2: (char,char);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ çíà÷åíèé òèïà string, ââåäåííûõ ñ êëàâèàòóðû
|
||||
function ReadString2: (string,string);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ çíà÷åíèé òèïà integer, ââåäåííûõ ñ êëàâèàòóðû, è ïåðåõîäèò íà ñëåäóþùóþ ñòðîêó ââîäà
|
||||
function ReadlnInteger2: (integer,integer);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ çíà÷åíèé òèïà real, ââåäåííûõ ñ êëàâèàòóðû, è ïåðåõîäèò íà ñëåäóþùóþ ñòðîêó ââîäà
|
||||
function ReadlnReal2: (real,real);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ çíà÷åíèé òèïà char, ââåäåííûõ ñ êëàâèàòóðû, è ïåðåõîäèò íà ñëåäóþùóþ ñòðîêó ââîäà
|
||||
function ReadlnChar2: (char,char);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ çíà÷åíèé òèïà string, ââåäåííûõ ñ êëàâèàòóðû, è ïåðåõîäèò íà ñëåäóþùóþ ñòðîêó ââîäà
|
||||
function ReadlnString2: (string,string);
|
||||
|
||||
function ReadInteger3: (integer,integer,integer);
|
||||
function ReadReal3: (real,real,real);
|
||||
function ReadChar3: (char,char,char);
|
||||
function ReadString3: (string,string,string);
|
||||
function ReadlnInteger3: (integer,integer,integer);
|
||||
function ReadlnReal3: (real,real,real);
|
||||
function ReadlnChar3: (char,char,char);
|
||||
function ReadlnString3: (string,string,string);
|
||||
|
||||
// == Версия 4.15. Дополнения ==
|
||||
|
||||
/// Возвращает введенное значение типа integer.
|
||||
|
|
@ -207,6 +182,140 @@ function ReadlnNode(prompt: string): Node;
|
|||
|
||||
// == Версия 4.15. Конец дополнений ==
|
||||
|
||||
// == Âåðñèÿ 4.17. Äîïîëíåíèÿ ==
|
||||
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà integer
|
||||
function ReadInteger2: (integer, integer);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà real
|
||||
function ReadReal2: (real, real);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà char
|
||||
function ReadChar2: (char, char);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà string
|
||||
function ReadString2: (string, string);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà boolean
|
||||
function ReadBoolean2: (boolean, boolean);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà Node
|
||||
function ReadNode2: (Node, Node);
|
||||
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà integer
|
||||
function ReadlnInteger2: (integer, integer);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà real
|
||||
function ReadlnReal2: (real, real);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà char
|
||||
function ReadlnChar2: (char, char);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà string
|
||||
function ReadlnString2: (string, string);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà boolean
|
||||
function ReadlnBoolean2: (boolean, boolean);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà Node
|
||||
function ReadlnNode2: (Node, Node);
|
||||
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà integer
|
||||
function ReadInteger3: (integer, integer, integer);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà real
|
||||
function ReadReal3: (real, real, real);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà char
|
||||
function ReadChar3: (char, char, char);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà string
|
||||
function ReadString3: (string, string, string);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà boolean
|
||||
function ReadBoolean3: (boolean, boolean, boolean);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà Node
|
||||
function ReadNode3: (Node, Node, Node);
|
||||
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà integer
|
||||
function ReadlnInteger3: (integer, integer, integer);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà real
|
||||
function ReadlnReal3: (real, real, real);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà char
|
||||
function ReadlnChar3: (char, char, char);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà string
|
||||
function ReadlnString3: (string, string, string);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà boolean
|
||||
function ReadlnBoolean3: (boolean, boolean, boolean);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà Node
|
||||
function ReadlnNode3: (Node, Node, Node);
|
||||
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà integer.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadInteger2(prompt: string): (integer, integer);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà real.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadReal2(prompt: string): (real, real);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà char.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadChar2(prompt: string): (char, char);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà string.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadString2(prompt: string): (string, string);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà boolean.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadBoolean2(prompt: string): (boolean, boolean);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà Node.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadNode2(prompt: string): (Node, Node);
|
||||
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà integer.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadlnInteger2(prompt: string): (integer, integer);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà real.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadlnReal2(prompt: string): (real, real);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà char.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadlnChar2(prompt: string): (char, char);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà string.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadlnString2(prompt: string): (string, string);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà boolean.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadlnBoolean2(prompt: string): (boolean, boolean);
|
||||
/// Âîçâðàùàåò êîðòåæ èç äâóõ ââåäåííûõ çíà÷åíèé òèïà Node.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadlnNode2(prompt: string): (Node, Node);
|
||||
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà integer.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadInteger3(prompt: string): (integer, integer, integer);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà real.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadReal3(prompt: string): (real, real, real);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà char.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadChar3(prompt: string): (char, char, char);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà string.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadString3(prompt: string): (string, string, string);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà boolean.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadBoolean3(prompt: string): (boolean, boolean, boolean);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà Node.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadNode3(prompt: string): (Node, Node, Node);
|
||||
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà integer.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadlnInteger3(prompt: string): (integer, integer, integer);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà real.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadlnReal3(prompt: string): (real, real, real);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà char.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadlnChar3(prompt: string): (char, char, char);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà string.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadlnString3(prompt: string): (string, string, string);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà boolean.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadlnBoolean3(prompt: string): (boolean, boolean, boolean);
|
||||
/// Âîçâðàùàåò êîðòåæ èç òðåõ ââåäåííûõ çíà÷åíèé òèïà Node.
|
||||
/// Ñòðîêîâîå ïðèãëàøåíèå prompt èãíîðèðóåòñÿ
|
||||
function ReadlnNode3(prompt: string): (Node, Node, Node);
|
||||
|
||||
|
||||
// == Âåðñèÿ 4.17. Êîíåö äîïîëíåíèé ==
|
||||
|
||||
|
||||
procedure GetR(var param: real);
|
||||
procedure GetN(var param: integer);
|
||||
procedure GetC(var param: char);
|
||||
|
|
@ -279,6 +388,7 @@ procedure Println(s: string);
|
|||
|
||||
// == Версия 4.15. Конец дополнений ==
|
||||
|
||||
|
||||
/// Освобождает память, выделенную динамически, на которую указывает p
|
||||
procedure Dispose(p: pointer);
|
||||
|
||||
|
|
@ -1115,23 +1225,6 @@ begin
|
|||
Result := GetNode;
|
||||
end;
|
||||
|
||||
function ReadInteger2 := (ReadInteger,ReadInteger);
|
||||
function ReadReal2 := (ReadReal,ReadReal);
|
||||
function ReadChar2 := (ReadChar,ReadChar);
|
||||
function ReadString2 := (ReadString,ReadString);
|
||||
function ReadlnInteger2 := (ReadInteger,ReadlnInteger);
|
||||
function ReadlnReal2 := (ReadReal,ReadlnReal);
|
||||
function ReadlnChar2 := (ReadChar,ReadlnChar);
|
||||
function ReadlnString2 := (ReadString,ReadlnString);
|
||||
function ReadInteger3 := (ReadInteger,ReadInteger,ReadInteger);
|
||||
function ReadReal3 := (ReadReal,ReadReal,ReadReal);
|
||||
function ReadChar3 := (ReadChar,ReadChar,ReadChar);
|
||||
function ReadString3 := (ReadString,ReadString,ReadString);
|
||||
function ReadlnInteger3 := (ReadInteger,ReadInteger,ReadlnInteger);
|
||||
function ReadlnReal3 := (ReadReal,ReadReal,ReadlnReal);
|
||||
function ReadlnChar3 := (ReadChar,ReadChar,ReadlnChar);
|
||||
function ReadlnString3 := (ReadString,ReadString,ReadlnString);
|
||||
|
||||
// == Версия 4.15. Дополнения ==
|
||||
|
||||
function ReadInteger(prompt: string): integer;
|
||||
|
|
@ -1206,6 +1299,251 @@ end;
|
|||
|
||||
// == Версия 4.15. Конец дополнений ==
|
||||
|
||||
// == Âåðñèÿ 4.17. Äîïîëíåíèÿ ==
|
||||
|
||||
function ReadInteger2: (integer, integer);
|
||||
begin
|
||||
Result := (GetInt, GetInt);
|
||||
end;
|
||||
|
||||
function ReadReal2: (real, real);
|
||||
begin
|
||||
Result := (GetReal, GetReal);
|
||||
end;
|
||||
|
||||
function ReadChar2: (char, char);
|
||||
begin
|
||||
Result := (GetChar, GetChar);
|
||||
end;
|
||||
|
||||
function ReadString2: (string, string);
|
||||
begin
|
||||
Result := (GetString, GetString);
|
||||
end;
|
||||
|
||||
function ReadBoolean2: (boolean, boolean);
|
||||
begin
|
||||
Result := (GetBool, GetBool);
|
||||
end;
|
||||
|
||||
function ReadNode2: (Node, Node);
|
||||
begin
|
||||
Result := (GetNode, GetNode);
|
||||
end;
|
||||
|
||||
function ReadlnInteger2: (integer, integer);
|
||||
begin
|
||||
Result := (GetInt, GetInt);
|
||||
end;
|
||||
|
||||
function ReadlnReal2: (real, real);
|
||||
begin
|
||||
Result := (GetReal, GetReal);
|
||||
end;
|
||||
|
||||
function ReadlnChar2: (char, char);
|
||||
begin
|
||||
Result := (GetChar, GetChar);
|
||||
end;
|
||||
|
||||
function ReadlnString2: (string, string);
|
||||
begin
|
||||
Result := (GetString, GetString);
|
||||
end;
|
||||
|
||||
function ReadlnBoolean2: (boolean, boolean);
|
||||
begin
|
||||
Result := (GetBool, GetBool);
|
||||
end;
|
||||
|
||||
function ReadlnNode2: (Node, Node);
|
||||
begin
|
||||
Result := (GetNode, GetNode);
|
||||
end;
|
||||
|
||||
function ReadInteger2(prompt: string): (integer, integer);
|
||||
begin
|
||||
Result := (GetInt, GetInt);
|
||||
end;
|
||||
|
||||
function ReadReal2(prompt: string): (real, real);
|
||||
begin
|
||||
Result := (GetReal, GetReal);
|
||||
end;
|
||||
|
||||
function ReadChar2(prompt: string): (char, char);
|
||||
begin
|
||||
Result := (GetChar, GetChar);
|
||||
end;
|
||||
|
||||
function ReadString2(prompt: string): (string, string);
|
||||
begin
|
||||
Result := (GetString, GetString);
|
||||
end;
|
||||
|
||||
function ReadBoolean2(prompt: string): (boolean, boolean);
|
||||
begin
|
||||
Result := (GetBool, GetBool);
|
||||
end;
|
||||
|
||||
function ReadNode2(prompt: string): (Node, Node);
|
||||
begin
|
||||
Result := (GetNode, GetNode);
|
||||
end;
|
||||
|
||||
function ReadlnInteger2(prompt: string): (integer, integer);
|
||||
begin
|
||||
Result := (GetInt, GetInt);
|
||||
end;
|
||||
|
||||
function ReadlnReal2(prompt: string): (real, real);
|
||||
begin
|
||||
Result := (GetReal, GetReal);
|
||||
end;
|
||||
|
||||
function ReadlnChar2(prompt: string): (char, char);
|
||||
begin
|
||||
Result := (GetChar, GetChar);
|
||||
end;
|
||||
|
||||
function ReadlnString2(prompt: string): (string, string);
|
||||
begin
|
||||
Result := (GetString, GetString);
|
||||
end;
|
||||
|
||||
function ReadlnBoolean2(prompt: string): (boolean, boolean);
|
||||
begin
|
||||
Result := (GetBool, GetBool);
|
||||
end;
|
||||
|
||||
function ReadlnNode2(prompt: string): (Node, Node);
|
||||
begin
|
||||
Result := (GetNode, GetNode);
|
||||
end;
|
||||
|
||||
function ReadInteger3: (integer, integer, integer);
|
||||
begin
|
||||
Result := (GetInt, GetInt, GetInt);
|
||||
end;
|
||||
|
||||
function ReadReal3: (real, real, real);
|
||||
begin
|
||||
Result := (GetReal, GetReal, GetReal);
|
||||
end;
|
||||
|
||||
function ReadChar3: (char, char, char);
|
||||
begin
|
||||
Result := (GetChar, GetChar, GetChar);
|
||||
end;
|
||||
|
||||
function ReadString3: (string, string, string);
|
||||
begin
|
||||
Result := (GetString, GetString, GetString);
|
||||
end;
|
||||
|
||||
function ReadBoolean3: (boolean, boolean, boolean);
|
||||
begin
|
||||
Result := (GetBool, GetBool, GetBool);
|
||||
end;
|
||||
|
||||
function ReadNode3: (Node, Node, Node);
|
||||
begin
|
||||
Result := (GetNode, GetNode, GetNode);
|
||||
end;
|
||||
|
||||
function ReadlnInteger3: (integer, integer, integer);
|
||||
begin
|
||||
Result := (GetInt, GetInt, GetInt);
|
||||
end;
|
||||
|
||||
function ReadlnReal3: (real, real, real);
|
||||
begin
|
||||
Result := (GetReal, GetReal, GetReal);
|
||||
end;
|
||||
|
||||
function ReadlnChar3: (char, char, char);
|
||||
begin
|
||||
Result := (GetChar, GetChar, GetChar);
|
||||
end;
|
||||
|
||||
function ReadlnString3: (string, string, string);
|
||||
begin
|
||||
Result := (GetString, GetString, GetString);
|
||||
end;
|
||||
|
||||
function ReadlnBoolean3: (boolean, boolean, boolean);
|
||||
begin
|
||||
Result := (GetBool, GetBool, GetBool);
|
||||
end;
|
||||
|
||||
function ReadlnNode3: (Node, Node, Node);
|
||||
begin
|
||||
Result := (GetNode, GetNode, GetNode);
|
||||
end;
|
||||
|
||||
function ReadInteger3(prompt: string): (integer, integer, integer);
|
||||
begin
|
||||
Result := (GetInt, GetInt, GetInt);
|
||||
end;
|
||||
|
||||
function ReadReal3(prompt: string): (real, real, real);
|
||||
begin
|
||||
Result := (GetReal, GetReal, GetReal);
|
||||
end;
|
||||
|
||||
function ReadChar3(prompt: string): (char, char, char);
|
||||
begin
|
||||
Result := (GetChar, GetChar, GetChar);
|
||||
end;
|
||||
|
||||
function ReadString3(prompt: string): (string, string, string);
|
||||
begin
|
||||
Result := (GetString, GetString, GetString);
|
||||
end;
|
||||
|
||||
function ReadBoolean3(prompt: string): (boolean, boolean, boolean);
|
||||
begin
|
||||
Result := (GetBool, GetBool, GetBool);
|
||||
end;
|
||||
|
||||
function ReadNode3(prompt: string): (Node, Node, Node);
|
||||
begin
|
||||
Result := (GetNode, GetNode, GetNode);
|
||||
end;
|
||||
|
||||
function ReadlnInteger3(prompt: string): (integer, integer, integer);
|
||||
begin
|
||||
Result := (GetInt, GetInt, GetInt);
|
||||
end;
|
||||
|
||||
function ReadlnReal3(prompt: string): (real, real, real);
|
||||
begin
|
||||
Result := (GetReal, GetReal, GetReal);
|
||||
end;
|
||||
|
||||
function ReadlnChar3(prompt: string): (char, char, char);
|
||||
begin
|
||||
Result := (GetChar, GetChar, GetChar);
|
||||
end;
|
||||
|
||||
function ReadlnString3(prompt: string): (string, string, string);
|
||||
begin
|
||||
Result := (GetString, GetString, GetString);
|
||||
end;
|
||||
|
||||
function ReadlnBoolean3(prompt: string): (boolean, boolean, boolean);
|
||||
begin
|
||||
Result := (GetBool, GetBool, GetBool);
|
||||
end;
|
||||
|
||||
function ReadlnNode3(prompt: string): (Node, Node, Node);
|
||||
begin
|
||||
Result := (GetNode, GetNode, GetNode);
|
||||
end;
|
||||
|
||||
// == Âåðñèÿ 4.17. Êîíåö äîïîëíåíèé ==
|
||||
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Процедуры Put
|
||||
// -----------------------------------------------------
|
||||
|
|
@ -1431,6 +1769,17 @@ begin
|
|||
var ip := IntPtr(PointerOutput(args[i]).p);
|
||||
_PutP(ip);
|
||||
end
|
||||
// == Âåðñèÿ 4.17. Äîïîëíåíèÿ ==
|
||||
else if args[i].GetType.FullName.StartsWith('System.Tuple') then
|
||||
foreach var e in args[i].GetType.GetProperties do
|
||||
InternalWrite(Arr(e.GetValue(args[i],nil)))
|
||||
else if args[i] is IEnumerable then
|
||||
begin
|
||||
var e := (args[i] as IEnumerable).GetEnumerator;
|
||||
while e.MoveNext do
|
||||
InternalWrite(Arr(e.Current));
|
||||
end
|
||||
// == Âåðñèÿ 4.17. Êîíåö äîïîëíåíèé ==
|
||||
else GenerateNotSupportedWriteTypeException(args[i].GetType.ToString);
|
||||
end;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ procedure Field(n,m: integer);
|
|||
procedure Start;
|
||||
/// Остановить Робота
|
||||
procedure Stop;
|
||||
/// Запустить процедуру без параметров
|
||||
procedure Run(p: procedure);
|
||||
|
||||
// Русские подпрограммы
|
||||
/// Переместить Робота вправо
|
||||
|
|
@ -111,6 +113,9 @@ begin
|
|||
RobField.Stop;
|
||||
end;
|
||||
|
||||
procedure Run(p: procedure) := p;
|
||||
|
||||
|
||||
procedure Speed(n: integer);
|
||||
begin
|
||||
RobField.SetSpeed(n);
|
||||
|
|
|
|||
|
|
@ -1059,7 +1059,12 @@ begin
|
|||
end;
|
||||
//
|
||||
end
|
||||
else labelExState.Text := 'Робот: Работа окончена, задание не выполнено';
|
||||
else
|
||||
if RobField.TaskName = '' then
|
||||
labelExState.Text := 'Робот: Работа окончена'
|
||||
else
|
||||
labelExState.Text := 'Робот: Работа окончена, задание не выполнено';
|
||||
System.Console.Write(RobField.TaskName);
|
||||
end;
|
||||
|
||||
var
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt)
|
||||
// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
///--
|
||||
unit __RedirectIOMode;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue