# Conflicts:
#	Parsers/PascalABCParserNewSaushkin/ABCPascal.cs
#	Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs
This commit is contained in:
miks1965 2018-01-12 11:44:27 +03:00
commit bb93625420
9 changed files with 45 additions and 13 deletions

View file

@ -142,7 +142,13 @@ namespace CodeCompletion
SymInfo[] syms = si.GetNamesAsInObject(ev);
SymInfo[] ext_syms = null;
if (si is ElementScope)
ext_syms = visitor.cur_scope.GetSymInfosForExtensionMethods((si as ElementScope).sc as TypeScope);
{
SymScope root_scope = visitor.cur_scope;
if (root_scope is ImplementationUnitScope)
root_scope = root_scope.topScope;
ext_syms = root_scope.GetSymInfosForExtensionMethods((si as ElementScope).sc as TypeScope);
}
List<SymInfo> lst = new List<SymInfo>();
lst.AddRange(syms);
if (ext_syms != null)

View file

@ -865,7 +865,11 @@ namespace CodeCompletion
else if (attrs.proc_attributes[i].attribute_type == proc_attribute.attr_virtual)
ps.is_virtual = true;
else if (attrs.proc_attributes[i].attribute_type == proc_attribute.attr_abstract)
{
ps.is_abstract = true;
if (ps.topScope is TypeScope)
(ps.topScope as TypeScope).is_abstract = true;
}
else if (attrs.proc_attributes[i].attribute_type == proc_attribute.attr_override)
ps.is_override = true;
else if (attrs.proc_attributes[i].attribute_type == proc_attribute.attr_reintroduce)
@ -1464,7 +1468,8 @@ namespace CodeCompletion
ps.head_loc = loc;
if (ps.topScope == ss.topScope)
{
while ((ss as ProcScope).nextProc != null && (ss as ProcScope).nextProc.topScope == ps.topScope) ss = (ss as ProcScope).nextProc;
while ((ss as ProcScope).nextProc != null && (ss as ProcScope).nextProc.topScope == ps.topScope)
ss = (ss as ProcScope).nextProc;
ProcScope tmp_ps = (ss as ProcScope).nextProc;
(ss as ProcScope).nextProc = ps;
ps.nextProc = tmp_ps;
@ -1720,6 +1725,8 @@ namespace CodeCompletion
key = "auto " + key;
else if (cl_def.attribute == class_attribute.Abstract)
key = "abstract " + key;
else if (cl_def.attribute == class_attribute.Sealed)
key = "sealed " + key;
if (key != null && returned_scope.body_loc != null)
{
returned_scope.head_loc = new location(returned_scope.body_loc.begin_line_num, returned_scope.body_loc.begin_column_num, returned_scope.body_loc.begin_line_num, returned_scope.body_loc.begin_column_num + key.Length, doc);
@ -3147,7 +3154,10 @@ namespace CodeCompletion
var_def_statement vds = decl as var_def_statement;
if (vds == null)
continue;
vds.vars_type.visit(this);
if (vds.vars_type != null)
vds.vars_type.visit(this);
else
vds.inital_value.visit(this);
foreach (ident id in vds.vars.list)
{
ps.parameters.Add(new ElementScope(new SymInfo(id.name, SymbolKind.Parameter, id.name), returned_scope, ps));

View file

@ -2,7 +2,7 @@
// This CSharp output file generated by Gardens Point LEX
// Version: 1.1.3.301
// Machine: DESKTOP-A6LT9RI
// DateTime: 08.01.2018 23:03:48
// DateTime: 12.01.2018 11:43:58
// UserName: ?????????
// GPLEX input file <ABCPascal.lex>
// GPLEX frame file <embedded resource>

View file

@ -2007,7 +2007,7 @@ inclass_constr_destr_decl
{
if ($5 is empty_statement)
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",@6);
var tmp = new constructor(null,$3 as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),@$),$2 as method_name,false,false,null,null,@$);
var tmp = new constructor(null,$3 as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),@$),$2 as method_name,false,false,null,null,LexLocation.MergeAll(@1,@2,@3));
$$ = new procedure_definition(tmp as procedure_header, new block(null,new statement_list($5 as statement,@5),@5), @$);
}
;

View file

@ -2,7 +2,7 @@
// GPPG version 1.3.6
// Machine: DESKTOP-A6LT9RI
// DateTime: 08.01.2018 23:03:49
// DateTime: 12.01.2018 11:43:59
// UserName: ?????????
// Input file <ABCPascal.y>
@ -4108,7 +4108,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
{
if (ValueStack[ValueStack.Depth-2].stn is empty_statement)
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",LocationStack[LocationStack.Depth-1]);
var tmp = new constructor(null,ValueStack[ValueStack.Depth-4].stn as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),CurrentLocationSpan),ValueStack[ValueStack.Depth-5].stn as method_name,false,false,null,null,CurrentLocationSpan);
var tmp = new constructor(null,ValueStack[ValueStack.Depth-4].stn as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),CurrentLocationSpan),ValueStack[ValueStack.Depth-5].stn as method_name,false,false,null,null,LexLocation.MergeAll(LocationStack[LocationStack.Depth-6],LocationStack[LocationStack.Depth-5],LocationStack[LocationStack.Depth-4]));
CurrentSemanticValue.stn = new procedure_definition(tmp as procedure_header, new block(null,new statement_list(ValueStack[ValueStack.Depth-2].stn as statement,LocationStack[LocationStack.Depth-2]),LocationStack[LocationStack.Depth-2]), CurrentLocationSpan);
}
break;

View file

@ -0,0 +1,9 @@
type
t1 = auto class
i := 0;
end;
begin
var o: t1;
o.i{@var t1.i: integer;@} := 2;
end.

View file

@ -126,11 +126,11 @@ namespace VisualPascalABC
c = textArea.Document.TextContent[off];
}
c = char.ToLower(c);
if (c != '=' && c != 't' && c != 'd')
if (c != '=' && c != 't' && c != 'd' && c != 'o')
{
return true;
}
if (c == 't' || c == 'd')
if (c == 't' || c == 'd' || c == 'o')
{
StringBuilder keyword = new StringBuilder();
@ -142,7 +142,7 @@ namespace VisualPascalABC
break;
c = textArea.Document.TextContent[off];
}
if (keyword.ToString().ToLower() == "sealed" || keyword.ToString().ToLower() == "abstract")
if (keyword.ToString().ToLower() == "sealed" || keyword.ToString().ToLower() == "abstract" || keyword.ToString().ToLower() == "auto")
{
return isClassMember(off, textArea);
}

View file

@ -53,7 +53,8 @@ namespace VisualPascalABC
void CaretPositionChangedEventHandler(object sender, EventArgs e)
{
if (!VisualPABCSingleton.MainForm.UserOptions.HighlightOperatorBrackets || WorkbenchServiceFactory.DebuggerManager.IsRunning) return;
if (!VisualPABCSingleton.MainForm.UserOptions.HighlightOperatorBrackets || WorkbenchServiceFactory.DebuggerManager.IsRunning)
return;
CodeCompletionHighlighter.Highlight(editor.ActiveTextAreaControl.TextArea);
}
@ -62,7 +63,8 @@ namespace VisualPascalABC
/// </summary>
bool TextAreaKeyEventHandler(char key)
{
if (!WorkbenchServiceFactory.Workbench.UserOptions.AllowCodeCompletion || !VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.compilerLoaded) return false;
if (!WorkbenchServiceFactory.Workbench.UserOptions.AllowCodeCompletion || !VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.compilerLoaded)
return false;
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
if (codeCompletionWindow != null)
{
@ -91,7 +93,11 @@ namespace VisualPascalABC
if (CodeCompletion.CodeCompletionController.CurrentParser == null)
return false;
if (!string.IsNullOrEmpty(WorkbenchServiceFactory.DocumentService.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.SelectionManager.SelectedText))
return false;
{
WorkbenchServiceFactory.DocumentService.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.Caret.Position = WorkbenchServiceFactory.DocumentService.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.SelectionManager.SelectionCollection[0].StartPosition;
WorkbenchServiceFactory.DocumentService.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.SelectionManager.RemoveSelectedText();
}
if (WorkbenchServiceFactory.Workbench.UserOptions.CodeCompletionDot)
{
completionDataProvider = new CodeCompletionProvider();

View file

@ -763,6 +763,7 @@ namespace VisualPascalABC
[HandleProcessCorruptedStateExceptionsAttribute]
get
{
return false;
try
{
if (!failed)