Skip to content

Commit

Permalink
chore: WIP syntax highlighting, new logo, remooved some beacon refere…
Browse files Browse the repository at this point in the history
…nces
  • Loading branch information
x86y committed Oct 16, 2023
1 parent 6506008 commit b380ae9
Show file tree
Hide file tree
Showing 17 changed files with 151 additions and 51 deletions.
10 changes: 0 additions & 10 deletions Beacon copy-Info.plist

This file was deleted.

42 changes: 20 additions & 22 deletions Beacon.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
F312CFA62995270D008EC197 /* Fonts in Resources */ = {isa = PBXBuildFile; fileRef = F3B198DE2995182E00FE664F /* Fonts */; };
F31BCE782A33B33E00A6116D /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = F31BCE772A33B33E00A6116D /* Utils.swift */; };
F31BCE792A33B33E00A6116D /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = F31BCE772A33B33E00A6116D /* Utils.swift */; };
F31BCE7B2A33B3A200A6116D /* CustomInputField.swift in Sources */ = {isa = PBXBuildFile; fileRef = F31BCE7A2A33B3A200A6116D /* CustomInputField.swift */; };
F31BCE7C2A33B3A200A6116D /* CustomInputField.swift in Sources */ = {isa = PBXBuildFile; fileRef = F31BCE7A2A33B3A200A6116D /* CustomInputField.swift */; };
F31BCE7E2A348B7500A6116D /* HelpView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F31BCE7D2A348B7500A6116D /* HelpView.swift */; };
F31BCE7F2A348B7500A6116D /* HelpView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F31BCE7D2A348B7500A6116D /* HelpView.swift */; };
F327CA1A2ADD0A2F00FD72D9 /* SwiftUIInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = F327CA192ADD0A2F00FD72D9 /* SwiftUIInput.swift */; };
F327CA1B2ADD0A2F00FD72D9 /* SwiftUIInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = F327CA192ADD0A2F00FD72D9 /* SwiftUIInput.swift */; };
F327CA1A2ADD0A2F00FD72D9 /* ReplInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = F327CA192ADD0A2F00FD72D9 /* ReplInput.swift */; };
F327CA1B2ADD0A2F00FD72D9 /* ReplInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = F327CA192ADD0A2F00FD72D9 /* ReplInput.swift */; };
F32D9E8429966FCD007BC97C /* Beacon-Bridging-Header.h in Sources */ = {isa = PBXBuildFile; fileRef = F312CF8729951C49008EC197 /* Beacon-Bridging-Header.h */; };
F32D9E8529966FCD007BC97C /* BeaconApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B198CD299517DA00FE664F /* BeaconApp.swift */; };
F32D9E8529966FCD007BC97C /* ArraygroundApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B198CD299517DA00FE664F /* ArraygroundApp.swift */; };
F32D9E8629966FCD007BC97C /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3877C8B29952A5400E2FCB5 /* ContentView.swift */; };
F32D9E8829966FCD007BC97C /* simbqn.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3B198E42995185400FE664F /* simbqn.a */; };
F32D9E8929966FCD007BC97C /* Introspect in Frameworks */ = {isa = PBXBuildFile; productRef = F32D9E8129966FCD007BC97C /* Introspect */; };
Expand All @@ -34,10 +32,12 @@
F32D9E972996710A007BC97C /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3877C8B29952A5400E2FCB5 /* ContentView.swift */; };
F361BF092AD2A74C00200F72 /* curl.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3AC4D252A4F6C3000B4FECD /* curl.xcframework */; };
F361BF0C2AD2A76700200F72 /* DashboardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3DF82892A4EF33A00F6CD19 /* DashboardView.swift */; };
F379CEC32ADD94BC00164F76 /* LexK.swift in Sources */ = {isa = PBXBuildFile; fileRef = F379CEC22ADD94BC00164F76 /* LexK.swift */; };
F379CEC42ADD94BC00164F76 /* LexK.swift in Sources */ = {isa = PBXBuildFile; fileRef = F379CEC22ADD94BC00164F76 /* LexK.swift */; };
F3877C8E29952A6600E2FCB5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F3877C8D29952A6600E2FCB5 /* Assets.xcassets */; };
F38F03A92A323F8500F66354 /* libksim.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F38F03A82A323F8500F66354 /* libksim.a */; };
F3AC4D262A4F6C3100B4FECD /* curl.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3AC4D252A4F6C3000B4FECD /* curl.xcframework */; };
F3B198CE299517DA00FE664F /* BeaconApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B198CD299517DA00FE664F /* BeaconApp.swift */; };
F3B198CE299517DA00FE664F /* ArraygroundApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B198CD299517DA00FE664F /* ArraygroundApp.swift */; };
F3B198D5299517DB00FE664F /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F3B198D4299517DB00FE664F /* Preview Assets.xcassets */; };
F3B198F4299518E900FE664F /* KeyboardViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B198F3299518E900FE664F /* KeyboardViewController.swift */; };
F3B19907299518F900FE664F /* BQNInputSetProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B198FE299518F800FE664F /* BQNInputSetProvider.swift */; };
Expand Down Expand Up @@ -100,20 +100,19 @@
F312CF8729951C49008EC197 /* Beacon-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Beacon-Bridging-Header.h"; sourceTree = "<group>"; };
F312CF95299521C6008EC197 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F31BCE772A33B33E00A6116D /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
F31BCE7A2A33B3A200A6116D /* CustomInputField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomInputField.swift; sourceTree = "<group>"; };
F31BCE7D2A348B7500A6116D /* HelpView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelpView.swift; sourceTree = "<group>"; };
F327CA192ADD0A2F00FD72D9 /* SwiftUIInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIInput.swift; sourceTree = "<group>"; };
F327CA192ADD0A2F00FD72D9 /* ReplInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReplInput.swift; sourceTree = "<group>"; };
F32D9E9429966FCD007BC97C /* BeaconSim.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BeaconSim.app; sourceTree = BUILT_PRODUCTS_DIR; };
F32D9E9529966FCD007BC97C /* Beacon copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Beacon copy-Info.plist"; path = "/Users/sp/mac/applefarm/Beacon/Beacon copy-Info.plist"; sourceTree = "<absolute>"; };
F3512E082A4CE18D00658F24 /* libk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libk.a; path = Beacon/Libs/libk.a; sourceTree = "<group>"; };
F35FE0AD2A44387C00653849 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
F35FE0AF2A44387D00653849 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
F379CEC22ADD94BC00164F76 /* LexK.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LexK.swift; sourceTree = "<group>"; };
F3877C8B29952A5400E2FCB5 /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
F3877C8D29952A6600E2FCB5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
F38F03A82A323F8500F66354 /* libksim.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libksim.a; path = Beacon/libs/libksim.a; sourceTree = "<group>"; };
F3AC4D252A4F6C3000B4FECD /* curl.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = curl.xcframework; path = Beacon/Libs/curl.xcframework; sourceTree = "<group>"; };
F3B198CA299517DA00FE664F /* Beacon.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Beacon.app; sourceTree = BUILT_PRODUCTS_DIR; };
F3B198CD299517DA00FE664F /* BeaconApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BeaconApp.swift; sourceTree = "<group>"; };
F3B198CD299517DA00FE664F /* ArraygroundApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArraygroundApp.swift; sourceTree = "<group>"; };
F3B198D4299517DB00FE664F /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
F3B198DB2995181700FE664F /* stdlib */ = {isa = PBXFileReference; lastKnownFileType = folder; path = stdlib; sourceTree = "<group>"; };
F3B198DD2995181F00FE664F /* bqnffi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bqnffi.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -175,8 +174,7 @@
F30A7B8C2A37258200503966 /* Components */ = {
isa = PBXGroup;
children = (
F31BCE7A2A33B3A200A6116D /* CustomInputField.swift */,
F327CA192ADD0A2F00FD72D9 /* SwiftUIInput.swift */,
F327CA192ADD0A2F00FD72D9 /* ReplInput.swift */,
);
path = Components;
sourceTree = "<group>";
Expand All @@ -202,6 +200,7 @@
F3B198DD2995181F00FE664F /* bqnffi.h */,
F3E1DFF62A3216C000B4A553 /* k.h */,
F312CF8729951C49008EC197 /* Beacon-Bridging-Header.h */,
F379CEC22ADD94BC00164F76 /* LexK.swift */,
);
path = Utilities;
sourceTree = "<group>";
Expand All @@ -226,7 +225,6 @@
F3B198F2299518E900FE664F /* Keyboard */,
F3B198CB299517DA00FE664F /* Products */,
F312CF7329951A0F008EC197 /* Frameworks */,
F32D9E9529966FCD007BC97C /* Beacon copy-Info.plist */,
);
sourceTree = "<group>";
};
Expand All @@ -250,7 +248,7 @@
F3D296802A404A1D00AD21A2 /* Models */,
F34179E62A35349800ACAF16 /* Utilities */,
F3B19916299519AE00FE664F /* Libs */,
F3B198CD299517DA00FE664F /* BeaconApp.swift */,
F3B198CD299517DA00FE664F /* ArraygroundApp.swift */,
F3877C8D29952A6600E2FCB5 /* Assets.xcassets */,
);
path = Beacon;
Expand Down Expand Up @@ -451,11 +449,11 @@
F31BCE792A33B33E00A6116D /* Utils.swift in Sources */,
F3E1DFF52A31F9D800B4A553 /* ConfigView.swift in Sources */,
F32D9E8429966FCD007BC97C /* Beacon-Bridging-Header.h in Sources */,
F379CEC42ADD94BC00164F76 /* LexK.swift in Sources */,
F30A7B8B2A370B7800503966 /* BuffersView.swift in Sources */,
F31BCE7F2A348B7500A6116D /* HelpView.swift in Sources */,
F32D9E8529966FCD007BC97C /* BeaconApp.swift in Sources */,
F327CA1B2ADD0A2F00FD72D9 /* SwiftUIInput.swift in Sources */,
F31BCE7C2A33B3A200A6116D /* CustomInputField.swift in Sources */,
F32D9E8529966FCD007BC97C /* ArraygroundApp.swift in Sources */,
F327CA1B2ADD0A2F00FD72D9 /* ReplInput.swift in Sources */,
F32D9E8629966FCD007BC97C /* ContentView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -469,11 +467,11 @@
F3DF828A2A4EF33A00F6CD19 /* DashboardView.swift in Sources */,
F3E1DFF42A31F9D800B4A553 /* ConfigView.swift in Sources */,
F312CF8829951C89008EC197 /* Beacon-Bridging-Header.h in Sources */,
F379CEC32ADD94BC00164F76 /* LexK.swift in Sources */,
F30A7B8A2A370B7800503966 /* BuffersView.swift in Sources */,
F31BCE7E2A348B7500A6116D /* HelpView.swift in Sources */,
F3B198CE299517DA00FE664F /* BeaconApp.swift in Sources */,
F327CA1A2ADD0A2F00FD72D9 /* SwiftUIInput.swift in Sources */,
F31BCE7B2A33B3A200A6116D /* CustomInputField.swift in Sources */,
F3B198CE299517DA00FE664F /* ArraygroundApp.swift in Sources */,
F327CA1A2ADD0A2F00FD72D9 /* ReplInput.swift in Sources */,
F32D9E972996710A007BC97C /* ContentView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -734,7 +732,7 @@
"$(PROJECT_DIR)/Beacon/libs",
"$(PROJECT_DIR)/Beacon/Libs",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.1;
PRODUCT_BUNDLE_IDENTIFIER = arrscience.Beacons;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -781,7 +779,7 @@
"$(PROJECT_DIR)/Beacon/libs",
"$(PROJECT_DIR)/Beacon/Libs",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.1;
PRODUCT_BUNDLE_IDENTIFIER = arrscience.Beacons;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
8 changes: 4 additions & 4 deletions Beacon/BeaconApp.swift → Beacon/ArraygroundApp.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//
// BeaconApp.swift
// Beacon
// ArraygroundApp.swift
// Arrayground
//

import SwiftUI

@main
struct BeaconApp: App {
struct ArraygroundApp: App {
@AppStorage("scheme") private var scheme: Appearance = .system
@State private var selectedView = 0
var appearanceSwitch: ColorScheme? {
Expand All @@ -26,7 +26,7 @@ struct BeaconApp: App {
TabView(selection: $selectedView) {
ContentView(viewModel: viewModel).tag(0)
.preferredColorScheme(appearanceSwitch)
//Dashboard().tag(1)
// Dashboard().tag(1)
}.tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
.onChange(of: selectedView) {
dismissKeyboard()
Expand Down
Binary file removed Beacon/Assets.xcassets/AppIcon.appiconset/BQN.png
Binary file not shown.
2 changes: 1 addition & 1 deletion Beacon/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "BQN.png",
"filename" : "icon.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftUI

struct SwiftUIInputField: View {
struct ReplInput: View {
@Binding var text: String
@Binding var helpOpen: Bool
@Binding var settingsOpen: Bool
Expand Down
2 changes: 1 addition & 1 deletion Beacon/Models/History.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// History.swift
// Beacon
// Arrayground
//

import Foundation
Expand Down
3 changes: 1 addition & 2 deletions Beacon/Utilities/Beacon-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//
// Beacon-Bridging-Header.h
// Beacon
//
// Arrayground
//

#ifndef Beacon_Bridging_Header_h
Expand Down
87 changes: 87 additions & 0 deletions Beacon/Utilities/LexK.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
//
// LexK.swift
// Arrayground
//

import SwiftUI

enum TokenType {
case number, function, variable, string, statement, comment, other
}

struct Token {
let value: String
let type: TokenType
}

func tokenize(code: String) -> [Token] {
var tokens: [Token] = []
var currentToken = ""
var isComment = false
var isString = false

for char in code {
if isComment {
currentToken.append(char)
if char == "\n" {
tokens.append(Token(value: currentToken, type: .comment))
currentToken = ""
isComment = false
}
continue
}

if isString {
currentToken.append(char)
if char == "\"" {
tokens.append(Token(value: currentToken, type: .string))
currentToken = ""
isString = false
}
continue
}

if char == "#" || char == "/" {
isComment = true
currentToken.append(char)
continue
}

if char == "\"" {
isString = true
currentToken.append(char)
continue
}

if char.isWhitespace {
if !currentToken.isEmpty {
tokens.append(Token(value: currentToken, type: determineType(token: currentToken)))
}
currentToken = ""
} else {
currentToken.append(char)
}
}

if !currentToken.isEmpty {
tokens.append(Token(value: currentToken, type: determineType(token: currentToken)))
}

return tokens
}

func determineType(token: String) -> TokenType {
if Double(token) != nil {
return .number
}
if token.last == ":" {
return .function
}
if token.first?.isLetter == true {
return .variable
}
if token == ":" {
return .statement
}
return .other
}
4 changes: 1 addition & 3 deletions Beacon/Utilities/Utils.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//
// Utils.swift
// Beacon
//
//
// Arrayground
//

import Foundation
Expand Down
3 changes: 1 addition & 2 deletions Beacon/Utilities/k.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//
// k.h
// Beacon
//
// Arrayground
//

#ifndef k_h
Expand Down
2 changes: 1 addition & 1 deletion Beacon/Views/BuffersView.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// BuffersView.swift
// Beacon
// Arrayground
//

import SwiftUI
Expand Down
2 changes: 1 addition & 1 deletion Beacon/Views/ConfigView.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ConfigView.swift
// Beacon
// Arrayground
//

import SwiftUI
Expand Down
31 changes: 30 additions & 1 deletion Beacon/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,35 @@ struct HistoryView: View {
.font(Font.custom("BQN386 Unicode", size: 18))
.foregroundColor(.blue)
} else if editType == Behavior.duplicate {
/*
HStack(spacing: 0) {
ForEach(tokenize(code: historyItem.src), id: \.value) { token in
switch token.type {
case .number:
Text(token.value)
.foregroundColor(.green)
case .function:
Text(token.value)
.foregroundColor(.purple)
case .variable:
Text(token.value)
.foregroundColor(.blue)
case .string:
Text(token.value)
.foregroundColor(.orange)
case .statement:
Text(token.value)
.foregroundColor(.pink)
case .comment:
Text(token.value)
.foregroundColor(.gray)
case .other:
Text(token.value)
.foregroundColor(.primary)
}
}
}
*/
Text(historyItem.src)
.font(Font.custom("BQN386 Unicode", size: 18))
.foregroundColor(.blue)
Expand Down Expand Up @@ -148,7 +177,7 @@ struct ContentView: View {
}.padding(EdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10))
.padding(.bottom, 5)

SwiftUIInputField(text: $input,
ReplInput(text: $input,
helpOpen: $showHelp,
settingsOpen: $showSettings,
buffersOpen: $showBuffers,
Expand Down
2 changes: 1 addition & 1 deletion Beacon/Views/DashboardView.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// DashboardView.swift
// Beacon
// Arrayground
//

import Charts
Expand Down
2 changes: 1 addition & 1 deletion Beacon/Views/HelpView.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// HelpView.swift
// Beacon
// Arrayground
//

import Foundation
Expand Down

0 comments on commit b380ae9

Please sign in to comment.