diff --git a/Build/4DPop Macros.4dbase.zip b/Build/4DPop Macros.4dbase.zip index d518f8e..c715a6e 100644 Binary files a/Build/4DPop Macros.4dbase.zip and b/Build/4DPop Macros.4dbase.zip differ diff --git a/Build/Components/4DPop Macros.4dbase/4DPop Macros.4DZ b/Build/Components/4DPop Macros.4dbase/4DPop Macros.4DZ index 9b72847..45bd20e 100755 Binary files a/Build/Components/4DPop Macros.4dbase/4DPop Macros.4DZ and b/Build/Components/4DPop Macros.4dbase/4DPop Macros.4DZ differ diff --git a/Build/Components/4DPop Macros.4dbase/Info.plist b/Build/Components/4DPop Macros.4dbase/Info.plist index 977f1d5..a964b7b 100755 --- a/Build/Components/4DPop Macros.4dbase/Info.plist +++ b/Build/Components/4DPop Macros.4dbase/Info.plist @@ -6,13 +6,13 @@ CFBundleName 4DPop Macros CFBundleVersion - 275 + 277 NSHumanReadableCopyright ©vdl 2009-2023 CFBundleGetInfoString 20R4 CFBundleLongVersionString - 20R4 (274) + 20R4 (276) CFBundleShortVersionString 20R4 CFBundleDisplayName diff --git a/Build/Components/4DPop Macros.4dbase/Libraries/lib4d-arm64.dylib b/Build/Components/4DPop Macros.4dbase/Libraries/lib4d-arm64.dylib index 93c0eab..319ed2f 100644 Binary files a/Build/Components/4DPop Macros.4dbase/Libraries/lib4d-arm64.dylib and b/Build/Components/4DPop Macros.4dbase/Libraries/lib4d-arm64.dylib differ diff --git a/Build/Components/4DPop Macros.4dbase/Resources/InfoPlist.strings b/Build/Components/4DPop Macros.4dbase/Resources/InfoPlist.strings index a607b92..5a39683 100755 Binary files a/Build/Components/4DPop Macros.4dbase/Resources/InfoPlist.strings and b/Build/Components/4DPop Macros.4dbase/Resources/InfoPlist.strings differ diff --git a/Info.plist b/Info.plist index 977f1d5..a964b7b 100755 --- a/Info.plist +++ b/Info.plist @@ -6,13 +6,13 @@ CFBundleName 4DPop Macros CFBundleVersion - 275 + 277 NSHumanReadableCopyright ©vdl 2009-2023 CFBundleGetInfoString 20R4 CFBundleLongVersionString - 20R4 (274) + 20R4 (276) CFBundleShortVersionString 20R4 CFBundleDisplayName diff --git a/Project/Sources/Classes/beautifier.4dm b/Project/Sources/Classes/beautifier.4dm index 8e2e1b6..4b73044 100644 --- a/Project/Sources/Classes/beautifier.4dm +++ b/Project/Sources/Classes/beautifier.4dm @@ -51,28 +51,29 @@ Class constructor() endForEach: $c[14]\ } + $t:="(?0 ? Bool:C1537($options.aLineOfCommentsMustBePrecededByALineBreak) : False:C215)\ & ($line#(kCommentMark+"}"))\ & ($line#(kCommentMark+"]"))\ - & ($line#(kCommentMark+")")) + & ($line#(kCommentMark+")"))\ + & ($line#(kCommentMark+"%")) End if $doLineComment:=This:C1470.rgx.setPattern(This:C1470._patterns.commentLine).match() - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.If).match()) $doLineBefore:=Bool:C1537($options.lineBreakBeforeBranchingStructures) & Not:C34($isComment) @@ -278,8 +277,7 @@ Function beautify() End if - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.Else).match()) If ($tLon_branchAndLoop{$tLon_branchAndLoop}=4) @@ -297,8 +295,7 @@ Function beautify() $doLineAfter:=True:C214 $skipLineAfter:=False:C215 - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.EndIf).match()) $doLineBefore:=(Not:C34($skipLineAfter) | Not:C34($isClosure))\ @@ -313,8 +310,7 @@ Function beautify() End if - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.Use).match()) If (Bool:C1537($options.splitTestLines)) @@ -329,8 +325,7 @@ Function beautify() APPEND TO ARRAY:C911($tLon_branchAndLoop; 13) - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.EndUse).match()) $doLineBefore:=Not:C34($skipLineAfter) | Not:C34($isClosure) @@ -343,8 +338,7 @@ Function beautify() End if - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.ForEach).match()) If (Bool:C1537($options.splitTestLines)) @@ -359,8 +353,7 @@ Function beautify() APPEND TO ARRAY:C911($tLon_branchAndLoop; 14) - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.EndForEach).match()) $doLineBefore:=Not:C34($skipLineAfter) | Not:C34($isClosure) @@ -373,8 +366,7 @@ Function beautify() End if - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.CaseOf).match()) $level+=1 @@ -385,8 +377,7 @@ Function beautify() APPEND TO ARRAY:C911($tLon_branchAndLoop; 4) - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._controls.caseOfItem).match()) If (Bool:C1537($options.splitTestLines)) @@ -400,8 +391,7 @@ Function beautify() $doLineAfter:=True:C214 $skipLineAfter:=False:C215 - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.EndCase).match()) $doAddLine:=Bool:C1537($options.separationLineForCaseOf) @@ -417,8 +407,7 @@ Function beautify() $tLon_branchAndLoop{0}:=-5 - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.While).match()) If (Bool:C1537($options.splitTestLines)) @@ -433,8 +422,7 @@ Function beautify() APPEND TO ARRAY:C911($tLon_branchAndLoop; 6) - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.EndWhile).match()) $doLineBefore:=Not:C34($skipLineAfter) | Not:C34($isClosure) @@ -447,8 +435,7 @@ Function beautify() End if - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.For).match()) $doLineBefore:=Not:C34($isComment) @@ -472,8 +459,7 @@ Function beautify() APPEND TO ARRAY:C911($tLon_branchAndLoop; 8) - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.EndFor).match()) $doLineBefore:=Not:C34($skipLineAfter) | Not:C34($isClosure) @@ -486,8 +472,7 @@ Function beautify() End if - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.Repeat).match()) $doLineBefore:=True:C214 @@ -496,8 +481,7 @@ Function beautify() APPEND TO ARRAY:C911($tLon_branchAndLoop; 10) - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.Until).match()) If (Bool:C1537($options.splitTestLines)) @@ -516,42 +500,41 @@ Function beautify() End if - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.keywords).match()) $doLineBefore:=True:C214 $doLineAfter:=True:C214 $skipLineAfter:=False:C215 - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.BeginSQL).match()) $doLineBefore:=True:C214 $doLineAfter:=True:C214 $skipLineAfter:=False:C215 - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.EndSQL).match()) $doLineBefore:=True:C214 $doLineAfter:=True:C214 $skipLineAfter:=False:C215 - // —————————————————————————————————————————————————————————————————————————————————————————————————— - + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ Else $isEmptyLine:=False:C215 $doLineBefore:=$isClosure - // —————————————————————————————————————————————————————————————————————————————————————————————————— + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ End case + // Add a space before the comment and capitalize the first letter If ($options.formatComments)\ - && (Position:C15(kCommentMark; $line)#0) // Add a space before the comment and capitalize the first letter + && (Position:C15(kCommentMark; $line)#0)\ + && (Position:C15(kCommentMark+"%"; $line)=0)\ + && Not:C34(This:C1470.rgx.setPattern(This:C1470._patterns.commentLine).match()) $line:=This:C1470._formatComment($line) @@ -676,7 +659,7 @@ Function _splitIntoKeyAndValue($code : Text; $cmd : Object) : Text Case of - // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : ($cmd.id=1471) // New Object $pos:=Position:C15($cmd.name; $code) @@ -705,7 +688,7 @@ Function _splitIntoKeyAndValue($code : Text; $cmd : Object) : Text End if - // ______________________________________________________ + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : ($cmd.id=1055) // SVG SET ATTRIBUTE $splitted:=$prefix+$cmd.name+"(" @@ -718,7 +701,7 @@ Function _splitIntoKeyAndValue($code : Text; $cmd : Object) : Text End if - // ______________________________________________________ + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : ($cmd.id=1220) // OB SET $pos:=Position:C15(";"; $code) @@ -730,7 +713,7 @@ Function _splitIntoKeyAndValue($code : Text; $cmd : Object) : Text End if - // ______________________________________________________ + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : ($cmd.id=865) // DOM Create XML element $pos:=Position:C15($cmd.name; $code) @@ -758,7 +741,7 @@ Function _splitIntoKeyAndValue($code : Text; $cmd : Object) : Text End if - // ______________________________________________________ + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : ($cmd.id=866) // DOM SET XML ATTRIBUTE $splitted:=$cmd.name+"(" @@ -783,7 +766,7 @@ Function _splitIntoKeyAndValue($code : Text; $cmd : Object) : Text End if - // ______________________________________________________ + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : ($cmd.id=1093) // ST SET ATTRIBUTES  $splitted:=$prefix+$cmd.name+"(" @@ -817,12 +800,12 @@ Function _splitIntoKeyAndValue($code : Text; $cmd : Object) : Text $splitted+=$t+"\\\r" $code:=Delete string:C232($code; 1; Length:C16($t)) - // ______________________________________________________ + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ Else // Oops - // ______________________________________________________ + //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ End case // Go to the first semicolon diff --git a/Project/Sources/Classes/macro.4dm b/Project/Sources/Classes/macro.4dm index 9c95f0f..99784e9 100755 --- a/Project/Sources/Classes/macro.4dm +++ b/Project/Sources/Classes/macro.4dm @@ -499,6 +499,12 @@ Function _paste($text : Text; $useSelection : Boolean) SET MACRO PARAMETER:C998($target; $text) + If (Structure file:C489=Structure file:C489(*)) + + return + + End if + // Force tokenisation var $name : Text var $i; $mode; $origin; $state; $time; $UID : Integer diff --git a/Project/Sources/Methods/classDiagram.4dm b/Project/Sources/Methods/classDiagram.4dm new file mode 100644 index 0000000..1031940 --- /dev/null +++ b/Project/Sources/Methods/classDiagram.4dm @@ -0,0 +1,101 @@ +//%attributes = {} +var $key; $code; $name : Text +var $i; $j : Integer +var $attribute; $classes; $class : Object +var $c : Collection +var $regex : cs:C1710.regex + +ARRAY TEXT:C222($methods; 0) + +METHOD GET PATHS:C1163(Path class:K72:19; $methods; *) + +$regex:=cs:C1710.regex.new() +$classes:=New object:C1471 + +For ($i; 1; Size of array:C274($methods); 1) + + $name:=Delete string:C232($methods{$i}; 1; 8) + + If ($name#"@Entity") && ($name#"DataStore") + + METHOD GET CODE:C1190($methods{$i}; $code; *) + + $class:=New object:C1471 + + If ($regex.setPattern("(?m-si)Class extends\\s([[:alpha:]][[:alnum:]]*)").setTarget($code).match()) + + $class.extend:=$regex.matches[1].data + + End if + + $c:=$regex.setPattern("(?m-si)(?!.*[gs]et)Function ([[:alpha:]][^[:blank:]($]*)(?:\\(.*\\))(?:[^$]*)").extract(1) + + If ($c.length>0) + + $class.functions:=$c + + End if + + // Public attributes (not starting with an underscore) + $c:=$regex.setPattern("(?mi-s)This\\.(?!_)([^[:blank:]\\.]*):").extract(1) + + If ($c.length>0) + + $class.attributes:=New collection:C1472 + + For ($j; 0; $c.length-1; 1) + + If ($class.attributes.query("name = :1"; $c[$j]).pop()=Null:C1517) + + $attribute:=New object:C1471(\ + "name"; $c[$j]) + + //If ($regex.setPattern("(?mi-s)This\\."+$attribute.name+"\\.").match()) + //$attribute.type:="Object" + //End if + + $class.attributes.push($attribute) + + End if + End for + End if + + // Computed attributes + $c:=$regex.setPattern("(?mi-s)Function\\sget\\s([[:alpha:]][^[:blank:]($]*)\\(\\)\\s:\\s([[:alpha:]]*)").extract("1 2") + + If ($c.length>0) + + $class.attributes:=$class.attributes || New collection:C1472 + + For ($j; 0; $c.length-1; 2) + + $attribute:=New object:C1471(\ + "name"; $c[$j]; \ + "type"; $c[$j+1]; \ + "computed"; True:C214; \ + "writable"; $regex.setPattern("(?mi-s)Function set "+$c[$j]).match()) + + $class.attributes.push($attribute) + + End for + End if + + $classes[$name]:=$class + + End if +End for + +For each ($key; $classes) + + $class:=$classes[$key] + + If ($class.extend#Null:C1517) + + $classes[$class.extend].childs:=$classes[$class.extend].childs || New object:C1471 + $classes[$class.extend].childs[$key]:=$class + + //OB REMOVE($class; "extend") + + End if +End for each + diff --git a/Project/Sources/folders.json b/Project/Sources/folders.json index aeb4f2e..0c0be05 100755 --- a/Project/Sources/folders.json +++ b/Project/Sources/folders.json @@ -26,10 +26,12 @@ "COMPILER_TESTS", "createSymbolicLink", "macro", - "Method120", - "Method121", - "Method122", - "Method123" + "Method2", + "Method3", + "Method4", + "Method5", + "Method6", + "Method7" ] }, "#️⃣ API": {}, diff --git a/Resources/InfoPlist.strings b/Resources/InfoPlist.strings index a607b92..5a39683 100755 Binary files a/Resources/InfoPlist.strings and b/Resources/InfoPlist.strings differ