From bb577a45723c2efaeead3631105e7b083b9c6c2a Mon Sep 17 00:00:00 2001 From: John Peel Date: Sat, 9 Jul 2016 15:32:56 -0400 Subject: [PATCH] Small changes to CC to support new Lape features. --- Units/Misc/CastaliaSimplePasPar.pas | 34 +++++++++++++++++++---------- Units/Misc/v_ideCodeInsight.pas | 3 ++- Units/Misc/v_ideCodeParser.pas | 9 ++++---- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/Units/Misc/CastaliaSimplePasPar.pas b/Units/Misc/CastaliaSimplePasPar.pas index 49ef2b5ac..3d9503565 100644 --- a/Units/Misc/CastaliaSimplePasPar.pas +++ b/Units/Misc/CastaliaSimplePasPar.pas @@ -2113,6 +2113,8 @@ procedure TmwSimplePasPar.FunctionProcedureName; //Operators =) tokMinus, tokOr, tokPlus, tokXor, tokAnd, tokAs, tokDiv, tokMod, tokShl, tokShr, tokSlash, tokStar, tokStarStar, + tokEqual, tokGreater, tokGreaterEqual, tokLower, tokLowerEqual, + tokIn, tokIs, tokNotEqual, tokDivAsgn, tokMulAsgn, tokPlusAsgn, @@ -2153,13 +2155,12 @@ procedure TmwSimplePasPar.FunctionProcedureBlock; NoExternal: Boolean; begin NoExternal := True; - if TokenID = tokSemiColon - then SEMICOLON; + if TokenID = tokSemiColon then SEMICOLON; case ExID of tokForward: ForwardDeclaration; // DR 2001-07-23 else - while ExID in [tokAbstract, tokCdecl, tokDynamic, tokExport, tokExternal, tokFar, + while (ExID in [tokAbstract, tokCdecl, tokDynamic, tokExport, tokExternal, tokFar, tokMessage, tokNear, tokOverload, tokOverride, tokPascal, tokRegister, tokReintroduce, tokSafeCall, tokStdCall, tokVirtual, tokDeprecated, tokLibrary, tokPlatform, // DR 2001-10-20 @@ -2171,20 +2172,29 @@ procedure TmwSimplePasPar.FunctionProcedureBlock; {$IFDEF D9_NEWER} , tokInline {$ENDIF} - ] // DR 2001-11-14 + , tokConst + ]) or (TokenID = tokConstRef)// DR 2001-11-14 do begin - case ExId of - tokExternal: + case TokenID of + tokConstRef: + begin + NextToken; + if (TokenID = tokSemiColon) then SEMICOLON; + end + else + case ExId of + tokExternal: + begin + ProceduralDirective; + if TokenID = tokSemiColon then SEMICOLON; + NoExternal := False; + end; + else begin ProceduralDirective; if TokenID = tokSemiColon then SEMICOLON; - NoExternal := False; end; - else - begin - ProceduralDirective; - if TokenID = tokSemiColon then SEMICOLON; end; end; end; @@ -5038,7 +5048,7 @@ procedure TmwSimplePasPar.ExportedHeading; tokDeprecated, tokLibrary, tokPlatform, // DR 2001-10-20 tokLocal, tokVarargs // DR 2001-11-14 {$IFDEF D8_NEWER}, tokStatic{$ENDIF}{$IFDEF D9_NEWER}, tokInline{$ENDIF} - ] do + , tokConst] do begin ProceduralDirective; if TokenID = tokSemiColon then SEMICOLON; diff --git a/Units/Misc/v_ideCodeInsight.pas b/Units/Misc/v_ideCodeInsight.pas index 2bceb2024..6289da2a9 100644 --- a/Units/Misc/v_ideCodeInsight.pas +++ b/Units/Misc/v_ideCodeInsight.pas @@ -1339,7 +1339,8 @@ procedure TCodeInsight.Proposal_AddDeclaration(Item: TDeclaration; ItemList, Ins (Item is TciOutParameter) or (Item is TciFormalParameter) or (Item is TciInParameter) or - (Item is TciVarParameter) then + (Item is TciVarParameter) or + (Item is TciConstRefParameter) then begin FirstColumn := FormatFirstColumn('param'); c[0] := TciParameterName; diff --git a/Units/Misc/v_ideCodeParser.pas b/Units/Misc/v_ideCodeParser.pas index 0127bce40..cf42237f6 100644 --- a/Units/Misc/v_ideCodeParser.pas +++ b/Units/Misc/v_ideCodeParser.pas @@ -919,7 +919,8 @@ function TciProcedureDeclaration.GetParamDeclarations: TDeclarationArray; (fItems[i] is TciOutParameter) or (fItems[i] is TciFormalParameter) or (fItems[i] is TciInParameter) or - (fItems[i] is TciVarParameter) then + (fItems[i] is TciVarParameter) or + (fItems[i] is TciConstRefParameter) then begin SetLength(Result, Length(Result) + 1); Result[High(Result)] := fItems[i]; @@ -1224,7 +1225,7 @@ procedure TCodeParser.TypeKind; procedure TCodeParser.TypedConstant; begin - if (not InDeclarations([TciVarDeclaration, TciConstParameter, TciOutParameter, TciFormalParameter, TciInParameter, TciVarParameter])) then + if (not InDeclarations([TciVarDeclaration, TciConstParameter, TciOutParameter, TciFormalParameter, TciInParameter, TciVarParameter, TciConstRefParameter])) then begin inherited; Exit; @@ -1473,7 +1474,7 @@ procedure TCodeParser.VarParameter; procedure TCodeParser.ParameterName; begin - if (not InDeclarations([TciConstParameter, TciOutParameter, TciFormalParameter, TciInParameter, TciVarParameter])) then + if (not InDeclarations([TciConstParameter, TciOutParameter, TciFormalParameter, TciInParameter, TciVarParameter, TciConstRefParameter])) then begin inherited; Exit; @@ -1486,7 +1487,7 @@ procedure TCodeParser.ParameterName; procedure TCodeParser.NewFormalParameterType; begin - if (not InDeclarations([TciConstParameter, TciOutParameter, TciFormalParameter, TciInParameter, TciVarParameter])) then + if (not InDeclarations([TciConstParameter, TciOutParameter, TciFormalParameter, TciInParameter, TciVarParameter, TciConstRefParameter])) then begin inherited; Exit;