-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #12. Can format method and property declarations.
- Loading branch information
Showing
9 changed files
with
310 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
src/TcBlackTests/TcPouTestData/FB_ExpectedTabAndUnixLineEnd.TcPOU
This file was deleted.
Oops, something went wrong.
96 changes: 96 additions & 0 deletions
96
src/TcBlackTests/TcPouTestData/FB_ExpectedWithPropertiesAndMethods.TcPOU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.3"> | ||
<POU Name="FB_Child" Id="{16c60171-46ae-4c0f-982d-d26906c8a65a}" SpecialFunc="None"> | ||
<Declaration><![CDATA[FUNCTION_BLOCK FB_Child EXTENDS FB_Base IMPLEMENTS I_Interface, I_Interface2 | ||
VAR | ||
SomeText : STRING; | ||
Counter : DINT := 1; | ||
Result : DINT := 2; | ||
Base : FB_Base; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[SomeText:= 'Current counts'; | ||
IF Conditions[1] AND Conditions[2] AND Conditions[3] AND Conditions[4] AND Conditions[5]AND Conditions[6] THEN | ||
Counter :=Counter+ 1; | ||
IF Counter > 2 THEN | ||
Counter := Counter + 5 ; | ||
END_IF | ||
END_IF | ||
Base(Variable1:=2, Variable2:=3 , Variable3:= 5,Sentence:='', Conditions :=Conditions); | ||
AddTwoInts( Variable1 :=4, | ||
Variable2:=4);]]></ST> | ||
</Implementation> | ||
<Method Name="AddTwoInts" Id="{6a4e1f8c-f7f9-4983-b9b4-e06e406d35d9}"> | ||
<Declaration><![CDATA[METHOD AddTwoInts : DINT | ||
VAR_INPUT | ||
Variable1 : DINT; | ||
Variable2 : DINT; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[AddTwoInts:=Variable1+Variable2 ;]]></ST> | ||
</Implementation> | ||
</Method> | ||
<Property Name="AnotherProperty" Id="{aa0cfd4f-5e29-4982-9f71-257c1439d0f2}"> | ||
<Declaration><![CDATA[PROPERTY AnotherProperty : LREAL | ||
]]></Declaration> | ||
<Get Name="Get" Id="{d44792da-1b4d-4983-85ab-83fe99d160dd}"> | ||
<Declaration><![CDATA[VAR | ||
percent : LREAL := 100; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[]]></ST> | ||
</Implementation> | ||
</Get> | ||
<Set Name="Set" Id="{39df90cf-cdb1-4cd9-b65e-5832b944cb70}"> | ||
<Declaration><![CDATA[VAR | ||
sName : STRING(20) := 'This is the one!'; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[]]></ST> | ||
</Implementation> | ||
</Set> | ||
</Property> | ||
<Property Name="Counter" Id="{d49735b6-a4d9-4d67-adc2-f3998b3471ec}"> | ||
<Declaration><![CDATA[PROPERTY Counted : DINT | ||
]]></Declaration> | ||
<Get Name="Get" Id="{7c33609a-907f-4f05-8aea-95e3f6a224e3}"> | ||
<Declaration><![CDATA[VAR | ||
AddOne : DINT := 1; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[]]></ST> | ||
</Implementation> | ||
</Get> | ||
<Set Name="Set" Id="{4bb13cca-2444-4335-a94c-c714ed95062a}"> | ||
<Declaration><![CDATA[VAR | ||
SubTractTwo : DINT := 2; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[]]></ST> | ||
</Implementation> | ||
</Set> | ||
</Property> | ||
<Method Name="SecondMethod" Id="{f5bbaa77-a784-4d59-b884-5b52362ac1cd}"> | ||
<Declaration><![CDATA[METHOD SecondMethod : BOOL | ||
VAR_INPUT | ||
bBool : BOOL; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[]]></ST> | ||
</Implementation> | ||
</Method> | ||
</POU> | ||
</TcPlcObject> |
13 changes: 0 additions & 13 deletions
13
src/TcBlackTests/TcPouTestData/FB_InputTabAndUnixLineEnd.TcPOU
This file was deleted.
Oops, something went wrong.
93 changes: 93 additions & 0 deletions
93
src/TcBlackTests/TcPouTestData/FB_InputWithPropertiesAndMethods.TcPOU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.3"> | ||
<POU Name="FB_Child" Id="{16c60171-46ae-4c0f-982d-d26906c8a65a}" SpecialFunc="None"> | ||
<Declaration><![CDATA[FUNCTION_BLOCK FB_Child EXTENDS FB_Base IMPLEMENTS I_Interface,I_Interface2 | ||
VAR | ||
SomeText: STRING; | ||
Counter : DINT:= 1 ; | ||
Result : DINT :=2; | ||
Base:FB_Base; | ||
END_VAR]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[SomeText:= 'Current counts'; | ||
IF Conditions[1] AND Conditions[2] AND Conditions[3] AND Conditions[4] AND Conditions[5]AND Conditions[6] THEN | ||
Counter :=Counter+ 1; | ||
IF Counter > 2 THEN | ||
Counter := Counter + 5 ; | ||
END_IF | ||
END_IF | ||
Base(Variable1:=2, Variable2:=3 , Variable3:= 5,Sentence:='', Conditions :=Conditions); | ||
AddTwoInts( Variable1 :=4, | ||
Variable2:=4);]]></ST> | ||
</Implementation> | ||
<Method Name="AddTwoInts" Id="{6a4e1f8c-f7f9-4983-b9b4-e06e406d35d9}"> | ||
<Declaration><![CDATA[METHOD AddTwoInts:DINT | ||
VAR_INPUT | ||
Variable1 :DINT; | ||
Variable2:DINT ; | ||
END_VAR]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[AddTwoInts:=Variable1+Variable2 ;]]></ST> | ||
</Implementation> | ||
</Method> | ||
<Property Name="AnotherProperty" Id="{aa0cfd4f-5e29-4982-9f71-257c1439d0f2}"> | ||
<Declaration><![CDATA[PROPERTY AnotherProperty : LREAL]]></Declaration> | ||
<Get Name="Get" Id="{d44792da-1b4d-4983-85ab-83fe99d160dd}"> | ||
<Declaration><![CDATA[VAR | ||
percent:LREAL:=100; | ||
END_VAR]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[]]></ST> | ||
</Implementation> | ||
</Get> | ||
<Set Name="Set" Id="{39df90cf-cdb1-4cd9-b65e-5832b944cb70}"> | ||
<Declaration><![CDATA[VAR | ||
sName:STRING(20) := 'This is the one!'; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[]]></ST> | ||
</Implementation> | ||
</Set> | ||
</Property> | ||
<Property Name="Counter" Id="{d49735b6-a4d9-4d67-adc2-f3998b3471ec}"> | ||
<Declaration><![CDATA[PROPERTY Counted : DINT]]></Declaration> | ||
<Get Name="Get" Id="{7c33609a-907f-4f05-8aea-95e3f6a224e3}"> | ||
<Declaration><![CDATA[VAR | ||
AddOne:DINT:=1 ; | ||
END_VAR]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[]]></ST> | ||
</Implementation> | ||
</Get> | ||
<Set Name="Set" Id="{4bb13cca-2444-4335-a94c-c714ed95062a}"> | ||
<Declaration><![CDATA[VAR | ||
SubTractTwo : DINT:=2; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[]]></ST> | ||
</Implementation> | ||
</Set> | ||
</Property> | ||
<Method Name="SecondMethod" Id="{f5bbaa77-a784-4d59-b884-5b52362ac1cd}"> | ||
<Declaration><![CDATA[METHOD SecondMethod : BOOL | ||
VAR_INPUT | ||
bBool:BOOL; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[]]></ST> | ||
</Implementation> | ||
</Method> | ||
</POU> | ||
</TcPlcObject> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.