Skip to content

Commit

Permalink
Merge branch 'release/4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
ktekinay committed Mar 21, 2020
2 parents e5ed74f + d27612e commit f72e7ee
Show file tree
Hide file tree
Showing 16 changed files with 2,044 additions and 571 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ JSONItem_MTC Harness/Builds - JSONItem_MTC Harness.xojo_project
JSONItem_MTC Harness.xojo_project alias
Double-Click Me.xojo_project
JSONItem_MTC Harness/JSONItem_MTC.debug.app
JSONItem_MTC Harness/Builds - JSONItem_MTC Harness
13 changes: 7 additions & 6 deletions JSONItem_MTC Harness/JSONItem_MTC Harness.xojo_project
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Type=Desktop
RBProjectVersion=2019.011
RBProjectVersion=2019.031
MinIDEVersion=20070100
OrigIDEVersion=00000000
Class=App;App.xojo_code;&h0000000014C611D3;&h0000000000000000;false
MenuBar=MenuBar1;MenuBar1.xojo_menu;&h0000000018745784;&h0000000000000000;false
Window=WndMenu;WndMenu.xojo_window;&h00000000618D91A0;&h0000000000000000;false
Expand All @@ -9,10 +10,10 @@ Folder=XojoUnit;XojoUnit;&h000000002516B04D;&h0000000000000000;false
Folder=Tests;Tests;&h000000001962C3CC;&h0000000000000000;false
Class=Stopwatch_MTC;Stopwatch_MTC.xojo_code;&h0000000034CE49A5;&h0000000000000000;false
Module=FormatCodePreferences;FormatCodePreferences.xojo_code;&h000000002977F6F1;&h0000000000000000;false
Module=M_JSON;M_JSON.xojo_code;&h00000000190CD7FF;&h0000000000000000;false
BuildSteps=Build Automation;Build Automation.xojo_code;&h000000007E1DE94C;&h0000000000000000;false
Class=JSONItem_MTC;../JSONItem_MTC.xojo_xml_code;&h000000002DCCA46D;&h0000000000000000;false
Class=JSONWebToken_MTC;../JSONWebToken_MTC.xojo_xml_code;&h00000000034117FF;&h0000000000000000;false
Module=M_JSON;M_JSON.xojo_code;&h00000000190CD7FF;&h0000000000000000;false
Class=DesktopTestController;Tests/DesktopTestController.xojo_code;&h000000003FC78D4E;&h000000001962C3CC;false
Class=BasicTests_JSONItem;Tests/BasicTests_JSONItem.xojo_code;&h000000006BEECF33;&h000000001962C3CC;false
Class=BasicTests_JSONItem_MTC;Tests/BasicTests_JSONItem_MTC.xojo_code;&h000000002324D4BF;&h000000001962C3CC;false
Expand All @@ -26,7 +27,6 @@ Class=StressTests;Tests/StressTests.xojo_code;&h000000001D5DEFFF;&h000000001962C
Class=XojoJSONItemTests;Tests/XojoJSONItemTests.xojo_code;&h00000000794C237D;&h000000001962C3CC;false
RawData=json_sample;Text Files/json_sample.txt;&h000000005E7609A1;&h0000000000000000;false
Module=M_Global;M_Global.xojo_code;&h000000003616CFFF;&h0000000000000000;false
Class=JSONDictionary;M_JSON/JSONDictionary.xojo_code;&h0000000035DB8FFF;&h00000000190CD7FF;false
Folder=Tests;XojoUnit/Tests;&h0000000044C729E7;&h000000002516B04D;false
Class=XojoUnitSuperClassTests;XojoUnit/Tests/XojoUnitSuperClassTests.xojo_code;&h000000003A8067FF;&h0000000044C729E7;false
Class=XojoUnitTests;XojoUnit/Tests/XojoUnitTests.xojo_code;&h0000000045CA76B3;&h0000000044C729E7;false
Expand All @@ -41,13 +41,14 @@ MenuBar=XojoUnitMenuBar;XojoUnit/XojoUnitMenuBar.xojo_menu;&h00000000726AEEEA;&h
Toolbar=XojoUnitTestToolbar;XojoUnit/XojoUnitTestToolbar.xojo_toolbar;&h000000004C5F6799;&h000000002516B04D;false
Window=XojoUnitAboutWindow;XojoUnit/XojoUnitAboutWindow.xojo_window;&h0000000006C01E42;&h000000002516B04D;false
Window=XojoUnitTestWindow;XojoUnit/XojoUnitTestWindow.xojo_window;&h000000005E851226;&h000000002516B04D;false
Class=JSONDictionary;M_JSON/JSONDictionary.xojo_code;&h0000000035DB8FFF;&h00000000190CD7FF;false
DefaultWindow=WndMenu
AppMenuBar=MenuBar1
MajorVersion=1
MinorVersion=0
MajorVersion=4
MinorVersion=2
SubVersion=0
NonRelease=0
Release=0
Release=3
InfoVersion=
LongVersion=
ShortVersion=
Expand Down
38 changes: 25 additions & 13 deletions JSONItem_MTC Harness/M_JSON.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ Protected Module M_JSON
#tag EndMethod

#tag Method, Flags = &h21
Private Function ParseArray(mb As MemoryBlock, p As Ptr, ByRef bytePos As Integer) As Variant()
Private Function ParseArray(mb As MemoryBlock, p As Ptr, ByRef bytePos As Integer, isCaseSensitive As Boolean) As Variant()
#if not DebugBuild
#pragma BackgroundTasks kAllowBackgroudTasks
#pragma BoundsChecking false
Expand Down Expand Up @@ -748,7 +748,7 @@ Protected Module M_JSON

foundComma = false

dim value as variant = ParseValue( mb, p, bytePos )
dim value as variant = ParseValue( mb, p, bytePos, isCaseSensitive )
result.Append value

expectingComma = true
Expand All @@ -759,7 +759,7 @@ Protected Module M_JSON
#tag EndMethod

#tag Method, Flags = &h0
Function ParseJSON_MTC(json As String) As Variant
Function ParseJSON_MTC(json As String, isCaseSensitive As Boolean = True) As Variant
//
// Takes in JSON and returns either a Dictionary or Variant array
//
Expand Down Expand Up @@ -813,9 +813,9 @@ Protected Module M_JSON
bytePos = bytePos + 1

if thisByte = kSquareBracket then
result = ParseArray( mbJSON, pJSON, bytePos )
result = ParseArray( mbJSON, pJSON, bytePos, isCaseSensitive )
elseif thisByte = kCurlyBrace then
result = ParseObject( mbJSON, pJSON, bytePos )
result = ParseObject( mbJSON, pJSON, bytePos, isCaseSensitive )
else
raise new JSONException( "Illegal value", 10, 1 )
end if
Expand Down Expand Up @@ -951,7 +951,7 @@ Protected Module M_JSON
#tag EndMethod

#tag Method, Flags = &h21
Private Function ParseObject(mb As MemoryBlock, p As Ptr, ByRef bytePos As Integer) As Dictionary
Private Function ParseObject(mb As MemoryBlock, p As Ptr, ByRef bytePos As Integer, isCaseSensitive As Boolean) As Dictionary
#if not DebugBuild
#pragma BackgroundTasks kAllowBackgroudTasks
#pragma BoundsChecking false
Expand All @@ -961,7 +961,12 @@ Protected Module M_JSON

const kColon as integer = 58

dim result as new M_JSON.JSONDictionary
dim result as Dictionary
if isCaseSensitive then
result = new M_JSON.JSONDictionary
else
result = new Dictionary
end if

dim key as string
dim value as variant
Expand Down Expand Up @@ -1025,7 +1030,7 @@ Protected Module M_JSON
if expectingValue then
expectingValue = false
expectingComma = true
value = ParseValue( mb, p, bytePos )
value = ParseValue( mb, p, bytePos, isCaseSensitive )

result.Value( key ) = value

Expand Down Expand Up @@ -1194,7 +1199,7 @@ Protected Module M_JSON
#tag EndMethod

#tag Method, Flags = &h21
Private Function ParseValue(mb As MemoryBlock, p As Ptr, ByRef bytePos As Integer) As Variant
Private Function ParseValue(mb As MemoryBlock, p As Ptr, ByRef bytePos As Integer, isCaseSensitive As Boolean) As Variant
#if not DebugBuild
#pragma BackgroundTasks kAllowBackgroudTasks
#pragma BoundsChecking false
Expand Down Expand Up @@ -1222,11 +1227,11 @@ Protected Module M_JSON
select case thisByte
case kSquareBracket
bytePos = bytePos + 1
return ParseArray( mb, p, bytePos )
return ParseArray( mb, p, bytePos, isCaseSensitive )

case kCurlyBrace
bytePos = bytePos + 1
return ParseObject( mb, p, bytePos )
return ParseObject( mb, p, bytePos, isCaseSensitive )

case kN // Should be null
if ( bytePos + 4 ) < mb.Size and p.Byte( bytePos + 1 ) = kU and p.Byte( bytePos + 2 ) = kL and p.Byte( bytePos + 3 ) = kL then
Expand Down Expand Up @@ -1275,7 +1280,7 @@ Protected Module M_JSON
#tag EndProperty


#tag Constant, Name = kAllowBackgroudTasks, Type = Boolean, Dynamic = False, Default = \"True", Scope = Private
#tag Constant, Name = kAllowBackgroudTasks, Type = Boolean, Dynamic = False, Default = \"False", Scope = Private
#tag EndConstant

#tag Constant, Name = kBackslash, Type = Double, Dynamic = False, Default = \"92", Scope = Private
Expand Down Expand Up @@ -1314,7 +1319,7 @@ Protected Module M_JSON
#tag Constant, Name = kTab, Type = Double, Dynamic = False, Default = \"9", Scope = Private
#tag EndConstant

#tag Constant, Name = kVersion, Type = String, Dynamic = False, Default = \"4.1.1", Scope = Protected
#tag Constant, Name = kVersion, Type = String, Dynamic = False, Default = \"4.2", Scope = Protected
#tag EndConstant


Expand All @@ -1323,34 +1328,41 @@ Protected Module M_JSON
Name="Name"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Index"
Visible=true
Group="ID"
InitialValue="-2147483648"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Super"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Left"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Top"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag EndViewBehavior
End Module
Expand Down
Loading

0 comments on commit f72e7ee

Please sign in to comment.