diff --git a/ApplicationLibrary/Views/Profile/EditProfileContentView.swift b/ApplicationLibrary/Views/Profile/EditProfileContentView.swift index 2830054..2f557c4 100644 --- a/ApplicationLibrary/Views/Profile/EditProfileContentView.swift +++ b/ApplicationLibrary/Views/Profile/EditProfileContentView.swift @@ -29,26 +29,30 @@ } } } else { - viewBuilder { - if readOnly { - TextEditor(text: .constant(viewModel.profileContent)) - } else { - TextEditor(text: $viewModel.profileContent) - } - } - .font(Font.system(.caption2, design: .monospaced)) - .autocorrectionDisabled(true) - .textContentType(.init(rawValue: "")) #if os(iOS) - .keyboardType(.asciiCapable) - .textInputAutocapitalization(.none) - .background(Color(UIColor.secondarySystemGroupedBackground)) - #elseif os(macOS) - .padding() - #endif + RunestoneTextView( + text: readOnly ? .constant(viewModel.profileContent) : $viewModel.profileContent, + isEditable: !readOnly + ) .onChangeCompat(of: viewModel.profileContent) { viewModel.markAsChanged() } + #elseif os(macOS) + viewBuilder { + if readOnly { + TextEditor(text: .constant(viewModel.profileContent)) + } else { + TextEditor(text: $viewModel.profileContent) + } + } + .font(Font.system(.caption2, design: .monospaced)) + .autocorrectionDisabled(true) + .textContentType(.init(rawValue: "")) + .padding() + .onChangeCompat(of: viewModel.profileContent) { + viewModel.markAsChanged() + } + #endif } } .alertBinding($viewModel.alert) diff --git a/ApplicationLibrary/Views/Profile/ProfileEditorTheme.swift b/ApplicationLibrary/Views/Profile/ProfileEditorTheme.swift new file mode 100644 index 0000000..a8ee9d9 --- /dev/null +++ b/ApplicationLibrary/Views/Profile/ProfileEditorTheme.swift @@ -0,0 +1,73 @@ +#if os(iOS) + import Runestone + import UIKit + + final class ProfileEditorTheme: Theme { + let font: UIFont = .monospacedSystemFont(ofSize: 14, weight: .regular) + let textColor: UIColor = .label + + let gutterBackgroundColor: UIColor = .secondarySystemBackground + let gutterHairlineColor: UIColor = .separator + + let lineNumberColor: UIColor = .secondaryLabel + let lineNumberFont: UIFont = .monospacedSystemFont(ofSize: 14, weight: .regular) + + let selectedLineBackgroundColor: UIColor = .systemFill + let selectedLinesLineNumberColor: UIColor = .label + let selectedLinesGutterBackgroundColor: UIColor = .secondarySystemBackground + + let invisibleCharactersColor: UIColor = .tertiaryLabel + + let pageGuideHairlineColor: UIColor = .separator + let pageGuideBackgroundColor: UIColor = .secondarySystemBackground + + let markedTextBackgroundColor: UIColor = .systemFill + let markedTextBackgroundCornerRadius: CGFloat = 4 + + func textColor(for rawHighlightName: String) -> UIColor? { + guard let highlightName = HighlightName(rawHighlightName) else { + return nil + } + switch highlightName { + case .comment: + return .secondaryLabel + case .property: + return .systemCyan + case .string: + return .systemGreen + case .number: + return .systemOrange + case .constantBuiltin: + return .systemPurple + case .error: + return .systemRed + } + } + + func fontTraits(for _: String) -> FontTraits { + [] + } + } + + private enum HighlightName: String { + case comment + case property + case string + case number + case constantBuiltin = "constant.builtin" + case error + + init?(_ rawHighlightName: String) { + var components = rawHighlightName.split(separator: ".") + while !components.isEmpty { + let candidateRawHighlightName = components.joined(separator: ".") + if let highlightName = Self(rawValue: candidateRawHighlightName) { + self = highlightName + return + } + components.removeLast() + } + return nil + } + } +#endif diff --git a/ApplicationLibrary/Views/Profile/RunestoneTextView.swift b/ApplicationLibrary/Views/Profile/RunestoneTextView.swift new file mode 100644 index 0000000..1e87cfd --- /dev/null +++ b/ApplicationLibrary/Views/Profile/RunestoneTextView.swift @@ -0,0 +1,85 @@ +#if os(iOS) + import Runestone + import SwiftUI + import TreeSitterJSON5Runestone + + struct RunestoneTextView: UIViewRepresentable { + @Binding var text: String + let isEditable: Bool + + func makeUIView(context: Context) -> TextView { + let textView = TextView() + + textView.showLineNumbers = true + textView.isLineWrappingEnabled = false + textView.showTabs = false + textView.showSpaces = false + textView.showLineBreaks = false + textView.showSoftLineBreaks = false + textView.showNonBreakingSpaces = false + + textView.autocorrectionType = .no + textView.autocapitalizationType = .none + textView.smartDashesType = .no + textView.smartQuotesType = .no + textView.smartInsertDeleteType = .no + + textView.backgroundColor = .secondarySystemGroupedBackground + textView.contentInsetAdjustmentBehavior = .always + textView.alwaysBounceVertical = true + + textView.kern = 0.3 + textView.lineHeightMultiplier = 1.3 + + textView.characterPairs = [ + BasicCharacterPair(leading: "{", trailing: "}"), + BasicCharacterPair(leading: "[", trailing: "]"), + BasicCharacterPair(leading: "\"", trailing: "\""), + ] + + let theme = ProfileEditorTheme() + let state = TextViewState(text: text, theme: theme, language: .json5) + textView.setState(state) + + textView.isEditable = isEditable + textView.editorDelegate = context.coordinator + + return textView + } + + func updateUIView(_ textView: TextView, context _: Context) { + if textView.text != text { + textView.text = text + } + if textView.isEditable != isEditable { + textView.isEditable = isEditable + } + } + + func makeCoordinator() -> Coordinator { + Coordinator(self) + } + + final class Coordinator: TextViewDelegate { + var parent: RunestoneTextView + + init(_ parent: RunestoneTextView) { + self.parent = parent + } + + func textViewDidChange(_ textView: TextView) { + parent.text = textView.text + } + } + } + + final class BasicCharacterPair: CharacterPair { + let leading: String + let trailing: String + + init(leading: String, trailing: String) { + self.leading = leading + self.trailing = trailing + } + } +#endif diff --git a/Frameworks/TreeSitterJSON5/.gitignore b/Frameworks/TreeSitterJSON5/.gitignore new file mode 100644 index 0000000..2d9f16e --- /dev/null +++ b/Frameworks/TreeSitterJSON5/.gitignore @@ -0,0 +1,2 @@ +.build/ +.swiftpm/ diff --git a/Frameworks/TreeSitterJSON5/Package.resolved b/Frameworks/TreeSitterJSON5/Package.resolved new file mode 100644 index 0000000..e5aaf00 --- /dev/null +++ b/Frameworks/TreeSitterJSON5/Package.resolved @@ -0,0 +1,25 @@ +{ + "object": { + "pins": [ + { + "package": "Runestone", + "repositoryURL": "https://github.com/simonbs/Runestone", + "state": { + "branch": null, + "revision": "1fad339aab99cf2136ce6bf8c32da3265b2e85e5", + "version": "0.5.1" + } + }, + { + "package": "TreeSitter", + "repositoryURL": "https://github.com/tree-sitter/tree-sitter", + "state": { + "branch": null, + "revision": "98be227227af10cc7a269cb3ffb23686c0610b17", + "version": "0.20.9" + } + } + ] + }, + "version": 1 +} diff --git a/Frameworks/TreeSitterJSON5/Package.swift b/Frameworks/TreeSitterJSON5/Package.swift new file mode 100644 index 0000000..c94fd82 --- /dev/null +++ b/Frameworks/TreeSitterJSON5/Package.swift @@ -0,0 +1,23 @@ +// swift-tools-version:5.5 + +import PackageDescription + +let package = Package( + name: "TreeSitterJSON5", + platforms: [ + .iOS(.v14), .macCatalyst(.v14), + ], + products: [ + .library(name: "TreeSitterJSON5", targets: ["TreeSitterJSON5"]), + .library(name: "TreeSitterJSON5Queries", targets: ["TreeSitterJSON5Queries"]), + .library(name: "TreeSitterJSON5Runestone", targets: ["TreeSitterJSON5Runestone"]), + ], + dependencies: [ + .package(url: "https://github.com/simonbs/Runestone", from: "0.3.0"), + ], + targets: [ + .target(name: "TreeSitterJSON5", cSettings: [.headerSearchPath("src")]), + .target(name: "TreeSitterJSON5Queries", resources: [.copy("highlights.scm"), .copy("injections.scm")]), + .target(name: "TreeSitterJSON5Runestone", dependencies: ["Runestone", "TreeSitterJSON5", "TreeSitterJSON5Queries"]), + ] +) diff --git a/Frameworks/TreeSitterJSON5/README.md b/Frameworks/TreeSitterJSON5/README.md new file mode 100644 index 0000000..6c5dc90 --- /dev/null +++ b/Frameworks/TreeSitterJSON5/README.md @@ -0,0 +1,3 @@ +# TreeSitterJSON5 + +Copied from https://github.com/Lakr233/FlowDown diff --git a/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5/include/public.h b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5/include/public.h new file mode 100644 index 0000000..74f0536 --- /dev/null +++ b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5/include/public.h @@ -0,0 +1,10 @@ +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct TSLanguage TSLanguage; +const TSLanguage *tree_sitter_json5(void); + +#ifdef __cplusplus +} +#endif diff --git a/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5/src/parser.c b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5/src/parser.c new file mode 100644 index 0000000..2556a8b --- /dev/null +++ b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5/src/parser.c @@ -0,0 +1,2555 @@ +#include + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + +#define LANGUAGE_VERSION 13 +#define STATE_COUNT 31 +#define LARGE_STATE_COUNT 7 +#define SYMBOL_COUNT 21 +#define ALIAS_COUNT 0 +#define TOKEN_COUNT 14 +#define EXTERNAL_TOKEN_COUNT 0 +#define FIELD_COUNT 2 +#define MAX_ALIAS_SEQUENCE_LENGTH 5 +#define PRODUCTION_ID_COUNT 2 + +enum { + sym_comment = 1, + anon_sym_LBRACE = 2, + anon_sym_COMMA = 3, + anon_sym_RBRACE = 4, + anon_sym_COLON = 5, + sym_identifier = 6, + anon_sym_LBRACK = 7, + anon_sym_RBRACK = 8, + sym_string = 9, + sym_number = 10, + anon_sym_null = 11, + anon_sym_true = 12, + anon_sym_false = 13, + sym_file = 14, + sym_object = 15, + sym_member = 16, + sym_array = 17, + sym__value = 18, + aux_sym_object_repeat1 = 19, + aux_sym_array_repeat1 = 20, +}; + +static const char * const ts_symbol_names[] = { + [ts_builtin_sym_end] = "end", + [sym_comment] = "comment", + [anon_sym_LBRACE] = "{", + [anon_sym_COMMA] = ",", + [anon_sym_RBRACE] = "}", + [anon_sym_COLON] = ":", + [sym_identifier] = "identifier", + [anon_sym_LBRACK] = "[", + [anon_sym_RBRACK] = "]", + [sym_string] = "string", + [sym_number] = "number", + [anon_sym_null] = "null", + [anon_sym_true] = "true", + [anon_sym_false] = "false", + [sym_file] = "file", + [sym_object] = "object", + [sym_member] = "member", + [sym_array] = "array", + [sym__value] = "_value", + [aux_sym_object_repeat1] = "object_repeat1", + [aux_sym_array_repeat1] = "array_repeat1", +}; + +static const TSSymbol ts_symbol_map[] = { + [ts_builtin_sym_end] = ts_builtin_sym_end, + [sym_comment] = sym_comment, + [anon_sym_LBRACE] = anon_sym_LBRACE, + [anon_sym_COMMA] = anon_sym_COMMA, + [anon_sym_RBRACE] = anon_sym_RBRACE, + [anon_sym_COLON] = anon_sym_COLON, + [sym_identifier] = sym_identifier, + [anon_sym_LBRACK] = anon_sym_LBRACK, + [anon_sym_RBRACK] = anon_sym_RBRACK, + [sym_string] = sym_string, + [sym_number] = sym_number, + [anon_sym_null] = anon_sym_null, + [anon_sym_true] = anon_sym_true, + [anon_sym_false] = anon_sym_false, + [sym_file] = sym_file, + [sym_object] = sym_object, + [sym_member] = sym_member, + [sym_array] = sym_array, + [sym__value] = sym__value, + [aux_sym_object_repeat1] = aux_sym_object_repeat1, + [aux_sym_array_repeat1] = aux_sym_array_repeat1, +}; + +static const TSSymbolMetadata ts_symbol_metadata[] = { + [ts_builtin_sym_end] = { + .visible = false, + .named = true, + }, + [sym_comment] = { + .visible = true, + .named = true, + }, + [anon_sym_LBRACE] = { + .visible = true, + .named = false, + }, + [anon_sym_COMMA] = { + .visible = true, + .named = false, + }, + [anon_sym_RBRACE] = { + .visible = true, + .named = false, + }, + [anon_sym_COLON] = { + .visible = true, + .named = false, + }, + [sym_identifier] = { + .visible = true, + .named = true, + }, + [anon_sym_LBRACK] = { + .visible = true, + .named = false, + }, + [anon_sym_RBRACK] = { + .visible = true, + .named = false, + }, + [sym_string] = { + .visible = true, + .named = true, + }, + [sym_number] = { + .visible = true, + .named = true, + }, + [anon_sym_null] = { + .visible = true, + .named = false, + }, + [anon_sym_true] = { + .visible = true, + .named = false, + }, + [anon_sym_false] = { + .visible = true, + .named = false, + }, + [sym_file] = { + .visible = true, + .named = true, + }, + [sym_object] = { + .visible = true, + .named = true, + }, + [sym_member] = { + .visible = true, + .named = true, + }, + [sym_array] = { + .visible = true, + .named = true, + }, + [sym__value] = { + .visible = false, + .named = true, + }, + [aux_sym_object_repeat1] = { + .visible = false, + .named = false, + }, + [aux_sym_array_repeat1] = { + .visible = false, + .named = false, + }, +}; + +enum { + field_name = 1, + field_value = 2, +}; + +static const char * const ts_field_names[] = { + [0] = NULL, + [field_name] = "name", + [field_value] = "value", +}; + +static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = { + [1] = {.index = 0, .length = 2}, +}; + +static const TSFieldMapEntry ts_field_map_entries[] = { + [0] = + {field_name, 0}, + {field_value, 2}, +}; + +static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = { + [0] = {0}, +}; + +static const uint16_t ts_non_terminal_alias_map[] = { + 0, +}; + +static inline bool sym_identifier_character_set_1(int32_t c) { + return (c < 6656 + ? (c < 2979 + ? (c < 2308 + ? (c < 1369 + ? (c < 750 + ? (c < 186 + ? (c < 'a' + ? (c < 'A' + ? c == '$' + : (c <= 'Z' || c == '_')) + : (c <= 'z' || (c < 181 + ? c == 170 + : c <= 181))) + : (c <= 186 || (c < 710 + ? (c < 216 + ? (c >= 192 && c <= 214) + : (c <= 246 || (c >= 248 && c <= 705))) + : (c <= 721 || (c < 748 + ? (c >= 736 && c <= 740) + : c <= 748))))) + : (c <= 750 || (c < 908 + ? (c < 895 + ? (c < 886 + ? (c >= 880 && c <= 884) + : (c <= 887 || (c >= 890 && c <= 893))) + : (c <= 895 || (c < 904 + ? c == 902 + : c <= 906))) + : (c <= 908 || (c < 1015 + ? (c < 931 + ? (c >= 910 && c <= 929) + : c <= 1013) + : (c <= 1153 || (c < 1329 + ? (c >= 1162 && c <= 1327) + : c <= 1366))))))) + : (c <= 1369 || (c < 1869 + ? (c < 1749 + ? (c < 1568 + ? (c < 1488 + ? (c >= 1376 && c <= 1416) + : (c <= 1514 || (c >= 1519 && c <= 1522))) + : (c <= 1610 || (c < 1649 + ? (c >= 1646 && c <= 1647) + : c <= 1747))) + : (c <= 1749 || (c < 1791 + ? (c < 1774 + ? (c >= 1765 && c <= 1766) + : (c <= 1775 || (c >= 1786 && c <= 1788))) + : (c <= 1791 || (c < 1810 + ? c == 1808 + : c <= 1839))))) + : (c <= 1957 || (c < 2084 + ? (c < 2042 + ? (c < 1994 + ? c == 1969 + : (c <= 2026 || (c >= 2036 && c <= 2037))) + : (c <= 2042 || (c < 2074 + ? (c >= 2048 && c <= 2069) + : c <= 2074))) + : (c <= 2084 || (c < 2144 + ? (c < 2112 + ? c == 2088 + : c <= 2136) + : (c <= 2154 || (c < 2230 + ? (c >= 2208 && c <= 2228) + : c <= 2247))))))))) + : (c <= 2361 || (c < 2693 + ? (c < 2527 + ? (c < 2451 + ? (c < 2417 + ? (c < 2384 + ? c == 2365 + : (c <= 2384 || (c >= 2392 && c <= 2401))) + : (c <= 2432 || (c < 2447 + ? (c >= 2437 && c <= 2444) + : c <= 2448))) + : (c <= 2472 || (c < 2493 + ? (c < 2482 + ? (c >= 2474 && c <= 2480) + : (c <= 2482 || (c >= 2486 && c <= 2489))) + : (c <= 2493 || (c < 2524 + ? c == 2510 + : c <= 2525))))) + : (c <= 2529 || (c < 2610 + ? (c < 2575 + ? (c < 2556 + ? (c >= 2544 && c <= 2545) + : (c <= 2556 || (c >= 2565 && c <= 2570))) + : (c <= 2576 || (c < 2602 + ? (c >= 2579 && c <= 2600) + : c <= 2608))) + : (c <= 2611 || (c < 2649 + ? (c < 2616 + ? (c >= 2613 && c <= 2614) + : c <= 2617) + : (c <= 2652 || (c < 2674 + ? c == 2654 + : c <= 2676))))))) + : (c <= 2701 || (c < 2866 + ? (c < 2768 + ? (c < 2738 + ? (c < 2707 + ? (c >= 2703 && c <= 2705) + : (c <= 2728 || (c >= 2730 && c <= 2736))) + : (c <= 2739 || (c < 2749 + ? (c >= 2741 && c <= 2745) + : c <= 2749))) + : (c <= 2768 || (c < 2831 + ? (c < 2809 + ? (c >= 2784 && c <= 2785) + : (c <= 2809 || (c >= 2821 && c <= 2828))) + : (c <= 2832 || (c < 2858 + ? (c >= 2835 && c <= 2856) + : c <= 2864))))) + : (c <= 2867 || (c < 2949 + ? (c < 2911 + ? (c < 2877 + ? (c >= 2869 && c <= 2873) + : (c <= 2877 || (c >= 2908 && c <= 2909))) + : (c <= 2913 || (c < 2947 + ? c == 2929 + : c <= 2947))) + : (c <= 2954 || (c < 2969 + ? (c < 2962 + ? (c >= 2958 && c <= 2960) + : c <= 2965) + : (c <= 2970 || (c < 2974 + ? c == 2972 + : c <= 2975))))))))))) + : (c <= 2980 || (c < 4176 + ? (c < 3423 + ? (c < 3218 + ? (c < 3114 + ? (c < 3077 + ? (c < 2990 + ? (c >= 2984 && c <= 2986) + : (c <= 3001 || c == 3024)) + : (c <= 3084 || (c < 3090 + ? (c >= 3086 && c <= 3088) + : c <= 3112))) + : (c <= 3129 || (c < 3200 + ? (c < 3160 + ? c == 3133 + : (c <= 3162 || (c >= 3168 && c <= 3169))) + : (c <= 3200 || (c < 3214 + ? (c >= 3205 && c <= 3212) + : c <= 3216))))) + : (c <= 3240 || (c < 3332 + ? (c < 3294 + ? (c < 3253 + ? (c >= 3242 && c <= 3251) + : (c <= 3257 || c == 3261)) + : (c <= 3294 || (c < 3313 + ? (c >= 3296 && c <= 3297) + : c <= 3314))) + : (c <= 3340 || (c < 3389 + ? (c < 3346 + ? (c >= 3342 && c <= 3344) + : c <= 3386) + : (c <= 3389 || (c < 3412 + ? c == 3406 + : c <= 3414))))))) + : (c <= 3425 || (c < 3749 + ? (c < 3585 + ? (c < 3507 + ? (c < 3461 + ? (c >= 3450 && c <= 3455) + : (c <= 3478 || (c >= 3482 && c <= 3505))) + : (c <= 3515 || (c < 3520 + ? c == 3517 + : c <= 3526))) + : (c <= 3632 || (c < 3716 + ? (c < 3648 + ? (c >= 3634 && c <= 3635) + : (c <= 3654 || (c >= 3713 && c <= 3714))) + : (c <= 3716 || (c < 3724 + ? (c >= 3718 && c <= 3722) + : c <= 3747))))) + : (c <= 3749 || (c < 3840 + ? (c < 3776 + ? (c < 3762 + ? (c >= 3751 && c <= 3760) + : (c <= 3763 || c == 3773)) + : (c <= 3780 || (c < 3804 + ? c == 3782 + : c <= 3807))) + : (c <= 3840 || (c < 3976 + ? (c < 3913 + ? (c >= 3904 && c <= 3911) + : c <= 3948) + : (c <= 3980 || (c < 4159 + ? (c >= 4096 && c <= 4138) + : c <= 4159))))))))) + : (c <= 4181 || (c < 4992 + ? (c < 4696 + ? (c < 4256 + ? (c < 4206 + ? (c < 4193 + ? (c >= 4186 && c <= 4189) + : (c <= 4193 || (c >= 4197 && c <= 4198))) + : (c <= 4208 || (c < 4238 + ? (c >= 4213 && c <= 4225) + : c <= 4238))) + : (c <= 4293 || (c < 4348 + ? (c < 4301 + ? c == 4295 + : (c <= 4301 || (c >= 4304 && c <= 4346))) + : (c <= 4680 || (c < 4688 + ? (c >= 4682 && c <= 4685) + : c <= 4694))))) + : (c <= 4696 || (c < 4800 + ? (c < 4752 + ? (c < 4704 + ? (c >= 4698 && c <= 4701) + : (c <= 4744 || (c >= 4746 && c <= 4749))) + : (c <= 4784 || (c < 4792 + ? (c >= 4786 && c <= 4789) + : c <= 4798))) + : (c <= 4800 || (c < 4824 + ? (c < 4808 + ? (c >= 4802 && c <= 4805) + : c <= 4822) + : (c <= 4880 || (c < 4888 + ? (c >= 4882 && c <= 4885) + : c <= 4954))))))) + : (c <= 5007 || (c < 6016 + ? (c < 5873 + ? (c < 5743 + ? (c < 5112 + ? (c >= 5024 && c <= 5109) + : (c <= 5117 || (c >= 5121 && c <= 5740))) + : (c <= 5759 || (c < 5792 + ? (c >= 5761 && c <= 5786) + : c <= 5866))) + : (c <= 5880 || (c < 5952 + ? (c < 5902 + ? (c >= 5888 && c <= 5900) + : (c <= 5905 || (c >= 5920 && c <= 5937))) + : (c <= 5969 || (c < 5998 + ? (c >= 5984 && c <= 5996) + : c <= 6000))))) + : (c <= 6067 || (c < 6320 + ? (c < 6272 + ? (c < 6108 + ? c == 6103 + : (c <= 6108 || (c >= 6176 && c <= 6264))) + : (c <= 6276 || (c < 6314 + ? (c >= 6279 && c <= 6312) + : c <= 6314))) + : (c <= 6389 || (c < 6512 + ? (c < 6480 + ? (c >= 6400 && c <= 6430) + : c <= 6509) + : (c <= 6516 || (c < 6576 + ? (c >= 6528 && c <= 6571) + : c <= 6601))))))))))))) + : (c <= 6678 || (c < 43250 + ? (c < 8579 + ? (c < 8031 + ? (c < 7401 + ? (c < 7098 + ? (c < 6981 + ? (c < 6823 + ? (c >= 6688 && c <= 6740) + : (c <= 6823 || (c >= 6917 && c <= 6963))) + : (c <= 6987 || (c < 7086 + ? (c >= 7043 && c <= 7072) + : c <= 7087))) + : (c <= 7141 || (c < 7296 + ? (c < 7245 + ? (c >= 7168 && c <= 7203) + : (c <= 7247 || (c >= 7258 && c <= 7293))) + : (c <= 7304 || (c < 7357 + ? (c >= 7312 && c <= 7354) + : c <= 7359))))) + : (c <= 7404 || (c < 7968 + ? (c < 7424 + ? (c < 7413 + ? (c >= 7406 && c <= 7411) + : (c <= 7414 || c == 7418)) + : (c <= 7615 || (c < 7960 + ? (c >= 7680 && c <= 7957) + : c <= 7965))) + : (c <= 8005 || (c < 8025 + ? (c < 8016 + ? (c >= 8008 && c <= 8013) + : c <= 8023) + : (c <= 8025 || (c < 8029 + ? c == 8027 + : c <= 8029))))))) + : (c <= 8061 || (c < 8450 + ? (c < 8150 + ? (c < 8130 + ? (c < 8118 + ? (c >= 8064 && c <= 8116) + : (c <= 8124 || c == 8126)) + : (c <= 8132 || (c < 8144 + ? (c >= 8134 && c <= 8140) + : c <= 8147))) + : (c <= 8155 || (c < 8305 + ? (c < 8178 + ? (c >= 8160 && c <= 8172) + : (c <= 8180 || (c >= 8182 && c <= 8188))) + : (c <= 8305 || (c < 8336 + ? c == 8319 + : c <= 8348))))) + : (c <= 8450 || (c < 8488 + ? (c < 8473 + ? (c < 8458 + ? c == 8455 + : (c <= 8467 || c == 8469)) + : (c <= 8477 || (c < 8486 + ? c == 8484 + : c <= 8486))) + : (c <= 8488 || (c < 8508 + ? (c < 8495 + ? (c >= 8490 && c <= 8493) + : c <= 8505) + : (c <= 8511 || (c < 8526 + ? (c >= 8517 && c <= 8521) + : c <= 8526))))))))) + : (c <= 8580 || (c < 12540 + ? (c < 11696 + ? (c < 11559 + ? (c < 11499 + ? (c < 11312 + ? (c >= 11264 && c <= 11310) + : (c <= 11358 || (c >= 11360 && c <= 11492))) + : (c <= 11502 || (c < 11520 + ? (c >= 11506 && c <= 11507) + : c <= 11557))) + : (c <= 11559 || (c < 11648 + ? (c < 11568 + ? c == 11565 + : (c <= 11623 || c == 11631)) + : (c <= 11670 || (c < 11688 + ? (c >= 11680 && c <= 11686) + : c <= 11694))))) + : (c <= 11702 || (c < 12293 + ? (c < 11728 + ? (c < 11712 + ? (c >= 11704 && c <= 11710) + : (c <= 11718 || (c >= 11720 && c <= 11726))) + : (c <= 11734 || (c < 11823 + ? (c >= 11736 && c <= 11742) + : c <= 11823))) + : (c <= 12294 || (c < 12353 + ? (c < 12347 + ? (c >= 12337 && c <= 12341) + : c <= 12348) + : (c <= 12438 || (c < 12449 + ? (c >= 12445 && c <= 12447) + : c <= 12538))))))) + : (c <= 12543 || (c < 42560 + ? (c < 19968 + ? (c < 12784 + ? (c < 12593 + ? (c >= 12549 && c <= 12591) + : (c <= 12686 || (c >= 12704 && c <= 12735))) + : (c <= 12799 || (c < 19903 + ? c == 13312 + : c <= 19903))) + : (c <= 19968 || (c < 42240 + ? (c < 40960 + ? c == 40956 + : (c <= 42124 || (c >= 42192 && c <= 42237))) + : (c <= 42508 || (c < 42538 + ? (c >= 42512 && c <= 42527) + : c <= 42539))))) + : (c <= 42606 || (c < 42997 + ? (c < 42786 + ? (c < 42656 + ? (c >= 42623 && c <= 42653) + : (c <= 42725 || (c >= 42775 && c <= 42783))) + : (c <= 42888 || (c < 42946 + ? (c >= 42891 && c <= 42943) + : c <= 42954))) + : (c <= 43009 || (c < 43020 + ? (c < 43015 + ? (c >= 43011 && c <= 43013) + : c <= 43018) + : (c <= 43042 || (c < 43138 + ? (c >= 43072 && c <= 43123) + : c <= 43187))))))))))) + : (c <= 43255 || (c < 65142 + ? (c < 43793 + ? (c < 43616 + ? (c < 43471 + ? (c < 43312 + ? (c < 43261 + ? c == 43259 + : (c <= 43262 || (c >= 43274 && c <= 43301))) + : (c <= 43334 || (c < 43396 + ? (c >= 43360 && c <= 43388) + : c <= 43442))) + : (c <= 43471 || (c < 43520 + ? (c < 43494 + ? (c >= 43488 && c <= 43492) + : (c <= 43503 || (c >= 43514 && c <= 43518))) + : (c <= 43560 || (c < 43588 + ? (c >= 43584 && c <= 43586) + : c <= 43595))))) + : (c <= 43638 || (c < 43714 + ? (c < 43701 + ? (c < 43646 + ? c == 43642 + : (c <= 43695 || c == 43697)) + : (c <= 43702 || (c < 43712 + ? (c >= 43705 && c <= 43709) + : c <= 43712))) + : (c <= 43714 || (c < 43762 + ? (c < 43744 + ? (c >= 43739 && c <= 43741) + : c <= 43754) + : (c <= 43764 || (c < 43785 + ? (c >= 43777 && c <= 43782) + : c <= 43790))))))) + : (c <= 43798 || (c < 64285 + ? (c < 55203 + ? (c < 43868 + ? (c < 43816 + ? (c >= 43808 && c <= 43814) + : (c <= 43822 || (c >= 43824 && c <= 43866))) + : (c <= 43881 || (c < 44032 + ? (c >= 43888 && c <= 44002) + : c <= 44032))) + : (c <= 55203 || (c < 64112 + ? (c < 55243 + ? (c >= 55216 && c <= 55238) + : (c <= 55291 || (c >= 63744 && c <= 64109))) + : (c <= 64217 || (c < 64275 + ? (c >= 64256 && c <= 64262) + : c <= 64279))))) + : (c <= 64285 || (c < 64326 + ? (c < 64318 + ? (c < 64298 + ? (c >= 64287 && c <= 64296) + : (c <= 64310 || (c >= 64312 && c <= 64316))) + : (c <= 64318 || (c < 64323 + ? (c >= 64320 && c <= 64321) + : c <= 64324))) + : (c <= 64433 || (c < 64914 + ? (c < 64848 + ? (c >= 64467 && c <= 64829) + : c <= 64911) + : (c <= 64967 || (c < 65136 + ? (c >= 65008 && c <= 65019) + : c <= 65140))))))))) + : (c <= 65276 || (c < 66816 + ? (c < 65664 + ? (c < 65498 + ? (c < 65474 + ? (c < 65345 + ? (c >= 65313 && c <= 65338) + : (c <= 65370 || (c >= 65382 && c <= 65470))) + : (c <= 65479 || (c < 65490 + ? (c >= 65482 && c <= 65487) + : c <= 65495))) + : (c <= 65500 || (c < 65596 + ? (c < 65549 + ? (c >= 65536 && c <= 65547) + : (c <= 65574 || (c >= 65576 && c <= 65594))) + : (c <= 65597 || (c < 65616 + ? (c >= 65599 && c <= 65613) + : c <= 65629))))) + : (c <= 65786 || (c < 66432 + ? (c < 66349 + ? (c < 66208 + ? (c >= 66176 && c <= 66204) + : (c <= 66256 || (c >= 66304 && c <= 66335))) + : (c <= 66368 || (c < 66384 + ? (c >= 66370 && c <= 66377) + : c <= 66421))) + : (c <= 66461 || (c < 66560 + ? (c < 66504 + ? (c >= 66464 && c <= 66499) + : c <= 66511) + : (c <= 66717 || (c < 66776 + ? (c >= 66736 && c <= 66771) + : c <= 66811))))))) + : (c <= 66855 || (c < 67828 + ? (c < 67594 + ? (c < 67424 + ? (c < 67072 + ? (c >= 66864 && c <= 66915) + : (c <= 67382 || (c >= 67392 && c <= 67413))) + : (c <= 67431 || (c < 67592 + ? (c >= 67584 && c <= 67589) + : c <= 67592))) + : (c <= 67637 || (c < 67680 + ? (c < 67644 + ? (c >= 67639 && c <= 67640) + : (c <= 67644 || (c >= 67647 && c <= 67669))) + : (c <= 67702 || (c < 67808 + ? (c >= 67712 && c <= 67742) + : c <= 67826))))) + : (c <= 67829 || (c < 68117 + ? (c < 68030 + ? (c < 67872 + ? (c >= 67840 && c <= 67861) + : (c <= 67897 || (c >= 67968 && c <= 68023))) + : (c <= 68031 || (c < 68112 + ? c == 68096 + : c <= 68115))) + : (c <= 68119 || (c < 68224 + ? (c < 68192 + ? (c >= 68121 && c <= 68149) + : c <= 68220) + : (c <= 68252 || (c < 68297 + ? (c >= 68288 && c <= 68295) + : c <= 68309))))))))))))))); +} + +static inline bool sym_identifier_character_set_2(int32_t c) { + return (c < 6656 + ? (c < 2979 + ? (c < 2308 + ? (c < 1369 + ? (c < 748 + ? (c < 181 + ? (c < '_' + ? (c < '0' + ? c == '$' + : (c <= '9' || (c >= 'A' && c <= 'Z'))) + : (c <= '_' || (c < 170 + ? (c >= 'a' && c <= 'z') + : c <= 170))) + : (c <= 181 || (c < 248 + ? (c < 192 + ? c == 186 + : (c <= 214 || (c >= 216 && c <= 246))) + : (c <= 705 || (c < 736 + ? (c >= 710 && c <= 721) + : c <= 740))))) + : (c <= 748 || (c < 904 + ? (c < 890 + ? (c < 880 + ? c == 750 + : (c <= 884 || (c >= 886 && c <= 887))) + : (c <= 893 || (c < 902 + ? c == 895 + : c <= 902))) + : (c <= 906 || (c < 1015 + ? (c < 910 + ? c == 908 + : (c <= 929 || (c >= 931 && c <= 1013))) + : (c <= 1153 || (c < 1329 + ? (c >= 1162 && c <= 1327) + : c <= 1366))))))) + : (c <= 1369 || (c < 1869 + ? (c < 1749 + ? (c < 1568 + ? (c < 1488 + ? (c >= 1376 && c <= 1416) + : (c <= 1514 || (c >= 1519 && c <= 1522))) + : (c <= 1610 || (c < 1649 + ? (c >= 1646 && c <= 1647) + : c <= 1747))) + : (c <= 1749 || (c < 1791 + ? (c < 1774 + ? (c >= 1765 && c <= 1766) + : (c <= 1775 || (c >= 1786 && c <= 1788))) + : (c <= 1791 || (c < 1810 + ? c == 1808 + : c <= 1839))))) + : (c <= 1957 || (c < 2084 + ? (c < 2042 + ? (c < 1994 + ? c == 1969 + : (c <= 2026 || (c >= 2036 && c <= 2037))) + : (c <= 2042 || (c < 2074 + ? (c >= 2048 && c <= 2069) + : c <= 2074))) + : (c <= 2084 || (c < 2144 + ? (c < 2112 + ? c == 2088 + : c <= 2136) + : (c <= 2154 || (c < 2230 + ? (c >= 2208 && c <= 2228) + : c <= 2247))))))))) + : (c <= 2361 || (c < 2693 + ? (c < 2527 + ? (c < 2451 + ? (c < 2417 + ? (c < 2384 + ? c == 2365 + : (c <= 2384 || (c >= 2392 && c <= 2401))) + : (c <= 2432 || (c < 2447 + ? (c >= 2437 && c <= 2444) + : c <= 2448))) + : (c <= 2472 || (c < 2493 + ? (c < 2482 + ? (c >= 2474 && c <= 2480) + : (c <= 2482 || (c >= 2486 && c <= 2489))) + : (c <= 2493 || (c < 2524 + ? c == 2510 + : c <= 2525))))) + : (c <= 2529 || (c < 2610 + ? (c < 2575 + ? (c < 2556 + ? (c >= 2544 && c <= 2545) + : (c <= 2556 || (c >= 2565 && c <= 2570))) + : (c <= 2576 || (c < 2602 + ? (c >= 2579 && c <= 2600) + : c <= 2608))) + : (c <= 2611 || (c < 2649 + ? (c < 2616 + ? (c >= 2613 && c <= 2614) + : c <= 2617) + : (c <= 2652 || (c < 2674 + ? c == 2654 + : c <= 2676))))))) + : (c <= 2701 || (c < 2866 + ? (c < 2768 + ? (c < 2738 + ? (c < 2707 + ? (c >= 2703 && c <= 2705) + : (c <= 2728 || (c >= 2730 && c <= 2736))) + : (c <= 2739 || (c < 2749 + ? (c >= 2741 && c <= 2745) + : c <= 2749))) + : (c <= 2768 || (c < 2831 + ? (c < 2809 + ? (c >= 2784 && c <= 2785) + : (c <= 2809 || (c >= 2821 && c <= 2828))) + : (c <= 2832 || (c < 2858 + ? (c >= 2835 && c <= 2856) + : c <= 2864))))) + : (c <= 2867 || (c < 2949 + ? (c < 2911 + ? (c < 2877 + ? (c >= 2869 && c <= 2873) + : (c <= 2877 || (c >= 2908 && c <= 2909))) + : (c <= 2913 || (c < 2947 + ? c == 2929 + : c <= 2947))) + : (c <= 2954 || (c < 2969 + ? (c < 2962 + ? (c >= 2958 && c <= 2960) + : c <= 2965) + : (c <= 2970 || (c < 2974 + ? c == 2972 + : c <= 2975))))))))))) + : (c <= 2980 || (c < 4176 + ? (c < 3423 + ? (c < 3218 + ? (c < 3114 + ? (c < 3077 + ? (c < 2990 + ? (c >= 2984 && c <= 2986) + : (c <= 3001 || c == 3024)) + : (c <= 3084 || (c < 3090 + ? (c >= 3086 && c <= 3088) + : c <= 3112))) + : (c <= 3129 || (c < 3200 + ? (c < 3160 + ? c == 3133 + : (c <= 3162 || (c >= 3168 && c <= 3169))) + : (c <= 3200 || (c < 3214 + ? (c >= 3205 && c <= 3212) + : c <= 3216))))) + : (c <= 3240 || (c < 3332 + ? (c < 3294 + ? (c < 3253 + ? (c >= 3242 && c <= 3251) + : (c <= 3257 || c == 3261)) + : (c <= 3294 || (c < 3313 + ? (c >= 3296 && c <= 3297) + : c <= 3314))) + : (c <= 3340 || (c < 3389 + ? (c < 3346 + ? (c >= 3342 && c <= 3344) + : c <= 3386) + : (c <= 3389 || (c < 3412 + ? c == 3406 + : c <= 3414))))))) + : (c <= 3425 || (c < 3749 + ? (c < 3585 + ? (c < 3507 + ? (c < 3461 + ? (c >= 3450 && c <= 3455) + : (c <= 3478 || (c >= 3482 && c <= 3505))) + : (c <= 3515 || (c < 3520 + ? c == 3517 + : c <= 3526))) + : (c <= 3632 || (c < 3716 + ? (c < 3648 + ? (c >= 3634 && c <= 3635) + : (c <= 3654 || (c >= 3713 && c <= 3714))) + : (c <= 3716 || (c < 3724 + ? (c >= 3718 && c <= 3722) + : c <= 3747))))) + : (c <= 3749 || (c < 3840 + ? (c < 3776 + ? (c < 3762 + ? (c >= 3751 && c <= 3760) + : (c <= 3763 || c == 3773)) + : (c <= 3780 || (c < 3804 + ? c == 3782 + : c <= 3807))) + : (c <= 3840 || (c < 3976 + ? (c < 3913 + ? (c >= 3904 && c <= 3911) + : c <= 3948) + : (c <= 3980 || (c < 4159 + ? (c >= 4096 && c <= 4138) + : c <= 4159))))))))) + : (c <= 4181 || (c < 4992 + ? (c < 4696 + ? (c < 4256 + ? (c < 4206 + ? (c < 4193 + ? (c >= 4186 && c <= 4189) + : (c <= 4193 || (c >= 4197 && c <= 4198))) + : (c <= 4208 || (c < 4238 + ? (c >= 4213 && c <= 4225) + : c <= 4238))) + : (c <= 4293 || (c < 4348 + ? (c < 4301 + ? c == 4295 + : (c <= 4301 || (c >= 4304 && c <= 4346))) + : (c <= 4680 || (c < 4688 + ? (c >= 4682 && c <= 4685) + : c <= 4694))))) + : (c <= 4696 || (c < 4800 + ? (c < 4752 + ? (c < 4704 + ? (c >= 4698 && c <= 4701) + : (c <= 4744 || (c >= 4746 && c <= 4749))) + : (c <= 4784 || (c < 4792 + ? (c >= 4786 && c <= 4789) + : c <= 4798))) + : (c <= 4800 || (c < 4824 + ? (c < 4808 + ? (c >= 4802 && c <= 4805) + : c <= 4822) + : (c <= 4880 || (c < 4888 + ? (c >= 4882 && c <= 4885) + : c <= 4954))))))) + : (c <= 5007 || (c < 6016 + ? (c < 5873 + ? (c < 5743 + ? (c < 5112 + ? (c >= 5024 && c <= 5109) + : (c <= 5117 || (c >= 5121 && c <= 5740))) + : (c <= 5759 || (c < 5792 + ? (c >= 5761 && c <= 5786) + : c <= 5866))) + : (c <= 5880 || (c < 5952 + ? (c < 5902 + ? (c >= 5888 && c <= 5900) + : (c <= 5905 || (c >= 5920 && c <= 5937))) + : (c <= 5969 || (c < 5998 + ? (c >= 5984 && c <= 5996) + : c <= 6000))))) + : (c <= 6067 || (c < 6320 + ? (c < 6272 + ? (c < 6108 + ? c == 6103 + : (c <= 6108 || (c >= 6176 && c <= 6264))) + : (c <= 6276 || (c < 6314 + ? (c >= 6279 && c <= 6312) + : c <= 6314))) + : (c <= 6389 || (c < 6512 + ? (c < 6480 + ? (c >= 6400 && c <= 6430) + : c <= 6509) + : (c <= 6516 || (c < 6576 + ? (c >= 6528 && c <= 6571) + : c <= 6601))))))))))))) + : (c <= 6678 || (c < 43250 + ? (c < 8579 + ? (c < 8031 + ? (c < 7401 + ? (c < 7098 + ? (c < 6981 + ? (c < 6823 + ? (c >= 6688 && c <= 6740) + : (c <= 6823 || (c >= 6917 && c <= 6963))) + : (c <= 6987 || (c < 7086 + ? (c >= 7043 && c <= 7072) + : c <= 7087))) + : (c <= 7141 || (c < 7296 + ? (c < 7245 + ? (c >= 7168 && c <= 7203) + : (c <= 7247 || (c >= 7258 && c <= 7293))) + : (c <= 7304 || (c < 7357 + ? (c >= 7312 && c <= 7354) + : c <= 7359))))) + : (c <= 7404 || (c < 7968 + ? (c < 7424 + ? (c < 7413 + ? (c >= 7406 && c <= 7411) + : (c <= 7414 || c == 7418)) + : (c <= 7615 || (c < 7960 + ? (c >= 7680 && c <= 7957) + : c <= 7965))) + : (c <= 8005 || (c < 8025 + ? (c < 8016 + ? (c >= 8008 && c <= 8013) + : c <= 8023) + : (c <= 8025 || (c < 8029 + ? c == 8027 + : c <= 8029))))))) + : (c <= 8061 || (c < 8450 + ? (c < 8150 + ? (c < 8130 + ? (c < 8118 + ? (c >= 8064 && c <= 8116) + : (c <= 8124 || c == 8126)) + : (c <= 8132 || (c < 8144 + ? (c >= 8134 && c <= 8140) + : c <= 8147))) + : (c <= 8155 || (c < 8305 + ? (c < 8178 + ? (c >= 8160 && c <= 8172) + : (c <= 8180 || (c >= 8182 && c <= 8188))) + : (c <= 8305 || (c < 8336 + ? c == 8319 + : c <= 8348))))) + : (c <= 8450 || (c < 8488 + ? (c < 8473 + ? (c < 8458 + ? c == 8455 + : (c <= 8467 || c == 8469)) + : (c <= 8477 || (c < 8486 + ? c == 8484 + : c <= 8486))) + : (c <= 8488 || (c < 8508 + ? (c < 8495 + ? (c >= 8490 && c <= 8493) + : c <= 8505) + : (c <= 8511 || (c < 8526 + ? (c >= 8517 && c <= 8521) + : c <= 8526))))))))) + : (c <= 8580 || (c < 12540 + ? (c < 11696 + ? (c < 11559 + ? (c < 11499 + ? (c < 11312 + ? (c >= 11264 && c <= 11310) + : (c <= 11358 || (c >= 11360 && c <= 11492))) + : (c <= 11502 || (c < 11520 + ? (c >= 11506 && c <= 11507) + : c <= 11557))) + : (c <= 11559 || (c < 11648 + ? (c < 11568 + ? c == 11565 + : (c <= 11623 || c == 11631)) + : (c <= 11670 || (c < 11688 + ? (c >= 11680 && c <= 11686) + : c <= 11694))))) + : (c <= 11702 || (c < 12293 + ? (c < 11728 + ? (c < 11712 + ? (c >= 11704 && c <= 11710) + : (c <= 11718 || (c >= 11720 && c <= 11726))) + : (c <= 11734 || (c < 11823 + ? (c >= 11736 && c <= 11742) + : c <= 11823))) + : (c <= 12294 || (c < 12353 + ? (c < 12347 + ? (c >= 12337 && c <= 12341) + : c <= 12348) + : (c <= 12438 || (c < 12449 + ? (c >= 12445 && c <= 12447) + : c <= 12538))))))) + : (c <= 12543 || (c < 42560 + ? (c < 19968 + ? (c < 12784 + ? (c < 12593 + ? (c >= 12549 && c <= 12591) + : (c <= 12686 || (c >= 12704 && c <= 12735))) + : (c <= 12799 || (c < 19903 + ? c == 13312 + : c <= 19903))) + : (c <= 19968 || (c < 42240 + ? (c < 40960 + ? c == 40956 + : (c <= 42124 || (c >= 42192 && c <= 42237))) + : (c <= 42508 || (c < 42538 + ? (c >= 42512 && c <= 42527) + : c <= 42539))))) + : (c <= 42606 || (c < 42997 + ? (c < 42786 + ? (c < 42656 + ? (c >= 42623 && c <= 42653) + : (c <= 42725 || (c >= 42775 && c <= 42783))) + : (c <= 42888 || (c < 42946 + ? (c >= 42891 && c <= 42943) + : c <= 42954))) + : (c <= 43009 || (c < 43020 + ? (c < 43015 + ? (c >= 43011 && c <= 43013) + : c <= 43018) + : (c <= 43042 || (c < 43138 + ? (c >= 43072 && c <= 43123) + : c <= 43187))))))))))) + : (c <= 43255 || (c < 65142 + ? (c < 43793 + ? (c < 43616 + ? (c < 43471 + ? (c < 43312 + ? (c < 43261 + ? c == 43259 + : (c <= 43262 || (c >= 43274 && c <= 43301))) + : (c <= 43334 || (c < 43396 + ? (c >= 43360 && c <= 43388) + : c <= 43442))) + : (c <= 43471 || (c < 43520 + ? (c < 43494 + ? (c >= 43488 && c <= 43492) + : (c <= 43503 || (c >= 43514 && c <= 43518))) + : (c <= 43560 || (c < 43588 + ? (c >= 43584 && c <= 43586) + : c <= 43595))))) + : (c <= 43638 || (c < 43714 + ? (c < 43701 + ? (c < 43646 + ? c == 43642 + : (c <= 43695 || c == 43697)) + : (c <= 43702 || (c < 43712 + ? (c >= 43705 && c <= 43709) + : c <= 43712))) + : (c <= 43714 || (c < 43762 + ? (c < 43744 + ? (c >= 43739 && c <= 43741) + : c <= 43754) + : (c <= 43764 || (c < 43785 + ? (c >= 43777 && c <= 43782) + : c <= 43790))))))) + : (c <= 43798 || (c < 64285 + ? (c < 55203 + ? (c < 43868 + ? (c < 43816 + ? (c >= 43808 && c <= 43814) + : (c <= 43822 || (c >= 43824 && c <= 43866))) + : (c <= 43881 || (c < 44032 + ? (c >= 43888 && c <= 44002) + : c <= 44032))) + : (c <= 55203 || (c < 64112 + ? (c < 55243 + ? (c >= 55216 && c <= 55238) + : (c <= 55291 || (c >= 63744 && c <= 64109))) + : (c <= 64217 || (c < 64275 + ? (c >= 64256 && c <= 64262) + : c <= 64279))))) + : (c <= 64285 || (c < 64326 + ? (c < 64318 + ? (c < 64298 + ? (c >= 64287 && c <= 64296) + : (c <= 64310 || (c >= 64312 && c <= 64316))) + : (c <= 64318 || (c < 64323 + ? (c >= 64320 && c <= 64321) + : c <= 64324))) + : (c <= 64433 || (c < 64914 + ? (c < 64848 + ? (c >= 64467 && c <= 64829) + : c <= 64911) + : (c <= 64967 || (c < 65136 + ? (c >= 65008 && c <= 65019) + : c <= 65140))))))))) + : (c <= 65276 || (c < 66816 + ? (c < 65664 + ? (c < 65498 + ? (c < 65474 + ? (c < 65345 + ? (c >= 65313 && c <= 65338) + : (c <= 65370 || (c >= 65382 && c <= 65470))) + : (c <= 65479 || (c < 65490 + ? (c >= 65482 && c <= 65487) + : c <= 65495))) + : (c <= 65500 || (c < 65596 + ? (c < 65549 + ? (c >= 65536 && c <= 65547) + : (c <= 65574 || (c >= 65576 && c <= 65594))) + : (c <= 65597 || (c < 65616 + ? (c >= 65599 && c <= 65613) + : c <= 65629))))) + : (c <= 65786 || (c < 66432 + ? (c < 66349 + ? (c < 66208 + ? (c >= 66176 && c <= 66204) + : (c <= 66256 || (c >= 66304 && c <= 66335))) + : (c <= 66368 || (c < 66384 + ? (c >= 66370 && c <= 66377) + : c <= 66421))) + : (c <= 66461 || (c < 66560 + ? (c < 66504 + ? (c >= 66464 && c <= 66499) + : c <= 66511) + : (c <= 66717 || (c < 66776 + ? (c >= 66736 && c <= 66771) + : c <= 66811))))))) + : (c <= 66855 || (c < 67828 + ? (c < 67594 + ? (c < 67424 + ? (c < 67072 + ? (c >= 66864 && c <= 66915) + : (c <= 67382 || (c >= 67392 && c <= 67413))) + : (c <= 67431 || (c < 67592 + ? (c >= 67584 && c <= 67589) + : c <= 67592))) + : (c <= 67637 || (c < 67680 + ? (c < 67644 + ? (c >= 67639 && c <= 67640) + : (c <= 67644 || (c >= 67647 && c <= 67669))) + : (c <= 67702 || (c < 67808 + ? (c >= 67712 && c <= 67742) + : c <= 67826))))) + : (c <= 67829 || (c < 68117 + ? (c < 68030 + ? (c < 67872 + ? (c >= 67840 && c <= 67861) + : (c <= 67897 || (c >= 67968 && c <= 68023))) + : (c <= 68031 || (c < 68112 + ? c == 68096 + : c <= 68115))) + : (c <= 68119 || (c < 68224 + ? (c < 68192 + ? (c >= 68121 && c <= 68149) + : c <= 68220) + : (c <= 68252 || (c < 68297 + ? (c >= 68288 && c <= 68295) + : c <= 68309))))))))))))))); +} + +static inline bool sym_identifier_character_set_3(int32_t c) { + return (c < 6656 + ? (c < 2979 + ? (c < 2308 + ? (c < 1369 + ? (c < 748 + ? (c < 181 + ? (c < '_' + ? (c < '0' + ? c == '$' + : (c <= '9' || (c >= 'A' && c <= 'Z'))) + : (c <= '_' || (c < 170 + ? (c >= 'b' && c <= 'z') + : c <= 170))) + : (c <= 181 || (c < 248 + ? (c < 192 + ? c == 186 + : (c <= 214 || (c >= 216 && c <= 246))) + : (c <= 705 || (c < 736 + ? (c >= 710 && c <= 721) + : c <= 740))))) + : (c <= 748 || (c < 904 + ? (c < 890 + ? (c < 880 + ? c == 750 + : (c <= 884 || (c >= 886 && c <= 887))) + : (c <= 893 || (c < 902 + ? c == 895 + : c <= 902))) + : (c <= 906 || (c < 1015 + ? (c < 910 + ? c == 908 + : (c <= 929 || (c >= 931 && c <= 1013))) + : (c <= 1153 || (c < 1329 + ? (c >= 1162 && c <= 1327) + : c <= 1366))))))) + : (c <= 1369 || (c < 1869 + ? (c < 1749 + ? (c < 1568 + ? (c < 1488 + ? (c >= 1376 && c <= 1416) + : (c <= 1514 || (c >= 1519 && c <= 1522))) + : (c <= 1610 || (c < 1649 + ? (c >= 1646 && c <= 1647) + : c <= 1747))) + : (c <= 1749 || (c < 1791 + ? (c < 1774 + ? (c >= 1765 && c <= 1766) + : (c <= 1775 || (c >= 1786 && c <= 1788))) + : (c <= 1791 || (c < 1810 + ? c == 1808 + : c <= 1839))))) + : (c <= 1957 || (c < 2084 + ? (c < 2042 + ? (c < 1994 + ? c == 1969 + : (c <= 2026 || (c >= 2036 && c <= 2037))) + : (c <= 2042 || (c < 2074 + ? (c >= 2048 && c <= 2069) + : c <= 2074))) + : (c <= 2084 || (c < 2144 + ? (c < 2112 + ? c == 2088 + : c <= 2136) + : (c <= 2154 || (c < 2230 + ? (c >= 2208 && c <= 2228) + : c <= 2247))))))))) + : (c <= 2361 || (c < 2693 + ? (c < 2527 + ? (c < 2451 + ? (c < 2417 + ? (c < 2384 + ? c == 2365 + : (c <= 2384 || (c >= 2392 && c <= 2401))) + : (c <= 2432 || (c < 2447 + ? (c >= 2437 && c <= 2444) + : c <= 2448))) + : (c <= 2472 || (c < 2493 + ? (c < 2482 + ? (c >= 2474 && c <= 2480) + : (c <= 2482 || (c >= 2486 && c <= 2489))) + : (c <= 2493 || (c < 2524 + ? c == 2510 + : c <= 2525))))) + : (c <= 2529 || (c < 2610 + ? (c < 2575 + ? (c < 2556 + ? (c >= 2544 && c <= 2545) + : (c <= 2556 || (c >= 2565 && c <= 2570))) + : (c <= 2576 || (c < 2602 + ? (c >= 2579 && c <= 2600) + : c <= 2608))) + : (c <= 2611 || (c < 2649 + ? (c < 2616 + ? (c >= 2613 && c <= 2614) + : c <= 2617) + : (c <= 2652 || (c < 2674 + ? c == 2654 + : c <= 2676))))))) + : (c <= 2701 || (c < 2866 + ? (c < 2768 + ? (c < 2738 + ? (c < 2707 + ? (c >= 2703 && c <= 2705) + : (c <= 2728 || (c >= 2730 && c <= 2736))) + : (c <= 2739 || (c < 2749 + ? (c >= 2741 && c <= 2745) + : c <= 2749))) + : (c <= 2768 || (c < 2831 + ? (c < 2809 + ? (c >= 2784 && c <= 2785) + : (c <= 2809 || (c >= 2821 && c <= 2828))) + : (c <= 2832 || (c < 2858 + ? (c >= 2835 && c <= 2856) + : c <= 2864))))) + : (c <= 2867 || (c < 2949 + ? (c < 2911 + ? (c < 2877 + ? (c >= 2869 && c <= 2873) + : (c <= 2877 || (c >= 2908 && c <= 2909))) + : (c <= 2913 || (c < 2947 + ? c == 2929 + : c <= 2947))) + : (c <= 2954 || (c < 2969 + ? (c < 2962 + ? (c >= 2958 && c <= 2960) + : c <= 2965) + : (c <= 2970 || (c < 2974 + ? c == 2972 + : c <= 2975))))))))))) + : (c <= 2980 || (c < 4176 + ? (c < 3423 + ? (c < 3218 + ? (c < 3114 + ? (c < 3077 + ? (c < 2990 + ? (c >= 2984 && c <= 2986) + : (c <= 3001 || c == 3024)) + : (c <= 3084 || (c < 3090 + ? (c >= 3086 && c <= 3088) + : c <= 3112))) + : (c <= 3129 || (c < 3200 + ? (c < 3160 + ? c == 3133 + : (c <= 3162 || (c >= 3168 && c <= 3169))) + : (c <= 3200 || (c < 3214 + ? (c >= 3205 && c <= 3212) + : c <= 3216))))) + : (c <= 3240 || (c < 3332 + ? (c < 3294 + ? (c < 3253 + ? (c >= 3242 && c <= 3251) + : (c <= 3257 || c == 3261)) + : (c <= 3294 || (c < 3313 + ? (c >= 3296 && c <= 3297) + : c <= 3314))) + : (c <= 3340 || (c < 3389 + ? (c < 3346 + ? (c >= 3342 && c <= 3344) + : c <= 3386) + : (c <= 3389 || (c < 3412 + ? c == 3406 + : c <= 3414))))))) + : (c <= 3425 || (c < 3749 + ? (c < 3585 + ? (c < 3507 + ? (c < 3461 + ? (c >= 3450 && c <= 3455) + : (c <= 3478 || (c >= 3482 && c <= 3505))) + : (c <= 3515 || (c < 3520 + ? c == 3517 + : c <= 3526))) + : (c <= 3632 || (c < 3716 + ? (c < 3648 + ? (c >= 3634 && c <= 3635) + : (c <= 3654 || (c >= 3713 && c <= 3714))) + : (c <= 3716 || (c < 3724 + ? (c >= 3718 && c <= 3722) + : c <= 3747))))) + : (c <= 3749 || (c < 3840 + ? (c < 3776 + ? (c < 3762 + ? (c >= 3751 && c <= 3760) + : (c <= 3763 || c == 3773)) + : (c <= 3780 || (c < 3804 + ? c == 3782 + : c <= 3807))) + : (c <= 3840 || (c < 3976 + ? (c < 3913 + ? (c >= 3904 && c <= 3911) + : c <= 3948) + : (c <= 3980 || (c < 4159 + ? (c >= 4096 && c <= 4138) + : c <= 4159))))))))) + : (c <= 4181 || (c < 4992 + ? (c < 4696 + ? (c < 4256 + ? (c < 4206 + ? (c < 4193 + ? (c >= 4186 && c <= 4189) + : (c <= 4193 || (c >= 4197 && c <= 4198))) + : (c <= 4208 || (c < 4238 + ? (c >= 4213 && c <= 4225) + : c <= 4238))) + : (c <= 4293 || (c < 4348 + ? (c < 4301 + ? c == 4295 + : (c <= 4301 || (c >= 4304 && c <= 4346))) + : (c <= 4680 || (c < 4688 + ? (c >= 4682 && c <= 4685) + : c <= 4694))))) + : (c <= 4696 || (c < 4800 + ? (c < 4752 + ? (c < 4704 + ? (c >= 4698 && c <= 4701) + : (c <= 4744 || (c >= 4746 && c <= 4749))) + : (c <= 4784 || (c < 4792 + ? (c >= 4786 && c <= 4789) + : c <= 4798))) + : (c <= 4800 || (c < 4824 + ? (c < 4808 + ? (c >= 4802 && c <= 4805) + : c <= 4822) + : (c <= 4880 || (c < 4888 + ? (c >= 4882 && c <= 4885) + : c <= 4954))))))) + : (c <= 5007 || (c < 6016 + ? (c < 5873 + ? (c < 5743 + ? (c < 5112 + ? (c >= 5024 && c <= 5109) + : (c <= 5117 || (c >= 5121 && c <= 5740))) + : (c <= 5759 || (c < 5792 + ? (c >= 5761 && c <= 5786) + : c <= 5866))) + : (c <= 5880 || (c < 5952 + ? (c < 5902 + ? (c >= 5888 && c <= 5900) + : (c <= 5905 || (c >= 5920 && c <= 5937))) + : (c <= 5969 || (c < 5998 + ? (c >= 5984 && c <= 5996) + : c <= 6000))))) + : (c <= 6067 || (c < 6320 + ? (c < 6272 + ? (c < 6108 + ? c == 6103 + : (c <= 6108 || (c >= 6176 && c <= 6264))) + : (c <= 6276 || (c < 6314 + ? (c >= 6279 && c <= 6312) + : c <= 6314))) + : (c <= 6389 || (c < 6512 + ? (c < 6480 + ? (c >= 6400 && c <= 6430) + : c <= 6509) + : (c <= 6516 || (c < 6576 + ? (c >= 6528 && c <= 6571) + : c <= 6601))))))))))))) + : (c <= 6678 || (c < 43250 + ? (c < 8579 + ? (c < 8031 + ? (c < 7401 + ? (c < 7098 + ? (c < 6981 + ? (c < 6823 + ? (c >= 6688 && c <= 6740) + : (c <= 6823 || (c >= 6917 && c <= 6963))) + : (c <= 6987 || (c < 7086 + ? (c >= 7043 && c <= 7072) + : c <= 7087))) + : (c <= 7141 || (c < 7296 + ? (c < 7245 + ? (c >= 7168 && c <= 7203) + : (c <= 7247 || (c >= 7258 && c <= 7293))) + : (c <= 7304 || (c < 7357 + ? (c >= 7312 && c <= 7354) + : c <= 7359))))) + : (c <= 7404 || (c < 7968 + ? (c < 7424 + ? (c < 7413 + ? (c >= 7406 && c <= 7411) + : (c <= 7414 || c == 7418)) + : (c <= 7615 || (c < 7960 + ? (c >= 7680 && c <= 7957) + : c <= 7965))) + : (c <= 8005 || (c < 8025 + ? (c < 8016 + ? (c >= 8008 && c <= 8013) + : c <= 8023) + : (c <= 8025 || (c < 8029 + ? c == 8027 + : c <= 8029))))))) + : (c <= 8061 || (c < 8450 + ? (c < 8150 + ? (c < 8130 + ? (c < 8118 + ? (c >= 8064 && c <= 8116) + : (c <= 8124 || c == 8126)) + : (c <= 8132 || (c < 8144 + ? (c >= 8134 && c <= 8140) + : c <= 8147))) + : (c <= 8155 || (c < 8305 + ? (c < 8178 + ? (c >= 8160 && c <= 8172) + : (c <= 8180 || (c >= 8182 && c <= 8188))) + : (c <= 8305 || (c < 8336 + ? c == 8319 + : c <= 8348))))) + : (c <= 8450 || (c < 8488 + ? (c < 8473 + ? (c < 8458 + ? c == 8455 + : (c <= 8467 || c == 8469)) + : (c <= 8477 || (c < 8486 + ? c == 8484 + : c <= 8486))) + : (c <= 8488 || (c < 8508 + ? (c < 8495 + ? (c >= 8490 && c <= 8493) + : c <= 8505) + : (c <= 8511 || (c < 8526 + ? (c >= 8517 && c <= 8521) + : c <= 8526))))))))) + : (c <= 8580 || (c < 12540 + ? (c < 11696 + ? (c < 11559 + ? (c < 11499 + ? (c < 11312 + ? (c >= 11264 && c <= 11310) + : (c <= 11358 || (c >= 11360 && c <= 11492))) + : (c <= 11502 || (c < 11520 + ? (c >= 11506 && c <= 11507) + : c <= 11557))) + : (c <= 11559 || (c < 11648 + ? (c < 11568 + ? c == 11565 + : (c <= 11623 || c == 11631)) + : (c <= 11670 || (c < 11688 + ? (c >= 11680 && c <= 11686) + : c <= 11694))))) + : (c <= 11702 || (c < 12293 + ? (c < 11728 + ? (c < 11712 + ? (c >= 11704 && c <= 11710) + : (c <= 11718 || (c >= 11720 && c <= 11726))) + : (c <= 11734 || (c < 11823 + ? (c >= 11736 && c <= 11742) + : c <= 11823))) + : (c <= 12294 || (c < 12353 + ? (c < 12347 + ? (c >= 12337 && c <= 12341) + : c <= 12348) + : (c <= 12438 || (c < 12449 + ? (c >= 12445 && c <= 12447) + : c <= 12538))))))) + : (c <= 12543 || (c < 42560 + ? (c < 19968 + ? (c < 12784 + ? (c < 12593 + ? (c >= 12549 && c <= 12591) + : (c <= 12686 || (c >= 12704 && c <= 12735))) + : (c <= 12799 || (c < 19903 + ? c == 13312 + : c <= 19903))) + : (c <= 19968 || (c < 42240 + ? (c < 40960 + ? c == 40956 + : (c <= 42124 || (c >= 42192 && c <= 42237))) + : (c <= 42508 || (c < 42538 + ? (c >= 42512 && c <= 42527) + : c <= 42539))))) + : (c <= 42606 || (c < 42997 + ? (c < 42786 + ? (c < 42656 + ? (c >= 42623 && c <= 42653) + : (c <= 42725 || (c >= 42775 && c <= 42783))) + : (c <= 42888 || (c < 42946 + ? (c >= 42891 && c <= 42943) + : c <= 42954))) + : (c <= 43009 || (c < 43020 + ? (c < 43015 + ? (c >= 43011 && c <= 43013) + : c <= 43018) + : (c <= 43042 || (c < 43138 + ? (c >= 43072 && c <= 43123) + : c <= 43187))))))))))) + : (c <= 43255 || (c < 65142 + ? (c < 43793 + ? (c < 43616 + ? (c < 43471 + ? (c < 43312 + ? (c < 43261 + ? c == 43259 + : (c <= 43262 || (c >= 43274 && c <= 43301))) + : (c <= 43334 || (c < 43396 + ? (c >= 43360 && c <= 43388) + : c <= 43442))) + : (c <= 43471 || (c < 43520 + ? (c < 43494 + ? (c >= 43488 && c <= 43492) + : (c <= 43503 || (c >= 43514 && c <= 43518))) + : (c <= 43560 || (c < 43588 + ? (c >= 43584 && c <= 43586) + : c <= 43595))))) + : (c <= 43638 || (c < 43714 + ? (c < 43701 + ? (c < 43646 + ? c == 43642 + : (c <= 43695 || c == 43697)) + : (c <= 43702 || (c < 43712 + ? (c >= 43705 && c <= 43709) + : c <= 43712))) + : (c <= 43714 || (c < 43762 + ? (c < 43744 + ? (c >= 43739 && c <= 43741) + : c <= 43754) + : (c <= 43764 || (c < 43785 + ? (c >= 43777 && c <= 43782) + : c <= 43790))))))) + : (c <= 43798 || (c < 64285 + ? (c < 55203 + ? (c < 43868 + ? (c < 43816 + ? (c >= 43808 && c <= 43814) + : (c <= 43822 || (c >= 43824 && c <= 43866))) + : (c <= 43881 || (c < 44032 + ? (c >= 43888 && c <= 44002) + : c <= 44032))) + : (c <= 55203 || (c < 64112 + ? (c < 55243 + ? (c >= 55216 && c <= 55238) + : (c <= 55291 || (c >= 63744 && c <= 64109))) + : (c <= 64217 || (c < 64275 + ? (c >= 64256 && c <= 64262) + : c <= 64279))))) + : (c <= 64285 || (c < 64326 + ? (c < 64318 + ? (c < 64298 + ? (c >= 64287 && c <= 64296) + : (c <= 64310 || (c >= 64312 && c <= 64316))) + : (c <= 64318 || (c < 64323 + ? (c >= 64320 && c <= 64321) + : c <= 64324))) + : (c <= 64433 || (c < 64914 + ? (c < 64848 + ? (c >= 64467 && c <= 64829) + : c <= 64911) + : (c <= 64967 || (c < 65136 + ? (c >= 65008 && c <= 65019) + : c <= 65140))))))))) + : (c <= 65276 || (c < 66816 + ? (c < 65664 + ? (c < 65498 + ? (c < 65474 + ? (c < 65345 + ? (c >= 65313 && c <= 65338) + : (c <= 65370 || (c >= 65382 && c <= 65470))) + : (c <= 65479 || (c < 65490 + ? (c >= 65482 && c <= 65487) + : c <= 65495))) + : (c <= 65500 || (c < 65596 + ? (c < 65549 + ? (c >= 65536 && c <= 65547) + : (c <= 65574 || (c >= 65576 && c <= 65594))) + : (c <= 65597 || (c < 65616 + ? (c >= 65599 && c <= 65613) + : c <= 65629))))) + : (c <= 65786 || (c < 66432 + ? (c < 66349 + ? (c < 66208 + ? (c >= 66176 && c <= 66204) + : (c <= 66256 || (c >= 66304 && c <= 66335))) + : (c <= 66368 || (c < 66384 + ? (c >= 66370 && c <= 66377) + : c <= 66421))) + : (c <= 66461 || (c < 66560 + ? (c < 66504 + ? (c >= 66464 && c <= 66499) + : c <= 66511) + : (c <= 66717 || (c < 66776 + ? (c >= 66736 && c <= 66771) + : c <= 66811))))))) + : (c <= 66855 || (c < 67828 + ? (c < 67594 + ? (c < 67424 + ? (c < 67072 + ? (c >= 66864 && c <= 66915) + : (c <= 67382 || (c >= 67392 && c <= 67413))) + : (c <= 67431 || (c < 67592 + ? (c >= 67584 && c <= 67589) + : c <= 67592))) + : (c <= 67637 || (c < 67680 + ? (c < 67644 + ? (c >= 67639 && c <= 67640) + : (c <= 67644 || (c >= 67647 && c <= 67669))) + : (c <= 67702 || (c < 67808 + ? (c >= 67712 && c <= 67742) + : c <= 67826))))) + : (c <= 67829 || (c < 68117 + ? (c < 68030 + ? (c < 67872 + ? (c >= 67840 && c <= 67861) + : (c <= 67897 || (c >= 67968 && c <= 68023))) + : (c <= 68031 || (c < 68112 + ? c == 68096 + : c <= 68115))) + : (c <= 68119 || (c < 68224 + ? (c < 68192 + ? (c >= 68121 && c <= 68149) + : c <= 68220) + : (c <= 68252 || (c < 68297 + ? (c >= 68288 && c <= 68295) + : c <= 68309))))))))))))))); +} + +static bool ts_lex(TSLexer *lexer, TSStateId state) { + START_LEXER(); + eof = lexer->eof(lexer); + switch (state) { + case 0: + if (eof) ADVANCE(33); + if (lookahead == '"') ADVANCE(3); + if (lookahead == '\'') ADVANCE(4); + if (lookahead == ',') ADVANCE(37); + if (lookahead == '.') ADVANCE(66); + if (lookahead == '/') ADVANCE(5); + if (lookahead == '0') ADVANCE(64); + if (lookahead == ':') ADVANCE(39); + if (lookahead == 'I') ADVANCE(51); + if (lookahead == 'N') ADVANCE(41); + if (lookahead == '[') ADVANCE(60); + if (lookahead == ']') ADVANCE(61); + if (lookahead == 'f') ADVANCE(42); + if (lookahead == 'n') ADVANCE(57); + if (lookahead == 't') ADVANCE(53); + if (lookahead == '{') ADVANCE(36); + if (lookahead == '}') ADVANCE(38); + if (('+' <= lookahead && lookahead <= '-')) ADVANCE(8); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(0) + if (('1' <= lookahead && lookahead <= '9')) ADVANCE(65); + if (sym_identifier_character_set_1(lookahead)) ADVANCE(59); + END_STATE(); + case 1: + if (lookahead == '"') ADVANCE(3); + if (lookahead == '\'') ADVANCE(4); + if (lookahead == '.') ADVANCE(66); + if (lookahead == '/') ADVANCE(5); + if (lookahead == '0') ADVANCE(64); + if (lookahead == 'I') ADVANCE(20); + if (lookahead == 'N') ADVANCE(10); + if (lookahead == '[') ADVANCE(60); + if (lookahead == ']') ADVANCE(61); + if (lookahead == 'f') ADVANCE(11); + if (lookahead == 'n') ADVANCE(26); + if (lookahead == 't') ADVANCE(22); + if (lookahead == '{') ADVANCE(36); + if (lookahead == '+' || + lookahead == '-') ADVANCE(8); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(1) + if (('1' <= lookahead && lookahead <= '9')) ADVANCE(65); + END_STATE(); + case 2: + if (lookahead == '"') ADVANCE(3); + if (lookahead == '\'') ADVANCE(4); + if (lookahead == '/') ADVANCE(5); + if (lookahead == '}') ADVANCE(38); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(2) + if (sym_identifier_character_set_1(lookahead)) ADVANCE(59); + END_STATE(); + case 3: + if (lookahead == '"') ADVANCE(62); + if (lookahead == '\\') ADVANCE(29); + if (lookahead != 0) ADVANCE(3); + END_STATE(); + case 4: + if (lookahead == '\'') ADVANCE(62); + if (lookahead == '\\') ADVANCE(30); + if (lookahead != 0) ADVANCE(4); + END_STATE(); + case 5: + if (lookahead == '*') ADVANCE(7); + if (lookahead == '/') ADVANCE(35); + END_STATE(); + case 6: + if (lookahead == '*') ADVANCE(6); + if (lookahead == '/') ADVANCE(34); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(7); + END_STATE(); + case 7: + if (lookahead == '*') ADVANCE(6); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(7); + END_STATE(); + case 8: + if (lookahead == '.') ADVANCE(66); + if (lookahead == '0') ADVANCE(64); + if (lookahead == 'I') ADVANCE(20); + if (lookahead == 'N') ADVANCE(10); + if (('1' <= lookahead && lookahead <= '9')) ADVANCE(65); + END_STATE(); + case 9: + if (lookahead == 'N') ADVANCE(63); + END_STATE(); + case 10: + if (lookahead == 'a') ADVANCE(9); + END_STATE(); + case 11: + if (lookahead == 'a') ADVANCE(17); + END_STATE(); + case 12: + if (lookahead == 'e') ADVANCE(71); + END_STATE(); + case 13: + if (lookahead == 'e') ADVANCE(73); + END_STATE(); + case 14: + if (lookahead == 'f') ADVANCE(16); + END_STATE(); + case 15: + if (lookahead == 'i') ADVANCE(24); + END_STATE(); + case 16: + if (lookahead == 'i') ADVANCE(21); + END_STATE(); + case 17: + if (lookahead == 'l') ADVANCE(23); + END_STATE(); + case 18: + if (lookahead == 'l') ADVANCE(69); + END_STATE(); + case 19: + if (lookahead == 'l') ADVANCE(18); + END_STATE(); + case 20: + if (lookahead == 'n') ADVANCE(14); + END_STATE(); + case 21: + if (lookahead == 'n') ADVANCE(15); + END_STATE(); + case 22: + if (lookahead == 'r') ADVANCE(25); + END_STATE(); + case 23: + if (lookahead == 's') ADVANCE(13); + END_STATE(); + case 24: + if (lookahead == 't') ADVANCE(27); + END_STATE(); + case 25: + if (lookahead == 'u') ADVANCE(12); + END_STATE(); + case 26: + if (lookahead == 'u') ADVANCE(19); + END_STATE(); + case 27: + if (lookahead == 'y') ADVANCE(63); + END_STATE(); + case 28: + if (lookahead == '+' || + lookahead == '-') ADVANCE(31); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(67); + END_STATE(); + case 29: + if (lookahead == '"' || + lookahead == '\\' || + lookahead == 'b' || + lookahead == 'f' || + lookahead == 'n' || + lookahead == 'r' || + lookahead == 't' || + lookahead == 'v') ADVANCE(3); + END_STATE(); + case 30: + if (lookahead == '\'' || + lookahead == '\\' || + lookahead == 'b' || + lookahead == 'f' || + lookahead == 'n' || + lookahead == 'r' || + lookahead == 't' || + lookahead == 'v') ADVANCE(4); + END_STATE(); + case 31: + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(67); + END_STATE(); + case 32: + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'F') || + ('a' <= lookahead && lookahead <= 'f')) ADVANCE(68); + END_STATE(); + case 33: + ACCEPT_TOKEN(ts_builtin_sym_end); + END_STATE(); + case 34: + ACCEPT_TOKEN(sym_comment); + if (lookahead == '*') ADVANCE(6); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(7); + END_STATE(); + case 35: + ACCEPT_TOKEN(sym_comment); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(35); + END_STATE(); + case 36: + ACCEPT_TOKEN(anon_sym_LBRACE); + END_STATE(); + case 37: + ACCEPT_TOKEN(anon_sym_COMMA); + END_STATE(); + case 38: + ACCEPT_TOKEN(anon_sym_RBRACE); + END_STATE(); + case 39: + ACCEPT_TOKEN(anon_sym_COLON); + END_STATE(); + case 40: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'N') ADVANCE(59); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 41: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'a') ADVANCE(40); + if (sym_identifier_character_set_3(lookahead)) ADVANCE(59); + END_STATE(); + case 42: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'a') ADVANCE(48); + if (sym_identifier_character_set_3(lookahead)) ADVANCE(59); + END_STATE(); + case 43: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'e') ADVANCE(72); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 44: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'e') ADVANCE(74); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 45: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'f') ADVANCE(47); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 46: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'i') ADVANCE(55); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 47: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'i') ADVANCE(52); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 48: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'l') ADVANCE(54); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 49: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'l') ADVANCE(70); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 50: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'l') ADVANCE(49); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 51: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'n') ADVANCE(45); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 52: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'n') ADVANCE(46); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 53: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'r') ADVANCE(56); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 54: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 's') ADVANCE(44); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 55: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 't') ADVANCE(58); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 56: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'u') ADVANCE(43); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 57: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'u') ADVANCE(50); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 58: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'y') ADVANCE(59); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 59: + ACCEPT_TOKEN(sym_identifier); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 60: + ACCEPT_TOKEN(anon_sym_LBRACK); + END_STATE(); + case 61: + ACCEPT_TOKEN(anon_sym_RBRACK); + END_STATE(); + case 62: + ACCEPT_TOKEN(sym_string); + END_STATE(); + case 63: + ACCEPT_TOKEN(sym_number); + END_STATE(); + case 64: + ACCEPT_TOKEN(sym_number); + if (lookahead == '.') ADVANCE(66); + if (lookahead == 'E' || + lookahead == 'e') ADVANCE(28); + if (lookahead == 'X' || + lookahead == 'x') ADVANCE(32); + END_STATE(); + case 65: + ACCEPT_TOKEN(sym_number); + if (lookahead == '.') ADVANCE(66); + if (lookahead == 'E' || + lookahead == 'e') ADVANCE(28); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(65); + END_STATE(); + case 66: + ACCEPT_TOKEN(sym_number); + if (lookahead == 'E' || + lookahead == 'e') ADVANCE(28); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(66); + END_STATE(); + case 67: + ACCEPT_TOKEN(sym_number); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(67); + END_STATE(); + case 68: + ACCEPT_TOKEN(sym_number); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'F') || + ('a' <= lookahead && lookahead <= 'f')) ADVANCE(68); + END_STATE(); + case 69: + ACCEPT_TOKEN(anon_sym_null); + END_STATE(); + case 70: + ACCEPT_TOKEN(anon_sym_null); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 71: + ACCEPT_TOKEN(anon_sym_true); + END_STATE(); + case 72: + ACCEPT_TOKEN(anon_sym_true); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + case 73: + ACCEPT_TOKEN(anon_sym_false); + END_STATE(); + case 74: + ACCEPT_TOKEN(anon_sym_false); + if (sym_identifier_character_set_2(lookahead)) ADVANCE(59); + END_STATE(); + default: + return false; + } +} + +static const TSLexMode ts_lex_modes[STATE_COUNT] = { + [0] = {.lex_state = 0}, + [1] = {.lex_state = 0}, + [2] = {.lex_state = 1}, + [3] = {.lex_state = 1}, + [4] = {.lex_state = 1}, + [5] = {.lex_state = 1}, + [6] = {.lex_state = 1}, + [7] = {.lex_state = 2}, + [8] = {.lex_state = 2}, + [9] = {.lex_state = 0}, + [10] = {.lex_state = 0}, + [11] = {.lex_state = 0}, + [12] = {.lex_state = 0}, + [13] = {.lex_state = 0}, + [14] = {.lex_state = 2}, + [15] = {.lex_state = 0}, + [16] = {.lex_state = 0}, + [17] = {.lex_state = 0}, + [18] = {.lex_state = 0}, + [19] = {.lex_state = 0}, + [20] = {.lex_state = 0}, + [21] = {.lex_state = 0}, + [22] = {.lex_state = 0}, + [23] = {.lex_state = 0}, + [24] = {.lex_state = 2}, + [25] = {.lex_state = 0}, + [26] = {.lex_state = 0}, + [27] = {.lex_state = 0}, + [28] = {.lex_state = 0}, + [29] = {.lex_state = 0}, + [30] = {.lex_state = 0}, +}; + +static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { + [0] = { + [ts_builtin_sym_end] = ACTIONS(1), + [sym_comment] = ACTIONS(3), + [anon_sym_LBRACE] = ACTIONS(1), + [anon_sym_COMMA] = ACTIONS(1), + [anon_sym_RBRACE] = ACTIONS(1), + [anon_sym_COLON] = ACTIONS(1), + [sym_identifier] = ACTIONS(1), + [anon_sym_LBRACK] = ACTIONS(1), + [anon_sym_RBRACK] = ACTIONS(1), + [sym_string] = ACTIONS(1), + [sym_number] = ACTIONS(1), + [anon_sym_null] = ACTIONS(1), + [anon_sym_true] = ACTIONS(1), + [anon_sym_false] = ACTIONS(1), + }, + [1] = { + [sym_file] = STATE(28), + [sym_object] = STATE(30), + [sym_array] = STATE(30), + [ts_builtin_sym_end] = ACTIONS(5), + [sym_comment] = ACTIONS(3), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_LBRACK] = ACTIONS(9), + }, + [2] = { + [sym_object] = STATE(21), + [sym_array] = STATE(21), + [sym__value] = STATE(21), + [sym_comment] = ACTIONS(3), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_LBRACK] = ACTIONS(9), + [anon_sym_RBRACK] = ACTIONS(11), + [sym_string] = ACTIONS(13), + [sym_number] = ACTIONS(13), + [anon_sym_null] = ACTIONS(13), + [anon_sym_true] = ACTIONS(13), + [anon_sym_false] = ACTIONS(13), + }, + [3] = { + [sym_object] = STATE(27), + [sym_array] = STATE(27), + [sym__value] = STATE(27), + [sym_comment] = ACTIONS(3), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_LBRACK] = ACTIONS(9), + [anon_sym_RBRACK] = ACTIONS(15), + [sym_string] = ACTIONS(17), + [sym_number] = ACTIONS(17), + [anon_sym_null] = ACTIONS(17), + [anon_sym_true] = ACTIONS(17), + [anon_sym_false] = ACTIONS(17), + }, + [4] = { + [sym_object] = STATE(27), + [sym_array] = STATE(27), + [sym__value] = STATE(27), + [sym_comment] = ACTIONS(3), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_LBRACK] = ACTIONS(9), + [anon_sym_RBRACK] = ACTIONS(19), + [sym_string] = ACTIONS(17), + [sym_number] = ACTIONS(17), + [anon_sym_null] = ACTIONS(17), + [anon_sym_true] = ACTIONS(17), + [anon_sym_false] = ACTIONS(17), + }, + [5] = { + [sym_object] = STATE(27), + [sym_array] = STATE(27), + [sym__value] = STATE(27), + [sym_comment] = ACTIONS(3), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_LBRACK] = ACTIONS(9), + [sym_string] = ACTIONS(17), + [sym_number] = ACTIONS(17), + [anon_sym_null] = ACTIONS(17), + [anon_sym_true] = ACTIONS(17), + [anon_sym_false] = ACTIONS(17), + }, + [6] = { + [sym_object] = STATE(26), + [sym_array] = STATE(26), + [sym__value] = STATE(26), + [sym_comment] = ACTIONS(3), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_LBRACK] = ACTIONS(9), + [sym_string] = ACTIONS(21), + [sym_number] = ACTIONS(21), + [anon_sym_null] = ACTIONS(21), + [anon_sym_true] = ACTIONS(21), + [anon_sym_false] = ACTIONS(21), + }, +}; + +static const uint16_t ts_small_parse_table[] = { + [0] = 4, + ACTIONS(3), 1, + sym_comment, + ACTIONS(23), 1, + anon_sym_RBRACE, + STATE(25), 1, + sym_member, + ACTIONS(25), 2, + sym_identifier, + sym_string, + [14] = 4, + ACTIONS(3), 1, + sym_comment, + ACTIONS(27), 1, + anon_sym_RBRACE, + STATE(23), 1, + sym_member, + ACTIONS(25), 2, + sym_identifier, + sym_string, + [28] = 2, + ACTIONS(3), 1, + sym_comment, + ACTIONS(29), 4, + ts_builtin_sym_end, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_RBRACK, + [38] = 2, + ACTIONS(3), 1, + sym_comment, + ACTIONS(31), 4, + ts_builtin_sym_end, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_RBRACK, + [48] = 2, + ACTIONS(3), 1, + sym_comment, + ACTIONS(33), 4, + ts_builtin_sym_end, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_RBRACK, + [58] = 2, + ACTIONS(3), 1, + sym_comment, + ACTIONS(35), 4, + ts_builtin_sym_end, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_RBRACK, + [68] = 2, + ACTIONS(3), 1, + sym_comment, + ACTIONS(37), 4, + ts_builtin_sym_end, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_RBRACK, + [78] = 4, + ACTIONS(3), 1, + sym_comment, + ACTIONS(39), 1, + anon_sym_RBRACE, + STATE(25), 1, + sym_member, + ACTIONS(25), 2, + sym_identifier, + sym_string, + [92] = 2, + ACTIONS(3), 1, + sym_comment, + ACTIONS(41), 4, + ts_builtin_sym_end, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_RBRACK, + [102] = 2, + ACTIONS(3), 1, + sym_comment, + ACTIONS(43), 4, + ts_builtin_sym_end, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_RBRACK, + [112] = 2, + ACTIONS(3), 1, + sym_comment, + ACTIONS(45), 4, + ts_builtin_sym_end, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_RBRACK, + [122] = 4, + ACTIONS(3), 1, + sym_comment, + ACTIONS(39), 1, + anon_sym_RBRACE, + ACTIONS(47), 1, + anon_sym_COMMA, + STATE(20), 1, + aux_sym_object_repeat1, + [135] = 4, + ACTIONS(3), 1, + sym_comment, + ACTIONS(19), 1, + anon_sym_RBRACK, + ACTIONS(49), 1, + anon_sym_COMMA, + STATE(22), 1, + aux_sym_array_repeat1, + [148] = 4, + ACTIONS(3), 1, + sym_comment, + ACTIONS(51), 1, + anon_sym_COMMA, + ACTIONS(54), 1, + anon_sym_RBRACE, + STATE(20), 1, + aux_sym_object_repeat1, + [161] = 4, + ACTIONS(3), 1, + sym_comment, + ACTIONS(56), 1, + anon_sym_COMMA, + ACTIONS(58), 1, + anon_sym_RBRACK, + STATE(19), 1, + aux_sym_array_repeat1, + [174] = 4, + ACTIONS(3), 1, + sym_comment, + ACTIONS(60), 1, + anon_sym_COMMA, + ACTIONS(63), 1, + anon_sym_RBRACK, + STATE(22), 1, + aux_sym_array_repeat1, + [187] = 4, + ACTIONS(3), 1, + sym_comment, + ACTIONS(65), 1, + anon_sym_COMMA, + ACTIONS(67), 1, + anon_sym_RBRACE, + STATE(18), 1, + aux_sym_object_repeat1, + [200] = 3, + ACTIONS(3), 1, + sym_comment, + STATE(25), 1, + sym_member, + ACTIONS(25), 2, + sym_identifier, + sym_string, + [211] = 2, + ACTIONS(3), 1, + sym_comment, + ACTIONS(54), 2, + anon_sym_COMMA, + anon_sym_RBRACE, + [219] = 2, + ACTIONS(3), 1, + sym_comment, + ACTIONS(69), 2, + anon_sym_COMMA, + anon_sym_RBRACE, + [227] = 2, + ACTIONS(3), 1, + sym_comment, + ACTIONS(63), 2, + anon_sym_COMMA, + anon_sym_RBRACK, + [235] = 2, + ACTIONS(3), 1, + sym_comment, + ACTIONS(71), 1, + ts_builtin_sym_end, + [242] = 2, + ACTIONS(3), 1, + sym_comment, + ACTIONS(73), 1, + anon_sym_COLON, + [249] = 2, + ACTIONS(3), 1, + sym_comment, + ACTIONS(75), 1, + ts_builtin_sym_end, +}; + +static const uint32_t ts_small_parse_table_map[] = { + [SMALL_STATE(7)] = 0, + [SMALL_STATE(8)] = 14, + [SMALL_STATE(9)] = 28, + [SMALL_STATE(10)] = 38, + [SMALL_STATE(11)] = 48, + [SMALL_STATE(12)] = 58, + [SMALL_STATE(13)] = 68, + [SMALL_STATE(14)] = 78, + [SMALL_STATE(15)] = 92, + [SMALL_STATE(16)] = 102, + [SMALL_STATE(17)] = 112, + [SMALL_STATE(18)] = 122, + [SMALL_STATE(19)] = 135, + [SMALL_STATE(20)] = 148, + [SMALL_STATE(21)] = 161, + [SMALL_STATE(22)] = 174, + [SMALL_STATE(23)] = 187, + [SMALL_STATE(24)] = 200, + [SMALL_STATE(25)] = 211, + [SMALL_STATE(26)] = 219, + [SMALL_STATE(27)] = 227, + [SMALL_STATE(28)] = 235, + [SMALL_STATE(29)] = 242, + [SMALL_STATE(30)] = 249, +}; + +static const TSParseActionEntry ts_parse_actions[] = { + [0] = {.entry = {.count = 0, .reusable = false}}, + [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), + [3] = {.entry = {.count = 1, .reusable = true}}, SHIFT_EXTRA(), + [5] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_file, 0), + [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), + [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), + [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), + [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21), + [15] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), + [17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27), + [19] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), + [21] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26), + [23] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), + [25] = {.entry = {.count = 1, .reusable = true}}, SHIFT(29), + [27] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), + [29] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array, 5), + [31] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_object, 2), + [33] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_object, 5), + [35] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array, 2), + [37] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array, 4), + [39] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), + [41] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_object, 3), + [43] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array, 3), + [45] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_object, 4), + [47] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), + [49] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), + [51] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_object_repeat1, 2), SHIFT_REPEAT(24), + [54] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_object_repeat1, 2), + [56] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), + [58] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), + [60] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_array_repeat1, 2), SHIFT_REPEAT(5), + [63] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_array_repeat1, 2), + [65] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), + [67] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), + [69] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_member, 3, .production_id = 1), + [71] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [73] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), + [75] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_file, 1), +}; + +#ifdef __cplusplus +extern "C" { +#endif +#ifdef _WIN32 +#define extern __declspec(dllexport) +#endif + +extern const TSLanguage *tree_sitter_json5(void) { + static const TSLanguage language = { + .version = LANGUAGE_VERSION, + .symbol_count = SYMBOL_COUNT, + .alias_count = ALIAS_COUNT, + .token_count = TOKEN_COUNT, + .external_token_count = EXTERNAL_TOKEN_COUNT, + .state_count = STATE_COUNT, + .large_state_count = LARGE_STATE_COUNT, + .production_id_count = PRODUCTION_ID_COUNT, + .field_count = FIELD_COUNT, + .max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH, + .parse_table = &ts_parse_table[0][0], + .small_parse_table = ts_small_parse_table, + .small_parse_table_map = ts_small_parse_table_map, + .parse_actions = ts_parse_actions, + .symbol_names = ts_symbol_names, + .field_names = ts_field_names, + .field_map_slices = ts_field_map_slices, + .field_map_entries = ts_field_map_entries, + .symbol_metadata = ts_symbol_metadata, + .public_symbol_map = ts_symbol_map, + .alias_map = ts_non_terminal_alias_map, + .alias_sequences = &ts_alias_sequences[0][0], + .lex_modes = ts_lex_modes, + .lex_fn = ts_lex, + }; + return &language; +} +#ifdef __cplusplus +} +#endif diff --git a/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5/src/tree_sitter/parser.h b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5/src/tree_sitter/parser.h new file mode 100644 index 0000000..cbbc7b4 --- /dev/null +++ b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5/src/tree_sitter/parser.h @@ -0,0 +1,223 @@ +#ifndef TREE_SITTER_PARSER_H_ +#define TREE_SITTER_PARSER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#define ts_builtin_sym_error ((TSSymbol)-1) +#define ts_builtin_sym_end 0 +#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024 + +typedef uint16_t TSStateId; + +#ifndef TREE_SITTER_API_H_ +typedef uint16_t TSSymbol; +typedef uint16_t TSFieldId; +typedef struct TSLanguage TSLanguage; +#endif + +typedef struct { + TSFieldId field_id; + uint8_t child_index; + bool inherited; +} TSFieldMapEntry; + +typedef struct { + uint16_t index; + uint16_t length; +} TSFieldMapSlice; + +typedef struct { + bool visible; + bool named; + bool supertype; +} TSSymbolMetadata; + +typedef struct TSLexer TSLexer; + +struct TSLexer { + int32_t lookahead; + TSSymbol result_symbol; + void (*advance)(TSLexer *, bool); + void (*mark_end)(TSLexer *); + uint32_t (*get_column)(TSLexer *); + bool (*is_at_included_range_start)(const TSLexer *); + bool (*eof)(const TSLexer *); +}; + +typedef enum { + TSParseActionTypeShift, + TSParseActionTypeReduce, + TSParseActionTypeAccept, + TSParseActionTypeRecover, +} TSParseActionType; + +typedef union { + struct { + uint8_t type; + TSStateId state; + bool extra; + bool repetition; + } shift; + struct { + uint8_t type; + uint8_t child_count; + TSSymbol symbol; + int16_t dynamic_precedence; + uint16_t production_id; + } reduce; + uint8_t type; +} TSParseAction; + +typedef struct { + uint16_t lex_state; + uint16_t external_lex_state; +} TSLexMode; + +typedef union { + TSParseAction action; + struct { + uint8_t count; + bool reusable; + } entry; +} TSParseActionEntry; + +struct TSLanguage { + uint32_t version; + uint32_t symbol_count; + uint32_t alias_count; + uint32_t token_count; + uint32_t external_token_count; + uint32_t state_count; + uint32_t large_state_count; + uint32_t production_id_count; + uint32_t field_count; + uint16_t max_alias_sequence_length; + const uint16_t *parse_table; + const uint16_t *small_parse_table; + const uint32_t *small_parse_table_map; + const TSParseActionEntry *parse_actions; + const char * const *symbol_names; + const char * const *field_names; + const TSFieldMapSlice *field_map_slices; + const TSFieldMapEntry *field_map_entries; + const TSSymbolMetadata *symbol_metadata; + const TSSymbol *public_symbol_map; + const uint16_t *alias_map; + const TSSymbol *alias_sequences; + const TSLexMode *lex_modes; + bool (*lex_fn)(TSLexer *, TSStateId); + bool (*keyword_lex_fn)(TSLexer *, TSStateId); + TSSymbol keyword_capture_token; + struct { + const bool *states; + const TSSymbol *symbol_map; + void *(*create)(void); + void (*destroy)(void *); + bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist); + unsigned (*serialize)(void *, char *); + void (*deserialize)(void *, const char *, unsigned); + } external_scanner; +}; + +/* + * Lexer Macros + */ + +#define START_LEXER() \ + bool result = false; \ + bool skip = false; \ + bool eof = false; \ + int32_t lookahead; \ + goto start; \ + next_state: \ + lexer->advance(lexer, skip); \ + start: \ + skip = false; \ + lookahead = lexer->lookahead; + +#define ADVANCE(state_value) \ + { \ + state = state_value; \ + goto next_state; \ + } + +#define SKIP(state_value) \ + { \ + skip = true; \ + state = state_value; \ + goto next_state; \ + } + +#define ACCEPT_TOKEN(symbol_value) \ + result = true; \ + lexer->result_symbol = symbol_value; \ + lexer->mark_end(lexer); + +#define END_STATE() return result; + +/* + * Parse Table Macros + */ + +#define SMALL_STATE(id) id - LARGE_STATE_COUNT + +#define STATE(id) id + +#define ACTIONS(id) id + +#define SHIFT(state_value) \ + {{ \ + .shift = { \ + .type = TSParseActionTypeShift, \ + .state = state_value \ + } \ + }} + +#define SHIFT_REPEAT(state_value) \ + {{ \ + .shift = { \ + .type = TSParseActionTypeShift, \ + .state = state_value, \ + .repetition = true \ + } \ + }} + +#define SHIFT_EXTRA() \ + {{ \ + .shift = { \ + .type = TSParseActionTypeShift, \ + .extra = true \ + } \ + }} + +#define REDUCE(symbol_val, child_count_val, ...) \ + {{ \ + .reduce = { \ + .type = TSParseActionTypeReduce, \ + .symbol = symbol_val, \ + .child_count = child_count_val, \ + __VA_ARGS__ \ + }, \ + }} + +#define RECOVER() \ + {{ \ + .type = TSParseActionTypeRecover \ + }} + +#define ACCEPT_INPUT() \ + {{ \ + .type = TSParseActionTypeAccept \ + }} + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_PARSER_H_ diff --git a/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Queries/Query.swift b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Queries/Query.swift new file mode 100644 index 0000000..8c6e925 --- /dev/null +++ b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Queries/Query.swift @@ -0,0 +1,17 @@ +import Foundation + +public enum Query { + public static var highlightsFileURL: URL { + url(named: "highlights") + } + + public static var injectionsFileURL: URL { + url(named: "injections") + } +} + +private extension Query { + static func url(named filename: String) -> URL { + Bundle.module.url(forResource: filename, withExtension: "scm")! + } +} diff --git a/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Queries/highlights.scm b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Queries/highlights.scm new file mode 100644 index 0000000..eace2b1 --- /dev/null +++ b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Queries/highlights.scm @@ -0,0 +1,15 @@ +(number) @number + +(comment) @comment + +(member name: (_) @property) + +(member value: (string) @string) +(member value: (number) @number) +(member value: ["true" "false" "null"] @constant.builtin) + +(array ((string) @string)) +(array (number) @number) +(array ["true" "false" "null"] @constant.builtin) + +(ERROR) @error diff --git a/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Queries/injections.scm b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Queries/injections.scm new file mode 100644 index 0000000..4bb7d67 --- /dev/null +++ b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Queries/injections.scm @@ -0,0 +1 @@ +(comment) @comment diff --git a/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Runestone/TreeSitterIndentationScopes+Helpers.swift b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Runestone/TreeSitterIndentationScopes+Helpers.swift new file mode 100644 index 0000000..815bb37 --- /dev/null +++ b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Runestone/TreeSitterIndentationScopes+Helpers.swift @@ -0,0 +1,7 @@ +import Runestone + +public extension TreeSitterIndentationScopes { + static var json5: TreeSitterIndentationScopes { + TreeSitterIndentationScopes(indent: ["object", "array"], outdent: ["}", "]"]) + } +} diff --git a/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Runestone/TreeSitterLanguage+Helpers.swift b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Runestone/TreeSitterLanguage+Helpers.swift new file mode 100644 index 0000000..2169456 --- /dev/null +++ b/Frameworks/TreeSitterJSON5/Sources/TreeSitterJSON5Runestone/TreeSitterLanguage+Helpers.swift @@ -0,0 +1,11 @@ +import Runestone +import TreeSitterJSON5 +import TreeSitterJSON5Queries + +public extension TreeSitterLanguage { + static var json5: TreeSitterLanguage { + let highlightsQuery = TreeSitterLanguage.Query(contentsOf: TreeSitterJSON5Queries.Query.highlightsFileURL) + let injectionsQuery = TreeSitterLanguage.Query(contentsOf: TreeSitterJSON5Queries.Query.injectionsFileURL) + return TreeSitterLanguage(tree_sitter_json5(), highlightsQuery: highlightsQuery, injectionsQuery: injectionsQuery, indentationScopes: .json5) + } +} diff --git a/Localizable.xcstrings b/Localizable.xcstrings index d155794..25718e4 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -1232,6 +1232,7 @@ } }, "Page" : { + "extractionState" : "stale", "localizations" : { "zh-Hans" : { "stringUnit" : { @@ -1486,6 +1487,9 @@ } } } + }, + "Share QR Code" : { + }, "Share URL as QR Code" : { "localizations" : { @@ -1752,6 +1756,9 @@ } } } + }, + "Update Failed" : { + }, "Uplink" : { "localizations" : { diff --git a/sing-box.xcodeproj/project.pbxproj b/sing-box.xcodeproj/project.pbxproj index 839af28..cb8a326 100644 --- a/sing-box.xcodeproj/project.pbxproj +++ b/sing-box.xcodeproj/project.pbxproj @@ -9,6 +9,8 @@ /* Begin PBXBuildFile section */ 3A017F922A4AB2E4009149FA /* GRDB in Frameworks */ = {isa = PBXBuildFile; productRef = 3A017F912A4AB2E4009149FA /* GRDB */; }; 3A096F8F2A4ED3DE00D4A2ED /* Extension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 3A096F862A4ED3DE00D4A2ED /* Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 3A2E87F22ED5A91100644195 /* Runestone in Frameworks */ = {isa = PBXBuildFile; productRef = 3A2E87F12ED5A91100644195 /* Runestone */; }; + 3A2E87FB2ED5ABDA00644195 /* TreeSitterJSON5Runestone in Frameworks */ = {isa = PBXBuildFile; productRef = 3A2E87FA2ED5ABDA00644195 /* TreeSitterJSON5Runestone */; }; 3A3AA7FC2A4EFDAE002F78AB /* Library.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AEC211D2A459B4700A63465 /* Library.framework */; }; 3A3AA7FF2A4EFDB3002F78AB /* Library.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AEC211D2A459B4700A63465 /* Library.framework */; }; 3A3DEBEB2A4FFE2D00373BF4 /* AppIntents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A3DEBE62A4FFA6000373BF4 /* AppIntents.framework */; }; @@ -534,6 +536,8 @@ buildActionMask = 2147483647; files = ( 3A4EAD1B2A4FEB02005435B3 /* Library.framework in Frameworks */, + 3A2E87FB2ED5ABDA00644195 /* TreeSitterJSON5Runestone in Frameworks */, + 3A2E87F22ED5A91100644195 /* Runestone in Frameworks */, 3A4A020D2B53E3DC004EFB87 /* QRCode in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -754,6 +758,8 @@ name = ApplicationLibrary; packageProductDependencies = ( 3A4A020C2B53E3DC004EFB87 /* QRCode */, + 3A2E87F12ED5A91100644195 /* Runestone */, + 3A2E87FA2ED5ABDA00644195 /* TreeSitterJSON5Runestone */, ); productName = ApplicationLibrary; productReference = 3A4EAD102A4FEAE6005435B3 /* ApplicationLibrary.framework */; @@ -1058,6 +1064,8 @@ 3A017F902A4AB2E4009149FA /* XCRemoteSwiftPackageReference "GRDB" */, 3A57DF3A2A4D705000690BC5 /* XCRemoteSwiftPackageReference "MacControlCenterUI" */, 3A4A020B2B53E3DC004EFB87 /* XCRemoteSwiftPackageReference "qrcode" */, + 3A2E87F02ED5A91100644195 /* XCRemoteSwiftPackageReference "Runestone" */, + 3A2E87F92ED5ABCF00644195 /* XCLocalSwiftPackageReference "Frameworks/TreeSitterJSON5" */, ); productRefGroup = 3AEC20C72A45991900A63465 /* Products */; projectDirPath = ""; @@ -2553,6 +2561,13 @@ }; /* End XCConfigurationList section */ +/* Begin XCLocalSwiftPackageReference section */ + 3A2E87F92ED5ABCF00644195 /* XCLocalSwiftPackageReference "Frameworks/TreeSitterJSON5" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Frameworks/TreeSitterJSON5; + }; +/* End XCLocalSwiftPackageReference section */ + /* Begin XCRemoteSwiftPackageReference section */ 3A017F902A4AB2E4009149FA /* XCRemoteSwiftPackageReference "GRDB" */ = { isa = XCRemoteSwiftPackageReference; @@ -2562,6 +2577,14 @@ minimumVersion = 6.15.1; }; }; + 3A2E87F02ED5A91100644195 /* XCRemoteSwiftPackageReference "Runestone" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/simonbs/Runestone"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 0.5.1; + }; + }; 3A4A020B2B53E3DC004EFB87 /* XCRemoteSwiftPackageReference "qrcode" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/dagronf/qrcode.git"; @@ -2594,6 +2617,16 @@ package = 3A017F902A4AB2E4009149FA /* XCRemoteSwiftPackageReference "GRDB" */; productName = GRDB; }; + 3A2E87F12ED5A91100644195 /* Runestone */ = { + isa = XCSwiftPackageProductDependency; + package = 3A2E87F02ED5A91100644195 /* XCRemoteSwiftPackageReference "Runestone" */; + productName = Runestone; + }; + 3A2E87FA2ED5ABDA00644195 /* TreeSitterJSON5Runestone */ = { + isa = XCSwiftPackageProductDependency; + package = 3A2E87F92ED5ABCF00644195 /* XCLocalSwiftPackageReference "Frameworks/TreeSitterJSON5" */; + productName = TreeSitterJSON5Runestone; + }; 3A4A020C2B53E3DC004EFB87 /* QRCode */ = { isa = XCSwiftPackageProductDependency; package = 3A4A020B2B53E3DC004EFB87 /* XCRemoteSwiftPackageReference "qrcode" */; diff --git a/sing-box.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/sing-box.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 33bc350..47799b5 100644 --- a/sing-box.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/sing-box.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "82fb479ec8c73c3348b93e33a9102fc692bb5a0a0d6f14beb4c5f31445c36e81", + "originHash" : "48cbd083120736a1a1ce4b717dcbfdb7900aa5e2aa21991865021fb98adc2093", "pins" : [ { "identity" : "binarycodable", @@ -46,6 +46,15 @@ "version" : "17.1.0" } }, + { + "identity" : "runestone", + "kind" : "remoteSourceControl", + "location" : "https://github.com/simonbs/Runestone", + "state" : { + "revision" : "1fad339aab99cf2136ce6bf8c32da3265b2e85e5", + "version" : "0.5.1" + } + }, { "identity" : "swift-qrcode-generator", "kind" : "remoteSourceControl", @@ -63,6 +72,15 @@ "revision" : "96361ba7f9dce5184d95aba8ea90d9faa4acabb2", "version" : "1.6.1" } + }, + { + "identity" : "tree-sitter", + "kind" : "remoteSourceControl", + "location" : "https://github.com/tree-sitter/tree-sitter", + "state" : { + "revision" : "98be227227af10cc7a269cb3ffb23686c0610b17", + "version" : "0.20.9" + } } ], "version" : 3