Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 154 additions & 1 deletion DevLint/DevLint.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
C81EF13C2D6B1D6A001B3B5E /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81EF13B2D6B1D6A001B3B5E /* ContentView.swift */; };
C81EF13E2D6B1D6E001B3B5E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C81EF13D2D6B1D6E001B3B5E /* Assets.xcassets */; };
C81EF1412D6B1D6E001B3B5E /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C81EF1402D6B1D6E001B3B5E /* Preview Assets.xcassets */; };
C81FA9692D897B5B00A33FEC /* Tokenizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81FA9682D897B5B00A33FEC /* Tokenizer.swift */; };
C81FA96B2D897B6900A33FEC /* Token.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81FA96A2D897B6900A33FEC /* Token.swift */; };
C81FA9742D8989C000A33FEC /* DevLintTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81FA9732D8989C000A33FEC /* DevLintTests.swift */; };
C81FA97B2D898A0E00A33FEC /* TokenizerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81FA97A2D898A0E00A33FEC /* TokenizerTests.swift */; };
C81FA97E2D899CB100A33FEC /* LanguageRules.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81FA97D2D899CB100A33FEC /* LanguageRules.swift */; };
C81FA9802D899CD200A33FEC /* SwiftLanguageRules.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81FA97F2D899CD200A33FEC /* SwiftLanguageRules.swift */; };
C8601D452D7EEEA60058AEAB /* CustomToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8601D442D7EEEA60058AEAB /* CustomToolbar.swift */; };
C8601D472D7EFA770058AEAB /* ToolbarButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8601D462D7EFA770058AEAB /* ToolbarButton.swift */; };
C8763EBD2D7CCC1E00D535E6 /* LineNumberView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8763EBC2D7CCC1E00D535E6 /* LineNumberView.swift */; };
Expand All @@ -30,6 +36,16 @@
C8F849BB2D75AF4A002090E5 /* SyntaxHighlighter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8F849BA2D75AF4A002090E5 /* SyntaxHighlighter.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
C81FA9752D8989C000A33FEC /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = C81EF12E2D6B1D6A001B3B5E /* Project object */;
proxyType = 1;
remoteGlobalIDString = C81EF1352D6B1D6A001B3B5E;
remoteInfo = DevLint;
};
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
C813D9D72D7AED5500833098 /* CodeEditorModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeEditorModel.swift; sourceTree = "<group>"; };
C813D9D92D7AED7600833098 /* ThemeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeModel.swift; sourceTree = "<group>"; };
Expand All @@ -39,6 +55,13 @@
C81EF13D2D6B1D6E001B3B5E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
C81EF1402D6B1D6E001B3B5E /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
C81EF1422D6B1D6E001B3B5E /* DevLint.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DevLint.entitlements; sourceTree = "<group>"; };
C81FA9682D897B5B00A33FEC /* Tokenizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tokenizer.swift; sourceTree = "<group>"; };
C81FA96A2D897B6900A33FEC /* Token.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Token.swift; sourceTree = "<group>"; };
C81FA9712D8989C000A33FEC /* DevLintTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DevLintTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
C81FA9732D8989C000A33FEC /* DevLintTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DevLintTests.swift; sourceTree = "<group>"; };
C81FA97A2D898A0E00A33FEC /* TokenizerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenizerTests.swift; sourceTree = "<group>"; };
C81FA97D2D899CB100A33FEC /* LanguageRules.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LanguageRules.swift; sourceTree = "<group>"; };
C81FA97F2D899CD200A33FEC /* SwiftLanguageRules.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftLanguageRules.swift; sourceTree = "<group>"; };
C8601D442D7EEEA60058AEAB /* CustomToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomToolbar.swift; sourceTree = "<group>"; };
C8601D462D7EFA770058AEAB /* ToolbarButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolbarButton.swift; sourceTree = "<group>"; };
C8763EBC2D7CCC1E00D535E6 /* LineNumberView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineNumberView.swift; sourceTree = "<group>"; };
Expand All @@ -64,13 +87,21 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
C81FA96E2D8989C000A33FEC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
C81EF12D2D6B1D6A001B3B5E = {
isa = PBXGroup;
children = (
C81EF1382D6B1D6A001B3B5E /* DevLint */,
C81FA9722D8989C000A33FEC /* DevLintTests */,
C81EF1372D6B1D6A001B3B5E /* Products */,
);
sourceTree = "<group>";
Expand All @@ -79,6 +110,7 @@
isa = PBXGroup;
children = (
C81EF1362D6B1D6A001B3B5E /* DevLint.app */,
C81FA9712D8989C000A33FEC /* DevLintTests.xctest */,
);
name = Products;
sourceTree = "<group>";
Expand All @@ -93,6 +125,7 @@
C8F849B32D75AD81002090E5 /* Views */,
C8EF75F52D7CC0370023A5DE /* Components */,
C8F849B92D75AF32002090E5 /* Utilities */,
C81FA9672D897B4100A33FEC /* SyntaxHighlighting */,
C8EF75F22D7CBEBD0023A5DE /* Resources */,
C8EF75F32D7CBEE30023A5DE /* Supporting Files */,
C81EF1422D6B1D6E001B3B5E /* DevLint.entitlements */,
Expand All @@ -109,6 +142,35 @@
path = "Preview Content";
sourceTree = "<group>";
};
C81FA9672D897B4100A33FEC /* SyntaxHighlighting */ = {
isa = PBXGroup;
children = (
C81FA9812D899F8D00A33FEC /* Tokenizer */,
C8F849BA2D75AF4A002090E5 /* SyntaxHighlighter.swift */,
);
path = SyntaxHighlighting;
sourceTree = "<group>";
};
C81FA9722D8989C000A33FEC /* DevLintTests */ = {
isa = PBXGroup;
children = (
C81FA9732D8989C000A33FEC /* DevLintTests.swift */,
C81FA97A2D898A0E00A33FEC /* TokenizerTests.swift */,
);
path = DevLintTests;
sourceTree = "<group>";
};
C81FA9812D899F8D00A33FEC /* Tokenizer */ = {
isa = PBXGroup;
children = (
C81FA96A2D897B6900A33FEC /* Token.swift */,
C81FA9682D897B5B00A33FEC /* Tokenizer.swift */,
C81FA97D2D899CB100A33FEC /* LanguageRules.swift */,
C81FA97F2D899CD200A33FEC /* SwiftLanguageRules.swift */,
);
path = Tokenizer;
sourceTree = "<group>";
};
C887B66F2D77784A00AE1A03 /* Models */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -161,7 +223,6 @@
C8EF75F42D7CC0250023A5DE /* Core */ = {
isa = PBXGroup;
children = (
C8F849BA2D75AF4A002090E5 /* SyntaxHighlighter.swift */,
C8AC32312D7AF2B7003F496D /* ThemeManager.swift */,
);
path = Core;
Expand Down Expand Up @@ -230,6 +291,24 @@
productReference = C81EF1362D6B1D6A001B3B5E /* DevLint.app */;
productType = "com.apple.product-type.application";
};
C81FA9702D8989C000A33FEC /* DevLintTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = C81FA9772D8989C000A33FEC /* Build configuration list for PBXNativeTarget "DevLintTests" */;
buildPhases = (
C81FA96D2D8989C000A33FEC /* Sources */,
C81FA96E2D8989C000A33FEC /* Frameworks */,
C81FA96F2D8989C000A33FEC /* Resources */,
);
buildRules = (
);
dependencies = (
C81FA9762D8989C000A33FEC /* PBXTargetDependency */,
);
name = DevLintTests;
productName = DevLintTests;
productReference = C81FA9712D8989C000A33FEC /* DevLintTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
Expand All @@ -243,6 +322,10 @@
C81EF1352D6B1D6A001B3B5E = {
CreatedOnToolsVersion = 14.2;
};
C81FA9702D8989C000A33FEC = {
CreatedOnToolsVersion = 14.2;
TestTargetID = C81EF1352D6B1D6A001B3B5E;
};
};
};
buildConfigurationList = C81EF1312D6B1D6A001B3B5E /* Build configuration list for PBXProject "DevLint" */;
Expand All @@ -262,6 +345,7 @@
projectRoot = "";
targets = (
C81EF1352D6B1D6A001B3B5E /* DevLint */,
C81FA9702D8989C000A33FEC /* DevLintTests */,
);
};
/* End PBXProject section */
Expand All @@ -276,6 +360,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
C81FA96F2D8989C000A33FEC /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand All @@ -284,7 +375,9 @@
buildActionMask = 2147483647;
files = (
C8F849BB2D75AF4A002090E5 /* SyntaxHighlighter.swift in Sources */,
C81FA9692D897B5B00A33FEC /* Tokenizer.swift in Sources */,
C8601D472D7EFA770058AEAB /* ToolbarButton.swift in Sources */,
C81FA9802D899CD200A33FEC /* SwiftLanguageRules.swift in Sources */,
C8AC32342D7AF3ED003F496D /* CodeEditorView.swift in Sources */,
C8AC32302D7AF297003F496D /* CodeEditorViewModel.swift in Sources */,
C81EF13C2D6B1D6A001B3B5E /* ContentView.swift in Sources */,
Expand All @@ -293,6 +386,7 @@
C8763EBD2D7CCC1E00D535E6 /* LineNumberView.swift in Sources */,
C8763EC12D7CCD1000D535E6 /* CodeInputView.swift in Sources */,
C8763EC32D7CCD4000D535E6 /* CodeOutputView.swift in Sources */,
C81FA96B2D897B6900A33FEC /* Token.swift in Sources */,
C8AC32322D7AF2B7003F496D /* ThemeManager.swift in Sources */,
C8763EBF2D7CCCBE00D535E6 /* EditorSectionView.swift in Sources */,
C8B705482D88415700034249 /* SwiftFormatAdapter.swift in Sources */,
Expand All @@ -301,11 +395,29 @@
C8EF75F72D7CC0910023A5DE /* Extensions.swift in Sources */,
C8B705452D88410500034249 /* CodeFormatter.swift in Sources */,
C8F849B52D75AEF1002090E5 /* CodeEditorContainer.swift in Sources */,
C81FA97E2D899CB100A33FEC /* LanguageRules.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C81FA96D2D8989C000A33FEC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C81FA9742D8989C000A33FEC /* DevLintTests.swift in Sources */,
C81FA97B2D898A0E00A33FEC /* TokenizerTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
C81FA9762D8989C000A33FEC /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = C81EF1352D6B1D6A001B3B5E /* DevLint */;
targetProxy = C81FA9752D8989C000A33FEC /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
C81EF1432D6B1D6E001B3B5E /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down Expand Up @@ -472,6 +584,38 @@
};
name = Release;
};
C81FA9782D8989C000A33FEC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.codeAlligator.DevLintTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DevLint.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/DevLint";
};
name = Debug;
};
C81FA9792D8989C000A33FEC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.codeAlligator.DevLintTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DevLint.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/DevLint";
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
Expand All @@ -493,6 +637,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C81FA9772D8989C000A33FEC /* Build configuration list for PBXNativeTarget "DevLintTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C81FA9782D8989C000A33FEC /* Debug */,
C81FA9792D8989C000A33FEC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
Expand Down
55 changes: 55 additions & 0 deletions DevLint/DevLint/SyntaxHighlighting/Tokenizer/LanguageRules.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// LanguageRules.swift
// DevLint
//
// Created by CS Prasad on 18/03/25.
//

import Foundation

protocol LanguageRules {
var keywords: Set<String> { get } // func, var, let, if, else
var identifiers: Set<String> { get } // Variable and function names (not predefined)
var numbers: Set<String> { get } // Integers, floats, etc.
var decimalNumbers: Set<String> { get } // Floating-point numbers (e.g., 3.14)
var exponentNumbers: Set<String> { get } // Scientific notation (e.g., 1.23e10)
var strings: Set<String> { get } // "Hello, World!"
var rawStrings: Set<String> { get } // #"Hello, World!"#
var multiLineStrings: Set<String> { get } // """Hello\nWorld!"""
var interpolatedStrings: Set<String> { get } // "Hello \(name)!"
var characters: Set<String> { get } // 'A', 'B', etc.
var booleans: Set<String> { get } // true, false
var operatorSymbols: Set<String> { get } // +, -, *, /, =, ==, !=, etc.
var punctuation: Set<String> { get } // { }, ( ), [ ], ; , . , ,
var comments: Set<String> { get } // //, /* */ (Single/Multi-line)
var directives: Set<String> { get } // #if, #endif, #define (Preprocessor directives)
var escapeSequences: Set<String> { get } // \n, \t, etc.
var annotations: Set<String> { get } // @available, @objc, etc.
var attributes: Set<String> { get } // Swift attributes (@available, @objc)
var types: Set<String> { get } // Int, String, Double, custom class names
var accessModifiers: Set<String> { get } // public, private, internal, protected
var storageModifiers: Set<String> { get } // static, final, override, mutating
var functionCalls: Set<String> { get } // print(), customFunction()
var macros: Set<String> { get } // #macro (Used in some languages)
var nullLiterals: Set<String> { get } // null, nil
var escapedIdentifiers: Set<String> { get } // Backtick-wrapped names (`reserved`)
var hexNumbers: Set<String> { get } // 0xFF, 0x1A
var binaryNumbers: Set<String> { get } // 0b1010, 0b1101
var octalNumbers: Set<String> { get } // 0o77, 0o123
var regexLiterals: Set<String> { get } // /pattern/ (Used in JS, Swift 5.7+)
var genericTypes: Set<String> { get } // <T>, <Key, Value>
var shebang: Set<String> { get } // #!/usr/bin/swift
var parameterLabels: Set<String> { get } // firstName in func greet(firstName name: String)
var tupleTypes: Set<String> { get } // (x: Int, y: Int)
var metatypes: Set<String> { get } // .Type, .Protocol
var keyPaths: Set<String> { get } // \Person.name
var implicitParameters: Set<String> { get } // $0, $1 in closures
var dollarIdentifiers: Set<String> { get } // $var (Swift internals)
var patternMatching: Set<String> { get } // case .some(_)
var lazyStorage: Set<String> { get } // _storage variables
var dependencyMacros: Set<String> { get } // #if canImport
var moduleNames: Set<String> { get } // import MyCustomModule
var escapedNewlines: Set<String> { get } // \ at EOL for line continuation

func getTokenType(for value: String) -> Token.TokenType
}
Loading
Loading