Skip to content

Commit

Permalink
Merge pull request #182 from IvanMathy/feat/releaseReadiness2
Browse files Browse the repository at this point in the history
Feat/release readiness2
  • Loading branch information
IvanMathy authored Sep 23, 2020
2 parents ccf8015 + 928be7f commit 5144567
Show file tree
Hide file tree
Showing 20 changed files with 4,141 additions and 54 deletions.
16 changes: 8 additions & 8 deletions Boop/Boop.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = RLZ8XBTX7G;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -758,7 +758,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.3.0;
OTHER_CODE_SIGN_FLAGS = "--deep";
PRODUCT_BUNDLE_IDENTIFIER = com.OKatBest.Boop;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -775,7 +775,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -789,7 +789,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.3.0;
OTHER_CODE_SIGN_FLAGS = "--deep";
PRODUCT_BUNDLE_IDENTIFIER = com.okatbest.boop;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -806,7 +806,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 16;
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -819,7 +819,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.3.0;
OTHER_CODE_SIGN_FLAGS = "--deep";
"OTHER_SWIFT_FLAGS[arch=*]" = "-D APPSTORE";
PRODUCT_BUNDLE_IDENTIFIER = com.OKatBest.Boop;
Expand All @@ -837,7 +837,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 16;
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -850,7 +850,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.3.0;
OTHER_CODE_SIGN_FLAGS = "--deep";
"OTHER_SWIFT_FLAGS[arch=*]" = "-D APPSTORE";
PRODUCT_BUNDLE_IDENTIFIER = com.okatbest.boop;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/IvanMathy/savannakit",
"state": {
"branch": null,
"revision": "d0950476608b714f435c7026ab8c7f13b87e5e81",
"version": "0.14.2"
"revision": "bb51ee074152a7361e7085d10723f699c79fe673",
"version": "0.15.1"
}
}
]
Expand Down
6 changes: 3 additions & 3 deletions Boop/Boop/Assets.xcassets/Icons/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "icons8-elephant.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "icons8-pineapple.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "icons8-translation.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
Binary file not shown.
42 changes: 17 additions & 25 deletions Boop/Boop/Editor/BoopLexer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ class BoopLexer: RegexLexer {

func generators(source: String) -> [TokenGenerator] {

let standalonePrefix = "(?<=[\\s]|^|[\\(,:])"
let standaloneSuffix = "(?=[\\s\\?\\!,:\\)\\();]|$)"

let quoteLookahead = "(?=(?:(?:[^\"]*\"){2})*[^\"]*$)"

let quotes = "(\"|@\")(?:[^\"\\\\\\n]|\\\\.)*[^\"\\n]*(@\"|\")"
let number = "\\b(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)\\b"
let number = #"\b(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)\b"#


var generators = [TokenGenerator?]()
Expand All @@ -36,61 +30,59 @@ class BoopLexer: RegexLexer {

// Find common attributes

generators.append(regexToken(.attribute, "\(standalonePrefix)(\(commonAttributes.joined(separator: "|")))\(standaloneSuffix)", options: .caseInsensitive))
generators.append(regexToken(.attribute, #"\b(\#(commonAttributes.joined(separator: "|")))\b"#, options: .caseInsensitive))

generators.append(regexToken(.keyword, "\(standalonePrefix)(\(moreAttributes.joined(separator: "|")))\(standaloneSuffix)", options: .caseInsensitive))
generators.append(regexToken(.keyword, #"\b(\#(moreAttributes.joined(separator: "|")))\b"#, options: .caseInsensitive))


// Extras

let UTCDate = "(?:(Sun|Mon|Tue|Wed|Thu|Fri|Sat),\\s+)?(0[1-9]|[1-2]?[0-9]|3[01])\\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s+(19[0-9]{2}|[2-9][0-9]{3})\\s+(2[0-3]|[0-1][0-9]):([0-5][0-9])(?::(60|[0-5][0-9]))?\\s+([-\\+][0-9]{2}[0-5][0-9]|(?:UT|GMT|(?:E|C|M|P)(?:ST|DT)|[A-IK-Z]))"

generators.append(regexToken(.number, "\(standalonePrefix)(\(UTCDate))\(standaloneSuffix)"))
generators.append(regexToken(.number, UTCDate))

// - Match MD5 strings
generators.append(regexToken(.keyword, "\(standalonePrefix)([a-f0-9]{32})\(standaloneSuffix)"))
generators.append(regexToken(.keyword, "[a-f0-9]{32}"))

// - Bootleg XML-like tags match:

generators.append(regexToken(.attribute, "(?m)\(quoteLookahead)<(?:.*?)\\b[^>]*\\/?>"))
generators.append(regexToken(.attribute, "<(?:.*?)\\b[^>]*\\/?>"))

// Strings

generators.append(regexToken(.string, quotes, options: [.dotMatchesLineSeparators, .caseInsensitive]))
// - Match JSON labels and generic parameters
generators.append(regexToken(.extra, #""([^"]+?)"\s*(?=:)"#, greedy: true))

generators.append(regexToken(.string, "`(?:[^`\\\\\\n]|\\\\.)*[^`\\n]*`", options: [.dotMatchesLineSeparators, .caseInsensitive]))
// Strings

generators.append(regexToken(.string, "'(?:[^\'\\\\\\n]|\\\\.)*[^\'\\n]*'", options: [.dotMatchesLineSeparators, .caseInsensitive]))
let quotes = #"(["'`])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1"#

generators.append(regexToken(.string, "(\"\"\")(.*?)(\"\"\")", options: [.dotMatchesLineSeparators, .caseInsensitive]))
generators.append(regexToken(.string, quotes, greedy: true))

// More Extras
generators.append(regexToken(.string, "(\"\"\")(.*?)(\"\"\")", options: [.dotMatchesLineSeparators, .caseInsensitive], greedy: true))

// - Match JSON labels and generic parameters
generators.append(regexToken(.extra, "(?m)\(quoteLookahead)(?=(?:[ {\\[]*))([^\\r\\n:\\s\\w]+?|\(quotes))\\s*(?=\\:(?!\\:))"))



// Comments

generators.append(regexToken(.comment, "\(quoteLookahead)//(.*)"))
generators.append(regexToken(.comment, #"(?=(\/\/.*))"#))

generators.append(regexToken(.comment, "\(quoteLookahead)/\\*.*?\\*/", options: [.dotMatchesLineSeparators, .caseInsensitive]))
generators.append(regexToken(.comment, #"(?=(\/\*[\s\S]*?(?:\*\/|$)))"#, options: [.dotMatchesLineSeparators], greedy: true))

generators.append(regexToken(.comment, "\(quoteLookahead)<\\!--[\\s\\S]*?(?:-\\->|$)", options: [.dotMatchesLineSeparators, .caseInsensitive]))
generators.append(regexToken(.comment, #"<!--[\s\S]*?-->"#, options: [.dotMatchesLineSeparators, .caseInsensitive], greedy: true))




return generators.compactMap( { $0 })
}

func regexToken(_ type: BoopToken.TokenType, _ pattern:String, options: NSRegularExpression.Options = .caseInsensitive) -> TokenGenerator? {
func regexToken(_ type: BoopToken.TokenType, _ pattern:String, options: NSRegularExpression.Options = .caseInsensitive, greedy: Bool = false) -> TokenGenerator? {
guard let regex = try? NSRegularExpression(pattern: pattern, options: options) else {
return nil
}
let generator = RegexTokenGenerator(regularExpression: regex, tokenTransformer: { (range) -> Token in
return BoopToken(type: type, range: range)
return BoopToken(type: type, range: range, greedy: greedy)
})
return TokenGenerator.regex(generator)
}
Expand Down
17 changes: 13 additions & 4 deletions Boop/Boop/Editor/BoopToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import Cocoa
import SavannaKit

class BoopToken: Token {
class BoopToken: Token, CustomStringConvertible {

public enum TokenType {


public enum TokenType: String {
case comment
case string
case attribute
Expand All @@ -26,15 +28,22 @@ class BoopToken: Token {
// Plain tokens are not even parsed in the first place.
var isPlain = false

var range: Range<String.Index>
var isActive = true
var isGreedy: Bool

var range: NSRange
var type: BoopToken.TokenType

init(type:TokenType, range: Range<String.Index>) {
init(type:TokenType, range: NSRange, greedy: Bool = false) {
self.range = range
self.type = type
self.isGreedy = greedy
}


var description: String {
return type.rawValue
}


}
6 changes: 3 additions & 3 deletions Boop/Boop/scripts/AndroidIOSStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
{
"api":1,
"name":"Android Strings to iOS Localizables",
"description":"Connverts Android Strings to iOS localizables",
"description":"Converts Android Strings to iOS localizables",
"author":"Manuel Kunz (https://github.com/KunzManuel)",
"icon":"quote",
"tags":"string, android, ios"
"icon":"translation",
"tags":"string,android,ios"
}
**/

Expand Down
4 changes: 2 additions & 2 deletions Boop/Boop/scripts/IOSAndroidStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"name":"iOS Localizables to Android Strings",
"description":"Converts iOS Localizables to Android Strings",
"author":"Manuel Kunz (https://github.com/KunzManuel)",
"icon":"quote",
"tags":"string, android, ios"
"icon":"translation",
"tags":"string,android,ios"
}
**/

Expand Down
21 changes: 21 additions & 0 deletions Boop/Boop/scripts/JSONtoYAML.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
{
"api":1,
"name":"JSON to YAML",
"description":"Converts JSON to YAML.",
"author":"Ivan",
"icon":"metamorphose",
"tags":"markup,convert"
}
**/

const yaml = require('@boop/js-yaml')

function main(input) {
try {
input.text = yaml.safeDump(JSON.parse(input.text))
}
catch(error) {
input.postError("Invalid JSON")
}
}
2 changes: 1 addition & 1 deletion Boop/Boop/scripts/PhpUnserialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name":"PHP Unserialize",
"description":"Convert PHP serialized data to JSON",
"author":"Rob Bogie",
"icon":"HTML",
"icon":"elephant",
"tags":"php,serialize,unserialize,json"
}
**/
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions Scripts/SpongeText.js → Boop/Boop/scripts/SpongeCase.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
{
"api": 1,
"name": "Sponge Text",
"description": "Randomly capitalizes letters to make it sarcastic",
"name": "Sponge Case",
"description": "CoNvERtS yoUR Text To A HIghER fOrM Of CoMMUnICAtIOn",
"author": "Paul Seelman",
"icon": "dice",
"tags": "sponge,spongetext,spongebob,spongebob text,sarcasm,sarcastic,random,caps,capitalized"
"icon": "pineapple",
"tags": "bob,sarcasm,no,this,is,patrick"
}
**/
function spongeText(string) {
Expand Down
23 changes: 23 additions & 0 deletions Boop/Boop/scripts/YAMLtoJSON.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
{
"api":1,
"name":"YAML to JSON",
"description":"Converts YAML to JSON.",
"author":"Ivan",
"icon":"metamorphose",
"tags":"markup,convert"
}
**/

const yaml = require('@boop/js-yaml')

function main(input) {

try {
input.text = JSON.stringify(yaml.safeLoad(input.text), null, 2)
}
catch(error) {
input.postError("Invalid YAML")
}

}
Loading

0 comments on commit 5144567

Please sign in to comment.