Skip to content

Commit

Permalink
Merge branch release/1.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
rakuyoMo committed Apr 7, 2022
2 parents 95a2215 + 8a96a7f commit 8f3b490
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 10 deletions.
2 changes: 1 addition & 1 deletion JSONPreview.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Pod::Spec.new do |s|

s.name = 'JSONPreview'

s.version = '1.3.5'
s.version = '1.3.6'

s.summary = '🎨 A view that can be highlighted after formatting JSON.'

Expand Down
8 changes: 4 additions & 4 deletions JSONPreview.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -501,15 +501,15 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 13;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = 5C9JW4S9DE;
INFOPLIST_FILE = "$(SRCROOT)/JSONPreview/Other/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.5;
MARKETING_VERSION = 1.3.6;
PRODUCT_BUNDLE_IDENTIFIER = com.rakuyo.JSONPreview;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -523,15 +523,15 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 13;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = 5C9JW4S9DE;
INFOPLIST_FILE = "$(SRCROOT)/JSONPreview/Other/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.5;
MARKETING_VERSION = 1.3.6;
PRODUCT_BUNDLE_IDENTIFIER = com.rakuyo.JSONPreview;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
9 changes: 9 additions & 0 deletions JSONPreview/Core/JSONLexer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,15 @@ private extension JSONLexer {
if first.isNumber || first == "." {
number += String(first)
_first = tmpJSON.removeFirst()
}

// Scientific counting support
else if first.lowercased() == "e",
let next = tmpJSON.first,
(next == "+" || next == "-" || next.isNumber) {

number += (String(first) + String(tmpJSON.removeFirst()))
_first = tmpJSON.removeFirst()

} else {
tmpJSON = String(first) + tmpJSON
Expand Down
22 changes: 21 additions & 1 deletion JSONPreview/Other/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ViewController: UIViewController {
[
{
"string" : "string",
"int" : 1024,
"float" : 3.1415926,
"negative_numbers" : -50,
"bool_true" : true,
Expand All @@ -65,6 +66,7 @@ class ViewController: UIViewController {
"effects_in_array" : [
"string",
3.1415926,
1024,
-50,
true,
false,
Expand All @@ -80,6 +82,16 @@ class ViewController: UIViewController {
{},
]
},
{
"exponential_value": [
1024e+23,
-25e+23,
-25e-23,
2.54e23,
3.1415926E+23,
3.1415926E-23,
]
},
{
"quotes_string": "This is a string that has some \\"quotes\\" inside it!",
"very_long_value" : "A very very very very very very very very very very very very long string."
Expand All @@ -104,7 +116,15 @@ class ViewController: UIViewController {
]
"""

previewView.preview(json, style: .default)
let start = Date().timeIntervalSince1970
print("will display json")

previewView.preview(json, style: .default) {
let end = Date().timeIntervalSince1970
let timeConsuming = end - start

print("did display json at: \(timeConsuming)")
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions JSONPreviewTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.3.5</string>
<string>1.3.6</string>
<key>CFBundleVersion</key>
<string>13</string>
<string>14</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions JSONPreviewUITests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.3.5</string>
<string>1.3.6</string>
<key>CFBundleVersion</key>
<string>13</string>
<string>14</string>
</dict>
</plist>
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ For rendering, `JSONPreview` performs only **limited** formatting checks, includ
- `"` must occur in pairs.
- The previous node of `"` can only be one of `{`, `[`, `,` and `:`.
- Spell checking for `null`, `true`, and `false`.
- For scientific notation, the next node of `{E/e}` must be `+`, `-` or a number.

Any other syntax errors will not trigger a rendering error.

Expand Down
1 change: 1 addition & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ previewView.preview(json, style: style)
- `"` 必须成对出现。
- `"` 的上一个节点只能是 `{``[``,` 以及 `:` 中的一个。
- 针对 `null``true` 以及 `false` 的拼写检查。
- 针对科学计数法,`{E/e}` 的下一个节点必须是 `+``-` 或数字。

除此之外的语法错误均不会触发渲染错误。

Expand Down

0 comments on commit 8f3b490

Please sign in to comment.