diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.EditorSyntax.txt b/desktop/internal/editor/syntax/grammars/LICENSE.EditorSyntax.txt new file mode 100644 index 0000000000..e31e632977 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.EditorSyntax.txt @@ -0,0 +1,23 @@ +Copyright (c) Microsoft Corporation + +All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.MagicPython.txt b/desktop/internal/editor/syntax/grammars/LICENSE.MagicPython.txt new file mode 100644 index 0000000000..e6b42c6f3f --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.MagicPython.txt @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2015-present MagicStack Inc. http://magic.io + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/desktop/internal/editor/textmate/testdata/grammars/LICENSE.vscode.txt b/desktop/internal/editor/syntax/grammars/LICENSE.better-objc-syntax.txt similarity index 95% rename from desktop/internal/editor/textmate/testdata/grammars/LICENSE.vscode.txt rename to desktop/internal/editor/syntax/grammars/LICENSE.better-objc-syntax.txt index 0ac28ee234..c74c89459a 100644 --- a/desktop/internal/editor/textmate/testdata/grammars/LICENSE.vscode.txt +++ b/desktop/internal/editor/syntax/grammars/LICENSE.better-objc-syntax.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2015 - present Microsoft Corporation +Copyright (c) 2019 Jeff Hykin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.better-objcpp-syntax.txt b/desktop/internal/editor/syntax/grammars/LICENSE.better-objcpp-syntax.txt new file mode 100644 index 0000000000..c74c89459a --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.better-objcpp-syntax.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jeff Hykin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.better-shell-syntax.txt b/desktop/internal/editor/syntax/grammars/LICENSE.better-shell-syntax.txt new file mode 100644 index 0000000000..c74c89459a --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.better-shell-syntax.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jeff Hykin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.csharp-tmLanguage.txt b/desktop/internal/editor/syntax/grammars/LICENSE.csharp-tmLanguage.txt new file mode 100644 index 0000000000..5e389fb971 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.csharp-tmLanguage.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 .NET Foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.graphiql.txt b/desktop/internal/editor/syntax/grammars/LICENSE.graphiql.txt new file mode 100644 index 0000000000..7bbf892a04 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.graphiql.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) GraphQL Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.language-php.txt b/desktop/internal/editor/syntax/grammars/LICENSE.language-php.txt new file mode 100644 index 0000000000..85af29286a --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.language-php.txt @@ -0,0 +1,31 @@ +Copyright (c) 2014 GitHub Inc. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +-------------------------------------------------------------------- + +This package was derived from a TextMate bundle located at +https://github.com/textmate/php.tmbundle and distributed under the following +license, located in `README.mdown`: + +Permission to copy, use, modify, sell and distribute this +software is granted. This software is provided "as is" without +express or implied warranty, and with no claim as to its +suitability for any purpose. diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.lua.tmbundle.txt b/desktop/internal/editor/syntax/grammars/LICENSE.lua.tmbundle.txt new file mode 100644 index 0000000000..89118ae91a --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.lua.tmbundle.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 最萌小汐 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.moby.txt b/desktop/internal/editor/syntax/grammars/LICENSE.moby.txt new file mode 100644 index 0000000000..6d8d58fb67 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.moby.txt @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2013-2018 Docker, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.ruby-lsp.txt b/desktop/internal/editor/syntax/grammars/LICENSE.ruby-lsp.txt new file mode 100644 index 0000000000..c3ef6620b6 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.ruby-lsp.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022-present, Shopify Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.swift-tmlanguage.txt b/desktop/internal/editor/syntax/grammars/LICENSE.swift-tmlanguage.txt new file mode 100644 index 0000000000..fa95646b3c --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.swift-tmlanguage.txt @@ -0,0 +1,7 @@ +Copyright 2023 Jacob Bandes-Storch + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.textmate-bundles.txt b/desktop/internal/editor/syntax/grammars/LICENSE.textmate-bundles.txt index 2fa2c82f71..9cc847472a 100644 --- a/desktop/internal/editor/syntax/grammars/LICENSE.textmate-bundles.txt +++ b/desktop/internal/editor/syntax/grammars/LICENSE.textmate-bundles.txt @@ -85,3 +85,39 @@ An exception is made for files in readable text which contain their own license or files where an accompanying file exists (in the same directory) with a "-license" suffix added to the base-name name of the original file, and an extension of txt, html, or similar. For example "tidy" is accompanied by "tidy-license.txt". + +--- + +https://github.com/textmate/groovy.tmbundle 85d8f7c97ae473ccb9473f6c8d27e4ec957f4be1 + +Copyright (c) textmate-groovy.tmbundle project authors + +If not otherwise specified (see below), files in this repository fall under the following license: + +Permission to copy, use, modify, sell and distribute this +software is granted. This software is provided "as is" without +express or implied warranty, and with no claim as to its +suitability for any purpose. + +An exception is made for files in readable text which contain their own license information, +or files where an accompanying file exists (in the same directory) with a "-license" suffix added +to the base-name name of the original file, and an extension of txt, html, or similar. For example +"tidy" is accompanied by "tidy-license.txt". + +--- + +https://github.com/sumneko/lua.tmbundle b295d83bf0e91b5d3a69eb097f9ed351623b95be + +Copyright (c) sumneko-lua.tmbundle project authors + +If not otherwise specified (see below), files in this repository fall under the following license: + +Permission to copy, use, modify, sell and distribute this +software is granted. This software is provided "as is" without +express or implied warranty, and with no claim as to its +suitability for any purpose. + +An exception is made for files in readable text which contain their own license information, +or files where an accompanying file exists (in the same directory) with a "-license" suffix added +to the base-name name of the original file, and an extension of txt, html, or similar. For example +"tidy" is accompanied by "tidy-license.txt". diff --git a/desktop/internal/editor/textmate/testdata/grammars/LICENSE.cmake.txt b/desktop/internal/editor/syntax/grammars/LICENSE.vscode-cmake-tools.txt similarity index 100% rename from desktop/internal/editor/textmate/testdata/grammars/LICENSE.cmake.txt rename to desktop/internal/editor/syntax/grammars/LICENSE.vscode-cmake-tools.txt diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.vscode-kotlin.txt b/desktop/internal/editor/syntax/grammars/LICENSE.vscode-kotlin.txt new file mode 100644 index 0000000000..2426eb9e01 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.vscode-kotlin.txt @@ -0,0 +1,10 @@ +The MIT License (MIT) + +Copyright (c) 2016 George Fraser +Copyright (c) 2018 fwcd + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.vscode-mssql.txt b/desktop/internal/editor/syntax/grammars/LICENSE.vscode-mssql.txt new file mode 100644 index 0000000000..1b36720743 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.vscode-mssql.txt @@ -0,0 +1,10 @@ + ------------------------------------------ START OF LICENSE ----------------------------------------- +vscode-mssql +Copyright (c) Microsoft Corporation +All rights reserved. +MIT License +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Copyright (c) 2016 Microsoft +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +----------------------------------------------- END OF LICENSE ----------------------------------------- \ No newline at end of file diff --git a/desktop/internal/editor/textmate/testdata/grammars/LICENSE.groovy.txt b/desktop/internal/editor/syntax/grammars/LICENSE.vscode-proto3.txt similarity index 58% rename from desktop/internal/editor/textmate/testdata/grammars/LICENSE.groovy.txt rename to desktop/internal/editor/syntax/grammars/LICENSE.vscode-proto3.txt index 6aedd960e6..afbac211da 100644 --- a/desktop/internal/editor/textmate/testdata/grammars/LICENSE.groovy.txt +++ b/desktop/internal/editor/syntax/grammars/LICENSE.vscode-proto3.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) Microsoft +Copyright (c) 2016 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,22 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ---- - -The Original TextMate License - -If not otherwise specified (see below), files in this repository -fall under the following license: - -Permission to copy, use, modify, sell and distribute this -software is granted. This software is provided "as is" without -express or implied warranty, and with no claim as to its -suitability for any purpose. - -An exception is made for files in readable text which contain their own license -information, or files where an accompanying file exists (in the same directory) -with a “-license” suffix added to the base-name name of the original file, and an -extension of txt, html, or similar. For example “tidy” is accompanied -by “tidy-license.txt”. +SOFTWARE. \ No newline at end of file diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.vscode-swift.txt b/desktop/internal/editor/syntax/grammars/LICENSE.vscode-swift.txt new file mode 100644 index 0000000000..83e5c33248 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.vscode-swift.txt @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2015 David Owens II + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/desktop/internal/editor/syntax/grammars/LICENSE.vscode-zig.txt b/desktop/internal/editor/syntax/grammars/LICENSE.vscode-zig.txt new file mode 100644 index 0000000000..571e549daf --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/LICENSE.vscode-zig.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 Marc Tiehuis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/desktop/internal/editor/syntax/grammars/MagicPython.tmLanguage.json b/desktop/internal/editor/syntax/grammars/MagicPython.tmLanguage.json new file mode 100644 index 0000000000..91a2c8e756 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/MagicPython.tmLanguage.json @@ -0,0 +1,4213 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/MagicStack/MagicPython/blob/master/grammars/MagicPython.tmLanguage", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/MagicStack/MagicPython/commit/7d0f2b22a5ad8fccbd7341bc7b7a715169283044", + "name": "MagicPython", + "scopeName": "source.python", + "patterns": [ + { + "include": "#statement" + }, + { + "include": "#expression" + } + ], + "repository": { + "impossible": { + "comment": "This is a special rule that should be used where no match is desired. It is not a good idea to match something like '1{0}' because in some cases that can result in infinite loops in token generation. So the rule instead matches and impossible expression to allow a match to fail and move to the next token.", + "match": "$.^" + }, + "statement": { + "patterns": [ + { + "include": "#import" + }, + { + "include": "#class-declaration" + }, + { + "include": "#function-declaration" + }, + { + "include": "#generator" + }, + { + "include": "#statement-keyword" + }, + { + "include": "#assignment-operator" + }, + { + "include": "#decorator" + }, + { + "include": "#docstring-statement" + }, + { + "include": "#semicolon" + } + ] + }, + "semicolon": { + "patterns": [ + { + "name": "invalid.deprecated.semicolon.python", + "match": "\\;$" + } + ] + }, + "comments": { + "patterns": [ + { + "name": "comment.line.number-sign.python", + "contentName": "meta.typehint.comment.python", + "begin": "(?x)\n (?:\n \\# \\s* (type:)\n \\s*+ (?# we want `\\s*+` which is possessive quantifier since\n we do not actually want to backtrack when matching\n whitespace here)\n (?! $ | \\#)\n )\n", + "end": "(?:$|(?=\\#))", + "beginCaptures": { + "0": { + "name": "meta.typehint.comment.python" + }, + "1": { + "name": "comment.typehint.directive.notation.python" + } + }, + "patterns": [ + { + "name": "comment.typehint.ignore.notation.python", + "match": "(?x)\n \\G ignore\n (?= \\s* (?: $ | \\#))\n" + }, + { + "name": "comment.typehint.type.notation.python", + "match": "(?x)\n (?))" + }, + { + "name": "comment.typehint.variable.notation.python", + "match": "([[:alpha:]_]\\w*)" + } + ] + }, + { + "include": "#comments-base" + } + ] + }, + "docstring-statement": { + "begin": "^(?=\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))", + "comment": "the string either terminates correctly or by the beginning of a new line (this is for single line docstrings that aren't terminated) AND it's not followed by another docstring", + "end": "((?<=\\1)|^)(?!\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))", + "patterns": [ + { + "include": "#docstring" + } + ] + }, + "docstring": { + "patterns": [ + { + "name": "string.quoted.docstring.multi.python", + "begin": "(\\'\\'\\'|\\\"\\\"\\\")", + "end": "(\\1)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.python" + } + }, + "patterns": [ + { + "include": "#docstring-prompt" + }, + { + "include": "#codetags" + }, + { + "include": "#docstring-guts-unicode" + } + ] + }, + { + "name": "string.quoted.docstring.raw.multi.python", + "begin": "([rR])(\\'\\'\\'|\\\"\\\"\\\")", + "end": "(\\2)", + "beginCaptures": { + "1": { + "name": "storage.type.string.python" + }, + "2": { + "name": "punctuation.definition.string.begin.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.python" + } + }, + "patterns": [ + { + "include": "#string-consume-escape" + }, + { + "include": "#docstring-prompt" + }, + { + "include": "#codetags" + } + ] + }, + { + "name": "string.quoted.docstring.single.python", + "begin": "(\\'|\\\")", + "end": "(\\1)|(\\n)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.python" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#codetags" + }, + { + "include": "#docstring-guts-unicode" + } + ] + }, + { + "name": "string.quoted.docstring.raw.single.python", + "begin": "([rR])(\\'|\\\")", + "end": "(\\2)|(\\n)", + "beginCaptures": { + "1": { + "name": "storage.type.string.python" + }, + "2": { + "name": "punctuation.definition.string.begin.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.python" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#string-consume-escape" + }, + { + "include": "#codetags" + } + ] + } + ] + }, + "docstring-guts-unicode": { + "patterns": [ + { + "include": "#escape-sequence-unicode" + }, + { + "include": "#escape-sequence" + }, + { + "include": "#string-line-continuation" + } + ] + }, + "docstring-prompt": { + "match": "(?x)\n (?:\n (?:^|\\G) \\s* (?# '\\G' is necessary for ST)\n ((?:>>>|\\.\\.\\.) \\s) (?=\\s*\\S)\n )\n", + "captures": { + "1": { + "name": "keyword.control.flow.python" + } + } + }, + "statement-keyword": { + "patterns": [ + { + "name": "storage.type.function.python", + "match": "\\b((async\\s+)?\\s*def)\\b" + }, + { + "name": "keyword.control.flow.python", + "comment": "if `as` is eventually followed by `:` or line continuation\nit's probably control flow like:\n with foo as bar, \\\n Foo as Bar:\n try:\n do_stuff()\n except Exception as e:\n pass\n", + "match": "\\b(?>= | //= | \\*\\*=\n | \\+= | -= | /= | @=\n | \\*= | %= | ~= | \\^= | &= | \\|=\n | =(?!=)\n" + }, + "operator": { + "match": "(?x)\n \\b(?> | & | \\| | \\^ | ~) (?# 3)\n\n | (\\*\\* | \\* | \\+ | - | % | // | / | @) (?# 4)\n\n | (!= | == | >= | <= | < | >) (?# 5)\n\n | (:=) (?# 6)\n", + "captures": { + "1": { + "name": "keyword.operator.logical.python" + }, + "2": { + "name": "keyword.control.flow.python" + }, + "3": { + "name": "keyword.operator.bitwise.python" + }, + "4": { + "name": "keyword.operator.arithmetic.python" + }, + "5": { + "name": "keyword.operator.comparison.python" + }, + "6": { + "name": "keyword.operator.assignment.python" + } + } + }, + "punctuation": { + "patterns": [ + { + "name": "punctuation.separator.colon.python", + "match": ":" + }, + { + "name": "punctuation.separator.element.python", + "match": "," + } + ] + }, + "literal": { + "patterns": [ + { + "name": "constant.language.python", + "match": "\\b(True|False|None|NotImplemented|Ellipsis)\\b" + }, + { + "include": "#number" + } + ] + }, + "number": { + "name": "constant.numeric.python", + "patterns": [ + { + "include": "#number-float" + }, + { + "include": "#number-dec" + }, + { + "include": "#number-hex" + }, + { + "include": "#number-oct" + }, + { + "include": "#number-bin" + }, + { + "include": "#number-long" + }, + { + "name": "invalid.illegal.name.python", + "match": "\\b[0-9]+\\w+" + } + ] + }, + "number-float": { + "name": "constant.numeric.float.python", + "match": "(?x)\n (?=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?\n })\n )\n", + "captures": { + "1": { + "name": "constant.character.format.placeholder.other.python" + }, + "3": { + "name": "storage.type.format.python" + }, + "4": { + "name": "storage.type.format.python" + } + } + }, + { + "name": "meta.format.brace.python", + "match": "(?x)\n (\n {\n \\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'\"]+\\])*\n (![rsa])?\n (:)\n [^'\"{}\\n]* (?:\n \\{ [^'\"}\\n]*? \\} [^'\"{}\\n]*\n )*\n }\n )\n", + "captures": { + "1": { + "name": "constant.character.format.placeholder.other.python" + }, + "3": { + "name": "storage.type.format.python" + }, + "4": { + "name": "storage.type.format.python" + } + } + } + ] + }, + "fstring-formatting": { + "patterns": [ + { + "include": "#fstring-formatting-braces" + }, + { + "include": "#fstring-formatting-singe-brace" + } + ] + }, + "fstring-formatting-singe-brace": { + "name": "invalid.illegal.brace.python", + "match": "(}(?!}))" + }, + "import": { + "comment": "Import statements used to correctly mark `from`, `import`, and `as`\n", + "patterns": [ + { + "begin": "\\b(?)", + "end": "(?=:)", + "beginCaptures": { + "1": { + "name": "punctuation.separator.annotation.result.python" + } + }, + "patterns": [ + { + "include": "#expression" + } + ] + }, + "item-access": { + "patterns": [ + { + "name": "meta.item-access.python", + "begin": "(?x)\n \\b(?=\n [[:alpha:]_]\\w* \\s* \\[\n )\n", + "end": "(\\])", + "endCaptures": { + "1": { + "name": "punctuation.definition.arguments.end.python" + } + }, + "patterns": [ + { + "include": "#item-name" + }, + { + "include": "#item-index" + }, + { + "include": "#expression" + } + ] + } + ] + }, + "item-name": { + "patterns": [ + { + "include": "#special-variables" + }, + { + "include": "#builtin-functions" + }, + { + "include": "#special-names" + }, + { + "name": "meta.indexed-name.python", + "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n" + } + ] + }, + "item-index": { + "begin": "(\\[)", + "end": "(?=\\])", + "beginCaptures": { + "1": { + "name": "punctuation.definition.arguments.begin.python" + } + }, + "contentName": "meta.item-access.arguments.python", + "patterns": [ + { + "name": "punctuation.separator.slice.python", + "match": ":" + }, + { + "include": "#expression" + } + ] + }, + "decorator": { + "name": "meta.function.decorator.python", + "begin": "(?x)\n ^\\s*\n ((@)) \\s* (?=[[:alpha:]_]\\w*)\n", + "end": "(?x)\n ( \\) )\n # trailing whitespace and comments are legal\n (?: (.*?) (?=\\s*(?:\\#|$)) )\n | (?=\\n|\\#)\n", + "beginCaptures": { + "1": { + "name": "entity.name.function.decorator.python" + }, + "2": { + "name": "punctuation.definition.decorator.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.arguments.end.python" + }, + "2": { + "name": "invalid.illegal.decorator.python" + } + }, + "patterns": [ + { + "include": "#decorator-name" + }, + { + "include": "#function-arguments" + } + ] + }, + "decorator-name": { + "patterns": [ + { + "include": "#builtin-callables" + }, + { + "include": "#illegal-object-name" + }, + { + "name": "entity.name.function.decorator.python", + "match": "(?x)\n ([[:alpha:]_]\\w*) | (\\.)\n", + "captures": { + "2": { + "name": "punctuation.separator.period.python" + } + } + }, + { + "include": "#line-continuation" + }, + { + "name": "invalid.illegal.decorator.python", + "match": "(?x)\n \\s* ([^([:alpha:]\\s_\\.#\\\\] .*?) (?=\\#|$)\n", + "captures": { + "1": { + "name": "invalid.illegal.decorator.python" + } + } + } + ] + }, + "call-wrapper-inheritance": { + "comment": "same as a function call, but in inheritance context", + "name": "meta.function-call.python", + "begin": "(?x)\n \\b(?=\n ([[:alpha:]_]\\w*) \\s* (\\()\n )\n", + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.definition.arguments.end.python" + } + }, + "patterns": [ + { + "include": "#inheritance-name" + }, + { + "include": "#function-arguments" + } + ] + }, + "inheritance-name": { + "patterns": [ + { + "include": "#lambda-incomplete" + }, + { + "include": "#builtin-possible-callables" + }, + { + "include": "#inheritance-identifier" + } + ] + }, + "function-call": { + "name": "meta.function-call.python", + "comment": "Regular function call of the type \"name(args)\"", + "begin": "(?x)\n \\b(?=\n ([[:alpha:]_]\\w*) \\s* (\\()\n )\n", + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.definition.arguments.end.python" + } + }, + "patterns": [ + { + "include": "#special-variables" + }, + { + "include": "#function-name" + }, + { + "include": "#function-arguments" + } + ] + }, + "function-name": { + "patterns": [ + { + "include": "#builtin-possible-callables" + }, + { + "comment": "Some color schemas support meta.function-call.generic scope", + "name": "meta.function-call.generic.python", + "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n" + } + ] + }, + "function-arguments": { + "begin": "(\\()", + "end": "(?=\\))(?!\\)\\s*\\()", + "beginCaptures": { + "1": { + "name": "punctuation.definition.arguments.begin.python" + } + }, + "contentName": "meta.function-call.arguments.python", + "patterns": [ + { + "name": "punctuation.separator.arguments.python", + "match": "(,)" + }, + { + "match": "(?x)\n (?:(?<=[,(])|^) \\s* (\\*{1,2})\n", + "captures": { + "1": { + "name": "keyword.operator.unpacking.arguments.python" + } + } + }, + { + "include": "#lambda-incomplete" + }, + { + "include": "#illegal-names" + }, + { + "match": "\\b([[:alpha:]_]\\w*)\\s*(=)(?!=)", + "captures": { + "1": { + "name": "variable.parameter.function-call.python" + }, + "2": { + "name": "keyword.operator.assignment.python" + } + } + }, + { + "name": "keyword.operator.assignment.python", + "match": "=(?!=)" + }, + { + "include": "#expression" + }, + { + "match": "\\s*(\\))\\s*(\\()", + "captures": { + "1": { + "name": "punctuation.definition.arguments.end.python" + }, + "2": { + "name": "punctuation.definition.arguments.begin.python" + } + } + } + ] + }, + "builtin-callables": { + "patterns": [ + { + "include": "#illegal-names" + }, + { + "include": "#illegal-object-name" + }, + { + "include": "#builtin-exceptions" + }, + { + "include": "#builtin-functions" + }, + { + "include": "#builtin-types" + } + ] + }, + "builtin-possible-callables": { + "patterns": [ + { + "include": "#builtin-callables" + }, + { + "include": "#magic-names" + } + ] + }, + "builtin-exceptions": { + "name": "support.type.exception.python", + "match": "(?x) (?" + }, + "regexp-base-expression": { + "patterns": [ + { + "include": "#regexp-quantifier" + }, + { + "include": "#regexp-base-common" + } + ] + }, + "fregexp-base-expression": { + "patterns": [ + { + "include": "#fregexp-quantifier" + }, + { + "include": "#fstring-formatting-braces" + }, + { + "match": "\\{.*?\\}" + }, + { + "include": "#regexp-base-common" + } + ] + }, + "fstring-formatting-braces": { + "patterns": [ + { + "comment": "empty braces are illegal", + "match": "({)(\\s*?)(})", + "captures": { + "1": { + "name": "constant.character.format.placeholder.other.python" + }, + "2": { + "name": "invalid.illegal.brace.python" + }, + "3": { + "name": "constant.character.format.placeholder.other.python" + } + } + }, + { + "name": "constant.character.escape.python", + "match": "({{|}})" + } + ] + }, + "regexp-base-common": { + "patterns": [ + { + "name": "support.other.match.any.regexp", + "match": "\\." + }, + { + "name": "support.other.match.begin.regexp", + "match": "\\^" + }, + { + "name": "support.other.match.end.regexp", + "match": "\\$" + }, + { + "name": "keyword.operator.quantifier.regexp", + "match": "[+*?]\\??" + }, + { + "name": "keyword.operator.disjunction.regexp", + "match": "\\|" + }, + { + "include": "#regexp-escape-sequence" + } + ] + }, + "regexp-quantifier": { + "name": "keyword.operator.quantifier.regexp", + "match": "(?x)\n \\{(\n \\d+ | \\d+,(\\d+)? | ,\\d+\n )\\}\n" + }, + "fregexp-quantifier": { + "name": "keyword.operator.quantifier.regexp", + "match": "(?x)\n \\{\\{(\n \\d+ | \\d+,(\\d+)? | ,\\d+\n )\\}\\}\n" + }, + "regexp-backreference-number": { + "name": "meta.backreference.regexp", + "match": "(\\\\[1-9]\\d?)", + "captures": { + "1": { + "name": "entity.name.tag.backreference.regexp" + } + } + }, + "regexp-backreference": { + "name": "meta.backreference.named.regexp", + "match": "(?x)\n (\\() (\\?P= \\w+(?:\\s+[[:alnum:]]+)?) (\\))\n", + "captures": { + "1": { + "name": "support.other.parenthesis.regexp punctuation.parenthesis.backreference.named.begin.regexp" + }, + "2": { + "name": "entity.name.tag.named.backreference.regexp" + }, + "3": { + "name": "support.other.parenthesis.regexp punctuation.parenthesis.backreference.named.end.regexp" + } + } + }, + "regexp-flags": { + "name": "storage.modifier.flag.regexp", + "match": "\\(\\?[aiLmsux]+\\)" + }, + "regexp-escape-special": { + "name": "support.other.escape.special.regexp", + "match": "\\\\([AbBdDsSwWZ])" + }, + "regexp-escape-character": { + "name": "constant.character.escape.regexp", + "match": "(?x)\n \\\\ (\n x[0-9A-Fa-f]{2}\n | 0[0-7]{1,2}\n | [0-7]{3}\n )\n" + }, + "regexp-escape-unicode": { + "name": "constant.character.unicode.regexp", + "match": "(?x)\n \\\\ (\n u[0-9A-Fa-f]{4}\n | U[0-9A-Fa-f]{8}\n )\n" + }, + "regexp-escape-catchall": { + "name": "constant.character.escape.regexp", + "match": "\\\\(.|\\n)" + }, + "regexp-escape-sequence": { + "patterns": [ + { + "include": "#regexp-escape-special" + }, + { + "include": "#regexp-escape-character" + }, + { + "include": "#regexp-escape-unicode" + }, + { + "include": "#regexp-backreference-number" + }, + { + "include": "#regexp-escape-catchall" + } + ] + }, + "regexp-charecter-set-escapes": { + "patterns": [ + { + "name": "constant.character.escape.regexp", + "match": "\\\\[abfnrtv\\\\]" + }, + { + "include": "#regexp-escape-special" + }, + { + "name": "constant.character.escape.regexp", + "match": "\\\\([0-7]{1,3})" + }, + { + "include": "#regexp-escape-character" + }, + { + "include": "#regexp-escape-unicode" + }, + { + "include": "#regexp-escape-catchall" + } + ] + }, + "codetags": { + "match": "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)", + "captures": { + "1": { + "name": "keyword.codetag.notation.python" + } + } + }, + "comments-base": { + "name": "comment.line.number-sign.python", + "begin": "(\\#)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.python" + } + }, + "end": "($)", + "patterns": [ + { + "include": "#codetags" + } + ] + }, + "comments-string-single-three": { + "name": "comment.line.number-sign.python", + "begin": "(\\#)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.python" + } + }, + "end": "($|(?='''))", + "patterns": [ + { + "include": "#codetags" + } + ] + }, + "comments-string-double-three": { + "name": "comment.line.number-sign.python", + "begin": "(\\#)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.python" + } + }, + "end": "($|(?=\"\"\"))", + "patterns": [ + { + "include": "#codetags" + } + ] + }, + "single-one-regexp-expression": { + "patterns": [ + { + "include": "#regexp-base-expression" + }, + { + "include": "#single-one-regexp-character-set" + }, + { + "include": "#single-one-regexp-comments" + }, + { + "include": "#regexp-flags" + }, + { + "include": "#single-one-regexp-named-group" + }, + { + "include": "#regexp-backreference" + }, + { + "include": "#single-one-regexp-lookahead" + }, + { + "include": "#single-one-regexp-lookahead-negative" + }, + { + "include": "#single-one-regexp-lookbehind" + }, + { + "include": "#single-one-regexp-lookbehind-negative" + }, + { + "include": "#single-one-regexp-conditional" + }, + { + "include": "#single-one-regexp-parentheses-non-capturing" + }, + { + "include": "#single-one-regexp-parentheses" + } + ] + }, + "single-one-regexp-character-set": { + "patterns": [ + { + "match": "(?x)\n \\[ \\^? \\] (?! .*?\\])\n" + }, + { + "name": "meta.character.set.regexp", + "begin": "(\\[)(\\^)?(\\])?", + "end": "(\\]|(?=\\'))|((?=(?)\n", + "end": "(\\)|(?=\\'))|((?=(?)\n", + "end": "(\\)|(?=\\'\\'\\'))", + "beginCaptures": { + "1": { + "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp" + }, + "2": { + "name": "entity.name.tag.named.group.regexp" + } + }, + "endCaptures": { + "1": { + "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#single-three-regexp-expression" + }, + { + "include": "#comments-string-single-three" + } + ] + }, + "single-three-regexp-comments": { + "name": "comment.regexp", + "begin": "\\(\\?#", + "end": "(\\)|(?=\\'\\'\\'))", + "beginCaptures": { + "0": { + "name": "punctuation.comment.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.comment.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#codetags" + } + ] + }, + "single-three-regexp-lookahead": { + "begin": "(\\()\\?=", + "end": "(\\)|(?=\\'\\'\\'))", + "beginCaptures": { + "0": { + "name": "keyword.operator.lookahead.regexp" + }, + "1": { + "name": "punctuation.parenthesis.lookahead.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#single-three-regexp-expression" + }, + { + "include": "#comments-string-single-three" + } + ] + }, + "single-three-regexp-lookahead-negative": { + "begin": "(\\()\\?!", + "end": "(\\)|(?=\\'\\'\\'))", + "beginCaptures": { + "0": { + "name": "keyword.operator.lookahead.negative.regexp" + }, + "1": { + "name": "punctuation.parenthesis.lookahead.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#single-three-regexp-expression" + }, + { + "include": "#comments-string-single-three" + } + ] + }, + "single-three-regexp-lookbehind": { + "begin": "(\\()\\?<=", + "end": "(\\)|(?=\\'\\'\\'))", + "beginCaptures": { + "0": { + "name": "keyword.operator.lookbehind.regexp" + }, + "1": { + "name": "punctuation.parenthesis.lookbehind.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#single-three-regexp-expression" + }, + { + "include": "#comments-string-single-three" + } + ] + }, + "single-three-regexp-lookbehind-negative": { + "begin": "(\\()\\?)\n", + "end": "(\\)|(?=\"))|((?=(?)\n", + "end": "(\\)|(?=\"\"\"))", + "beginCaptures": { + "1": { + "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp" + }, + "2": { + "name": "entity.name.tag.named.group.regexp" + } + }, + "endCaptures": { + "1": { + "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#double-three-regexp-expression" + }, + { + "include": "#comments-string-double-three" + } + ] + }, + "double-three-regexp-comments": { + "name": "comment.regexp", + "begin": "\\(\\?#", + "end": "(\\)|(?=\"\"\"))", + "beginCaptures": { + "0": { + "name": "punctuation.comment.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.comment.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#codetags" + } + ] + }, + "double-three-regexp-lookahead": { + "begin": "(\\()\\?=", + "end": "(\\)|(?=\"\"\"))", + "beginCaptures": { + "0": { + "name": "keyword.operator.lookahead.regexp" + }, + "1": { + "name": "punctuation.parenthesis.lookahead.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#double-three-regexp-expression" + }, + { + "include": "#comments-string-double-three" + } + ] + }, + "double-three-regexp-lookahead-negative": { + "begin": "(\\()\\?!", + "end": "(\\)|(?=\"\"\"))", + "beginCaptures": { + "0": { + "name": "keyword.operator.lookahead.negative.regexp" + }, + "1": { + "name": "punctuation.parenthesis.lookahead.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#double-three-regexp-expression" + }, + { + "include": "#comments-string-double-three" + } + ] + }, + "double-three-regexp-lookbehind": { + "begin": "(\\()\\?<=", + "end": "(\\)|(?=\"\"\"))", + "beginCaptures": { + "0": { + "name": "keyword.operator.lookbehind.regexp" + }, + "1": { + "name": "punctuation.parenthesis.lookbehind.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#double-three-regexp-expression" + }, + { + "include": "#comments-string-double-three" + } + ] + }, + "double-three-regexp-lookbehind-negative": { + "begin": "(\\()\\?=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=})\n", + "captures": { + "1": { + "name": "storage.type.format.python" + }, + "2": { + "name": "storage.type.format.python" + } + } + }, + { + "include": "#fstring-terminator-single-tail" + } + ] + }, + "fstring-terminator-single-tail": { + "begin": "((?:=?)(?:![rsa])?)(:)(?=.*?{)", + "end": "(?=})|(?=\\n)", + "beginCaptures": { + "1": { + "name": "storage.type.format.python" + }, + "2": { + "name": "storage.type.format.python" + } + }, + "patterns": [ + { + "include": "#fstring-illegal-single-brace" + }, + { + "include": "#fstring-single-brace" + }, + { + "name": "storage.type.format.python", + "match": "([bcdeEfFgGnosxX%])(?=})" + }, + { + "name": "storage.type.format.python", + "match": "(\\.\\d+)" + }, + { + "name": "storage.type.format.python", + "match": "(,)" + }, + { + "name": "storage.type.format.python", + "match": "(\\d+)" + }, + { + "name": "storage.type.format.python", + "match": "(\\#)" + }, + { + "name": "storage.type.format.python", + "match": "([-+ ])" + }, + { + "name": "storage.type.format.python", + "match": "([<>=^])" + }, + { + "name": "storage.type.format.python", + "match": "(\\w)" + } + ] + }, + "fstring-fnorm-quoted-multi-line": { + "name": "meta.fstring.python", + "begin": "(\\b[fF])([bBuU])?('''|\"\"\")", + "end": "(\\3)", + "beginCaptures": { + "1": { + "name": "string.interpolated.python string.quoted.multi.python storage.type.string.python" + }, + "2": { + "name": "invalid.illegal.prefix.python" + }, + "3": { + "name": "punctuation.definition.string.begin.python string.interpolated.python string.quoted.multi.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.multi.python" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#fstring-guts" + }, + { + "include": "#fstring-illegal-multi-brace" + }, + { + "include": "#fstring-multi-brace" + }, + { + "include": "#fstring-multi-core" + } + ] + }, + "fstring-normf-quoted-multi-line": { + "name": "meta.fstring.python", + "begin": "(\\b[bBuU])([fF])('''|\"\"\")", + "end": "(\\3)", + "beginCaptures": { + "1": { + "name": "invalid.illegal.prefix.python" + }, + "2": { + "name": "string.interpolated.python string.quoted.multi.python storage.type.string.python" + }, + "3": { + "name": "punctuation.definition.string.begin.python string.quoted.multi.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.multi.python" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#fstring-guts" + }, + { + "include": "#fstring-illegal-multi-brace" + }, + { + "include": "#fstring-multi-brace" + }, + { + "include": "#fstring-multi-core" + } + ] + }, + "fstring-raw-quoted-multi-line": { + "name": "meta.fstring.python", + "begin": "(\\b(?:[rR][fF]|[fF][rR]))('''|\"\"\")", + "end": "(\\2)", + "beginCaptures": { + "1": { + "name": "string.interpolated.python string.quoted.raw.multi.python storage.type.string.python" + }, + "2": { + "name": "punctuation.definition.string.begin.python string.quoted.raw.multi.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.raw.multi.python" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#fstring-raw-guts" + }, + { + "include": "#fstring-illegal-multi-brace" + }, + { + "include": "#fstring-multi-brace" + }, + { + "include": "#fstring-raw-multi-core" + } + ] + }, + "fstring-multi-core": { + "name": "string.interpolated.python string.quoted.multi.python", + "match": "(?x)\n (.+?)\n (\n (?# .* and .*? in multi-line match need special handling of\n newlines otherwise SublimeText and Atom will match slightly\n differently.\n\n The guard for newlines has to be separate from the\n lookahead because of special $ matching rule.)\n ($\\n?)\n |\n (?=[\\\\\\}\\{]|'''|\"\"\")\n )\n (?# due to how multiline regexps are matched we need a special case\n for matching a newline character)\n | \\n\n" + }, + "fstring-raw-multi-core": { + "name": "string.interpolated.python string.quoted.raw.multi.python", + "match": "(?x)\n (.+?)\n (\n (?# .* and .*? in multi-line match need special handling of\n newlines otherwise SublimeText and Atom will match slightly\n differently.\n\n The guard for newlines has to be separate from the\n lookahead because of special $ matching rule.)\n ($\\n?)\n |\n (?=[\\\\\\}\\{]|'''|\"\"\")\n )\n (?# due to how multiline regexps are matched we need a special case\n for matching a newline character)\n | \\n\n" + }, + "fstring-multi-brace": { + "comment": "value interpolation using { ... }", + "begin": "(\\{)", + "end": "(?x)\n (\\})\n", + "beginCaptures": { + "1": { + "name": "constant.character.format.placeholder.other.python" + } + }, + "endCaptures": { + "1": { + "name": "constant.character.format.placeholder.other.python" + } + }, + "patterns": [ + { + "include": "#fstring-terminator-multi" + }, + { + "include": "#f-expression" + } + ] + }, + "fstring-terminator-multi": { + "patterns": [ + { + "name": "storage.type.format.python", + "match": "(=(![rsa])?)(?=})" + }, + { + "name": "storage.type.format.python", + "match": "(=?![rsa])(?=})" + }, + { + "match": "(?x)\n ( (?: =?) (?: ![rsa])? )\n ( : \\w? [<>=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=})\n", + "captures": { + "1": { + "name": "storage.type.format.python" + }, + "2": { + "name": "storage.type.format.python" + } + } + }, + { + "include": "#fstring-terminator-multi-tail" + } + ] + }, + "fstring-terminator-multi-tail": { + "begin": "((?:=?)(?:![rsa])?)(:)(?=.*?{)", + "end": "(?=})", + "beginCaptures": { + "1": { + "name": "storage.type.format.python" + }, + "2": { + "name": "storage.type.format.python" + } + }, + "patterns": [ + { + "include": "#fstring-illegal-multi-brace" + }, + { + "include": "#fstring-multi-brace" + }, + { + "name": "storage.type.format.python", + "match": "([bcdeEfFgGnosxX%])(?=})" + }, + { + "name": "storage.type.format.python", + "match": "(\\.\\d+)" + }, + { + "name": "storage.type.format.python", + "match": "(,)" + }, + { + "name": "storage.type.format.python", + "match": "(\\d+)" + }, + { + "name": "storage.type.format.python", + "match": "(\\#)" + }, + { + "name": "storage.type.format.python", + "match": "([-+ ])" + }, + { + "name": "storage.type.format.python", + "match": "([<>=^])" + }, + { + "name": "storage.type.format.python", + "match": "(\\w)" + } + ] + } + } +} \ No newline at end of file diff --git a/desktop/internal/editor/syntax/grammars/NOTICE.moby.txt b/desktop/internal/editor/syntax/grammars/NOTICE.moby.txt new file mode 100644 index 0000000000..58b19b6d15 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/NOTICE.moby.txt @@ -0,0 +1,19 @@ +Docker +Copyright 2012-2017 Docker, Inc. + +This product includes software developed at Docker, Inc. (https://www.docker.com). + +This product contains software (https://github.com/creack/pty) developed +by Keith Rarick, licensed under the MIT License. + +The following is courtesy of our legal counsel: + + +Use and transfer of Docker may be subject to certain restrictions by the +United States and other governments. +It is your responsibility to ensure that your use and/or transfer does not +violate applicable laws. + +For more information, please see https://www.bis.doc.gov + +See also https://www.apache.org/dev/crypto.html and/or seek legal counsel. diff --git a/desktop/internal/editor/syntax/grammars/NOTICE.txt b/desktop/internal/editor/syntax/grammars/NOTICE.txt index 06f7fdeaf9..172c34d7e5 100644 --- a/desktop/internal/editor/syntax/grammars/NOTICE.txt +++ b/desktop/internal/editor/syntax/grammars/NOTICE.txt @@ -56,9 +56,59 @@ and that grammar's license, follow. 7bc75dfe779ad5b35d9bf4013d9181864358cb49. MIT, LICENSE.language-xml.txt. - ini.tmLanguage.json (extension ini): textmate/ini.tmbundle 2af0cbb0704940f967152616f2f1ff0aae6287a6, LICENSE.textmate-bundles.txt. +- groovy.tmLanguage.json (extension groovy): textmate/groovy.tmbundle + 85d8f7c97ae473ccb9473f6c8d27e4ec957f4be1, LICENSE.textmate-bundles.txt. +- html-derivative.tmLanguage.json (extension html): textmate/html.tmbundle + 0c3d5ee54de3a993f747f54186b73a4d2d3c44a2, LICENSE.textmate-bundles.txt. PHP uses it for the + HTML around its code. +- php.tmLanguage.json, php-html.tmLanguage.json (extension php; the second is html.tmLanguage.json + there, renamed beside HTML's own): KapitanOczywisty/language-php + d94fd6b7dff1613d34bc0d36328f9982e65bd545. MIT, LICENSE.language-php.txt, which also carries the + permission of the TextMate PHP bundle it derives from. +- MagicPython.tmLanguage.json (extension python): MagicStack/MagicPython + 7d0f2b22a5ad8fccbd7341bc7b7a715169283044. MIT, LICENSE.MagicPython.txt. +- shell-unix-bash.tmLanguage.json (extension shellscript): jeff-hykin/better-shell-syntax + 35020b0bd79a90d3b262b4c13a8bb0b33adc1f45. MIT, LICENSE.better-shell-syntax.txt. +- powershell.tmLanguage.json (extension powershell): PowerShell/EditorSyntax + 23eed76d483c887a1608609e9dd57e09666411cc. MIT, LICENSE.EditorSyntax.txt. +- ruby.tmLanguage.json (extension ruby): Shopify/ruby-lsp + e044408a069f43c892143f19c389628eebffbd01. MIT, LICENSE.ruby-lsp.txt. +- csharp.tmLanguage.json (extension csharp): dotnet/csharp-tmLanguage + c2719309e91d2e26be21fce0ecaaca86c7b48ce4. MIT, LICENSE.csharp-tmLanguage.txt. +- objective-c.tmLanguage.json (extension objective-c): jeff-hykin/better-objc-syntax + 119b75fb1f4d3e8726fa62588e3b935e0b719294. MIT, LICENSE.better-objc-syntax.txt. +- objective-c++.tmLanguage.json (extension objective-c): jeff-hykin/better-objcpp-syntax + 5a7eb15eee382dd5aa388bc04fdb60a0d2128e14. MIT, LICENSE.better-objcpp-syntax.txt. +- swift.tmLanguage.json (extension swift): jtbandes/swift-tmlanguage + 2be007b6bc88e54a0edfd3c313ff31276edc923d, MIT, LICENSE.swift-tmlanguage.txt; VS Code also + records owensd/vscode-swift cec27af6662e3799120b208e64483efdfe5521f5, MIT, + LICENSE.vscode-swift.txt. +- sql.tmLanguage.json (extension sql): microsoft/vscode-mssql + 684648ee5414eb2d9df22b0392ef05079f91e44e. MIT, LICENSE.vscode-mssql.txt. +- lua.tmLanguage.json (extension lua): sumneko/lua.tmbundle + b295d83bf0e91b5d3a69eb097f9ed351623b95be. MIT, LICENSE.lua.tmbundle.txt; VS Code records the + bundle under the TextMate bundle license, which LICENSE.textmate-bundles.txt reproduces too. +- docker.tmLanguage.json (extension docker): moby/moby + bea959c7b793b32a893820b97c4eadc7c87fabb0, contrib/syntax/textmate/Docker.tmbundle. Apache + License 2.0, LICENSE.moby.txt, with the NOTICE of that project in NOTICE.moby.txt. - toml.tmLanguage.json: not from VS Code, but from tamasfe/taplo at commit 08f343be02ce1b20296470396a42f0fa47820449, editors/vscode/toml.tmLanguage.json. MIT, LICENSE.taplo.txt. +- cmake.tmLanguage.json: not from VS Code, but from microsoft/vscode-cmake-tools at commit + e0969b894e56d8ea5e6641d48a82e5ba3babcc38, syntaxes/CMake.tmLanguage.json. MIT, + LICENSE.vscode-cmake-tools.txt. +- kotlin.tmLanguage.json: not from VS Code, but from fwcd/vscode-kotlin at commit + 4a7c1538754828c1d22a8bee8ff3400045b4352a, syntaxes/kotlin.tmLanguage.json. MIT, + LICENSE.vscode-kotlin.txt. +- zig.tmLanguage.json: not from VS Code, but from ziglang/vscode-zig at commit + 38309f0b1dc0c1bdc4b23e78594302bf28ef43d1, syntaxes/zig.tmLanguage.json. MIT, + LICENSE.vscode-zig.txt. +- proto3.tmLanguage.json: not from VS Code, but from zxh0/vscode-proto3 at commit + 5563d58bc5935213a41ab168f321cf9d99c34fcb, syntaxes/proto3.tmLanguage.json. MIT, + LICENSE.vscode-proto3.txt. +- graphql.tmLanguage.json: not from VS Code, but from graphql/graphiql at commit + 7a6311da0c617e7d2759b59036442c6ef26ced3d, packages/vscode-graphql-syntax/grammars/graphql.json, + renamed. MIT, LICENSE.graphiql.txt. The tokenizer that runs them (internal/editor/textmate) is a Go port of vscode-textmate's algorithm, MIT: internal/editor/textmate/LICENSE.vscode-textmate.md. diff --git a/desktop/internal/editor/textmate/testdata/grammars/cmake.tmLanguage.json b/desktop/internal/editor/syntax/grammars/cmake.tmLanguage.json similarity index 100% rename from desktop/internal/editor/textmate/testdata/grammars/cmake.tmLanguage.json rename to desktop/internal/editor/syntax/grammars/cmake.tmLanguage.json diff --git a/desktop/internal/editor/syntax/grammars/csharp.tmLanguage.json b/desktop/internal/editor/syntax/grammars/csharp.tmLanguage.json new file mode 100644 index 0000000000..3a0ff04c37 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/csharp.tmLanguage.json @@ -0,0 +1,6117 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/dotnet/csharp-tmLanguage/blob/master/grammars/csharp.tmLanguage", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/dotnet/csharp-tmLanguage/commit/c2719309e91d2e26be21fce0ecaaca86c7b48ce4", + "name": "C#", + "scopeName": "source.cs", + "patterns": [ + { + "include": "#preprocessor" + }, + { + "include": "#comment" + }, + { + "include": "#directives" + }, + { + "include": "#declarations" + }, + { + "include": "#script-top-level" + } + ], + "repository": { + "directives": { + "patterns": [ + { + "include": "#extern-alias-directive" + }, + { + "include": "#using-directive" + }, + { + "include": "#attribute-section" + }, + { + "include": "#punctuation-semicolon" + } + ] + }, + "declarations": { + "patterns": [ + { + "include": "#namespace-declaration" + }, + { + "include": "#type-declarations" + }, + { + "include": "#punctuation-semicolon" + } + ] + }, + "script-top-level": { + "patterns": [ + { + "include": "#statement" + }, + { + "include": "#method-declaration" + }, + { + "include": "#punctuation-semicolon" + } + ] + }, + "type-declarations": { + "patterns": [ + { + "include": "#preprocessor" + }, + { + "include": "#comment" + }, + { + "include": "#storage-modifier" + }, + { + "include": "#class-declaration" + }, + { + "include": "#delegate-declaration" + }, + { + "include": "#enum-declaration" + }, + { + "include": "#interface-declaration" + }, + { + "include": "#struct-declaration" + }, + { + "include": "#union-declaration" + }, + { + "include": "#record-declaration" + }, + { + "include": "#attribute-section" + }, + { + "include": "#punctuation-semicolon" + } + ] + }, + "class-or-struct-members": { + "patterns": [ + { + "include": "#preprocessor" + }, + { + "include": "#comment" + }, + { + "include": "#storage-modifier" + }, + { + "include": "#type-declarations" + }, + { + "include": "#constructor-declaration" + }, + { + "include": "#property-declaration" + }, + { + "include": "#fixed-size-buffer-declaration" + }, + { + "include": "#field-declaration" + }, + { + "include": "#event-declaration" + }, + { + "include": "#indexer-declaration" + }, + { + "include": "#variable-initializer" + }, + { + "include": "#destructor-declaration" + }, + { + "include": "#operator-declaration" + }, + { + "include": "#conversion-operator-declaration" + }, + { + "include": "#method-declaration" + }, + { + "include": "#attribute-section" + }, + { + "include": "#punctuation-semicolon" + } + ] + }, + "interface-members": { + "patterns": [ + { + "include": "#preprocessor" + }, + { + "include": "#comment" + }, + { + "include": "#storage-modifier" + }, + { + "include": "#property-declaration" + }, + { + "include": "#event-declaration" + }, + { + "include": "#indexer-declaration" + }, + { + "include": "#method-declaration" + }, + { + "include": "#operator-declaration" + }, + { + "include": "#attribute-section" + }, + { + "include": "#punctuation-semicolon" + } + ] + }, + "statement": { + "patterns": [ + { + "include": "#preprocessor" + }, + { + "include": "#comment" + }, + { + "include": "#while-statement" + }, + { + "include": "#do-statement" + }, + { + "include": "#for-statement" + }, + { + "include": "#foreach-statement" + }, + { + "include": "#if-statement" + }, + { + "include": "#else-part" + }, + { + "include": "#goto-statement" + }, + { + "include": "#return-statement" + }, + { + "include": "#break-or-continue-statement" + }, + { + "include": "#throw-statement" + }, + { + "include": "#yield-statement" + }, + { + "include": "#await-statement" + }, + { + "include": "#try-statement" + }, + { + "include": "#expression-operator-expression" + }, + { + "include": "#context-control-statement" + }, + { + "include": "#context-control-paren-statement" + }, + { + "include": "#labeled-statement" + }, + { + "include": "#object-creation-expression" + }, + { + "include": "#array-creation-expression" + }, + { + "include": "#anonymous-object-creation-expression" + }, + { + "include": "#local-declaration" + }, + { + "include": "#block" + }, + { + "include": "#expression" + }, + { + "include": "#punctuation-semicolon" + } + ] + }, + "expression": { + "patterns": [ + { + "include": "#preprocessor" + }, + { + "include": "#comment" + }, + { + "include": "#expression-operator-expression" + }, + { + "include": "#type-operator-expression" + }, + { + "include": "#default-literal-expression" + }, + { + "include": "#throw-expression" + }, + { + "include": "#raw-interpolated-string" + }, + { + "include": "#interpolated-string" + }, + { + "include": "#verbatim-interpolated-string" + }, + { + "include": "#type-builtin" + }, + { + "include": "#language-variable" + }, + { + "include": "#switch-statement-or-expression" + }, + { + "include": "#with-expression" + }, + { + "include": "#conditional-operator" + }, + { + "include": "#assignment-expression" + }, + { + "include": "#expression-operators" + }, + { + "include": "#await-expression" + }, + { + "include": "#query-expression" + }, + { + "include": "#as-expression" + }, + { + "include": "#is-expression" + }, + { + "include": "#boolean-literal" + }, + { + "include": "#null-literal" + }, + { + "include": "#anonymous-method-expression" + }, + { + "include": "#object-creation-expression" + }, + { + "include": "#array-creation-expression" + }, + { + "include": "#anonymous-object-creation-expression" + }, + { + "include": "#invocation-expression" + }, + { + "include": "#member-access-expression" + }, + { + "include": "#element-access-expression" + }, + { + "include": "#cast-expression" + }, + { + "include": "#literal" + }, + { + "include": "#parenthesized-expression" + }, + { + "include": "#tuple-deconstruction-assignment" + }, + { + "include": "#initializer-expression" + }, + { + "include": "#identifier" + } + ] + }, + "extern-alias-directive": { + "begin": "\\b(extern)\\s+(alias)\\b", + "beginCaptures": { + "1": { + "name": "keyword.other.directive.extern.cs" + }, + "2": { + "name": "keyword.other.directive.alias.cs" + } + }, + "end": "(?=;)", + "patterns": [ + { + "match": "\\@?[_[:alpha:]][_[:alnum:]]*", + "name": "variable.other.alias.cs" + } + ] + }, + "using-directive": { + "patterns": [ + { + "begin": "\\b(?:(global)\\s+)?(using)\\s+(static)\\b\\s*(?:(unsafe)\\b\\s*)?", + "beginCaptures": { + "1": { + "name": "keyword.other.directive.global.cs" + }, + "2": { + "name": "keyword.other.directive.using.cs" + }, + "3": { + "name": "keyword.other.directive.static.cs" + }, + "4": { + "name": "storage.modifier.unsafe.cs" + } + }, + "end": "(?=;)", + "patterns": [ + { + "include": "#type" + } + ] + }, + { + "begin": "\\b(?:(global)\\s+)?(using)\\b\\s*(?:(unsafe)\\b\\s*)?(@?[_[:alpha:]][_[:alnum:]]*)\\s*(=)", + "beginCaptures": { + "1": { + "name": "keyword.other.directive.global.cs" + }, + "2": { + "name": "keyword.other.directive.using.cs" + }, + "3": { + "name": "storage.modifier.unsafe.cs" + }, + "4": { + "name": "entity.name.type.alias.cs" + }, + "5": { + "name": "keyword.operator.assignment.cs" + } + }, + "end": "(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#type" + } + ] + }, + { + "begin": "\\b(?:(global)\\s+)?(using)\\b\\s*+(?!\\(|var\\b)", + "beginCaptures": { + "1": { + "name": "keyword.other.directive.global.cs" + }, + "2": { + "name": "keyword.other.directive.using.cs" + } + }, + "end": "(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "name": "entity.name.type.namespace.cs", + "match": "\\@?[_[:alpha:]][_[:alnum:]]*" + }, + { + "include": "#punctuation-accessor" + }, + { + "include": "#operator-assignment" + } + ] + } + ] + }, + "attribute-section": { + "begin": "(\\[)(assembly|module|field|event|method|param|property|return|typevar|type)?(\\:)?", + "beginCaptures": { + "1": { + "name": "punctuation.squarebracket.open.cs" + }, + "2": { + "name": "keyword.other.attribute-specifier.cs" + }, + "3": { + "name": "punctuation.separator.colon.cs" + } + }, + "end": "(\\])", + "endCaptures": { + "1": { + "name": "punctuation.squarebracket.close.cs" + } + }, + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#attribute" + }, + { + "include": "#punctuation-comma" + } + ] + }, + "attribute": { + "patterns": [ + { + "include": "#type-name" + }, + { + "include": "#type-arguments" + }, + { + "include": "#attribute-arguments" + } + ] + }, + "attribute-arguments": { + "begin": "(\\()", + "beginCaptures": { + "1": { + "name": "punctuation.parenthesis.open.cs" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.parenthesis.close.cs" + } + }, + "patterns": [ + { + "include": "#attribute-named-argument" + }, + { + "include": "#expression" + }, + { + "include": "#punctuation-comma" + } + ] + }, + "attribute-named-argument": { + "begin": "(@?[_[:alpha:]][_[:alnum:]]*)\\s*(?==)", + "beginCaptures": { + "1": { + "name": "entity.name.variable.property.cs" + } + }, + "end": "(?=(,|\\)))", + "patterns": [ + { + "include": "#operator-assignment" + }, + { + "include": "#expression" + } + ] + }, + "namespace-declaration": { + "begin": "\\b(namespace)\\s+", + "beginCaptures": { + "1": { + "name": "storage.type.namespace.cs" + } + }, + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "name": "entity.name.type.namespace.cs", + "match": "@?[_[:alpha:]][_[:alnum:]]*" + }, + { + "include": "#punctuation-accessor" + }, + { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.curlybrace.open.cs" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.curlybrace.close.cs" + } + }, + "patterns": [ + { + "include": "#declarations" + }, + { + "include": "#using-directive" + }, + { + "include": "#punctuation-semicolon" + } + ] + } + ] + }, + "storage-modifier": { + "name": "storage.modifier.$1.cs", + "match": "(?\n (?:\n (?:ref\\s+(?:readonly\\s+)?)? # ref return\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)\\s+\n(\\g)\\s*\n(<([^<>]+)>)?\\s*\n(?=\\()", + "beginCaptures": { + "1": { + "name": "storage.type.delegate.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "7": { + "name": "entity.name.type.delegate.cs" + }, + "8": { + "patterns": [ + { + "include": "#type-parameter-list" + } + ] + } + }, + "end": "(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#parenthesized-parameter-list" + }, + { + "include": "#generic-constraints" + } + ] + }, + "enum-declaration": { + "begin": "(?=\\benum\\b)", + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "begin": "(?=enum)", + "end": "(?=\\{)|(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "match": "(enum)\\s+(@?[_[:alpha:]][_[:alnum:]]*)", + "captures": { + "1": { + "name": "storage.type.enum.cs" + }, + "2": { + "name": "entity.name.type.enum.cs" + } + } + }, + { + "begin": ":", + "beginCaptures": { + "0": { + "name": "punctuation.separator.colon.cs" + } + }, + "end": "(?=\\{)", + "patterns": [ + { + "include": "#type" + } + ] + } + ] + }, + { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.curlybrace.open.cs" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.curlybrace.close.cs" + } + }, + "patterns": [ + { + "include": "#preprocessor" + }, + { + "include": "#comment" + }, + { + "include": "#attribute-section" + }, + { + "include": "#punctuation-comma" + }, + { + "begin": "@?[_[:alpha:]][_[:alnum:]]*", + "beginCaptures": { + "0": { + "name": "entity.name.variable.enum-member.cs" + } + }, + "end": "(?=(,|\\}))", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#variable-initializer" + } + ] + } + ] + }, + { + "include": "#preprocessor" + }, + { + "include": "#comment" + } + ] + }, + "interface-declaration": { + "begin": "(?=\\binterface\\b)", + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "begin": "(?x)\n(interface)\\b\\s+\n(@?[_[:alpha:]][_[:alnum:]]*)", + "beginCaptures": { + "1": { + "name": "storage.type.interface.cs" + }, + "2": { + "name": "entity.name.type.interface.cs" + } + }, + "end": "(?=\\{)|(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#type-parameter-list" + }, + { + "include": "#base-types" + }, + { + "include": "#generic-constraints" + } + ] + }, + { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.curlybrace.open.cs" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.curlybrace.close.cs" + } + }, + "patterns": [ + { + "include": "#interface-members" + } + ] + }, + { + "include": "#preprocessor" + }, + { + "include": "#comment" + } + ] + }, + "record-declaration": { + "begin": "(?=\\brecord\\b)", + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "begin": "(?x)\n(record)\\b\\s+\n(@?[_[:alpha:]][_[:alnum:]]*)", + "beginCaptures": { + "1": { + "name": "storage.type.record.cs" + }, + "2": { + "name": "entity.name.type.class.cs" + } + }, + "end": "(?=\\{)|(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#type-parameter-list" + }, + { + "include": "#parenthesized-parameter-list" + }, + { + "include": "#base-types" + }, + { + "include": "#generic-constraints" + } + ] + }, + { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.curlybrace.open.cs" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.curlybrace.close.cs" + } + }, + "patterns": [ + { + "include": "#class-or-struct-members" + } + ] + }, + { + "include": "#preprocessor" + }, + { + "include": "#comment" + } + ] + }, + "struct-declaration": { + "begin": "(?=(\\brecord\\b\\s+)?\\bstruct\\b)", + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "begin": "(?x)\n(\\b(record)\\b\\s+)?\n(struct)\\b\\s+\n(@?[_[:alpha:]][_[:alnum:]]*)", + "beginCaptures": { + "2": { + "name": "storage.type.record.cs" + }, + "3": { + "name": "storage.type.struct.cs" + }, + "4": { + "name": "entity.name.type.struct.cs" + } + }, + "end": "(?=\\{)|(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#type-parameter-list" + }, + { + "include": "#parenthesized-parameter-list" + }, + { + "include": "#base-types" + }, + { + "include": "#generic-constraints" + } + ] + }, + { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.curlybrace.open.cs" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.curlybrace.close.cs" + } + }, + "patterns": [ + { + "include": "#class-or-struct-members" + } + ] + }, + { + "include": "#preprocessor" + }, + { + "include": "#comment" + } + ] + }, + "union-declaration": { + "begin": "(?=\\bunion\\b)", + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "begin": "(?x)\n(union)\\b\\s+\n(@?[_[:alpha:]][_[:alnum:]]*)", + "beginCaptures": { + "1": { + "name": "storage.type.union.cs" + }, + "2": { + "name": "entity.name.type.union.cs" + } + }, + "end": "(?=\\{)|(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#type-parameter-list" + }, + { + "include": "#parenthesized-type-list" + }, + { + "include": "#base-types" + }, + { + "include": "#generic-constraints" + } + ] + }, + { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.curlybrace.open.cs" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.curlybrace.close.cs" + } + }, + "patterns": [ + { + "include": "#class-or-struct-members" + } + ] + }, + { + "include": "#preprocessor" + }, + { + "include": "#comment" + } + ] + }, + "type-parameter-list": { + "begin": "\\<", + "beginCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.begin.cs" + } + }, + "end": "\\>", + "endCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.end.cs" + } + }, + "patterns": [ + { + "match": "\\b(in|out)\\b", + "name": "storage.modifier.$1.cs" + }, + { + "match": "(@?[_[:alpha:]][_[:alnum:]]*)\\b", + "name": "entity.name.type.type-parameter.cs" + }, + { + "include": "#comment" + }, + { + "include": "#punctuation-comma" + }, + { + "include": "#attribute-section" + } + ] + }, + "base-types": { + "begin": ":", + "beginCaptures": { + "0": { + "name": "punctuation.separator.colon.cs" + } + }, + "end": "(?=\\{|where|;)", + "patterns": [ + { + "include": "#base-class-constructor-call" + }, + { + "include": "#type" + }, + { + "include": "#punctuation-comma" + }, + { + "include": "#preprocessor" + } + ] + }, + "base-class-constructor-call": { + "begin": "(?x)\n(?:\n (@?[_[:alpha:]][_[:alnum:]]*)\\s*(\\.) # qualified name part\n)*\n(@?[_[:alpha:]][_[:alnum:]]*)\\s* # type name\n(\n <\n (?\n [^<>()]|\n \\((?:[^<>()]|<[^<>()]*>|\\([^<>()]*\\))*\\)|\n <\\g*>\n )*\n >\\s*\n)? # optional type arguments\n(?=\\() # followed by argument list", + "beginCaptures": { + "1": { + "name": "entity.name.type.cs" + }, + "2": { + "name": "punctuation.accessor.cs" + }, + "3": { + "name": "entity.name.type.cs" + }, + "4": { + "patterns": [ + { + "include": "#type-arguments" + } + ] + } + }, + "end": "(?<=\\))", + "patterns": [ + { + "include": "#argument-list" + } + ] + }, + "generic-constraints": { + "begin": "(where)\\s+(@?[_[:alpha:]][_[:alnum:]]*)\\s*(:)", + "beginCaptures": { + "1": { + "name": "storage.modifier.where.cs" + }, + "2": { + "name": "entity.name.type.type-parameter.cs" + }, + "3": { + "name": "punctuation.separator.colon.cs" + } + }, + "end": "(?=\\{|where|;|=>)", + "patterns": [ + { + "name": "storage.type.class.cs", + "match": "\\bclass\\b" + }, + { + "name": "storage.type.struct.cs", + "match": "\\bstruct\\b" + }, + { + "name": "keyword.other.constraint.default.cs", + "match": "\\bdefault\\b" + }, + { + "name": "keyword.other.constraint.notnull.cs", + "match": "\\bnotnull\\b" + }, + { + "name": "keyword.other.constraint.unmanaged.cs", + "match": "\\bunmanaged\\b" + }, + { + "match": "(new)\\s*(\\()\\s*(\\))", + "captures": { + "1": { + "name": "keyword.operator.expression.new.cs" + }, + "2": { + "name": "punctuation.parenthesis.open.cs" + }, + "3": { + "name": "punctuation.parenthesis.close.cs" + } + } + }, + { + "include": "#type" + }, + { + "include": "#punctuation-comma" + }, + { + "include": "#generic-constraints" + } + ] + }, + "fixed-size-buffer-declaration": { + "begin": "(?x)\n\\b(fixed)\\b\\s+\n(?\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* # Are there any more names being dotted into?\n )\n)\\s+\n(\\g)\\s* # buffer name\n(?=\\[)", + "beginCaptures": { + "1": { + "name": "storage.modifier.fixed.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "6": { + "name": "entity.name.variable.field.cs" + } + }, + "end": "(?=;)", + "patterns": [ + { + "include": "#bracketed-argument-list" + }, + { + "include": "#comment" + } + ] + }, + "field-declaration": { + "begin": "(?x)\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)\\s+\n(\\g)\\s* # first field name\n(?!=>|==)(?=,|;|=|$)", + "beginCaptures": { + "1": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "6": { + "name": "entity.name.variable.field.cs" + } + }, + "end": "(?=;)", + "patterns": [ + { + "name": "entity.name.variable.field.cs", + "match": "@?[_[:alpha:]][_[:alnum:]]*" + }, + { + "include": "#punctuation-comma" + }, + { + "include": "#comment" + }, + { + "include": "#variable-initializer" + }, + { + "include": "#class-or-struct-members" + } + ] + }, + "property-declaration": { + "begin": "(?x)\n\n# The negative lookahead below ensures that we don't match nested types\n# or other declarations as properties.\n(?![[:word:][:space:]]*\\b(?:class|interface|struct|union|enum|event)\\b)\n\n(?\n (?\n (?:\n (?:ref\\s+(?:readonly\\s+)?)? # ref return\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n )\\s+\n)\n(?\\g\\s*\\.\\s*)?\n(?\\g)\\s*\n(?=\\{|=>|//|/\\*|$)", + "beginCaptures": { + "1": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "7": { + "patterns": [ + { + "include": "#type" + }, + { + "include": "#punctuation-accessor" + } + ] + }, + "8": { + "name": "entity.name.variable.property.cs" + } + }, + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#property-accessors" + }, + { + "include": "#accessor-getter-expression" + }, + { + "include": "#variable-initializer" + }, + { + "include": "#class-or-struct-members" + } + ] + }, + "indexer-declaration": { + "begin": "(?x)\n(?\n (?\n (?:\n (?:ref\\s+(?:readonly\\s+)?)? # ref return\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n )\\s+\n)\n(?\\g\\s*\\.\\s*)?\n(?this)\\s*\n(?=\\[)", + "beginCaptures": { + "1": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "7": { + "patterns": [ + { + "include": "#type" + }, + { + "include": "#punctuation-accessor" + } + ] + }, + "8": { + "name": "variable.language.this.cs" + } + }, + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#bracketed-parameter-list" + }, + { + "include": "#property-accessors" + }, + { + "include": "#accessor-getter-expression" + }, + { + "include": "#variable-initializer" + } + ] + }, + "event-declaration": { + "begin": "(?x)\n\\b(event)\\b\\s*\n(?\n (?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n )\\s+\n)\n(?\\g\\s*\\.\\s*)?\n(\\g)\\s* # first event name\n(?=\\{|;|,|=|//|/\\*|$)", + "beginCaptures": { + "1": { + "name": "storage.type.event.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "8": { + "patterns": [ + { + "include": "#type" + }, + { + "include": "#punctuation-accessor" + } + ] + }, + "9": { + "name": "entity.name.variable.event.cs" + } + }, + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#event-accessors" + }, + { + "name": "entity.name.variable.event.cs", + "match": "@?[_[:alpha:]][_[:alnum:]]*" + }, + { + "include": "#punctuation-comma" + }, + { + "begin": "=", + "beginCaptures": { + "0": { + "name": "keyword.operator.assignment.cs" + } + }, + "end": "(?<=,)|(?=;)", + "patterns": [ + { + "include": "#expression" + }, + { + "include": "#punctuation-comma" + } + ] + } + ] + }, + "property-accessors": { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.curlybrace.open.cs" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.curlybrace.close.cs" + } + }, + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#attribute-section" + }, + { + "name": "storage.modifier.$1.cs", + "match": "\\b(private|protected|internal)\\b" + }, + { + "begin": "(?:\\b(readonly)\\s+)?\\b(get)\\b\\s*(?=\\{|;|=>|//|/\\*|$)", + "beginCaptures": { + "1": { + "name": "storage.modifier.readonly.cs" + }, + "2": { + "name": "storage.type.accessor.get.cs" + } + }, + "end": "(?<=\\}|;)|(?=\\})", + "patterns": [ + { + "include": "#accessor-getter" + } + ] + }, + { + "begin": "\\b(set|init)\\b\\s*(?=\\{|;|=>|//|/\\*|$)", + "beginCaptures": { + "1": { + "name": "storage.type.accessor.$1.cs" + } + }, + "end": "(?<=\\}|;)|(?=\\})", + "patterns": [ + { + "include": "#accessor-setter" + } + ] + } + ] + }, + "event-accessors": { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.curlybrace.open.cs" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.curlybrace.close.cs" + } + }, + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#attribute-section" + }, + { + "begin": "\\b(add|remove)\\b\\s*(?=\\{|;|=>|//|/\\*|$)", + "beginCaptures": { + "1": { + "name": "storage.type.accessor.$1.cs" + } + }, + "end": "(?<=\\}|;)|(?=\\})", + "patterns": [ + { + "include": "#accessor-setter" + } + ] + } + ] + }, + "accessor-getter": { + "patterns": [ + { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.curlybrace.open.cs" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.curlybrace.close.cs" + } + }, + "contentName": "meta.accessor.getter.cs", + "patterns": [ + { + "include": "#statement" + } + ] + }, + { + "include": "#accessor-getter-expression" + }, + { + "include": "#punctuation-semicolon" + } + ] + }, + "accessor-getter-expression": { + "begin": "=>", + "beginCaptures": { + "0": { + "name": "keyword.operator.arrow.cs" + } + }, + "end": "(?=;|\\})", + "contentName": "meta.accessor.getter.cs", + "patterns": [ + { + "include": "#ref-modifier" + }, + { + "include": "#expression" + } + ] + }, + "accessor-setter": { + "patterns": [ + { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.curlybrace.open.cs" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.curlybrace.close.cs" + } + }, + "contentName": "meta.accessor.setter.cs", + "patterns": [ + { + "include": "#statement" + } + ] + }, + { + "begin": "=>", + "beginCaptures": { + "0": { + "name": "keyword.operator.arrow.cs" + } + }, + "end": "(?=;|\\})", + "contentName": "meta.accessor.setter.cs", + "patterns": [ + { + "include": "#ref-modifier" + }, + { + "include": "#expression" + } + ] + }, + { + "include": "#punctuation-semicolon" + } + ] + }, + "method-declaration": { + "begin": "(?x)\n(?\n (?\n (?:\n (?:ref\\s+(?:readonly\\s+)?)? # ref return\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n )\\s+\n)\n(?\\g\\s*\\.\\s*)?\n(\\g)\\s*\n(<([^<>]+)>)?\\s*\n(?=\\()", + "beginCaptures": { + "1": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "7": { + "patterns": [ + { + "include": "#type" + }, + { + "include": "#punctuation-accessor" + } + ] + }, + "8": { + "name": "entity.name.function.cs" + }, + "9": { + "patterns": [ + { + "include": "#type-parameter-list" + } + ] + } + }, + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#parenthesized-parameter-list" + }, + { + "include": "#generic-constraints" + }, + { + "include": "#expression-body" + }, + { + "include": "#block" + } + ] + }, + "constructor-declaration": { + "begin": "(@?[_[:alpha:]][_[:alnum:]]*)\\s*(?=\\(|$)", + "beginCaptures": { + "1": { + "name": "entity.name.function.cs" + } + }, + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "begin": "(:)", + "beginCaptures": { + "1": { + "name": "punctuation.separator.colon.cs" + } + }, + "end": "(?=\\{|=>)", + "patterns": [ + { + "include": "#constructor-initializer" + } + ] + }, + { + "include": "#parenthesized-parameter-list" + }, + { + "include": "#preprocessor" + }, + { + "include": "#comment" + }, + { + "include": "#expression-body" + }, + { + "include": "#block" + } + ] + }, + "constructor-initializer": { + "begin": "\\b(base|this)\\b\\s*(?=\\()", + "beginCaptures": { + "1": { + "name": "variable.language.$1.cs" + } + }, + "end": "(?<=\\))", + "patterns": [ + { + "include": "#argument-list" + } + ] + }, + "destructor-declaration": { + "begin": "(~)(@?[_[:alpha:]][_[:alnum:]]*)\\s*(?=\\()", + "beginCaptures": { + "1": { + "name": "punctuation.tilde.cs" + }, + "2": { + "name": "entity.name.function.cs" + } + }, + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#parenthesized-parameter-list" + }, + { + "include": "#expression-body" + }, + { + "include": "#block" + } + ] + }, + "operator-declaration": { + "begin": "(?x)\n(?\n (?:\n (?:ref\\s+(?:readonly\\s+)?)? # ref return\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)\\s*\n\\b(?operator)\\b\\s*\n(?[+\\-*/%&|\\^!=~<>]+|true|false)\\s*\n(?=\\()", + "beginCaptures": { + "1": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "6": { + "name": "storage.type.operator.cs" + }, + "7": { + "name": "entity.name.function.cs" + } + }, + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#parenthesized-parameter-list" + }, + { + "include": "#expression-body" + }, + { + "include": "#block" + } + ] + }, + "conversion-operator-declaration": { + "begin": "(?x)\n(?(?:\\b(?:explicit|implicit)))\\s*\n(?(?:\\b(?:operator)))\\s*\n(?\n (?:\n (?:ref\\s+(?:readonly\\s+)?)? # ref return\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)\\s*\n(?=\\()", + "beginCaptures": { + "1": { + "patterns": [ + { + "match": "\\b(explicit)\\b", + "captures": { + "1": { + "name": "storage.modifier.explicit.cs" + } + } + }, + { + "match": "\\b(implicit)\\b", + "captures": { + "1": { + "name": "storage.modifier.implicit.cs" + } + } + } + ] + }, + "2": { + "name": "storage.type.operator.cs" + }, + "3": { + "patterns": [ + { + "include": "#type" + } + ] + } + }, + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#parenthesized-parameter-list" + }, + { + "include": "#expression-body" + }, + { + "include": "#block" + } + ] + }, + "block": { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.curlybrace.open.cs" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.curlybrace.close.cs" + } + }, + "patterns": [ + { + "include": "#statement" + } + ] + }, + "variable-initializer": { + "begin": "(?)", + "beginCaptures": { + "1": { + "name": "keyword.operator.assignment.cs" + } + }, + "end": "(?=[,\\)\\];}])", + "patterns": [ + { + "include": "#ref-modifier" + }, + { + "include": "#expression" + } + ] + }, + "expression-body": { + "begin": "=>", + "beginCaptures": { + "0": { + "name": "keyword.operator.arrow.cs" + } + }, + "end": "(?=[,\\);}])", + "patterns": [ + { + "include": "#ref-modifier" + }, + { + "include": "#expression" + } + ] + }, + "goto-statement": { + "begin": "(?", + "beginCaptures": { + "0": { + "name": "keyword.operator.arrow.cs" + } + }, + "end": "(?=,|})", + "patterns": [ + { + "include": "#expression" + } + ] + }, + { + "begin": "\\b(when)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.conditional.when.cs" + } + }, + "end": "(?==>|,|})", + "patterns": [ + { + "include": "#case-guard" + } + ] + }, + { + "begin": "(?!\\s)", + "end": "(?=\\bwhen\\b|=>|,|})", + "patterns": [ + { + "include": "#pattern" + } + ] + } + ] + }, + "case-guard": { + "patterns": [ + { + "include": "#parenthesized-expression" + }, + { + "include": "#expression" + } + ] + }, + "is-expression": { + "begin": "(?=?", + "beginCaptures": { + "0": { + "name": "keyword.operator.relational.cs" + } + }, + "end": "(?=[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)", + "patterns": [ + { + "include": "#expression" + } + ] + }, + "var-pattern": { + "begin": "\\b(var)\\b", + "beginCaptures": { + "1": { + "name": "storage.type.var.cs" + } + }, + "end": "(?=[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)", + "patterns": [ + { + "include": "#designation-pattern" + } + ] + }, + "designation-pattern": { + "patterns": [ + { + "include": "#intrusive" + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.parenthesis.open.cs" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.parenthesis.close.cs" + } + }, + "patterns": [ + { + "include": "#punctuation-comma" + }, + { + "include": "#designation-pattern" + } + ] + }, + { + "include": "#simple-designation-pattern" + } + ] + }, + "simple-designation-pattern": { + "patterns": [ + { + "include": "#discard-pattern" + }, + { + "match": "@?[_[:alpha:]][_[:alnum:]]*", + "name": "entity.name.variable.local.cs" + } + ] + }, + "type-pattern": { + "begin": "(?=@?[_[:alpha:]][_[:alnum:]]*)", + "end": "(?=[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)", + "patterns": [ + { + "begin": "\\G", + "end": "(?!\\G[@_[:alpha:]])(?=[\\({@_[:alpha:])}\\],;:=&|^]|(?:\\s|^)\\?|!=|\\b(and|or|when)\\b)", + "patterns": [ + { + "include": "#intrusive" + }, + { + "include": "#type-subpattern" + } + ] + }, + { + "begin": "(?=[\\({@_[:alpha:]])", + "end": "(?=[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)", + "patterns": [ + { + "include": "#intrusive" + }, + { + "include": "#positional-pattern" + }, + { + "include": "#property-pattern" + }, + { + "include": "#simple-designation-pattern" + } + ] + } + ] + }, + "type-subpattern": { + "patterns": [ + { + "include": "#type-builtin" + }, + { + "begin": "(@?[_[:alpha:]][_[:alnum:]]*)\\s*(::)", + "beginCaptures": { + "1": { + "name": "entity.name.type.alias.cs" + }, + "2": { + "name": "punctuation.separator.coloncolon.cs" + } + }, + "end": "(?<=[_[:alnum:]])|(?=[.<\\[\\({)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)", + "patterns": [ + { + "include": "#intrusive" + }, + { + "match": "\\@?[_[:alpha:]][_[:alnum:]]*", + "name": "entity.name.type.cs" + } + ] + }, + { + "match": "\\@?[_[:alpha:]][_[:alnum:]]*", + "name": "entity.name.type.cs" + }, + { + "begin": "\\.", + "beginCaptures": { + "0": { + "name": "punctuation.accessor.cs" + } + }, + "end": "(?<=[_[:alnum:]])|(?=[<\\[\\({)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)", + "patterns": [ + { + "include": "#intrusive" + }, + { + "match": "\\@?[_[:alpha:]][_[:alnum:]]*", + "name": "entity.name.type.cs" + } + ] + }, + { + "include": "#type-arguments" + }, + { + "include": "#type-array-suffix" + }, + { + "match": "(?\n (?:\n (?:ref\\s+)? # ref local\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n )\n)\\s+\n(\\g)\\s+\n\\b(in)\\b", + "captures": { + "1": { + "name": "storage.modifier.ref.cs" + }, + "2": { + "name": "storage.type.var.cs" + }, + "3": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "8": { + "name": "entity.name.variable.local.cs" + }, + "9": { + "name": "keyword.control.loop.in.cs" + } + } + }, + { + "match": "(?x) # match foreach (var (x, y) in ...)\n(?:\\b(var)\\b\\s*)?\n(?\\((?:[^\\(\\)]|\\g)+\\))\\s+\n\\b(in)\\b", + "captures": { + "1": { + "name": "storage.type.var.cs" + }, + "2": { + "patterns": [ + { + "include": "#tuple-declaration-deconstruction-element-list" + } + ] + }, + "3": { + "name": "keyword.control.loop.in.cs" + } + } + }, + { + "include": "#expression" + } + ] + } + ] + }, + "try-statement": { + "patterns": [ + { + "include": "#try-block" + }, + { + "include": "#catch-clause" + }, + { + "include": "#finally-clause" + } + ] + }, + "try-block": { + "begin": "(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)\\s*\n(?:(\\g)\\b)?", + "captures": { + "1": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "6": { + "name": "entity.name.variable.local.cs" + } + } + } + ] + }, + { + "include": "#when-clause" + }, + { + "include": "#comment" + }, + { + "include": "#block" + } + ] + }, + "when-clause": { + "begin": "(?\n (?:\n (?:ref\\s+(?:readonly\\s+)?)? # ref local\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n )\n)\\s+\n(\\g)\\s*\n(?!=>)\n(?=,|;|=|\\))", + "beginCaptures": { + "1": { + "name": "storage.modifier.ref.cs" + }, + "2": { + "name": "storage.modifier.readonly.cs" + }, + "3": { + "name": "storage.type.var.cs" + }, + "4": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "9": { + "name": "entity.name.variable.local.cs" + } + }, + "end": "(?=[;)}])", + "patterns": [ + { + "name": "entity.name.variable.local.cs", + "match": "@?[_[:alpha:]][_[:alnum:]]*" + }, + { + "include": "#punctuation-comma" + }, + { + "include": "#comment" + }, + { + "include": "#variable-initializer" + } + ] + }, + "local-constant-declaration": { + "begin": "(?x)\n(?\\b(?:const)\\b)\\s*\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)\\s+\n(\\g)\\s*\n(?=,|;|=)", + "beginCaptures": { + "1": { + "name": "storage.modifier.const.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "7": { + "name": "entity.name.variable.local.cs" + } + }, + "end": "(?=;)", + "patterns": [ + { + "name": "entity.name.variable.local.cs", + "match": "@?[_[:alpha:]][_[:alnum:]]*" + }, + { + "include": "#punctuation-comma" + }, + { + "include": "#comment" + }, + { + "include": "#variable-initializer" + } + ] + }, + "local-function-declaration": { + "begin": "(?x)\n\\b((?:(?:async|unsafe|static|extern)\\s+)*)\n(?\n (?:ref\\s+(?:readonly\\s+)?)? # ref return\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n \\s*(?:,\\s*)* # commata for multi-dimensional arrays\n \\]\n (?:\\s*\\?)? # arrays can be nullable reference types\n )*\n)\\s+\n(\\g)\\s*\n(<[^<>]+>)?\\s*\n(?=\\()", + "beginCaptures": { + "1": { + "patterns": [ + { + "include": "#storage-modifier" + } + ] + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "7": { + "name": "entity.name.function.cs" + }, + "8": { + "patterns": [ + { + "include": "#type-parameter-list" + } + ] + } + }, + "end": "(?<=\\})|(?=;)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#parenthesized-parameter-list" + }, + { + "include": "#generic-constraints" + }, + { + "include": "#expression-body" + }, + { + "include": "#block" + } + ] + }, + "local-tuple-var-deconstruction": { + "begin": "(?x) # e.g. var (x, y) = GetPoint();\n(?:\\b(var)\\b\\s*)\n(?\\((?:[^\\(\\)]|\\g)+\\))\\s*\n(?=;|=|\\))", + "beginCaptures": { + "1": { + "name": "storage.type.var.cs" + }, + "2": { + "patterns": [ + { + "include": "#tuple-declaration-deconstruction-element-list" + } + ] + } + }, + "end": "(?=;|\\))", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#variable-initializer" + } + ] + }, + "local-tuple-declaration-deconstruction": { + "match": "(?x) # e.g. (int x, var y) = GetPoint();\n(?\\((?:[^\\(\\)]|\\g)+\\))\\s*\n(?!=>|==)(?==)", + "captures": { + "1": { + "patterns": [ + { + "include": "#tuple-declaration-deconstruction-element-list" + } + ] + } + } + }, + "tuple-deconstruction-assignment": { + "match": "(?x)\n(?\\s*\\((?:[^\\(\\)]|\\g)+\\))\\s*\n(?!=>|==)(?==)", + "captures": { + "1": { + "patterns": [ + { + "include": "#tuple-deconstruction-element-list" + } + ] + } + } + }, + "tuple-declaration-deconstruction-element-list": { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.parenthesis.open.cs" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.parenthesis.close.cs" + } + }, + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#tuple-declaration-deconstruction-element-list" + }, + { + "include": "#declaration-expression-tuple" + }, + { + "include": "#punctuation-comma" + }, + { + "match": "(?x) # e.g. x\n(@?[_[:alpha:]][_[:alnum:]]*)\\b\\s*\n(?=[,)])", + "captures": { + "1": { + "name": "entity.name.variable.tuple-element.cs" + } + } + } + ] + }, + "tuple-deconstruction-element-list": { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.parenthesis.open.cs" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.parenthesis.close.cs" + } + }, + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#tuple-deconstruction-element-list" + }, + { + "include": "#declaration-expression-tuple" + }, + { + "include": "#punctuation-comma" + }, + { + "match": "(?x) # e.g. x\n(@?[_[:alpha:]][_[:alnum:]]*)\\b\\s*\n(?=[,)])", + "captures": { + "1": { + "name": "variable.other.readwrite.cs" + } + } + } + ] + }, + "declaration-expression-local": { + "match": "(?x) # e.g. int x OR var x\n(?:\n \\b(var)\\b|\n (?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n )\n)\\s+\n(\\g)\\b\\s*\n(?=[,)\\]])", + "captures": { + "1": { + "name": "storage.type.var.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "7": { + "name": "entity.name.variable.local.cs" + } + } + }, + "declaration-expression-tuple": { + "match": "(?x) # e.g. int x OR var x\n(?:\n \\b(var)\\b|\n (?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n )\n)\\s+\n(\\g)\\b\\s*\n(?=[,)])", + "captures": { + "1": { + "name": "storage.type.var.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "7": { + "name": "entity.name.variable.tuple-element.cs" + } + } + }, + "expression-operator-expression": { + "begin": "\\b(checked|unchecked|nameof)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.operator.expression.$1.cs" + }, + "2": { + "name": "punctuation.parenthesis.open.cs" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.parenthesis.close.cs" + } + }, + "patterns": [ + { + "include": "#expression" + } + ] + }, + "type-operator-expression": { + "begin": "\\b(default|sizeof|typeof)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.operator.expression.$1.cs" + }, + "2": { + "name": "punctuation.parenthesis.open.cs" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.parenthesis.close.cs" + } + }, + "patterns": [ + { + "include": "#type" + } + ] + }, + "default-literal-expression": { + "match": "\\b(default)\\b", + "captures": { + "1": { + "name": "keyword.operator.expression.default.cs" + } + } + }, + "throw-expression": { + "match": "\\b(throw)\\b", + "captures": { + "1": { + "name": "keyword.control.flow.throw.cs" + } + } + }, + "interpolated-string": { + "name": "string.quoted.double.cs", + "begin": "\\$\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cs" + } + }, + "end": "(\")|((?:[^\\\\\\n\\{])$)", + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.cs" + }, + "2": { + "name": "invalid.illegal.newline.cs" + } + }, + "patterns": [ + { + "include": "#string-character-escape" + }, + { + "include": "#interpolation" + } + ] + }, + "verbatim-interpolated-string": { + "name": "string.quoted.double.cs", + "begin": "(?:\\$@|@\\$)\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cs" + } + }, + "end": "\"(?=[^\"])", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cs" + } + }, + "patterns": [ + { + "include": "#verbatim-string-character-escape" + }, + { + "include": "#interpolation" + } + ] + }, + "interpolation": { + "name": "meta.embedded.interpolation.cs", + "begin": "(?<=[^\\{]|^)((?:\\{\\{)*)(\\{)(?!\\{)", + "beginCaptures": { + "1": { + "name": "string.quoted.double.cs" + }, + "2": { + "name": "punctuation.definition.interpolation.begin.cs" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.definition.interpolation.end.cs" + } + }, + "patterns": [ + { + "include": "#expression" + } + ] + }, + "raw-interpolated-string": { + "patterns": [ + { + "include": "#raw-interpolated-string-five-or-more-quote-one-or-more-interpolation" + }, + { + "include": "#raw-interpolated-string-three-or-more-quote-three-or-more-interpolation" + }, + { + "include": "#raw-interpolated-string-quadruple-quote-double-interpolation" + }, + { + "include": "#raw-interpolated-string-quadruple-quote-single-interpolation" + }, + { + "include": "#raw-interpolated-string-triple-quote-double-interpolation" + }, + { + "include": "#raw-interpolated-string-triple-quote-single-interpolation" + } + ] + }, + "raw-interpolated-string-triple-quote-single-interpolation": { + "name": "string.quoted.double.cs", + "begin": "\\$\"\"\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cs" + } + }, + "end": "\"\"\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cs" + } + }, + "patterns": [ + { + "include": "#raw-interpolation" + } + ] + }, + "raw-interpolated-string-triple-quote-double-interpolation": { + "name": "string.quoted.double.cs", + "begin": "\\$\\$\"\"\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cs" + } + }, + "end": "\"\"\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cs" + } + }, + "patterns": [ + { + "include": "#double-raw-interpolation" + } + ] + }, + "raw-interpolated-string-quadruple-quote-single-interpolation": { + "name": "string.quoted.double.cs", + "begin": "\\$\"\"\"\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cs" + } + }, + "end": "\"\"\"\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cs" + } + }, + "patterns": [ + { + "include": "#raw-interpolation" + } + ] + }, + "raw-interpolated-string-quadruple-quote-double-interpolation": { + "name": "string.quoted.double.cs", + "begin": "\\$\\$\"\"\"\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cs" + } + }, + "end": "\"\"\"\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cs" + } + }, + "patterns": [ + { + "include": "#double-raw-interpolation" + } + ] + }, + "raw-interpolated-string-three-or-more-quote-three-or-more-interpolation": { + "name": "string.quoted.double.cs", + "begin": "\\$\\$\\$+\"\"\"+", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cs" + } + }, + "end": "\"\"\"+", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cs" + } + } + }, + "raw-interpolated-string-five-or-more-quote-one-or-more-interpolation": { + "name": "string.quoted.double.cs", + "begin": "\\$+\"\"\"\"\"+", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cs" + } + }, + "end": "\"\"\"\"\"+", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cs" + } + } + }, + "raw-interpolation": { + "name": "meta.embedded.interpolation.cs", + "begin": "(?<=[^\\{]|^)((?:\\{)*)(\\{)(?!\\{)", + "beginCaptures": { + "1": { + "name": "string.quoted.double.cs" + }, + "2": { + "name": "punctuation.definition.interpolation.begin.cs" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.definition.interpolation.end.cs" + } + }, + "patterns": [ + { + "include": "#expression" + } + ] + }, + "double-raw-interpolation": { + "name": "meta.embedded.interpolation.cs", + "begin": "(?<=[^\\{][^\\{]|^)((?:\\{)*)(\\{\\{)(?!\\{)", + "beginCaptures": { + "1": { + "name": "string.quoted.double.cs" + }, + "2": { + "name": "punctuation.definition.interpolation.begin.cs" + } + }, + "end": "\\}\\}", + "endCaptures": { + "0": { + "name": "punctuation.definition.interpolation.end.cs" + } + }, + "patterns": [ + { + "include": "#expression" + } + ] + }, + "literal": { + "patterns": [ + { + "include": "#boolean-literal" + }, + { + "include": "#null-literal" + }, + { + "include": "#numeric-literal" + }, + { + "include": "#char-literal" + }, + { + "include": "#raw-string-literal" + }, + { + "include": "#string-literal" + }, + { + "include": "#verbatim-string-literal" + }, + { + "include": "#tuple-literal" + } + ] + }, + "boolean-literal": { + "patterns": [ + { + "name": "constant.language.boolean.true.cs", + "match": "(?>>?|\\|)?=(?!=|>)", + "beginCaptures": { + "0": { + "patterns": [ + { + "include": "#assignment-operators" + } + ] + } + }, + "end": "(?=[,\\)\\];}])", + "patterns": [ + { + "include": "#ref-modifier" + }, + { + "include": "#expression" + } + ] + }, + "assignment-operators": { + "patterns": [ + { + "name": "keyword.operator.assignment.compound.cs", + "match": "\\*=|/=|%=|\\+=|-=|\\?\\?=" + }, + { + "name": "keyword.operator.assignment.compound.bitwise.cs", + "match": "\\&=|\\^=|<<=|>>>?=|\\|=" + }, + { + "name": "keyword.operator.assignment.cs", + "match": "\\=" + } + ] + }, + "expression-operators": { + "patterns": [ + { + "name": "keyword.operator.bitwise.shift.cs", + "match": "<<|>>>?" + }, + { + "name": "keyword.operator.comparison.cs", + "match": "==|!=" + }, + { + "name": "keyword.operator.relational.cs", + "match": "<=|>=|<|>" + }, + { + "name": "keyword.operator.logical.cs", + "match": "\\!|&&|\\|\\|" + }, + { + "name": "keyword.operator.bitwise.cs", + "match": "\\&|~|\\^|\\|" + }, + { + "name": "keyword.operator.decrement.cs", + "match": "--" + }, + { + "name": "keyword.operator.increment.cs", + "match": "\\+\\+" + }, + { + "name": "keyword.operator.arithmetic.cs", + "match": "\\+|-(?!>)|\\*|/|%" + }, + { + "name": "keyword.operator.null-coalescing.cs", + "match": "\\?\\?" + }, + { + "name": "keyword.operator.range.cs", + "match": "\\.\\." + } + ] + }, + "with-expression": { + "begin": "(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)\\s*\n(\\))(?=\\s*-*!*@?[_[:alnum:]\\(])", + "captures": { + "1": { + "name": "punctuation.parenthesis.open.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "7": { + "name": "punctuation.parenthesis.close.cs" + } + } + }, + "as-expression": { + "match": "(?x)\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?(?!\\?))? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n \\s*(?:,\\s*)* # commata for multi-dimensional arrays\n \\]\n (?:\\s*\\?(?!\\?))? # arrays can be nullable reference types\n )*\n )\n)?", + "captures": { + "1": { + "name": "keyword.operator.expression.as.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + } + } + }, + "language-variable": { + "patterns": [ + { + "name": "variable.language.$1.cs", + "match": "\\b(base|this)\\b" + }, + { + "name": "variable.other.$1.cs", + "match": "\\b(value)\\b" + } + ] + }, + "invocation-expression": { + "begin": "(?x)\n(?:\n (?:(\\?)\\s*)? # preceding null-conditional operator?\n (\\.)\\s*| # preceding dot?\n (->)\\s* # preceding pointer arrow?\n)?\n(@?[_[:alpha:]][_[:alnum:]]*)\\s* # method name\n(\n <\n (?\n [^<>()]|\n \\((?:[^<>()]|<[^<>()]*>|\\([^<>()]*\\))*\\)|\n <\\g*>\n )*\n >\\s*\n)? # type arguments\n(?=\\() # open paren of argument list", + "beginCaptures": { + "1": { + "name": "keyword.operator.null-conditional.cs" + }, + "2": { + "name": "punctuation.accessor.cs" + }, + "3": { + "name": "punctuation.accessor.pointer.cs" + }, + "4": { + "name": "entity.name.function.cs" + }, + "5": { + "patterns": [ + { + "include": "#type-arguments" + } + ] + } + }, + "end": "(?<=\\))", + "patterns": [ + { + "include": "#argument-list" + } + ] + }, + "element-access-expression": { + "begin": "(?x)\n(?:\n (?:(\\?)\\s*)? # preceding null-conditional operator?\n (\\.)\\s*| # preceding dot?\n (->)\\s* # preceding pointer arrow?\n)?\n(?:(@?[_[:alpha:]][_[:alnum:]]*)\\s*)? # property name\n(?:(\\?)\\s*)? # null-conditional operator?\n(?=\\[) # open bracket of argument list", + "beginCaptures": { + "1": { + "name": "keyword.operator.null-conditional.cs" + }, + "2": { + "name": "punctuation.accessor.cs" + }, + "3": { + "name": "punctuation.accessor.pointer.cs" + }, + "4": { + "name": "variable.other.object.property.cs" + }, + "5": { + "name": "keyword.operator.null-conditional.cs" + } + }, + "end": "(?<=\\])(?!\\s*\\[)", + "patterns": [ + { + "include": "#bracketed-argument-list" + } + ] + }, + "member-access-expression": { + "patterns": [ + { + "match": "(?x)\n(?:\n (?:(\\?)\\s*)? # preceding null-conditional operator?\n (\\.)\\s*| # preceding dot?\n (->)\\s* # preceding pointer arrow?\n)\n(@?[_[:alpha:]][_[:alnum:]]*)\\s* # property name\n(?![_[:alnum:]]|\\(|(\\?)?\\[|<) # next character is not alpha-numeric, nor a (, [, or <. Also, test for ?[", + "captures": { + "1": { + "name": "keyword.operator.null-conditional.cs" + }, + "2": { + "name": "punctuation.accessor.cs" + }, + "3": { + "name": "punctuation.accessor.pointer.cs" + }, + "4": { + "name": "variable.other.object.property.cs" + } + } + }, + { + "match": "(?x)\n(\\.)?\\s*\n(@?[_[:alpha:]][_[:alnum:]]*)\n(?\\s*<([^<>]|\\g)+>\\s*)\n(?=\n (\\s*\\?)?\n \\s*\\.\\s*@?[_[:alpha:]][_[:alnum:]]*\n)", + "captures": { + "1": { + "name": "punctuation.accessor.cs" + }, + "2": { + "name": "variable.other.object.cs" + }, + "3": { + "patterns": [ + { + "include": "#type-arguments" + } + ] + } + } + }, + { + "match": "(?x)\n(@?[_[:alpha:]][_[:alnum:]]*)\n(?=\n \\s*(?:(?:\\?\\s*)?\\.|->)\n \\s*@?[_[:alpha:]][_[:alnum:]]*\n)", + "captures": { + "1": { + "name": "variable.other.object.cs" + } + } + } + ] + }, + "object-creation-expression": { + "patterns": [ + { + "include": "#object-creation-expression-with-parameters" + }, + { + "include": "#object-creation-expression-with-no-parameters" + } + ] + }, + "object-creation-expression-with-parameters": { + "begin": "(?x)\n(new)(?:\\s+\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n))?\\s*\n(?=\\()", + "beginCaptures": { + "1": { + "name": "keyword.operator.expression.new.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + } + }, + "end": "(?<=\\))", + "patterns": [ + { + "include": "#argument-list" + } + ] + }, + "object-creation-expression-with-no-parameters": { + "match": "(?x)\n(new)\\s+\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)\\s*\n(?=\\{|//|/\\*|$)", + "captures": { + "1": { + "name": "keyword.operator.expression.new.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + } + } + }, + "array-creation-expression": { + "begin": "(?x)\n\\b(new|stackalloc)\\b\\s*\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)?\\s*\n(?=\\[)", + "beginCaptures": { + "1": { + "name": "keyword.operator.expression.$1.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + } + }, + "end": "(?<=\\])", + "patterns": [ + { + "include": "#bracketed-argument-list" + } + ] + }, + "anonymous-object-creation-expression": { + "begin": "\\b(new)\\b\\s*(?=\\{|//|/\\*|$)", + "beginCaptures": { + "1": { + "name": "keyword.operator.expression.new.cs" + } + }, + "end": "(?<=\\})", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#initializer-expression" + } + ] + }, + "bracketed-parameter-list": { + "begin": "(?=(\\[))", + "beginCaptures": { + "1": { + "name": "punctuation.squarebracket.open.cs" + } + }, + "end": "(?=(\\]))", + "endCaptures": { + "1": { + "name": "punctuation.squarebracket.close.cs" + } + }, + "patterns": [ + { + "begin": "(?<=\\[)", + "end": "(?=\\])", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#attribute-section" + }, + { + "include": "#parameter" + }, + { + "include": "#punctuation-comma" + }, + { + "include": "#variable-initializer" + } + ] + } + ] + }, + "parenthesized-parameter-list": { + "begin": "(\\()", + "beginCaptures": { + "0": { + "name": "punctuation.parenthesis.open.cs" + } + }, + "end": "(\\))", + "endCaptures": { + "0": { + "name": "punctuation.parenthesis.close.cs" + } + }, + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#attribute-section" + }, + { + "include": "#parameter" + }, + { + "include": "#punctuation-comma" + }, + { + "include": "#variable-initializer" + } + ] + }, + "parenthesized-type-list": { + "begin": "(\\()", + "beginCaptures": { + "0": { + "name": "punctuation.parenthesis.open.cs" + } + }, + "end": "(\\))", + "endCaptures": { + "0": { + "name": "punctuation.parenthesis.close.cs" + } + }, + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#type" + }, + { + "include": "#punctuation-comma" + } + ] + }, + "parameter": { + "match": "(?x)\n(?:(?:\\b(ref|params|out|in|this)\\b)\\s+)?\n(?\n (?:\n (?:ref\\s+)? # ref return\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^()]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)\\s+\n(\\g)", + "captures": { + "1": { + "name": "storage.modifier.$1.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "7": { + "name": "entity.name.variable.parameter.cs" + } + } + }, + "argument-list": { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.parenthesis.open.cs" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.parenthesis.close.cs" + } + }, + "patterns": [ + { + "include": "#named-argument" + }, + { + "include": "#argument" + }, + { + "include": "#punctuation-comma" + } + ] + }, + "bracketed-argument-list": { + "begin": "\\[", + "beginCaptures": { + "0": { + "name": "punctuation.squarebracket.open.cs" + } + }, + "end": "\\]", + "endCaptures": { + "0": { + "name": "punctuation.squarebracket.close.cs" + } + }, + "patterns": [ + { + "include": "#named-argument" + }, + { + "include": "#argument" + }, + { + "include": "#punctuation-comma" + } + ] + }, + "named-argument": { + "begin": "(@?[_[:alpha:]][_[:alnum:]]*)\\s*(:)", + "beginCaptures": { + "1": { + "name": "entity.name.variable.parameter.cs" + }, + "2": { + "name": "punctuation.separator.colon.cs" + } + }, + "end": "(?=(,|\\)|\\]))", + "patterns": [ + { + "include": "#argument" + } + ] + }, + "argument": { + "patterns": [ + { + "name": "storage.modifier.$1.cs", + "match": "\\b(ref|in)\\b" + }, + { + "begin": "\\b(out)\\b", + "beginCaptures": { + "1": { + "name": "storage.modifier.out.cs" + } + }, + "end": "(?=,|\\)|\\])", + "patterns": [ + { + "include": "#declaration-expression-local" + }, + { + "include": "#expression" + } + ] + }, + { + "include": "#expression" + } + ] + }, + "query-expression": { + "begin": "(?x)\n\\b(from)\\b\\s*\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)?\n\\s+(\\g)\\b\\s*\n\\b(in)\\b\\s*", + "beginCaptures": { + "1": { + "name": "keyword.operator.expression.query.from.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "7": { + "name": "entity.name.variable.range-variable.cs" + }, + "8": { + "name": "keyword.operator.expression.query.in.cs" + } + }, + "end": "(?=;|\\))", + "patterns": [ + { + "include": "#query-body" + }, + { + "include": "#expression" + } + ] + }, + "query-body": { + "patterns": [ + { + "include": "#let-clause" + }, + { + "include": "#where-clause" + }, + { + "include": "#join-clause" + }, + { + "include": "#orderby-clause" + }, + { + "include": "#select-clause" + }, + { + "include": "#group-clause" + } + ] + }, + "let-clause": { + "begin": "(?x)\n\\b(let)\\b\\s*\n(@?[_[:alpha:]][_[:alnum:]]*)\\b\\s*\n(=)\\s*", + "beginCaptures": { + "1": { + "name": "keyword.operator.expression.query.let.cs" + }, + "2": { + "name": "entity.name.variable.range-variable.cs" + }, + "3": { + "name": "keyword.operator.assignment.cs" + } + }, + "end": "(?=;|\\))", + "patterns": [ + { + "include": "#query-body" + }, + { + "include": "#expression" + } + ] + }, + "where-clause": { + "begin": "(?x)\n\\b(where)\\b\\s*", + "beginCaptures": { + "1": { + "name": "keyword.operator.expression.query.where.cs" + } + }, + "end": "(?=;|\\))", + "patterns": [ + { + "include": "#query-body" + }, + { + "include": "#expression" + } + ] + }, + "join-clause": { + "begin": "(?x)\n\\b(join)\\b\\s*\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)?\n\\s+(\\g)\\b\\s*\n\\b(in)\\b\\s*", + "beginCaptures": { + "1": { + "name": "keyword.operator.expression.query.join.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "7": { + "name": "entity.name.variable.range-variable.cs" + }, + "8": { + "name": "keyword.operator.expression.query.in.cs" + } + }, + "end": "(?=;|\\))", + "patterns": [ + { + "include": "#join-on" + }, + { + "include": "#join-equals" + }, + { + "include": "#join-into" + }, + { + "include": "#query-body" + }, + { + "include": "#expression" + } + ] + }, + "join-on": { + "match": "\\b(on)\\b\\s*", + "captures": { + "1": { + "name": "keyword.operator.expression.query.on.cs" + } + } + }, + "join-equals": { + "match": "\\b(equals)\\b\\s*", + "captures": { + "1": { + "name": "keyword.operator.expression.query.equals.cs" + } + } + }, + "join-into": { + "match": "(?x)\n\\b(into)\\b\\s*\n(@?[_[:alpha:]][_[:alnum:]]*)\\b\\s*", + "captures": { + "1": { + "name": "keyword.operator.expression.query.into.cs" + }, + "2": { + "name": "entity.name.variable.range-variable.cs" + } + } + }, + "orderby-clause": { + "begin": "\\b(orderby)\\b\\s*", + "beginCaptures": { + "1": { + "name": "keyword.operator.expression.query.orderby.cs" + } + }, + "end": "(?=;|\\))", + "patterns": [ + { + "include": "#ordering-direction" + }, + { + "include": "#query-body" + }, + { + "include": "#expression" + }, + { + "include": "#punctuation-comma" + } + ] + }, + "ordering-direction": { + "match": "\\b(ascending|descending)\\b", + "captures": { + "1": { + "name": "keyword.operator.expression.query.$1.cs" + } + } + }, + "select-clause": { + "begin": "\\b(select)\\b\\s*", + "beginCaptures": { + "1": { + "name": "keyword.operator.expression.query.select.cs" + } + }, + "end": "(?=;|\\))", + "patterns": [ + { + "include": "#query-body" + }, + { + "include": "#expression" + } + ] + }, + "group-clause": { + "begin": "\\b(group)\\b\\s*", + "beginCaptures": { + "1": { + "name": "keyword.operator.expression.query.group.cs" + } + }, + "end": "(?=;|\\))", + "patterns": [ + { + "include": "#group-by" + }, + { + "include": "#group-into" + }, + { + "include": "#query-body" + }, + { + "include": "#expression" + } + ] + }, + "group-by": { + "match": "\\b(by)\\b\\s*", + "captures": { + "1": { + "name": "keyword.operator.expression.query.by.cs" + } + } + }, + "group-into": { + "match": "(?x)\n\\b(into)\\b\\s*\n(@?[_[:alpha:]][_[:alnum:]]*)\\b\\s*", + "captures": { + "1": { + "name": "keyword.operator.expression.query.into.cs" + }, + "2": { + "name": "entity.name.variable.range-variable.cs" + } + } + }, + "anonymous-method-expression": { + "patterns": [ + { + "begin": "(?x)\n((?:\\b(?:async|static)\\b\\s*)*)\n(?:\n (@?[_[:alpha:]][_[:alnum:]]*)\\b|\n (\\()\n (?(?:[^()]|\\(\\g\\))*)\n (\\))\n)\\s*\n(=>)", + "beginCaptures": { + "1": { + "patterns": [ + { + "match": "async|static", + "name": "storage.modifier.$0.cs" + } + ] + }, + "2": { + "name": "entity.name.variable.parameter.cs" + }, + "3": { + "name": "punctuation.parenthesis.open.cs" + }, + "4": { + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#explicit-anonymous-function-parameter" + }, + { + "include": "#implicit-anonymous-function-parameter" + }, + { + "include": "#default-argument" + }, + { + "include": "#punctuation-comma" + } + ] + }, + "5": { + "name": "punctuation.parenthesis.close.cs" + }, + "6": { + "name": "keyword.operator.arrow.cs" + } + }, + "end": "(?=[,;)}])", + "patterns": [ + { + "include": "#intrusive" + }, + { + "begin": "(?={)", + "end": "(?=[,;)}])", + "patterns": [ + { + "include": "#block" + }, + { + "include": "#intrusive" + } + ] + }, + { + "begin": "\\b(ref)\\b|(?=\\S)", + "beginCaptures": { + "1": { + "name": "storage.modifier.ref.cs" + } + }, + "end": "(?=[,;)}])", + "patterns": [ + { + "include": "#expression" + } + ] + } + ] + }, + { + "begin": "(?x)\n((?:\\b(?:async|static)\\b\\s*)*)\n\\b(delegate)\\b\\s*", + "beginCaptures": { + "1": { + "patterns": [ + { + "match": "async|static", + "name": "storage.modifier.$0.cs" + } + ] + }, + "2": { + "name": "storage.type.delegate.cs" + } + }, + "end": "(?<=})|(?=[,;)}])", + "patterns": [ + { + "include": "#intrusive" + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.parenthesis.open.cs" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.parenthesis.close.cs" + } + }, + "patterns": [ + { + "include": "#intrusive" + }, + { + "include": "#explicit-anonymous-function-parameter" + }, + { + "include": "#punctuation-comma" + } + ] + }, + { + "include": "#block" + } + ] + } + ] + }, + "explicit-anonymous-function-parameter": { + "match": "(?x)\n(?:\\b(ref|params|out|in)\\b\\s*)?\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?<(?:[^<>]|\\g)*>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^()]|\\g)*\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)\\s*\n\\b(\\g)\\b", + "captures": { + "1": { + "name": "storage.modifier.$1.cs" + }, + "2": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "7": { + "name": "entity.name.variable.parameter.cs" + } + } + }, + "implicit-anonymous-function-parameter": { + "match": "\\@?[_[:alpha:]][_[:alnum:]]*\\b", + "name": "entity.name.variable.parameter.cs" + }, + "default-argument": { + "begin": "=", + "beginCaptures": { + "0": { + "name": "keyword.operator.assignment.cs" + } + }, + "end": "(?=,|\\))", + "patterns": [ + { + "include": "#expression" + } + ] + }, + "type": { + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#ref-modifier" + }, + { + "include": "#readonly-modifier" + }, + { + "include": "#tuple-type" + }, + { + "include": "#type-builtin" + }, + { + "include": "#type-name" + }, + { + "include": "#type-arguments" + }, + { + "include": "#type-array-suffix" + }, + { + "include": "#type-nullable-suffix" + }, + { + "include": "#type-pointer-suffix" + } + ] + }, + "ref-modifier": { + "name": "storage.modifier.ref.cs", + "match": "\\bref\\b" + }, + "readonly-modifier": { + "name": "storage.modifier.readonly.cs", + "match": "\\breadonly\\b" + }, + "tuple-type": { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.parenthesis.open.cs" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.parenthesis.close.cs" + } + }, + "patterns": [ + { + "include": "#tuple-element" + }, + { + "include": "#punctuation-comma" + } + ] + }, + "tuple-element": { + "match": "(?x)\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)* | # Are there any more names being dotted into?\n (?\\s*\\((?:[^\\(\\)]|\\g)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)\n(?:(?\\g)\\b)?", + "captures": { + "1": { + "patterns": [ + { + "include": "#type" + } + ] + }, + "6": { + "name": "entity.name.variable.tuple-element.cs" + } + } + }, + "type-builtin": { + "match": "\\b(bool|s?byte|u?short|n?u?int|u?long|float|double|decimal|char|string|object|void|dynamic)\\b", + "captures": { + "1": { + "name": "keyword.type.$1.cs" + } + } + }, + "type-name": { + "patterns": [ + { + "match": "(@?[_[:alpha:]][_[:alnum:]]*)\\s*(\\:\\:)", + "captures": { + "1": { + "name": "entity.name.type.alias.cs" + }, + "2": { + "name": "punctuation.separator.coloncolon.cs" + } + } + }, + { + "match": "(@?[_[:alpha:]][_[:alnum:]]*)\\s*(\\.)", + "captures": { + "1": { + "name": "entity.name.type.cs" + }, + "2": { + "name": "punctuation.accessor.cs" + } + } + }, + { + "match": "(\\.)\\s*(@?[_[:alpha:]][_[:alnum:]]*)", + "captures": { + "1": { + "name": "punctuation.accessor.cs" + }, + "2": { + "name": "entity.name.type.cs" + } + } + }, + { + "name": "entity.name.type.cs", + "match": "@?[_[:alpha:]][_[:alnum:]]*" + } + ] + }, + "type-arguments": { + "begin": "<", + "beginCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.begin.cs" + } + }, + "end": ">", + "endCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.end.cs" + } + }, + "patterns": [ + { + "include": "#type" + }, + { + "include": "#punctuation-comma" + } + ] + }, + "type-array-suffix": { + "begin": "\\[", + "beginCaptures": { + "0": { + "name": "punctuation.squarebracket.open.cs" + } + }, + "end": "\\]", + "endCaptures": { + "0": { + "name": "punctuation.squarebracket.close.cs" + } + }, + "patterns": [ + { + "include": "#intrusive" + }, + { + "include": "#punctuation-comma" + } + ] + }, + "type-nullable-suffix": { + "match": "\\?", + "name": "punctuation.separator.question-mark.cs" + }, + "type-pointer-suffix": { + "match": "\\*", + "name": "punctuation.separator.asterisk.cs" + }, + "operator-assignment": { + "name": "keyword.operator.assignment.cs", + "match": "(?)", + "endCaptures": { + "1": { + "name": "punctuation.definition.tag.cs" + } + }, + "patterns": [ + { + "include": "#xml-attribute" + } + ] + }, + "xml-attribute": { + "patterns": [ + { + "match": "(?x)\n(?:^|\\s+)\n(\n (?:\n ([-_[:alnum:]]+)\n (:)\n )?\n ([-_[:alnum:]]+)\n)\n(=)", + "captures": { + "1": { + "name": "entity.other.attribute-name.cs" + }, + "2": { + "name": "entity.other.attribute-name.namespace.cs" + }, + "3": { + "name": "punctuation.separator.colon.cs" + }, + "4": { + "name": "entity.other.attribute-name.localname.cs" + }, + "5": { + "name": "punctuation.separator.equals.cs" + } + } + }, + { + "include": "#xml-string" + } + ] + }, + "xml-cdata": { + "name": "string.unquoted.cdata.cs", + "begin": "", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cs" + } + } + }, + "xml-string": { + "patterns": [ + { + "name": "string.quoted.single.cs", + "begin": "\\'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cs" + } + }, + "end": "\\'", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cs" + } + }, + "patterns": [ + { + "include": "#xml-character-entity" + } + ] + }, + { + "name": "string.quoted.double.cs", + "begin": "\\\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cs" + } + }, + "end": "\\\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cs" + } + }, + "patterns": [ + { + "include": "#xml-character-entity" + } + ] + } + ] + }, + "xml-character-entity": { + "patterns": [ + { + "name": "constant.character.entity.cs", + "match": "(?x)\n(&)\n(\n (?:[[:alpha:]:_][[:alnum:]:_.-]*)|\n (?:\\#[[:digit:]]+)|\n (?:\\#x[[:xdigit:]]+)\n)\n(;)", + "captures": { + "1": { + "name": "punctuation.definition.constant.cs" + }, + "3": { + "name": "punctuation.definition.constant.cs" + } + } + }, + { + "name": "invalid.illegal.bad-ampersand.cs", + "match": "&" + } + ] + }, + "xml-comment": { + "name": "comment.block.cs", + "begin": "", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.cs" + } + } + } + } +} \ No newline at end of file diff --git a/desktop/internal/editor/syntax/grammars/docker.tmLanguage.json b/desktop/internal/editor/syntax/grammars/docker.tmLanguage.json new file mode 100644 index 0000000000..aa5223a31e --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/docker.tmLanguage.json @@ -0,0 +1,109 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/moby/moby/blob/master/contrib/syntax/textmate/Docker.tmbundle/Syntaxes/Dockerfile.tmLanguage", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/moby/moby/commit/c2029cb2574647e4bc28ed58486b8e85883eedb9", + "name": "Dockerfile", + "scopeName": "source.dockerfile", + "patterns": [ + { + "captures": { + "1": { + "name": "keyword.other.special-method.dockerfile" + }, + "2": { + "name": "keyword.other.special-method.dockerfile" + } + }, + "match": "^\\s*\\b(?i:(FROM))\\b.*?\\b(?i:(AS))\\b" + }, + { + "captures": { + "1": { + "name": "keyword.control.dockerfile" + }, + "2": { + "name": "keyword.other.special-method.dockerfile" + } + }, + "match": "^\\s*(?i:(ONBUILD)\\s+)?(?i:(ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR))\\s" + }, + { + "captures": { + "1": { + "name": "keyword.operator.dockerfile" + }, + "2": { + "name": "keyword.other.special-method.dockerfile" + } + }, + "match": "^\\s*(?i:(ONBUILD)\\s+)?(?i:(CMD|ENTRYPOINT))\\s" + }, + { + "include": "#string-character-escape" + }, + { + "begin": "\"", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.dockerfile" + } + }, + "end": "\"", + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.dockerfile" + } + }, + "name": "string.quoted.double.dockerfile", + "patterns": [ + { + "include": "#string-character-escape" + } + ] + }, + { + "begin": "'", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.dockerfile" + } + }, + "end": "'", + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.dockerfile" + } + }, + "name": "string.quoted.single.dockerfile", + "patterns": [ + { + "include": "#string-character-escape" + } + ] + }, + { + "captures": { + "1": { + "name": "punctuation.whitespace.comment.leading.dockerfile" + }, + "2": { + "name": "comment.line.number-sign.dockerfile" + }, + "3": { + "name": "punctuation.definition.comment.dockerfile" + } + }, + "comment": "comment.line", + "match": "^(\\s*)((#).*$\\n?)" + } + ], + "repository": { + "string-character-escape": { + "name": "constant.character.escaped.dockerfile", + "match": "\\\\." + } + } +} \ No newline at end of file diff --git a/desktop/internal/editor/syntax/grammars/graphql.tmLanguage.json b/desktop/internal/editor/syntax/grammars/graphql.tmLanguage.json new file mode 100644 index 0000000000..96b93d2cd6 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/graphql.tmLanguage.json @@ -0,0 +1,798 @@ +{ + "name": "GraphQL", + "scopeName": "source.graphql", + "fileTypes": ["graphql", "graphqls", "gql", "graphcool"], + "patterns": [{ "include": "#graphql" }], + "repository": { + "graphql": { + "patterns": [ + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-string" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-fragment-definition" }, + { "include": "#graphql-directive-definition" }, + { "include": "#graphql-type-interface" }, + { "include": "#graphql-enum" }, + { "include": "#graphql-scalar" }, + { "include": "#graphql-union" }, + { "include": "#graphql-schema" }, + { "include": "#graphql-operation-def" }, + { "include": "#literal-quasi-embedded" } + ] + }, + "graphql-operation-def": { + "patterns": [ + { "include": "#graphql-query-mutation-subscription" }, + { "include": "#graphql-name" }, + { "include": "#graphql-variable-definitions" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-selection-set" } + ] + }, + "graphql-fragment-definition": { + "name": "meta.fragment.graphql", + "begin": "\\s*(?:(\\bfragment\\b)\\s*([_A-Za-z][_0-9A-Za-z]*)?)", + "end": "(?<=})", + "captures": { + "1": { "name": "keyword.fragment.graphql" }, + "2": { "name": "entity.name.fragment.graphql" } + }, + "patterns": [ + { + "match": "\\s*(?:(\\bon\\b)\\s*([_A-Za-z][_0-9A-Za-z]*))", + "captures": { + "1": { "name": "keyword.on.graphql" }, + "2": { "name": "support.type.graphql" } + } + }, + { "include": "#graphql-variable-definitions" }, + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-selection-set" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-skip-newlines" }, + { "include": "#literal-quasi-embedded" } + ] + }, + "graphql-query-mutation-subscription": { + "match": "\\s*\\b(query|mutation|subscription)\\b", + "captures": { + "1": { "name": "keyword.operation.graphql" } + } + }, + "graphql-type-interface": { + "name": "meta.type.interface.graphql", + "begin": "\\s*\\b(?:(extends?)?\\b\\s*\\b(type)|(interface)|(input))\\b\\s*([_A-Za-z][_0-9A-Za-z]*)?", + "end": "(?=.)", + "applyEndPatternLast": 1, + "captures": { + "1": { "name": "keyword.type.graphql" }, + "2": { "name": "keyword.type.graphql" }, + "3": { "name": "keyword.interface.graphql" }, + "4": { "name": "keyword.input.graphql" }, + "5": { "name": "support.type.graphql" } + }, + "patterns": [ + { + "begin": "\\s*\\b(implements)\\b\\s*", + "end": "\\s*(?={)", + "beginCaptures": { + "1": { "name": "keyword.implements.graphql" } + }, + "patterns": [ + { + "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", + "captures": { + "1": { "name": "support.type.graphql" } + } + }, + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-ampersand" }, + { "include": "#graphql-comma" } + ] + }, + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-type-object" }, + { "include": "#literal-quasi-embedded" }, + { "include": "#graphql-ignore-spaces" } + ] + }, + "graphql-ignore-spaces": { + "match": "\\s*" + }, + "graphql-type-object": { + "name": "meta.type.object.graphql", + "begin": "\\s*({)", + "end": "\\s*(})", + "beginCaptures": { + "1": { "name": "punctuation.operation.graphql" } + }, + "endCaptures": { + "1": { "name": "punctuation.operation.graphql" } + }, + "patterns": [ + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-string" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-object-type" }, + { "include": "#graphql-type-definition" }, + { "include": "#literal-quasi-embedded" } + ] + }, + "graphql-type-definition": { + "comment": "key (optionalArgs): Type", + "begin": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?=\\s*\\(|:)", + "end": "(?=\\s*(([_A-Za-z][_0-9A-Za-z]*)\\s*(\\(|:)|(})))|\\s*(,)|(?=\\s*\")", + "beginCaptures": { + "1": { "name": "variable.graphql" } + }, + "endCaptures": { + "5": { "name": "punctuation.comma.graphql" } + }, + "patterns": [ + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-variable-definitions" }, + { "include": "#graphql-type-object" }, + { "include": "#graphql-colon" }, + { "include": "#graphql-input-types" }, + { "include": "#graphql-variable-assignment" }, + { "include": "#literal-quasi-embedded" } + ] + }, + "graphql-schema": { + "begin": "\\s*\\b(schema)\\b", + "end": "(?<=})", + "beginCaptures": { + "1": { "name": "keyword.schema.graphql" } + }, + "patterns": [ + { + "begin": "\\s*({)", + "end": "\\s*(})", + "beginCaptures": { + "1": { "name": "punctuation.operation.graphql" } + }, + "endCaptures": { + "1": { "name": "punctuation.operation.graphql" } + }, + "patterns": [ + { + "begin": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?=\\s*\\(|:)", + "end": "(?=\\s*(([_A-Za-z][_0-9A-Za-z]*)\\s*(\\(|:)|(})))|\\s*(,)", + "beginCaptures": { + "1": { "name": "variable.arguments.graphql" } + }, + "endCaptures": { + "5": { "name": "punctuation.comma.graphql" } + }, + "patterns": [ + { + "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", + "captures": { + "1": { "name": "support.type.graphql" } + } + }, + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-colon" }, + { "include": "#graphql-skip-newlines" } + ] + }, + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-skip-newlines" } + ] + }, + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-skip-newlines" } + ] + }, + "graphql-comment": { + "patterns": [ + { + "comment": "need to prefix comment space with a scope else Atom's reflow cmd doesn't work", + "name": "comment.line.graphql.js", + "match": "(\\s*)(#).*", + "captures": { + "1": { + "name": "punctuation.whitespace.comment.leading.graphql" + } + } + } + ] + }, + "graphql-description-string": { + "comment": "single-line string description; included only in definition positions, never where a string value can appear", + "name": "comment.line.documentation.graphql", + "begin": "(\")", + "end": "(\")", + "beginCaptures": { + "1": { + "name": "punctuation.whitespace.comment.leading.graphql" + } + } + }, + "graphql-description-singleline": { + "name": "comment.line.number-sign.graphql", + "match": "#(?=([^\"]*\"[^\"]*\")*[^\"]*$).*$" + }, + "graphql-description-docstring": { + "name": "comment.block.documentation.graphql", + "begin": "\"\"\"", + "end": "\"\"\"" + }, + "graphql-block-string-value": { + "comment": "triple-quoted block string used as a value; not a description", + "contentName": "string.quoted.triple.graphql", + "begin": "\\s*+((\"\"\"))", + "end": "((\"\"\"))", + "beginCaptures": { + "1": { "name": "string.quoted.triple.graphql" }, + "2": { "name": "punctuation.definition.string.begin.graphql" } + }, + "endCaptures": { + "1": { "name": "string.quoted.triple.graphql" }, + "2": { "name": "punctuation.definition.string.end.graphql" } + }, + "patterns": [ + { + "name": "constant.character.escape.graphql", + "match": "\\\\\"\"\"" + }, + { "include": "#literal-quasi-embedded" } + ] + }, + "graphql-variable-definitions": { + "begin": "\\s*(\\()", + "end": "\\s*(\\))", + "captures": { + "1": { "name": "meta.brace.round.graphql" } + }, + "patterns": [ + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-string" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-variable-definition" }, + { "include": "#literal-quasi-embedded" } + ] + }, + "graphql-variable-definition": { + "comment": "variable: type = value,.... which may be a list", + "name": "meta.variables.graphql", + "begin": "\\s*(\\$?[_A-Za-z][_0-9A-Za-z]*)(?=\\s*\\(|:)", + "end": "(?=\\s*((\\$?[_A-Za-z][_0-9A-Za-z]*)\\s*(\\(|:)|(}|\\))))|\\s*(,)|(?=\\s*\")", + "beginCaptures": { + "1": { "name": "variable.parameter.graphql" } + }, + "endCaptures": { + "5": { "name": "punctuation.comma.graphql" } + }, + "patterns": [ + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-colon" }, + { "include": "#graphql-input-types" }, + { "include": "#graphql-variable-assignment" }, + { "include": "#literal-quasi-embedded" }, + { "include": "#graphql-skip-newlines" } + ] + }, + "graphql-input-types": { + "patterns": [ + { "include": "#graphql-scalar-type" }, + { + "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?:\\s*(!))?", + "captures": { + "1": { "name": "support.type.graphql" }, + "2": { "name": "keyword.operator.nulltype.graphql" } + } + }, + { + "name": "meta.type.list.graphql", + "begin": "\\s*(\\[)", + "end": "\\s*(\\])(?:\\s*(!))?", + "captures": { + "1": { "name": "meta.brace.square.graphql" }, + "2": { "name": "keyword.operator.nulltype.graphql" } + }, + "patterns": [ + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-input-types" }, + { "include": "#graphql-comma" }, + { "include": "#literal-quasi-embedded" } + ] + } + ] + }, + "graphql-scalar": { + "match": "\\s*\\b(scalar)\\b\\s*([_A-Za-z][_0-9A-Za-z]*)", + "captures": { + "1": { "name": "keyword.scalar.graphql" }, + "2": { "name": "entity.scalar.graphql" } + } + }, + "graphql-scalar-type": { + "match": "\\s*\\b(Int|Float|String|Boolean|ID)\\b(?:\\s*(!))?", + "captures": { + "1": { "name": "support.type.builtin.graphql" }, + "2": { "name": "keyword.operator.nulltype.graphql" } + } + }, + "graphql-variable-assignment": { + "begin": "\\s*(=)", + "end": "(?=[\n,)])|(?<=[_0-9A-Za-z\"])|(?<=\\])|(?<=})", + "beginCaptures": { + "1": { "name": "punctuation.assignment.graphql" } + }, + "patterns": [{ "include": "#graphql-value" }] + }, + "graphql-comma": { + "match": "\\s*(,)", + "captures": { + "1": { "name": "punctuation.comma.graphql" } + } + }, + "graphql-ampersand": { + "match": "\\s*(&)", + "captures": { + "1": { "name": "keyword.operator.logical.graphql" } + } + }, + "graphql-colon": { + "match": "\\s*(:)", + "captures": { + "1": { "name": "punctuation.colon.graphql" } + } + }, + "graphql-union-mark": { + "match": "\\s*(\\|)", + "captures": { + "1": { "name": "punctuation.union.graphql" } + } + }, + "graphql-name": { + "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", + "captures": { + "1": { "name": "entity.name.function.graphql" } + } + }, + "graphql-directive": { + "begin": "\\s*((@)\\s*([_A-Za-z][_0-9A-Za-z]*))", + "end": "(?=.)", + "applyEndPatternLast": 1, + "beginCaptures": { + "1": { "name": "entity.name.function.directive.graphql" } + }, + "patterns": [ + { "include": "#graphql-comment" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-arguments" }, + { "include": "#literal-quasi-embedded" }, + { "include": "#graphql-skip-newlines" } + ] + }, + "graphql-directive-definition": { + "begin": "\\s*(\\bdirective\\b)\\s*(@[_A-Za-z][_0-9A-Za-z]*)", + "end": "(?=.)", + "applyEndPatternLast": 1, + "beginCaptures": { + "1": { + "name": "keyword.directive.graphql" + }, + "2": { + "name": "entity.name.function.directive.graphql" + }, + "3": { + "name": "keyword.repeatable.graphql" + }, + "4": { + "name": "keyword.on.graphql" + }, + "5": { + "name": "support.type.graphql" + } + }, + "patterns": [ + { + "include": "#graphql-variable-definitions" + }, + { + "begin": "\\s*(\\brepeatable\\b)?\\s*(\\bon\\b)\\s*([_A-Za-z]*)", + "end": "(?=.)", + "applyEndPatternLast": 1, + "beginCaptures": { + "1": { + "name": "keyword.repeatable.graphql" + }, + "2": { + "name": "keyword.on.graphql" + }, + "3": { + "name": "support.type.location.graphql" + } + }, + "patterns": [ + { + "include": "#graphql-skip-newlines" + }, + { + "include": "#graphql-comment" + }, + { + "include": "#literal-quasi-embedded" + }, + { + "match": "\\s*(\\|)\\s*([_A-Za-z]*)", + "captures": { + "2": { + "name": "support.type.location.graphql" + } + } + } + ] + }, + { + "include": "#graphql-skip-newlines" + }, + { + "include": "#graphql-comment" + }, + { + "include": "#literal-quasi-embedded" + } + ] + }, + "graphql-selection-set": { + "name": "meta.selectionset.graphql", + "begin": "\\s*({)", + "end": "\\s*(})", + "beginCaptures": { + "1": { "name": "punctuation.operation.graphql" } + }, + "endCaptures": { + "1": { "name": "punctuation.operation.graphql" } + }, + "patterns": [ + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-field" }, + { "include": "#graphql-fragment-spread" }, + { "include": "#graphql-inline-fragment" }, + { "include": "#graphql-comma" }, + { "include": "#native-interpolation" }, + { "include": "#literal-quasi-embedded" } + ] + }, + "graphql-field": { + "patterns": [ + { + "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)\\s*(:)", + "captures": { + "1": { "name": "string.unquoted.alias.graphql" }, + "2": { "name": "punctuation.colon.graphql" } + } + }, + { + "match": "\\s*([_A-Za-z][_0-9A-Za-z]*)", + "captures": { + "1": { "name": "variable.graphql" } + } + }, + { "include": "#graphql-arguments" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-selection-set" }, + { "include": "#literal-quasi-embedded" }, + { "include": "#graphql-skip-newlines" } + ] + }, + "graphql-fragment-spread": { + "begin": "\\s*(\\.\\.\\.)\\s*(?!\\bon\\b)([_A-Za-z][_0-9A-Za-z]*)", + "end": "(?=.)", + "applyEndPatternLast": 1, + "captures": { + "1": { "name": "keyword.operator.spread.graphql" }, + "2": { "name": "variable.fragment.graphql" } + }, + "patterns": [ + { "include": "#graphql-arguments" }, + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-selection-set" }, + { "include": "#graphql-directive" }, + { "include": "#literal-quasi-embedded" }, + { "include": "#graphql-skip-newlines" } + ] + }, + "graphql-inline-fragment": { + "begin": "\\s*(\\.\\.\\.)\\s*(?:(\\bon\\b)\\s*([_A-Za-z][_0-9A-Za-z]*))?", + "end": "(?=.)", + "applyEndPatternLast": 1, + "captures": { + "1": { "name": "keyword.operator.spread.graphql" }, + "2": { "name": "keyword.on.graphql" }, + "3": { "name": "support.type.graphql" } + }, + "patterns": [ + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-selection-set" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-skip-newlines" }, + { "include": "#literal-quasi-embedded" } + ] + }, + "graphql-arguments": { + "name": "meta.arguments.graphql", + "begin": "\\s*(\\()", + "end": "\\s*(\\))", + "beginCaptures": { + "1": { "name": "meta.brace.round.directive.graphql" } + }, + "endCaptures": { + "1": { "name": "meta.brace.round.directive.graphql" } + }, + "patterns": [ + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { + "begin": "\\s*([_A-Za-z][_0-9A-Za-z]*)(?:\\s*(:))", + "end": "(?=\\s*(?:(?:([_A-Za-z][_0-9A-Za-z]*)\\s*(:))|\\)))|\\s*(,)", + "beginCaptures": { + "1": { "name": "variable.parameter.graphql" }, + "2": { "name": "punctuation.colon.graphql" } + }, + "endCaptures": { + "3": { "name": "punctuation.comma.graphql" } + }, + "patterns": [ + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-value" }, + { "include": "#graphql-skip-newlines" } + ] + }, + { "include": "#literal-quasi-embedded" } + ] + }, + "graphql-variable-name": { + "match": "\\s*(\\$[_A-Za-z][_0-9A-Za-z]*)", + "captures": { + "1": { "name": "variable.graphql" } + } + }, + "graphql-float-value": { + "match": "\\s*(-?(0|[1-9][0-9]*)(\\.[0-9]+)?((e|E)(\\+|-)?[0-9]+)?)", + "captures": { + "1": { "name": "constant.numeric.float.graphql" } + } + }, + "graphql-boolean-value": { + "match": "\\s*\\b(true|false)\\b", + "captures": { + "1": { "name": "constant.language.boolean.graphql" } + } + }, + "graphql-null-value": { + "match": "\\s*\\b(null)\\b", + "captures": { + "1": { "name": "constant.language.null.graphql" } + } + }, + "graphql-string-value": { + "contentName": "string.quoted.double.graphql", + "begin": "\\s*+((\"))", + "end": "\\s*+(?:((\"))|(\n))", + "beginCaptures": { + "1": { "name": "string.quoted.double.graphql" }, + "2": { "name": "punctuation.definition.string.begin.graphql" } + }, + "endCaptures": { + "1": { "name": "string.quoted.double.graphql" }, + "2": { "name": "punctuation.definition.string.end.graphql" }, + "3": { "name": "invalid.illegal.newline.graphql" } + }, + "patterns": [ + { "include": "#graphql-string-content" }, + { "include": "#literal-quasi-embedded" } + ] + }, + "graphql-string-content": { + "patterns": [ + { + "name": "constant.character.escape.graphql", + "match": "\\\\[/'\"\\\\nrtbf]" + }, + { + "name": "constant.character.escape.graphql", + "match": "\\\\u([0-9a-fA-F]{4})" + } + ] + }, + "graphql-enum": { + "name": "meta.enum.graphql", + "begin": "\\s*+\\b(enum)\\b\\s*([_A-Za-z][_0-9A-Za-z]*)", + "end": "(?<=})", + "beginCaptures": { + "1": { "name": "keyword.enum.graphql" }, + "2": { "name": "support.type.enum.graphql" } + }, + "patterns": [ + { + "name": "meta.type.object.graphql", + "begin": "\\s*({)", + "end": "\\s*(})", + "beginCaptures": { + "1": { "name": "punctuation.operation.graphql" } + }, + "endCaptures": { + "1": { "name": "punctuation.operation.graphql" } + }, + "patterns": [ + { "include": "#graphql-object-type" }, + + { "include": "#graphql-comment" }, + { "include": "#graphql-description-docstring" }, + { "include": "#graphql-description-string" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" }, + { "include": "#graphql-enum-value" }, + { "include": "#literal-quasi-embedded" } + ] + }, + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-directive" } + ] + }, + "graphql-enum-value": { + "name": "constant.character.enum.graphql", + "match": "\\s*(?!=\\b(true|false|null)\\b)([_A-Za-z][_0-9A-Za-z]*)" + }, + "graphql-value": { + "patterns": [ + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-variable-name" }, + { "include": "#graphql-float-value" }, + { "include": "#graphql-string-value" }, + { "include": "#graphql-boolean-value" }, + { "include": "#graphql-null-value" }, + { "include": "#graphql-enum-value" }, + { "include": "#graphql-list-value" }, + { "include": "#graphql-object-value" }, + { "include": "#literal-quasi-embedded" } + ] + }, + "graphql-list-value": { + "patterns": [ + { + "name": "meta.listvalues.graphql", + "begin": "\\s*+(\\[)", + "end": "\\s*(\\])", + "endCaptures": { + "1": { "name": "meta.brace.square.graphql" } + }, + "beginCaptures": { + "1": { "name": "meta.brace.square.graphql" } + }, + "patterns": [{ "include": "#graphql-value" }] + } + ] + }, + "graphql-object-value": { + "patterns": [ + { + "name": "meta.objectvalues.graphql", + "begin": "\\s*+({)", + "end": "\\s*(})", + "beginCaptures": { + "1": { "name": "meta.brace.curly.graphql" } + }, + "endCaptures": { + "1": { "name": "meta.brace.curly.graphql" } + }, + "patterns": [ + { "include": "#graphql-object-field" }, + { "include": "#graphql-value" } + ] + } + ] + }, + "graphql-object-field": { + "match": "\\s*(([_A-Za-z][_0-9A-Za-z]*))\\s*(:)", + "captures": { + "1": { "name": "constant.object.key.graphql" }, + "2": { "name": "string.unquoted.graphql" }, + "3": { "name": "punctuation.graphql" } + } + }, + "graphql-union": { + "begin": "\\s*\\b(union)\\b\\s*([_A-Za-z][_0-9A-Za-z]*)", + "end": "(?=.)", + "applyEndPatternLast": 1, + "captures": { + "1": { "name": "keyword.union.graphql" }, + "2": { "name": "support.type.graphql" } + }, + "patterns": [ + { + "begin": "\\s*(=)\\s*([_A-Za-z][_0-9A-Za-z]*)", + "end": "(?=.)", + "applyEndPatternLast": 1, + "captures": { + "1": { "name": "punctuation.assignment.graphql" }, + "2": { "name": "support.type.graphql" } + }, + "patterns": [ + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-skip-newlines" }, + { "include": "#literal-quasi-embedded" }, + { + "match": "\\s*(\\|)\\s*([_A-Za-z][_0-9A-Za-z]*)", + "captures": { + "1": { "name": "punctuation.or.graphql" }, + "2": { "name": "support.type.graphql" } + } + } + ] + }, + { "include": "#graphql-comment" }, + { "include": "#graphql-block-string-value" }, + { "include": "#graphql-description-singleline" }, + { "include": "#graphql-skip-newlines" }, + { "include": "#literal-quasi-embedded" } + ] + }, + "native-interpolation": { + "name": "native.interpolation", + "begin": "\\s*(\\${)", + "end": "(})", + "beginCaptures": { + "1": { "name": "keyword.other.substitution.begin" } + }, + "endCaptures": { + "1": { "name": "keyword.other.substitution.end" } + }, + "patterns": [ + { "include": "source.js" }, + { "include": "source.ts" }, + { "include": "source.js.jsx" }, + { "include": "source.tsx" } + ] + }, + "graphql-skip-newlines": { + "match": "\\s*\n" + } + } +} diff --git a/desktop/internal/editor/textmate/testdata/grammars/groovy.tmLanguage.json b/desktop/internal/editor/syntax/grammars/groovy.tmLanguage.json similarity index 100% rename from desktop/internal/editor/textmate/testdata/grammars/groovy.tmLanguage.json rename to desktop/internal/editor/syntax/grammars/groovy.tmLanguage.json diff --git a/desktop/internal/editor/syntax/grammars/html-derivative.tmLanguage.json b/desktop/internal/editor/syntax/grammars/html-derivative.tmLanguage.json new file mode 100644 index 0000000000..f06c4d0ec4 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/html-derivative.tmLanguage.json @@ -0,0 +1,49 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/textmate/html.tmbundle/blob/master/Syntaxes/HTML%20%28Derivative%29.tmLanguage", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/textmate/html.tmbundle/commit/390c8870273a2ae80244dae6db6ba064a802f407", + "name": "HTML (Derivative)", + "scopeName": "text.html.derivative", + "injections": { + "R:text.html - (comment.block, text.html meta.embedded, meta.tag.*.*.html, meta.tag.*.*.*.html, meta.tag.*.*.*.*.html)": { + "comment": "Uses R: to ensure this matches after any other injections.", + "patterns": [ + { + "match": "<", + "name": "invalid.illegal.bad-angle-bracket.html" + } + ] + } + }, + "patterns": [ + { + "include": "text.html.basic#core-minus-invalid" + }, + { + "begin": "(]*)(?)", + "endCaptures": { + "1": { + "name": "punctuation.definition.tag.end.html" + } + }, + "name": "meta.tag.other.unrecognized.html.derivative", + "patterns": [ + { + "include": "text.html.basic#attribute" + } + ] + } + ] +} \ No newline at end of file diff --git a/desktop/internal/editor/syntax/grammars/kotlin.tmLanguage.json b/desktop/internal/editor/syntax/grammars/kotlin.tmLanguage.json new file mode 100644 index 0000000000..9fded0ef09 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/kotlin.tmLanguage.json @@ -0,0 +1,580 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "Kotlin", + "scopeName": "source.kotlin", + "patterns": [ + { + "include": "#import" + }, + { + "include": "#package" + }, + { + "include": "#code" + } + ], + "fileTypes": [ + "kt", + "kts" + ], + "repository": { + "import": { + "begin": "\\b(import)\\b\\s*", + "beginCaptures": { + "1": { + "name": "keyword.soft.kotlin" + } + }, + "end": ";|$", + "name": "meta.import.kotlin", + "contentName": "entity.name.package.kotlin", + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#hard-keywords" + }, + { + "match": "\\*", + "name": "variable.language.wildcard.kotlin" + } + ] + }, + "package": { + "begin": "\\b(package)\\b\\s*", + "beginCaptures": { + "1": { + "name": "keyword.hard.package.kotlin" + } + }, + "end": ";|$", + "name": "meta.package.kotlin", + "contentName": "entity.name.package.kotlin", + "patterns": [ + { + "include": "#comments" + } + ] + }, + "code": { + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#keywords" + }, + { + "include": "#annotation-simple" + }, + { + "include": "#annotation-site-list" + }, + { + "include": "#annotation-site" + }, + { + "include": "#class-declaration" + }, + { + "include": "#object" + }, + { + "include": "#type-alias" + }, + { + "include": "#function" + }, + { + "include": "#variable-declaration" + }, + { + "include": "#type-constraint" + }, + { + "include": "#type-annotation" + }, + { + "include": "#function-call" + }, + { + "include": "#method-reference" + }, + { + "include": "#key" + }, + { + "include": "#string" + }, + { + "include": "#string-empty" + }, + { + "include": "#string-multiline" + }, + { + "include": "#character" + }, + { + "include": "#lambda-arrow" + }, + { + "include": "#operators" + }, + { + "include": "#self-reference" + }, + { + "include": "#decimal-literal" + }, + { + "include": "#hex-literal" + }, + { + "include": "#binary-literal" + }, + { + "include": "#boolean-literal" + }, + { + "include": "#null-literal" + } + ] + }, + "comments": { + "patterns": [ + { + "include": "#comment-line" + }, + { + "include": "#comment-block" + }, + { + "include": "#comment-javadoc" + } + ] + }, + "comment-line": { + "begin": "//", + "end": "$", + "name": "comment.line.double-slash.kotlin" + }, + "comment-block": { + "begin": "/\\*(?!\\*)", + "end": "\\*/", + "name": "comment.block.kotlin" + }, + "comment-javadoc": { + "patterns": [ + { + "begin": "/\\*\\*", + "end": "\\*/", + "name": "comment.block.javadoc.kotlin", + "patterns": [ + { + "match": "@(return|constructor|receiver|sample|see|author|since|suppress)\\b", + "name": "keyword.other.documentation.javadoc.kotlin" + }, + { + "match": "(@param|@property)\\s+(\\S+)", + "captures": { + "1": { + "name": "keyword.other.documentation.javadoc.kotlin" + }, + "2": { + "name": "variable.parameter.kotlin" + } + } + }, + { + "match": "(@param)\\[(\\S+)\\]", + "captures": { + "1": { + "name": "keyword.other.documentation.javadoc.kotlin" + }, + "2": { + "name": "variable.parameter.kotlin" + } + } + }, + { + "match": "(@(?:exception|throws))\\s+(\\S+)", + "captures": { + "1": { + "name": "keyword.other.documentation.javadoc.kotlin" + }, + "2": { + "name": "entity.name.type.class.kotlin" + } + } + }, + { + "match": "{(@link)\\s+(\\S+)?#([\\w$]+\\s*\\([^\\(\\)]*\\)).*}", + "captures": { + "1": { + "name": "keyword.other.documentation.javadoc.kotlin" + }, + "2": { + "name": "entity.name.type.class.kotlin" + }, + "3": { + "name": "variable.parameter.kotlin" + } + } + } + ] + } + ] + }, + "keywords": { + "patterns": [ + { + "include": "#prefix-modifiers" + }, + { + "include": "#postfix-modifiers" + }, + { + "include": "#soft-keywords" + }, + { + "include": "#hard-keywords" + }, + { + "include": "#control-keywords" + } + ] + }, + "prefix-modifiers": { + "match": "\\b(abstract|final|enum|open|annotation|sealed|data|override|final|lateinit|private|protected|public|internal|inner|companion|noinline|crossinline|vararg|reified|tailrec|operator|infix|inline|external|const|suspend|value)\\b", + "name": "storage.modifier.other.kotlin" + }, + "postfix-modifiers": { + "match": "\\b(where|by|get|set)\\b", + "name": "storage.modifier.other.kotlin" + }, + "soft-keywords": { + "match": "\\b(init|catch|finally|field)\\b", + "name": "keyword.soft.kotlin" + }, + "hard-keywords": { + "match": "\\b(as|typeof|is|in)\\b", + "name": "keyword.hard.kotlin" + }, + "control-keywords": { + "match": "\\b(if|else|while|do|when|try|throw|break|continue|return|for)\\b", + "name": "keyword.control.kotlin" + }, + "annotation-simple": { + "match": "(?<([^<>]|\\g)+>)?", + "captures": { + "1": { + "name": "keyword.hard.class.kotlin" + }, + "2": { + "name": "entity.name.type.class.kotlin" + }, + "3": { + "patterns": [ + { + "include": "#type-parameter" + } + ] + } + } + }, + "object": { + "match": "\\b(object)(?:\\s+(\\b\\w+\\b|`[^`]+`))?", + "captures": { + "1": { + "name": "keyword.hard.object.kotlin" + }, + "2": { + "name": "entity.name.type.object.kotlin" + } + } + }, + "type-alias": { + "match": "\\b(typealias)\\s+(\\b\\w+\\b|`[^`]+`)\\s*(?<([^<>]|\\g)+>)?", + "captures": { + "1": { + "name": "keyword.hard.typealias.kotlin" + }, + "2": { + "name": "entity.name.type.kotlin" + }, + "3": { + "patterns": [ + { + "include": "#type-parameter" + } + ] + } + } + }, + "function": { + "match": "\\b(fun)\\b\\s*(?<([^<>]|\\g)+>)?\\s*(?:(?:(\\w+)\\.)?(\\b\\w+\\b|`[^`]+`))?", + "captures": { + "1": { + "name": "keyword.hard.fun.kotlin" + }, + "2": { + "patterns": [ + { + "include": "#type-parameter" + } + ] + }, + "4": { + "name": "entity.name.type.class.extension.kotlin" + }, + "5": { + "name": "entity.name.function.declaration.kotlin" + } + } + }, + "variable-declaration": { + "match": "\\b(val|var)\\b\\s*(?<([^<>]|\\g)+>)?", + "captures": { + "1": { + "name": "keyword.hard.kotlin" + }, + "2": { + "patterns": [ + { + "include": "#type-parameter" + } + ] + } + } + }, + "type-parameter": { + "patterns": [ + { + "match": "\\b\\w+\\b", + "name": "entity.name.type.kotlin" + }, + { + "match": "\\b(in|out)\\b", + "name": "storage.modifier.kotlin" + } + ] + }, + "type-annotation": { + "match": "(?|(?[<(]([^<>()\"']|\\g)+[)>]))+", + "captures": { + "0": { + "patterns": [ + { + "include": "#type-parameter" + } + ] + } + } + }, + "function-call": { + "match": "\\??\\.?(\\b\\w+\\b|`[^`]+`)\\s*(?<([^<>]|\\g)+>)?\\s*(?=[({])", + "captures": { + "1": { + "name": "entity.name.function.call.kotlin" + }, + "2": { + "patterns": [ + { + "include": "#type-parameter" + } + ] + } + } + }, + "method-reference": { + "match": "\\??::(\\b\\w+\\b|`[^`]+`)", + "captures": { + "1": { + "name": "entity.name.function.reference.kotlin" + } + } + }, + "key": { + "match": "\\b(\\w=)\\s*(=)", + "captures": { + "1": { + "name": "variable.parameter.kotlin" + }, + "2": { + "name": "keyword.operator.assignment.kotlin" + } + } + }, + "string-empty": { + "match": "(?", + "name": "storage.type.function.arrow.kotlin" + }, + "operators": { + "patterns": [ + { + "match": "(===?|\\!==?|<=|>=|<|>)", + "name": "keyword.operator.comparison.kotlin" + }, + { + "match": "([+*/%-]=)", + "name": "keyword.operator.assignment.arithmetic.kotlin" + }, + { + "match": "(=)", + "name": "keyword.operator.assignment.kotlin" + }, + { + "match": "([+*/%-])", + "name": "keyword.operator.arithmetic.kotlin" + }, + { + "match": "(!|&&|\\|\\|)", + "name": "keyword.operator.logical.kotlin" + }, + { + "match": "(--|\\+\\+)", + "name": "keyword.operator.increment-decrement.kotlin" + }, + { + "match": "(\\.\\.)", + "name": "keyword.operator.range.kotlin" + } + ] + }, + "self-reference": { + "match": "\\b(this|super)(@\\w+)?\\b", + "name": "variable.language.this.kotlin" + } + } +} diff --git a/desktop/internal/editor/syntax/grammars/lua.tmLanguage.json b/desktop/internal/editor/syntax/grammars/lua.tmLanguage.json new file mode 100644 index 0000000000..69e731feb8 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/lua.tmLanguage.json @@ -0,0 +1,984 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/sumneko/lua.tmbundle/blob/master/Syntaxes/Lua.plist", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/sumneko/lua.tmbundle/commit/b295d83bf0e91b5d3a69eb097f9ed351623b95be", + "name": "Lua", + "scopeName": "source.lua", + "patterns": [ + { + "begin": "\\b(?:(local)\\s+)?(function)\\b(?![,:])", + "beginCaptures": { + "1": { + "name": "keyword.local.lua" + }, + "2": { + "name": "keyword.control.lua" + } + }, + "end": "(?<=[\\)\\-{}\\[\\]\"'])", + "name": "meta.function.lua", + "patterns": [ + { + "include": "#comment" + }, + { + "begin": "(\\()", + "beginCaptures": { + "1": { + "name": "punctuation.definition.parameters.begin.lua" + } + }, + "end": "(\\))|(?=[\\-{}\\[\\]\"'])|(?", + "captures": { + "0": { + "name": "storage.type.attribute.lua" + } + } + }, + { + "match": "\\<[a-zA-Z_\\*][a-zA-Z0-9_\\.\\*\\-]*\\>", + "name": "storage.type.generic.lua" + }, + { + "match": "\\b(break|do|else|for|if|elseif|goto|return|then|repeat|while|until|end|in)\\b", + "name": "keyword.control.lua" + }, + { + "match": "\\b(local)\\b", + "name": "keyword.local.lua" + }, + { + "match": "^\\s*(global)\\b(?!\\s*=)", + "captures": { + "1": { + "name": "keyword.global.lua" + } + } + }, + { + "match": "\\b(function)\\b(?![,:])", + "name": "keyword.control.lua" + }, + { + "match": "(?=?|(?|\\<", + "name": "keyword.operator.lua" + } + ] + }, + { + "begin": "(?<=---)[ \\t]*@see", + "beginCaptures": { + "0": { + "name": "storage.type.annotation.lua" + } + }, + "end": "(?=[\\n@#])", + "patterns": [ + { + "match": "\\b([a-zA-Z_\\*][a-zA-Z0-9_\\.\\*\\-]*)", + "name": "support.class.lua" + }, + { + "match": "#", + "name": "keyword.operator.lua" + } + ] + }, + { + "begin": "(?<=---)[ \\t]*@diagnostic", + "beginCaptures": { + "0": { + "name": "storage.type.annotation.lua" + } + }, + "end": "(?=[\\n@#])", + "patterns": [ + { + "begin": "([a-zA-Z_\\-0-9]+)[ \\t]*(:)?", + "beginCaptures": { + "1": { + "name": "keyword.other.unit" + }, + "2": { + "name": "keyword.operator.unit" + } + }, + "end": "(?=\\n)", + "patterns": [ + { + "match": "\\b([a-zA-Z_\\*][a-zA-Z0-9_\\-]*)", + "name": "support.class.lua" + }, + { + "match": ",", + "name": "keyword.operator.lua" + } + ] + } + ] + }, + { + "begin": "(?<=---)[ \\t]*@module", + "beginCaptures": { + "0": { + "name": "storage.type.annotation.lua" + } + }, + "end": "(?=[\\n@#])", + "patterns": [ + { + "include": "#string" + } + ] + }, + { + "match": "(?<=---)[ \\t]*@(async|nodiscard)", + "name": "storage.type.annotation.lua" + }, + { + "begin": "(?<=---)\\|\\s*[\\>\\+]?", + "beginCaptures": { + "0": { + "name": "storage.type.annotation.lua" + } + }, + "end": "(?=[\\n@#])", + "patterns": [ + { + "include": "#string" + } + ] + } + ] + }, + "emmydoc.type": { + "patterns": [ + { + "begin": "\\bfun\\b", + "beginCaptures": { + "0": { + "name": "keyword.control.lua" + } + }, + "end": "(?=[\\s#])", + "patterns": [ + { + "match": "[\\(\\),\\:\\?\\[\\]\\<\\>][ \\t]*", + "name": "keyword.operator.lua" + }, + { + "match": "([a-zA-Z_][a-zA-Z0-9_\\.\\*\\-]*)(?", + "name": "storage.type.generic.lua" + }, + { + "match": "\\basync\\b", + "name": "entity.name.tag.lua" + }, + { + "match": "[\\{\\}\\:\\,\\?\\|\\`][ \\t]*", + "name": "keyword.operator.lua" + }, + { + "begin": "(?=[a-zA-Z_\\.\\*\"'\\[])", + "end": "(?=[\\s\\)\\,\\?\\:\\}\\|#])", + "patterns": [ + { + "match": "([a-zA-Z0-9_\\.\\*\\[\\]\\<\\>\\,\\-]+)(?)", + "name": "meta.id-with-protocol.objcpp", + "patterns": [ + { + "include": "#protocol_list" + } + ] + }, + "anonymous_pattern_5": { + "match": "\\b(NS_DURING|NS_HANDLER|NS_ENDHANDLER)\\b", + "name": "keyword.control.macro.objcpp" + }, + "anonymous_pattern_7": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objcpp" + } + }, + "match": "(@)(try|catch|finally|throw)\\b", + "name": "keyword.control.exception.objcpp" + }, + "anonymous_pattern_8": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objcpp" + } + }, + "match": "(@)(synchronized)\\b", + "name": "keyword.control.synchronize.objcpp" + }, + "anonymous_pattern_9": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objcpp" + } + }, + "match": "(@)(required|optional)\\b", + "name": "keyword.control.protocol-specification.objcpp" + }, + "apple_foundation_functional_macros": { + "begin": "(\\b(?:API_AVAILABLE|API_DEPRECATED|API_UNAVAILABLE|NS_AVAILABLE|NS_AVAILABLE_MAC|NS_AVAILABLE_IOS|NS_DEPRECATED|NS_DEPRECATED_MAC|NS_DEPRECATED_IOS|NS_SWIFT_NAME))(?:(?:\\s)+)?(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "entity.name.function.preprocessor.apple-foundation.objcpp" + }, + "2": { + "name": "punctuation.section.macro.arguments.begin.bracket.round.apple-foundation.objcpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.macro.arguments.end.bracket.round.apple-foundation.objcpp" + } + }, + "name": "meta.preprocessor.macro.callable.apple-foundation.objcpp", + "patterns": [ + { + "include": "#c_lang" + } + ] + }, + "bracketed_content": { + "begin": "\\[", + "beginCaptures": { + "0": { + "name": "punctuation.section.scope.begin.objcpp" + } + }, + "end": "\\]", + "endCaptures": { + "0": { + "name": "punctuation.section.scope.end.objcpp" + } + }, + "name": "meta.bracketed.objcpp", + "patterns": [ + { + "begin": "(?=predicateWithFormat:)(?<=NSPredicate )(predicateWithFormat:)", + "beginCaptures": { + "1": { + "name": "support.function.any-method.objcpp" + }, + "2": { + "name": "punctuation.separator.arguments.objcpp" + } + }, + "end": "(?=\\])", + "name": "meta.function-call.predicate.objcpp", + "patterns": [ + { + "captures": { + "1": { + "name": "punctuation.separator.arguments.objcpp" + } + }, + "match": "\\bargument(Array|s)(:)", + "name": "support.function.any-method.name-of-parameter.objcpp" + }, + { + "captures": { + "1": { + "name": "punctuation.separator.arguments.objcpp" + } + }, + "match": "\\b\\w+(:)", + "name": "invalid.illegal.unknown-method.objcpp" + }, + { + "begin": "@\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.objcpp" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objcpp" + } + }, + "name": "string.quoted.double.objcpp", + "patterns": [ + { + "match": "\\b(AND|OR|NOT|IN)\\b", + "name": "keyword.operator.logical.predicate.cocoa.objcpp" + }, + { + "match": "\\b(ALL|ANY|SOME|NONE)\\b", + "name": "constant.language.predicate.cocoa.objcpp" + }, + { + "match": "\\b(NULL|NIL|SELF|TRUE|YES|FALSE|NO|FIRST|LAST|SIZE)\\b", + "name": "constant.language.predicate.cocoa.objcpp" + }, + { + "match": "\\b(MATCHES|CONTAINS|BEGINSWITH|ENDSWITH|BETWEEN)\\b", + "name": "keyword.operator.comparison.predicate.cocoa.objcpp" + }, + { + "match": "\\bC(ASEINSENSITIVE|I)\\b", + "name": "keyword.other.modifier.predicate.cocoa.objcpp" + }, + { + "match": "\\b(ANYKEY|SUBQUERY|CAST|TRUEPREDICATE|FALSEPREDICATE)\\b", + "name": "keyword.other.predicate.cocoa.objcpp" + }, + { + "match": "\\\\(\\\\|[abefnrtv'\"?]|[0-3]\\d{,2}|[4-7]\\d?|x[a-zA-Z0-9]+)", + "name": "constant.character.escape.objcpp" + }, + { + "match": "\\\\.", + "name": "invalid.illegal.unknown-escape.objcpp" + } + ] + }, + { + "include": "#special_variables" + }, + { + "include": "#c_functions" + }, + { + "include": "$base" + } + ] + }, + { + "begin": "(?=\\w)(?<=[\\w\\])\"] )(\\w+(?:(:)|(?=\\])))", + "beginCaptures": { + "1": { + "name": "support.function.any-method.objcpp" + }, + "2": { + "name": "punctuation.separator.arguments.objcpp" + } + }, + "end": "(?=\\])", + "name": "meta.function-call.objcpp", + "patterns": [ + { + "captures": { + "1": { + "name": "punctuation.separator.arguments.objcpp" + } + }, + "match": "\\b\\w+(:)", + "name": "support.function.any-method.name-of-parameter.objcpp" + }, + { + "include": "#special_variables" + }, + { + "include": "#c_functions" + }, + { + "include": "$base" + } + ] + }, + { + "include": "#special_variables" + }, + { + "include": "#c_functions" + }, + { + "include": "$self" + } + ] + }, + "c_functions": { + "patterns": [ + { + "captures": { + "1": { + "name": "punctuation.whitespace.support.function.leading.objcpp" + }, + "2": { + "name": "support.function.C99.objcpp" + } + }, + "match": "(\\s*)\\b(hypot(f|l)?|s(scanf|ystem|nprintf|ca(nf|lb(n(f|l)?|ln(f|l)?))|i(n(h(f|l)?|f|l)?|gn(al|bit))|tr(s(tr|pn)|nc(py|at|mp)|c(spn|hr|oll|py|at|mp)|to(imax|d|u(l(l)?|max)|k|f|l(d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(jmp|vbuf|locale|buf)|qrt(f|l)?|w(scanf|printf)|rand)|n(e(arbyint(f|l)?|xt(toward(f|l)?|after(f|l)?))|an(f|l)?)|c(s(in(h(f|l)?|f|l)?|qrt(f|l)?)|cos(h(f)?|f|l)?|imag(f|l)?|t(ime|an(h(f|l)?|f|l)?)|o(s(h(f|l)?|f|l)?|nj(f|l)?|pysign(f|l)?)|p(ow(f|l)?|roj(f|l)?)|e(il(f|l)?|xp(f|l)?)|l(o(ck|g(f|l)?)|earerr)|a(sin(h(f|l)?|f|l)?|cos(h(f|l)?|f|l)?|tan(h(f|l)?|f|l)?|lloc|rg(f|l)?|bs(f|l)?)|real(f|l)?|brt(f|l)?)|t(ime|o(upper|lower)|an(h(f|l)?|f|l)?|runc(f|l)?|gamma(f|l)?|mp(nam|file))|i(s(space|n(ormal|an)|cntrl|inf|digit|u(nordered|pper)|p(unct|rint)|finite|w(space|c(ntrl|type)|digit|upper|p(unct|rint)|lower|al(num|pha)|graph|xdigit|blank)|l(ower|ess(equal|greater)?)|al(num|pha)|gr(eater(equal)?|aph)|xdigit|blank)|logb(f|l)?|max(div|abs))|di(v|fftime)|_Exit|unget(c|wc)|p(ow(f|l)?|ut(s|c(har)?|wc(har)?)|error|rintf)|e(rf(c(f|l)?|f|l)?|x(it|p(2(f|l)?|f|l|m1(f|l)?)?))|v(s(scanf|nprintf|canf|printf|w(scanf|printf))|printf|f(scanf|printf|w(scanf|printf))|w(scanf|printf)|a_(start|copy|end|arg))|qsort|f(s(canf|e(tpos|ek))|close|tell|open|dim(f|l)?|p(classify|ut(s|c|w(s|c))|rintf)|e(holdexcept|set(e(nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(aiseexcept|ror)|get(e(nv|xceptflag)|round))|flush|w(scanf|ide|printf|rite)|loor(f|l)?|abs(f|l)?|get(s|c|pos|w(s|c))|re(open|e|ad|xp(f|l)?)|m(in(f|l)?|od(f|l)?|a(f|l|x(f|l)?)?))|l(d(iv|exp(f|l)?)|o(ngjmp|cal(time|econv)|g(1(p(f|l)?|0(f|l)?)|2(f|l)?|f|l|b(f|l)?)?)|abs|l(div|abs|r(int(f|l)?|ound(f|l)?))|r(int(f|l)?|ound(f|l)?)|gamma(f|l)?)|w(scanf|c(s(s(tr|pn)|nc(py|at|mp)|c(spn|hr|oll|py|at|mp)|to(imax|d|u(l(l)?|max)|k|f|l(d|l)?|mbs)|pbrk|ftime|len|r(chr|tombs)|xfrm)|to(b|mb)|rtomb)|printf|mem(set|c(hr|py|mp)|move))|a(s(sert|ctime|in(h(f|l)?|f|l)?)|cos(h(f|l)?|f|l)?|t(o(i|f|l(l)?)|exit|an(h(f|l)?|2(f|l)?|f|l)?)|b(s|ort))|g(et(s|c(har)?|env|wc(har)?)|mtime)|r(int(f|l)?|ound(f|l)?|e(name|alloc|wind|m(ove|quo(f|l)?|ainder(f|l)?))|a(nd|ise))|b(search|towc)|m(odf(f|l)?|em(set|c(hr|py|mp)|move)|ktime|alloc|b(s(init|towcs|rtowcs)|towc|len|r(towc|len))))\\b" + }, + { + "captures": { + "1": { + "name": "punctuation.whitespace.function-call.leading.objcpp" + }, + "2": { + "name": "support.function.any-method.objcpp" + }, + "3": { + "name": "punctuation.definition.parameters.objcpp" + } + }, + "match": "(?x) (?: (?= \\s ) (?:(?<=else|new|return) | (?[a-zA-Z_$][\\w$]*))\t # macro name\n(?:\n (\\()\n\t(\n\t \\s* \\g \\s*\t\t # first argument\n\t ((,) \\s* \\g \\s*)* # additional arguments\n\t (?:\\.\\.\\.)?\t\t\t# varargs ellipsis?\n\t)\n (\\))\n)?", + "beginCaptures": { + "1": { + "name": "keyword.control.directive.define.objcpp" + }, + "2": { + "name": "punctuation.definition.directive.objcpp" + }, + "3": { + "name": "entity.name.function.preprocessor.objcpp" + }, + "5": { + "name": "punctuation.definition.parameters.begin.objcpp" + }, + "6": { + "name": "variable.parameter.preprocessor.objcpp" + }, + "8": { + "name": "punctuation.separator.parameters.objcpp" + }, + "9": { + "name": "punctuation.definition.parameters.end.objcpp" + } + }, + "end": "(?=(?://|/\\*))|(?", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objcpp" + } + }, + "name": "string.quoted.other.lt-gt.include.objcpp" + } + ] + }, + { + "include": "#pragma-mark" + }, + { + "begin": "^\\s*((#)\\s*line)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.directive.line.objcpp" + }, + "2": { + "name": "punctuation.definition.directive.objcpp" + } + }, + "end": "(?=(?://|/\\*))|(?\\]\\)]))\\s*([a-zA-Z_]\\w*)\\s*(?=(?:\\[\\]\\s*)?(?:,|\\)))", + "captures": { + "1": { + "name": "variable.parameter.probably.objcpp" + } + } + }, + "access-method": { + "name": "meta.function-call.member.objcpp", + "begin": "([a-zA-Z_][a-zA-Z_0-9]*|(?<=[\\]\\)]))\\s*(?:(\\.)|(->))((?:(?:[a-zA-Z_][a-zA-Z_0-9]*)\\s*(?:(?:\\.)|(?:->)))*)\\s*([a-zA-Z_][a-zA-Z_0-9]*)(\\()", + "beginCaptures": { + "1": { + "name": "variable.object.objcpp" + }, + "2": { + "name": "punctuation.separator.dot-access.objcpp" + }, + "3": { + "name": "punctuation.separator.pointer-access.objcpp" + }, + "4": { + "patterns": [ + { + "match": "\\.", + "name": "punctuation.separator.dot-access.objcpp" + }, + { + "match": "->", + "name": "punctuation.separator.pointer-access.objcpp" + }, + { + "match": "[a-zA-Z_][a-zA-Z_0-9]*", + "name": "variable.object.objcpp" + }, + { + "name": "everything.else.objcpp", + "match": ".+" + } + ] + }, + "5": { + "name": "entity.name.function.member.objcpp" + }, + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.function.member.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.function.member.objcpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards" + } + ] + }, + "block": { + "patterns": [ + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.objcpp" + } + }, + "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)", + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.objcpp" + } + }, + "name": "meta.block.objcpp", + "patterns": [ + { + "include": "#block_innards" + } + ] + } + ] + }, + "block_innards": { + "patterns": [ + { + "include": "#preprocessor-rule-enabled-block" + }, + { + "include": "#preprocessor-rule-disabled-block" + }, + { + "include": "#preprocessor-rule-conditional-block" + }, + { + "include": "#method_access" + }, + { + "include": "#member_access" + }, + { + "include": "#c_function_call" + }, + { + "name": "meta.initialization.objcpp", + "begin": "(?x)\n(?:\n (?:\n\t(?=\\s)(?=+!]+ | \\(\\) | \\[\\]))\n)\n\\s*(\\() # opening bracket", + "beginCaptures": { + "1": { + "name": "variable.other.objcpp" + }, + "2": { + "name": "punctuation.section.parens.begin.bracket.round.initialization.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.initialization.objcpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards" + } + ] + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.objcpp" + } + }, + "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)", + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.objcpp" + } + }, + "patterns": [ + { + "include": "#block_innards" + } + ] + }, + { + "include": "#parens-block" + }, + { + "include": "$base" + } + ] + }, + "c_function_call": { + "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(?=\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*\\( # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", + "end": "(?<=\\))(?!\\w)", + "name": "meta.function-call.objcpp", + "patterns": [ + { + "include": "#function-call-innards" + } + ] + }, + "comments": { + "patterns": [ + { + "captures": { + "1": { + "name": "meta.toc-list.banner.block.objcpp" + } + }, + "match": "^/\\* =(\\s*.*?)\\s*= \\*/$\\n?", + "name": "comment.block.objcpp" + }, + { + "begin": "/\\*", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.begin.objcpp" + } + }, + "end": "\\*/", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.end.objcpp" + } + }, + "name": "comment.block.objcpp" + }, + { + "captures": { + "1": { + "name": "meta.toc-list.banner.line.objcpp" + } + }, + "match": "^// =(\\s*.*?)\\s*=\\s*$\\n?", + "name": "comment.line.banner.objcpp" + }, + { + "begin": "(^[ \\t]+)?(?=//)", + "beginCaptures": { + "1": { + "name": "punctuation.whitespace.comment.leading.objcpp" + } + }, + "end": "(?!\\G)", + "patterns": [ + { + "begin": "//", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.objcpp" + } + }, + "end": "(?=\\n)", + "name": "comment.line.double-slash.objcpp", + "patterns": [ + { + "include": "#line_continuation_character" + } + ] + } + ] + } + ] + }, + "disabled": { + "begin": "^\\s*#\\s*if(n?def)?\\b.*$", + "end": "^\\s*#\\s*endif\\b", + "patterns": [ + { + "include": "#disabled" + }, + { + "include": "#pragma-mark" + } + ] + }, + "line_continuation_character": { + "patterns": [ + { + "match": "(\\\\)\\n", + "captures": { + "1": { + "name": "constant.character.escape.line-continuation.objcpp" + } + } + } + ] + }, + "parens": { + "name": "meta.parens.objcpp", + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.objcpp" + } + }, + "patterns": [ + { + "include": "$base" + } + ] + }, + "parens-block": { + "name": "meta.parens.block.objcpp", + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.objcpp" + } + }, + "patterns": [ + { + "include": "#block_innards" + }, + { + "match": "(?-mix:(?>=|\\|=", + "name": "keyword.operator.assignment.compound.bitwise.objcpp" + }, + { + "match": "<<|>>", + "name": "keyword.operator.bitwise.shift.objcpp" + }, + { + "match": "!=|<=|>=|==|<|>", + "name": "keyword.operator.comparison.objcpp" + }, + { + "match": "&&|!|\\|\\|", + "name": "keyword.operator.logical.objcpp" + }, + { + "match": "&|\\||\\^|~", + "name": "keyword.operator.objcpp" + }, + { + "match": "=", + "name": "keyword.operator.assignment.objcpp" + }, + { + "match": "%|\\*|/|-|\\+", + "name": "keyword.operator.objcpp" + }, + { + "begin": "(\\?)", + "beginCaptures": { + "1": { + "name": "keyword.operator.ternary.objcpp" + } + }, + "end": "(:)", + "endCaptures": { + "1": { + "name": "keyword.operator.ternary.objcpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards" + }, + { + "include": "$base" + } + ] + } + ] + }, + "strings": { + "patterns": [ + { + "begin": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.objcpp" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objcpp" + } + }, + "name": "string.quoted.double.objcpp", + "patterns": [ + { + "include": "#string_escaped_char" + }, + { + "include": "#string_placeholder" + }, + { + "include": "#line_continuation_character" + } + ] + }, + { + "begin": "'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.objcpp" + } + }, + "end": "'", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objcpp" + } + }, + "name": "string.quoted.single.objcpp", + "patterns": [ + { + "include": "#string_escaped_char" + }, + { + "include": "#line_continuation_character" + } + ] + } + ] + }, + "string_escaped_char": { + "patterns": [ + { + "match": "(?x)\\\\ (\n\\\\\t\t\t |\n[abefnprtv'\"?] |\n[0-3]\\d{,2}\t |\n[4-7]\\d?\t\t|\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )", + "name": "constant.character.escape.objcpp" + }, + { + "match": "\\\\.", + "name": "invalid.illegal.unknown-escape.objcpp" + } + ] + }, + "string_placeholder": { + "patterns": [ + { + "match": "(?x) %\n(\\d+\\$)?\t\t\t\t\t\t # field (argument #)\n[#0\\- +']*\t\t\t\t\t\t # flags\n[,;:_]?\t\t\t\t\t\t\t # separator character (AltiVec)\n((-?\\d+)|\\*(-?\\d+\\$)?)?\t\t # minimum field width\n(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)?\t# precision\n(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier\n[diouxXDOUeEfFgGaACcSspn%]\t\t # conversion type", + "name": "constant.other.placeholder.objcpp" + }, + { + "match": "(%)(?!\"\\s*(PRI|SCN))", + "captures": { + "1": { + "name": "invalid.illegal.placeholder.objcpp" + } + } + } + ] + }, + "storage_types": { + "patterns": [ + { + "match": "(?-mix:(?=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", + "end": "(?<=\\))(?!\\w)|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.name.function.objcpp" + }, + "2": { + "name": "punctuation.section.arguments.begin.bracket.round.objcpp" + } + }, + "end": "(\\))|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.name.function.objcpp" + }, + "2": { + "name": "punctuation.section.parameters.begin.bracket.round.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parameters.end.bracket.round.objcpp" + } + }, + "patterns": [ + { + "include": "#probably_a_parameter" + }, + { + "include": "#function-innards" + } + ] + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.objcpp" + } + }, + "patterns": [ + { + "include": "#function-innards" + } + ] + }, + { + "include": "$base" + } + ] + }, + "function-call-innards": { + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#storage_types" + }, + { + "include": "#method_access" + }, + { + "include": "#member_access" + }, + { + "include": "#operators" + }, + { + "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.name.function.objcpp" + }, + "2": { + "name": "punctuation.section.arguments.begin.bracket.round.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.objcpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards" + } + ] + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.objcpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards" + } + ] + }, + { + "include": "#block_innards" + } + ] + }, + "default_statement": { + "name": "meta.conditional.case.objcpp", + "begin": "((?\\[\\]=]))", + "patterns": [ + { + "name": "meta.head.switch.objcpp", + "begin": "\\G ?", + "end": "((?:\\{|(?=;)))", + "endCaptures": { + "1": { + "name": "punctuation.section.block.begin.bracket.curly.switch.objcpp" + } + }, + "patterns": [ + { + "include": "#switch_conditional_parentheses" + }, + { + "include": "$base" + } + ] + }, + { + "name": "meta.body.switch.objcpp", + "begin": "(?<=\\{)", + "end": "(\\})", + "endCaptures": { + "1": { + "name": "punctuation.section.block.end.bracket.curly.switch.objcpp" + } + }, + "patterns": [ + { + "include": "#default_statement" + }, + { + "include": "#case_statement" + }, + { + "include": "$base" + }, + { + "include": "#block_innards" + } + ] + }, + { + "name": "meta.tail.switch.objcpp", + "begin": "(?<=})[\\s\\n]*", + "end": "[\\s\\n]*(?=;)", + "patterns": [ + { + "include": "$base" + } + ] + } + ] + }, + "switch_conditional_parentheses": { + "name": "meta.conditional.switch.objcpp", + "begin": "(\\()", + "beginCaptures": { + "1": { + "name": "punctuation.section.parens.begin.bracket.round.conditional.switch.objcpp" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.section.parens.end.bracket.round.conditional.switch.objcpp" + } + }, + "patterns": [ + { + "include": "#conditional_context" + } + ] + }, + "static_assert": { + "begin": "(static_assert|_Static_assert)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.other.static_assert.objcpp" + }, + "2": { + "name": "punctuation.section.arguments.begin.bracket.round.objcpp" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.section.arguments.end.bracket.round.objcpp" + } + }, + "patterns": [ + { + "name": "meta.static_assert.message.objcpp", + "begin": "(,)\\s*(?=(?:L|u8|u|U\\s*\\\")?)", + "beginCaptures": { + "1": { + "name": "punctuation.separator.delimiter.objcpp" + } + }, + "end": "(?=\\))", + "patterns": [ + { + "include": "#string_context" + }, + { + "include": "#string_context_c" + } + ] + }, + { + "include": "#function_call_context" + } + ] + }, + "conditional_context": { + "patterns": [ + { + "include": "$base" + }, + { + "include": "#block_innards" + } + ] + }, + "member_access": { + "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!(?:void|char|short|int|signed|unsigned|long|float|double|bool|_Bool|_Complex|_Imaginary|u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t|pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t|memory_order|atomic_bool|atomic_char|atomic_schar|atomic_uchar|atomic_short|atomic_ushort|atomic_int|atomic_uint|atomic_long|atomic_ulong|atomic_llong|atomic_ullong|atomic_char16_t|atomic_char32_t|atomic_wchar_t|atomic_int_least8_t|atomic_uint_least8_t|atomic_int_least16_t|atomic_uint_least16_t|atomic_int_least32_t|atomic_uint_least32_t|atomic_int_least64_t|atomic_uint_least64_t|atomic_int_fast8_t|atomic_uint_fast8_t|atomic_int_fast16_t|atomic_uint_fast16_t|atomic_int_fast32_t|atomic_uint_fast32_t|atomic_int_fast64_t|atomic_uint_fast64_t|atomic_intptr_t|atomic_uintptr_t|atomic_size_t|atomic_ptrdiff_t|atomic_intmax_t|atomic_uintmax_t))[a-zA-Z_]\\w*\\b(?!\\())", + "captures": { + "1": { + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objcpp", + "match": "(.+)" + } + ] + }, + "2": { + "name": "punctuation.separator.dot-access.objcpp" + }, + "3": { + "name": "punctuation.separator.pointer-access.objcpp" + }, + "4": { + "patterns": [ + { + "include": "#member_access" + }, + { + "include": "#method_access" + }, + { + "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))", + "captures": { + "1": { + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objcpp", + "match": "(.+)" + } + ] + }, + "2": { + "name": "punctuation.separator.dot-access.objcpp" + }, + "3": { + "name": "punctuation.separator.pointer-access.objcpp" + } + } + } + ] + }, + "5": { + "name": "variable.other.member.objcpp" + } + } + }, + "method_access": { + "contentName": "meta.function-call.member.objcpp", + "begin": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*([a-zA-Z_]\\w*)(\\()", + "beginCaptures": { + "1": { + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objcpp", + "match": "(.+)" + } + ] + }, + "2": { + "name": "punctuation.separator.dot-access.objcpp" + }, + "3": { + "name": "punctuation.separator.pointer-access.objcpp" + }, + "4": { + "patterns": [ + { + "include": "#member_access" + }, + { + "include": "#method_access" + }, + { + "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))", + "captures": { + "1": { + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objcpp", + "match": "(.+)" + } + ] + }, + "2": { + "name": "punctuation.separator.dot-access.objcpp" + }, + "3": { + "name": "punctuation.separator.pointer-access.objcpp" + } + } + } + ] + }, + "5": { + "name": "entity.name.function.member.objcpp" + }, + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.function.member.objcpp" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.section.arguments.end.bracket.round.function.member.objcpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards" + } + ] + }, + "numbers": { + "begin": "(?\\\\\\s*\\n)", + "name": "punctuation.separator.continuation.objcpp" + } + ] + } + ] + } + ] + }, + "cpp_lang": { + "patterns": [ + { + "include": "#special_block" + }, + { + "include": "#strings" + }, + { + "match": "\\b(friend|explicit|virtual|override|final|noexcept)\\b", + "name": "storage.modifier.objcpp" + }, + { + "match": "\\b(private:|protected:|public:)", + "name": "storage.type.modifier.access.objcpp" + }, + { + "match": "\\b(catch|try|throw|using)\\b", + "name": "keyword.control.objcpp" + }, + { + "match": "\\bdelete\\b(\\s*\\[\\])?|\\bnew\\b(?!])", + "name": "keyword.control.objcpp" + }, + { + "match": "\\b(f|m)[A-Z]\\w*\\b", + "name": "variable.other.readwrite.member.objcpp" + }, + { + "match": "\\bthis\\b", + "name": "variable.language.this.objcpp" + }, + { + "match": "\\bnullptr\\b", + "name": "constant.language.objcpp" + }, + { + "include": "#template_definition" + }, + { + "match": "\\btemplate\\b\\s*", + "name": "storage.type.template.objcpp" + }, + { + "match": "\\b(const_cast|dynamic_cast|reinterpret_cast|static_cast)\\b\\s*", + "name": "keyword.operator.cast.objcpp" + }, + { + "name": "punctuation.separator.namespace.access.objcpp", + "match": "((?:[a-zA-Z_][a-zA-Z_0-9]*::)*)([a-zA-Z_][a-zA-Z_0-9]*)(::)", + "captures": { + "1": { + "name": "entity.scope.objcpp" + }, + "2": { + "name": "entity.scope.name.objcpp" + }, + "3": { + "name": "punctuation.separator.namespace.access.objcpp" + } + } + }, + { + "match": "\\b(and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\b", + "name": "keyword.operator.objcpp" + }, + { + "match": "\\b(decltype|wchar_t|char16_t|char32_t)\\b", + "name": "storage.type.objcpp" + }, + { + "match": "\\b(constexpr|export|mutable|typename|thread_local)\\b", + "name": "storage.modifier.objcpp" + }, + { + "begin": "(?x)\n(?:\n ^ | # beginning of line\n (?:(?", + "endCaptures": { + "0": { + "name": "meta.template.angle-brackets.end.objcpp" + } + }, + "name": "template.definition.objcpp", + "patterns": [ + { + "include": "#template_definition_argument" + } + ] + }, + "template_definition_argument": { + "match": "\\s*(?:([a-zA-Z_][a-zA-Z_0-9]*\\s*)|((?:[a-zA-Z_][a-zA-Z_0-9]*\\s+)*)([a-zA-Z_][a-zA-Z_0-9]*)|([a-zA-Z_][a-zA-Z_0-9]*)\\s*(\\.\\.\\.)\\s*([a-zA-Z_][a-zA-Z_0-9]*)|((?:[a-zA-Z_][a-zA-Z_0-9]*\\s+)*)([a-zA-Z_][a-zA-Z_0-9]*)\\s*(=)\\s*(\\w+))(,|(?=>))", + "captures": { + "1": { + "name": "storage.type.template.objcpp" + }, + "2": { + "name": "storage.type.template.objcpp" + }, + "3": { + "name": "entity.name.type.template.objcpp" + }, + "4": { + "name": "storage.type.template.objcpp" + }, + "5": { + "name": "meta.template.operator.ellipsis.objcpp" + }, + "6": { + "name": "entity.name.type.template.objcpp" + }, + "7": { + "name": "storage.type.template.objcpp" + }, + "8": { + "name": "entity.name.type.template.objcpp" + }, + "9": { + "name": "keyword.operator.assignment.objcpp" + }, + "10": { + "name": "constant.language.objcpp" + }, + "11": { + "name": "meta.template.operator.comma.objcpp" + } + } + }, + "angle_brackets": { + "begin": "<", + "end": ">", + "name": "meta.angle-brackets.objcpp", + "patterns": [ + { + "include": "#angle_brackets" + }, + { + "include": "$base" + } + ] + }, + "block": { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.objcpp" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.objcpp" + } + }, + "name": "meta.block.objcpp", + "patterns": [ + { + "captures": { + "1": { + "name": "support.function.any-method.objcpp" + }, + "2": { + "name": "punctuation.definition.parameters.objcpp" + } + }, + "match": "(?x)\n(\n (?!while|for|do|if|else|switch|catch|enumerate|return|r?iterate)\n (?:\\b[A-Za-z_][A-Za-z0-9_]*+\\b|::)*+ # actual name\n)\n\\s*(\\() # opening bracket", + "name": "meta.function-call.objcpp" + }, + { + "include": "$base" + } + ] + }, + "constructor": { + "patterns": [ + { + "begin": "(?x)\n(?:^\\s*) # beginning of line\n((?!while|for|do|if|else|switch|catch|enumerate|r?iterate)[A-Za-z_][A-Za-z0-9_:]*) # actual name\n\\s*(\\() # opening bracket", + "beginCaptures": { + "1": { + "name": "entity.name.function.constructor.objcpp" + }, + "2": { + "name": "punctuation.definition.parameters.begin.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.end.objcpp" + } + }, + "name": "meta.function.constructor.objcpp", + "patterns": [ + { + "include": "#probably_a_parameter" + }, + { + "include": "#function-innards" + } + ] + }, + { + "begin": "(?x)\n(:)\n(\n (?=\n \\s*[A-Za-z_][A-Za-z0-9_:]* # actual name\n \\s* (\\() # opening bracket\n )\n)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.parameters.objcpp" + } + }, + "end": "(?=\\{)", + "name": "meta.function.constructor.initializer-list.objcpp", + "patterns": [ + { + "include": "$base" + } + ] + } + ] + }, + "special_block": { + "patterns": [ + { + "begin": "\\b(using)\\b\\s*(namespace)\\b\\s*((?:[_A-Za-z][_A-Za-z0-9]*\\b(::)?)*)", + "beginCaptures": { + "1": { + "name": "keyword.control.objcpp" + }, + "2": { + "name": "storage.type.namespace.objcpp" + }, + "3": { + "name": "entity.name.type.objcpp" + } + }, + "end": ";", + "endCaptures": { + "0": { + "name": "punctuation.terminator.statement.objcpp" + } + }, + "name": "meta.using-namespace-declaration.objcpp" + }, + { + "begin": "\\b(namespace)\\b\\s*([_A-Za-z][_A-Za-z0-9]*\\b)?+", + "beginCaptures": { + "1": { + "name": "storage.type.namespace.objcpp" + }, + "2": { + "name": "entity.name.type.objcpp" + } + }, + "captures": { + "1": { + "name": "keyword.control.namespace.$2.objcpp" + } + }, + "end": "(?<=\\})|(?=(;|,|\\(|\\)|>|\\[|\\]|=))", + "name": "meta.namespace-block.objcpp", + "patterns": [ + { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.scope.objcpp" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.definition.scope.objcpp" + } + }, + "patterns": [ + { + "include": "#special_block" + }, + { + "include": "#constructor" + }, + { + "include": "$base" + } + ] + }, + { + "include": "$base" + } + ] + }, + { + "begin": "\\b(?:(class)|(struct))\\b\\s*([_A-Za-z][_A-Za-z0-9]*\\b)?+(\\s*:\\s*(public|protected|private)\\s*([_A-Za-z][_A-Za-z0-9]*\\b)((\\s*,\\s*(public|protected|private)\\s*[_A-Za-z][_A-Za-z0-9]*\\b)*))?", + "beginCaptures": { + "1": { + "name": "storage.type.class.objcpp" + }, + "2": { + "name": "storage.type.struct.objcpp" + }, + "3": { + "name": "entity.name.type.objcpp" + }, + "5": { + "name": "storage.type.modifier.access.objcpp" + }, + "6": { + "name": "entity.name.type.inherited.objcpp" + }, + "7": { + "patterns": [ + { + "match": "(public|protected|private)", + "name": "storage.type.modifier.access.objcpp" + }, + { + "match": "[_A-Za-z][_A-Za-z0-9]*", + "name": "entity.name.type.inherited.objcpp" + } + ] + } + }, + "end": "(?<=\\})|(?=(;|\\(|\\)|>|\\[|\\]|=))", + "name": "meta.class-struct-block.objcpp", + "patterns": [ + { + "include": "#angle_brackets" + }, + { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.objcpp" + } + }, + "end": "(\\})(\\s*\\n)?", + "endCaptures": { + "1": { + "name": "punctuation.section.block.end.bracket.curly.objcpp" + }, + "2": { + "name": "invalid.illegal.you-forgot-semicolon.objcpp" + } + }, + "patterns": [ + { + "include": "#special_block" + }, + { + "include": "#constructor" + }, + { + "include": "$base" + } + ] + }, + { + "include": "$base" + } + ] + }, + { + "begin": "\\b(extern)(?=\\s*\")", + "beginCaptures": { + "1": { + "name": "storage.modifier.objcpp" + } + }, + "end": "(?<=\\})|(?=\\w)|(?=\\s*#\\s*endif\\b)", + "name": "meta.extern-block.objcpp", + "patterns": [ + { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.objcpp" + } + }, + "end": "\\}|(?=\\s*#\\s*endif\\b)", + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.objcpp" + } + }, + "patterns": [ + { + "include": "#special_block" + }, + { + "include": "$base" + } + ] + }, + { + "include": "$base" + } + ] + } + ] + }, + "strings": { + "patterns": [ + { + "begin": "(u|u8|U|L)?\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.objcpp" + }, + "1": { + "name": "meta.encoding.objcpp" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objcpp" + } + }, + "name": "string.quoted.double.objcpp", + "patterns": [ + { + "match": "\\\\u\\h{4}|\\\\U\\h{8}", + "name": "constant.character.escape.objcpp" + }, + { + "match": "\\\\['\"?\\\\abfnrtv]", + "name": "constant.character.escape.objcpp" + }, + { + "match": "\\\\[0-7]{1,3}", + "name": "constant.character.escape.objcpp" + }, + { + "match": "\\\\x\\h+", + "name": "constant.character.escape.objcpp" + }, + { + "include": "#string_placeholder" + } + ] + }, + { + "begin": "(u|u8|U|L)?R\"(?:([^ ()\\\\\\t]{0,16})|([^ ()\\\\\\t]*))\\(", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.objcpp" + }, + "1": { + "name": "meta.encoding.objcpp" + }, + "3": { + "name": "invalid.illegal.delimiter-too-long.objcpp" + } + }, + "end": "\\)\\2(\\3)\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objcpp" + }, + "1": { + "name": "invalid.illegal.delimiter-too-long.objcpp" + } + }, + "name": "string.quoted.double.raw.objcpp" + } + ] + } + } + }, + "cpp_lang_newish": { + "patterns": [ + { + "include": "#special_block" + }, + { + "match": "(?-mix:##[a-zA-Z_]\\w*(?!\\w))", + "name": "variable.other.macro.argument.objcpp" + }, + { + "include": "#strings" + }, + { + "match": "(?[a-zA-Z_$][\\w$]*))\t # macro name\n(?:\n (\\()\n\t(\n\t \\s* \\g \\s*\t\t # first argument\n\t ((,) \\s* \\g \\s*)* # additional arguments\n\t (?:\\.\\.\\.)?\t\t\t# varargs ellipsis?\n\t)\n (\\))\n)?", + "beginCaptures": { + "1": { + "name": "keyword.control.directive.define.objcpp" + }, + "2": { + "name": "punctuation.definition.directive.objcpp" + }, + "3": { + "name": "entity.name.function.preprocessor.objcpp" + }, + "5": { + "name": "punctuation.definition.parameters.begin.objcpp" + }, + "6": { + "name": "variable.parameter.preprocessor.objcpp" + }, + "8": { + "name": "punctuation.separator.parameters.objcpp" + }, + "9": { + "name": "punctuation.definition.parameters.end.objcpp" + } + }, + "end": "(?=(?://|/\\*))|(?", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objcpp" + } + }, + "name": "string.quoted.other.lt-gt.include.objcpp" + } + ] + }, + { + "include": "#pragma-mark" + }, + { + "begin": "^\\s*((#)\\s*line)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.directive.line.objcpp" + }, + "2": { + "name": "punctuation.definition.directive.objcpp" + } + }, + "end": "(?=(?://|/\\*))|(?,\\w])*>\\s*", + "captures": { + "0": { + "name": "meta.template.call.objcpp", + "patterns": [ + { + "include": "#storage_types_c" + }, + { + "include": "#constants" + }, + { + "include": "#scope_resolution" + }, + { + "match": "(?))", + "endCaptures": { + "1": { + "name": "punctuation.section.angle-brackets.end.template.definition.objcpp" + } + }, + "patterns": [ + { + "include": "#scope_resolution" + }, + { + "include": "#template_definition_argument" + }, + { + "include": "#template_call_innards" + } + ] + }, + "template_definition_argument": { + "match": "((?:(?:(?:(?:(?:(?:\\s*([a-zA-Z_]\\w*)|((?:[a-zA-Z_]\\w*\\s+)+)([a-zA-Z_]\\w*)))|([a-zA-Z_]\\w*)\\s*(\\.\\.\\.)\\s*([a-zA-Z_]\\w*)))|((?:[a-zA-Z_]\\w*\\s+)*)([a-zA-Z_]\\w*)\\s*([=])\\s*(\\w+)))\\s*(?:(?:(,)|(?=>))))", + "captures": { + "2": { + "name": "storage.type.template.argument.$1.objcpp" + }, + "3": { + "name": "storage.type.template.argument.$2.objcpp" + }, + "4": { + "name": "entity.name.type.template.objcpp" + }, + "5": { + "name": "storage.type.template.objcpp" + }, + "6": { + "name": "keyword.operator.ellipsis.template.definition.objcpp" + }, + "7": { + "name": "entity.name.type.template.objcpp" + }, + "8": { + "name": "storage.type.template.objcpp" + }, + "9": { + "name": "entity.name.type.template.objcpp" + }, + "10": { + "name": "keyword.operator.assignment.objcpp" + }, + "11": { + "name": "constant.other.objcpp" + }, + "12": { + "name": "punctuation.separator.comma.template.argument.objcpp" + } + } + }, + "scope_resolution": { + "match": "((?:[a-zA-Z_]\\w*\\s*(?:(?:<(?:[\\s<>,\\w])*>\\s*))?::)*\\s*)([a-zA-Z_]\\w*)\\s*((?:<(?:[\\s<>,\\w])*>\\s*))?(::)", + "captures": { + "1": { + "patterns": [ + { + "include": "#scope_resolution" + } + ] + }, + "2": { + "name": "entity.name.namespace.scope-resolution.objcpp" + }, + "3": { + "patterns": [ + { + "include": "#template_call_innards" + } + ] + }, + "4": { + "name": "punctuation.separator.namespace.access.objcpp" + } + }, + "name": "meta.scope-resolution.objcpp" + }, + "angle_brackets": { + "begin": "<", + "end": ">", + "name": "meta.angle-brackets.objcpp", + "patterns": [ + { + "include": "#angle_brackets" + }, + { + "include": "$base" + } + ] + }, + "block": { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.objcpp" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.objcpp" + } + }, + "name": "meta.block.objcpp", + "patterns": [ + { + "captures": { + "1": { + "name": "support.function.any-method.objcpp" + }, + "2": { + "name": "punctuation.definition.parameters.objcpp" + } + }, + "match": "(?x)\n(\n (?!while|for|do|if|else|switch|catch|return)\n (?:\\b[A-Za-z_][A-Za-z0-9_]*+\\b|::)*+ # actual name\n)\n\\s*(\\() # opening bracket", + "name": "meta.function-call.objcpp" + }, + { + "include": "$base" + } + ] + }, + "constructor": { + "patterns": [ + { + "begin": "(?x)\n(?:^\\s*) # beginning of line\n((?!while|for|do|if|else|switch|catch)[A-Za-z_][A-Za-z0-9_:]*) # actual name\n\\s*(\\() # opening bracket", + "beginCaptures": { + "1": { + "name": "entity.name.function.constructor.objcpp" + }, + "2": { + "name": "punctuation.definition.parameters.begin.constructor.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.end.constructor.objcpp" + } + }, + "name": "meta.function.constructor.objcpp", + "patterns": [ + { + "include": "#probably_a_parameter" + }, + { + "include": "#function-innards-c" + } + ] + }, + { + "begin": "(?x)\n(:)\n(\n (?=\n \\s*[A-Za-z_][A-Za-z0-9_:]* # actual name\n \\s* (\\() # opening bracket\n )\n)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.initializer-list.parameters.objcpp" + } + }, + "end": "(?=\\{)", + "name": "meta.function.constructor.initializer-list.objcpp", + "patterns": [ + { + "include": "$base" + } + ] + } + ] + }, + "special_block": { + "patterns": [ + { + "comment": "https://en.cppreference.com/w/cpp/language/namespace", + "begin": "\\b(using)\\s+(namespace)\\s+(?:((?:[a-zA-Z_]\\w*\\s*(?:(?:<(?:[\\s<>,\\w])*>\\s*))?::)*)\\s*)?((?,\\w])*>\\s*))?::)*[a-zA-Z_]\\w*)|(?={)))", + "beginCaptures": { + "1": { + "name": "keyword.other.namespace.definition.objcpp storage.type.namespace.definition.objcpp" + }, + "2": { + "patterns": [ + { + "match": "(?-mix:(?|\\[|\\]|=))", + "name": "meta.namespace-block.objcpp", + "patterns": [ + { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.scope.objcpp" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.definition.scope.objcpp" + } + }, + "patterns": [ + { + "include": "#special_block" + }, + { + "include": "#constructor" + }, + { + "include": "$base" + } + ] + }, + { + "include": "$base" + } + ] + }, + { + "begin": "\\b(?:(class)|(struct))\\b\\s*([_A-Za-z][_A-Za-z0-9]*\\b)?+(\\s*:\\s*(public|protected|private)\\s*([_A-Za-z][_A-Za-z0-9]*\\b)((\\s*,\\s*(public|protected|private)\\s*[_A-Za-z][_A-Za-z0-9]*\\b)*))?", + "beginCaptures": { + "1": { + "name": "storage.type.class.objcpp" + }, + "2": { + "name": "storage.type.struct.objcpp" + }, + "3": { + "name": "entity.name.type.objcpp" + }, + "5": { + "name": "storage.type.modifier.access.objcpp" + }, + "6": { + "name": "entity.name.type.inherited.objcpp" + }, + "7": { + "patterns": [ + { + "match": "(public|protected|private)", + "name": "storage.type.modifier.access.objcpp" + }, + { + "match": "[_A-Za-z][_A-Za-z0-9]*", + "name": "entity.name.type.inherited.objcpp" + } + ] + } + }, + "end": "(?<=\\})|(;)|(?=(\\(|\\)|>|\\[|\\]|=))", + "endCaptures": { + "1": { + "name": "punctuation.terminator.statement.objcpp" + } + }, + "name": "meta.class-struct-block.objcpp", + "patterns": [ + { + "include": "#angle_brackets" + }, + { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.objcpp" + } + }, + "end": "(\\})(\\s*\\n)?", + "endCaptures": { + "1": { + "name": "punctuation.section.block.end.bracket.curly.objcpp" + }, + "2": { + "name": "invalid.illegal.you-forgot-semicolon.objcpp" + } + }, + "patterns": [ + { + "include": "#special_block" + }, + { + "include": "#constructor" + }, + { + "include": "$base" + } + ] + }, + { + "include": "$base" + } + ] + }, + { + "begin": "\\b(extern)(?=\\s*\")", + "beginCaptures": { + "1": { + "name": "storage.modifier.objcpp" + } + }, + "end": "(?<=\\})|(?=\\w)|(?=\\s*#\\s*endif\\b)", + "name": "meta.extern-block.objcpp", + "patterns": [ + { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.objcpp" + } + }, + "end": "\\}|(?=\\s*#\\s*endif\\b)", + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.objcpp" + } + }, + "patterns": [ + { + "include": "#special_block" + }, + { + "include": "$base" + } + ] + }, + { + "include": "$base" + } + ] + } + ] + }, + "strings": { + "patterns": [ + { + "begin": "(u|u8|U|L)?\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.objcpp" + }, + "1": { + "name": "meta.encoding.objcpp" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objcpp" + } + }, + "name": "string.quoted.double.objcpp", + "patterns": [ + { + "match": "\\\\u\\h{4}|\\\\U\\h{8}", + "name": "constant.character.escape.objcpp" + }, + { + "match": "\\\\['\"?\\\\abfnrtv]", + "name": "constant.character.escape.objcpp" + }, + { + "match": "\\\\[0-7]{1,3}", + "name": "constant.character.escape.objcpp" + }, + { + "match": "\\\\x\\h+", + "name": "constant.character.escape.objcpp" + }, + { + "include": "#string_placeholder-c" + } + ] + }, + { + "begin": "(u|u8|U|L)?R\"(?:([^ ()\\\\\\t]{0,16})|([^ ()\\\\\\t]*))\\(", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.objcpp" + }, + "1": { + "name": "meta.encoding.objcpp" + }, + "3": { + "name": "invalid.illegal.delimiter-too-long.objcpp" + } + }, + "end": "\\)\\2(\\3)\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objcpp" + }, + "1": { + "name": "invalid.illegal.delimiter-too-long.objcpp" + } + }, + "name": "string.quoted.double.raw.objcpp" + } + ] + }, + "probably_a_parameter": { + "match": "(?:(?:([a-zA-Z_]\\w*)\\s*(?==)|(?<=\\w\\s|\\*\\/|[&*>\\]\\)])\\s*([a-zA-Z_]\\w*)\\s*(?=(?:\\[\\]\\s*)?(?:(?:,|\\))))))", + "captures": { + "1": { + "name": "variable.parameter.probably.defaulted.objcpp" + }, + "2": { + "name": "variable.parameter.probably.objcpp" + } + } + }, + "operator_overload": { + "begin": "((?:[a-zA-Z_]\\w*\\s*(?:(?:<(?:[\\s<>,\\w])*>\\s*))?::)*)\\s*(operator)((?:(?:\\s*(?:\\+\\+|\\-\\-|\\(\\)|\\[\\]|\\->|\\+\\+|\\-\\-|\\+|\\-|!|~|\\*|&|\\->\\*|\\*|\\/|%|\\+|\\-|<<|>>|<=>|<|<=|>|>=|==|!=|&|\\^|\\||&&|\\|\\||=|\\+=|\\-=|\\*=|\\/=|%=|<<=|>>=|&=|\\^=|\\|=|,)|\\s+(?:(?:(?:new|new\\[\\]|delete|delete\\[\\])|(?:[a-zA-Z_]\\w*\\s*(?:(?:<(?:[\\s<>,\\w])*>\\s*))?::)*[a-zA-Z_]\\w*\\s*(?:&)?)))))\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.scope.objcpp" + }, + "2": { + "name": "keyword.other.operator.overload.objcpp" + }, + "3": { + "name": "entity.name.operator.overloadee.objcpp" + }, + "4": { + "name": "punctuation.section.parameters.begin.bracket.round.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parameters.end.bracket.round.objcpp" + } + }, + "name": "meta.function.definition.parameters.operator-overload.objcpp", + "patterns": [ + { + "include": "#probably_a_parameter" + }, + { + "include": "#function-innards-c" + } + ] + }, + "access-method": { + "name": "meta.function-call.member.objcpp", + "begin": "([a-zA-Z_][a-zA-Z_0-9]*|(?<=[\\]\\)]))\\s*(?:(\\.)|(->))((?:(?:[a-zA-Z_][a-zA-Z_0-9]*)\\s*(?:(?:\\.)|(?:->)))*)\\s*([a-zA-Z_][a-zA-Z_0-9]*)(\\()", + "beginCaptures": { + "1": { + "name": "variable.other.object.objcpp" + }, + "2": { + "name": "punctuation.separator.dot-access.objcpp" + }, + "3": { + "name": "punctuation.separator.pointer-access.objcpp" + }, + "4": { + "patterns": [ + { + "match": "\\.", + "name": "punctuation.separator.dot-access.objcpp" + }, + { + "match": "->", + "name": "punctuation.separator.pointer-access.objcpp" + }, + { + "match": "[a-zA-Z_][a-zA-Z_0-9]*", + "name": "variable.other.object.objcpp" + }, + { + "name": "everything.else.objcpp", + "match": ".+" + } + ] + }, + "5": { + "name": "entity.name.function.member.objcpp" + }, + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.function.member.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.function.member.objcpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards-c" + } + ] + }, + "access-member": { + "name": "variable.other.object.access.objcpp", + "match": "(?:(?:([a-zA-Z_]\\w*)|(?<=\\]|\\))))\\s*(?:(?:((?:(?:\\.|\\.\\*)))|((?:(?:->|->\\*)))))\\s*((?:[a-zA-Z_]\\w*\\s*(?:(?:\\.|->))\\s*)*)\\b(?!(?:auto|void|char|short|int|signed|unsigned|long|float|double|bool|wchar_t|u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t|pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t))([a-zA-Z_]\\w*)\\b(?!\\()", + "captures": { + "1": { + "name": "variable.other.object.objcpp" + }, + "2": { + "name": "punctuation.separator.dot-access.objcpp" + }, + "3": { + "name": "punctuation.separator.pointer-access.objcpp" + }, + "4": { + "patterns": [ + { + "match": "\\.", + "name": "punctuation.separator.dot-access.objcpp" + }, + { + "match": "->", + "name": "punctuation.separator.pointer-access.objcpp" + }, + { + "match": "[a-zA-Z_]\\w*", + "name": "variable.other.object.objcpp" + }, + { + "match": ".+", + "name": "everything.else.objcpp" + } + ] + }, + "5": { + "name": "variable.other.member.objcpp" + } + } + }, + "block-c": { + "patterns": [ + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.objcpp" + } + }, + "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)", + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.objcpp" + } + }, + "name": "meta.block.objcpp", + "patterns": [ + { + "include": "#block_innards-c" + } + ] + } + ] + }, + "block_innards-c": { + "patterns": [ + { + "include": "#preprocessor-rule-enabled-block" + }, + { + "include": "#preprocessor-rule-disabled-block" + }, + { + "include": "#preprocessor-rule-conditional-block" + }, + { + "include": "#access-method" + }, + { + "include": "#access-member" + }, + { + "include": "#c_function_call" + }, + { + "name": "meta.initialization.objcpp", + "begin": "(?x)\n(?:\n (?:\n\t(?=\\s)(?=+!]+ | \\(\\) | \\[\\]))\n)\n\\s*(\\() # opening bracket", + "beginCaptures": { + "1": { + "name": "variable.other.objcpp" + }, + "2": { + "name": "punctuation.section.parens.begin.bracket.round.initialization.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.initialization.objcpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards-c" + } + ] + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.objcpp" + } + }, + "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)", + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.objcpp" + } + }, + "patterns": [ + { + "include": "#block_innards-c" + } + ] + }, + { + "include": "#parens-block-c" + }, + { + "include": "$base" + } + ] + }, + "c_function_call": { + "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|return|typeid|alignof|alignas|sizeof|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(?=\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*(?:(?:<(?:[\\s<>,\\w])*>\\s*))?\\( # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", + "end": "(?<=\\))(?!\\w)", + "name": "meta.function-call.objcpp", + "patterns": [ + { + "include": "#function-call-innards-c" + } + ] + }, + "comments-c": { + "patterns": [ + { + "captures": { + "1": { + "name": "meta.toc-list.banner.block.objcpp" + } + }, + "match": "^/\\* =(\\s*.*?)\\s*= \\*/$\\n?", + "name": "comment.block.objcpp" + }, + { + "begin": "/\\*", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.begin.objcpp" + } + }, + "end": "\\*/", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.end.objcpp" + } + }, + "name": "comment.block.objcpp" + }, + { + "captures": { + "1": { + "name": "meta.toc-list.banner.line.objcpp" + } + }, + "match": "^// =(\\s*.*?)\\s*=\\s*$\\n?", + "name": "comment.line.banner.objcpp" + }, + { + "begin": "(^[ \\t]+)?(?=//)", + "beginCaptures": { + "1": { + "name": "punctuation.whitespace.comment.leading.objcpp" + } + }, + "end": "(?!\\G)", + "patterns": [ + { + "begin": "//", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.objcpp" + } + }, + "end": "(?=\\n)", + "name": "comment.line.double-slash.objcpp", + "patterns": [ + { + "include": "#line_continuation_character" + } + ] + } + ] + } + ] + }, + "disabled": { + "begin": "^\\s*#\\s*if(n?def)?\\b.*$", + "end": "^\\s*#\\s*endif\\b", + "patterns": [ + { + "include": "#disabled" + }, + { + "include": "#pragma-mark" + } + ] + }, + "line_continuation_character": { + "patterns": [ + { + "match": "(\\\\)\\n", + "captures": { + "1": { + "name": "constant.character.escape.line-continuation.objcpp" + } + } + } + ] + }, + "parens-c": { + "name": "punctuation.section.parens-c\b.objcpp", + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.objcpp" + } + }, + "patterns": [ + { + "include": "$base" + } + ] + }, + "parens-block-c": { + "name": "meta.block.parens.objcpp", + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.objcpp" + } + }, + "patterns": [ + { + "include": "#block_innards-c" + }, + { + "match": "(?>=|\\|=", + "name": "keyword.operator.assignment.compound.bitwise.objcpp" + }, + { + "match": "<<|>>", + "name": "keyword.operator.bitwise.shift.objcpp" + }, + { + "match": "!=|<=|>=|==|<|>", + "name": "keyword.operator.comparison.objcpp" + }, + { + "match": "&&|!|\\|\\|", + "name": "keyword.operator.logical.objcpp" + }, + { + "match": "&|\\||\\^|~", + "name": "keyword.operator.objcpp" + }, + { + "match": "=", + "name": "keyword.operator.assignment.objcpp" + }, + { + "match": "%|\\*|/|-|\\+", + "name": "keyword.operator.objcpp" + }, + { + "begin": "\\?", + "beginCaptures": { + "0": { + "name": "keyword.operator.ternary.objcpp" + } + }, + "end": ":", + "applyEndPatternLast": true, + "endCaptures": { + "0": { + "name": "keyword.operator.ternary.objcpp" + } + }, + "patterns": [ + { + "include": "#access-method" + }, + { + "include": "#access-member" + }, + { + "include": "#c_function_call" + }, + { + "include": "$base" + } + ] + } + ] + }, + "strings-c": { + "patterns": [ + { + "begin": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.objcpp" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objcpp" + } + }, + "name": "string.quoted.double.objcpp", + "patterns": [ + { + "include": "#string_escaped_char-c" + }, + { + "include": "#string_placeholder-c" + }, + { + "include": "#line_continuation_character" + } + ] + }, + { + "begin": "(?-mix:(?=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", + "end": "(?<=\\))(?!\\w)|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.name.function.objcpp" + }, + "2": { + "name": "punctuation.section.arguments.begin.bracket.round.objcpp" + } + }, + "end": "(\\))|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.name.function.objcpp" + }, + "2": { + "name": "punctuation.section.parameters.begin.bracket.round.objcpp" + } + }, + "end": "\\)|:", + "endCaptures": { + "0": { + "name": "punctuation.section.parameters.end.bracket.round.objcpp" + } + }, + "patterns": [ + { + "include": "#probably_a_parameter" + }, + { + "include": "#function-innards-c" + } + ] + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.objcpp" + } + }, + "patterns": [ + { + "include": "#function-innards-c" + } + ] + }, + { + "include": "$base" + } + ] + }, + "function-call-innards-c": { + "patterns": [ + { + "include": "#comments-c" + }, + { + "include": "#storage_types_c" + }, + { + "include": "#access-method" + }, + { + "include": "#access-member" + }, + { + "include": "#operators" + }, + { + "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|return|typeid|alignof|alignas|sizeof|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:new)\\s*((?:(?:<(?:[\\s<>,\\w])*>\\s*))?) # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.operator.memory.new.objcpp" + }, + "2": { + "patterns": [ + { + "include": "#template_call_innards" + } + ] + }, + "3": { + "name": "punctuation.section.arguments.begin.bracket.round.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.objcpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards-c" + } + ] + }, + { + "begin": "(?,\\w])*>\\s*))?::)*)\\s*([a-zA-Z_]\\w*)\\s*(?:((?:<(?:[\\s<>,\\w])*>\\s*)))?(\\()", + "beginCaptures": { + "1": { + "patterns": [ + { + "include": "#scope_resolution" + } + ] + }, + "2": { + "name": "entity.name.function.call.objcpp" + }, + "3": { + "patterns": [ + { + "include": "#template_call_innards" + } + ] + }, + "4": { + "name": "punctuation.section.arguments.begin.bracket.round.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.objcpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards-c" + } + ] + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.objcpp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.objcpp" + } + }, + "patterns": [ + { + "include": "#function-call-innards-c" + } + ] + }, + { + "include": "#block_innards-c" + } + ] + } + } + }, + "disabled": { + "begin": "^\\s*#\\s*if(n?def)?\\b.*$", + "comment": "eat nested preprocessor if(def)s", + "end": "^\\s*#\\s*endif\\b.*$", + "patterns": [ + { + "include": "#disabled" + }, + { + "include": "#pragma-mark" + } + ] + }, + "implementation_innards": { + "patterns": [ + { + "include": "#preprocessor-rule-enabled-implementation" + }, + { + "include": "#preprocessor-rule-disabled-implementation" + }, + { + "include": "#preprocessor-rule-other-implementation" + }, + { + "include": "#property_directive" + }, + { + "include": "#method_super" + }, + { + "include": "$base" + } + ] + }, + "interface_innards": { + "patterns": [ + { + "include": "#preprocessor-rule-enabled-interface" + }, + { + "include": "#preprocessor-rule-disabled-interface" + }, + { + "include": "#preprocessor-rule-other-interface" + }, + { + "include": "#properties" + }, + { + "include": "#protocol_list" + }, + { + "include": "#method" + }, + { + "include": "$base" + } + ] + }, + "method": { + "begin": "^(-|\\+)\\s*", + "end": "(?=\\{|#)|;", + "name": "meta.function.objcpp", + "patterns": [ + { + "begin": "(\\()", + "beginCaptures": { + "1": { + "name": "punctuation.definition.type.begin.objcpp" + } + }, + "end": "(\\))\\s*(\\w+\\b)", + "endCaptures": { + "1": { + "name": "punctuation.definition.type.end.objcpp" + }, + "2": { + "name": "entity.name.function.objcpp" + } + }, + "name": "meta.return-type.objcpp", + "patterns": [ + { + "include": "#protocol_list" + }, + { + "include": "#protocol_type_qualifier" + }, + { + "include": "$base" + } + ] + }, + { + "match": "\\b\\w+(?=:)", + "name": "entity.name.function.name-of-parameter.objcpp" + }, + { + "begin": "((:))\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.name.function.name-of-parameter.objcpp" + }, + "2": { + "name": "punctuation.separator.arguments.objcpp" + }, + "3": { + "name": "punctuation.definition.type.begin.objcpp" + } + }, + "end": "(\\))\\s*(\\w+\\b)?", + "endCaptures": { + "1": { + "name": "punctuation.definition.type.end.objcpp" + }, + "2": { + "name": "variable.parameter.function.objcpp" + } + }, + "name": "meta.argument-type.objcpp", + "patterns": [ + { + "include": "#protocol_list" + }, + { + "include": "#protocol_type_qualifier" + }, + { + "include": "$base" + } + ] + }, + { + "include": "#comment" + } + ] + }, + "method_super": { + "begin": "^(?=-|\\+)", + "end": "(?<=\\})|(?=#)", + "name": "meta.function-with-body.objcpp", + "patterns": [ + { + "include": "#method" + }, + { + "include": "$base" + } + ] + }, + "pragma-mark": { + "captures": { + "1": { + "name": "meta.preprocessor.objcpp" + }, + "2": { + "name": "keyword.control.import.pragma.objcpp" + }, + "3": { + "name": "meta.toc-list.pragma-mark.objcpp" + } + }, + "match": "^\\s*(#\\s*(pragma\\s+mark)\\s+(.*))", + "name": "meta.section.objcpp" + }, + "preprocessor-rule-disabled-implementation": { + "begin": "^\\s*(#(if)\\s+(0)\\b).*", + "captures": { + "1": { + "name": "meta.preprocessor.objcpp" + }, + "2": { + "name": "keyword.control.import.if.objcpp" + }, + "3": { + "name": "constant.numeric.preprocessor.objcpp" + } + }, + "end": "^\\s*(#\\s*(endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "begin": "^\\s*(#\\s*(else)\\b)", + "captures": { + "1": { + "name": "meta.preprocessor.objcpp" + }, + "2": { + "name": "keyword.control.import.else.objcpp" + } + }, + "end": "(?=^\\s*#\\s*endif\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "include": "#interface_innards" + } + ] + }, + { + "begin": "", + "end": "(?=^\\s*#\\s*(else|endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "name": "comment.block.preprocessor.if-branch.objcpp", + "patterns": [ + { + "include": "#disabled" + }, + { + "include": "#pragma-mark" + } + ] + } + ] + }, + "preprocessor-rule-disabled-interface": { + "begin": "^\\s*(#(if)\\s+(0)\\b).*", + "captures": { + "1": { + "name": "meta.preprocessor.objcpp" + }, + "2": { + "name": "keyword.control.import.if.objcpp" + }, + "3": { + "name": "constant.numeric.preprocessor.objcpp" + } + }, + "end": "^\\s*(#\\s*(endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "begin": "^\\s*(#\\s*(else)\\b)", + "captures": { + "1": { + "name": "meta.preprocessor.objcpp" + }, + "2": { + "name": "keyword.control.import.else.objcpp" + } + }, + "end": "(?=^\\s*#\\s*endif\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "include": "#interface_innards" + } + ] + }, + { + "begin": "", + "end": "(?=^\\s*#\\s*(else|endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "name": "comment.block.preprocessor.if-branch.objcpp", + "patterns": [ + { + "include": "#disabled" + }, + { + "include": "#pragma-mark" + } + ] + } + ] + }, + "preprocessor-rule-enabled-implementation": { + "begin": "^\\s*(#(if)\\s+(0*1)\\b)", + "captures": { + "1": { + "name": "meta.preprocessor.objcpp" + }, + "2": { + "name": "keyword.control.import.if.objcpp" + }, + "3": { + "name": "constant.numeric.preprocessor.objcpp" + } + }, + "end": "^\\s*(#\\s*(endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "begin": "^\\s*(#\\s*(else)\\b).*", + "captures": { + "1": { + "name": "meta.preprocessor.objcpp" + }, + "2": { + "name": "keyword.control.import.else.objcpp" + } + }, + "contentName": "comment.block.preprocessor.else-branch.objcpp", + "end": "(?=^\\s*#\\s*endif\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "include": "#disabled" + }, + { + "include": "#pragma-mark" + } + ] + }, + { + "begin": "", + "end": "(?=^\\s*#\\s*(else|endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "include": "#implementation_innards" + } + ] + } + ] + }, + "preprocessor-rule-enabled-interface": { + "begin": "^\\s*(#(if)\\s+(0*1)\\b)", + "captures": { + "1": { + "name": "meta.preprocessor.objcpp" + }, + "2": { + "name": "keyword.control.import.if.objcpp" + }, + "3": { + "name": "constant.numeric.preprocessor.objcpp" + } + }, + "end": "^\\s*(#\\s*(endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "begin": "^\\s*(#\\s*(else)\\b).*", + "captures": { + "1": { + "name": "meta.preprocessor.objcpp" + }, + "2": { + "name": "keyword.control.import.else.objcpp" + } + }, + "contentName": "comment.block.preprocessor.else-branch.objcpp", + "end": "(?=^\\s*#\\s*endif\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "include": "#disabled" + }, + { + "include": "#pragma-mark" + } + ] + }, + { + "begin": "", + "end": "(?=^\\s*#\\s*(else|endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "include": "#interface_innards" + } + ] + } + ] + }, + "preprocessor-rule-other-implementation": { + "begin": "^\\s*(#\\s*(if(n?def)?)\\b.*?(?:(?=(?://|/\\*))|$))", + "captures": { + "1": { + "name": "meta.preprocessor.objcpp" + }, + "2": { + "name": "keyword.control.import.objcpp" + } + }, + "end": "^\\s*(#\\s*(endif)\\b).*?(?:(?=(?://|/\\*))|$)", + "patterns": [ + { + "include": "#implementation_innards" + } + ] + }, + "preprocessor-rule-other-interface": { + "begin": "^\\s*(#\\s*(if(n?def)?)\\b.*?(?:(?=(?://|/\\*))|$))", + "captures": { + "1": { + "name": "meta.preprocessor.objcpp" + }, + "2": { + "name": "keyword.control.import.objcpp" + } + }, + "end": "^\\s*(#\\s*(endif)\\b).*?(?:(?=(?://|/\\*))|$)", + "patterns": [ + { + "include": "#interface_innards" + } + ] + }, + "properties": { + "patterns": [ + { + "begin": "((@)property)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.other.property.objcpp" + }, + "2": { + "name": "punctuation.definition.keyword.objcpp" + }, + "3": { + "name": "punctuation.section.scope.begin.objcpp" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.section.scope.end.objcpp" + } + }, + "name": "meta.property-with-attributes.objcpp", + "patterns": [ + { + "match": "\\b(getter|setter|readonly|readwrite|assign|retain|copy|nonatomic|atomic|strong|weak|nonnull|nullable|null_resettable|null_unspecified|class|direct)\\b", + "name": "keyword.other.property.attribute.objcpp" + } + ] + }, + { + "captures": { + "1": { + "name": "keyword.other.property.objcpp" + }, + "2": { + "name": "punctuation.definition.keyword.objcpp" + } + }, + "match": "((@)property)\\b", + "name": "meta.property.objcpp" + } + ] + }, + "property_directive": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objcpp" + } + }, + "match": "(@)(dynamic|synthesize)\\b", + "name": "keyword.other.property.directive.objcpp" + }, + "protocol_list": { + "begin": "(<)", + "beginCaptures": { + "1": { + "name": "punctuation.section.scope.begin.objcpp" + } + }, + "end": "(>)", + "endCaptures": { + "1": { + "name": "punctuation.section.scope.end.objcpp" + } + }, + "name": "meta.protocol-list.objcpp", + "patterns": [ + { + "match": "\\bNS(GlyphStorage|M(utableCopying|enuItem)|C(hangeSpelling|o(ding|pying|lorPicking(Custom|Default)))|T(oolbarItemValidations|ext(Input|AttachmentCell))|I(nputServ(iceProvider|erMouseTracker)|gnoreMisspelledWords)|Obj(CTypeSerializationCallBack|ect)|D(ecimalNumberBehaviors|raggingInfo)|U(serInterfaceValidations|RL(HandleClient|DownloadDelegate|ProtocolClient|AuthenticationChallengeSender))|Validated(ToobarItem|UserInterfaceItem)|Locking)\\b", + "name": "support.other.protocol.objcpp" + } + ] + }, + "protocol_type_qualifier": { + "match": "\\b(in|out|inout|oneway|bycopy|byref|nonnull|nullable|_Nonnull|_Nullable|_Null_unspecified)\\b", + "name": "storage.modifier.protocol.objcpp" + }, + "special_variables": { + "patterns": [ + { + "match": "\\b_cmd\\b", + "name": "variable.other.selector.objcpp" + }, + { + "match": "\\b(self|super)\\b", + "name": "variable.language.objcpp" + } + ] + }, + "string_escaped_char": { + "patterns": [ + { + "match": "(?x)\\\\ (\n\\\\\t\t\t |\n[abefnprtv'\"?] |\n[0-3]\\d{,2}\t |\n[4-7]\\d?\t\t|\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )", + "name": "constant.character.escape.objcpp" + }, + { + "match": "\\\\.", + "name": "invalid.illegal.unknown-escape.objcpp" + } + ] + }, + "string_placeholder": { + "patterns": [ + { + "match": "(?x) %\n(\\d+\\$)?\t\t\t\t\t\t # field (argument #)\n[#0\\- +']*\t\t\t\t\t\t # flags\n[,;:_]?\t\t\t\t\t\t\t # separator character (AltiVec)\n((-?\\d+)|\\*(-?\\d+\\$)?)?\t\t # minimum field width\n(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)?\t# precision\n(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier\n[diouxXDOUeEfFgGaACcSspn%]\t\t # conversion type", + "name": "constant.other.placeholder.objcpp" + }, + { + "match": "(%)(?!\"\\s*(PRI|SCN))", + "captures": { + "1": { + "name": "invalid.illegal.placeholder.objcpp" + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/desktop/internal/editor/syntax/grammars/objective-c.tmLanguage.json b/desktop/internal/editor/syntax/grammars/objective-c.tmLanguage.json new file mode 100644 index 0000000000..594c0ebfd7 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/objective-c.tmLanguage.json @@ -0,0 +1,3755 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/jeff-hykin/better-objc-syntax/blob/master/autogenerated/objc.tmLanguage.json", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/jeff-hykin/better-objc-syntax/commit/119b75fb1f4d3e8726fa62588e3b935e0b719294", + "name": "Objective-C", + "scopeName": "source.objc", + "patterns": [ + { + "include": "#anonymous_pattern_1" + }, + { + "include": "#anonymous_pattern_2" + }, + { + "include": "#anonymous_pattern_3" + }, + { + "include": "#anonymous_pattern_4" + }, + { + "include": "#anonymous_pattern_5" + }, + { + "include": "#apple_foundation_functional_macros" + }, + { + "include": "#anonymous_pattern_7" + }, + { + "include": "#anonymous_pattern_8" + }, + { + "include": "#anonymous_pattern_9" + }, + { + "include": "#anonymous_pattern_10" + }, + { + "include": "#anonymous_pattern_11" + }, + { + "include": "#anonymous_pattern_12" + }, + { + "include": "#anonymous_pattern_13" + }, + { + "include": "#anonymous_pattern_14" + }, + { + "include": "#anonymous_pattern_15" + }, + { + "include": "#anonymous_pattern_16" + }, + { + "include": "#anonymous_pattern_17" + }, + { + "include": "#anonymous_pattern_18" + }, + { + "include": "#anonymous_pattern_19" + }, + { + "include": "#anonymous_pattern_20" + }, + { + "include": "#anonymous_pattern_21" + }, + { + "include": "#anonymous_pattern_22" + }, + { + "include": "#anonymous_pattern_23" + }, + { + "include": "#anonymous_pattern_24" + }, + { + "include": "#anonymous_pattern_25" + }, + { + "include": "#anonymous_pattern_26" + }, + { + "include": "#anonymous_pattern_27" + }, + { + "include": "#anonymous_pattern_28" + }, + { + "include": "#anonymous_pattern_29" + }, + { + "include": "#anonymous_pattern_30" + }, + { + "include": "#bracketed_content" + }, + { + "include": "#c_lang" + } + ], + "repository": { + "anonymous_pattern_1": { + "begin": "((@)(interface|protocol))(?!.+;)\\s+([A-Za-z_][A-Za-z0-9_]*)\\s*((:)(?:\\s*)([A-Za-z][A-Za-z0-9]*))?(\\s|\\n)?", + "captures": { + "1": { + "name": "storage.type.objc" + }, + "2": { + "name": "punctuation.definition.storage.type.objc" + }, + "4": { + "name": "entity.name.type.objc" + }, + "6": { + "name": "punctuation.definition.entity.other.inherited-class.objc" + }, + "7": { + "name": "entity.other.inherited-class.objc" + }, + "8": { + "name": "meta.divider.objc" + }, + "9": { + "name": "meta.inherited-class.objc" + } + }, + "contentName": "meta.scope.interface.objc", + "end": "((@)end)\\b", + "name": "meta.interface-or-protocol.objc", + "patterns": [ + { + "include": "#interface_innards" + } + ] + }, + "anonymous_pattern_10": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objc" + } + }, + "match": "(@)(defs|encode)\\b", + "name": "keyword.other.objc" + }, + "anonymous_pattern_11": { + "match": "\\bid\\b", + "name": "storage.type.id.objc" + }, + "anonymous_pattern_12": { + "match": "\\b(IBOutlet|IBAction|BOOL|SEL|id|unichar|IMP|Class|instancetype)\\b", + "name": "storage.type.objc" + }, + "anonymous_pattern_13": { + "captures": { + "1": { + "name": "punctuation.definition.storage.type.objc" + } + }, + "match": "(@)(class|protocol)\\b", + "name": "storage.type.objc" + }, + "anonymous_pattern_14": { + "begin": "((@)selector)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "storage.type.objc" + }, + "2": { + "name": "punctuation.definition.storage.type.objc" + }, + "3": { + "name": "punctuation.definition.storage.type.objc" + } + }, + "contentName": "meta.selector.method-name.objc", + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.definition.storage.type.objc" + } + }, + "name": "meta.selector.objc", + "patterns": [ + { + "captures": { + "1": { + "name": "punctuation.separator.arguments.objc" + } + }, + "match": "\\b(?:[a-zA-Z_:][\\w]*)+", + "name": "support.function.any-method.name-of-parameter.objc" + } + ] + }, + "anonymous_pattern_15": { + "captures": { + "1": { + "name": "punctuation.definition.storage.modifier.objc" + } + }, + "match": "(@)(synchronized|public|package|private|protected)\\b", + "name": "storage.modifier.objc" + }, + "anonymous_pattern_16": { + "match": "\\b(YES|NO|Nil|nil)\\b", + "name": "constant.language.objc" + }, + "anonymous_pattern_17": { + "match": "\\bNSApp\\b", + "name": "support.variable.foundation.objc" + }, + "anonymous_pattern_18": { + "captures": { + "1": { + "name": "punctuation.whitespace.support.function.cocoa.leopard.objc" + }, + "2": { + "name": "support.function.cocoa.leopard.objc" + } + }, + "match": "(\\s*)\\b(NS(Rect(ToCGRect|FromCGRect)|MakeCollectable|S(tringFromProtocol|ize(ToCGSize|FromCGSize))|Draw(NinePartImage|ThreePartImage)|P(oint(ToCGPoint|FromCGPoint)|rotocolFromString)|EventMaskFromType|Value))\\b" + }, + "anonymous_pattern_19": { + "captures": { + "1": { + "name": "punctuation.whitespace.support.function.leading.cocoa.objc" + }, + "2": { + "name": "support.function.cocoa.objc" + } + }, + "match": "(\\s*)\\b(NS(R(ound(DownToMultipleOfPageSize|UpToMultipleOfPageSize)|un(CriticalAlertPanel(RelativeToWindow)?|InformationalAlertPanel(RelativeToWindow)?|AlertPanel(RelativeToWindow)?)|e(set(MapTable|HashTable)|c(ycleZone|t(Clip(List)?|F(ill(UsingOperation|List(UsingOperation|With(Grays|Colors(UsingOperation)?))?)?|romString))|ordAllocationEvent)|turnAddress|leaseAlertPanel|a(dPixel|l(MemoryAvailable|locateCollectable))|gisterServicesProvider)|angeFromString)|Get(SizeAndAlignment|CriticalAlertPanel|InformationalAlertPanel|UncaughtExceptionHandler|FileType(s)?|WindowServerMemory|AlertPanel)|M(i(n(X|Y)|d(X|Y))|ouseInRect|a(p(Remove|Get|Member|Insert(IfAbsent|KnownAbsent)?)|ke(R(ect|ange)|Size|Point)|x(Range|X|Y)))|B(itsPer(SampleFromDepth|PixelFromDepth)|e(stDepth|ep|gin(CriticalAlertSheet|InformationalAlertSheet|AlertSheet)))|S(ho(uldRetainWithZone|w(sServicesMenuItem|AnimationEffect))|tringFrom(R(ect|ange)|MapTable|S(ize|elector)|HashTable|Class|Point)|izeFromString|e(t(ShowsServicesMenuItem|ZoneName|UncaughtExceptionHandler|FocusRingStyle)|lectorFromString|archPathForDirectoriesInDomains)|wap(Big(ShortToHost|IntToHost|DoubleToHost|FloatToHost|Long(ToHost|LongToHost))|Short|Host(ShortTo(Big|Little)|IntTo(Big|Little)|DoubleTo(Big|Little)|FloatTo(Big|Little)|Long(To(Big|Little)|LongTo(Big|Little)))|Int|Double|Float|L(ittle(ShortToHost|IntToHost|DoubleToHost|FloatToHost|Long(ToHost|LongToHost))|ong(Long)?)))|H(ighlightRect|o(stByteOrder|meDirectory(ForUser)?)|eight|ash(Remove|Get|Insert(IfAbsent|KnownAbsent)?)|FSType(CodeFromFileType|OfFile))|N(umberOfColorComponents|ext(MapEnumeratorPair|HashEnumeratorItem))|C(o(n(tainsRect|vert(GlyphsToPackedGlyphs|Swapped(DoubleToHost|FloatToHost)|Host(DoubleToSwapped|FloatToSwapped)))|unt(MapTable|HashTable|Frames|Windows(ForContext)?)|py(M(emoryPages|apTableWithZone)|Bits|HashTableWithZone|Object)|lorSpaceFromDepth|mpare(MapTables|HashTables))|lassFromString|reate(MapTable(WithZone)?|HashTable(WithZone)?|Zone|File(namePboardType|ContentsPboardType)))|TemporaryDirectory|I(s(ControllerMarker|EmptyRect|FreedObject)|n(setRect|crementExtraRefCount|te(r(sect(sRect|ionR(ect|ange))|faceStyleForKey)|gralRect)))|Zone(Realloc|Malloc|Name|Calloc|Fr(omPointer|ee))|O(penStepRootDirectory|ffsetRect)|D(i(sableScreenUpdates|videRect)|ottedFrameRect|e(c(imal(Round|Multiply|S(tring|ubtract)|Normalize|Co(py|mpa(ct|re))|IsNotANumber|Divide|Power|Add)|rementExtraRefCountWasZero)|faultMallocZone|allocate(MemoryPages|Object))|raw(Gr(oove|ayBezel)|B(itmap|utton)|ColorTiledRects|TiledRects|DarkBezel|W(hiteBezel|indowBackground)|LightBezel))|U(serName|n(ionR(ect|ange)|registerServicesProvider)|pdateDynamicServices)|Java(Bundle(Setup|Cleanup)|Setup(VirtualMachine)?|Needs(ToLoadClasses|VirtualMachine)|ClassesF(orBundle|romPath)|ObjectNamedInPath|ProvidesClasses)|P(oint(InRect|FromString)|erformService|lanarFromDepth|ageSize)|E(n(d(MapTableEnumeration|HashTableEnumeration)|umerate(MapTable|HashTable)|ableScreenUpdates)|qual(R(ects|anges)|Sizes|Points)|raseRect|xtraRefCount)|F(ileTypeForHFSTypeCode|ullUserName|r(ee(MapTable|HashTable)|ame(Rect(WithWidth(UsingOperation)?)?|Address)))|Wi(ndowList(ForContext)?|dth)|Lo(cationInRange|g(v|PageSize)?)|A(ccessibility(R(oleDescription(ForUIElement)?|aiseBadArgumentException)|Unignored(Children(ForOnlyChild)?|Descendant|Ancestor)|PostNotification|ActionDescription)|pplication(Main|Load)|vailableWindowDepths|ll(MapTable(Values|Keys)|HashTableObjects|ocate(MemoryPages|Collectable|Object)))))\\b" + }, + "anonymous_pattern_2": { + "begin": "((@)(implementation))\\s+([A-Za-z_][A-Za-z0-9_]*)\\s*(?::\\s*([A-Za-z][A-Za-z0-9]*))?", + "captures": { + "1": { + "name": "storage.type.objc" + }, + "2": { + "name": "punctuation.definition.storage.type.objc" + }, + "4": { + "name": "entity.name.type.objc" + }, + "5": { + "name": "entity.other.inherited-class.objc" + } + }, + "contentName": "meta.scope.implementation.objc", + "end": "((@)end)\\b", + "name": "meta.implementation.objc", + "patterns": [ + { + "include": "#implementation_innards" + } + ] + }, + "anonymous_pattern_20": { + "match": "\\bNS(RuleEditor|G(arbageCollector|radient)|MapTable|HashTable|Co(ndition|llectionView(Item)?)|T(oolbarItemGroup|extInputClient|r(eeNode|ackingArea))|InvocationOperation|Operation(Queue)?|D(ictionaryController|ockTile)|P(ointer(Functions|Array)|athC(o(ntrol(Delegate)?|mponentCell)|ell(Delegate)?)|r(intPanelAccessorizing|edicateEditor(RowTemplate)?))|ViewController|FastEnumeration|Animat(ionContext|ablePropertyContainer))\\b", + "name": "support.class.cocoa.leopard.objc" + }, + "anonymous_pattern_21": { + "match": "\\bNS(R(u(nLoop|ler(Marker|View))|e(sponder|cursiveLock|lativeSpecifier)|an(domSpecifier|geSpecifier))|G(etCommand|lyph(Generator|Storage|Info)|raphicsContext)|XML(Node|D(ocument|TD(Node)?)|Parser|Element)|M(iddleSpecifier|ov(ie(View)?|eCommand)|utable(S(tring|et)|C(haracterSet|opying)|IndexSet|D(ictionary|ata)|URLRequest|ParagraphStyle|A(ttributedString|rray))|e(ssagePort(NameServer)?|nu(Item(Cell)?|View)?|t(hodSignature|adata(Item|Query(ResultGroup|AttributeValueTuple)?)))|a(ch(BootstrapServer|Port)|trix))|B(itmapImageRep|ox|u(ndle|tton(Cell)?)|ezierPath|rowser(Cell)?)|S(hadow|c(anner|r(ipt(SuiteRegistry|C(o(ercionHandler|mmand(Description)?)|lassDescription)|ObjectSpecifier|ExecutionContext|WhoseTest)|oll(er|View)|een))|t(epper(Cell)?|atus(Bar|Item)|r(ing|eam))|imple(HorizontalTypesetter|CString)|o(cketPort(NameServer)?|und|rtDescriptor)|p(e(cifierTest|ech(Recognizer|Synthesizer)|ll(Server|Checker))|litView)|e(cureTextField(Cell)?|t(Command)?|archField(Cell)?|rializer|gmentedC(ontrol|ell))|lider(Cell)?|avePanel)|H(ost|TTP(Cookie(Storage)?|URLResponse)|elpManager)|N(ib(Con(nector|trolConnector)|OutletConnector)?|otification(Center|Queue)?|u(ll|mber(Formatter)?)|etService(Browser)?|ameSpecifier)|C(ha(ngeSpelling|racterSet)|o(n(stantString|nection|trol(ler)?|ditionLock)|d(ing|er)|unt(Command|edSet)|pying|lor(Space|P(ick(ing(Custom|Default)|er)|anel)|Well|List)?|m(p(oundPredicate|arisonPredicate)|boBox(Cell)?))|u(stomImageRep|rsor)|IImageRep|ell|l(ipView|o(seCommand|neCommand)|assDescription)|a(ched(ImageRep|URLResponse)|lendar(Date)?)|reateCommand)|T(hread|ypesetter|ime(Zone|r)|o(olbar(Item(Validations)?)?|kenField(Cell)?)|ext(Block|Storage|Container|Tab(le(Block)?)?|Input|View|Field(Cell)?|List|Attachment(Cell)?)?|a(sk|b(le(Header(Cell|View)|Column|View)|View(Item)?))|reeController)|I(n(dex(S(pecifier|et)|Path)|put(Manager|S(tream|erv(iceProvider|er(MouseTracker)?)))|vocation)|gnoreMisspelledWords|mage(Rep|Cell|View)?)|O(ut(putStream|lineView)|pen(GL(Context|Pixel(Buffer|Format)|View)|Panel)|bj(CTypeSerializationCallBack|ect(Controller)?))|D(i(st(antObject(Request)?|ributed(NotificationCenter|Lock))|ctionary|rectoryEnumerator)|ocument(Controller)?|e(serializer|cimalNumber(Behaviors|Handler)?|leteCommand)|at(e(Components|Picker(Cell)?|Formatter)?|a)|ra(wer|ggingInfo))|U(ser(InterfaceValidations|Defaults(Controller)?)|RL(Re(sponse|quest)|Handle(Client)?|C(onnection|ache|redential(Storage)?)|Download(Delegate)?|Prot(ocol(Client)?|ectionSpace)|AuthenticationChallenge(Sender)?)?|n(iqueIDSpecifier|doManager|archiver))|P(ipe|o(sitionalSpecifier|pUpButton(Cell)?|rt(Message|NameServer|Coder)?)|ICTImageRep|ersistentDocument|DFImageRep|a(steboard|nel|ragraphStyle|geLayout)|r(int(Info|er|Operation|Panel)|o(cessInfo|tocolChecker|perty(Specifier|ListSerialization)|gressIndicator|xy)|edicate))|E(numerator|vent|PSImageRep|rror|x(ception|istsCommand|pression))|V(iew(Animation)?|al(idated(ToobarItem|UserInterfaceItem)|ue(Transformer)?))|Keyed(Unarchiver|Archiver)|Qui(ckDrawView|tCommand)|F(ile(Manager|Handle|Wrapper)|o(nt(Manager|Descriptor|Panel)?|rm(Cell|atter)))|W(hoseSpecifier|indow(Controller)?|orkspace)|L(o(c(k(ing)?|ale)|gicalTest)|evelIndicator(Cell)?|ayoutManager)|A(ssertionHandler|nimation|ctionCell|ttributedString|utoreleasePool|TSTypesetter|ppl(ication|e(Script|Event(Manager|Descriptor)))|ffineTransform|lert|r(chiver|ray(Controller)?)))\\b", + "name": "support.class.cocoa.objc" + }, + "anonymous_pattern_22": { + "match": "\\bNS(R(oundingMode|ule(Editor(RowType|NestingMode)|rOrientation)|e(questUserAttentionType|lativePosition))|G(lyphInscription|radientDrawingOptions)|XML(NodeKind|D(ocumentContentKind|TDNodeKind)|ParserError)|M(ultibyteGlyphPacking|apTableOptions)|B(itmapFormat|oxType|ezierPathElement|ackgroundStyle|rowserDropOperation)|S(tr(ing(CompareOptions|DrawingOptions|EncodingConversionOptions)|eam(Status|Event))|p(eechBoundary|litViewDividerStyle)|e(archPathD(irectory|omainMask)|gmentS(tyle|witchTracking))|liderType|aveOptions)|H(TTPCookieAcceptPolicy|ashTableOptions)|N(otification(SuspensionBehavior|Coalescing)|umberFormatter(RoundingMode|Behavior|Style|PadPosition)|etService(sError|Options))|C(haracterCollection|o(lor(RenderingIntent|SpaceModel|PanelMode)|mp(oundPredicateType|arisonPredicateModifier))|ellStateValue|al(culationError|endarUnit))|T(ypesetterControlCharacterAction|imeZoneNameStyle|e(stComparisonOperation|xt(Block(Dimension|V(erticalAlignment|alueType)|Layer)|TableLayoutAlgorithm|FieldBezelStyle))|ableView(SelectionHighlightStyle|ColumnAutoresizingStyle)|rackingAreaOptions)|I(n(sertionPosition|te(rfaceStyle|ger))|mage(RepLoadStatus|Scaling|CacheMode|FrameStyle|LoadStatus|Alignment))|Ope(nGLPixelFormatAttribute|rationQueuePriority)|Date(Picker(Mode|Style)|Formatter(Behavior|Style))|U(RL(RequestCachePolicy|HandleStatus|C(acheStoragePolicy|redentialPersistence))|Integer)|P(o(stingStyle|int(ingDeviceType|erFunctionsOptions)|pUpArrowPosition)|athStyle|r(int(ing(Orientation|PaginationMode)|erTableStatus|PanelOptions)|opertyList(MutabilityOptions|Format)|edicateOperatorType))|ExpressionType|KeyValue(SetMutationKind|Change)|QTMovieLoopMode|F(indPanel(SubstringMatchType|Action)|o(nt(RenderingMode|FamilyClass)|cusRingPlacement))|W(hoseSubelementIdentifier|ind(ingRule|ow(B(utton|ackingLocation)|SharingType|CollectionBehavior)))|L(ine(MovementDirection|SweepDirection|CapStyle|JoinStyle)|evelIndicatorStyle)|Animation(BlockingMode|Curve))\\b", + "name": "support.type.cocoa.leopard.objc" + }, + "anonymous_pattern_23": { + "match": "\\bC(I(Sampler|Co(ntext|lor)|Image(Accumulator)?|PlugIn(Registration)?|Vector|Kernel|Filter(Generator|Shape)?)|A(Renderer|MediaTiming(Function)?|BasicAnimation|ScrollLayer|Constraint(LayoutManager)?|T(iledLayer|extLayer|rans(ition|action))|OpenGLLayer|PropertyAnimation|KeyframeAnimation|Layer|A(nimation(Group)?|ction)))\\b", + "name": "support.class.quartz.objc" + }, + "anonymous_pattern_24": { + "match": "\\bC(G(Float|Point|Size|Rect)|IFormat|AConstraintAttribute)\\b", + "name": "support.type.quartz.objc" + }, + "anonymous_pattern_25": { + "match": "\\bNS(R(ect(Edge)?|ange)|G(lyph(Relation|LayoutMode)?|radientType)|M(odalSession|a(trixMode|p(Table|Enumerator)))|B(itmapImageFileType|orderType|uttonType|ezelStyle|ackingStoreType|rowserColumnResizingType)|S(cr(oll(er(Part|Arrow)|ArrowPosition)|eenAuxiliaryOpaque)|tringEncoding|ize|ocketNativeHandle|election(Granularity|Direction|Affinity)|wapped(Double|Float)|aveOperationType)|Ha(sh(Table|Enumerator)|ndler(2)?)|C(o(ntrol(Size|Tint)|mp(ositingOperation|arisonResult))|ell(State|Type|ImagePosition|Attribute))|T(hreadPrivate|ypesetterGlyphInfo|i(ckMarkPosition|tlePosition|meInterval)|o(ol(TipTag|bar(SizeMode|DisplayMode))|kenStyle)|IFFCompression|ext(TabType|Alignment)|ab(State|leViewDropOperation|ViewType)|rackingRectTag)|ImageInterpolation|Zone|OpenGL(ContextAuxiliary|PixelFormatAuxiliary)|D(ocumentChangeType|atePickerElementFlags|ra(werState|gOperation))|UsableScrollerParts|P(oint|r(intingPageOrder|ogressIndicator(Style|Th(ickness|readInfo))))|EventType|KeyValueObservingOptions|Fo(nt(SymbolicTraits|TraitMask|Action)|cusRingType)|W(indow(OrderingMode|Depth)|orkspace(IconCreationOptions|LaunchOptions)|ritingDirection)|L(ineBreakMode|ayout(Status|Direction))|A(nimation(Progress|Effect)|ppl(ication(TerminateReply|DelegateReply|PrintReply)|eEventManagerSuspensionID)|ffineTransformStruct|lertStyle))\\b", + "name": "support.type.cocoa.objc" + }, + "anonymous_pattern_26": { + "match": "\\bNS(NotFound|Ordered(Ascending|Descending|Same))\\b", + "name": "support.constant.cocoa.objc" + }, + "anonymous_pattern_27": { + "match": "\\bNS(MenuDidBeginTracking|ViewDidUpdateTrackingAreas)?Notification\\b", + "name": "support.constant.notification.cocoa.leopard.objc" + }, + "anonymous_pattern_28": { + "match": "\\bNS(Menu(Did(RemoveItem|SendAction|ChangeItem|EndTracking|AddItem)|WillSendAction)|S(ystemColorsDidChange|plitView(DidResizeSubviews|WillResizeSubviews))|C(o(nt(extHelpModeDid(Deactivate|Activate)|rolT(intDidChange|extDid(BeginEditing|Change|EndEditing)))|lor(PanelColorDidChange|ListDidChange)|mboBox(Selection(IsChanging|DidChange)|Will(Dismiss|PopUp)))|lassDescriptionNeededForClass)|T(oolbar(DidRemoveItem|WillAddItem)|ext(Storage(DidProcessEditing|WillProcessEditing)|Did(BeginEditing|Change|EndEditing)|View(DidChange(Selection|TypingAttributes)|WillChangeNotifyingTextView))|ableView(Selection(IsChanging|DidChange)|ColumnDid(Resize|Move)))|ImageRepRegistryDidChange|OutlineView(Selection(IsChanging|DidChange)|ColumnDid(Resize|Move)|Item(Did(Collapse|Expand)|Will(Collapse|Expand)))|Drawer(Did(Close|Open)|Will(Close|Open))|PopUpButton(CellWillPopUp|WillPopUp)|View(GlobalFrameDidChange|BoundsDidChange|F(ocusDidChange|rameDidChange))|FontSetChanged|W(indow(Did(Resi(ze|gn(Main|Key))|M(iniaturize|ove)|Become(Main|Key)|ChangeScreen(|Profile)|Deminiaturize|Update|E(ndSheet|xpose))|Will(M(iniaturize|ove)|BeginSheet|Close))|orkspace(SessionDid(ResignActive|BecomeActive)|Did(Mount|TerminateApplication|Unmount|PerformFileOperation|Wake|LaunchApplication)|Will(Sleep|Unmount|PowerOff|LaunchApplication)))|A(ntialiasThresholdChanged|ppl(ication(Did(ResignActive|BecomeActive|Hide|ChangeScreenParameters|U(nhide|pdate)|FinishLaunching)|Will(ResignActive|BecomeActive|Hide|Terminate|U(nhide|pdate)|FinishLaunching))|eEventManagerWillProcessFirstEvent)))Notification\\b", + "name": "support.constant.notification.cocoa.objc" + }, + "anonymous_pattern_29": { + "match": "\\bNS(RuleEditor(RowType(Simple|Compound)|NestingMode(Si(ngle|mple)|Compound|List))|GradientDraws(BeforeStartingLocation|AfterEndingLocation)|M(inusSetExpressionType|a(chPortDeallocate(ReceiveRight|SendRight|None)|pTable(StrongMemory|CopyIn|ZeroingWeakMemory|ObjectPointerPersonality)))|B(oxCustom|undleExecutableArchitecture(X86|I386|PPC(64)?)|etweenPredicateOperatorType|ackgroundStyle(Raised|Dark|L(ight|owered)))|S(tring(DrawingTruncatesLastVisibleLine|EncodingConversion(ExternalRepresentation|AllowLossy))|ubqueryExpressionType|p(e(ech(SentenceBoundary|ImmediateBoundary|WordBoundary)|llingState(GrammarFlag|SpellingFlag))|litViewDividerStyleThi(n|ck))|e(rvice(RequestTimedOutError|M(iscellaneousError|alformedServiceDictionaryError)|InvalidPasteboardDataError|ErrorM(inimum|aximum)|Application(NotFoundError|LaunchFailedError))|gmentStyle(Round(Rect|ed)|SmallSquare|Capsule|Textured(Rounded|Square)|Automatic)))|H(UDWindowMask|ashTable(StrongMemory|CopyIn|ZeroingWeakMemory|ObjectPointerPersonality))|N(oModeColorPanel|etServiceNoAutoRename)|C(hangeRedone|o(ntainsPredicateOperatorType|l(orRenderingIntent(RelativeColorimetric|Saturation|Default|Perceptual|AbsoluteColorimetric)|lectorDisabledOption))|ellHit(None|ContentArea|TrackableArea|EditableTextArea))|T(imeZoneNameStyle(S(hort(Standard|DaylightSaving)|tandard)|DaylightSaving)|extFieldDatePickerStyle|ableViewSelectionHighlightStyle(Regular|SourceList)|racking(Mouse(Moved|EnteredAndExited)|CursorUpdate|InVisibleRect|EnabledDuringMouseDrag|A(ssumeInside|ctive(In(KeyWindow|ActiveApp)|WhenFirstResponder|Always))))|I(n(tersectSetExpressionType|dexedColorSpaceModel)|mageScale(None|Proportionally(Down|UpOrDown)|AxesIndependently))|Ope(nGLPFAAllowOfflineRenderers|rationQueue(DefaultMaxConcurrentOperationCount|Priority(High|Normal|Very(High|Low)|Low)))|D(iacriticInsensitiveSearch|ownloadsDirectory)|U(nionSetExpressionType|TF(16(BigEndianStringEncoding|StringEncoding|LittleEndianStringEncoding)|32(BigEndianStringEncoding|StringEncoding|LittleEndianStringEncoding)))|P(ointerFunctions(Ma(chVirtualMemory|llocMemory)|Str(ongMemory|uctPersonality)|C(StringPersonality|opyIn)|IntegerPersonality|ZeroingWeakMemory|O(paque(Memory|Personality)|bjectP(ointerPersonality|ersonality)))|at(hStyle(Standard|NavigationBar|PopUp)|ternColorSpaceModel)|rintPanelShows(Scaling|Copies|Orientation|P(a(perSize|ge(Range|SetupAccessory))|review)))|Executable(RuntimeMismatchError|NotLoadableError|ErrorM(inimum|aximum)|L(inkError|oadError)|ArchitectureMismatchError)|KeyValueObservingOption(Initial|Prior)|F(i(ndPanelSubstringMatchType(StartsWith|Contains|EndsWith|FullWord)|leRead(TooLargeError|UnknownStringEncodingError))|orcedOrderingSearch)|Wi(ndow(BackingLocation(MainMemory|Default|VideoMemory)|Sharing(Read(Only|Write)|None)|CollectionBehavior(MoveToActiveSpace|CanJoinAllSpaces|Default))|dthInsensitiveSearch)|AggregateExpressionType)\\b", + "name": "support.constant.cocoa.leopard.objc" + }, + "anonymous_pattern_3": { + "begin": "@\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.objc" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objc" + } + }, + "name": "string.quoted.double.objc", + "patterns": [ + { + "include": "#string_escaped_char" + }, + { + "match": "(?x)%\n\t\t\t\t\t\t(\\d+\\$)? # field (argument #)\n\t\t\t\t\t\t[#0\\- +']* # flags\n\t\t\t\t\t\t((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width\n\t\t\t\t\t\t(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision\n\t\t\t\t\t\t[@] # conversion type\n\t\t\t\t\t", + "name": "constant.other.placeholder.objc" + }, + { + "include": "#string_placeholder" + } + ] + }, + "anonymous_pattern_30": { + "match": "\\bNS(R(GB(ModeColorPanel|ColorSpaceModel)|ight(Mouse(D(own(Mask)?|ragged(Mask)?)|Up(Mask)?)|T(ext(Movement|Alignment)|ab(sBezelBorder|StopType))|ArrowFunctionKey)|ound(RectBezelStyle|Bankers|ed(BezelStyle|TokenStyle|DisclosureBezelStyle)|Down|Up|Plain|Line(CapStyle|JoinStyle))|un(StoppedResponse|ContinuesResponse|AbortedResponse)|e(s(izableWindowMask|et(CursorRectsRunLoopOrdering|FunctionKey))|ce(ssedBezelStyle|iver(sCantHandleCommandScriptError|EvaluationScriptError))|turnTextMovement|doFunctionKey|quiredArgumentsMissingScriptError|l(evancyLevelIndicatorStyle|ative(Before|After))|gular(SquareBezelStyle|ControlSize)|moveTraitFontAction)|a(n(domSubelement|geDateMode)|tingLevelIndicatorStyle|dio(ModeMatrix|Button)))|G(IFFileType|lyph(Below|Inscribe(B(elow|ase)|Over(strike|Below)|Above)|Layout(WithPrevious|A(tAPoint|gainstAPoint))|A(ttribute(BidiLevel|Soft|Inscribe|Elastic)|bove))|r(ooveBorder|eaterThan(Comparison|OrEqualTo(Comparison|PredicateOperatorType)|PredicateOperatorType)|a(y(ModeColorPanel|ColorSpaceModel)|dient(None|Con(cave(Strong|Weak)|vex(Strong|Weak)))|phiteControlTint)))|XML(N(o(tationDeclarationKind|de(CompactEmptyElement|IsCDATA|OptionsNone|Use(SingleQuotes|DoubleQuotes)|Pre(serve(NamespaceOrder|C(haracterReferences|DATA)|DTD|Prefixes|E(ntities|mptyElements)|Quotes|Whitespace|A(ttributeOrder|ll))|ttyPrint)|ExpandEmptyElement))|amespaceKind)|CommentKind|TextKind|InvalidKind|D(ocument(X(MLKind|HTMLKind|Include)|HTMLKind|T(idy(XML|HTML)|extKind)|IncludeContentTypeDeclaration|Validate|Kind)|TDKind)|P(arser(GTRequiredError|XMLDeclNot(StartedError|FinishedError)|Mi(splaced(XMLDeclarationError|CDATAEndStringError)|xedContentDeclNot(StartedError|FinishedError))|S(t(andaloneValueError|ringNot(StartedError|ClosedError))|paceRequiredError|eparatorRequiredError)|N(MTOKENRequiredError|o(t(ationNot(StartedError|FinishedError)|WellBalancedError)|DTDError)|amespaceDeclarationError|AMERequiredError)|C(haracterRef(In(DTDError|PrologError|EpilogError)|AtEOFError)|o(nditionalSectionNot(StartedError|FinishedError)|mment(NotFinishedError|ContainsDoubleHyphenError))|DATANotFinishedError)|TagNameMismatchError|In(ternalError|valid(HexCharacterRefError|C(haracter(RefError|InEntityError|Error)|onditionalSectionError)|DecimalCharacterRefError|URIError|Encoding(NameError|Error)))|OutOfMemoryError|D(ocumentStartError|elegateAbortedParseError|OCTYPEDeclNotFinishedError)|U(RI(RequiredError|FragmentError)|n(declaredEntityError|parsedEntityError|knownEncodingError|finishedTagError))|P(CDATARequiredError|ublicIdentifierRequiredError|arsedEntityRef(MissingSemiError|NoNameError|In(Internal(SubsetError|Error)|PrologError|EpilogError)|AtEOFError)|r(ocessingInstructionNot(StartedError|FinishedError)|ematureDocumentEndError))|E(n(codingNotSupportedError|tity(Ref(In(DTDError|PrologError|EpilogError)|erence(MissingSemiError|WithoutNameError)|LoopError|AtEOFError)|BoundaryError|Not(StartedError|FinishedError)|Is(ParameterError|ExternalError)|ValueRequiredError))|qualExpectedError|lementContentDeclNot(StartedError|FinishedError)|xt(ernalS(tandaloneEntityError|ubsetNotFinishedError)|raContentError)|mptyDocumentError)|L(iteralNot(StartedError|FinishedError)|T(RequiredError|SlashRequiredError)|essThanSymbolInAttributeError)|Attribute(RedefinedError|HasNoValueError|Not(StartedError|FinishedError)|ListNot(StartedError|FinishedError)))|rocessingInstructionKind)|E(ntity(GeneralKind|DeclarationKind|UnparsedKind|P(ar(sedKind|ameterKind)|redefined))|lement(Declaration(MixedKind|UndefinedKind|E(lementKind|mptyKind)|Kind|AnyKind)|Kind))|Attribute(N(MToken(sKind|Kind)|otationKind)|CDATAKind|ID(Ref(sKind|Kind)|Kind)|DeclarationKind|En(tit(yKind|iesKind)|umerationKind)|Kind))|M(i(n(XEdge|iaturizableWindowMask|YEdge|uteCalendarUnit)|terLineJoinStyle|ddleSubelement|xedState)|o(nthCalendarUnit|deSwitchFunctionKey|use(Moved(Mask)?|E(ntered(Mask)?|ventSubtype|xited(Mask)?))|veToBezierPathElement|mentary(ChangeButton|Push(Button|InButton)|Light(Button)?))|enuFunctionKey|a(c(intoshInterfaceStyle|OSRomanStringEncoding)|tchesPredicateOperatorType|ppedRead|x(XEdge|YEdge))|ACHOperatingSystem)|B(MPFileType|o(ttomTabsBezelBorder|ldFontMask|rderlessWindowMask|x(Se(condary|parator)|OldStyle|Primary))|uttLineCapStyle|e(zelBorder|velLineJoinStyle|low(Bottom|Top)|gin(sWith(Comparison|PredicateOperatorType)|FunctionKey))|lueControlTint|ack(spaceCharacter|tabTextMovement|ingStore(Retained|Buffered|Nonretained)|TabCharacter|wardsSearch|groundTab)|r(owser(NoColumnResizing|UserColumnResizing|AutoColumnResizing)|eakFunctionKey))|S(h(ift(JISStringEncoding|KeyMask)|ow(ControlGlyphs|InvisibleGlyphs)|adowlessSquareBezelStyle)|y(s(ReqFunctionKey|tem(D(omainMask|efined(Mask)?)|FunctionKey))|mbolStringEncoding)|c(a(nnedOption|le(None|ToFit|Proportionally))|r(oll(er(NoPart|Increment(Page|Line|Arrow)|Decrement(Page|Line|Arrow)|Knob(Slot)?|Arrows(M(inEnd|axEnd)|None|DefaultSetting))|Wheel(Mask)?|LockFunctionKey)|eenChangedEventType))|t(opFunctionKey|r(ingDrawing(OneShot|DisableScreenFontSubstitution|Uses(DeviceMetrics|FontLeading|LineFragmentOrigin))|eam(Status(Reading|NotOpen|Closed|Open(ing)?|Error|Writing|AtEnd)|Event(Has(BytesAvailable|SpaceAvailable)|None|OpenCompleted|E(ndEncountered|rrorOccurred)))))|i(ngle(DateMode|UnderlineStyle)|ze(DownFontAction|UpFontAction))|olarisOperatingSystem|unOSOperatingSystem|pecialPageOrder|e(condCalendarUnit|lect(By(Character|Paragraph|Word)|i(ng(Next|Previous)|onAffinity(Downstream|Upstream))|edTab|FunctionKey)|gmentSwitchTracking(Momentary|Select(One|Any)))|quareLineCapStyle|witchButton|ave(ToOperation|Op(tions(Yes|No|Ask)|eration)|AsOperation)|mall(SquareBezelStyle|C(ontrolSize|apsFontMask)|IconButtonBezelStyle))|H(ighlightModeMatrix|SBModeColorPanel|o(ur(Minute(SecondDatePickerElementFlag|DatePickerElementFlag)|CalendarUnit)|rizontalRuler|meFunctionKey)|TTPCookieAcceptPolicy(Never|OnlyFromMainDocumentDomain|Always)|e(lp(ButtonBezelStyle|KeyMask|FunctionKey)|avierFontAction)|PUXOperatingSystem)|Year(MonthDa(yDatePickerElementFlag|tePickerElementFlag)|CalendarUnit)|N(o(n(StandardCharacterSetFontMask|ZeroWindingRule|activatingPanelMask|LossyASCIIStringEncoding)|Border|t(ification(SuspensionBehavior(Hold|Coalesce|D(eliverImmediately|rop))|NoCoalescing|CoalescingOn(Sender|Name)|DeliverImmediately|PostToAllSessions)|PredicateType|EqualToPredicateOperatorType)|S(cr(iptError|ollerParts)|ubelement|pecifierError)|CellMask|T(itle|opLevelContainersSpecifierError|abs(BezelBorder|NoBorder|LineBorder))|I(nterfaceStyle|mage)|UnderlineStyle|FontChangeAction)|u(ll(Glyph|CellType)|m(eric(Search|PadKeyMask)|berFormatter(Round(Half(Down|Up|Even)|Ceiling|Down|Up|Floor)|Behavior(10|Default)|S(cientificStyle|pellOutStyle)|NoStyle|CurrencyStyle|DecimalStyle|P(ercentStyle|ad(Before(Suffix|Prefix)|After(Suffix|Prefix))))))|e(t(Services(BadArgumentError|NotFoundError|C(ollisionError|ancelledError)|TimeoutError|InvalidError|UnknownError|ActivityInProgress)|workDomainMask)|wlineCharacter|xt(StepInterfaceStyle|FunctionKey))|EXTSTEPStringEncoding|a(t(iveShortGlyphPacking|uralTextAlignment)|rrowFontMask))|C(hange(ReadOtherContents|GrayCell(Mask)?|BackgroundCell(Mask)?|Cleared|Done|Undone|Autosaved)|MYK(ModeColorPanel|ColorSpaceModel)|ircular(BezelStyle|Slider)|o(n(stantValueExpressionType|t(inuousCapacityLevelIndicatorStyle|entsCellMask|ain(sComparison|erSpecifierError)|rol(Glyph|KeyMask))|densedFontMask)|lor(Panel(RGBModeMask|GrayModeMask|HSBModeMask|C(MYKModeMask|olorListModeMask|ustomPaletteModeMask|rayonModeMask)|WheelModeMask|AllModesMask)|ListModeColorPanel)|reServiceDirectory|m(p(osite(XOR|Source(In|O(ut|ver)|Atop)|Highlight|C(opy|lear)|Destination(In|O(ut|ver)|Atop)|Plus(Darker|Lighter))|ressedFontMask)|mandKeyMask))|u(stom(SelectorPredicateOperatorType|PaletteModeColorPanel)|r(sor(Update(Mask)?|PointingDevice)|veToBezierPathElement))|e(nterT(extAlignment|abStopType)|ll(State|H(ighlighted|as(Image(Horizontal|OnLeftOrBottom)|OverlappingImage))|ChangesContents|Is(Bordered|InsetButton)|Disabled|Editable|LightsBy(Gray|Background|Contents)|AllowsMixedState))|l(ipPagination|o(s(ePathBezierPathElement|ableWindowMask)|ckAndCalendarDatePickerStyle)|ear(ControlTint|DisplayFunctionKey|LineFunctionKey))|a(seInsensitive(Search|PredicateOption)|n(notCreateScriptCommandError|cel(Button|TextMovement))|chesDirectory|lculation(NoError|Overflow|DivideByZero|Underflow|LossOfPrecision)|rriageReturnCharacter)|r(itical(Request|AlertStyle)|ayonModeColorPanel))|T(hick(SquareBezelStyle|erSquareBezelStyle)|ypesetter(Behavior|HorizontalTabAction|ContainerBreakAction|ZeroAdvancementAction|OriginalBehavior|ParagraphBreakAction|WhitespaceAction|L(ineBreakAction|atestBehavior))|i(ckMark(Right|Below|Left|Above)|tledWindowMask|meZoneDatePickerElementFlag)|o(olbarItemVisibilityPriority(Standard|High|User|Low)|pTabsBezelBorder|ggleButton)|IFF(Compression(N(one|EXT)|CCITTFAX(3|4)|OldJPEG|JPEG|PackBits|LZW)|FileType)|e(rminate(Now|Cancel|Later)|xt(Read(InapplicableDocumentTypeError|WriteErrorM(inimum|aximum))|Block(M(i(nimum(Height|Width)|ddleAlignment)|a(rgin|ximum(Height|Width)))|B(o(ttomAlignment|rder)|aselineAlignment)|Height|TopAlignment|P(ercentageValueType|adding)|Width|AbsoluteValueType)|StorageEdited(Characters|Attributes)|CellType|ured(RoundedBezelStyle|BackgroundWindowMask|SquareBezelStyle)|Table(FixedLayoutAlgorithm|AutomaticLayoutAlgorithm)|Field(RoundedBezel|SquareBezel|AndStepperDatePickerStyle)|WriteInapplicableDocumentTypeError|ListPrependEnclosingMarker))|woByteGlyphPacking|ab(Character|TextMovement|le(tP(oint(Mask|EventSubtype)?|roximity(Mask|EventSubtype)?)|Column(NoResizing|UserResizingMask|AutoresizingMask)|View(ReverseSequentialColumnAutoresizingStyle|GridNone|S(olid(HorizontalGridLineMask|VerticalGridLineMask)|equentialColumnAutoresizingStyle)|NoColumnAutoresizing|UniformColumnAutoresizingStyle|FirstColumnOnlyAutoresizingStyle|LastColumnOnlyAutoresizingStyle)))|rackModeMatrix)|I(n(sert(CharFunctionKey|FunctionKey|LineFunctionKey)|t(Type|ernalS(criptError|pecifierError))|dexSubelement|validIndexSpecifierError|formational(Request|AlertStyle)|PredicateOperatorType)|talicFontMask|SO(2022JPStringEncoding|Latin(1StringEncoding|2StringEncoding))|dentityMappingCharacterCollection|llegalTextMovement|mage(R(ight|ep(MatchesDevice|LoadStatus(ReadingHeader|Completed|InvalidData|Un(expectedEOF|knownType)|WillNeedAllData)))|Below|C(ellType|ache(BySize|Never|Default|Always))|Interpolation(High|None|Default|Low)|O(nly|verlaps)|Frame(Gr(oove|ayBezel)|Button|None|Photo)|L(oadStatus(ReadError|C(ompleted|ancelled)|InvalidData|UnexpectedEOF)|eft)|A(lign(Right|Bottom(Right|Left)?|Center|Top(Right|Left)?|Left)|bove)))|O(n(State|eByteGlyphPacking|OffButton|lyScrollerArrows)|ther(Mouse(D(own(Mask)?|ragged(Mask)?)|Up(Mask)?)|TextMovement)|SF1OperatingSystem|pe(n(GL(GO(Re(setLibrary|tainRenderers)|ClearFormatCache|FormatCacheSize)|PFA(R(obust|endererID)|M(inimumPolicy|ulti(sample|Screen)|PSafe|aximumPolicy)|BackingStore|S(creenMask|te(ncilSize|reo)|ingleRenderer|upersample|ample(s|Buffers|Alpha))|NoRecovery|C(o(lor(Size|Float)|mpliant)|losestPolicy)|OffScreen|D(oubleBuffer|epthSize)|PixelBuffer|VirtualScreenCount|FullScreen|Window|A(cc(umSize|elerated)|ux(Buffers|DepthStencil)|l(phaSize|lRenderers))))|StepUnicodeReservedBase)|rationNotSupportedForKeyS(criptError|pecifierError))|ffState|KButton|rPredicateType|bjC(B(itfield|oolType)|S(hortType|tr(ingType|uctType)|electorType)|NoType|CharType|ObjectType|DoubleType|UnionType|PointerType|VoidType|FloatType|Long(Type|longType)|ArrayType))|D(i(s(c(losureBezelStyle|reteCapacityLevelIndicatorStyle)|playWindowRunLoopOrdering)|acriticInsensitivePredicateOption|rect(Selection|PredicateModifier))|o(c(ModalWindowMask|ument(Directory|ationDirectory))|ubleType|wn(TextMovement|ArrowFunctionKey))|e(s(cendingPageOrder|ktopDirectory)|cimalTabStopType|v(ice(NColorSpaceModel|IndependentModifierFlagsMask)|eloper(Directory|ApplicationDirectory))|fault(ControlTint|TokenStyle)|lete(Char(acter|FunctionKey)|FunctionKey|LineFunctionKey)|moApplicationDirectory)|a(yCalendarUnit|teFormatter(MediumStyle|Behavior(10|Default)|ShortStyle|NoStyle|FullStyle|LongStyle))|ra(wer(Clos(ingState|edState)|Open(ingState|State))|gOperation(Generic|Move|None|Copy|Delete|Private|Every|Link|All)))|U(ser(CancelledError|D(irectory|omainMask)|FunctionKey)|RL(Handle(NotLoaded|Load(Succeeded|InProgress|Failed))|CredentialPersistence(None|Permanent|ForSession))|n(scaledWindowMask|cachedRead|i(codeStringEncoding|talicFontMask|fiedTitleAndToolbarWindowMask)|d(o(CloseGroupingRunLoopOrdering|FunctionKey)|e(finedDateComponent|rline(Style(Single|None|Thick|Double)|Pattern(Solid|D(ot|ash(Dot(Dot)?)?)))))|known(ColorSpaceModel|P(ointingDevice|ageOrder)|KeyS(criptError|pecifierError))|boldFontMask)|tilityWindowMask|TF8StringEncoding|p(dateWindowsRunLoopOrdering|TextMovement|ArrowFunctionKey))|J(ustifiedTextAlignment|PEG(2000FileType|FileType)|apaneseEUC(GlyphPacking|StringEncoding))|P(o(s(t(Now|erFontMask|WhenIdle|ASAP)|iti(on(Replace|Be(fore|ginning)|End|After)|ve(IntType|DoubleType|FloatType)))|pUp(NoArrow|ArrowAt(Bottom|Center))|werOffEventType|rtraitOrientation)|NGFileType|ush(InCell(Mask)?|OnPushOffButton)|e(n(TipMask|UpperSideMask|PointingDevice|LowerSideMask)|riodic(Mask)?)|P(S(caleField|tatus(Title|Field)|aveButton)|N(ote(Title|Field)|ame(Title|Field))|CopiesField|TitleField|ImageButton|OptionsButton|P(a(perFeedButton|ge(Range(To|From)|ChoiceMatrix))|reviewButton)|LayoutButton)|lainTextTokenStyle|a(useFunctionKey|ragraphSeparatorCharacter|ge(DownFunctionKey|UpFunctionKey))|r(int(ing(ReplyLater|Success|Cancelled|Failure)|ScreenFunctionKey|erTable(NotFound|OK|Error)|FunctionKey)|o(p(ertyList(XMLFormat|MutableContainers(AndLeaves)?|BinaryFormat|Immutable|OpenStepFormat)|rietaryStringEncoding)|gressIndicator(BarStyle|SpinningStyle|Preferred(SmallThickness|Thickness|LargeThickness|AquaThickness)))|e(ssedTab|vFunctionKey))|L(HeightForm|CancelButton|TitleField|ImageButton|O(KButton|rientationMatrix)|UnitsButton|PaperNameButton|WidthForm))|E(n(terCharacter|d(sWith(Comparison|PredicateOperatorType)|FunctionKey))|v(e(nOddWindingRule|rySubelement)|aluatedObjectExpressionType)|qualTo(Comparison|PredicateOperatorType)|ra(serPointingDevice|CalendarUnit|DatePickerElementFlag)|x(clude(10|QuickDrawElementsIconCreationOption)|pandedFontMask|ecuteFunctionKey))|V(i(ew(M(in(XMargin|YMargin)|ax(XMargin|YMargin))|HeightSizable|NotSizable|WidthSizable)|aPanelFontAction)|erticalRuler|a(lidationErrorM(inimum|aximum)|riableExpressionType))|Key(SpecifierEvaluationScriptError|Down(Mask)?|Up(Mask)?|PathExpressionType|Value(MinusSetMutation|SetSetMutation|Change(Re(placement|moval)|Setting|Insertion)|IntersectSetMutation|ObservingOption(New|Old)|UnionSetMutation|ValidationError))|QTMovie(NormalPlayback|Looping(BackAndForthPlayback|Playback))|F(1(1FunctionKey|7FunctionKey|2FunctionKey|8FunctionKey|3FunctionKey|9FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey|6FunctionKey)|7FunctionKey|i(nd(PanelAction(Replace(A(ndFind|ll(InSelection)?))?|S(howFindPanel|e(tFindString|lectAll(InSelection)?))|Next|Previous)|FunctionKey)|tPagination|le(Read(No(SuchFileError|PermissionError)|CorruptFileError|In(validFileNameError|applicableStringEncodingError)|Un(supportedSchemeError|knownError))|HandlingPanel(CancelButton|OKButton)|NoSuchFileError|ErrorM(inimum|aximum)|Write(NoPermissionError|In(validFileNameError|applicableStringEncodingError)|OutOfSpaceError|Un(supportedSchemeError|knownError))|LockingError)|xedPitchFontMask)|2(1FunctionKey|7FunctionKey|2FunctionKey|8FunctionKey|3FunctionKey|9FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey|6FunctionKey)|o(nt(Mo(noSpaceTrait|dernSerifsClass)|BoldTrait|S(ymbolicClass|criptsClass|labSerifsClass|ansSerifClass)|C(o(ndensedTrait|llectionApplicationOnlyMask)|larendonSerifsClass)|TransitionalSerifsClass|I(ntegerAdvancementsRenderingMode|talicTrait)|O(ldStyleSerifsClass|rnamentalsClass)|DefaultRenderingMode|U(nknownClass|IOptimizedTrait)|Panel(S(hadowEffectModeMask|t(andardModesMask|rikethroughEffectModeMask)|izeModeMask)|CollectionModeMask|TextColorEffectModeMask|DocumentColorEffectModeMask|UnderlineEffectModeMask|FaceModeMask|All(ModesMask|EffectsModeMask))|ExpandedTrait|VerticalTrait|F(amilyClassMask|reeformSerifsClass)|Antialiased(RenderingMode|IntegerAdvancementsRenderingMode))|cusRing(Below|Type(None|Default|Exterior)|Only|Above)|urByteGlyphPacking|rm(attingError(M(inimum|aximum))?|FeedCharacter))|8FunctionKey|unction(ExpressionType|KeyMask)|3(1FunctionKey|2FunctionKey|3FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey)|9FunctionKey|4FunctionKey|P(RevertButton|S(ize(Title|Field)|etButton)|CurrentField|Preview(Button|Field))|l(oat(ingPointSamplesBitmapFormat|Type)|agsChanged(Mask)?)|axButton|5FunctionKey|6FunctionKey)|W(heelModeColorPanel|indow(s(NTOperatingSystem|CP125(1StringEncoding|2StringEncoding|3StringEncoding|4StringEncoding|0StringEncoding)|95(InterfaceStyle|OperatingSystem))|M(iniaturizeButton|ovedEventType)|Below|CloseButton|ToolbarButton|ZoomButton|Out|DocumentIconButton|ExposedEventType|Above)|orkspaceLaunch(NewInstance|InhibitingBackgroundOnly|Default|PreferringClassic|WithoutA(ctivation|ddingToRecents)|A(sync|nd(Hide(Others)?|Print)|llowingClassicStartup))|eek(day(CalendarUnit|OrdinalCalendarUnit)|CalendarUnit)|a(ntsBidiLevels|rningAlertStyle)|r(itingDirection(RightToLeft|Natural|LeftToRight)|apCalendarComponents))|L(i(stModeMatrix|ne(Moves(Right|Down|Up|Left)|B(order|reakBy(C(harWrapping|lipping)|Truncating(Middle|Head|Tail)|WordWrapping))|S(eparatorCharacter|weep(Right|Down|Up|Left))|ToBezierPathElement|DoesntMove|arSlider)|teralSearch|kePredicateOperatorType|ghterFontAction|braryDirectory)|ocalDomainMask|e(ssThan(Comparison|OrEqualTo(Comparison|PredicateOperatorType)|PredicateOperatorType)|ft(Mouse(D(own(Mask)?|ragged(Mask)?)|Up(Mask)?)|T(ext(Movement|Alignment)|ab(sBezelBorder|StopType))|ArrowFunctionKey))|a(yout(RightToLeft|NotDone|CantFit|OutOfGlyphs|Done|LeftToRight)|ndscapeOrientation)|ABColorSpaceModel)|A(sc(iiWithDoubleByteEUCGlyphPacking|endingPageOrder)|n(y(Type|PredicateModifier|EventMask)|choredSearch|imation(Blocking|Nonblocking(Threaded)?|E(ffect(DisappearingItemDefault|Poof)|ase(In(Out)?|Out))|Linear)|dPredicateType)|t(Bottom|tachmentCharacter|omicWrite|Top)|SCIIStringEncoding|d(obe(GB1CharacterCollection|CNS1CharacterCollection|Japan(1CharacterCollection|2CharacterCollection)|Korea1CharacterCollection)|dTraitFontAction|minApplicationDirectory)|uto(saveOperation|Pagination)|pp(lication(SupportDirectory|D(irectory|e(fined(Mask)?|legateReply(Success|Cancel|Failure)|activatedEventType))|ActivatedEventType)|KitDefined(Mask)?)|l(ternateKeyMask|pha(ShiftKeyMask|NonpremultipliedBitmapFormat|FirstBitmapFormat)|ert(SecondButtonReturn|ThirdButtonReturn|OtherReturn|DefaultReturn|ErrorReturn|FirstButtonReturn|AlternateReturn)|l(ScrollerParts|DomainsMask|PredicateModifier|LibrariesDirectory|ApplicationsDirectory))|rgument(sWrongScriptError|EvaluationScriptError)|bove(Bottom|Top)|WTEventType))\\b", + "name": "support.constant.cocoa.objc" + }, + "anonymous_pattern_4": { + "begin": "\\b(id)\\s*(?=<)", + "beginCaptures": { + "1": { + "name": "storage.type.objc" + } + }, + "end": "(?<=>)", + "name": "meta.id-with-protocol.objc", + "patterns": [ + { + "include": "#protocol_list" + } + ] + }, + "anonymous_pattern_5": { + "match": "\\b(NS_DURING|NS_HANDLER|NS_ENDHANDLER)\\b", + "name": "keyword.control.macro.objc" + }, + "anonymous_pattern_7": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objc" + } + }, + "match": "(@)(try|catch|finally|throw)\\b", + "name": "keyword.control.exception.objc" + }, + "anonymous_pattern_8": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objc" + } + }, + "match": "(@)(synchronized)\\b", + "name": "keyword.control.synchronize.objc" + }, + "anonymous_pattern_9": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objc" + } + }, + "match": "(@)(required|optional)\\b", + "name": "keyword.control.protocol-specification.objc" + }, + "apple_foundation_functional_macros": { + "begin": "(\\b(?:API_AVAILABLE|API_DEPRECATED|API_UNAVAILABLE|NS_AVAILABLE|NS_AVAILABLE_MAC|NS_AVAILABLE_IOS|NS_DEPRECATED|NS_DEPRECATED_MAC|NS_DEPRECATED_IOS|NS_SWIFT_NAME))(?:(?:\\s)+)?(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "entity.name.function.preprocessor.apple-foundation.objc" + }, + "2": { + "name": "punctuation.section.macro.arguments.begin.bracket.round.apple-foundation.objc" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.macro.arguments.end.bracket.round.apple-foundation.objc" + } + }, + "name": "meta.preprocessor.macro.callable.apple-foundation.objc", + "patterns": [ + { + "include": "#c_lang" + } + ] + }, + "bracketed_content": { + "begin": "\\[", + "beginCaptures": { + "0": { + "name": "punctuation.section.scope.begin.objc" + } + }, + "end": "\\]", + "endCaptures": { + "0": { + "name": "punctuation.section.scope.end.objc" + } + }, + "name": "meta.bracketed.objc", + "patterns": [ + { + "begin": "(?=predicateWithFormat:)(?<=NSPredicate )(predicateWithFormat:)", + "beginCaptures": { + "1": { + "name": "support.function.any-method.objc" + }, + "2": { + "name": "punctuation.separator.arguments.objc" + } + }, + "end": "(?=\\])", + "name": "meta.function-call.predicate.objc", + "patterns": [ + { + "captures": { + "1": { + "name": "punctuation.separator.arguments.objc" + } + }, + "match": "\\bargument(Array|s)(:)", + "name": "support.function.any-method.name-of-parameter.objc" + }, + { + "captures": { + "1": { + "name": "punctuation.separator.arguments.objc" + } + }, + "match": "\\b\\w+(:)", + "name": "invalid.illegal.unknown-method.objc" + }, + { + "begin": "@\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.objc" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objc" + } + }, + "name": "string.quoted.double.objc", + "patterns": [ + { + "match": "\\b(AND|OR|NOT|IN)\\b", + "name": "keyword.operator.logical.predicate.cocoa.objc" + }, + { + "match": "\\b(ALL|ANY|SOME|NONE)\\b", + "name": "constant.language.predicate.cocoa.objc" + }, + { + "match": "\\b(NULL|NIL|SELF|TRUE|YES|FALSE|NO|FIRST|LAST|SIZE)\\b", + "name": "constant.language.predicate.cocoa.objc" + }, + { + "match": "\\b(MATCHES|CONTAINS|BEGINSWITH|ENDSWITH|BETWEEN)\\b", + "name": "keyword.operator.comparison.predicate.cocoa.objc" + }, + { + "match": "\\bC(ASEINSENSITIVE|I)\\b", + "name": "keyword.other.modifier.predicate.cocoa.objc" + }, + { + "match": "\\b(ANYKEY|SUBQUERY|CAST|TRUEPREDICATE|FALSEPREDICATE)\\b", + "name": "keyword.other.predicate.cocoa.objc" + }, + { + "match": "\\\\(\\\\|[abefnrtv'\"?]|[0-3]\\d{,2}|[4-7]\\d?|x[a-zA-Z0-9]+)", + "name": "constant.character.escape.objc" + }, + { + "match": "\\\\.", + "name": "invalid.illegal.unknown-escape.objc" + } + ] + }, + { + "include": "#special_variables" + }, + { + "include": "#c_functions" + }, + { + "include": "$base" + } + ] + }, + { + "begin": "(?=\\w)(?<=[\\w\\])\"] )(\\w+(?:(:)|(?=\\])))", + "beginCaptures": { + "1": { + "name": "support.function.any-method.objc" + }, + "2": { + "name": "punctuation.separator.arguments.objc" + } + }, + "end": "(?=\\])", + "name": "meta.function-call.objc", + "patterns": [ + { + "captures": { + "1": { + "name": "punctuation.separator.arguments.objc" + } + }, + "match": "\\b\\w+(:)", + "name": "support.function.any-method.name-of-parameter.objc" + }, + { + "include": "#special_variables" + }, + { + "include": "#c_functions" + }, + { + "include": "$base" + } + ] + }, + { + "include": "#special_variables" + }, + { + "include": "#c_functions" + }, + { + "include": "$self" + } + ] + }, + "c_functions": { + "patterns": [ + { + "captures": { + "1": { + "name": "punctuation.whitespace.support.function.leading.objc" + }, + "2": { + "name": "support.function.C99.objc" + } + }, + "match": "(\\s*)\\b(hypot(f|l)?|s(scanf|ystem|nprintf|ca(nf|lb(n(f|l)?|ln(f|l)?))|i(n(h(f|l)?|f|l)?|gn(al|bit))|tr(s(tr|pn)|nc(py|at|mp)|c(spn|hr|oll|py|at|mp)|to(imax|d|u(l(l)?|max)|k|f|l(d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(jmp|vbuf|locale|buf)|qrt(f|l)?|w(scanf|printf)|rand)|n(e(arbyint(f|l)?|xt(toward(f|l)?|after(f|l)?))|an(f|l)?)|c(s(in(h(f|l)?|f|l)?|qrt(f|l)?)|cos(h(f)?|f|l)?|imag(f|l)?|t(ime|an(h(f|l)?|f|l)?)|o(s(h(f|l)?|f|l)?|nj(f|l)?|pysign(f|l)?)|p(ow(f|l)?|roj(f|l)?)|e(il(f|l)?|xp(f|l)?)|l(o(ck|g(f|l)?)|earerr)|a(sin(h(f|l)?|f|l)?|cos(h(f|l)?|f|l)?|tan(h(f|l)?|f|l)?|lloc|rg(f|l)?|bs(f|l)?)|real(f|l)?|brt(f|l)?)|t(ime|o(upper|lower)|an(h(f|l)?|f|l)?|runc(f|l)?|gamma(f|l)?|mp(nam|file))|i(s(space|n(ormal|an)|cntrl|inf|digit|u(nordered|pper)|p(unct|rint)|finite|w(space|c(ntrl|type)|digit|upper|p(unct|rint)|lower|al(num|pha)|graph|xdigit|blank)|l(ower|ess(equal|greater)?)|al(num|pha)|gr(eater(equal)?|aph)|xdigit|blank)|logb(f|l)?|max(div|abs))|di(v|fftime)|_Exit|unget(c|wc)|p(ow(f|l)?|ut(s|c(har)?|wc(har)?)|error|rintf)|e(rf(c(f|l)?|f|l)?|x(it|p(2(f|l)?|f|l|m1(f|l)?)?))|v(s(scanf|nprintf|canf|printf|w(scanf|printf))|printf|f(scanf|printf|w(scanf|printf))|w(scanf|printf)|a_(start|copy|end|arg))|qsort|f(s(canf|e(tpos|ek))|close|tell|open|dim(f|l)?|p(classify|ut(s|c|w(s|c))|rintf)|e(holdexcept|set(e(nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(aiseexcept|ror)|get(e(nv|xceptflag)|round))|flush|w(scanf|ide|printf|rite)|loor(f|l)?|abs(f|l)?|get(s|c|pos|w(s|c))|re(open|e|ad|xp(f|l)?)|m(in(f|l)?|od(f|l)?|a(f|l|x(f|l)?)?))|l(d(iv|exp(f|l)?)|o(ngjmp|cal(time|econv)|g(1(p(f|l)?|0(f|l)?)|2(f|l)?|f|l|b(f|l)?)?)|abs|l(div|abs|r(int(f|l)?|ound(f|l)?))|r(int(f|l)?|ound(f|l)?)|gamma(f|l)?)|w(scanf|c(s(s(tr|pn)|nc(py|at|mp)|c(spn|hr|oll|py|at|mp)|to(imax|d|u(l(l)?|max)|k|f|l(d|l)?|mbs)|pbrk|ftime|len|r(chr|tombs)|xfrm)|to(b|mb)|rtomb)|printf|mem(set|c(hr|py|mp)|move))|a(s(sert|ctime|in(h(f|l)?|f|l)?)|cos(h(f|l)?|f|l)?|t(o(i|f|l(l)?)|exit|an(h(f|l)?|2(f|l)?|f|l)?)|b(s|ort))|g(et(s|c(har)?|env|wc(har)?)|mtime)|r(int(f|l)?|ound(f|l)?|e(name|alloc|wind|m(ove|quo(f|l)?|ainder(f|l)?))|a(nd|ise))|b(search|towc)|m(odf(f|l)?|em(set|c(hr|py|mp)|move)|ktime|alloc|b(s(init|towcs|rtowcs)|towc|len|r(towc|len))))\\b" + }, + { + "captures": { + "1": { + "name": "punctuation.whitespace.function-call.leading.objc" + }, + "2": { + "name": "support.function.any-method.objc" + }, + "3": { + "name": "punctuation.definition.parameters.objc" + } + }, + "match": "(?x) (?: (?= \\s ) (?:(?<=else|new|return) | (?[a-zA-Z_$][\\w$]*))\t # macro name\n(?:\n (\\()\n\t(\n\t \\s* \\g \\s*\t\t # first argument\n\t ((,) \\s* \\g \\s*)* # additional arguments\n\t (?:\\.\\.\\.)?\t\t\t# varargs ellipsis?\n\t)\n (\\))\n)?", + "beginCaptures": { + "1": { + "name": "keyword.control.directive.define.objc" + }, + "2": { + "name": "punctuation.definition.directive.objc" + }, + "3": { + "name": "entity.name.function.preprocessor.objc" + }, + "5": { + "name": "punctuation.definition.parameters.begin.objc" + }, + "6": { + "name": "variable.parameter.preprocessor.objc" + }, + "8": { + "name": "punctuation.separator.parameters.objc" + }, + "9": { + "name": "punctuation.definition.parameters.end.objc" + } + }, + "end": "(?=(?://|/\\*))|(?", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objc" + } + }, + "name": "string.quoted.other.lt-gt.include.objc" + } + ] + }, + { + "include": "#pragma-mark" + }, + { + "begin": "^\\s*((#)\\s*line)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.directive.line.objc" + }, + "2": { + "name": "punctuation.definition.directive.objc" + } + }, + "end": "(?=(?://|/\\*))|(?\\]\\)]))\\s*([a-zA-Z_]\\w*)\\s*(?=(?:\\[\\]\\s*)?(?:,|\\)))", + "captures": { + "1": { + "name": "variable.parameter.probably.objc" + } + } + }, + "access-method": { + "name": "meta.function-call.member.objc", + "begin": "([a-zA-Z_][a-zA-Z_0-9]*|(?<=[\\]\\)]))\\s*(?:(\\.)|(->))((?:(?:[a-zA-Z_][a-zA-Z_0-9]*)\\s*(?:(?:\\.)|(?:->)))*)\\s*([a-zA-Z_][a-zA-Z_0-9]*)(\\()", + "beginCaptures": { + "1": { + "name": "variable.object.objc" + }, + "2": { + "name": "punctuation.separator.dot-access.objc" + }, + "3": { + "name": "punctuation.separator.pointer-access.objc" + }, + "4": { + "patterns": [ + { + "match": "\\.", + "name": "punctuation.separator.dot-access.objc" + }, + { + "match": "->", + "name": "punctuation.separator.pointer-access.objc" + }, + { + "match": "[a-zA-Z_][a-zA-Z_0-9]*", + "name": "variable.object.objc" + }, + { + "name": "everything.else.objc", + "match": ".+" + } + ] + }, + "5": { + "name": "entity.name.function.member.objc" + }, + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.function.member.objc" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.function.member.objc" + } + }, + "patterns": [ + { + "include": "#function-call-innards" + } + ] + }, + "block": { + "patterns": [ + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.objc" + } + }, + "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)", + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.objc" + } + }, + "name": "meta.block.objc", + "patterns": [ + { + "include": "#block_innards" + } + ] + } + ] + }, + "block_innards": { + "patterns": [ + { + "include": "#preprocessor-rule-enabled-block" + }, + { + "include": "#preprocessor-rule-disabled-block" + }, + { + "include": "#preprocessor-rule-conditional-block" + }, + { + "include": "#method_access" + }, + { + "include": "#member_access" + }, + { + "include": "#c_function_call" + }, + { + "name": "meta.initialization.objc", + "begin": "(?x)\n(?:\n (?:\n\t(?=\\s)(?=+!]+ | \\(\\) | \\[\\]))\n)\n\\s*(\\() # opening bracket", + "beginCaptures": { + "1": { + "name": "variable.other.objc" + }, + "2": { + "name": "punctuation.section.parens.begin.bracket.round.initialization.objc" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.initialization.objc" + } + }, + "patterns": [ + { + "include": "#function-call-innards" + } + ] + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.block.begin.bracket.curly.objc" + } + }, + "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)", + "endCaptures": { + "0": { + "name": "punctuation.section.block.end.bracket.curly.objc" + } + }, + "patterns": [ + { + "include": "#block_innards" + } + ] + }, + { + "include": "#parens-block" + }, + { + "include": "$base" + } + ] + }, + "c_function_call": { + "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(?=\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*\\( # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", + "end": "(?<=\\))(?!\\w)", + "name": "meta.function-call.objc", + "patterns": [ + { + "include": "#function-call-innards" + } + ] + }, + "comments": { + "patterns": [ + { + "captures": { + "1": { + "name": "meta.toc-list.banner.block.objc" + } + }, + "match": "^/\\* =(\\s*.*?)\\s*= \\*/$\\n?", + "name": "comment.block.objc" + }, + { + "begin": "/\\*", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.begin.objc" + } + }, + "end": "\\*/", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.end.objc" + } + }, + "name": "comment.block.objc" + }, + { + "captures": { + "1": { + "name": "meta.toc-list.banner.line.objc" + } + }, + "match": "^// =(\\s*.*?)\\s*=\\s*$\\n?", + "name": "comment.line.banner.objc" + }, + { + "begin": "(^[ \\t]+)?(?=//)", + "beginCaptures": { + "1": { + "name": "punctuation.whitespace.comment.leading.objc" + } + }, + "end": "(?!\\G)", + "patterns": [ + { + "begin": "//", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.objc" + } + }, + "end": "(?=\\n)", + "name": "comment.line.double-slash.objc", + "patterns": [ + { + "include": "#line_continuation_character" + } + ] + } + ] + } + ] + }, + "disabled": { + "begin": "^\\s*#\\s*if(n?def)?\\b.*$", + "end": "^\\s*#\\s*endif\\b", + "patterns": [ + { + "include": "#disabled" + }, + { + "include": "#pragma-mark" + } + ] + }, + "line_continuation_character": { + "patterns": [ + { + "match": "(\\\\)\\n", + "captures": { + "1": { + "name": "constant.character.escape.line-continuation.objc" + } + } + } + ] + }, + "parens": { + "name": "meta.parens.objc", + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.objc" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.objc" + } + }, + "patterns": [ + { + "include": "$base" + } + ] + }, + "parens-block": { + "name": "meta.parens.block.objc", + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.objc" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.objc" + } + }, + "patterns": [ + { + "include": "#block_innards" + }, + { + "match": "(?-mix:(?>=|\\|=", + "name": "keyword.operator.assignment.compound.bitwise.objc" + }, + { + "match": "<<|>>", + "name": "keyword.operator.bitwise.shift.objc" + }, + { + "match": "!=|<=|>=|==|<|>", + "name": "keyword.operator.comparison.objc" + }, + { + "match": "&&|!|\\|\\|", + "name": "keyword.operator.logical.objc" + }, + { + "match": "&|\\||\\^|~", + "name": "keyword.operator.objc" + }, + { + "match": "=", + "name": "keyword.operator.assignment.objc" + }, + { + "match": "%|\\*|/|-|\\+", + "name": "keyword.operator.objc" + }, + { + "begin": "(\\?)", + "beginCaptures": { + "1": { + "name": "keyword.operator.ternary.objc" + } + }, + "end": "(:)", + "endCaptures": { + "1": { + "name": "keyword.operator.ternary.objc" + } + }, + "patterns": [ + { + "include": "#function-call-innards" + }, + { + "include": "$base" + } + ] + } + ] + }, + "strings": { + "patterns": [ + { + "begin": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.objc" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objc" + } + }, + "name": "string.quoted.double.objc", + "patterns": [ + { + "include": "#string_escaped_char" + }, + { + "include": "#string_placeholder" + }, + { + "include": "#line_continuation_character" + } + ] + }, + { + "begin": "'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.objc" + } + }, + "end": "'", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objc" + } + }, + "name": "string.quoted.single.objc", + "patterns": [ + { + "include": "#string_escaped_char" + }, + { + "include": "#line_continuation_character" + } + ] + } + ] + }, + "string_escaped_char": { + "patterns": [ + { + "match": "(?x)\\\\ (\n\\\\\t\t\t |\n[abefnprtv'\"?] |\n[0-3]\\d{,2}\t |\n[4-7]\\d?\t\t|\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )", + "name": "constant.character.escape.objc" + }, + { + "match": "\\\\.", + "name": "invalid.illegal.unknown-escape.objc" + } + ] + }, + "string_placeholder": { + "patterns": [ + { + "match": "(?x) %\n(\\d+\\$)?\t\t\t\t\t\t # field (argument #)\n[#0\\- +']*\t\t\t\t\t\t # flags\n[,;:_]?\t\t\t\t\t\t\t # separator character (AltiVec)\n((-?\\d+)|\\*(-?\\d+\\$)?)?\t\t # minimum field width\n(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)?\t# precision\n(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier\n[diouxXDOUeEfFgGaACcSspn%]\t\t # conversion type", + "name": "constant.other.placeholder.objc" + }, + { + "match": "(%)(?!\"\\s*(PRI|SCN))", + "captures": { + "1": { + "name": "invalid.illegal.placeholder.objc" + } + } + } + ] + }, + "storage_types": { + "patterns": [ + { + "match": "(?-mix:(?=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", + "end": "(?<=\\))(?!\\w)|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.name.function.objc" + }, + "2": { + "name": "punctuation.section.arguments.begin.bracket.round.objc" + } + }, + "end": "(\\))|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.name.function.objc" + }, + "2": { + "name": "punctuation.section.parameters.begin.bracket.round.objc" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parameters.end.bracket.round.objc" + } + }, + "patterns": [ + { + "include": "#probably_a_parameter" + }, + { + "include": "#function-innards" + } + ] + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.objc" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.objc" + } + }, + "patterns": [ + { + "include": "#function-innards" + } + ] + }, + { + "include": "$base" + } + ] + }, + "function-call-innards": { + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#storage_types" + }, + { + "include": "#method_access" + }, + { + "include": "#member_access" + }, + { + "include": "#operators" + }, + { + "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.name.function.objc" + }, + "2": { + "name": "punctuation.section.arguments.begin.bracket.round.objc" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.arguments.end.bracket.round.objc" + } + }, + "patterns": [ + { + "include": "#function-call-innards" + } + ] + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.objc" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.parens.end.bracket.round.objc" + } + }, + "patterns": [ + { + "include": "#function-call-innards" + } + ] + }, + { + "include": "#block_innards" + } + ] + }, + "default_statement": { + "name": "meta.conditional.case.objc", + "begin": "((?\\[\\]=]))", + "patterns": [ + { + "name": "meta.head.switch.objc", + "begin": "\\G ?", + "end": "((?:\\{|(?=;)))", + "endCaptures": { + "1": { + "name": "punctuation.section.block.begin.bracket.curly.switch.objc" + } + }, + "patterns": [ + { + "include": "#switch_conditional_parentheses" + }, + { + "include": "$base" + } + ] + }, + { + "name": "meta.body.switch.objc", + "begin": "(?<=\\{)", + "end": "(\\})", + "endCaptures": { + "1": { + "name": "punctuation.section.block.end.bracket.curly.switch.objc" + } + }, + "patterns": [ + { + "include": "#default_statement" + }, + { + "include": "#case_statement" + }, + { + "include": "$base" + }, + { + "include": "#block_innards" + } + ] + }, + { + "name": "meta.tail.switch.objc", + "begin": "(?<=})[\\s\\n]*", + "end": "[\\s\\n]*(?=;)", + "patterns": [ + { + "include": "$base" + } + ] + } + ] + }, + "switch_conditional_parentheses": { + "name": "meta.conditional.switch.objc", + "begin": "(\\()", + "beginCaptures": { + "1": { + "name": "punctuation.section.parens.begin.bracket.round.conditional.switch.objc" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.section.parens.end.bracket.round.conditional.switch.objc" + } + }, + "patterns": [ + { + "include": "#conditional_context" + } + ] + }, + "static_assert": { + "begin": "(static_assert|_Static_assert)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.other.static_assert.objc" + }, + "2": { + "name": "punctuation.section.arguments.begin.bracket.round.objc" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.section.arguments.end.bracket.round.objc" + } + }, + "patterns": [ + { + "name": "meta.static_assert.message.objc", + "begin": "(,)\\s*(?=(?:L|u8|u|U\\s*\\\")?)", + "beginCaptures": { + "1": { + "name": "punctuation.separator.delimiter.objc" + } + }, + "end": "(?=\\))", + "patterns": [ + { + "include": "#string_context" + }, + { + "include": "#string_context_c" + } + ] + }, + { + "include": "#function_call_context" + } + ] + }, + "conditional_context": { + "patterns": [ + { + "include": "$base" + }, + { + "include": "#block_innards" + } + ] + }, + "member_access": { + "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!(?:void|char|short|int|signed|unsigned|long|float|double|bool|_Bool|_Complex|_Imaginary|u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t|pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t|memory_order|atomic_bool|atomic_char|atomic_schar|atomic_uchar|atomic_short|atomic_ushort|atomic_int|atomic_uint|atomic_long|atomic_ulong|atomic_llong|atomic_ullong|atomic_char16_t|atomic_char32_t|atomic_wchar_t|atomic_int_least8_t|atomic_uint_least8_t|atomic_int_least16_t|atomic_uint_least16_t|atomic_int_least32_t|atomic_uint_least32_t|atomic_int_least64_t|atomic_uint_least64_t|atomic_int_fast8_t|atomic_uint_fast8_t|atomic_int_fast16_t|atomic_uint_fast16_t|atomic_int_fast32_t|atomic_uint_fast32_t|atomic_int_fast64_t|atomic_uint_fast64_t|atomic_intptr_t|atomic_uintptr_t|atomic_size_t|atomic_ptrdiff_t|atomic_intmax_t|atomic_uintmax_t))[a-zA-Z_]\\w*\\b(?!\\())", + "captures": { + "1": { + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objc", + "match": "(.+)" + } + ] + }, + "2": { + "name": "punctuation.separator.dot-access.objc" + }, + "3": { + "name": "punctuation.separator.pointer-access.objc" + }, + "4": { + "patterns": [ + { + "include": "#member_access" + }, + { + "include": "#method_access" + }, + { + "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))", + "captures": { + "1": { + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objc", + "match": "(.+)" + } + ] + }, + "2": { + "name": "punctuation.separator.dot-access.objc" + }, + "3": { + "name": "punctuation.separator.pointer-access.objc" + } + } + } + ] + }, + "5": { + "name": "variable.other.member.objc" + } + } + }, + "method_access": { + "contentName": "meta.function-call.member.objc", + "begin": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*([a-zA-Z_]\\w*)(\\()", + "beginCaptures": { + "1": { + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objc", + "match": "(.+)" + } + ] + }, + "2": { + "name": "punctuation.separator.dot-access.objc" + }, + "3": { + "name": "punctuation.separator.pointer-access.objc" + }, + "4": { + "patterns": [ + { + "include": "#member_access" + }, + { + "include": "#method_access" + }, + { + "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))", + "captures": { + "1": { + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objc", + "match": "(.+)" + } + ] + }, + "2": { + "name": "punctuation.separator.dot-access.objc" + }, + "3": { + "name": "punctuation.separator.pointer-access.objc" + } + } + } + ] + }, + "5": { + "name": "entity.name.function.member.objc" + }, + "6": { + "name": "punctuation.section.arguments.begin.bracket.round.function.member.objc" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.section.arguments.end.bracket.round.function.member.objc" + } + }, + "patterns": [ + { + "include": "#function-call-innards" + } + ] + }, + "numbers": { + "begin": "(?\\\\\\s*\\n)", + "name": "punctuation.separator.continuation.objc" + } + ] + } + ] + } + ] + }, + "disabled": { + "begin": "^\\s*#\\s*if(n?def)?\\b.*$", + "comment": "eat nested preprocessor if(def)s", + "end": "^\\s*#\\s*endif\\b.*$", + "patterns": [ + { + "include": "#disabled" + }, + { + "include": "#pragma-mark" + } + ] + }, + "implementation_innards": { + "patterns": [ + { + "include": "#preprocessor-rule-enabled-implementation" + }, + { + "include": "#preprocessor-rule-disabled-implementation" + }, + { + "include": "#preprocessor-rule-other-implementation" + }, + { + "include": "#property_directive" + }, + { + "include": "#method_super" + }, + { + "include": "$base" + } + ] + }, + "interface_innards": { + "patterns": [ + { + "include": "#preprocessor-rule-enabled-interface" + }, + { + "include": "#preprocessor-rule-disabled-interface" + }, + { + "include": "#preprocessor-rule-other-interface" + }, + { + "include": "#properties" + }, + { + "include": "#protocol_list" + }, + { + "include": "#method" + }, + { + "include": "$base" + } + ] + }, + "method": { + "begin": "^(-|\\+)\\s*", + "end": "(?=\\{|#)|;", + "name": "meta.function.objc", + "patterns": [ + { + "begin": "(\\()", + "beginCaptures": { + "1": { + "name": "punctuation.definition.type.begin.objc" + } + }, + "end": "(\\))\\s*(\\w+\\b)", + "endCaptures": { + "1": { + "name": "punctuation.definition.type.end.objc" + }, + "2": { + "name": "entity.name.function.objc" + } + }, + "name": "meta.return-type.objc", + "patterns": [ + { + "include": "#protocol_list" + }, + { + "include": "#protocol_type_qualifier" + }, + { + "include": "$base" + } + ] + }, + { + "match": "\\b\\w+(?=:)", + "name": "entity.name.function.name-of-parameter.objc" + }, + { + "begin": "((:))\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.name.function.name-of-parameter.objc" + }, + "2": { + "name": "punctuation.separator.arguments.objc" + }, + "3": { + "name": "punctuation.definition.type.begin.objc" + } + }, + "end": "(\\))\\s*(\\w+\\b)?", + "endCaptures": { + "1": { + "name": "punctuation.definition.type.end.objc" + }, + "2": { + "name": "variable.parameter.function.objc" + } + }, + "name": "meta.argument-type.objc", + "patterns": [ + { + "include": "#protocol_list" + }, + { + "include": "#protocol_type_qualifier" + }, + { + "include": "$base" + } + ] + }, + { + "include": "#comment" + } + ] + }, + "method_super": { + "begin": "^(?=-|\\+)", + "end": "(?<=\\})|(?=#)", + "name": "meta.function-with-body.objc", + "patterns": [ + { + "include": "#method" + }, + { + "include": "$base" + } + ] + }, + "pragma-mark": { + "captures": { + "1": { + "name": "meta.preprocessor.objc" + }, + "2": { + "name": "keyword.control.import.pragma.objc" + }, + "3": { + "name": "meta.toc-list.pragma-mark.objc" + } + }, + "match": "^\\s*(#\\s*(pragma\\s+mark)\\s+(.*))", + "name": "meta.section.objc" + }, + "preprocessor-rule-disabled-implementation": { + "begin": "^\\s*(#(if)\\s+(0)\\b).*", + "captures": { + "1": { + "name": "meta.preprocessor.objc" + }, + "2": { + "name": "keyword.control.import.if.objc" + }, + "3": { + "name": "constant.numeric.preprocessor.objc" + } + }, + "end": "^\\s*(#\\s*(endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "begin": "^\\s*(#\\s*(else)\\b)", + "captures": { + "1": { + "name": "meta.preprocessor.objc" + }, + "2": { + "name": "keyword.control.import.else.objc" + } + }, + "end": "(?=^\\s*#\\s*endif\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "include": "#interface_innards" + } + ] + }, + { + "begin": "", + "end": "(?=^\\s*#\\s*(else|endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "name": "comment.block.preprocessor.if-branch.objc", + "patterns": [ + { + "include": "#disabled" + }, + { + "include": "#pragma-mark" + } + ] + } + ] + }, + "preprocessor-rule-disabled-interface": { + "begin": "^\\s*(#(if)\\s+(0)\\b).*", + "captures": { + "1": { + "name": "meta.preprocessor.objc" + }, + "2": { + "name": "keyword.control.import.if.objc" + }, + "3": { + "name": "constant.numeric.preprocessor.objc" + } + }, + "end": "^\\s*(#\\s*(endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "begin": "^\\s*(#\\s*(else)\\b)", + "captures": { + "1": { + "name": "meta.preprocessor.objc" + }, + "2": { + "name": "keyword.control.import.else.objc" + } + }, + "end": "(?=^\\s*#\\s*endif\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "include": "#interface_innards" + } + ] + }, + { + "begin": "", + "end": "(?=^\\s*#\\s*(else|endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "name": "comment.block.preprocessor.if-branch.objc", + "patterns": [ + { + "include": "#disabled" + }, + { + "include": "#pragma-mark" + } + ] + } + ] + }, + "preprocessor-rule-enabled-implementation": { + "begin": "^\\s*(#(if)\\s+(0*1)\\b)", + "captures": { + "1": { + "name": "meta.preprocessor.objc" + }, + "2": { + "name": "keyword.control.import.if.objc" + }, + "3": { + "name": "constant.numeric.preprocessor.objc" + } + }, + "end": "^\\s*(#\\s*(endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "begin": "^\\s*(#\\s*(else)\\b).*", + "captures": { + "1": { + "name": "meta.preprocessor.objc" + }, + "2": { + "name": "keyword.control.import.else.objc" + } + }, + "contentName": "comment.block.preprocessor.else-branch.objc", + "end": "(?=^\\s*#\\s*endif\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "include": "#disabled" + }, + { + "include": "#pragma-mark" + } + ] + }, + { + "begin": "", + "end": "(?=^\\s*#\\s*(else|endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "include": "#implementation_innards" + } + ] + } + ] + }, + "preprocessor-rule-enabled-interface": { + "begin": "^\\s*(#(if)\\s+(0*1)\\b)", + "captures": { + "1": { + "name": "meta.preprocessor.objc" + }, + "2": { + "name": "keyword.control.import.if.objc" + }, + "3": { + "name": "constant.numeric.preprocessor.objc" + } + }, + "end": "^\\s*(#\\s*(endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "begin": "^\\s*(#\\s*(else)\\b).*", + "captures": { + "1": { + "name": "meta.preprocessor.objc" + }, + "2": { + "name": "keyword.control.import.else.objc" + } + }, + "contentName": "comment.block.preprocessor.else-branch.objc", + "end": "(?=^\\s*#\\s*endif\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "include": "#disabled" + }, + { + "include": "#pragma-mark" + } + ] + }, + { + "begin": "", + "end": "(?=^\\s*#\\s*(else|endif)\\b.*?(?:(?=(?://|/\\*))|$))", + "patterns": [ + { + "include": "#interface_innards" + } + ] + } + ] + }, + "preprocessor-rule-other-implementation": { + "begin": "^\\s*(#\\s*(if(n?def)?)\\b.*?(?:(?=(?://|/\\*))|$))", + "captures": { + "1": { + "name": "meta.preprocessor.objc" + }, + "2": { + "name": "keyword.control.import.objc" + } + }, + "end": "^\\s*(#\\s*(endif)\\b).*?(?:(?=(?://|/\\*))|$)", + "patterns": [ + { + "include": "#implementation_innards" + } + ] + }, + "preprocessor-rule-other-interface": { + "begin": "^\\s*(#\\s*(if(n?def)?)\\b.*?(?:(?=(?://|/\\*))|$))", + "captures": { + "1": { + "name": "meta.preprocessor.objc" + }, + "2": { + "name": "keyword.control.import.objc" + } + }, + "end": "^\\s*(#\\s*(endif)\\b).*?(?:(?=(?://|/\\*))|$)", + "patterns": [ + { + "include": "#interface_innards" + } + ] + }, + "properties": { + "patterns": [ + { + "begin": "((@)property)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.other.property.objc" + }, + "2": { + "name": "punctuation.definition.keyword.objc" + }, + "3": { + "name": "punctuation.section.scope.begin.objc" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.section.scope.end.objc" + } + }, + "name": "meta.property-with-attributes.objc", + "patterns": [ + { + "match": "\\b(getter|setter|readonly|readwrite|assign|retain|copy|nonatomic|atomic|strong|weak|nonnull|nullable|null_resettable|null_unspecified|class|direct)\\b", + "name": "keyword.other.property.attribute.objc" + } + ] + }, + { + "captures": { + "1": { + "name": "keyword.other.property.objc" + }, + "2": { + "name": "punctuation.definition.keyword.objc" + } + }, + "match": "((@)property)\\b", + "name": "meta.property.objc" + } + ] + }, + "property_directive": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objc" + } + }, + "match": "(@)(dynamic|synthesize)\\b", + "name": "keyword.other.property.directive.objc" + }, + "protocol_list": { + "begin": "(<)", + "beginCaptures": { + "1": { + "name": "punctuation.section.scope.begin.objc" + } + }, + "end": "(>)", + "endCaptures": { + "1": { + "name": "punctuation.section.scope.end.objc" + } + }, + "name": "meta.protocol-list.objc", + "patterns": [ + { + "match": "\\bNS(GlyphStorage|M(utableCopying|enuItem)|C(hangeSpelling|o(ding|pying|lorPicking(Custom|Default)))|T(oolbarItemValidations|ext(Input|AttachmentCell))|I(nputServ(iceProvider|erMouseTracker)|gnoreMisspelledWords)|Obj(CTypeSerializationCallBack|ect)|D(ecimalNumberBehaviors|raggingInfo)|U(serInterfaceValidations|RL(HandleClient|DownloadDelegate|ProtocolClient|AuthenticationChallengeSender))|Validated(ToobarItem|UserInterfaceItem)|Locking)\\b", + "name": "support.other.protocol.objc" + } + ] + }, + "protocol_type_qualifier": { + "match": "\\b(in|out|inout|oneway|bycopy|byref|nonnull|nullable|_Nonnull|_Nullable|_Null_unspecified)\\b", + "name": "storage.modifier.protocol.objc" + }, + "special_variables": { + "patterns": [ + { + "match": "\\b_cmd\\b", + "name": "variable.other.selector.objc" + }, + { + "match": "\\b(self|super)\\b", + "name": "variable.language.objc" + } + ] + }, + "string_escaped_char": { + "patterns": [ + { + "match": "(?x)\\\\ (\n\\\\\t\t\t |\n[abefnprtv'\"?] |\n[0-3]\\d{,2}\t |\n[4-7]\\d?\t\t|\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )", + "name": "constant.character.escape.objc" + }, + { + "match": "\\\\.", + "name": "invalid.illegal.unknown-escape.objc" + } + ] + }, + "string_placeholder": { + "patterns": [ + { + "match": "(?x) %\n(\\d+\\$)?\t\t\t\t\t\t # field (argument #)\n[#0\\- +']*\t\t\t\t\t\t # flags\n[,;:_]?\t\t\t\t\t\t\t # separator character (AltiVec)\n((-?\\d+)|\\*(-?\\d+\\$)?)?\t\t # minimum field width\n(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)?\t# precision\n(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier\n[diouxXDOUeEfFgGaACcSspn%]\t\t # conversion type", + "name": "constant.other.placeholder.objc" + }, + { + "match": "(%)(?!\"\\s*(PRI|SCN))", + "captures": { + "1": { + "name": "invalid.illegal.placeholder.objc" + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/desktop/internal/editor/syntax/grammars/php-html.tmLanguage.json b/desktop/internal/editor/syntax/grammars/php-html.tmLanguage.json new file mode 100644 index 0000000000..86defb9926 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/php-html.tmLanguage.json @@ -0,0 +1,98 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/KapitanOczywisty/language-php/blob/master/grammars/html.cson", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/KapitanOczywisty/language-php/commit/ff64523c94c014d68f5dec189b05557649c5872a", + "name": "PHP", + "scopeName": "text.html.php", + "injections": { + "L:meta.embedded.php.blade": { + "patterns": [ + { + "include": "text.html.basic" + }, + { + "include": "text.html.php.blade#blade" + } + ] + }, + "text.html.php - (meta.embedded | meta.tag), L:((text.html.php meta.tag) - (meta.embedded.block.php | meta.embedded.line.php)), L:(source.js - (meta.embedded.block.php | meta.embedded.line.php)), L:(source.css - (meta.embedded.block.php | meta.embedded.line.php))": { + "patterns": [ + { + "include": "#php-tag" + } + ] + } + }, + "patterns": [ + { + "begin": "\\A#!", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.php" + } + }, + "end": "$", + "name": "comment.line.shebang.php" + }, + { + "include": "text.html.derivative" + } + ], + "repository": { + "php-tag": { + "patterns": [ + { + "begin": "<\\?(?i:php|=)?(?![^?]*\\?>)", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + } + }, + "end": "(\\?)>", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "source.php" + } + }, + "name": "meta.embedded.block.php", + "contentName": "source.php", + "patterns": [ + { + "include": "source.php" + } + ] + }, + { + "begin": "<\\?(?i:php|=)?", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + } + }, + "end": "(\\?)>", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "source.php" + } + }, + "name": "meta.embedded.line.php", + "contentName": "source.php", + "patterns": [ + { + "include": "source.php" + } + ] + } + ] + } + } +} \ No newline at end of file diff --git a/desktop/internal/editor/syntax/grammars/php.tmLanguage.json b/desktop/internal/editor/syntax/grammars/php.tmLanguage.json new file mode 100644 index 0000000000..2101987285 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/php.tmLanguage.json @@ -0,0 +1,4192 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/KapitanOczywisty/language-php/blob/master/grammars/php.cson", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/KapitanOczywisty/language-php/commit/d94fd6b7dff1613d34bc0d36328f9982e65bd545", + "scopeName": "source.php", + "patterns": [ + { + "include": "#attribute" + }, + { + "include": "#comments" + }, + { + "match": "(?i)(?:^|(?<=<\\?php))\\s*(namespace)\\s+([a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)(?=\\s*;)", + "name": "meta.namespace.php", + "captures": { + "1": { + "name": "keyword.other.namespace.php" + }, + "2": { + "name": "entity.name.type.namespace.php", + "patterns": [ + { + "match": "\\\\", + "name": "punctuation.separator.inheritance.php" + } + ] + } + } + }, + { + "begin": "(?i)(?:^|(?<=<\\?php))\\s*(namespace)\\s+", + "beginCaptures": { + "1": { + "name": "keyword.other.namespace.php" + } + }, + "end": "(?<=})|(?=\\?>)", + "name": "meta.namespace.php", + "patterns": [ + { + "include": "#comments" + }, + { + "match": "(?i)[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+", + "name": "entity.name.type.namespace.php", + "captures": { + "0": { + "patterns": [ + { + "match": "\\\\", + "name": "punctuation.separator.inheritance.php" + } + ] + } + } + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.namespace.begin.bracket.curly.php" + } + }, + "end": "}|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.namespace.end.bracket.curly.php" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "match": "[^\\s]+", + "name": "invalid.illegal.identifier.php" + } + ] + }, + { + "match": "\\s+(?=use\\b)" + }, + { + "begin": "(?i)\\buse\\b", + "beginCaptures": { + "0": { + "name": "keyword.other.use.php" + } + }, + "end": "(?<=})|(?=;)|(?=\\?>)", + "name": "meta.use.php", + "patterns": [ + { + "match": "\\b(const|function)\\b", + "name": "storage.type.${1:/downcase}.php" + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.use.begin.bracket.curly.php" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.definition.use.end.bracket.curly.php" + } + }, + "patterns": [ + { + "include": "#scope-resolution" + }, + { + "match": "(?xi)\n\\b(as)\n\\s+(\n (final|abstract)\n |(public|private|protected)\n |(static)\n)\n\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)", + "captures": { + "1": { + "name": "keyword.other.use-as.php" + }, + "2": { + "name": "storage.modifier.php" + }, + "3": { + "name": "storage.modifier.inheritance.${3:/downcase}.php" + }, + "4": { + "name": "storage.modifier.visibility.${4:/downcase}.php" + }, + "5": { + "name": "storage.modifier.static.php" + }, + "6": { + "name": "entity.other.alias.php" + } + } + }, + { + "match": "(?xi)\n\\b(as)\n\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)", + "captures": { + "1": { + "name": "keyword.other.use-as.php" + }, + "2": { + "patterns": [ + { + "match": "(?xi)\n\\b(?:\n (final|abstract)\n |(public|private|protected)\n |(static)\n)\\b", + "name": "storage.modifier.php", + "captures": { + "1": { + "name": "storage.modifier.inheritance.${1:/downcase}.php" + }, + "2": { + "name": "storage.modifier.visibility.${2:/downcase}.php" + }, + "3": { + "name": "storage.modifier.static.php" + } + } + }, + { + "match": ".+", + "name": "entity.other.alias.php" + } + ] + } + } + }, + { + "match": "(?i)\\b(insteadof)\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)", + "captures": { + "1": { + "name": "keyword.other.use-insteadof.php" + }, + "2": { + "name": "support.class.php" + } + } + }, + { + "match": ";", + "name": "punctuation.terminator.expression.php" + }, + { + "include": "#use-inner" + } + ] + }, + { + "include": "#use-inner" + } + ] + }, + { + "begin": "(?ix)\n\\b(trait)\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)", + "beginCaptures": { + "1": { + "name": "storage.type.trait.php" + }, + "2": { + "name": "entity.name.type.trait.php" + } + }, + "end": "}|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.trait.end.bracket.curly.php" + } + }, + "name": "meta.trait.php", + "patterns": [ + { + "include": "#comments" + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.trait.begin.bracket.curly.php" + } + }, + "end": "(?=}|\\?>)", + "contentName": "meta.trait.body.php", + "patterns": [ + { + "include": "$self" + } + ] + } + ] + }, + { + "begin": "(?ix)\n\\b(interface)\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)", + "beginCaptures": { + "1": { + "name": "storage.type.interface.php" + }, + "2": { + "name": "entity.name.type.interface.php" + } + }, + "end": "}|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.interface.end.bracket.curly.php" + } + }, + "name": "meta.interface.php", + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#interface-extends" + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.interface.begin.bracket.curly.php" + } + }, + "end": "(?=}|\\?>)", + "contentName": "meta.interface.body.php", + "patterns": [ + { + "include": "#class-constant" + }, + { + "include": "$self" + } + ] + } + ] + }, + { + "begin": "(?ix)\n\\b(enum)\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)\n(?: \\s* (:) \\s* (int | string) \\b )?", + "beginCaptures": { + "1": { + "name": "storage.type.enum.php" + }, + "2": { + "name": "entity.name.type.enum.php" + }, + "3": { + "name": "keyword.operator.return-value.php" + }, + "4": { + "name": "keyword.other.type.php" + } + }, + "end": "}|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.enum.end.bracket.curly.php" + } + }, + "name": "meta.enum.php", + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#class-implements" + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.enum.begin.bracket.curly.php" + } + }, + "end": "(?=}|\\?>)", + "contentName": "meta.enum.body.php", + "patterns": [ + { + "match": "(?i)\\b((case))\\s*([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)", + "captures": { + "1": { + "name": "storage.modifier.php" + }, + "2": { + "name": "storage.type.enum.case.php" + }, + "3": { + "name": "constant.enum.php" + } + } + }, + { + "include": "#class-constant" + }, + { + "include": "$self" + } + ] + } + ] + }, + { + "begin": "(?ix)\n(?:\n \\b((?:(?:final|abstract|readonly)\\s+)*)(class)\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)\n |\\b(new)\\b\\s*(\\#\\[.*\\])?\\s*(?:((readonly))\\s+)?\\b(class)\\b # anonymous class\n)", + "beginCaptures": { + "1": { + "patterns": [ + { + "match": "(?i)(final|abstract)|(readonly)", + "name": "storage.modifier.php", + "captures": { + "1": { + "name": "storage.modifier.inheritance.${1:/downcase}.php" + }, + "2": { + "name": "storage.modifier.readonly.php" + } + } + } + ] + }, + "2": { + "name": "storage.type.class.php" + }, + "3": { + "name": "entity.name.type.class.php" + }, + "4": { + "name": "keyword.other.new.php" + }, + "5": { + "patterns": [ + { + "include": "#attribute" + } + ] + }, + "6": { + "name": "storage.modifier.php" + }, + "7": { + "name": "storage.modifier.readonly.php" + }, + "8": { + "name": "storage.type.class.php" + } + }, + "end": "}|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.class.end.bracket.curly.php" + } + }, + "name": "meta.class.php", + "patterns": [ + { + "begin": "(?<=class)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "punctuation.definition.arguments.begin.bracket.round.php" + } + }, + "end": "\\)|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.bracket.round.php" + } + }, + "name": "meta.function-call.php", + "patterns": [ + { + "include": "#named-arguments" + }, + { + "include": "$self" + } + ] + }, + { + "include": "#comments" + }, + { + "include": "#class-extends" + }, + { + "include": "#class-implements" + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.class.begin.bracket.curly.php" + } + }, + "end": "(?=}|\\?>)", + "contentName": "meta.class.body.php", + "patterns": [ + { + "include": "#class-constant" + }, + { + "include": "$self" + } + ] + } + ] + }, + { + "include": "#match_statement" + }, + { + "include": "#switch_statement" + }, + { + "match": "\\s*\\b(yield\\s+from)\\b", + "captures": { + "1": { + "name": "keyword.control.yield-from.php" + } + } + }, + { + "match": "(?x)\n\\b(\n break|case|continue|declare|default|die|do|\n else(if)?|end(declare|for(each)?|if|switch|while)|exit|\n for(each)?|if|return|switch|use|while|yield\n)\\b", + "captures": { + "1": { + "name": "keyword.control.${1:/downcase}.php" + } + } + }, + { + "begin": "(?i)\\b((?:require|include)(?:_once)?)(\\s+|(?=\\())", + "beginCaptures": { + "1": { + "name": "keyword.control.import.include.php" + } + }, + "end": "(?=\\s|;|$|\\?>)", + "name": "meta.include.php", + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "begin": "\\b(catch)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.control.exception.catch.php" + }, + "2": { + "name": "punctuation.definition.parameters.begin.bracket.round.php" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.end.bracket.round.php" + } + }, + "name": "meta.catch.php", + "patterns": [ + { + "match": "(?xi)\n([a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ (?: \\s*\\|\\s* [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)*) # union or single exception class\n\\s*\n((\\$+)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)? # Variable", + "captures": { + "1": { + "patterns": [ + { + "match": "\\|", + "name": "punctuation.separator.delimiter.php" + }, + { + "begin": "(?i)(?=[\\\\a-z_\\x{7f}-\\x{10ffff}])", + "end": "(?xi)\n( [a-z_\\x{7f}-\\x{10ffff}] [a-z0-9_\\x{7f}-\\x{10ffff}]* )\n(?![a-z0-9_\\x{7f}-\\x{10ffff}\\\\])", + "endCaptures": { + "1": { + "name": "support.class.exception.php" + } + }, + "patterns": [ + { + "include": "#namespace" + } + ] + } + ] + }, + "2": { + "name": "variable.other.php" + }, + "3": { + "name": "punctuation.definition.variable.php" + } + } + } + ] + }, + { + "match": "\\b(catch|try|throw|exception|finally)\\b", + "name": "keyword.control.exception.php" + }, + { + "begin": "(?i)\\b(function)\\s*(?=&?\\s*\\()", + "beginCaptures": { + "1": { + "name": "storage.type.function.php" + } + }, + "end": "(?=\\s*{)", + "name": "meta.function.closure.php", + "patterns": [ + { + "include": "#comments" + }, + { + "begin": "(&)?\\s*(\\()", + "beginCaptures": { + "1": { + "name": "storage.modifier.reference.php" + }, + "2": { + "name": "punctuation.definition.parameters.begin.bracket.round.php" + } + }, + "contentName": "meta.function.parameters.php", + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.end.bracket.round.php" + } + }, + "patterns": [ + { + "include": "#function-parameters" + } + ] + }, + { + "begin": "(?i)(use)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.other.function.use.php" + }, + "2": { + "name": "punctuation.definition.parameters.begin.bracket.round.php" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.end.bracket.round.php" + } + }, + "name": "meta.function.closure.use.php", + "patterns": [ + { + "match": ",", + "name": "punctuation.separator.delimiter.php" + }, + { + "captures": { + "1": { + "name": "variable.other.php" + }, + "2": { + "name": "storage.modifier.reference.php" + }, + "3": { + "name": "punctuation.definition.variable.php" + } + }, + "match": "(?i)((?:(&)\\s*)?(\\$+)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)\\s*(?=,|\\))" + } + ] + }, + { + "match": "(?xi)\n(:)\\s*\n(\n # nullable type\n (?:\\?\\s*)? [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ |\n # union, intersection or DNF type\n (?: [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ | \\(\\s* [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+(?:\\s*&\\s*[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)+ \\s*\\) )\n (?: \\s*[|&]\\s*\n (?: [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ | \\(\\s* [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+(?:\\s*&\\s*[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)+ \\s*\\) )\n )+\n)\n(?=\\s*(?:{|/[/*]|\\#|$))", + "captures": { + "1": { + "name": "keyword.operator.return-value.php" + }, + "2": { + "patterns": [ + { + "include": "#php-types" + } + ] + } + } + } + ] + }, + { + "begin": "(?i)\\b(fn)\\s*(?=&?\\s*\\()", + "beginCaptures": { + "1": { + "name": "storage.type.function.php" + } + }, + "end": "=>", + "endCaptures": { + "0": { + "name": "punctuation.definition.arrow.php" + } + }, + "name": "meta.function.closure.php", + "patterns": [ + { + "begin": "(?:(&)\\s*)?(\\()", + "beginCaptures": { + "1": { + "name": "storage.modifier.reference.php" + }, + "2": { + "name": "punctuation.definition.parameters.begin.bracket.round.php" + } + }, + "contentName": "meta.function.parameters.php", + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.end.bracket.round.php" + } + }, + "patterns": [ + { + "include": "#function-parameters" + } + ] + }, + { + "match": "(?xi)\n(:)\\s*\n(\n # nullable type\n (?:\\?\\s*)? [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ |\n # union, intersection or DNF type\n (?: [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ | \\(\\s* [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+(?:\\s*&\\s*[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)+ \\s*\\) )\n (?: \\s*[|&]\\s*\n (?: [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ | \\(\\s* [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+(?:\\s*&\\s*[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)+ \\s*\\) )\n )+\n)\n(?=\\s*(?:=>|/[/*]|\\#|$))", + "captures": { + "1": { + "name": "keyword.operator.return-value.php" + }, + "2": { + "patterns": [ + { + "include": "#php-types" + } + ] + } + } + } + ] + }, + { + "begin": "(?x)\n((?:(?:final|abstract|public|private|protected)\\s+)*)\n(function)\\s+(__construct)\n\\s*(\\()", + "beginCaptures": { + "1": { + "patterns": [ + { + "match": "(?i)(final|abstract)|(public|private|protected)", + "name": "storage.modifier.php", + "captures": { + "1": { + "name": "storage.modifier.inheritance.${1:/downcase}.php" + }, + "2": { + "name": "storage.modifier.visibility.${2:/downcase}.php" + } + } + } + ] + }, + "2": { + "name": "storage.type.function.php" + }, + "3": { + "name": "support.function.constructor.php" + }, + "4": { + "name": "punctuation.definition.parameters.begin.bracket.round.php" + } + }, + "contentName": "meta.function.parameters.php", + "end": "(?xi)\n(\\)) \\s* ( : \\s*\n (?:\\?\\s*)? (?!\\s) [a-z0-9_\\x{7f}-\\x{10ffff}\\\\\\s\\|&()]+ (?)", + "endCaptures": { + "0": { + "name": "punctuation.definition.array.end.bracket.round.php" + } + }, + "name": "meta.array.php", + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "match": "(?ix)\n(\\()\n\\s*\n(\n (bool|int|float|string|array|object)\n |(binary|boolean|integer|double|real|unset)\n)\n\\s*\n(\\))", + "captures": { + "1": { + "name": "punctuation.definition.storage-type.begin.bracket.round.php" + }, + "2": { + "name": "storage.type.php" + }, + "3": { + "name": "storage.type.cast.${3:/downcase}.php" + }, + "5": { + "name": "punctuation.definition.storage-type.end.bracket.round.php" + } + } + }, + { + "match": "(?i)\\b(array|real|double|float|int(eger)?|bool(ean)?|string|class|var|function|interface|trait|parent|self|object|mixed)\\b", + "name": "storage.type.php" + }, + { + "match": "(?i)\\bconst\\b", + "name": "storage.type.const.php" + }, + { + "match": "(?xi)\n\\b(?:\n (global)\n |(abstract|final)\n |(private|protected|public)\n |(static)\n)\\b", + "name": "storage.modifier.php", + "captures": { + "1": { + "name": "storage.modifier.global.php" + }, + "2": { + "name": "storage.modifier.inheritance.${2:/downcase}.php" + }, + "3": { + "name": "storage.modifier.visibility.${3:/downcase}.php" + }, + "4": { + "name": "storage.modifier.static.php" + } + } + }, + { + "include": "#object" + }, + { + "match": ";", + "name": "punctuation.terminator.expression.php" + }, + { + "match": ":", + "name": "punctuation.terminator.statement.php" + }, + { + "include": "#heredoc" + }, + { + "include": "#numbers" + }, + { + "match": "(?i)\\bclone\\b", + "name": "keyword.other.clone.php" + }, + { + "match": "\\.\\.\\.", + "name": "keyword.operator.spread.php" + }, + { + "match": "\\.=?", + "name": "keyword.operator.string.php" + }, + { + "match": "=>", + "name": "keyword.operator.key.php" + }, + { + "captures": { + "1": { + "name": "keyword.operator.assignment.php" + }, + "2": { + "name": "storage.modifier.reference.php" + }, + "3": { + "name": "storage.modifier.reference.php" + } + }, + "match": "(?i)(\\=)(&)|(&)(?=[$a-z_])" + }, + { + "match": "@", + "name": "keyword.operator.error-control.php" + }, + { + "match": "===|==|!==|!=|<>", + "name": "keyword.operator.comparison.php" + }, + { + "match": "=|\\+=|\\-=|\\*\\*?=|/=|%=|&=|\\|=|\\^=|<<=|>>=|\\?\\?=", + "name": "keyword.operator.assignment.php" + }, + { + "match": "<=>|<=|>=|<|>", + "name": "keyword.operator.comparison.php" + }, + { + "match": "\\-\\-|\\+\\+", + "name": "keyword.operator.increment-decrement.php" + }, + { + "match": "\\-|\\+|\\*\\*?|/|%", + "name": "keyword.operator.arithmetic.php" + }, + { + "match": "(?i)(!|&&|\\|\\|)|\\b(and|or|xor)\\b", + "name": "keyword.operator.logical.php" + }, + { + "match": "(?i)\\bas\\b", + "name": "keyword.operator.as.php" + }, + { + "include": "#function-call" + }, + { + "match": "<<|>>|~|\\^|&|\\|", + "name": "keyword.operator.bitwise.php" + }, + { + "begin": "(?i)\\b(instanceof)\\s+(?=[\\\\$a-z_])", + "beginCaptures": { + "1": { + "name": "keyword.operator.type.php" + } + }, + "end": "(?i)(?=[^\\\\$a-z0-9_\\x{7f}-\\x{10ffff}])", + "patterns": [ + { + "include": "#class-name" + }, + { + "include": "#variable-name" + } + ] + }, + { + "include": "#instantiation" + }, + { + "captures": { + "1": { + "name": "keyword.control.goto.php" + }, + "2": { + "name": "support.other.php" + } + }, + "match": "(?i)(goto)\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)" + }, + { + "captures": { + "1": { + "name": "entity.name.goto-label.php" + } + }, + "match": "(?i)^\\s*([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*(?)", + "endCaptures": { + "0": { + "name": "punctuation.definition.end.bracket.curly.php" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "begin": "\\[", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.php" + } + }, + "end": "\\]|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.php" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.definition.begin.bracket.round.php" + } + }, + "end": "\\)|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.end.bracket.round.php" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "include": "#constants" + }, + { + "match": ",", + "name": "punctuation.separator.delimiter.php" + } + ], + "repository": { + "attribute-name": { + "patterns": [ + { + "begin": "(?i)(?=\\\\?[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*\\\\)", + "end": "(?xi)\n( [a-z_\\x{7f}-\\x{10ffff}] [a-z0-9_\\x{7f}-\\x{10ffff}]* )?\n(?![a-z0-9_\\x{7f}-\\x{10ffff}\\\\])", + "endCaptures": { + "1": { + "name": "support.attribute.php" + } + }, + "patterns": [ + { + "include": "#namespace" + } + ] + }, + { + "match": "(?xi)\n(\\\\)?\\b(\n Attribute|SensitiveParameter|AllowDynamicProperties|ReturnTypeWillChange\n |Override|Deprecated\n)\\b", + "name": "support.attribute.builtin.php", + "captures": { + "1": { + "name": "punctuation.separator.inheritance.php" + } + } + }, + { + "begin": "(?i)(?=[\\\\a-z_\\x{7f}-\\x{10ffff}])", + "end": "(?xi)\n( [a-z_\\x{7f}-\\x{10ffff}] [a-z0-9_\\x{7f}-\\x{10ffff}]* )?\n(?![a-z0-9_\\x{7f}-\\x{10ffff}\\\\])", + "endCaptures": { + "1": { + "name": "support.attribute.php" + } + }, + "patterns": [ + { + "include": "#namespace" + } + ] + } + ] + }, + "attribute": { + "begin": "\\#\\[", + "end": "\\]", + "name": "meta.attribute.php", + "patterns": [ + { + "match": ",", + "name": "punctuation.separator.delimiter.php" + }, + { + "begin": "([a-zA-Z0-9_\\x{7f}-\\x{10ffff}\\\\]+)\\s*(\\()", + "beginCaptures": { + "1": { + "patterns": [ + { + "include": "#attribute-name" + } + ] + }, + "2": { + "name": "punctuation.definition.arguments.begin.bracket.round.php" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.bracket.round.php" + } + }, + "patterns": [ + { + "include": "#named-arguments" + }, + { + "include": "$self" + } + ] + }, + { + "include": "#attribute-name" + } + ] + }, + "class-builtin": { + "patterns": [ + { + "match": "(?xi)\n(\\\\)?\\b\n(Attribute|(APC|Append)Iterator|Array(Access|Iterator|Object)\n|Bad(Function|Method)CallException\n|(Caching|CallbackFilter)Iterator|Collator|Collectable|Cond|Countable|CURLFile\n|Date(Interval|Period|Time(Interface|Immutable|Zone)?)?|Directory(Iterator)?|DomainException\n|DOM(Attr|CdataSection|CharacterData|Comment|Document(Fragment)?|Element|EntityReference\n |Implementation|NamedNodeMap|Node(list)?|ProcessingInstruction|Text|XPath)\n|(Error)?Exception|EmptyIterator\n|finfo\n|Ev(Check|Child|Embed|Fork|Idle|Io|Loop|Periodic|Prepare|Signal|Stat|Timer|Watcher)?\n|Event(Base|Buffer(Event)?|SslContext|Http(Request|Connection)?|Config|DnsBase|Util|Listener)?\n|FANNConnection|(Filter|Filesystem)Iterator\n|Gender\\\\Gender|GlobIterator|Gmagick(Draw|Pixel)?\n|Haru(Annotation|Destination|Doc|Encoder|Font|Image|Outline|Page)\n|Http((Inflate|Deflate)?Stream|Message|Request(Pool)?|Response|QueryString)\n|HRTime\\\\(PerformanceCounter|StopWatch)\n|Intl(Calendar|((CodePoint|RuleBased)?Break|Parts)?Iterator|DateFormatter|TimeZone)\n|Imagick(Draw|Pixel(Iterator)?)?\n|InfiniteIterator|InvalidArgumentException|Iterator(Aggregate|Iterator)?\n|JsonSerializable\n|KTaglib_(MPEG_(File|AudioProperties)|Tag|ID3v2_(Tag|(AttachedPicture)?Frame))\n|Lapack|(Length|Locale|Logic)Exception|LimitIterator|Lua(Closure)?\n|Mongo(BinData|Client|Code|Collection|CommandCursor|Cursor(Exception)?|Date|DB(Ref)?|DeleteBatch\n |Grid(FS(Cursor|File)?)|Id|InsertBatch|Int(32|64)|Log|Pool|Regex|ResultException|Timestamp\n |UpdateBatch|Write(Batch|ConcernException))?\n|Memcache(d)?|MessageFormatter|MultipleIterator|Mutex\n|mysqli(_(driver|stmt|warning|result))?\n|MysqlndUh(Connection|PreparedStatement)\n|NoRewindIterator|Normalizer|NumberFormatter\n|OCI-(Collection|Lob)|OuterIterator|(OutOf(Bounds|Range)|Overflow)Exception\n|ParentIterator|PDO(Statement)?|Phar(Data|FileInfo)?|php_user_filter|Pool\n|QuickHash(Int(Set|StringHash)|StringIntHash)\n|Recursive(Array|Caching|Directory|Fallback|Filter|Iterator|Regex|Tree)?Iterator\n|Reflection(Attribute|Class(Constant)?|Constant|Enum(UnitCase|BackedCase)?\n |Fiber|Function(Abstract)?|Generator|(Named|Union|Intersection)?Type\n |Method|Object|Parameter|Property|Reference|(Zend)?Extension)?\n|RangeException|Reflector|RegexIterator|ResourceBundle|RuntimeException|RRD(Creator|Graph|Updater)\n|SAM(Connection|Message)|SCA(_(SoapProxy|LocalProxy))?\n|SDO_(DAS_(ChangeSummary|Data(Factory|Object)|Relational|Setting|XML(_Document)?)\n |Data(Factory|Object)|Exception|List|Model_(Property|ReflectionDataObject|Type)|Sequence)\n|SeekableIterator|Serializable|SessionHandler(Interface)?|SimpleXML(Iterator|Element)|SNMP\n|Soap(Client|Fault|Header|Param|Server|Var)\n|SphinxClient|Spoofchecker\n|Spl(DoublyLinkedList|Enum|File(Info|Object)|FixedArray|(Max|Min)?Heap|Observer|ObjectStorage\n |(Priority)?Queue|Stack|Subject|Type|TempFileObject)\n|SQLite(3(Result|Stmt)?|Database|Result|Unbuffered)\n|stdClass|streamWrapper|SVM(Model)?|Swish(Result(s)?|Search)?|Sync(Event|Mutex|ReaderWriter|Semaphore)\n|Thread(ed)?|tidy(Node)?|TokyoTyrant(Table|Iterator|Query)?|Transliterator|Traversable\n|UConverter|(Underflow|UnexpectedValue)Exception\n|V8Js(Exception)?|Varnish(Admin|Log|Stat)\n|Worker|Weak(Map|Ref)\n|XML(Diff\\\\(Base|DOM|File|Memory)|Reader|Writer)|XsltProcessor\n|Yaf_(Route_(Interface|Map|Regex|Rewrite|Simple|Supervar)\n |Action_Abstract|Application|Config_(Simple|Ini|Abstract)|Controller_Abstract\n |Dispatcher|Exception|Loader|Plugin_Abstract|Registry|Request_(Abstract|Simple|Http)\n |Response_Abstract|Router|Session|View_(Simple|Interface))\n|Yar_(Client(_Exception)?|Concurrent_Client|Server(_Exception)?)\n|ZipArchive|ZMQ(Context|Device|Poll|Socket)?)\n\\b", + "name": "support.class.builtin.php", + "captures": { + "1": { + "name": "punctuation.separator.inheritance.php" + } + } + } + ] + }, + "class-name": { + "patterns": [ + { + "begin": "(?i)(?=\\\\?[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*\\\\)", + "end": "(?xi)\n( [a-z_\\x{7f}-\\x{10ffff}] [a-z0-9_\\x{7f}-\\x{10ffff}]* )?\n(?![a-z0-9_\\x{7f}-\\x{10ffff}\\\\])", + "endCaptures": { + "1": { + "name": "support.class.php" + } + }, + "patterns": [ + { + "include": "#namespace" + } + ] + }, + { + "include": "#class-builtin" + }, + { + "begin": "(?i)(?=[\\\\a-z_\\x{7f}-\\x{10ffff}])", + "end": "(?xi)\n( [a-z_\\x{7f}-\\x{10ffff}] [a-z0-9_\\x{7f}-\\x{10ffff}]* )?\n(?![a-z0-9_\\x{7f}-\\x{10ffff}\\\\])", + "endCaptures": { + "1": { + "name": "support.class.php" + } + }, + "patterns": [ + { + "include": "#namespace" + } + ] + } + ] + }, + "inheritance-single": { + "patterns": [ + { + "begin": "(?i)(?=\\\\?[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*\\\\)", + "end": "(?i)([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)?(?=[^a-z0-9_\\x{7f}-\\x{10ffff}\\\\])", + "endCaptures": { + "1": { + "name": "entity.other.inherited-class.php" + } + }, + "patterns": [ + { + "include": "#namespace" + } + ] + }, + { + "include": "#class-builtin" + }, + { + "include": "#namespace" + }, + { + "match": "(?i)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*", + "name": "entity.other.inherited-class.php" + } + ] + }, + "class-extends": { + "patterns": [ + { + "begin": "(?i)(extends)\\s+", + "beginCaptures": { + "1": { + "name": "storage.modifier.extends.php" + } + }, + "end": "(?i)(?=[^A-Za-z0-9_\\x{7f}-\\x{10ffff}\\\\])", + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#inheritance-single" + } + ] + } + ] + }, + "interface-extends": { + "patterns": [ + { + "begin": "(?i)(extends)\\s+", + "beginCaptures": { + "1": { + "name": "storage.modifier.extends.php" + } + }, + "end": "(?i)(?={)", + "patterns": [ + { + "include": "#comments" + }, + { + "match": ",", + "name": "punctuation.separator.classes.php" + }, + { + "include": "#inheritance-single" + } + ] + } + ] + }, + "class-implements": { + "patterns": [ + { + "begin": "(?i)(implements)\\s+", + "beginCaptures": { + "1": { + "name": "storage.modifier.implements.php" + } + }, + "end": "(?i)(?={)", + "patterns": [ + { + "include": "#comments" + }, + { + "match": ",", + "name": "punctuation.separator.classes.php" + }, + { + "include": "#inheritance-single" + } + ] + } + ] + }, + "class-constant": { + "patterns": [ + { + "match": "(?xi)\n\\b (const) \\s+\n(?: (\n # nullable type\n (?:\\?\\s*)? [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ |\n # union, intersection or DNF type\n (?: [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ | \\(\\s* [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+(?:\\s*&\\s*[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)+ \\s*\\) )\n (?: \\s*[|&]\\s*\n (?: [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ | \\(\\s* [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+(?:\\s*&\\s*[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)+ \\s*\\) )\n )+\n) \\s+ )?\n([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)", + "captures": { + "1": { + "name": "storage.type.const.php" + }, + "2": { + "patterns": [ + { + "include": "#php-types" + } + ] + }, + "3": { + "name": "constant.other.php" + } + } + } + ] + }, + "comments": { + "patterns": [ + { + "begin": "/\\*\\*(?=\\s)", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.php" + } + }, + "end": "\\*/", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.php" + } + }, + "name": "comment.block.documentation.phpdoc.php", + "patterns": [ + { + "include": "#php_doc" + } + ] + }, + { + "begin": "/\\*", + "captures": { + "0": { + "name": "punctuation.definition.comment.php" + } + }, + "end": "\\*/", + "name": "comment.block.php" + }, + { + "begin": "(^\\s+)?(?=//)", + "beginCaptures": { + "1": { + "name": "punctuation.whitespace.comment.leading.php" + } + }, + "end": "(?!\\G)", + "patterns": [ + { + "begin": "//", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.php" + } + }, + "end": "\\n|(?=\\?>)", + "name": "comment.line.double-slash.php" + } + ] + }, + { + "begin": "(^\\s+)?(?=#)(?!#\\[)", + "beginCaptures": { + "1": { + "name": "punctuation.whitespace.comment.leading.php" + } + }, + "end": "(?!\\G)", + "patterns": [ + { + "begin": "#", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.php" + } + }, + "end": "\\n|(?=\\?>)", + "name": "comment.line.number-sign.php" + } + ] + } + ] + }, + "constants": { + "patterns": [ + { + "match": "(?i)\\b(TRUE|FALSE|NULL|__(FILE|DIR|FUNCTION|CLASS|METHOD|LINE|NAMESPACE)__|ON|OFF|YES|NO|NL|BR|TAB)\\b", + "name": "constant.language.php" + }, + { + "match": "(?x)\n(\\\\)?\\b\n(DEFAULT_INCLUDE_PATH\n|EAR_(INSTALL|EXTENSION)_DIR\n|E_(ALL|COMPILE_(ERROR|WARNING)|CORE_(ERROR|WARNING)|DEPRECATED|ERROR|NOTICE\n |PARSE|RECOVERABLE_ERROR|STRICT|USER_(DEPRECATED|ERROR|NOTICE|WARNING)|WARNING)\n|PHP_(ROUND_HALF_(DOWN|EVEN|ODD|UP)|(MAJOR|MINOR|RELEASE)_VERSION|MAXPATHLEN\n |BINDIR|SHLIB_SUFFIX|SYSCONFDIR|SAPI|CONFIG_FILE_(PATH|SCAN_DIR)\n |INT_(MAX|SIZE)|ZTS|OS|OUTPUT_HANDLER_(START|CONT|END)|DEBUG|DATADIR\n |URL_(SCHEME|HOST|USER|PORT|PASS|PATH|QUERY|FRAGMENT)|PREFIX\n |EXTRA_VERSION|EXTENSION_DIR|EOL|VERSION(_ID)?\n |WINDOWS_(NT_(SERVER|DOMAIN_CONTROLLER|WORKSTATION)\n |VERSION_(MAJOR|MINOR)|BUILD|SUITEMASK|SP_(MAJOR|MINOR)\n |PRODUCTTYPE|PLATFORM)\n |LIBDIR|LOCALSTATEDIR)\n|STD(ERR|IN|OUT)|ZEND_(DEBUG_BUILD|THREAD_SAFE))\n\\b", + "name": "support.constant.core.php", + "captures": { + "1": { + "name": "punctuation.separator.inheritance.php" + } + } + }, + { + "match": "(?x)\n(\\\\)?\\b\n(__COMPILER_HALT_OFFSET__|AB(MON_(1|2|3|4|5|6|7|8|9|10|11|12)|DAY[1-7])\n|AM_STR|ASSERT_(ACTIVE|BAIL|CALLBACK_QUIET_EVAL|WARNING)|ALT_DIGITS\n|CASE_(UPPER|LOWER)|CHAR_MAX|CONNECTION_(ABORTED|NORMAL|TIMEOUT)|CODESET|COUNT_(NORMAL|RECURSIVE)\n|CREDITS_(ALL|DOCS|FULLPAGE|GENERAL|GROUP|MODULES|QA|SAPI)\n|CRYPT_(BLOWFISH|EXT_DES|MD5|SHA(256|512)|SALT_LENGTH|STD_DES)|CURRENCY_SYMBOL\n|D_(T_)?FMT|DATE_(ATOM|COOKIE|ISO8601|RFC(822|850|1036|1123|2822|3339)|RSS|W3C)\n|DAY_[1-7]|DECIMAL_POINT|DIRECTORY_SEPARATOR\n|ENT_(COMPAT|IGNORE|(NO)?QUOTES)|EXTR_(IF_EXISTS|OVERWRITE|PREFIX_(ALL|IF_EXISTS|INVALID|SAME)|REFS|SKIP)\n|ERA(_(D_(T_)?FMT)|T_FMT|YEAR)?|FRAC_DIGITS|GROUPING|HASH_HMAC|HTML_(ENTITIES|SPECIALCHARS)\n|INF|INFO_(ALL|CREDITS|CONFIGURATION|ENVIRONMENT|GENERAL|LICENSEMODULES|VARIABLES)\n|INI_(ALL|CANNER_(NORMAL|RAW)|PERDIR|SYSTEM|USER)|INT_(CURR_SYMBOL|FRAC_DIGITS)\n|LC_(ALL|COLLATE|CTYPE|MESSAGES|MONETARY|NUMERIC|TIME)|LOCK_(EX|NB|SH|UN)\n|LOG_(ALERT|AUTH(PRIV)?|CRIT|CRON|CONS|DAEMON|DEBUG|EMERG|ERR|INFO|LOCAL[1-7]|LPR|KERN|MAIL\n |NEWS|NODELAY|NOTICE|NOWAIT|ODELAY|PID|PERROR|WARNING|SYSLOG|UCP|USER)\n|M_(1_PI|SQRT(1_2|2|3|PI)|2_(SQRT)?PI|PI(_(2|4))?|E(ULER)?|LN(10|2|PI)|LOG(10|2)E)\n|MON_(1|2|3|4|5|6|7|8|9|10|11|12|DECIMAL_POINT|GROUPING|THOUSANDS_SEP)\n|N_(CS_PRECEDES|SEP_BY_SPACE|SIGN_POSN)|NAN|NEGATIVE_SIGN|NO(EXPR|STR)\n|P_(CS_PRECEDES|SEP_BY_SPACE|SIGN_POSN)|PM_STR|POSITIVE_SIGN\n|PATH(_SEPARATOR|INFO_(EXTENSION|(BASE|DIR|FILE)NAME))|RADIXCHAR\n|SEEK_(CUR|END|SET)|SORT_(ASC|DESC|LOCALE_STRING|REGULAR|STRING)|STR_PAD_(BOTH|LEFT|RIGHT)\n|T_FMT(_AMPM)?|THOUSEP|THOUSANDS_SEP\n|UPLOAD_ERR_(CANT_WRITE|EXTENSION|(FORM|INI)_SIZE|NO_(FILE|TMP_DIR)|OK|PARTIAL)\n|YES(EXPR|STR))\n\\b", + "name": "support.constant.std.php", + "captures": { + "1": { + "name": "punctuation.separator.inheritance.php" + } + } + }, + { + "match": "(?x)\n(\\\\)?\\b\n(GLOB_(MARK|BRACE|NO(SORT|CHECK|ESCAPE)|ONLYDIR|ERR|AVAILABLE_FLAGS)\n|XML_(SAX_IMPL|(DTD|DOCUMENT(_(FRAG|TYPE))?|HTML_DOCUMENT|NOTATION|NAMESPACE_DECL|PI|COMMENT|DATA_SECTION|TEXT)_NODE\n |OPTION_(SKIP_(TAGSTART|WHITE)|CASE_FOLDING|TARGET_ENCODING)\n |ERROR_((BAD_CHAR|(ATTRIBUTE_EXTERNAL|BINARY|PARAM|RECURSIVE)_ENTITY)_REF|MISPLACED_XML_PI|SYNTAX|NONE\n |NO_(MEMORY|ELEMENTS)|TAG_MISMATCH|INCORRECT_ENCODING|INVALID_TOKEN|DUPLICATE_ATTRIBUTE\n |UNCLOSED_(CDATA_SECTION|TOKEN)|UNDEFINED_ENTITY|UNKNOWN_ENCODING|JUNK_AFTER_DOC_ELEMENT\n |PARTIAL_CHAR|EXTERNAL_ENTITY_HANDLING|ASYNC_ENTITY)\n |ENTITY_(((REF|DECL)_)?NODE)|ELEMENT(_DECL)?_NODE|LOCAL_NAMESPACE|ATTRIBUTE_(NMTOKEN(S)?|NOTATION|NODE)\n |CDATA|ID(REF(S)?)?|DECL_NODE|ENTITY|ENUMERATION)\n|MHASH_(RIPEMD(128|160|256|320)|GOST|MD(2|4|5)|SHA(1|224|256|384|512)|SNEFRU256|HAVAL(128|160|192|224|256)\n |CRC23(B)?|TIGER(128|160)?|WHIRLPOOL|ADLER32)\n|MYSQL_(BOTH|NUM|CLIENT_(SSL|COMPRESS|IGNORE_SPACE|INTERACTIVE|ASSOC))\n|MYSQLI_(REPORT_(STRICT|INDEX|OFF|ERROR|ALL)|REFRESH_(GRANT|MASTER|BACKUP_LOG|STATUS|SLAVE|HOSTS|THREADS|TABLES|LOG)\n |READ_DEFAULT_(FILE|GROUP)|(GROUP|MULTIPLE_KEY|BINARY|BLOB)_FLAG|BOTH\n |STMT_ATTR_(CURSOR_TYPE|UPDATE_MAX_LENGTH|PREFETCH_ROWS)|STORE_RESULT\n |SERVER_QUERY_(NO_((GOOD_)?INDEX_USED)|WAS_SLOW)|SET_(CHARSET_NAME|FLAG)\n |NO_(DEFAULT_VALUE_FLAG|DATA)|NOT_NULL_FLAG|NUM(_FLAG)?\n |CURSOR_TYPE_(READ_ONLY|SCROLLABLE|NO_CURSOR|FOR_UPDATE)\n |CLIENT_(SSL|NO_SCHEMA|COMPRESS|IGNORE_SPACE|INTERACTIVE|FOUND_ROWS)\n |TYPE_(GEOMETRY|((MEDIUM|LONG|TINY)_)?BLOB|BIT|SHORT|STRING|SET|YEAR|NULL|NEWDECIMAL|NEWDATE|CHAR\n |TIME(STAMP)?|TINY|INT24|INTERVAL|DOUBLE|DECIMAL|DATE(TIME)?|ENUM|VAR_STRING|FLOAT|LONG(LONG)?)\n |TIME_STAMP_FLAG|INIT_COMMAND|ZEROFILL_FLAG|ON_UPDATE_NOW_FLAG\n |OPT_(NET_((CMD|READ)_BUFFER_SIZE)|CONNECT_TIMEOUT|INT_AND_FLOAT_NATIVE|LOCAL_INFILE)\n |DEBUG_TRACE_ENABLED|DATA_TRUNCATED|USE_RESULT|(ENUM|(PART|PRI|UNIQUE)_KEY|UNSIGNED)_FLAG\n |ASSOC|ASYNC|AUTO_INCREMENT_FLAG)\n|MCRYPT_(RC(2|6)|RIJNDAEL_(128|192|256)|RAND|GOST|XTEA|MODE_(STREAM|NOFB|CBC|CFB|OFB|ECB)|MARS\n |BLOWFISH(_COMPAT)?|SERPENT|SKIPJACK|SAFER(64|128|PLUS)|CRYPT|CAST_(128|256)|TRIPLEDES|THREEWAY\n |TWOFISH|IDEA|(3)?DES|DECRYPT|DEV_(U)?RANDOM|PANAMA|ENCRYPT|ENIGNA|WAKE|LOKI97|ARCFOUR(_IV)?)\n|STREAM_(REPORT_ERRORS|MUST_SEEK|MKDIR_RECURSIVE|BUFFER_(NONE|FULL|LINE)|SHUT_(RD)?WR\n |SOCK_(RDM|RAW|STREAM|SEQPACKET|DGRAM)|SERVER_(BIND|LISTEN)\n |NOTIFY_(REDIRECTED|RESOLVE|MIME_TYPE_IS|SEVERITY_(INFO|ERR|WARN)|COMPLETED|CONNECT|PROGRESS\n |FILE_SIZE_IS|FAILURE|AUTH_(REQUIRED|RESULT))\n |CRYPTO_METHOD_((SSLv2(3)?|SSLv3|TLS)_(CLIENT|SERVER))|CLIENT_((ASYNC_)?CONNECT|PERSISTENT)\n |CAST_(AS_STREAM|FOR_SELECT)|(IGNORE|IS)_URL|IPPROTO_(RAW|TCP|ICMP|IP|UDP)|OOB\n |OPTION_(READ_(BUFFER|TIMEOUT)|BLOCKING|WRITE_BUFFER)|URL_STAT_(LINK|QUIET)|USE_PATH\n |PEEK|PF_(INET(6)?|UNIX)|ENFORCE_SAFE_MODE|FILTER_(ALL|READ|WRITE))\n|SUNFUNCS_RET_(DOUBLE|STRING|TIMESTAMP)\n|SQLITE_(READONLY|ROW|MISMATCH|MISUSE|BOTH|BUSY|SCHEMA|NOMEM|NOTFOUND|NOTADB|NOLFS|NUM|CORRUPT\n |CONSTRAINT|CANTOPEN|TOOBIG|INTERRUPT|INTERNAL|IOERR|OK|DONE|PROTOCOL|PERM|ERROR|EMPTY\n |FORMAT|FULL|LOCKED|ABORT|ASSOC|AUTH)\n|SQLITE3_(BOTH|BLOB|NUM|NULL|TEXT|INTEGER|OPEN_(READ(ONLY|WRITE)|CREATE)|FLOAT_ASSOC)\n|CURL(M_(BAD_((EASY)?HANDLE)|CALL_MULTI_PERFORM|INTERNAL_ERROR|OUT_OF_MEMORY|OK)\n |MSG_DONE|SSH_AUTH_(HOST|NONE|DEFAULT|PUBLICKEY|PASSWORD|KEYBOARD)\n |CLOSEPOLICY_(SLOWEST|CALLBACK|OLDEST|LEAST_(RECENTLY_USED|TRAFFIC)\n |INFO_(REDIRECT_(COUNT|TIME)|REQUEST_SIZE|SSL_VERIFYRESULT|STARTTRANSFER_TIME\n |(SIZE|SPEED)_(DOWNLOAD|UPLOAD)|HTTP_CODE|HEADER_(OUT|SIZE)|NAMELOOKUP_TIME\n |CONNECT_TIME|CONTENT_(TYPE|LENGTH_(DOWNLOAD|UPLOAD))|CERTINFO|TOTAL_TIME\n |PRIVATE|PRETRANSFER_TIME|EFFECTIVE_URL|FILETIME)\n |OPT_(RESUME_FROM|RETURNTRANSFER|REDIR_PROTOCOLS|REFERER|READ(DATA|FUNCTION)|RANGE|RANDOM_FILE\n |MAX(CONNECTS|REDIRS)|BINARYTRANSFER|BUFFERSIZE\n |SSH_(HOST_PUBLIC_KEY_MD5|(PRIVATE|PUBLIC)_KEYFILE)|AUTH_TYPES)\n |SSL(CERT(TYPE|PASSWD)?|ENGINE(_DEFAULT)?|VERSION|KEY(TYPE|PASSWD)?)\n |SSL_(CIPHER_LIST|VERIFY(HOST|PEER))\n |STDERR|HTTP(GET|HEADER|200ALIASES|_VERSION|PROXYTUNNEL|AUTH)\n |HEADER(FUNCTION)?|NO(BODY|SIGNAL|PROGRESS)|NETRC|CRLF|CONNECTTIMEOUT(_MS)?\n |COOKIE(SESSION|JAR|FILE)?|CUSTOMREQUEST|CERTINFO|CLOSEPOLICY|CA(INFO|PATH)|TRANSFERTEXT\n |TCP_NODELAY|TIME(CONDITION|OUT(_MS)?|VALUE)|INTERFACE|INFILE(SIZE)?|IPRESOLVE\n |DNS_(CACHE_TIMEOUT|USE_GLOBAL_CACHE)|URL|USER(AGENT|PWD)|UNRESTRICTED_AUTH|UPLOAD\n |PRIVATE|PROGRESSFUNCTION|PROXY(TYPE|USERPWD|PORT|AUTH)?|PROTOCOLS|PORT\n |POST(REDIR|QUOTE|FIELDS)?|PUT|EGDSOCKET|ENCODING|VERBOSE|KRB4LEVEL|KEYPASSWD|QUOTE|FRESH_CONNECT\n |FTP(APPEND|LISTONLY|PORT|SSLAUTH)\n |FTP_(SSL|SKIP_PASV_IP|CREATE_MISSING_DIRS|USE_EP(RT|SV)|FILEMETHOD)\n |FILE(TIME)?|FORBID_REUSE|FOLLOWLOCATION|FAILONERROR|WRITE(FUNCTION|HEADER)|LOW_SPEED_(LIMIT|TIME)\n |AUTOREFERER)\n |PROXY_(HTTP|SOCKS(4|5))|PROTO_(SCP|SFTP|HTTP(S)?|TELNET|TFTP|DICT|FTP(S)?|FILE|LDAP(S)?|ALL)\n |E_((RECV|READ)_ERROR|GOT_NOTHING|MALFORMAT_USER\n |BAD_(CONTENT_ENCODING|CALLING_ORDER|PASSWORD_ENTERED|FUNCTION_ARGUMENT)\n |SSH|SSL_(CIPHER|CONNECT_ERROR|CERTPROBLEM|CACERT|PEER_CERTIFICATE|ENGINE_(NOTFOUND|SETFAILED))\n |SHARE_IN_USE|SEND_ERROR|HTTP_(RANGE_ERROR|NOT_FOUND|PORT_FAILED|POST_ERROR)\n |COULDNT_(RESOLVE_(HOST|PROXY)|CONNECT)|TOO_MANY_REDIRECTS|TELNET_OPTION_SYNTAX|OBSOLETE\n |OUT_OF_MEMORY|OPERATION|TIMEOUTED|OK|URL_MALFORMAT(_USER)?|UNSUPPORTED_PROTOCOL\n |UNKNOWN_TELNET_OPTION|PARTIAL_FILE\n |FTP_(BAD_DOWNLOAD_RESUME|SSL_FAILED|COULDNT_(RETR_FILE|GET_SIZE|STOR_FILE|SET_(BINARY|ASCII)|USE_REST)\n |CANT_(GET_HOST|RECONNECT)|USER_PASSWORD_INCORRECT|PORT_FAILED|QUOTE_ERROR|WRITE_ERROR\n |WEIRD_((PASS|PASV|SERVER|USER)_REPLY|227_FORMAT)|ACCESS_DENIED)\n |FILESIZE_EXCEEDED|FILE_COULDNT_READ_FILE|FUNCTION_NOT_FOUND|FAILED_INIT|WRITE_ERROR|LIBRARY_NOT_FOUND\n |LDAP_(SEARCH_FAILED|CANNOT_BIND|INVALID_URL)|ABORTED_BY_CALLBACK)\n |VERSION_NOW\n |FTP(METHOD_(MULTI|SINGLE|NO)CWD|SSL_(ALL|NONE|CONTROL|TRY)|AUTH_(DEFAULT|SSL|TLS))\n |AUTH_(ANY(SAFE)?|BASIC|DIGEST|GSSNEGOTIATE|NTLM))\n|CURL_(HTTP_VERSION_(1_(0|1)|NONE)|NETRC_(REQUIRED|IGNORED|OPTIONAL)|TIMECOND_(IF(UN)?MODSINCE|LASTMOD)\n |IPRESOLVE_(V(4|6)|WHATEVER)|VERSION_(SSL|IPV6|KERBEROS4|LIBZ))\n|IMAGETYPE_(GIF|XBM|BMP|SWF|COUNT|TIFF_(MM|II)|ICO|IFF|UNKNOWN|JB2|JPX|JP2|JPC|JPEG(2000)?|PSD|PNG|WBMP)\n|INPUT_(REQUEST|GET|SERVER|SESSION|COOKIE|POST|ENV)|ICONV_(MIME_DECODE_(STRICT|CONTINUE_ON_ERROR)|IMPL|VERSION)\n|DNS_(MX|SRV|SOA|HINFO|NS|NAPTR|CNAME|TXT|PTR|ANY|ALL|AAAA|A(6)?)\n|DOM(STRING_SIZE_ERR)\n|DOM_((SYNTAX|HIERARCHY_REQUEST|NO_(MODIFICATION_ALLOWED|DATA_ALLOWED)|NOT_(FOUND|SUPPORTED)|NAMESPACE\n |INDEX_SIZE|USE_ATTRIBUTE|VALID_(MODIFICATION|STATE|CHARACTER|ACCESS)|PHP|VALIDATION|WRONG_DOCUMENT)_ERR)\n|JSON_(HEX_(TAG|QUOT|AMP|APOS)|NUMERIC_CHECK|ERROR_(SYNTAX|STATE_MISMATCH|NONE|CTRL_CHAR|DEPTH|UTF8)|FORCE_OBJECT)\n|PREG_((D_UTF8(_OFFSET)?|NO|INTERNAL|(BACKTRACK|RECURSION)_LIMIT)_ERROR|GREP_INVERT\n |SPLIT_(NO_EMPTY|(DELIM|OFFSET)_CAPTURE)|SET_ORDER|OFFSET_CAPTURE|PATTERN_ORDER)\n|PSFS_(PASS_ON|ERR_FATAL|FEED_ME|FLAG_(NORMAL|FLUSH_(CLOSE|INC)))\n|PCRE_VERSION|POSIX_((F|R|W|X)_OK|S_IF(REG|BLK|SOCK|CHR|IFO))\n|FNM_(NOESCAPE|CASEFOLD|PERIOD|PATHNAME)\n|FILTER_(REQUIRE_(SCALAR|ARRAY)|NULL_ON_FAILURE|CALLBACK|DEFAULT|UNSAFE_RAW\n |SANITIZE_(MAGIC_QUOTES|STRING|STRIPPED|SPECIAL_CHARS|NUMBER_(INT|FLOAT)|URL\n |EMAIL|ENCODED|FULL_SPCIAL_CHARS)\n |VALIDATE_(REGEXP|BOOLEAN|INT|IP|URL|EMAIL|FLOAT)\n |FORCE_ARRAY\n |FLAG_(SCHEME_REQUIRED|STRIP_(BACKTICK|HIGH|LOW)|HOST_REQUIRED|NONE|NO_(RES|PRIV)_RANGE|ENCODE_QUOTES\n |IPV(4|6)|PATH_REQUIRED|EMPTY_STRING_NULL|ENCODE_(HIGH|LOW|AMP)|QUERY_REQUIRED\n |ALLOW_(SCIENTIFIC|HEX|THOUSAND|OCTAL|FRACTION)))\n|FILE_(BINARY|SKIP_EMPTY_LINES|NO_DEFAULT_CONTEXT|TEXT|IGNORE_NEW_LINES|USE_INCLUDE_PATH|APPEND)\n|FILEINFO_(RAW|MIME(_(ENCODING|TYPE))?|SYMLINK|NONE|CONTINUE|DEVICES|PRESERVE_ATIME)\n|FORCE_(DEFLATE|GZIP)\n|LIBXML_(XINCLUDE|NSCLEAN|NO(XMLDECL|BLANKS|NET|CDATA|ERROR|EMPTYTAG|ENT|WARNING)\n |COMPACT|DTD(VALID|LOAD|ATTR)|((DOTTED|LOADED)_)?VERSION|PARSEHUGE|ERR_(NONE|ERROR|FATAL|WARNING)))\n\\b", + "name": "support.constant.ext.php", + "captures": { + "1": { + "name": "punctuation.separator.inheritance.php" + } + } + }, + { + "match": "(?x)\n(\\\\)?\\b\n(T_(RETURN|REQUIRE(_ONCE)?|GOTO|GLOBAL|(MINUS|MOD|MUL|XOR)_EQUAL|METHOD_C|ML_COMMENT|BREAK\n |BOOL_CAST|BOOLEAN_(AND|OR)|BAD_CHARACTER|SR(_EQUAL)?|STRING(_CAST|VARNAME)?|START_HEREDOC|STATIC\n |SWITCH|SL(_EQUAL)?|HALT_COMPILER|NS_(C|SEPARATOR)|NUM_STRING|NEW|NAMESPACE|CHARACTER|COMMENT\n |CONSTANT(_ENCAPSED_STRING)?|CONCAT_EQUAL|CONTINUE|CURLY_OPEN|CLOSE_TAG|CLONE|CLASS(_C)?\n |CASE|CATCH|TRY|THROW|IMPLEMENTS|ISSET|IS_((GREATER|SMALLER)_OR_EQUAL|(NOT_)?(IDENTICAL|EQUAL))\n |INSTANCEOF|INCLUDE(_ONCE)?|INC|INT_CAST|INTERFACE|INLINE_HTML|IF|OR_EQUAL|OBJECT_(CAST|OPERATOR)\n |OPEN_TAG(_WITH_ECHO)?|OLD_FUNCTION|DNUMBER|DIR|DIV_EQUAL|DOC_COMMENT|DOUBLE_(ARROW|CAST|COLON)\n |DOLLAR_OPEN_CURLY_BRACES|DO|DEC|DECLARE|DEFAULT|USE|UNSET(_CAST)?|PRINT|PRIVATE|PROTECTED|PUBLIC\n |PLUS_EQUAL|PAAMAYIM_NEKUDOTAYIM|EXTENDS|EXIT|EMPTY|ENCAPSED_AND_WHITESPACE\n |END(SWITCH|IF|DECLARE|FOR(EACH)?|WHILE)|END_HEREDOC|ECHO|EVAL|ELSE(IF)?|VAR(IABLE)?|FINAL|FILE\n |FOR(EACH)?|FUNC_C|FUNCTION|WHITESPACE|WHILE|LNUMBER|LIST|LINE|LOGICAL_(AND|OR|XOR)\n |ARRAY_(CAST)?|ABSTRACT|AS|AND_EQUAL))\n\\b", + "name": "support.constant.parser-token.php", + "captures": { + "1": { + "name": "punctuation.separator.inheritance.php" + } + } + }, + { + "match": "(?i)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*", + "name": "constant.other.php" + } + ] + }, + "function-parameters": { + "patterns": [ + { + "include": "#attribute" + }, + { + "include": "#comments" + }, + { + "match": ",", + "name": "punctuation.separator.delimiter.php" + }, + { + "match": "(?xi)\n(?: (\n # nullable type\n (?:\\?\\s*)? [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ |\n # union, intersection or DNF type\n (?: [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ | \\(\\s* [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+(?:\\s*&\\s*[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)+ \\s*\\) )\n (?: \\s*[|&]\\s*\n (?: [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ | \\(\\s* [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+(?:\\s*&\\s*[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)+ \\s*\\) )\n )+\n) \\s+ )?\n((?:(&)\\s*)?(\\.\\.\\.)(\\$)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*) # Variable name with possible reference\n(?=\\s*(?:,|\\)|/[/*]|\\#|$)) # A closing parentheses (end of argument list) or a comma or a comment", + "captures": { + "1": { + "patterns": [ + { + "include": "#php-types" + } + ] + }, + "2": { + "name": "variable.other.php" + }, + "3": { + "name": "storage.modifier.reference.php" + }, + "4": { + "name": "keyword.operator.variadic.php" + }, + "5": { + "name": "punctuation.definition.variable.php" + } + }, + "name": "meta.function.parameter.variadic.php" + }, + { + "begin": "(?xi)\n(\n # nullable type\n (?:\\?\\s*)? [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ |\n # union, intersection or DNF type\n (?: [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ | \\(\\s* [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+(?:\\s*&\\s*[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)+ \\s*\\) )\n (?: \\s*[|&]\\s*\n (?: [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+ | \\(\\s* [a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+(?:\\s*&\\s*[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)+ \\s*\\) )\n )+\n)\n\\s+ ((?:(&)\\s*)?(\\$)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*) # Variable name with possible reference", + "beginCaptures": { + "1": { + "patterns": [ + { + "include": "#php-types" + } + ] + }, + "2": { + "name": "variable.other.php" + }, + "3": { + "name": "storage.modifier.reference.php" + }, + "4": { + "name": "punctuation.definition.variable.php" + } + }, + "end": "(?=\\s*(?:,|\\)|/[/*]|\\#))", + "name": "meta.function.parameter.typehinted.php", + "patterns": [ + { + "begin": "=", + "beginCaptures": { + "0": { + "name": "keyword.operator.assignment.php" + } + }, + "end": "(?=\\s*(?:,|\\)|/[/*]|\\#))", + "patterns": [ + { + "include": "#parameter-default-types" + } + ] + } + ] + }, + { + "match": "(?xi)\n((?:(&)\\s*)?(\\$)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*) # Variable name with possible reference\n(?=\\s*(?:,|\\)|/[/*]|\\#|$)) # A closing parentheses (end of argument list) or a comma or a comment", + "captures": { + "1": { + "name": "variable.other.php" + }, + "2": { + "name": "storage.modifier.reference.php" + }, + "3": { + "name": "punctuation.definition.variable.php" + } + }, + "name": "meta.function.parameter.no-default.php" + }, + { + "begin": "(?xi)\n((?:(&)\\s*)?(\\$)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*) # Variable name with possible reference\n\\s*(=)\\s*", + "beginCaptures": { + "1": { + "name": "variable.other.php" + }, + "2": { + "name": "storage.modifier.reference.php" + }, + "3": { + "name": "punctuation.definition.variable.php" + }, + "4": { + "name": "keyword.operator.assignment.php" + } + }, + "end": "(?=\\s*(?:,|\\)|/[/*]|\\#))", + "name": "meta.function.parameter.default.php", + "patterns": [ + { + "include": "#parameter-default-types" + } + ] + } + ] + }, + "named-arguments": { + "match": "(?i)(?<=^|\\(|,)\\s*([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)\\s*(:)(?!:)", + "captures": { + "1": { + "name": "entity.name.variable.parameter.php" + }, + "2": { + "name": "punctuation.separator.colon.php" + } + } + }, + "function-call": { + "patterns": [ + { + "begin": "(?x)\n(\n \\\\?(?)", + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.bracket.round.php" + } + }, + "name": "meta.function-call.php", + "patterns": [ + { + "include": "#named-arguments" + }, + { + "include": "$self" + } + ] + }, + { + "begin": "(\\\\)?(?)", + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.bracket.round.php" + } + }, + "name": "meta.function-call.php", + "patterns": [ + { + "include": "#named-arguments" + }, + { + "include": "$self" + } + ] + }, + { + "match": "(?i)\\b(print|echo)\\b", + "name": "support.function.construct.output.php" + } + ] + }, + "heredoc": { + "patterns": [ + { + "begin": "(?i)(?=<<<\\s*(\"?)([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)(\\1)\\s*$)", + "end": "(?!\\G)", + "name": "string.unquoted.heredoc.php", + "patterns": [ + { + "include": "#heredoc_interior" + } + ] + }, + { + "begin": "(?i)(?=<<<\\s*'([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)'\\s*$)", + "end": "(?!\\G)", + "name": "string.unquoted.nowdoc.php", + "patterns": [ + { + "include": "#nowdoc_interior" + } + ] + } + ] + }, + "heredoc_interior": { + "patterns": [ + { + "begin": "(<<<)\\s*(\"?)(HTML)(\\2)(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "3": { + "name": "keyword.operator.heredoc.php" + }, + "5": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "text.html", + "end": "^\\s*(\\3)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.heredoc.php" + } + }, + "name": "meta.embedded.html", + "patterns": [ + { + "include": "#interpolation" + }, + { + "include": "text.html.basic" + } + ] + }, + { + "begin": "(<<<)\\s*(\"?)(XML)(\\2)(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "3": { + "name": "keyword.operator.heredoc.php" + }, + "5": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "text.xml", + "end": "^\\s*(\\3)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.heredoc.php" + } + }, + "name": "meta.embedded.xml", + "patterns": [ + { + "include": "#interpolation" + }, + { + "include": "text.xml" + } + ] + }, + { + "begin": "(<<<)\\s*(\"?)([DS]QL)(\\2)(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "3": { + "name": "keyword.operator.heredoc.php" + }, + "5": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "source.sql", + "end": "^\\s*(\\3)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.heredoc.php" + } + }, + "name": "meta.embedded.sql", + "patterns": [ + { + "include": "#interpolation" + }, + { + "include": "source.sql" + } + ] + }, + { + "begin": "(<<<)\\s*(\"?)(JAVASCRIPT|JS)(\\2)(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "3": { + "name": "keyword.operator.heredoc.php" + }, + "5": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "source.js", + "end": "^\\s*(\\3)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.heredoc.php" + } + }, + "name": "meta.embedded.js", + "patterns": [ + { + "include": "#interpolation" + }, + { + "include": "source.js" + } + ] + }, + { + "begin": "(<<<)\\s*(\"?)(JSON)(\\2)(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "3": { + "name": "keyword.operator.heredoc.php" + }, + "5": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "source.json", + "end": "^\\s*(\\3)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.heredoc.php" + } + }, + "name": "meta.embedded.json", + "patterns": [ + { + "include": "#interpolation" + }, + { + "include": "source.json" + } + ] + }, + { + "begin": "(<<<)\\s*(\"?)(CSS)(\\2)(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "3": { + "name": "keyword.operator.heredoc.php" + }, + "5": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "source.css", + "end": "^\\s*(\\3)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.heredoc.php" + } + }, + "name": "meta.embedded.css", + "patterns": [ + { + "include": "#interpolation" + }, + { + "include": "source.css" + } + ] + }, + { + "begin": "(<<<)\\s*(\"?)(REGEXP?)(\\2)(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "3": { + "name": "keyword.operator.heredoc.php" + }, + "5": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "string.regexp.heredoc.php", + "end": "^\\s*(\\3)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.heredoc.php" + } + }, + "patterns": [ + { + "include": "#interpolation" + }, + { + "match": "(\\\\){1,2}[.$^\\[\\]{}]", + "name": "constant.character.escape.regex.php" + }, + { + "captures": { + "1": { + "name": "punctuation.definition.arbitrary-repitition.php" + }, + "3": { + "name": "punctuation.definition.arbitrary-repitition.php" + } + }, + "match": "({)\\d+(,\\d+)?(})", + "name": "string.regexp.arbitrary-repitition.php" + }, + { + "begin": "\\[(?:\\^?\\])?", + "captures": { + "0": { + "name": "punctuation.definition.character-class.php" + } + }, + "end": "\\]", + "name": "string.regexp.character-class.php", + "patterns": [ + { + "match": "\\\\[\\\\'\\[\\]]", + "name": "constant.character.escape.php" + } + ] + }, + { + "match": "[$^+*]", + "name": "keyword.operator.regexp.php" + }, + { + "begin": "(?i)(?<=^|\\s)(#)\\s(?=[[a-z0-9_\\x{7f}-\\x{10ffff},. \\t?!-][^\\x{00}-\\x{7f}]]*$)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.php" + } + }, + "end": "$", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.php" + } + }, + "name": "comment.line.number-sign.php" + } + ] + }, + { + "begin": "(<<<)\\s*(\"?)(BLADE)(\\2)(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "3": { + "name": "keyword.operator.heredoc.php" + }, + "5": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "text.html.php.blade", + "end": "^\\s*(\\3)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.heredoc.php" + } + }, + "name": "meta.embedded.php.blade", + "patterns": [ + { + "include": "#interpolation" + } + ] + }, + { + "begin": "(?i)(<<<)\\s*(\"?)([a-z_\\x{7f}-\\x{10ffff}]+[a-z0-9_\\x{7f}-\\x{10ffff}]*)(\\2)(\\s*)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.php" + }, + "3": { + "name": "keyword.operator.heredoc.php" + }, + "5": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "end": "^\\s*(\\3)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "1": { + "name": "keyword.operator.heredoc.php" + } + }, + "patterns": [ + { + "include": "#interpolation" + } + ] + } + ] + }, + "nowdoc_interior": { + "patterns": [ + { + "begin": "(<<<)\\s*'(HTML)'(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "2": { + "name": "keyword.operator.nowdoc.php" + }, + "3": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "text.html", + "end": "^\\s*(\\2)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.nowdoc.php" + } + }, + "name": "meta.embedded.html", + "patterns": [ + { + "include": "text.html.basic" + } + ] + }, + { + "begin": "(<<<)\\s*'(XML)'(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "2": { + "name": "keyword.operator.nowdoc.php" + }, + "3": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "text.xml", + "end": "^\\s*(\\2)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.nowdoc.php" + } + }, + "name": "meta.embedded.xml", + "patterns": [ + { + "include": "text.xml" + } + ] + }, + { + "begin": "(<<<)\\s*'([DS]QL)'(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "2": { + "name": "keyword.operator.nowdoc.php" + }, + "3": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "source.sql", + "end": "^\\s*(\\2)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.nowdoc.php" + } + }, + "name": "meta.embedded.sql", + "patterns": [ + { + "include": "source.sql" + } + ] + }, + { + "begin": "(<<<)\\s*'(JAVASCRIPT|JS)'(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "2": { + "name": "keyword.operator.nowdoc.php" + }, + "3": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "source.js", + "end": "^\\s*(\\2)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.nowdoc.php" + } + }, + "name": "meta.embedded.js", + "patterns": [ + { + "include": "source.js" + } + ] + }, + { + "begin": "(<<<)\\s*'(JSON)'(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "2": { + "name": "keyword.operator.nowdoc.php" + }, + "3": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "source.json", + "end": "^\\s*(\\2)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.nowdoc.php" + } + }, + "name": "meta.embedded.json", + "patterns": [ + { + "include": "source.json" + } + ] + }, + { + "begin": "(<<<)\\s*'(CSS)'(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "2": { + "name": "keyword.operator.nowdoc.php" + }, + "3": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "source.css", + "end": "^\\s*(\\2)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.nowdoc.php" + } + }, + "name": "meta.embedded.css", + "patterns": [ + { + "include": "source.css" + } + ] + }, + { + "begin": "(<<<)\\s*'(REGEXP?)'(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "2": { + "name": "keyword.operator.nowdoc.php" + }, + "3": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "string.regexp.nowdoc.php", + "end": "^\\s*(\\2)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.nowdoc.php" + } + }, + "patterns": [ + { + "match": "(\\\\){1,2}[.$^\\[\\]{}]", + "name": "constant.character.escape.regex.php" + }, + { + "captures": { + "1": { + "name": "punctuation.definition.arbitrary-repitition.php" + }, + "3": { + "name": "punctuation.definition.arbitrary-repitition.php" + } + }, + "match": "({)\\d+(,\\d+)?(})", + "name": "string.regexp.arbitrary-repitition.php" + }, + { + "begin": "\\[(?:\\^?\\])?", + "captures": { + "0": { + "name": "punctuation.definition.character-class.php" + } + }, + "end": "\\]", + "name": "string.regexp.character-class.php", + "patterns": [ + { + "match": "\\\\[\\\\'\\[\\]]", + "name": "constant.character.escape.php" + } + ] + }, + { + "match": "[$^+*]", + "name": "keyword.operator.regexp.php" + }, + { + "begin": "(?i)(?<=^|\\s)(#)\\s(?=[[a-z0-9_\\x{7f}-\\x{10ffff},. \\t?!-][^\\x{00}-\\x{7f}]]*$)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.php" + } + }, + "end": "$", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.php" + } + }, + "name": "comment.line.number-sign.php" + } + ] + }, + { + "begin": "(<<<)\\s*'(BLADE)'(\\s*)$", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.php" + }, + "1": { + "name": "punctuation.definition.string.php" + }, + "2": { + "name": "keyword.operator.nowdoc.php" + }, + "3": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "contentName": "text.html.php.blade", + "end": "^\\s*(\\2)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.php" + }, + "1": { + "name": "keyword.operator.nowdoc.php" + } + }, + "name": "meta.embedded.php.blade" + }, + { + "begin": "(?i)(<<<)\\s*'([a-z_\\x{7f}-\\x{10ffff}]+[a-z0-9_\\x{7f}-\\x{10ffff}]*)'(\\s*)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.php" + }, + "2": { + "name": "keyword.operator.nowdoc.php" + }, + "3": { + "name": "invalid.illegal.trailing-whitespace.php" + } + }, + "end": "^\\s*(\\2)(?![A-Za-z0-9_\\x{7f}-\\x{10ffff}])", + "endCaptures": { + "1": { + "name": "keyword.operator.nowdoc.php" + } + } + } + ] + }, + "instantiation": { + "patterns": [ + { + "match": "(?i)(new)\\s+(?!class\\b)([$a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)(?![a-z0-9_\\x{7f}-\\x{10ffff}\\\\(])", + "captures": { + "1": { + "name": "keyword.other.new.php" + }, + "2": { + "patterns": [ + { + "match": "(?i)(parent|static|self)(?![a-z0-9_\\x{7f}-\\x{10ffff}])", + "name": "storage.type.php" + }, + { + "include": "#class-name" + }, + { + "include": "#variable-name" + } + ] + } + } + }, + { + "begin": "(?i)(new)\\s+(?!class\\b)([$a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.other.new.php" + }, + "2": { + "patterns": [ + { + "match": "(?i)(parent|static|self)(?![a-z0-9_\\x{7f}-\\x{10ffff}])", + "name": "storage.type.php" + }, + { + "include": "#class-name" + }, + { + "include": "#variable-name" + } + ] + }, + "3": { + "name": "punctuation.definition.arguments.begin.bracket.round.php" + } + }, + "end": "\\)|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.bracket.round.php" + } + }, + "contentName": "meta.function-call.php", + "patterns": [ + { + "include": "#named-arguments" + }, + { + "include": "$self" + } + ] + } + ] + }, + "interpolation": { + "patterns": [ + { + "match": "\\\\[0-7]{1,3}", + "name": "constant.character.escape.octal.php" + }, + { + "match": "\\\\x[0-9A-Fa-f]{1,2}", + "name": "constant.character.escape.hex.php" + }, + { + "match": "\\\\u{[0-9A-Fa-f]+}", + "name": "constant.character.escape.unicode.php" + }, + { + "match": "\\\\[nrtvef$\\\\]", + "name": "constant.character.escape.php" + }, + { + "begin": "{(?=\\$.*?})", + "beginCaptures": { + "0": { + "name": "punctuation.definition.variable.php" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.definition.variable.php" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "include": "#variable-name" + } + ] + }, + "interpolation_double_quoted": { + "patterns": [ + { + "match": "\\\\\"", + "name": "constant.character.escape.php" + }, + { + "include": "#interpolation" + } + ] + }, + "invoke-call": { + "begin": "(?i)((\\$+)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "variable.other.php" + }, + "2": { + "name": "punctuation.definition.variable.php" + }, + "3": { + "name": "punctuation.definition.arguments.begin.bracket.round.php" + } + }, + "end": "\\)|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.bracket.round.php" + } + }, + "name": "meta.function-call.invoke.php", + "patterns": [ + { + "include": "#named-arguments" + }, + { + "include": "$self" + } + ] + }, + "namespace": { + "begin": "(?i)(?:(namespace)|[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)?(\\\\)", + "beginCaptures": { + "1": { + "name": "variable.language.namespace.php" + }, + "2": { + "name": "punctuation.separator.inheritance.php" + } + }, + "end": "(?i)(?![a-z0-9_\\x{7f}-\\x{10ffff}]*\\\\)", + "name": "support.other.namespace.php", + "patterns": [ + { + "match": "\\\\", + "name": "punctuation.separator.inheritance.php" + } + ] + }, + "numbers": { + "patterns": [ + { + "match": "0[xX][0-9a-fA-F]+(?:_[0-9a-fA-F]+)*", + "name": "constant.numeric.hex.php" + }, + { + "match": "0[bB][01]+(?:_[01]+)*", + "name": "constant.numeric.binary.php" + }, + { + "match": "0[oO][0-7]+(?:_[0-7]+)*", + "name": "constant.numeric.octal.php" + }, + { + "match": "0(?:_?[0-7]+)+", + "name": "constant.numeric.octal.php" + }, + { + "match": "(?x)\n(?:\n (?:[0-9]+(?:_[0-9]+)*)?(\\.)[0-9]+(?:_[0-9]+)*(?:[eE][+-]?[0-9]+(?:_[0-9]+)*)?| # .3\n [0-9]+(?:_[0-9]+)*(\\.)(?:[0-9]+(?:_[0-9]+)*)?(?:[eE][+-]?[0-9]+(?:_[0-9]+)*)?| # 3.\n [0-9]+(?:_[0-9]+)*[eE][+-]?[0-9]+(?:_[0-9]+)* # 2e-3\n)", + "name": "constant.numeric.decimal.php", + "captures": { + "1": { + "name": "punctuation.separator.decimal.period.php" + }, + "2": { + "name": "punctuation.separator.decimal.period.php" + } + } + }, + { + "match": "0|[1-9](?:_?[0-9]+)*", + "name": "constant.numeric.decimal.php" + } + ] + }, + "object": { + "patterns": [ + { + "begin": "(\\??->)\\s*(\\$?{)", + "beginCaptures": { + "1": { + "name": "keyword.operator.class.php" + }, + "2": { + "name": "punctuation.definition.variable.php" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.definition.variable.php" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "begin": "(?i)(\\??->)\\s*([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.operator.class.php" + }, + "2": { + "name": "entity.name.function.php" + }, + "3": { + "name": "punctuation.definition.arguments.begin.bracket.round.php" + } + }, + "end": "\\)|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.bracket.round.php" + } + }, + "name": "meta.method-call.php", + "patterns": [ + { + "include": "#named-arguments" + }, + { + "include": "$self" + } + ] + }, + { + "captures": { + "1": { + "name": "keyword.operator.class.php" + }, + "2": { + "name": "variable.other.property.php" + }, + "3": { + "name": "punctuation.definition.variable.php" + } + }, + "match": "(?i)(\\??->)\\s*((\\$+)?[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)?" + } + ] + }, + "php-types": { + "patterns": [ + { + "match": "\\?", + "name": "keyword.operator.nullable-type.php" + }, + { + "match": "[|&]", + "name": "punctuation.separator.delimiter.php" + }, + { + "match": "(?i)\\b(null|int|float|bool|string|array|object|callable|iterable|true|false|mixed|void)\\b", + "name": "keyword.other.type.php" + }, + { + "match": "(?i)\\b(parent|self)\\b", + "name": "storage.type.php" + }, + { + "match": "\\(", + "name": "punctuation.definition.type.begin.bracket.round.php" + }, + { + "match": "\\)", + "name": "punctuation.definition.type.end.bracket.round.php" + }, + { + "include": "#class-name" + } + ] + }, + "parameter-default-types": { + "patterns": [ + { + "include": "#strings" + }, + { + "include": "#numbers" + }, + { + "include": "#string-backtick" + }, + { + "include": "#variables" + }, + { + "match": "=>", + "name": "keyword.operator.key.php" + }, + { + "match": "=", + "name": "keyword.operator.assignment.php" + }, + { + "match": "&(?=\\s*\\$)", + "name": "storage.modifier.reference.php" + }, + { + "begin": "(array)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "support.function.construct.php" + }, + "2": { + "name": "punctuation.definition.array.begin.bracket.round.php" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.array.end.bracket.round.php" + } + }, + "name": "meta.array.php", + "patterns": [ + { + "include": "#parameter-default-types" + } + ] + }, + { + "begin": "\\[", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.php" + } + }, + "end": "\\]|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.php" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "include": "#instantiation" + }, + { + "begin": "(?xi)\n(?=[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+\n (::)\\s*([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)?\n)", + "end": "(?i)(::)\\s*([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)?", + "endCaptures": { + "1": { + "name": "keyword.operator.class.php" + }, + "2": { + "name": "constant.other.class.php" + } + }, + "patterns": [ + { + "include": "#class-name" + } + ] + }, + { + "include": "#constants" + } + ] + }, + "php_doc": { + "patterns": [ + { + "match": "^(?!\\s*\\*).*?(?:(?=\\*\\/)|$\\n?)", + "name": "invalid.illegal.missing-asterisk.phpdoc.php" + }, + { + "captures": { + "1": { + "name": "keyword.other.phpdoc.php" + }, + "2": { + "name": "storage.modifier.php" + }, + "3": { + "name": "storage.modifier.visibility.${3:/downcase}.php" + }, + "4": { + "name": "invalid.illegal.wrong-access-type.phpdoc.php" + } + }, + "match": "^\\s*\\*\\s*(@access)\\s+(?i:((public|private|protected))|(.+))\\s*$" + }, + { + "captures": { + "1": { + "name": "keyword.other.phpdoc.php" + }, + "2": { + "name": "markup.underline.link.php" + } + }, + "match": "(@xlink)\\s+(.+)\\s*$" + }, + { + "begin": "(@(?:global|param|property(-(read|write))?|return|throws|var))\\s+(?=[?A-Za-z_\\x{7f}-\\x{10ffff}\\\\]|\\()", + "beginCaptures": { + "1": { + "name": "keyword.other.phpdoc.php" + } + }, + "end": "(?=\\s|\\*/)", + "contentName": "meta.other.type.phpdoc.php", + "patterns": [ + { + "include": "#php_doc_types_array_multiple" + }, + { + "include": "#php_doc_types_array_single" + }, + { + "include": "#php_doc_types" + }, + { + "match": "[|&]", + "name": "punctuation.separator.delimiter.php" + } + ] + }, + { + "match": "(?x)\n@\n(\n api|abstract|author|category|copyright|example|global|inherit[Dd]oc|internal|\n license|link|method|property(-(read|write))?|package|param|return|see|since|source|\n static|subpackage|throws|todo|var|version|uses|deprecated|final|ignore\n)\\b", + "name": "keyword.other.phpdoc.php" + }, + { + "captures": { + "1": { + "name": "keyword.other.phpdoc.php" + } + }, + "match": "{(@(link|inherit[Dd]oc)).+?}", + "name": "meta.tag.inline.phpdoc.php" + } + ] + }, + "php_doc_types": { + "match": "(?i)\\??[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+([|&]\\??[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)*", + "captures": { + "0": { + "patterns": [ + { + "match": "\\?", + "name": "keyword.operator.nullable-type.php" + }, + { + "match": "(?x)\\b\n(string|integer|int|boolean|bool|float|double|object|mixed\n|array|resource|void|null|callback|false|true|self|static)\\b", + "name": "keyword.other.type.php" + }, + { + "include": "#class-name" + }, + { + "match": "[|&]", + "name": "punctuation.separator.delimiter.php" + } + ] + } + } + }, + "php_doc_types_array_multiple": { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.definition.type.begin.bracket.round.phpdoc.php" + } + }, + "end": "(\\))(\\[\\])?|(?=\\*/)", + "endCaptures": { + "1": { + "name": "punctuation.definition.type.end.bracket.round.phpdoc.php" + }, + "2": { + "name": "keyword.other.array.phpdoc.php" + } + }, + "patterns": [ + { + "include": "#php_doc_types_array_multiple" + }, + { + "include": "#php_doc_types_array_single" + }, + { + "include": "#php_doc_types" + }, + { + "match": "[|&]", + "name": "punctuation.separator.delimiter.php" + } + ] + }, + "php_doc_types_array_single": { + "match": "(?i)([a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)(\\[\\])", + "captures": { + "1": { + "patterns": [ + { + "include": "#php_doc_types" + } + ] + }, + "2": { + "name": "keyword.other.array.phpdoc.php" + } + } + }, + "regex-double-quoted": { + "begin": "\"/(?=(\\\\.|[^\"/])++/[imsxeADSUXu]*\")", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.php" + } + }, + "end": "(/)([imsxeADSUXu]*)(\")", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.php" + } + }, + "name": "string.regexp.double-quoted.php", + "patterns": [ + { + "match": "(\\\\){1,2}[.$^\\[\\]{}]", + "name": "constant.character.escape.regex.php" + }, + { + "include": "#interpolation_double_quoted" + }, + { + "captures": { + "1": { + "name": "punctuation.definition.arbitrary-repetition.php" + }, + "3": { + "name": "punctuation.definition.arbitrary-repetition.php" + } + }, + "match": "({)\\d+(,\\d+)?(})", + "name": "string.regexp.arbitrary-repetition.php" + }, + { + "begin": "\\[(?:\\^?\\])?", + "captures": { + "0": { + "name": "punctuation.definition.character-class.php" + } + }, + "end": "\\]", + "name": "string.regexp.character-class.php", + "patterns": [ + { + "include": "#interpolation_double_quoted" + } + ] + }, + { + "match": "[$^+*]", + "name": "keyword.operator.regexp.php" + } + ] + }, + "regex-single-quoted": { + "begin": "'/(?=(\\\\(?:\\\\(?:\\\\[\\\\']?|[^'])|.)|[^'/])++/[imsxeADSUXu]*')", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.php" + } + }, + "end": "(/)([imsxeADSUXu]*)(')", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.php" + } + }, + "name": "string.regexp.single-quoted.php", + "patterns": [ + { + "include": "#single_quote_regex_escape" + }, + { + "captures": { + "1": { + "name": "punctuation.definition.arbitrary-repetition.php" + }, + "3": { + "name": "punctuation.definition.arbitrary-repetition.php" + } + }, + "match": "({)\\d+(,\\d+)?(})", + "name": "string.regexp.arbitrary-repetition.php" + }, + { + "begin": "\\[(?:\\^?\\])?", + "captures": { + "0": { + "name": "punctuation.definition.character-class.php" + } + }, + "end": "\\]", + "name": "string.regexp.character-class.php" + }, + { + "match": "[$^+*]", + "name": "keyword.operator.regexp.php" + } + ] + }, + "scope-resolution": { + "patterns": [ + { + "match": "([A-Za-z_\\x{7f}-\\x{10ffff}\\\\][A-Za-z0-9_\\x{7f}-\\x{10ffff}\\\\]*)(?=\\s*::)", + "captures": { + "1": { + "patterns": [ + { + "match": "\\b(self|static|parent)\\b", + "name": "storage.type.php" + }, + { + "include": "#class-name" + }, + { + "include": "#variable-name" + } + ] + } + } + }, + { + "begin": "(?i)(::)\\s*([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.operator.class.php" + }, + "2": { + "name": "entity.name.function.php" + }, + "3": { + "name": "punctuation.definition.arguments.begin.bracket.round.php" + } + }, + "end": "\\)|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.bracket.round.php" + } + }, + "name": "meta.method-call.static.php", + "patterns": [ + { + "include": "#named-arguments" + }, + { + "include": "$self" + } + ] + }, + { + "match": "(?i)(::)\\s*(class)\\b", + "captures": { + "1": { + "name": "keyword.operator.class.php" + }, + "2": { + "name": "keyword.other.class.php" + } + } + }, + { + "match": "(?xi)\n(::)\\s*\n(?:\n ((\\$+)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*) # Variable\n |\n ([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*) # Constant\n)?", + "captures": { + "1": { + "name": "keyword.operator.class.php" + }, + "2": { + "name": "variable.other.class.php" + }, + "3": { + "name": "punctuation.definition.variable.php" + }, + "4": { + "name": "constant.other.class.php" + } + } + } + ] + }, + "single_quote_regex_escape": { + "match": "\\\\(?:\\\\(?:\\\\[\\\\']?|[^'])|.)", + "name": "constant.character.escape.php" + }, + "sql-string-double-quoted": { + "begin": "\"\\s*(?=(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER|AND|WITH)\\b)", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.php" + } + }, + "contentName": "source.sql.embedded.php", + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.php" + } + }, + "name": "string.quoted.double.sql.php", + "patterns": [ + { + "match": "(#)(\\\\\"|[^\"])*(?=\"|$)", + "name": "comment.line.number-sign.sql", + "captures": { + "1": { + "name": "punctuation.definition.comment.sql" + } + } + }, + { + "match": "(--)(\\\\\"|[^\"])*(?=\"|$)", + "name": "comment.line.double-dash.sql", + "captures": { + "1": { + "name": "punctuation.definition.comment.sql" + } + } + }, + { + "match": "\\\\[\\\\\"`']", + "name": "constant.character.escape.php" + }, + { + "match": "'(?=((\\\\')|[^'\"])*(\"|$))", + "name": "string.quoted.single.unclosed.sql" + }, + { + "match": "`(?=((\\\\`)|[^`\"])*(\"|$))", + "name": "string.quoted.other.backtick.unclosed.sql" + }, + { + "begin": "'", + "end": "'", + "name": "string.quoted.single.sql", + "patterns": [ + { + "include": "#interpolation_double_quoted" + } + ] + }, + { + "begin": "`", + "end": "`", + "name": "string.quoted.other.backtick.sql", + "patterns": [ + { + "include": "#interpolation_double_quoted" + } + ] + }, + { + "include": "#interpolation_double_quoted" + }, + { + "include": "source.sql" + } + ] + }, + "sql-string-single-quoted": { + "begin": "'\\s*(?=(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER|AND|WITH)\\b)", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.php" + } + }, + "contentName": "source.sql.embedded.php", + "end": "'", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.php" + } + }, + "name": "string.quoted.single.sql.php", + "patterns": [ + { + "match": "(#)(\\\\'|[^'])*(?='|$)", + "name": "comment.line.number-sign.sql", + "captures": { + "1": { + "name": "punctuation.definition.comment.sql" + } + } + }, + { + "match": "(--)(\\\\'|[^'])*(?='|$)", + "name": "comment.line.double-dash.sql", + "captures": { + "1": { + "name": "punctuation.definition.comment.sql" + } + } + }, + { + "match": "\\\\[\\\\'`\"]", + "name": "constant.character.escape.php" + }, + { + "match": "N(?=')" + }, + { + "match": "`(?=((\\\\`)|[^`'])*('|$))", + "name": "string.quoted.other.backtick.unclosed.sql" + }, + { + "match": "\"(?=((\\\\\")|[^\"'])*('|$))", + "name": "string.quoted.double.unclosed.sql" + }, + { + "include": "source.sql" + } + ] + }, + "string-backtick": { + "begin": "`", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.php" + } + }, + "end": "`", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.php" + } + }, + "name": "string.interpolated.php", + "patterns": [ + { + "match": "\\\\`", + "name": "constant.character.escape.php" + }, + { + "include": "#interpolation" + } + ] + }, + "string-double-quoted": { + "begin": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.php" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.php" + } + }, + "name": "string.quoted.double.php", + "patterns": [ + { + "include": "#interpolation_double_quoted" + } + ] + }, + "string-single-quoted": { + "begin": "'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.php" + } + }, + "end": "'", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.php" + } + }, + "name": "string.quoted.single.php", + "patterns": [ + { + "match": "\\\\[\\\\']", + "name": "constant.character.escape.php" + } + ] + }, + "strings": { + "patterns": [ + { + "include": "#regex-double-quoted" + }, + { + "include": "#sql-string-double-quoted" + }, + { + "include": "#string-double-quoted" + }, + { + "include": "#regex-single-quoted" + }, + { + "include": "#sql-string-single-quoted" + }, + { + "include": "#string-single-quoted" + } + ] + }, + "support": { + "patterns": [ + { + "match": "(?xi)\n\\b\napc_(\n store|sma_info|compile_file|clear_cache|cas|cache_info|inc|dec|define_constants|delete(_file)?|\n exists|fetch|load_constants|add|bin_(dump|load)(file)?\n)\\b", + "name": "support.function.apc.php" + }, + { + "match": "(?xi)\\b\n(\n compact|count|current|end|extract|in_array|key(_exists)?|list|nat(case)?sort|\n next|pos|prev|range|reset|shuffle|sizeof|[ak]?r?sort|u[ak]?sort|\n array_(\n all|any|change_key_case|chunk|column|combine|count_values|\n fill(_keys)?|filter|find(_key)?|flip|is_list|key_(exists|first|last)|keys|\n map|multisort|pad|pop|product|push|rand|reduce|reverse|\n search|shift|slice|splice|sum|unique|unshift|values|\n u?(diff|intersect)(_u?(key|assoc))?|(walk|replace|merge)(_recursive)?\n )\n)\\b", + "name": "support.function.array.php" + }, + { + "match": "(?xi)\\b\n(\n connection_(aborted|status)|constant|defined?|die|eval|exit|get_browser|\n __halt_compiler|highlight_(file|string)|hrtime|ignore_user_abort|pack|php_strip_whitespace|\n show_source|u?sleep|sys_getloadavg|time_(nanosleep|sleep_until)|uniqid|unpack\n)\\b", + "name": "support.function.basic_functions.php" + }, + { + "match": "(?i)\\bbc(add|ceil|comp|(div|pow)(mod)?|floor|mod|mul|round|scale|sqrt|sub)\\b", + "name": "support.function.bcmath.php" + }, + { + "match": "(?i)\\bblenc_encrypt\\b", + "name": "support.function.blenc.php" + }, + { + "match": "(?i)\\bbz(compress|close|open|decompress|errstr|errno|error|flush|write|read)\\b", + "name": "support.function.bz2.php" + }, + { + "match": "(?xi)\\b\n(\n (French|Gregorian|Jewish|Julian)ToJD|cal_(to_jd|info|days_in_month|from_jd)|unixtojd|\n jdto(unix|jewish)|easter_(date|days)|JD(MonthName|To(Gregorian|Julian|French)|DayOfWeek)\n)\\b", + "name": "support.function.calendar.php" + }, + { + "match": "(?xi)\\b\n(\n __autoload|class_alias|(class|interface|method|property|trait|enum)_exists|\n is_(a|subclass_of)|\n get_(class(_(vars|methods))?|(called|parent)_class|\n (mangled_)?object_vars|declared_(classes|interfaces|traits))\n)\\b", + "name": "support.function.classobj.php" + }, + { + "match": "(?xi)\\b\n(\n com_(create_guid|print_typeinfo|event_sink|load_typelib|get_active_object|message_pump)|\n variant_(sub|set(_type)?|not|neg|cast|cat|cmp|int|idiv|imp|or|div|date_(from|to)_timestamp|\n pow|eqv|fix|and|add|abs|round|get_type|xor|mod|mul)\n)\\b", + "name": "support.function.com.php" + }, + { + "match": "(?i)\\b(isset|unset|eval|empty|list)\\b", + "name": "support.function.construct.php" + }, + { + "match": "(?i)\\b(print|echo)\\b", + "name": "support.function.construct.output.php" + }, + { + "match": "(?i)\\bctype_(space|cntrl|digit|upper|punct|print|lower|alnum|alpha|graph|xdigit)\\b", + "name": "support.function.ctype.php" + }, + { + "match": "(?xi)\\b\ncurl_(\n close|copy_handle|errno|error|escape|exec|getinfo|init|pause|reset|\nsetopt(_array)?|strerror|unescape|upkeep|version|\n multi_((add|remove)_handle|close|errno|exec|getcontent|\n info_read|init|select|setopt|strerror)|\n share_(close|errno|init(_persistent)?|setopt|strerror)\n)\\b", + "name": "support.function.curl.php" + }, + { + "match": "(?xi)\\b\n(\n strtotime|str[fp]time|checkdate|time|timezone_name_(from_abbr|get)|idate|\n timezone_((location|offset|transitions|version)_get|(abbreviations|identifiers)_list|open)|\n date(_(sun(rise|set)|sun_info|sub|create(_immutable)?(_from_format)?|timestamp_[gs]et|timezone_[gs]et|time_set|\n isodate_set|interval_(create_from_date_string|format)|offset_get|diff|default_timezone_[gs]et|date_set|\n parse(_from_format)?|format|add|get_last_errors|modify))?|\n localtime|get(date|timeofday)|gm(strftime|date|mktime)|microtime|mktime\n)\\b", + "name": "support.function.datetime.php" + }, + { + "match": "(?i)\\bdba_(sync|handlers|nextkey|close|insert|optimize|open|delete|popen|exists|key_split|firstkey|fetch|list|replace)\\b", + "name": "support.function.dba.php" + }, + { + "match": "(?i)\\bdbx_(sort|connect|compare|close|escape_string|error|query|fetch_row)\\b", + "name": "support.function.dbx.php" + }, + { + "match": "(?i)\\b(scandir|chdir|chroot|closedir|opendir|dir|rewinddir|readdir|getcwd)\\b", + "name": "support.function.dir.php" + }, + { + "match": "(?xi)\\b\neio_(\n sync(fs)?|sync_file_range|symlink|stat(vfs)?|sendfile|set_min_parallel|set_max_(idle|poll_(reqs|time)|parallel)|\n seek|n(threads|op|pending|reqs|ready)|chown|chmod|custom|close|cancel|truncate|init|open|dup2|unlink|utime|poll|\n event_loop|f(sync|stat(vfs)?|chown|chmod|truncate|datasync|utime|allocate)|write|lstat|link|rename|realpath|\n read(ahead|dir|link)?|rmdir|get_(event_stream|last_error)|grp(_(add|cancel|limit))?|mknod|mkdir|busy\n)\\b", + "name": "support.function.eio.php" + }, + { + "match": "(?xi)\\b\nenchant_(\n dict_(store_replacement|suggest|check|is_in_session|describe|quick_check|add_to_(personal|session)|get_error)|\n broker_(set_ordering|init|dict_exists|describe|free(_dict)?|list_dicts|request_(pwl_)?dict|get_error)\n)\\b", + "name": "support.function.enchant.php" + }, + { + "match": "(?i)\\b(split(i)?|sql_regcase|ereg(i)?(_replace)?)\\b", + "name": "support.function.ereg.php" + }, + { + "match": "(?i)\\b((restore|set)_(error|exception)_handler|trigger_error|debug_(print_)?backtrace|user_error|error_(log|reporting|(clear|get)_last))\\b", + "name": "support.function.errorfunc.php" + }, + { + "match": "(?i)\\b(shell_exec|system|passthru|proc_(nice|close|terminate|open|get_status)|escapeshell(arg|cmd)|exec)\\b", + "name": "support.function.exec.php" + }, + { + "match": "(?i)\\b(exif_(thumbnail|tagname|imagetype|read_data)|read_exif_data)\\b", + "name": "support.function.exif.php" + }, + { + "match": "(?xi)\\b\nfann_(\n (duplicate|length|merge|shuffle|subset)_train_data|scale_(train(_data)?|(input|output)(_train_data)?)|\n set_(scaling_params|sarprop_(step_error_(shift|threshold_factor)|temperature|weight_decay_shift)|\n cascade_(num_candidate_groups|candidate_(change_fraction|limit|stagnation_epochs)|\n output_(change_fraction|stagnation_epochs)|weight_multiplier|activation_(functions|steepnesses)|\n (max|min)_(cand|out)_epochs)|\n callback|training_algorithm|train_(error|stop)_function|(input|output)_scaling_params|error_log|\n quickprop_(decay|mu)|weight(_array)?|learning_(momentum|rate)|bit_fail_limit|\n activation_(function|steepness)(_(hidden|layer|output))?|\n rprop_((decrease|increase)_factor|delta_(max|min|zero)))|\n save(_train)?|num_(input|output)_train_data|copy|clear_scaling_params|cascadetrain_on_(file|data)|\n create_((sparse|shortcut|standard)(_array)?|train(_from_callback)?|from_file)|\n test(_data)?|train(_(on_(file|data)|epoch))?|init_weights|descale_(input|output|train)|destroy(_train)?|\n print_error|run|reset_(MSE|err(no|str))|read_train_from_file|randomize_weights|\n get_(sarprop_(step_error_(shift|threshold_factor)|temperature|weight_decay_shift)|num_(input|output|layers)|\n network_type|MSE|connection_(array|rate)|bias_array|bit_fail(_limit)?|\n cascade_(num_(candidates|candidate_groups)|(candidate|output)_(change_fraction|limit|stagnation_epochs)|\n weight_multiplier|activation_(functions|steepnesses)(_count)?|(max|min)_(cand|out)_epochs)|\n total_(connections|neurons)|training_algorithm|train_(error|stop)_function|err(no|str)|\n quickprop_(decay|mu)|learning_(momentum|rate)|layer_array|activation_(function|steepness)|\n rprop_((decrease|increase)_factor|delta_(max|min|zero)))\n)\\b", + "name": "support.function.fann.php" + }, + { + "match": "(?xi)\\b\n(\n symlink|stat|set_file_buffer|chown|chgrp|chmod|copy|clearstatcache|touch|tempnam|tmpfile|\n is_(dir|(uploaded_)?file|executable|link|readable|writ(e)?able)|disk_(free|total)_space|diskfreespace|\n dirname|delete|unlink|umask|pclose|popen|pathinfo|parse_ini_(file|string)|fscanf|fstat|fseek|fnmatch|\n fclose|ftell|ftruncate|file(size|[acm]time|type|inode|owner|perms|group)?|file_(exists|(get|put)_contents)|\n f(open|puts|putcsv|passthru|eof|flush|write|lock|read|gets(s)?|getc(sv)?)|lstat|lchown|lchgrp|link(info)?|\n rename|rewind|read(file|link)|realpath(_cache_(get|size))?|rmdir|glob|move_uploaded_file|mkdir|basename|\n f(data)?sync\n)\\b", + "name": "support.function.file.php" + }, + { + "match": "(?i)\\b(finfo_(set_flags|close|open|file|buffer)|mime_content_type)\\b", + "name": "support.function.fileinfo.php" + }, + { + "match": "(?i)\\bfilter_(has_var|input(_array)?|id|var(_array)?|list)\\b", + "name": "support.function.filter.php" + }, + { + "match": "(?i)\\b(fastcgi_finish_request|fpm_get_status)\\b", + "name": "support.function.fpm.php" + }, + { + "match": "(?i)\\b(call_user_(func|method)(_array)?|create_function|unregister_tick_function|forward_static_call(_array)?|function_exists|func_(num_args|get_arg(s)?)|register_(shutdown|tick)_function|get_defined_functions)\\b", + "name": "support.function.funchand.php" + }, + { + "match": "(?i)\\b((n)?gettext|textdomain|d((n)?gettext|c(n)?gettext)|bind(textdomain|_textdomain_codeset))\\b", + "name": "support.function.gettext.php" + }, + { + "match": "(?xi)\\b\ngmp_(\n scan[01]|strval|sign|sub|setbit|sqrt(rem)?|hamdist|neg|nextprime|com|clrbit|cmp|testbit|\n intval|init|invert|import|or|div(exact)?|div_(q|qr|r)|jacobi|popcount|pow(m)?|perfect_(square|power)|\n prob_prime|export|fact|legendre|and|add|abs|root(rem)?|random(_(bits|range|seed))?|gcd(ext)?|xor|mod|mul|\n binomial|kronecker|lcm\n)\\b", + "name": "support.function.gmp.php" + }, + { + "match": "(?xi)\\b hash(_( algos|copy|equals|file|final|hkdf|hmac(_(file|algos)?)?| init|pbkdf2|update(_(file|stream))? ))? \\b", + "name": "support.function.hash.php" + }, + { + "match": "(?xi)\\b\n(\n http_(support|send_(status|stream|content_(disposition|type)|data|file|last_modified)|head|\n negotiate_(charset|content_type|language)|chunked_decode|cache_(etag|last_modified)|throttle|\n inflate|deflate|date|post_(data|fields)|put_(data|file|stream)|persistent_handles_(count|clean|ident)|\n parse_(cookie|headers|message|params)|redirect|request(_(method_(exists|name|(un)?register)|body_encode))?|\n get(_request_(headers|body(_stream)?))?|match_(etag|modified|request_header)|build_(cookie|str|url))|\n ob_(etag|deflate|inflate)handler\n)\\b", + "name": "support.function.http.php" + }, + { + "match": "(?i)\\b(iconv(_(str(pos|len|rpos)|substr|[gs]et_encoding|mime_(decode(_headers)?|encode)))?|ob_iconv_handler)\\b", + "name": "support.function.iconv.php" + }, + { + "match": "(?i)\\biis_((start|stop)_(service|server)|set_(script_map|server_rights|dir_security|app_settings)|(add|remove)_server|get_(script_map|service_state|server_(rights|by_(comment|path))|dir_security))\\b", + "name": "support.function.iisfunc.php" + }, + { + "match": "(?xi)\\b\n(\n iptc(embed|parse)|(jpeg|png)2wbmp|gd_info|getimagesize(fromstring)?|\n image(s[xy]|scale|(char|string)(up)?|set(clip|style|thickness|tile|interpolation|pixel|brush)|savealpha|\n convolution|copy(resampled|resized|merge(gray)?)?|colors(forindex|total)|\n color(set|closest(alpha|hwb)?|transparent|deallocate|(allocate|exact|resolve)(alpha)?|at|match)|\n crop(auto)?|create(truecolor|from(avif|bmp|string|jpeg|png|wbmp|webp|gif|gd(2(part)?)?|tga|xpm|xbm))?|\n types|ttf(bbox|text)|truecolortopalette|istruecolor|interlace|2wbmp|destroy|dashedline|jpeg|\n _type_to_(extension|mime_type)|ps(slantfont|text|(encode|extend|free|load)font|bbox)|png|polygon|\n palette(copy|totruecolor)|ellipse|ft(text|bbox)|filter|fill|filltoborder|\n filled(arc|ellipse|polygon|rectangle)|font(height|width)|flip|webp|wbmp|line|loadfont|layereffect|\n antialias|affine(matrix(concat|get))?|alphablending|arc|rotate|rectangle|gif|gd2?|gammacorrect|\n grab(screen|window)|xbm|resolution|openpolygon|get(clip|interpolation)|avif|bmp)\n)\\b", + "name": "support.function.image.php" + }, + { + "match": "(?xi)\\b\n(\n sys_get_temp_dir|set_(time_limit|include_path|magic_quotes_runtime)|cli_[gs]et_process_title|\n ini_(alter|get(_all)?|restore|set)|zend_(thread_id|version|logo_guid)|dl|php(credits|info|version)|\n php_(sapi_name|ini_(scanned_files|loaded_file)|uname|logo_guid)|putenv|extension_loaded|version_compare|\n assert(_options)?|restore_include_path|gc_(collect_cycles|disable|enable(d)?)|getopt|\n get_(cfg_var|current_user|defined_constants|extension_funcs|include_path|included_files|loaded_extensions|\n magic_quotes_(gpc|runtime)|required_files|resources)|\n get(env|lastmod|rusage|my(inode|[gup]id))|\n memory_get_(peak_)?usage|main|magic_quotes_runtime\n)\\b", + "name": "support.function.info.php" + }, + { + "match": "(?xi)\\b\nibase_(\n set_event_handler|service_(attach|detach)|server_info|num_(fields|params)|name_result|connect|\n commit(_ret)?|close|trans|delete_user|drop_db|db_info|pconnect|param_info|prepare|err(code|msg)|\n execute|query|field_info|fetch_(assoc|object|row)|free_(event_handler|query|result)|wait_event|\n add_user|affected_rows|rollback(_ret)?|restore|gen_id|modify_user|maintain_db|backup|\n blob_(cancel|close|create|import|info|open|echo|add|get)\n)\\b", + "name": "support.function.interbase.php" + }, + { + "match": "(?xi)\\b\n(\n normalizer_(normalize|is_normalized)|idn_to_(unicode|utf8|ascii)|\n numfmt_(set_(symbol|(text_)?attribute|pattern)|create|(parse|format)(_currency)?|\n get_(symbol|(text_)?attribute|pattern|error_(code|message)|locale))|\n collator_(sort(_with_sort_keys)?|set_(attribute|strength)|compare|create|asort|\n get_(strength|sort_key|error_(code|message)|locale|attribute))|\n transliterator_(create(_(inverse|from_rules))?|transliterate|list_ids|get_error_(code|message))|\n intl(cal|tz)_get_error_(code|message)|intl_(is_failure|error_name|get_error_(code|message))|\n datefmt_(set_(calendar|lenient|pattern|timezone(_id)?)|create|is_lenient|parse|format(_object)?|localtime|\n get_(calendar(_object)?|time(type|zone(_id)?)|datetype|pattern|error_(code|message)|locale))|\n locale_(set_default|compose|canonicalize|parse|filter_matches|lookup|accept_from_http|\n get_(script|display_(script|name|variant|language|region)|default|primary_language|keywords|all_variants|region))|\n resourcebundle_(create|count|locales|get(_(error_(code|message)))?)|\n grapheme_(str(i?str|r?i?pos|len|_split)|substr|extract)|\n msgfmt_(set_pattern|create|(format|parse)(_message)?|get_(pattern|error_(code|message)|locale))\n)\\b", + "name": "support.function.intl.php" + }, + { + "match": "(?i)\\bjson_(decode|encode|last_error(_msg)?|validate)\\b", + "name": "support.function.json.php" + }, + { + "match": "(?xi)\\b\nldap_(\n start|tls|sort|search|sasl_bind|set_(option|rebind_proc)|(first|next)_(attribute|entry|reference)|\n connect|control_paged_result(_response)?|count_entries|compare|close|t61_to_8859|8859_to_t61|\n dn2ufn|delete|unbind|parse_(reference|result)|escape|errno|err2str|error|explode_dn|bind|\n free_result|list|add|rename|read|get_(option|dn|entries|values(_len)?|attributes)|modify(_batch)?|\n mod_(add|del|replace)\n)\\b", + "name": "support.function.ldap.php" + }, + { + "match": "(?i)\\blibxml_(set_(streams_context|external_entity_loader)|clear_errors|disable_entity_loader|use_internal_errors|get_(errors|last_error))\\b", + "name": "support.function.libxml.php" + }, + { + "match": "(?i)\\b(ezmlm_hash|mail)\\b", + "name": "support.function.mail.php" + }, + { + "match": "(?xi)\\b\n(\n a?(cos|sin|tan)h?|sqrt|srand|hypot|hexdec|ceil|is_(nan|(in)?finite)|octdec|dec(hex|oct|bin)|deg2rad|\n pi|pow|exp(m1)?|floor|f(div|mod|pow)|lcg_value|log(1[p0])?|atan2|abs|round|rand|rad2deg|getrandmax|\n mt_(srand|rand|getrandmax)|max|min|bindec|base_convert|intdiv\n)\\b", + "name": "support.function.math.php" + }, + { + "match": "(?xi)\\b\nmb_(\n str(cut|str|to(lower|upper)|istr|ipos|imwidth|pos|width|len|rchr|richr|ripos|rpos|_pad|_split)|\n substitute_character|substr(_count)?|split|send_mail|http_(input|output)|check_encoding|\n convert_(case|encoding|kana|variables)|internal_encoding|output_handler|decode_(numericentity|mimeheader)|\n detect_(encoding|order)|parse_str|preferred_mime_name|encoding_aliases|encode_(numericentity|mimeheader)|\n ereg(i(_replace)?)?|ereg_(search(_(get(pos|regs)|init|regs|(set)?pos))?|replace(_callback)?|match)|\n list_encodings|language|regex_(set_options|encoding)|get_info|\n [lr]?trim|[lu]cfirst|ord|chr|scrub\n)\\b", + "name": "support.function.mbstring.php" + }, + { + "match": "(?xi)\\b\n(\n mcrypt_(\n cfb|create_iv|cbc|ofb|decrypt|encrypt|ecb|list_(algorithms|modes)|generic(_((de)?init|end))?|\n enc_(self_test|is_block_(algorithm|algorithm_mode|mode)|\n get_(supported_key_sizes|(block|iv|key)_size|(algorithms|modes)_name))|\n get_(cipher_name|(block|iv|key)_size)|\n module_(close|self_test|is_block_(algorithm|algorithm_mode|mode)|open|\n get_(supported_key_sizes|algo_(block|key)_size)))|\n mdecrypt_generic\n)\\b", + "name": "support.function.mcrypt.php" + }, + { + "match": "(?i)\\bmemcache_debug\\b", + "name": "support.function.memcache.php" + }, + { + "match": "(?i)\\bmhash(_(count|keygen_s2k|get_(hash_name|block_size)))?\\b", + "name": "support.function.mhash.php" + }, + { + "match": "(?i)\\b(log_(cmd_(insert|delete|update)|killcursor|write_batch|reply|getmore)|bson_(decode|encode))\\b", + "name": "support.function.mongo.php" + }, + { + "match": "(?xi)\\b\nmysql_(\n stat|set_charset|select_db|num_(fields|rows)|connect|client_encoding|close|create_db|escape_string|\n thread_id|tablename|insert_id|info|data_seek|drop_db|db_(name|query)|unbuffered_query|pconnect|ping|\n errno|error|query|field_(seek|name|type|table|flags|len)|fetch_(object|field|lengths|assoc|array|row)|\n free_result|list_(tables|dbs|processes|fields)|affected_rows|result|real_escape_string|\n get_(client|host|proto|server)_info\n)\\b", + "name": "support.function.mysql.php" + }, + { + "match": "(?xi)\\b\nmysqli_(\n ssl_set|store_result|stat|send_(query|long_data)|set_(charset|opt|local_infile_(default|handler))|\n stmt_(store_result|send_long_data|next_result|close|init|data_seek|prepare|execute|fetch|free_result|\n attr_[gs]et|result_metadata|reset|get_(result|warnings)|more_results|bind_(param|result))|\n select_db|slave_query|savepoint|next_result|change_user|character_set_name|connect|commit|\n client_encoding|close|thread_safe|init|options|(enable|disable)_(reads_from_master|rpl_parse)|\n dump_debug_info|debug|data_seek|use_result|ping|poll|param_count|prepare|escape_string|execute|\n embedded_server_(start|end)|kill|query|field_seek|free_result|autocommit|rollback|report|refresh|\n fetch(_(object|fields|field(_direct)?|assoc|all|array|row))?|rpl_(parse_enabled|probe|query_type)|\n release_savepoint|reap_async_query|real_(connect|escape_string|query)|more_results|multi_query|\n get_(charset|connection_stats|client_(stats|info|version)|cache_stats|warnings|links_stats|metadata)|\n master_query|bind_(param|result)|begin_transaction\n)\\b", + "name": "support.function.mysqli.php" + }, + { + "match": "(?i)\\bmysqlnd_memcache_(set|get_config)\\b", + "name": "support.function.mysqlnd-memcache.php" + }, + { + "match": "(?i)\\bmysqlnd_ms_(set_(user_pick_server|qos)|dump_servers|query_is_select|fabric_select_(shard|global)|get_(stats|last_(used_connection|gtid))|xa_(commit|rollback|gc|begin)|match_wild)\\b", + "name": "support.function.mysqlnd-ms.php" + }, + { + "match": "(?i)\\bmysqlnd_qc_(set_(storage_handler|cache_condition|is_select|user_handlers)|clear_cache|get_(normalized_query_trace_log|core_stats|cache_info|query_trace_log|available_handlers))\\b", + "name": "support.function.mysqlnd-qc.php" + }, + { + "match": "(?i)\\bmysqlnd_uh_(set_(statement|connection)_proxy|convert_to_mysqlnd)\\b", + "name": "support.function.mysqlnd-uh.php" + }, + { + "match": "(?xi)\\b\n(\n syslog|socket_(set_(blocking|timeout)|get_status)|set(raw)?cookie|http_response_code|openlog|\n headers_(list|sent)|header(_(register_callback|remove))?|checkdnsrr|closelog|inet_(ntop|pton)|ip2long|\n openlog|dns_(check_record|get_(record|mx))|define_syslog_variables|(p)?fsockopen|long2ip|\n get(servby(name|port)|host(name|by(name(l)?|addr))|protoby(name|number)|mxrr)|\n http_(clear|get)_last_response_headers|net_get_interfaces|request_parse_body\n)\\b", + "name": "support.function.network.php" + }, + { + "match": "(?i)\\bnsapi_(virtual|response_headers|request_headers)\\b", + "name": "support.function.nsapi.php" + }, + { + "match": "(?xi)\\b\n(\n oci(statementtype|setprefetch|serverversion|savelob(file)?|numcols|new(collection|cursor|descriptor)|nlogon|\n column(scale|size|name|type(raw)?|isnull|precision)|coll(size|trim|assign(elem)?|append|getelem|max)|commit|\n closelob|cancel|internaldebug|definebyname|plogon|parse|error|execute|fetch(statement|into)?|\n free(statement|collection|cursor|desc)|write(temporarylob|lobtofile)|loadlob|log(on|off)|rowcount|rollback|\n result|bindbyname)|\n oci_(statement_type|set_(client_(info|identifier)|prefetch|edition|action|module_name)|server_version|\n num_(fields|rows)|new_(connect|collection|cursor|descriptor)|connect|commit|client_version|close|cancel|\n internal_debug|define_by_name|pconnect|password_change|parse|error|execute|bind_(array_)?by_name|\n field_(scale|size|name|type(_raw)?|is_null|precision)|fetch(_(object|assoc|all|array|row))?|\n free_(statement|descriptor)|lob_(copy|is_equal)|rollback|result|get_implicit_resultset)\n)\\b", + "name": "support.function.oci8.php" + }, + { + "match": "(?i)\\bopcache_(compile_file|invalidate|is_script_cached|reset|get_(status|configuration))\\b", + "name": "support.function.opcache.php" + }, + { + "match": "(?xi)\\b\nopenssl_(\n sign|spki_(new|export(_challenge)?|verify)|seal|csr_(sign|new|export(_to_file)?|get_(subject|public_key))|\n cipher_(iv|key)_length|open|dh_compute_key|digest|decrypt|public_(decrypt|encrypt)|encrypt|error_string|\n pkcs12_(export(_to_file)?|read)|(cms|pkcs7)_(sign|decrypt|encrypt|verify|read)|verify|free_key|random_pseudo_bytes|\n pkey_(derive|new|export(_to_file)?|free|get_(details|public|private))|private_(decrypt|encrypt)|pbkdf2|\n get_((cipher|md)_methods|cert_locations|curve_names|(public|private)key)|\n x509_(check_private_key|checkpurpose|parse|export(_to_file)?|fingerprint|free|read|verify)\n)\\b", + "name": "support.function.openssl.php" + }, + { + "match": "(?xi)\\b\n(\n output_(add_rewrite_var|reset_rewrite_vars)|flush|\n ob_(start|clean|implicit_flush|end_(clean|flush)|flush|list_handlers|gzhandler|\n get_(status|contents|clean|flush|length|level))\n)\\b", + "name": "support.function.output.php" + }, + { + "match": "(?i)\\bpassword_(algos|hash|needs_rehash|verify|get_info)\\b", + "name": "support.function.password.php" + }, + { + "match": "(?xi)\\b\npcntl_(\n alarm|async_signals|errno|exec|r?fork|get_last_error|[gs]et(cpuaffinity|priority)|\n signal(_(dispatch|get_handler))?|sig(procmask|timedwait|waitinfo)|strerror|unshare|\n wait(p?id)?|wexitstatus|wif(exited|signaled|stopped)|w(stop|term)sig\n)\\b", + "name": "support.function.pcntl.php" + }, + { + "match": "(?xi)\\b\npg_(\n socket|send_(prepare|execute|query(_params)?)|set_(client_encoding|error_verbosity)|select|host|\n num_(fields|rows)|consume_input|connection_(status|reset|busy)|connect(_poll)?|convert|copy_(from|to)|\n client_encoding|close|cancel_query|tty|transaction_status|trace|insert|options|delete|dbname|untrace|\n unescape_bytea|update|pconnect|ping|port|put_line|parameter_status|prepare|version|query(_params)?|\n escape_(string|identifier|literal|bytea)|end_copy|execute|flush|free_result|last_(notice|error|oid)|\n field_(size|num|name|type(_oid)?|table|is_null|prtlen)|affected_rows|result_(status|seek|error(_field)?)|\n fetch_(object|assoc|all(_columns)?|array|row|result)|get_(notify|pid|result)|meta_data|\n lo_(seek|close|create|tell|truncate|import|open|unlink|export|write|read(_all)?)|\n)\\b", + "name": "support.function.pgsql.php" + }, + { + "match": "(?i)\\b(virtual|getallheaders|apache_([gs]etenv|note|child_terminate|lookup_uri|response_headers|reset_timeout|request_headers|get_(version|modules)))\\b", + "name": "support.function.php_apache.php" + }, + { + "match": "(?i)\\bdom_import_simplexml\\b", + "name": "support.function.php_dom.php" + }, + { + "match": "(?xi)\\b\nftp_(\n ssl_connect|systype|site|size|set_option|nlist|nb_(continue|f?(put|get))|ch(dir|mod)|connect|cdup|close|\n delete|put|pwd|pasv|exec|quit|f(put|get)|login|alloc|rename|raw(list)?|rmdir|get(_option)?|mdtm|mkdir\n)\\b", + "name": "support.function.php_ftp.php" + }, + { + "match": "(?xi)\\b\nimap_(\n (create|delete|list|rename|scan)(mailbox)?|status|sort|subscribe|set_quota|set(flag_full|acl)|search|savebody|\n num_(recent|msg)|check|close|clearflag_full|thread|timeout|open|header(info)?|headers|append|alerts|reopen|\n 8bit|unsubscribe|undelete|utf7_(decode|encode)|utf8|uid|ping|errors|expunge|qprint|gc|\n fetch(structure|header|text|mime|body)|fetch_overview|lsub|list(scan|subscribed)|last_error|\n rfc822_(parse_(headers|adrlist)|write_address)|get(subscribed|acl|mailboxes)|get_quota(root)?|\n msgno|mime_header_decode|mail_(copy|compose|move)|mail|mailboxmsginfo|binary|body(struct)?|base64\n)\\b", + "name": "support.function.php_imap.php" + }, + { + "match": "(?xi)\\b\nmssql_(\n select_db|num_(fields|rows)|next_result|connect|close|init|data_seek|pconnect|execute|query|\n field_(seek|name|type|length)|fetch_(object|field|assoc|array|row|batch)|free_(statement|result)|\n rows_affected|result|guid_string|get_last_message|min_(error|message)_severity|bind\n)\\b", + "name": "support.function.php_mssql.php" + }, + { + "match": "(?xi)\\b\nodbc_(\n statistics|specialcolumns|setoption|num_(fields|rows)|next_result|connect|columns|columnprivileges|commit|\n cursor|close(_all)?|tables|tableprivileges|do|data_source|pconnect|primarykeys|procedures|procedurecolumns|\n prepare|error(msg)?|exec(ute)?|field_(scale|num|name|type|precision|len)|foreignkeys|free_result|\n fetch_(into|object|array|row)|longreadlen|autocommit|rollback|result(_all)?|gettypeinfo|binmode\n)\\b", + "name": "support.function.php_odbc.php" + }, + { + "match": "(?i)\\bpreg_(split|quote|filter|last_error(_msg)?|replace(_callback(_array)?)?|grep|match(_all)?)\\b", + "name": "support.function.php_pcre.php" + }, + { + "match": "(?i)\\b(spl_(classes|object_hash|autoload(_(call|unregister|extensions|functions|register))?)|class_(implements|uses|parents)|iterator_(count|to_array|apply))\\b", + "name": "support.function.php_spl.php" + }, + { + "match": "(?i)\\bzip_(close|open|entry_(name|compressionmethod|compressedsize|close|open|filesize|read)|read)\\b", + "name": "support.function.php_zip.php" + }, + { + "match": "(?xi)\\b\nposix_(\n strerror|set(s|e?u|[ep]?g)id|ctermid|ttyname|times|isatty|initgroups|uname|errno|kill|e?access|\n get(sid|cwd|uid|pid|ppid|pwnam|pwuid|pgid|pgrp|euid|egid|login|rlimit|gid|grnam|groups|grgid)|\n get_last_error|mknod|mkfifo|(sys|f?path)conf|setrlimit\n)\\b", + "name": "support.function.posix.php" + }, + { + "match": "(?i)\\bset(thread|proc)title\\b", + "name": "support.function.proctitle.php" + }, + { + "match": "(?xi)\\b\npspell_(\n store_replacement|suggest|save_wordlist|new(_(config|personal))?|check|clear_session|\n config_(save_repl|create|ignore|(data|dict)_dir|personal|runtogether|repl|mode)|add_to_(session|personal)\n)\\b", + "name": "support.function.pspell.php" + }, + { + "match": "(?i)\\breadline(_(completion_function|clear_history|callback_(handler_(install|remove)|read_char)|info|on_new_line|write_history|list_history|add_history|redisplay|read_history))?\\b", + "name": "support.function.readline.php" + }, + { + "match": "(?i)\\brecode(_(string|file))?\\b", + "name": "support.function.recode.php" + }, + { + "match": "(?i)\\brrd(c_disconnect|_(create|tune|info|update|error|version|first|fetch|last(update)?|restore|graph|xport))\\b", + "name": "support.function.rrd.php" + }, + { + "match": "(?xi)\\b\n(\n shm_((get|has|remove|put)_var|detach|attach|remove)|sem_(acquire|release|remove|get)|ftok|\n msg_((get|remove|set|stat)_queue|send|queue_exists|receive)\n)\\b", + "name": "support.function.sem.php" + }, + { + "match": "(?xi)\\b\nsession_(\n status|start|set_(save_handler|cookie_params)|save_path|name|commit|cache_(expire|limiter)|\n is_registered|id|destroy|decode|unset|unregister|encode|write_close|abort|reset|register(_shutdown)?|\n (regenerate|create)_id|get_cookie_params|module_name|gc\n)\\b", + "name": "support.function.session.php" + }, + { + "match": "(?i)\\bshmop_(size|close|open|delete|write|read)\\b", + "name": "support.function.shmop.php" + }, + { + "match": "(?i)\\bsimplexml_(import_dom|load_(string|file))\\b", + "name": "support.function.simplexml.php" + }, + { + "match": "(?xi)\\b\n(\n snmp(walk(oid)?|realwalk|get(next)?|set)|\n snmp_(set_(valueretrieval|quick_print|enum_print|oid_(numeric_print|output_format))|read_mib|\n get_(valueretrieval|quick_print))|\n snmp[23]_(set|walk|real_walk|get(next)?)\n)\\b", + "name": "support.function.snmp.php" + }, + { + "match": "(?i)\\b(is_soap_fault|use_soap_error_handler)\\b", + "name": "support.function.soap.php" + }, + { + "match": "(?xi)\\b\nsocket_(\n accept|addrinfo_(bind|connect|explain|lookup)|atmark|bind|(clear|last)_error|close|cmsg_space|connect|\n create(_(listen|pair))?|(ex|im)port_stream|[gs]et_option|[gs]etopt|get(peer|sock)name|\n listen|read|recv(from|msg)?|select|send(msg|to)?|set_(non)?block|shutdown|strerror|write|\n wsaprotocol_info_(export|import|release)\n)\\b", + "name": "support.function.sockets.php" + }, + { + "match": "(?xi)\\b\nsqlite_(\n single_query|seek|has_(more|prev)|num_(fields|rows)|next|changes|column|current|close|\n create_(aggregate|function)|open|unbuffered_query|udf_(decode|encode)_binary|popen|prev|\n escape_string|error_string|exec|valid|key|query|field_name|factory|\n fetch_(string|single|column_types|object|all|array)|lib(encoding|version)|\n last_(insert_rowid|error)|array_query|rewind|busy_timeout\n)\\b", + "name": "support.function.sqlite.php" + }, + { + "match": "(?xi)\\b\nsqlsrv_(\n send_stream_data|server_info|has_rows|num_(fields|rows)|next_result|connect|configure|commit|\n client_info|close|cancel|prepare|errors|execute|query|field_metadata|fetch(_(array|object))?|\n free_stmt|rows_affected|rollback|get_(config|field)|begin_transaction\n)\\b", + "name": "support.function.sqlsrv.php" + }, + { + "match": "(?xi)\\b\nstats_(\n harmonic_mean|covariance|standard_deviation|skew|\n cdf_(noncentral_(chisquare|f)|negative_binomial|chisquare|cauchy|t|uniform|poisson|exponential|f|weibull|\n logistic|laplace|gamma|binomial|beta)|\n stat_(noncentral_t|correlation|innerproduct|independent_t|powersum|percentile|paired_t|gennch|binomial_coef)|\n dens_(normal|negative_binomial|chisquare|cauchy|t|pmf_(hypergeometric|poisson|binomial)|exponential|f|\n weibull|logistic|laplace|gamma|beta)|\n den_uniform|variance|kurtosis|absolute_deviation|\n rand_(setall|phrase_to_seeds|ranf|get_seeds|\n gen_(noncentral_[ft]|noncenral_chisquare|normal|chisquare|t|int|\n i(uniform|poisson|binomial(_negative)?)|exponential|f(uniform)?|gamma|beta))\n)\\b", + "name": "support.function.stats.php" + }, + { + "match": "(?xi)\\b\nstream_(\n bucket_(new|prepend|append|make_writeable)|\n context_(create|[gs]et_(options?|default|params))|copy_to_stream|filter_((ap|pre)pend|register|remove)|\n get_(contents|filters|line|meta_data|transports|wrappers)|is(atty|_local)|notification_callback|register_wrapper|resolve_include_path|select|\n set_(blocking|chunk_size|(read|write)_buffer|timeout)|\n socket_(accept|client|enable_crypto|get_name|pair|recvfrom|sendto|server|shutdown)|\n supports_lock|wrapper_((un)?register|restore)\n)\\b", + "name": "support.function.streamsfuncs.php" + }, + { + "match": "(?xi)\\b\n(\n money_format|md5(_file)?|metaphone|bin2hex|sscanf|sha1(_file)?|\n str(str|c?spn|n(at)?(case)?cmp|chr|coll|(case)?cmp|to(upper|lower)|tok|tr|istr|pos|pbrk|len|rchr|ri?pos|rev)|\n str_(getcsv|i?replace|pad|repeat|rot13|shuffle|split|word_count|\n contains|(starts|ends)_with|(in|de)crement)|\n strip(c?slashes|os)|strip_tags|similar_text|soundex|substr(_(count|compare|replace))?|setlocale|\n html(specialchars(_decode)?|entities)|html_entity_decode|hex2bin|hebrev(c)?|number_format|nl2br|nl_langinfo|\n chop|chunk_split|chr|convert_(cyr_string|uu(decode|encode))|count_chars|crypt|crc32|trim|implode|ord|\n uc(first|words)|join|parse_str|print(f)?|echo|explode|v?[fs]?printf|quoted_printable_(decode|encode)|\n quotemeta|wordwrap|lcfirst|[lr]trim|localeconv|levenshtein|addc?slashes|get_html_translation_table\n)\\b", + "name": "support.function.string.php" + }, + { + "match": "(?xi)\\b\nsybase_(\n set_message_handler|select_db|num_(fields|rows)|connect|close|deadlock_retry_count|data_seek|\n unbuffered_query|pconnect|query|field_seek|fetch_(object|field|assoc|array|row)|free_result|\n affected_rows|result|get_last_message|min_(client|error|message|server)_severity\n)\\b", + "name": "support.function.sybase.php" + }, + { + "match": "(?i)\\b(taint|is_tainted|untaint)\\b", + "name": "support.function.taint.php" + }, + { + "match": "(?xi)\\b\n(\n tidy_([gs]etopt|set_encoding|save_config|config_count|clean_repair|is_(xhtml|xml)|diagnose|\n (access|error|warning)_count|load_config|reset_config|(parse|repair)_(string|file)|\n get_(status|html(_ver)?|head|config|output|opt_doc|root|release|body))|\n ob_tidyhandler\n)\\b", + "name": "support.function.tidy.php" + }, + { + "match": "(?i)\\btoken_(name|get_all)\\b", + "name": "support.function.tokenizer.php" + }, + { + "match": "(?xi)\\b\ntrader_(\n stoch(f|r|rsi)?|stddev|sin(h)?|sum|sub|set_(compat|unstable_period)|sqrt|sar(ext)?|sma|\n ht_(sine|trend(line|mode)|dc(period|phase)|phasor)|natr|cci|cos(h)?|correl|\n cdl(shootingstar|shortline|sticksandwich|stalledpattern|spinningtop|separatinglines|\n hikkake(mod)?|highwave|homingpigeon|hangingman|harami(cross)?|hammer|concealbabyswall|\n counterattack|closingmarubozu|thrusting|tasukigap|takuri|tristar|inneck|invertedhammer|\n identical3crows|2crows|onneck|doji(star)?|darkcloudcover|dragonflydoji|unique3river|\n upsidegap2crows|3(starsinsouth|inside|outside|whitesoldiers|linestrike|blackcrows)|\n piercing|engulfing|evening(doji)?star|kicking(bylength)?|longline|longleggeddoji|\n ladderbottom|advanceblock|abandonedbaby|risefall3methods|rickshawman|gapsidesidewhite|\n gravestonedoji|xsidegap3methods|morning(doji)?star|mathold|matchinglow|marubozu|\n belthold|breakaway)|\n ceil|cmo|tsf|typprice|t3|tema|tan(h)?|trix|trima|trange|obv|div|dema|dx|ultosc|ppo|\n plus_d[im]|errno|exp|ema|var|kama|floor|wclprice|willr|wma|ln|log10|bop|beta|bbands|\n linearreg(_(slope|intercept|angle))?|asin|acos|atan|atr|adosc|ad|add|adx(r)?|apo|avgprice|\n aroon(osc)?|rsi|roc|rocp|rocr(100)?|get_(compat|unstable_period)|min(index)?|minus_d[im]|\n minmax(index)?|mid(point|price)|mom|mult|medprice|mfi|macd(ext|fix)?|mavp|max(index)?|ma(ma)?\n)\\b", + "name": "support.function.trader.php" + }, + { + "match": "(?i)\\buopz_(copy|compose|implement|overload|delete|undefine|extend|function|flags|restore|rename|redefine|backup)\\b", + "name": "support.function.uopz.php" + }, + { + "match": "(?i)\\b(http_build_query|(raw)?url(decode|encode)|parse_url|get_(headers|meta_tags)|base64_(decode|encode))\\b", + "name": "support.function.url.php" + }, + { + "match": "(?xi)\\b\n(\n (bool|double|float|int|str)val|debug_zval_dump|empty|get_(debug_type|defined_vars|resource_(id|type))|[gs]ettype|\n is_(array|bool|callable|countable|double|float|int(eger)?|iterable|long|null|numeric|object|real|resource|scalar|string)|\n isset|print_r|(un)?serialize|unset|var_(dump|export)\n)\\b", + "name": "support.function.var.php" + }, + { + "match": "(?i)\\bwddx_(serialize_(value|vars)|deserialize|packet_(start|end)|add_vars)\\b", + "name": "support.function.wddx.php" + }, + { + "match": "(?i)\\bxhprof_(sample_)?(disable|enable)\\b", + "name": "support.function.xhprof.php" + }, + { + "match": "(?xi)\n\\b\n(\n utf8_(decode|encode)|\n xml_(set_((notation|(end|start)_namespace|unparsed_entity)_decl_handler|\n (character_data|default|element|external_entity_ref|processing_instruction)_handler|object)|\n parse(_into_struct)?|parser_([gs]et_option|create(_ns)?|free)|error_string|\n get_(current_((column|line)_number|byte_index)|error_code))\n)\\b", + "name": "support.function.xml.php" + }, + { + "match": "(?xi)\\b\nxmlrpc_(\n server_(call_method|create|destroy|add_introspection_data|register_(introspection_callback|method))|\n is_fault|decode(_request)?|parse_method_descriptions|encode(_request)?|[gs]et_type\n)\\b", + "name": "support.function.xmlrpc.php" + }, + { + "match": "(?xi)\\b\nxmlwriter_(\n (end|start|write)_(comment|cdata|dtd(_(attlist|entity|element))?|document|pi|attribute|element)|\n (start|write)_(attribute|element)_ns|write_raw|set_indent(_string)?|text|output_memory|open_(memory|uri)|\n full_end_element|flush|\n)\\b", + "name": "support.function.xmlwriter.php" + }, + { + "match": "(?xi)\\b\n(\n zlib_(decode|encode|get_coding_type)|readgzfile|\n gz(seek|compress|close|tell|inflate|open|decode|deflate|uncompress|puts|passthru|encode|eof|file|\n write|rewind|read|getc|getss?)|deflate_(add|init)|inflate_(add|get_(read_len|status)|init)\n)\\b", + "name": "support.function.zlib.php" + } + ] + }, + "switch_statement": { + "patterns": [ + { + "match": "\\s+(?=switch\\b)" + }, + { + "begin": "\\bswitch\\b(?!\\s*\\(.*\\)\\s*:)", + "beginCaptures": { + "0": { + "name": "keyword.control.switch.php" + } + }, + "end": "}|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.section.switch-block.end.bracket.curly.php" + } + }, + "name": "meta.switch-statement.php", + "patterns": [ + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.definition.switch-expression.begin.bracket.round.php" + } + }, + "end": "\\)|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.switch-expression.end.bracket.round.php" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.section.switch-block.begin.bracket.curly.php" + } + }, + "end": "(?=}|\\?>)", + "patterns": [ + { + "include": "$self" + } + ] + } + ] + } + ] + }, + "match_statement": { + "patterns": [ + { + "match": "\\s+(?=match\\b)" + }, + { + "begin": "\\bmatch\\b", + "beginCaptures": { + "0": { + "name": "keyword.control.match.php" + } + }, + "end": "}|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.section.match-block.end.bracket.curly.php" + } + }, + "name": "meta.match-statement.php", + "patterns": [ + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.definition.match-expression.begin.bracket.round.php" + } + }, + "end": "\\)|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.match-expression.end.bracket.round.php" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.section.match-block.begin.bracket.curly.php" + } + }, + "end": "(?=}|\\?>)", + "patterns": [ + { + "match": "=>", + "name": "keyword.definition.arrow.php" + }, + { + "include": "$self" + } + ] + } + ] + } + ] + }, + "use-inner": { + "patterns": [ + { + "include": "#comments" + }, + { + "begin": "(?i)\\b(as)\\s+", + "beginCaptures": { + "1": { + "name": "keyword.other.use-as.php" + } + }, + "end": "(?i)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*", + "endCaptures": { + "0": { + "name": "entity.other.alias.php" + } + } + }, + { + "include": "#class-name" + }, + { + "match": ",", + "name": "punctuation.separator.delimiter.php" + } + ] + }, + "var_basic": { + "patterns": [ + { + "match": "(?i)(\\$+)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*", + "name": "variable.other.php", + "captures": { + "1": { + "name": "punctuation.definition.variable.php" + } + } + } + ] + }, + "var_global": { + "captures": { + "1": { + "name": "punctuation.definition.variable.php" + } + }, + "match": "(\\$)((_(COOKIE|FILES|GET|POST|REQUEST))|arg(v|c))\\b", + "name": "variable.other.global.php" + }, + "var_global_safer": { + "captures": { + "1": { + "name": "punctuation.definition.variable.php" + } + }, + "match": "(\\$)((GLOBALS|_(ENV|SERVER|SESSION)))", + "name": "variable.other.global.safer.php" + }, + "var_language": { + "match": "(\\$)this\\b", + "name": "variable.language.this.php", + "captures": { + "1": { + "name": "punctuation.definition.variable.php" + } + } + }, + "variable-name": { + "patterns": [ + { + "include": "#var_global" + }, + { + "include": "#var_global_safer" + }, + { + "captures": { + "1": { + "name": "variable.other.php" + }, + "2": { + "name": "punctuation.definition.variable.php" + }, + "4": { + "name": "keyword.operator.class.php" + }, + "5": { + "name": "variable.other.property.php" + }, + "6": { + "name": "punctuation.section.array.begin.php" + }, + "7": { + "name": "constant.numeric.index.php" + }, + "8": { + "name": "variable.other.index.php" + }, + "9": { + "name": "punctuation.definition.variable.php" + }, + "10": { + "name": "string.unquoted.index.php" + }, + "11": { + "name": "punctuation.section.array.end.php" + } + }, + "match": "(?xi)\n((\\$)(?[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*))\\s*\n(?:\n (\\??->)\\s*(\\g)\n |\n (\\[)(?:(\\d+)|((\\$)\\g)|([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*))(\\])\n)?" + }, + { + "captures": { + "1": { + "name": "variable.other.php" + }, + "2": { + "name": "punctuation.definition.variable.php" + }, + "4": { + "name": "punctuation.definition.variable.php" + } + }, + "match": "(?i)((\\${)(?[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)(}))" + } + ] + }, + "variables": { + "patterns": [ + { + "include": "#var_language" + }, + { + "include": "#var_global" + }, + { + "include": "#var_global_safer" + }, + { + "include": "#var_basic" + }, + { + "begin": "\\${(?=.*?})", + "beginCaptures": { + "0": { + "name": "punctuation.definition.variable.php" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.definition.variable.php" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + } + ] + }, + "ternary_shorthand": { + "match": "\\?:", + "name": "keyword.operator.ternary.php" + }, + "ternary_expression": { + "begin": "\\?", + "beginCaptures": { + "0": { + "name": "keyword.operator.ternary.php" + } + }, + "end": "(?", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.block.end.powershell" + } + }, + "name": "comment.block.powershell", + "patterns": [ + { + "include": "#commentEmbeddedDocs" + } + ] + }, + { + "match": "[2-6]>&1|>>|>|<<|<|>|>\\||[1-6]>|[1-6]>>", + "name": "keyword.operator.redirection.powershell" + }, + { + "include": "#commands" + }, + { + "include": "#commentLine" + }, + { + "include": "#variable" + }, + { + "include": "#subexpression" + }, + { + "include": "#function" + }, + { + "include": "#attribute" + }, + { + "include": "#UsingDirective" + }, + { + "include": "#type" + }, + { + "include": "#hashtable" + }, + { + "include": "#doubleQuotedString" + }, + { + "include": "#scriptblock" + }, + { + "comment": "Needed to parse stuff correctly in 'argument mode'. (See about_parsing.)", + "include": "#doubleQuotedStringEscapes" + }, + { + "begin": "['\\x{2018}-\\x{201B}]", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.powershell" + } + }, + "end": "['\\x{2018}-\\x{201B}]", + "applyEndPatternLast": true, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.powershell" + } + }, + "name": "string.quoted.single.powershell", + "patterns": [ + { + "match": "['\\x{2018}-\\x{201B}]{2}", + "name": "constant.character.escape.powershell" + } + ] + }, + { + "begin": "(@[\"\\x{201C}-\\x{201E}])\\s*$", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.powershell" + } + }, + "end": "^[\"\\x{201C}-\\x{201E}]@", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.powershell" + } + }, + "name": "string.quoted.double.heredoc.powershell", + "patterns": [ + { + "include": "#variableNoProperty" + }, + { + "include": "#doubleQuotedStringEscapes" + }, + { + "include": "#interpolation" + } + ] + }, + { + "begin": "(@['\\x{2018}-\\x{201B}])\\s*$", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.powershell" + } + }, + "end": "^['\\x{2018}-\\x{201B}]@", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.powershell" + } + }, + "name": "string.quoted.single.heredoc.powershell" + }, + { + "include": "#numericConstant" + }, + { + "begin": "(@)(\\()", + "beginCaptures": { + "1": { + "name": "keyword.other.array.begin.powershell" + }, + "2": { + "name": "punctuation.section.group.begin.powershell" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.group.end.powershell" + } + }, + "name": "meta.group.array-expression.powershell", + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "begin": "((\\$))(\\()", + "beginCaptures": { + "1": { + "name": "keyword.other.substatement.powershell" + }, + "2": { + "name": "punctuation.definition.subexpression.powershell" + }, + "3": { + "name": "punctuation.section.group.begin.powershell" + } + }, + "comment": "TODO: move to repo; make recursive.", + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.group.end.powershell" + } + }, + "name": "meta.group.complex.subexpression.powershell", + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "match": "(\\b(([A-Za-z0-9\\-_\\.]+)\\.(?i:exe|com|cmd|bat))\\b)", + "name": "support.function.powershell" + }, + { + "match": "(?{1,5})}", + "name": "constant.character.escape.powershell" + }, + { + "match": "`u(?:\\{[0-9a-fA-F]{,6}.)?", + "name": "invalid.character.escape.powershell" + } + ] + }, + "function": { + "begin": "^(?:\\s*+)(?i)(function|filter|configuration|workflow)\\s+(?:(global|local|script|private):)?((?:\\p{L}|\\d|_|-|\\.)+)", + "beginCaptures": { + "0": { + "name": "meta.function.powershell" + }, + "1": { + "name": "storage.type.powershell" + }, + "2": { + "name": "storage.modifier.scope.powershell" + }, + "3": { + "name": "entity.name.function.powershell" + } + }, + "end": "(?=\\{|\\()", + "patterns": [ + { + "include": "#commentLine" + } + ] + }, + "subexpression": { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.group.begin.powershell" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.group.end.powershell" + } + }, + "name": "meta.group.simple.subexpression.powershell", + "patterns": [ + { + "include": "$self" + } + ] + }, + "interpolation": { + "begin": "(((\\$)))((\\())", + "beginCaptures": { + "1": { + "name": "keyword.other.substatement.powershell" + }, + "2": { + "name": "punctuation.definition.substatement.powershell" + }, + "3": { + "name": "punctuation.section.embedded.substatement.begin.powershell" + }, + "4": { + "name": "punctuation.section.group.begin.powershell" + }, + "5": { + "name": "punctuation.section.embedded.substatement.begin.powershell" + } + }, + "contentName": "interpolated.complex.source.powershell", + "end": "(\\))", + "endCaptures": { + "0": { + "name": "punctuation.section.group.end.powershell" + }, + "1": { + "name": "punctuation.section.embedded.substatement.end.powershell" + } + }, + "name": "meta.embedded.substatement.powershell", + "patterns": [ + { + "include": "$self" + } + ] + }, + "numericConstant": { + "patterns": [ + { + "captures": { + "1": { + "name": "constant.numeric.hex.powershell" + }, + "2": { + "name": "keyword.other.powershell" + } + }, + "match": "(?)\\s+(\\w+)\\s*(=)\\s*(\\d+)", + "beginCaptures": { + "1": { "name": "storage.type.proto" }, + "2": { "name": "punctuation.definition.typeparameters.begin.proto" }, + "3": { "name": "storage.type.proto" }, + "4": { "name": "storage.type.proto" }, + "5": { "name": "punctuation.definition.typeparameters.end.proto" }, + "6": { "name": "variable.other.proto" }, + "7": { "name": "keyword.operator.assignment.proto" }, + "8": { "name": "constant.numeric.proto" } + }, + "end": "(;)", + "endCaptures": { + "1": { "name": "punctuation.terminator.proto" } + }, + "patterns": [{ "include": "#fieldOptions" }] + }, + "oneof": { + "begin": "(oneof)\\s+([A-Za-z][A-Za-z0-9_]*)\\s*\\{?", + "beginCaptures": { + "1": { "name": "keyword.other.proto" }, + "2": { "name": "variable.other.proto" } + }, + "end": "\\}", + "patterns": [ + { "include": "#optionStmt" }, + { "include": "#comments" }, + { "include": "#field" } + ] + }, + "enum": { + "begin": "(enum)(\\s+)([A-Za-z][A-Za-z0-9_]*)(\\s*)(\\{)?", + "beginCaptures": { + "1": { "name": "keyword.other.proto" }, + "3": { "name": "entity.name.class.proto" } + }, + "end": "\\}", + "patterns": [ + { "include": "#reserved" }, + { "include": "#optionStmt" }, + { "include": "#comments" }, + { + "begin": "([A-Za-z][A-Za-z0-9_]*)\\s*(=)\\s*(-?0[xX][0-9a-fA-F]+|-?[0-9]+)", + "beginCaptures": { + "1": { "name": "variable.other.proto" }, + "2": { "name": "keyword.operator.assignment.proto" }, + "3": { "name": "constant.numeric.proto" } + }, + "end": "(;)", + "endCaptures": { + "1": { "name": "punctuation.terminator.proto" } + }, + "patterns": [{ "include": "#fieldOptions" }] + } + ] + }, + "service": { + "begin": "(service)\\s+([A-Za-z][A-Za-z0-9_.]*)\\s*\\{?", + "beginCaptures": { + "1": { "name": "keyword.other.proto" }, + "2": { "name": "entity.name.class.message.proto" } + }, + "end": "\\}", + "patterns": [ + { "include": "#comments" }, + { "include": "#optionStmt" }, + { "include": "#method" } + ] + }, + "method": { + "begin": "(rpc)\\s+([A-Za-z][A-Za-z0-9_]*)", + "beginCaptures": { + "1": { "name": "keyword.other.proto" }, + "2": { "name": "entity.name.function" } + }, + "end": "\\}|(;)", + "endCaptures": { + "1": { "name": "punctuation.terminator.proto" } + }, + "patterns": [ + { "include": "#comments" }, + { "include": "#optionStmt" }, + { "include": "#rpcKeywords" }, + { "include": "#ident" } + ] + }, + "rpcKeywords": { + "match": "\\b(stream|returns)\\b", + "name": "keyword.other.proto" + }, + "ident": { + "match": "\\.?[A-Za-z][A-Za-z0-9_.]*", + "name": "entity.name.class.proto" + }, + "constants": { + "match": "\\b(true|false|max|[A-Z_]+)\\b", + "name": "constant.language.proto" + }, + "storagetypes": { + "match": "\\b(double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes)\\b", + "name": "storage.type.proto" + }, + "string": { + "match": "([\"'])(?:\\\\.|[^\\\\])*?\\1", + "name": "string.quoted.double.proto" + }, + "number": { + "name": "constant.numeric.proto", + "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)\\b" + } + } +} diff --git a/desktop/internal/editor/syntax/grammars/ruby.tmLanguage.json b/desktop/internal/editor/syntax/grammars/ruby.tmLanguage.json new file mode 100644 index 0000000000..84a8c1bede --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/ruby.tmLanguage.json @@ -0,0 +1,3181 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/Shopify/ruby-lsp/blob/master/vscode/grammars/ruby.cson.json", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/Shopify/ruby-lsp/commit/e044408a069f43c892143f19c389628eebffbd01", + "name": "Ruby", + "scopeName": "source.ruby", + "patterns": [ + { + "captures": { + "1": { + "name": "keyword.control.class.ruby" + }, + "2": { + "name": "entity.name.type.class.ruby" + }, + "5": { + "name": "punctuation.separator.namespace.ruby" + }, + "7": { + "name": "punctuation.separator.inheritance.ruby" + }, + "8": { + "name": "entity.other.inherited-class.ruby" + }, + "11": { + "name": "punctuation.separator.namespace.ruby" + } + }, + "comment": "class Namespace::ClassName < OtherNamespace::OtherClassName", + "match": "\\b(class)\\s+(([a-zA-Z0-9_]+)((::)[a-zA-Z0-9_]+)*)\\s*((<)\\s*(([a-zA-Z0-9_]+)((::)[a-zA-Z0-9_]+)*))?", + "name": "meta.class.ruby" + }, + { + "captures": { + "1": { + "name": "keyword.control.module.ruby" + }, + "2": { + "name": "entity.name.type.module.ruby" + }, + "5": { + "name": "punctuation.separator.namespace.ruby" + } + }, + "match": "\\b(module)\\s+(([a-zA-Z0-9_]+)((::)[a-zA-Z0-9_]+)*)", + "name": "meta.module.ruby" + }, + { + "captures": { + "1": { + "name": "keyword.control.class.ruby" + }, + "2": { + "name": "punctuation.separator.inheritance.ruby" + } + }, + "match": "\\b(class)\\s*(<<)\\s*", + "name": "meta.class.ruby" + }, + { + "comment": "else if is a common mistake carried over from other languages. it works if you put in a second end, but it’s never what you want.", + "match": "(?>)=)", + "comment": "A local variable operation assignment (+=, -=, *=, /=)" + }, + { + "captures": { + "1": { + "name": "keyword.control.ruby" + }, + "3": { + "name": "variable.ruby" + }, + "4": { + "name": "keyword.operator.assignment.augmented.ruby" + } + }, + "match": "(?>)=)", + "comment": "A local variable operation assignment in a condition" + }, + { + "captures": { + "1": { + "name": "variable.ruby" + } + }, + "match": "^\\s*([_a-z][A-Za-z0-9_]*)\\s*(?==[^=>])", + "comment": "A local variable assignment" + }, + { + "captures": { + "1": { + "name": "keyword.control.ruby" + }, + "3": { + "name": "variable.ruby" + } + }, + "match": "(?]", + "comment": "A local variable assignment in a condition" + }, + { + "captures": { + "1": { + "name": "punctuation.definition.constant.hashkey.ruby" + } + }, + "comment": "symbols as hash key (1.9 syntax)", + "match": "(?>[a-zA-Z_]\\w*(?>[?!])?)(:)(?!:)", + "name": "constant.language.symbol.hashkey.ruby" + }, + { + "captures": { + "1": { + "name": "punctuation.definition.constant.ruby" + } + }, + "comment": "symbols as hash key (1.8 syntax)", + "match": "(?[a-zA-Z_]\\w*(?>[?!])?)(?=\\s*=>)", + "name": "constant.language.symbol.hashkey.ruby" + }, + { + "comment": "everything being a reserved word, not a value and needing a 'end' is a..", + "match": "(?|_|\\*|\\$|\\?|:|\"|-[0adFiIlpv])", + "name": "variable.other.readwrite.global.pre-defined.ruby" + }, + { + "begin": "\\b(ENV)\\[", + "beginCaptures": { + "1": { + "name": "variable.other.constant.ruby" + } + }, + "end": "]", + "name": "meta.environment-variable.ruby", + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "match": "\\b[A-Z]\\w*(?=((\\.|::)[A-Za-z]|\\[))", + "name": "support.class.ruby" + }, + { + "match": "\\b((abort|at_exit|autoload|binding|callcc|caller|caller_locations|chomp|chop|eval|exec|exit|fork|format|gets|global_variables|gsub|lambda|load|local_variables|open|p|print|printf|proc|putc|puts|rand|readline|readlines|select|set_trace_func|sleep|spawn|sprintf|srand|sub|syscall|system|test|trace_var|trap|untrace_var|warn)\\b(?![?!])|autoload\\?|exit!)", + "name": "support.function.kernel.ruby" + }, + { + "match": "\\b[_A-Z]\\w*\\b", + "name": "variable.other.constant.ruby" + }, + { + "begin": "(->)\\(", + "beginCaptures": { + "1": { + "name": "support.function.kernel.ruby" + } + }, + "comment": "Lambda parameters.", + "end": "\\)", + "patterns": [ + { + "begin": "(?=[&*_a-zA-Z])", + "end": "(?=[,)])", + "patterns": [ + { + "include": "#method_parameters" + } + ] + }, + { + "include": "#method_parameters" + } + ] + }, + { + "begin": "(?x)\n(?=def\\b) # optimization to help Oniguruma fail fast\n(?<=^|\\s)(def)\\s+\n(\n (?>[a-zA-Z_]\\w*(?>\\.|::))? # method prefix\n (?> # method name\n [a-zA-Z_]\\w*(?>[?!]|=(?!>))?\n |\n ===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[]=?\n )\n)\n\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.control.def.ruby" + }, + "2": { + "name": "entity.name.function.ruby" + }, + "3": { + "name": "punctuation.definition.parameters.ruby" + } + }, + "comment": "The method pattern comes from the symbol pattern. See there for an explanation.", + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.ruby" + } + }, + "name": "meta.function.method.with-arguments.ruby", + "patterns": [ + { + "begin": "(?=[&*_a-zA-Z])", + "end": "(?=[,)])", + "patterns": [ + { + "include": "#method_parameters" + } + ] + }, + { + "include": "#method_parameters" + } + ] + }, + { + "begin": "(?x)\n(?=def\\b) # optimization to help Oniguruma fail fast\n(?<=^|\\s)(def)\\s+\n(\n (?>[a-zA-Z_]\\w*(?>\\.|::))? # method prefix\n (?> # method name\n [a-zA-Z_]\\w*(?>[?!]|=(?!>))?\n |\n ===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[]=?\n )\n)\n[ \\t]\n(?=[ \\t]*[^\\s#;]) # make sure the following is not comment", + "beginCaptures": { + "1": { + "name": "keyword.control.def.ruby" + }, + "2": { + "name": "entity.name.function.ruby" + } + }, + "comment": "same as the previous rule, but without parentheses around the arguments", + "end": "(?=;)|(?<=[\\w\\])}`'\"!?])(?=\\s*#|\\s*$)", + "name": "meta.function.method.with-arguments.ruby", + "patterns": [ + { + "begin": "(?=[&*_a-zA-Z])", + "end": "(?=,|;|\\s*#|\\s*$)", + "patterns": [ + { + "include": "#method_parameters" + } + ] + }, + { + "include": "#method_parameters" + } + ] + }, + { + "captures": { + "1": { + "name": "keyword.control.def.ruby" + }, + "3": { + "name": "entity.name.function.ruby" + } + }, + "comment": " the optional name is just to catch the def also without a method-name", + "match": "(?x)\n(?=def\\b) # optimization to help Oniguruma fail fast\n(?<=^|\\s)(def)\\b\n(\n \\s+\n (\n (?>[a-zA-Z_]\\w*(?>\\.|::))? # method prefix\n (?> # method name\n [a-zA-Z_]\\w*(?>[?!]|=(?!>))?\n |\n ===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[]=?\n )\n )\n)?", + "name": "meta.function.method.without-arguments.ruby" + }, + { + "match": "(?x)\n\\b\n(\n [\\d](?>_?\\d)* # 100_000\n (\\.(?![^[:space:][:digit:]])(?>_?\\d)*)? # fractional part\n ([eE][-+]?\\d(?>_?\\d)*)? # 1.23e-4\n |\n 0\n (?:\n [xX]\\h(?>_?\\h)*|\n [oO]?[0-7](?>_?[0-7])*|\n [bB][01](?>_?[01])*|\n [dD]\\d(?>_?\\d)*\n ) # A base indicator can only be used with an integer\n)\\b", + "name": "constant.numeric.ruby" + }, + { + "begin": ":'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.symbol.begin.ruby" + } + }, + "comment": "symbol literal with '' delimiter", + "end": "'", + "endCaptures": { + "0": { + "name": "punctuation.definition.symbol.end.ruby" + } + }, + "name": "constant.language.symbol.ruby", + "patterns": [ + { + "match": "\\\\['\\\\]", + "name": "constant.character.escape.ruby" + } + ] + }, + { + "begin": ":\"", + "beginCaptures": { + "0": { + "name": "punctuation.section.symbol.begin.ruby" + } + }, + "comment": "symbol literal with \"\" delimiter", + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.section.symbol.end.ruby" + } + }, + "name": "constant.language.symbol.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + } + ] + }, + { + "comment": "Needs higher precedence than regular expressions.", + "match": "(?|=>|==|=~|!~|!=|;|$|\n if|else|elsif|then|do|end|unless|while|until|or|and\n )\n)", + "captures": { + "1": { + "name": "string.regexp.interpolated.ruby" + }, + "2": { + "name": "punctuation.section.regexp.ruby" + } + }, + "comment": "regular expression literal with interpolation", + "contentName": "string.regexp.interpolated.ruby", + "end": "((/[eimnosux]*))", + "patterns": [ + { + "include": "#regex_sub" + } + ] + }, + { + "begin": "%r{", + "beginCaptures": { + "0": { + "name": "punctuation.section.regexp.begin.ruby" + } + }, + "end": "}[eimnosux]*", + "endCaptures": { + "0": { + "name": "punctuation.section.regexp.end.ruby" + } + }, + "name": "string.regexp.interpolated.ruby", + "patterns": [ + { + "include": "#regex_sub" + }, + { + "include": "#nest_curly_r" + } + ] + }, + { + "begin": "%r\\[", + "beginCaptures": { + "0": { + "name": "punctuation.section.regexp.begin.ruby" + } + }, + "end": "][eimnosux]*", + "endCaptures": { + "0": { + "name": "punctuation.section.regexp.end.ruby" + } + }, + "name": "string.regexp.interpolated.ruby", + "patterns": [ + { + "include": "#regex_sub" + }, + { + "include": "#nest_brackets_r" + } + ] + }, + { + "begin": "%r\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.regexp.begin.ruby" + } + }, + "end": "\\)[eimnosux]*", + "endCaptures": { + "0": { + "name": "punctuation.section.regexp.end.ruby" + } + }, + "name": "string.regexp.interpolated.ruby", + "patterns": [ + { + "include": "#regex_sub" + }, + { + "include": "#nest_parens_r" + } + ] + }, + { + "begin": "%r<", + "beginCaptures": { + "0": { + "name": "punctuation.section.regexp.begin.ruby" + } + }, + "end": ">[eimnosux]*", + "endCaptures": { + "0": { + "name": "punctuation.section.regexp.end.ruby" + } + }, + "name": "string.regexp.interpolated.ruby", + "patterns": [ + { + "include": "#regex_sub" + }, + { + "include": "#nest_ltgt_r" + } + ] + }, + { + "begin": "%r([^\\w])", + "beginCaptures": { + "0": { + "name": "punctuation.section.regexp.begin.ruby" + } + }, + "end": "\\1[eimnosux]*", + "endCaptures": { + "0": { + "name": "punctuation.section.regexp.end.ruby" + } + }, + "name": "string.regexp.interpolated.ruby", + "patterns": [ + { + "include": "#regex_sub" + } + ] + }, + { + "begin": "%I\\[", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "]", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "constant.language.symbol.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_brackets_i" + } + ] + }, + { + "begin": "%I\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "constant.language.symbol.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_parens_i" + } + ] + }, + { + "begin": "%I<", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": ">", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "constant.language.symbol.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_ltgt_i" + } + ] + }, + { + "begin": "%I{", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "constant.language.symbol.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_curly_i" + } + ] + }, + { + "begin": "%I([^\\w])", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "\\1", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "constant.language.symbol.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + } + ] + }, + { + "begin": "%i\\[", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "]", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "constant.language.symbol.ruby", + "patterns": [ + { + "match": "\\\\]|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_brackets" + } + ] + }, + { + "begin": "%i\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "constant.language.symbol.ruby", + "patterns": [ + { + "match": "\\\\\\)|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_parens" + } + ] + }, + { + "begin": "%i<", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": ">", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "constant.language.symbol.ruby", + "patterns": [ + { + "match": "\\\\>|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_ltgt" + } + ] + }, + { + "begin": "%i{", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "constant.language.symbol.ruby", + "patterns": [ + { + "match": "\\\\}|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_curly" + } + ] + }, + { + "begin": "%i([^\\w])", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "\\1", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "constant.language.symbol.ruby", + "patterns": [ + { + "comment": "Cant be named because its not necessarily an escape.", + "match": "\\\\." + } + ] + }, + { + "begin": "%W\\[", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "]", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "string.quoted.other.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_brackets_i" + } + ] + }, + { + "begin": "%W\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "string.quoted.other.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_parens_i" + } + ] + }, + { + "begin": "%W<", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": ">", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "string.quoted.other.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_ltgt_i" + } + ] + }, + { + "begin": "%W{", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "string.quoted.other.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_curly_i" + } + ] + }, + { + "begin": "%W([^\\w])", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "\\1", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "string.quoted.other.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + } + ] + }, + { + "begin": "%w\\[", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "]", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "string.quoted.other.ruby", + "patterns": [ + { + "match": "\\\\]|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_brackets" + } + ] + }, + { + "begin": "%w\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "string.quoted.other.ruby", + "patterns": [ + { + "match": "\\\\\\)|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_parens" + } + ] + }, + { + "begin": "%w<", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": ">", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "string.quoted.other.ruby", + "patterns": [ + { + "match": "\\\\>|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_ltgt" + } + ] + }, + { + "begin": "%w{", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "string.quoted.other.ruby", + "patterns": [ + { + "match": "\\\\}|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_curly" + } + ] + }, + { + "begin": "%w([^\\w])", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "\\1", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "name": "string.quoted.other.ruby", + "patterns": [ + { + "comment": "Cant be named because its not necessarily an escape.", + "match": "\\\\." + } + ] + }, + { + "begin": "%[Qx]?\\(", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.ruby" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.ruby" + } + }, + "name": "string.quoted.other.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_parens_i" + } + ] + }, + { + "begin": "%[Qx]?\\[", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.ruby" + } + }, + "end": "]", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.ruby" + } + }, + "name": "string.quoted.other.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_brackets_i" + } + ] + }, + { + "begin": "%[Qx]?{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.ruby" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.ruby" + } + }, + "name": "string.quoted.other.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_curly_i" + } + ] + }, + { + "begin": "%[Qx]?<", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.ruby" + } + }, + "end": ">", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.ruby" + } + }, + "name": "string.quoted.other.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_ltgt_i" + } + ] + }, + { + "begin": "%[Qx]([^\\w])", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.ruby" + } + }, + "end": "\\1", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.ruby" + } + }, + "name": "string.quoted.other.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + } + ] + }, + { + "begin": "%([^\\w\\s=])", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.ruby" + } + }, + "end": "\\1", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.ruby" + } + }, + "name": "string.quoted.other.interpolated.ruby", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + } + ] + }, + { + "begin": "%q\\(", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.ruby" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.ruby" + } + }, + "name": "string.quoted.other.ruby", + "patterns": [ + { + "match": "\\\\\\)|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_parens" + } + ] + }, + { + "begin": "%q<", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.ruby" + } + }, + "end": ">", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.ruby" + } + }, + "name": "string.quoted.other.ruby", + "patterns": [ + { + "match": "\\\\>|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_ltgt" + } + ] + }, + { + "begin": "%q\\[", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.ruby" + } + }, + "end": "]", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.ruby" + } + }, + "name": "string.quoted.other.ruby", + "patterns": [ + { + "match": "\\\\]|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_brackets" + } + ] + }, + { + "begin": "%q{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.ruby" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.ruby" + } + }, + "name": "string.quoted.other.ruby", + "patterns": [ + { + "match": "\\\\}|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_curly" + } + ] + }, + { + "begin": "%q([^\\w])", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.ruby" + } + }, + "end": "\\1", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.ruby" + } + }, + "name": "string.quoted.other.ruby", + "patterns": [ + { + "comment": "Cant be named because its not necessarily an escape.", + "match": "\\\\." + } + ] + }, + { + "begin": "%s\\(", + "beginCaptures": { + "0": { + "name": "punctuation.definition.symbol.begin.ruby" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.symbol.end.ruby" + } + }, + "name": "constant.language.symbol.ruby", + "patterns": [ + { + "match": "\\\\\\)|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_parens" + } + ] + }, + { + "begin": "%s<", + "beginCaptures": { + "0": { + "name": "punctuation.definition.symbol.begin.ruby" + } + }, + "end": ">", + "endCaptures": { + "0": { + "name": "punctuation.definition.symbol.end.ruby" + } + }, + "name": "constant.language.symbol.ruby", + "patterns": [ + { + "match": "\\\\>|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_ltgt" + } + ] + }, + { + "begin": "%s\\[", + "beginCaptures": { + "0": { + "name": "punctuation.definition.symbol.begin.ruby" + } + }, + "end": "]", + "endCaptures": { + "0": { + "name": "punctuation.definition.symbol.end.ruby" + } + }, + "name": "constant.language.symbol.ruby", + "patterns": [ + { + "match": "\\\\]|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_brackets" + } + ] + }, + { + "begin": "%s{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.symbol.begin.ruby" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.definition.symbol.end.ruby" + } + }, + "name": "constant.language.symbol.ruby", + "patterns": [ + { + "match": "\\\\}|\\\\\\\\", + "name": "constant.character.escape.ruby" + }, + { + "include": "#nest_curly" + } + ] + }, + { + "begin": "%s([^\\w])", + "beginCaptures": { + "0": { + "name": "punctuation.definition.symbol.begin.ruby" + } + }, + "end": "\\1", + "endCaptures": { + "0": { + "name": "punctuation.definition.symbol.end.ruby" + } + }, + "name": "constant.language.symbol.ruby", + "patterns": [ + { + "comment": "Cant be named because its not necessarily an escape.", + "match": "\\\\." + } + ] + }, + { + "captures": { + "1": { + "name": "punctuation.definition.constant.ruby" + } + }, + "comment": "symbols", + "match": "(?x)\n(?\n [$a-zA-Z_]\\w*(?>[?!]|=(?![>=]))?\n |\n ===?|<=>|>[>=]?|<[<=]?|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[]=?\n |\n @@?[a-zA-Z_]\\w*\n)", + "name": "constant.language.symbol.ruby" + }, + { + "begin": "^=begin", + "captures": { + "0": { + "name": "punctuation.definition.comment.ruby" + } + }, + "comment": "multiline comments", + "end": "^=end", + "name": "comment.block.documentation.ruby" + }, + { + "include": "#yard" + }, + { + "begin": "(^[ \\t]+)?(?=#)", + "beginCaptures": { + "1": { + "name": "punctuation.whitespace.comment.leading.ruby" + } + }, + "end": "(?!\\G)", + "patterns": [ + { + "begin": "#", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.ruby" + } + }, + "end": "\\n", + "name": "comment.line.number-sign.ruby" + } + ] + }, + { + "comment": "\n\t\t\tmatches questionmark-letters.\n\n\t\t\texamples (1st alternation = hex):\n\t\t\t?\\x1 ?\\x61\n\n\t\t\texamples (2nd alternation = octal):\n\t\t\t?\\0 ?\\07 ?\\017\n\n\t\t\texamples (3rd alternation = escaped):\n\t\t\t?\\n ?\\b\n\n\t\t\texamples (4th alternation = meta-ctrl):\n\t\t\t?\\C-a ?\\M-a ?\\C-\\M-\\C-\\M-a\n\n\t\t\texamples (4th alternation = normal):\n\t\t\t?a ?A ?0 \n\t\t\t?* ?\" ?( \n\t\t\t?. ?#\n\t\t\t\n\t\t\t\n\t\t\tthe negative lookbehind prevents against matching\n\t\t\tp(42.tainted?)\n\t\t\t", + "match": "(?<<[-~]?([\"'`]?)((?:[_\\w]+_|)HTML)\\b\\1))", + "comment": "Heredoc with embedded HTML", + "end": "^\\s*((?:[_\\w]+_|)HTML)$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.html", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)HTML)\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "text.html", + "while": "^(?!\\s*((?:[_\\w]+_|)HTML)\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "text.html.basic" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?=(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)HAML)\\b\\1))", + "comment": "Heredoc with embedded HAML", + "end": "^\\s*((?:[_\\w]+_|)HAML)$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.haml", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)HAML)\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "text.haml", + "while": "^(?!\\s*((?:[_\\w]+_|)HAML)\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "text.haml" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?=(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)XML)\\b\\1))", + "comment": "Heredoc with embedded XML", + "end": "^\\s*((?:[_\\w]+_|)XML)$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.xml", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)XML)\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "text.xml", + "while": "^(?!\\s*((?:[_\\w]+_|)XML)\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "text.xml" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?=(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)SQL)\\b\\1))", + "comment": "Heredoc with embedded SQL", + "end": "^\\s*((?:[_\\w]+_|)SQL)$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.sql", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)SQL)\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "source.sql", + "while": "^(?!\\s*((?:[_\\w]+_|)SQL)\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "source.sql" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?=(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)(?:GRAPHQL|GQL))\\b\\1))", + "comment": "Heredoc with embedded GraphQL", + "end": "^\\s*((?:[_\\w]+_|)(?:GRAPHQL|GQL))$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.graphql", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)(?:GRAPHQL|GQL))\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "source.graphql", + "while": "^(?!\\s*((?:[_\\w]+_|)(?:GRAPHQL|GQL))\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "source.graphql" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?=(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)CSS)\\b\\1))", + "comment": "Heredoc with embedded CSS", + "end": "^\\s*((?:[_\\w]+_|)CSS)$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.css", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)CSS)\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "source.css", + "while": "^(?!\\s*((?:[_\\w]+_|)CSS)\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "source.css" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?=(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)CPP)\\b\\1))", + "comment": "Heredoc with embedded C++", + "end": "^\\s*((?:[_\\w]+_|)CPP)$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.cpp", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)CPP)\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "source.cpp", + "while": "^(?!\\s*((?:[_\\w]+_|)CPP)\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "source.cpp" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?=(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)C)\\b\\1))", + "comment": "Heredoc with embedded C", + "end": "^\\s*((?:[_\\w]+_|)C)$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.c", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)C)\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "source.c", + "while": "^(?!\\s*((?:[_\\w]+_|)C)\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "source.c" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?=(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)(?:JS|JAVASCRIPT))\\b\\1))", + "comment": "Heredoc with embedded Javascript", + "end": "^\\s*((?:[_\\w]+_|)(?:JS|JAVASCRIPT))$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.js", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)(?:JS|JAVASCRIPT))\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "source.js", + "while": "^(?!\\s*((?:[_\\w]+_|)(?:JS|JAVASCRIPT))\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "source.js" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?=(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)JQUERY)\\b\\1))", + "comment": "Heredoc with embedded jQuery Javascript", + "end": "^\\s*((?:[_\\w]+_|)JQUERY)$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.js.jquery", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)JQUERY)\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "source.js.jquery", + "while": "^(?!\\s*((?:[_\\w]+_|)JQUERY)\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "source.js.jquery" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?=(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)(?:SH|SHELL))\\b\\1))", + "comment": "Heredoc with embedded Shell", + "end": "^\\s*((?:[_\\w]+_|)(?:SH|SHELL))$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.shell", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)(?:SH|SHELL))\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "source.shell", + "while": "^(?!\\s*((?:[_\\w]+_|)(?:SH|SHELL))\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "source.shell" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?=(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)LUA)\\b\\1))", + "comment": "Heredoc with embedded Lua", + "end": "^\\s*((?:[_\\w]+_|)LUA)$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.lua", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)LUA)\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "source.lua", + "while": "^(?!\\s*((?:[_\\w]+_|)LUA)\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "source.lua" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?=(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)RUBY)\\b\\1))", + "comment": "Heredoc with embedded Ruby", + "end": "^\\s*((?:[_\\w]+_|)RUBY)$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.ruby", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)RUBY)\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "source.ruby", + "while": "^(?!\\s*((?:[_\\w]+_|)RUBY)\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "source.ruby" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?=(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)(?:YAML|YML))\\b\\1))", + "comment": "Heredoc with embedded YAML", + "end": "^\\s*((?:[_\\w]+_|)(?:YAML|YML))$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.yaml", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)(?:YAML|YML))\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "source.yaml", + "while": "^(?!\\s*((?:[_\\w]+_|)(?:YAML|YML))\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "source.yaml" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?=(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)SLIM)\\b\\1))", + "comment": "Heredoc with embedded Slim", + "end": "^\\s*((?:[_\\w]+_|)SLIM)$\\n?", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "name": "meta.embedded.block.slim", + "patterns": [ + { + "begin": "(?><<[-~]?([\"'`]?)((?:[_\\w]+_|)SLIM)\\b\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "contentName": "text.slim", + "while": "^(?!\\s*((?:[_\\w]+_|)SLIM)\\s*$)", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "text.slim" + }, + { + "include": "#escaped_char" + } + ] + } + ] + }, + { + "begin": "(?>=\\s*<<([\"'`]?)([A-Za-z_]\\w*)\\1)", + "beginCaptures": { + "0": { + "name": "string.definition.begin.ruby" + } + }, + "end": "^\\2$", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "contentName": "string.unquoted.heredoc.ruby", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + } + ] + }, + { + "begin": "(?>((<<[-~]?([\"'`]?)([A-Za-z_]\\w*)\\3,\\s?)*<<[-~]?([\"'`]?)([A-Za-z_]\\w*)\\5))(.*)", + "beginCaptures": { + "1": { + "name": "string.definition.begin.ruby" + }, + "7": { + "patterns": [ + { + "include": "source.ruby" + } + ] + } + }, + "comment": "heredoc with multiple inputs and indented terminator", + "end": "^\\s*\\6$", + "endCaptures": { + "0": { + "name": "string.definition.end.ruby" + } + }, + "contentName": "string.unquoted.heredoc.ruby", + "patterns": [ + { + "include": "#heredoc" + }, + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + } + ] + }, + { + "begin": "(?<={|{\\s+|[^A-Za-z0-9_:@$]do|^do|[^A-Za-z0-9_:@$]do\\s+|^do\\s+)(\\|)", + "name": "meta.block.parameters.ruby", + "captures": { + "1": { + "name": "punctuation.separator.variable.ruby" + } + }, + "end": "(?", + "name": "punctuation.separator.key-value" + }, + { + "match": "->", + "name": "support.function.kernel.ruby" + }, + { + "match": "<<=|%=|&{1,2}=|\\*=|\\*\\*=|\\+=|-=|\\^=|\\|{1,2}=|<<", + "name": "keyword.operator.assignment.augmented.ruby" + }, + { + "match": "<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?<=[ \\t])\\?", + "name": "keyword.operator.comparison.ruby" + }, + { + "match": "(?>", + "name": "keyword.operator.other.ruby" + }, + { + "match": ";", + "name": "punctuation.separator.statement.ruby" + }, + { + "match": ",", + "name": "punctuation.separator.object.ruby" + }, + { + "comment": "Mark as namespace separator if double colons followed by capital letter", + "match": "(::)\\s*(?=[A-Z])", + "captures": { + "1": { + "name": "punctuation.separator.namespace.ruby" + } + } + }, + { + "comment": "Mark as method separator if double colons not followed by capital letter", + "match": "(\\.|::)\\s*(?![A-Z])", + "captures": { + "1": { + "name": "punctuation.separator.method.ruby" + } + } + }, + { + "comment": "Must come after method and constant separators to prefer double colons", + "match": ":", + "name": "punctuation.separator.other.ruby" + }, + { + "match": "{", + "name": "punctuation.section.scope.begin.ruby" + }, + { + "match": "}", + "name": "punctuation.section.scope.end.ruby" + }, + { + "match": "\\[", + "name": "punctuation.section.array.begin.ruby" + }, + { + "match": "]", + "name": "punctuation.section.array.end.ruby" + }, + { + "match": "\\(|\\)", + "name": "punctuation.section.function.ruby" + }, + { + "name": "meta.function-call.ruby", + "begin": "(?<=[^\\.]\\.|::)(?=[a-zA-Z][a-zA-Z0-9_!?]*[^a-zA-Z0-9_!?])", + "end": "(?<=[a-zA-Z0-9_!?])(?=[^a-zA-Z0-9_!?])", + "patterns": [ + { + "name": "entity.name.function.ruby", + "match": "([a-zA-Z][a-zA-Z0-9_!?]*)(?=[^a-zA-Z0-9_!?])" + } + ] + }, + { + "begin": "([a-zA-Z]\\w*[!?]?)(\\()", + "beginCaptures": { + "1": { + "name": "entity.name.function.ruby" + }, + "2": { + "name": "punctuation.section.function.ruby" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.section.function.ruby" + } + }, + "name": "meta.function-call.ruby", + "patterns": [ + { + "include": "$self" + } + ] + } + ], + "repository": { + "method_parameters": { + "patterns": [ + { + "include": "#parens" + }, + { + "include": "#braces" + }, + { + "include": "#brackets" + }, + { + "include": "#params" + }, + { + "include": "$self" + } + ], + "repository": { + "params": { + "captures": { + "1": { + "name": "storage.type.variable.ruby" + }, + "2": { + "name": "constant.other.symbol.hashkey.parameter.function.ruby" + }, + "3": { + "name": "punctuation.definition.constant.ruby" + }, + "4": { + "name": "variable.parameter.function.ruby" + } + }, + "match": "\\G(&|\\*\\*?)?(?:([_a-zA-Z]\\w*[?!]?(:))|([_a-zA-Z]\\w*))" + }, + "braces": { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.section.scope.begin.ruby" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.section.scope.end.ruby" + } + }, + "patterns": [ + { + "include": "#parens" + }, + { + "include": "#braces" + }, + { + "include": "#brackets" + }, + { + "include": "$self" + } + ] + }, + "brackets": { + "begin": "\\[", + "beginCaptures": { + "0": { + "name": "punctuation.section.array.begin.ruby" + } + }, + "end": "\\]", + "endCaptures": { + "0": { + "name": "punctuation.section.array.end.ruby" + } + }, + "patterns": [ + { + "include": "#parens" + }, + { + "include": "#braces" + }, + { + "include": "#brackets" + }, + { + "include": "$self" + } + ] + }, + "parens": { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.function.begin.ruby" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.function.end.ruby" + } + }, + "patterns": [ + { + "include": "#parens" + }, + { + "include": "#braces" + }, + { + "include": "#brackets" + }, + { + "include": "$self" + } + ] + } + } + }, + "escaped_char": { + "match": "\\\\(?:[0-7]{1,3}|x[\\da-fA-F]{1,2}|.)", + "name": "constant.character.escape.ruby" + }, + "heredoc": { + "begin": "^<<[-~]?[A-Za-z_]\\w*", + "end": "$", + "patterns": [ + { + "include": "$self" + } + ] + }, + "interpolated_ruby": { + "patterns": [ + { + "begin": "#{", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.ruby" + } + }, + "contentName": "source.ruby", + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.ruby" + } + }, + "name": "meta.embedded.line.ruby", + "patterns": [ + { + "include": "#nest_curly_and_self" + }, + { + "include": "$self" + } + ] + }, + { + "captures": { + "1": { + "name": "punctuation.definition.variable.ruby" + } + }, + "match": "(#@)[a-zA-Z_]\\w*", + "name": "variable.other.readwrite.instance.ruby" + }, + { + "captures": { + "1": { + "name": "punctuation.definition.variable.ruby" + } + }, + "match": "(#@@)[a-zA-Z_]\\w*", + "name": "variable.other.readwrite.class.ruby" + }, + { + "captures": { + "1": { + "name": "punctuation.definition.variable.ruby" + } + }, + "match": "(#\\$)[a-zA-Z_]\\w*", + "name": "variable.other.readwrite.global.ruby" + } + ] + }, + "nest_brackets": { + "begin": "\\[", + "captures": { + "0": { + "name": "punctuation.section.scope.ruby" + } + }, + "end": "]", + "patterns": [ + { + "include": "#nest_brackets" + } + ] + }, + "nest_brackets_i": { + "begin": "\\[", + "captures": { + "0": { + "name": "punctuation.section.scope.ruby" + } + }, + "end": "]", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_brackets_i" + } + ] + }, + "nest_brackets_r": { + "begin": "\\[", + "captures": { + "0": { + "name": "punctuation.section.scope.ruby" + } + }, + "end": "]", + "patterns": [ + { + "include": "#regex_sub" + }, + { + "include": "#nest_brackets_r" + } + ] + }, + "nest_curly": { + "begin": "{", + "captures": { + "0": { + "name": "punctuation.section.scope.ruby" + } + }, + "end": "}", + "patterns": [ + { + "include": "#nest_curly" + } + ] + }, + "nest_curly_and_self": { + "patterns": [ + { + "begin": "{", + "captures": { + "0": { + "name": "punctuation.section.scope.ruby" + } + }, + "end": "}", + "patterns": [ + { + "include": "#nest_curly_and_self" + } + ] + }, + { + "include": "$self" + } + ] + }, + "nest_curly_i": { + "begin": "{", + "captures": { + "0": { + "name": "punctuation.section.scope.ruby" + } + }, + "end": "}", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_curly_i" + } + ] + }, + "nest_curly_r": { + "begin": "{", + "captures": { + "0": { + "name": "punctuation.section.scope.ruby" + } + }, + "end": "}", + "patterns": [ + { + "include": "#regex_sub" + }, + { + "include": "#nest_curly_r" + } + ] + }, + "nest_ltgt": { + "begin": "<", + "captures": { + "0": { + "name": "punctuation.section.scope.ruby" + } + }, + "end": ">", + "patterns": [ + { + "include": "#nest_ltgt" + } + ] + }, + "nest_ltgt_i": { + "begin": "<", + "captures": { + "0": { + "name": "punctuation.section.scope.ruby" + } + }, + "end": ">", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_ltgt_i" + } + ] + }, + "nest_ltgt_r": { + "begin": "<", + "captures": { + "0": { + "name": "punctuation.section.scope.ruby" + } + }, + "end": ">", + "patterns": [ + { + "include": "#regex_sub" + }, + { + "include": "#nest_ltgt_r" + } + ] + }, + "nest_parens": { + "begin": "\\(", + "captures": { + "0": { + "name": "punctuation.section.scope.ruby" + } + }, + "end": "\\)", + "patterns": [ + { + "include": "#nest_parens" + } + ] + }, + "nest_parens_i": { + "begin": "\\(", + "captures": { + "0": { + "name": "punctuation.section.scope.ruby" + } + }, + "end": "\\)", + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "include": "#nest_parens_i" + } + ] + }, + "nest_parens_r": { + "begin": "\\(", + "captures": { + "0": { + "name": "punctuation.section.scope.ruby" + } + }, + "end": "\\)", + "patterns": [ + { + "include": "#regex_sub" + }, + { + "include": "#nest_parens_r" + } + ] + }, + "regex_sub": { + "patterns": [ + { + "include": "#interpolated_ruby" + }, + { + "include": "#escaped_char" + }, + { + "captures": { + "1": { + "name": "punctuation.definition.arbitrary-repetition.ruby" + }, + "3": { + "name": "punctuation.definition.arbitrary-repetition.ruby" + } + }, + "match": "({)\\d+(,\\d+)?(})", + "name": "string.regexp.arbitrary-repetition.ruby" + }, + { + "begin": "\\[(?:\\^?])?", + "captures": { + "0": { + "name": "punctuation.definition.character-class.ruby" + } + }, + "end": "]", + "name": "string.regexp.character-class.ruby", + "patterns": [ + { + "include": "#escaped_char" + } + ] + }, + { + "begin": "\\(\\?#", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.begin.ruby" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.end.ruby" + } + }, + "name": "comment.line.number-sign.ruby", + "patterns": [ + { + "include": "#escaped_char" + } + ] + }, + { + "begin": "\\(", + "captures": { + "0": { + "name": "punctuation.definition.group.ruby" + } + }, + "end": "\\)", + "name": "string.regexp.group.ruby", + "patterns": [ + { + "include": "#regex_sub" + } + ] + }, + { + "begin": "(?<=^|\\s)(#)\\s(?=[[a-zA-Z0-9,. \\t?!-][^\\x{00}-\\x{7F}]]*$)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.ruby" + } + }, + "comment": "We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags.", + "end": "$\\n?", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.ruby" + } + }, + "name": "comment.line.number-sign.ruby" + } + ] + }, + "yard": { + "patterns": [ + { + "include": "#yard_comment" + }, + { + "include": "#yard_param_types" + }, + { + "include": "#yard_option" + }, + { + "include": "#yard_tag" + }, + { + "include": "#yard_types" + }, + { + "include": "#yard_directive" + }, + { + "include": "#yard_see" + }, + { + "include": "#yard_macro_attribute" + } + ] + }, + "yard_see": { + "comment": "separate rule for @see because name could contain url", + "begin": "^(\\s*)(#)(\\s*)(@)(see)(?=\\s)(\\s+(.+?))?(?=\\s|$)", + "beginCaptures": { + "2": { + "name": "punctuation.definition.comment.ruby" + }, + "4": { + "name": "comment.line.keyword.punctuation.yard.ruby" + }, + "5": { + "name": "comment.line.keyword.yard.ruby" + }, + "7": { + "name": "comment.line.parameter.yard.ruby" + } + }, + "end": "^(?!\\s*#\\3\\s{2,}|\\s*#\\s*$)", + "contentName": "comment.line.string.yard.ruby", + "name": "comment.line.number-sign.ruby", + "patterns": [ + { + "include": "#yard" + }, + { + "include": "#yard_continuation" + } + ] + }, + "yard_macro_attribute": { + "comment": "separate rule for attribute and macro tags because name goes after []", + "begin": "^(\\s*)(#)(\\s*)(@!)(attribute|macro)(\\s+((\\[).+(])))?(?=\\s)(\\s+([a-z_]\\w*:?))?", + "beginCaptures": { + "2": { + "name": "punctuation.definition.comment.ruby" + }, + "4": { + "name": "comment.line.keyword.punctuation.yard.ruby" + }, + "5": { + "name": "comment.line.keyword.yard.ruby" + }, + "7": { + "name": "comment.line.type.yard.ruby" + }, + "8": { + "name": "comment.line.punctuation.yard.ruby" + }, + "9": { + "name": "comment.line.punctuation.yard.ruby" + }, + "11": { + "name": "comment.line.parameter.yard.ruby" + } + }, + "end": "^(?!\\s*#\\3\\s{2,}|\\s*#\\s*$)", + "contentName": "comment.line.string.yard.ruby", + "name": "comment.line.number-sign.ruby", + "patterns": [ + { + "include": "#yard" + }, + { + "include": "#yard_continuation" + } + ] + }, + "yard_comment": { + "comment": "For YARD tags that follow the tag-comment pattern", + "begin": "^(\\s*)(#)(\\s*)(@)(abstract|api|author|deprecated|example|macro|note|overload|since|todo|version)(?=\\s|$)", + "beginCaptures": { + "2": { + "name": "punctuation.definition.comment.ruby" + }, + "4": { + "name": "comment.line.keyword.punctuation.yard.ruby" + }, + "5": { + "name": "comment.line.keyword.yard.ruby" + } + }, + "end": "^(?!\\s*#\\3\\s{2,}|\\s*#\\s*$)", + "contentName": "comment.line.string.yard.ruby", + "name": "comment.line.number-sign.ruby", + "patterns": [ + { + "include": "#yard" + }, + { + "include": "#yard_continuation" + } + ] + }, + "yard_param_types": { + "comment": "For YARD tags that follow the tag-name-types-description or tag-types-name-description pattern", + "begin": "^(\\s*)(#)(\\s*)(@)(attr|attr_reader|attr_writer|yieldparam|param)(?=\\s)(?>\\s+(?>([a-z_]\\w*:?)|((\\[).+(]))))?(?>\\s+(?>((\\[).+(]))|([a-z_]\\w*:?)))?", + "beginCaptures": { + "2": { + "name": "punctuation.definition.comment.ruby" + }, + "4": { + "name": "comment.line.keyword.punctuation.yard.ruby" + }, + "5": { + "name": "comment.line.keyword.yard.ruby" + }, + "6": { + "name": "comment.line.parameter.yard.ruby" + }, + "7": { + "name": "comment.line.type.yard.ruby" + }, + "8": { + "name": "comment.line.punctuation.yard.ruby" + }, + "9": { + "name": "comment.line.punctuation.yard.ruby" + }, + "10": { + "name": "comment.line.type.yard.ruby" + }, + "11": { + "name": "comment.line.punctuation.yard.ruby" + }, + "12": { + "name": "comment.line.punctuation.yard.ruby" + }, + "13": { + "name": "comment.line.parameter.yard.ruby" + } + }, + "end": "^(?!\\s*#\\3\\s{2,}|\\s*#\\s*$)", + "contentName": "comment.line.string.yard.ruby", + "name": "comment.line.number-sign.ruby", + "patterns": [ + { + "include": "#yard" + }, + { + "include": "#yard_continuation" + } + ] + }, + "yard_option": { + "comment": "For YARD option tag that follow the tag-name-types-key-(value)-description pattern", + "begin": "^(\\s*)(#)(\\s*)(@)(option)(?=\\s)(?>\\s+([a-z_]\\w*:?))?(?>\\s+((\\[).+(])))?(?>\\s+((\\S*)))?(?>\\s+((\\().+(\\))))?", + "beginCaptures": { + "2": { + "name": "punctuation.definition.comment.ruby" + }, + "4": { + "name": "comment.line.keyword.punctuation.yard.ruby" + }, + "5": { + "name": "comment.line.keyword.yard.ruby" + }, + "6": { + "name": "comment.line.parameter.yard.ruby" + }, + "7": { + "name": "comment.line.type.yard.ruby" + }, + "8": { + "name": "comment.line.punctuation.yard.ruby" + }, + "9": { + "name": "comment.line.punctuation.yard.ruby" + }, + "10": { + "name": "comment.line.keyword.yard.ruby" + }, + "11": { + "name": "comment.line.hashkey.yard.ruby" + }, + "12": { + "name": "comment.line.defaultvalue.yard.ruby" + }, + "13": { + "name": "comment.line.punctuation.yard.ruby" + }, + "14": { + "name": "comment.line.punctuation.yard.ruby" + } + }, + "end": "^(?!\\s*#\\3\\s{2,}|\\s*#\\s*$)", + "contentName": "comment.line.string.yard.ruby", + "name": "comment.line.number-sign.ruby", + "patterns": [ + { + "include": "#yard" + }, + { + "include": "#yard_continuation" + } + ] + }, + "yard_tag": { + "comment": "For YARD tags that are just the tag", + "match": "^(\\s*)(#)(\\s*)(@)(private)$", + "captures": { + "2": { + "name": "punctuation.definition.comment.ruby" + }, + "4": { + "name": "comment.line.keyword.punctuation.yard.ruby" + }, + "5": { + "name": "comment.line.keyword.yard.ruby" + } + }, + "name": "comment.line.number-sign.ruby" + }, + "yard_types": { + "comment": "For YARD tags that follow the tag-types-comment pattern", + "begin": "^(\\s*)(#)(\\s*)(@)(raise|return|yield(?:return)?)(?=\\s)(\\s+((\\[).+(])))?", + "beginCaptures": { + "2": { + "name": "punctuation.definition.comment.ruby" + }, + "4": { + "name": "comment.line.keyword.punctuation.yard.ruby" + }, + "5": { + "name": "comment.line.keyword.yard.ruby" + }, + "7": { + "name": "comment.line.type.yard.ruby" + }, + "8": { + "name": "comment.line.punctuation.yard.ruby" + }, + "9": { + "name": "comment.line.punctuation.yard.ruby" + } + }, + "end": "^(?!\\s*#\\3\\s{2,}|\\s*#\\s*$)", + "contentName": "comment.line.string.yard.ruby", + "name": "comment.line.number-sign.ruby", + "patterns": [ + { + "include": "#yard" + }, + { + "include": "#yard_continuation" + } + ] + }, + "yard_directive": { + "comment": "For YARD directives", + "begin": "^(\\s*)(#)(\\s*)(@!)(endgroup|group|method|parse|scope|visibility)(\\s+((\\[).+(])))?(?=\\s)", + "beginCaptures": { + "2": { + "name": "punctuation.definition.comment.ruby" + }, + "4": { + "name": "comment.line.keyword.punctuation.yard.ruby" + }, + "5": { + "name": "comment.line.keyword.yard.ruby" + }, + "7": { + "name": "comment.line.type.yard.ruby" + }, + "8": { + "name": "comment.line.punctuation.yard.ruby" + }, + "9": { + "name": "comment.line.punctuation.yard.ruby" + } + }, + "end": "^(?!\\s*#\\3\\s{2,}|\\s*#\\s*$)", + "contentName": "comment.line.string.yard.ruby", + "name": "comment.line.number-sign.ruby", + "patterns": [ + { + "include": "#yard" + }, + { + "include": "#yard_continuation" + } + ] + }, + "yard_continuation": { + "match": "^\\s*#", + "name": "punctuation.definition.comment.ruby" + } + } +} \ No newline at end of file diff --git a/desktop/internal/editor/syntax/grammars/shell-unix-bash.tmLanguage.json b/desktop/internal/editor/syntax/grammars/shell-unix-bash.tmLanguage.json new file mode 100644 index 0000000000..255638d7db --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/shell-unix-bash.tmLanguage.json @@ -0,0 +1,2353 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/jeff-hykin/better-shell-syntax/blob/master/autogenerated/shell.tmLanguage.json", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/jeff-hykin/better-shell-syntax/commit/35020b0bd79a90d3b262b4c13a8bb0b33adc1f45", + "name": "Shell Script", + "scopeName": "source.shell", + "patterns": [ + { + "include": "#initial_context" + } + ], + "repository": { + "alias_statement": { + "begin": "(?:(?:[ \\t]*+)(alias)(?:[ \\t]*+)((?:(?:((?&;<>\\(\\)\\$`\\\\\"'<\\|]+)(?!>))", + "captures": { + "1": { + "name": "string.unquoted.argument.shell", + "patterns": [ + { + "match": "\\*", + "name": "variable.language.special.wildcard.shell" + }, + { + "include": "#variable" + }, + { + "include": "#numeric_literal" + }, + { + "match": "(?|#|\\n|$|;|[ \\t]))(?!nocorrect |nocorrect\t|nocorrect$|readonly |readonly\t|readonly$|function |function\t|function$|foreach |foreach\t|foreach$|coproc |coproc\t|coproc$|logout |logout\t|logout$|export |export\t|export$|select |select\t|select$|repeat |repeat\t|repeat$|pushd |pushd\t|pushd$|until |until\t|until$|while |while\t|while$|local |local\t|local$|case |case\t|case$|done |done\t|done$|elif |elif\t|elif$|else |else\t|else$|esac |esac\t|esac$|popd |popd\t|popd$|then |then\t|then$|time |time\t|time$|for |for\t|for$|end |end\t|end$|fi |fi\t|fi$|do |do\t|do$|in |in\t|in$|if |if\t|if$))(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))|((?!\"|'|\\\\\\n?$)(?:[^!'\"<> \\t\\n\\r]+?)))(?:(?= |\\t)|(?:(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?]+))", + "captures": { + "1": { + "name": "entity.name.function.call.shell entity.name.command.shell" + } + } + }, + { + "begin": "(?:(?:\\G|(?|#|\\n|$|;|[ \\t]))(?!nocorrect |nocorrect\t|nocorrect$|readonly |readonly\t|readonly$|function |function\t|function$|foreach |foreach\t|foreach$|coproc |coproc\t|coproc$|logout |logout\t|logout$|export |export\t|export$|select |select\t|select$|repeat |repeat\t|repeat$|pushd |pushd\t|pushd$|until |until\t|until$|while |while\t|while$|local |local\t|local$|case |case\t|case$|done |done\t|done$|elif |elif\t|elif$|else |else\t|else$|esac |esac\t|esac$|popd |popd\t|popd$|then |then\t|then$|time |time\t|time$|for |for\t|for$|end |end\t|end$|fi |fi\t|fi$|do |do\t|do$|in |in\t|in$|if |if\t|if$)(?!\\\\\\n?$)))", + "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?|&&|\\|\\|", + "name": "keyword.operator.logical.shell" + }, + { + "match": "(?[>=]?|==|!=|^|\\|{1,2}|&{1,2}|\\?|\\:|,|=|[*/%+\\-&^|]=|<<=|>>=", + "name": "keyword.operator.arithmetic.shell" + }, + { + "match": "0[xX][0-9A-Fa-f]+", + "name": "constant.numeric.hex.shell" + }, + { + "match": ";", + "name": "punctuation.separator.semicolon.range" + }, + { + "match": "0\\d+", + "name": "constant.numeric.octal.shell" + }, + { + "match": "\\d{1,2}#[0-9a-zA-Z@_]+", + "name": "constant.numeric.other.shell" + }, + { + "match": "\\d+", + "name": "constant.numeric.integer.shell" + }, + { + "match": "(?[>=]?|==|!=|^|\\|{1,2}|&{1,2}|\\?|\\:|,|=|[*/%+\\-&^|]=|<<=|>>=", + "name": "keyword.operator.arithmetic.shell" + }, + { + "match": "0[xX][0-9A-Fa-f]+", + "name": "constant.numeric.hex.shell" + }, + { + "match": "0\\d+", + "name": "constant.numeric.octal.shell" + }, + { + "match": "\\d{1,2}#[0-9a-zA-Z@_]+", + "name": "constant.numeric.other.shell" + }, + { + "match": "\\d+", + "name": "constant.numeric.integer.shell" + } + ] + }, + "misc_ranges": { + "patterns": [ + { + "include": "#logical_expression_single" + }, + { + "include": "#logical_expression_double" + }, + { + "include": "#subshell_dollar" + }, + { + "begin": "(?|#|\\n|$|;|[ \\t]))))", + "end": "(?:(?=[ \\t])|(?:(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?>?)(?:[ \\t]*+)([^ \t\n>&;<>\\(\\)\\$`\\\\\"'<\\|]+))", + "captures": { + "1": { + "name": "keyword.operator.redirect.shell" + }, + "2": { + "name": "string.unquoted.argument.shell" + } + } + }, + "redirect_number": { + "match": "(?<=[ \\t])(?:(?:(1)|(2)|(\\d+))(?=>))", + "captures": { + "1": { + "name": "keyword.operator.redirect.stdout.shell" + }, + "2": { + "name": "keyword.operator.redirect.stderr.shell" + }, + "3": { + "name": "keyword.operator.redirect.$3.shell" + } + } + }, + "redirection": { + "patterns": [ + { + "begin": "[><]\\(", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.shell" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.shell" + } + }, + "name": "string.interpolated.process-substitution.shell", + "patterns": [ + { + "include": "#initial_context" + } + ] + }, + { + "match": "(?])(&>|\\d*>&\\d*|\\d*(>>|>|<)|\\d*<&|\\d*<>)(?![<>])", + "name": "keyword.operator.redirect.shell" + } + ] + }, + "regex_comparison": { + "match": "\\=~", + "name": "keyword.operator.logical.regex.shell" + }, + "regexp": { + "patterns": [ + { + "match": "(?:.+)" + } + ] + }, + "simple_options": { + "match": "(?:(?:[ \\t]++)\\-(?:\\w+))*", + "captures": { + "0": { + "patterns": [ + { + "match": "(?:[ \\t]++)(\\-)(\\w+)", + "captures": { + "1": { + "name": "string.unquoted.argument.shell constant.other.option.dash.shell" + }, + "2": { + "name": "string.unquoted.argument.shell constant.other.option.shell" + } + } + } + ] + } + } + }, + "simple_unquoted": { + "match": "[^ \\t\\n>&;<>\\(\\)\\$`\\\\\"'<\\|]", + "name": "string.unquoted.shell" + }, + "special_expansion": { + "match": "!|:[-=?]?|\\*|@|##|#|%%|%|\\/", + "name": "keyword.operator.expansion.shell" + }, + "start_of_command": { + "match": "(?:(?:[ \\t]*+)(?:(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?!nocorrect |nocorrect\t|nocorrect$|readonly |readonly\t|readonly$|function |function\t|function$|foreach |foreach\t|foreach$|coproc |coproc\t|coproc$|logout |logout\t|logout$|export |export\t|export$|select |select\t|select$|repeat |repeat\t|repeat$|pushd |pushd\t|pushd$|until |until\t|until$|while |while\t|while$|local |local\t|local$|case |case\t|case$|done |done\t|done$|elif |elif\t|elif$|else |else\t|else$|esac |esac\t|esac$|popd |popd\t|popd$|then |then\t|then$|time |time\t|time$|for |for\t|for$|end |end\t|end$|fi |fi\t|fi$|do |do\t|do$|in |in\t|in$|if |if\t|if$)(?!\\\\\\n?$)))" + }, + "string": { + "patterns": [ + { + "match": "\\\\.", + "name": "constant.character.escape.shell" + }, + { + "begin": "'", + "end": "'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.shell" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.shell" + } + }, + "name": "string.quoted.single.shell" + }, + { + "begin": "\\$?\"", + "end": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.shell" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.shell" + } + }, + "name": "string.quoted.double.shell", + "patterns": [ + { + "match": "\\\\[\\$\\n`\"\\\\]", + "name": "constant.character.escape.shell" + }, + { + "include": "#variable" + }, + { + "include": "#interpolation" + } + ] + }, + { + "begin": "\\$'", + "end": "'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.shell" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.shell" + } + }, + "name": "string.quoted.single.dollar.shell", + "patterns": [ + { + "match": "\\\\(?:a|b|e|f|n|r|t|v|\\\\|')", + "name": "constant.character.escape.ansi-c.shell" + }, + { + "match": "\\\\[0-9]{3}\"", + "name": "constant.character.escape.octal.shell" + }, + { + "match": "\\\\x[0-9a-fA-F]{2}\"", + "name": "constant.character.escape.hex.shell" + }, + { + "match": "\\\\c.\"", + "name": "constant.character.escape.control-char.shell" + } + ] + } + ] + }, + "subshell_dollar": { + "patterns": [ + { + "begin": "(?:\\$\\()", + "end": "\\)", + "beginCaptures": { + "0": { + "name": "punctuation.definition.subshell.single.shell" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.subshell.single.shell" + } + }, + "name": "meta.scope.subshell", + "patterns": [ + { + "include": "#parenthese" + }, + { + "include": "#initial_context" + } + ] + } + ] + }, + "support": { + "patterns": [ + { + "match": "(?<=^|;|&|\\s)(?::|\\.)(?=\\s|;|&|$)", + "name": "support.function.builtin.shell" + } + ] + }, + "typical_statements": { + "patterns": [ + { + "include": "#assignment_statement" + }, + { + "include": "#case_statement" + }, + { + "include": "#for_statement" + }, + { + "include": "#while_statement" + }, + { + "include": "#function_definition" + }, + { + "include": "#command_statement" + }, + { + "include": "#line_continuation" + }, + { + "include": "#arithmetic_double" + }, + { + "include": "#normal_context" + } + ] + }, + "variable": { + "patterns": [ + { + "match": "(?:(\\$)(\\@(?!\\w)))", + "captures": { + "1": { + "name": "punctuation.definition.variable.shell variable.parameter.positional.all.shell" + }, + "2": { + "name": "variable.parameter.positional.all.shell" + } + } + }, + { + "match": "(?:(\\$)([0-9](?!\\w)))", + "captures": { + "1": { + "name": "punctuation.definition.variable.shell variable.parameter.positional.shell" + }, + "2": { + "name": "variable.parameter.positional.shell" + } + } + }, + { + "match": "(?:(\\$)([-*#?$!0_](?!\\w)))", + "captures": { + "1": { + "name": "punctuation.definition.variable.shell variable.language.special.shell" + }, + "2": { + "name": "variable.language.special.shell" + } + } + }, + { + "begin": "(?:(\\$)(\\{)(?:[ \\t]*+)(?=\\d))", + "end": "\\}", + "beginCaptures": { + "1": { + "name": "punctuation.definition.variable.shell variable.parameter.positional.shell" + }, + "2": { + "name": "punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell variable.parameter.positional.shell" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell variable.parameter.positional.shell" + } + }, + "contentName": "meta.parameter-expansion", + "patterns": [ + { + "include": "#special_expansion" + }, + { + "include": "#array_access_inline" + }, + { + "match": "[0-9]+", + "name": "variable.parameter.positional.shell" + }, + { + "match": "(?]?=|<>|<|>", + "name": "keyword.operator.comparison.sql" + }, + { + "match": "-|\\+|/", + "name": "keyword.operator.math.sql" + }, + { + "match": "\\|\\|", + "name": "keyword.operator.concatenator.sql" + }, + { + "match": "(?i)\\b(approx_count_distinct|approx_percentile_cont|approx_percentile_disc|avg|checksum_agg|count|count_big|group|grouping|grouping_id|max|min|sum|stdev|stdevp|var|varp)\\b\\s*\\(", + "captures": { + "1": { + "name": "support.function.aggregate.sql" + } + } + }, + { + "match": "(?i)\\b(cume_dist|first_value|lag|last_value|lead|percent_rank|percentile_cont|percentile_disc)\\b\\s*\\(", + "captures": { + "1": { + "name": "support.function.analytic.sql" + } + } + }, + { + "match": "(?i)\\b(bit_count|get_bit|left_shift|right_shift|set_bit)\\b\\s*\\(", + "captures": { + "1": { + "name": "support.function.bitmanipulation.sql" + } + } + }, + { + "match": "(?i)\\b(cast|convert|parse|try_cast|try_convert|try_parse)\\b\\s*\\(", + "captures": { + "1": { + "name": "support.function.conversion.sql" + } + } + }, + { + "match": "(?i)\\b(collationproperty|tertiary_weights)\\b\\s*\\(", + "captures": { + "1": { + "name": "support.function.collation.sql" + } + } + }, + { + "match": "(?i)\\b(asymkey_id|asymkeyproperty|certproperty|cert_id|crypt_gen_random|decryptbyasymkey|decryptbycert|decryptbykey|decryptbykeyautoasymkey|decryptbykeyautocert|decryptbypassphrase|encryptbyasymkey|encryptbycert|encryptbykey|encryptbypassphrase|hashbytes|is_objectsigned|key_guid|key_id|key_name|signbyasymkey|signbycert|symkeyproperty|verifysignedbycert|verifysignedbyasymkey)\\b\\s*\\(", + "captures": { + "1": { + "name": "support.function.cryptographic.sql" + } + } + }, + { + "match": "(?i)\\b(cursor_status)\\b\\s*\\(", + "captures": { + "1": { + "name": "support.function.cursor.sql" + } + } + }, + { + "match": "(?i)\\b(sysdatetime|sysdatetimeoffset|sysutcdatetime|current_time(stamp)?|getdate|getutcdate|datename|datepart|day|month|year|datefromparts|datetime2fromparts|datetimefromparts|datetimeoffsetfromparts|smalldatetimefromparts|timefromparts|datediff|dateadd|datetrunc|eomonth|switchoffset|todatetimeoffset|isdate|date_bucket)\\b\\s*\\(", + "captures": { + "1": { + "name": "support.function.datetime.sql" + } + } + }, + { + "match": "(?i)\\b(datalength|ident_current|ident_incr|ident_seed|identity|sql_variant_property)\\b\\s*\\(", + "captures": { + "1": { + "name": "support.function.datatype.sql" + } + } + }, + { + "match": "(?i)\\b(coalesce|nullif)\\b\\s*\\(", + "captures": { + "1": { + "name": "support.function.expression.sql" + } + } + }, + { + "match": "(?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k)", + "end": "(?!\\G\\()", + "beginCaptures": { + "0": { + "name": "storage.modifier.attribute.swift" + }, + "1": { + "name": "punctuation.definition.attribute.swift" + }, + "2": { + "name": "punctuation.definition.identifier.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + } + }, + "patterns": [ + { + "name": "meta.arguments.attribute.swift", + "begin": "\\(", + "end": "\\)", + "beginCaptures": { + "0": { + "name": "punctuation.definition.arguments.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.swift" + } + }, + "patterns": [ + { + "include": "#expressions" + } + ] + } + ] + } + ] + }, + "builtin-functions": { + "patterns": [ + { + "comment": "Member functions in the standard library in Swift 3 which may be used with trailing closures and no parentheses", + "name": "support.function.swift", + "match": "(?<=\\.)(?:s(?:ort(?:ed)?|plit)|contains|index|partition|f(?:i(?:lter|rst)|orEach|latMap)|with(?:MutableCharacters|CString|U(?:nsafe(?:Mutable(?:BufferPointer|Pointer(?:s|To(?:Header|Elements)))|BufferPointer)|TF8Buffer))|m(?:in|a(?:p|x)))(?=\\s*[({])\\b" + }, + { + "comment": "Member functions in the standard library in Swift 3", + "name": "support.function.swift", + "match": "(?<=\\.)(?:s(?:ymmetricDifference|t(?:oreBytes|arts|ride)|ortInPlace|u(?:ccessor|ffix|btract(?:ing|InPlace|WithOverflow)?)|quareRoot|amePosition)|h(?:oldsUnique(?:Reference|OrPinnedReference)|as(?:Suffix|Prefix))|ne(?:gate(?:d)?|xt)|c(?:o(?:untByEnumerating|py(?:Bytes)?)|lamp(?:ed)?|reate)|t(?:o(?:IntMax|Opaque|UIntMax)|ake(?:RetainedValue|UnretainedValue)|r(?:uncatingRemainder|a(?:nscodedLength|ilSurrogate)))|i(?:s(?:MutableAndUniquelyReferenced(?:OrPinned)?|S(?:trictSu(?:perset(?:Of)?|bset(?:Of)?)|u(?:perset(?:Of)?|bset(?:Of)?))|Continuation|T(?:otallyOrdered|railSurrogate)|Disjoint(?:With)?|Unique(?:Reference|lyReferenced(?:OrPinned)?)|Equal|Le(?:ss(?:ThanOrEqualTo)?|adSurrogate))|n(?:sert(?:ContentsOf)?|tersect(?:ion|InPlace)?|itialize(?:Memory|From)?|dex(?:Of|ForKey)))|o(?:verlaps|bjectAt)|d(?:i(?:stance(?:To)?|vide(?:d|WithOverflow)?)|e(?:s(?:cendant|troy)|code(?:CString)?|initialize|alloc(?:ate(?:Capacity)?)?)|rop(?:First|Last))|u(?:n(?:ion(?:InPlace)?|derestimateCount|wrappedOrError)|p(?:date(?:Value)?|percased))|join(?:ed|WithSeparator)|p(?:op(?:First|Last)|ass(?:Retained|Unretained)|re(?:decessor|fix))|e(?:scape(?:d)?|n(?:code|umerate(?:d)?)|lementsEqual|xclusiveOr(?:InPlace)?)|f(?:orm(?:Remainder|S(?:ymmetricDifference|quareRoot)|TruncatingRemainder|In(?:tersection|dex)|Union)|latten|rom(?:CString(?:RepairingIllFormedUTF8)?|Opaque))|w(?:i(?:thMemoryRebound|dth)|rite(?:To)?)|l(?:o(?:wercased|ad)|e(?:adSurrogate|xicographical(?:Compare|lyPrecedes)))|a(?:ss(?:ign(?:BackwardFrom|From)?|umingMemoryBound)|d(?:d(?:ing(?:Product)?|Product|WithOverflow)?|vanced(?:By)?)|utorelease|ppend(?:ContentsOf)?|lloc(?:ate)?|bs)|r(?:ound(?:ed)?|e(?:serveCapacity|tain|duce|place(?:Range|Subrange)?|verse(?:d)?|quest(?:NativeBuffer|UniqueMutableBackingBuffer)|lease|m(?:ove(?:Range|Subrange|Value(?:ForKey)?|First|Last|A(?:tIndex|ll))?|ainder(?:WithOverflow)?)))|ge(?:nerate|t(?:Objects|Element))|m(?:in(?:imum(?:Magnitude)?|Element)|ove(?:Initialize(?:Memory|BackwardFrom|From)?|Assign(?:From)?)?|ultipl(?:y(?:WithOverflow)?|ied)|easure|a(?:ke(?:Iterator|Description)|x(?:imum(?:Magnitude)?|Element)))|bindMemory)(?=\\s*\\()" + }, + { + "comment": "Member functions in the standard library in Swift 2 only", + "name": "support.function.swift", + "match": "(?<=\\.)(?:s(?:uperclassMirror|amePositionIn|tartsWith)|nextObject|c(?:haracterAtIndex|o(?:untByEnumeratingWithState|pyWithZone)|ustom(?:Mirror|PlaygroundQuickLook))|is(?:EmptyInput|ASCII)|object(?:Enumerator|ForKey|AtIndex)|join|put|keyEnumerator|withUnsafeMutablePointerToValue|length|getMirror|m(?:oveInitializeAssignFrom|ember))(?=\\s*\\()" + } + ] + }, + "builtin-global-functions": { + "patterns": [ + { + "begin": "\\b(type)(\\()\\s*(of)(:)", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "support.function.dynamic-type.swift" + }, + "2": { + "name": "punctuation.definition.arguments.begin.swift" + }, + "3": { + "name": "support.variable.parameter.swift" + }, + "4": { + "name": "punctuation.separator.argument-label.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.swift" + } + }, + "patterns": [ + { + "include": "#expressions" + } + ] + }, + { + "comment": "Global functions available in Swift 3 which may be used with trailing closures and no parentheses", + "name": "support.function.swift", + "match": "\\b(?:anyGenerator|autoreleasepool)(?=\\s*[({])\\b" + }, + { + "comment": "Global functions available in Swift 3", + "name": "support.function.swift", + "match": "\\b(?:s(?:tride(?:of(?:Value)?)?|izeof(?:Value)?|equence|wap)|numericCast|transcode|is(?:UniquelyReferenced(?:NonObjC)?|KnownUniquelyReferenced)|zip|d(?:ump|ebugPrint)|unsafe(?:BitCast|Downcast|Unwrap|Address(?:Of)?)|pr(?:int|econdition(?:Failure)?)|fatalError|with(?:Unsafe(?:MutablePointer|Pointer)|ExtendedLifetime|VaList)|a(?:ssert(?:ionFailure)?|lignof(?:Value)?|bs)|re(?:peatElement|adLine)|getVaList|m(?:in|ax))(?=\\s*\\()" + }, + { + "comment": "Global functions available in Swift 2 only", + "name": "support.function.swift", + "match": "\\b(?:s(?:ort|uffix|pli(?:ce|t))|insert|overlaps|d(?:istance|rop(?:First|Last))|join|prefix|extend|withUnsafe(?:MutablePointers|Pointers)|lazy|advance|re(?:flect|move(?:Range|Last|A(?:tIndex|ll))))(?=\\s*\\()" + } + ] + }, + "builtin-properties": { + "patterns": [ + { + "comment": "The simpler (?<=\\bProcess\\.|\\bCommandLine\\.) breaks VS Code / Atom, see https://github.com/textmate/swift.tmbundle/issues/29", + "name": "support.variable.swift", + "match": "(?<=^Process\\.|\\WProcess\\.|^CommandLine\\.|\\WCommandLine\\.)(arguments|argc|unsafeArgv)" + }, + { + "comment": "Properties in the standard library in Swift 3", + "name": "support.variable.swift", + "match": "(?<=\\.)(?:s(?:t(?:artIndex|ri(?:ngValue|de))|i(?:ze|gn(?:BitIndex|ificand(?:Bit(?:Count|Pattern)|Width)?|alingNaN)?)|u(?:perclassMirror|mmary|bscriptBaseAddress))|h(?:eader|as(?:hValue|PointerRepresentation))|n(?:ulTerminatedUTF8|ext(?:Down|Up)|a(?:n|tiveOwner))|c(?:haracters|ount(?:TrailingZeros)?|ustom(?:Mirror|PlaygroundQuickLook)|apacity)|i(?:s(?:S(?:ign(?:Minus|aling(?:NaN)?)|ubnormal)|N(?:ormal|aN)|Canonical|Infinite|Zero|Empty|Finite|ASCII)|n(?:dices|finity)|dentity)|owner|de(?:scription|bugDescription)|u(?:n(?:safelyUnwrapped|icodeScalar(?:s)?|derestimatedCount)|tf(?:16|8(?:Start|C(?:String|odeUnitCount))?)|intValue|ppercaseString|lp(?:OfOne)?)|p(?:i|ointee)|e(?:ndIndex|lements|xponent(?:Bit(?:Count|Pattern))?)|value(?:s)?|keys|quietNaN|f(?:irst(?:ElementAddress(?:IfContiguous)?)?|loatingPointClass)|l(?:ittleEndian|owercaseString|eastNo(?:nzeroMagnitude|rmalMagnitude)|a(?:st|zy))|a(?:l(?:ignment|l(?:ocatedElementCount|Zeros))|rray(?:PropertyIsNativeTypeChecked)?)|ra(?:dix|wValue)|greatestFiniteMagnitude|m(?:in|emory|ax)|b(?:yteS(?:ize|wapped)|i(?:nade|tPattern|gEndian)|uffer|ase(?:Address)?))\\b" + }, + { + "comment": "Properties in the standard library in Swift 2 only", + "name": "support.variable.swift", + "match": "(?<=\\.)(?:boolValue|disposition|end|objectIdentifier|quickLookObject|start|valueType)\\b" + }, + { + "comment": "Enum cases in the standard library - note that there is some overlap between these and the properties", + "name": "support.variable.swift", + "match": "(?<=\\.)(?:s(?:calarValue|i(?:ze|gnalingNaN)|o(?:und|me)|uppressed|prite|et)|n(?:one|egative(?:Subnormal|Normal|Infinity|Zero))|c(?:ol(?:or|lection)|ustomized)|t(?:o(?:NearestOr(?:Even|AwayFromZero)|wardZero)|uple|ext)|i(?:nt|mage)|optional|d(?:ictionary|o(?:uble|wn))|u(?:Int|p|rl)|p(?:o(?:sitive(?:Subnormal|Normal|Infinity|Zero)|int)|lus)|e(?:rror|mptyInput)|view|quietNaN|float|a(?:ttributedString|wayFromZero)|r(?:ectangle|ange)|generated|minus|b(?:ool|ezierPath))\\b" + } + ] + }, + "builtin-types": { + "comment": "Types provided in the standard library", + "patterns": [ + { + "include": "#builtin-types-builtin-class-type" + }, + { + "include": "#builtin-types-builtin-enum-type" + }, + { + "include": "#builtin-types-builtin-protocol-type" + }, + { + "include": "#builtin-types-builtin-struct-type" + }, + { + "include": "#builtin-types-builtin-typealias" + }, + { + "name": "support.type.any.swift", + "match": "\\bAny\\b" + } + ] + }, + "builtin-types-builtin-class-type": { + "comment": "Builtin class types", + "name": "support.class.swift", + "match": "\\b(Managed(Buffer|ProtoBuffer)|NonObjectiveCBase|AnyGenerator)\\b" + }, + "builtin-types-builtin-enum-type": { + "patterns": [ + { + "comment": "CommandLine is an enum, but it acts like a constant", + "name": "support.constant.swift", + "match": "\\b(?:CommandLine|Process(?=\\.))\\b" + }, + { + "comment": "The return type of a function that never returns", + "name": "support.constant.never.swift", + "match": "\\bNever\\b" + }, + { + "comment": "Enum types in the standard library in Swift 3", + "name": "support.type.swift", + "match": "\\b(?:ImplicitlyUnwrappedOptional|Representation|MemoryLayout|FloatingPointClassification|SetIndexRepresentation|SetIteratorRepresentation|FloatingPointRoundingRule|UnicodeDecodingResult|Optional|DictionaryIndexRepresentation|AncestorRepresentation|DisplayStyle|PlaygroundQuickLook|Never|FloatingPointSign|Bit|DictionaryIteratorRepresentation)\\b" + }, + { + "comment": "Enum types in the standard library in Swift 2 only", + "name": "support.type.swift", + "match": "\\b(?:MirrorDisposition|QuickLookObject)\\b" + } + ] + }, + "builtin-types-builtin-protocol-type": { + "patterns": [ + { + "name": "support.type.swift", + "match": "\\bActor\\b" + }, + { + "comment": "Protocols in the standard library in Swift 3", + "name": "support.type.swift", + "match": "\\b(?:Ra(?:n(?:domAccess(?:Collection|Indexable)|geReplaceable(?:Collection|Indexable))|wRepresentable)|M(?:irrorPath|utable(?:Collection|Indexable))|Bi(?:naryFloatingPoint|twiseOperations|directional(?:Collection|Indexable))|S(?:tr(?:ideable|eamable)|igned(?:Number|Integer)|e(?:tAlgebra|quence))|Hashable|C(?:o(?:llection|mparable)|ustom(?:Reflectable|StringConvertible|DebugStringConvertible|PlaygroundQuickLookable|LeafReflectable)|VarArg)|TextOutputStream|I(?:n(?:teger(?:Arithmetic)?|dexable(?:Base)?)|teratorProtocol)|OptionSet|Un(?:signedInteger|icodeCodec)|E(?:quatable|rror|xpressibleBy(?:BooleanLiteral|String(?:Interpolation|Literal)|NilLiteral|IntegerLiteral|DictionaryLiteral|UnicodeScalarLiteral|ExtendedGraphemeClusterLiteral|FloatLiteral|ArrayLiteral))|FloatingPoint|L(?:osslessStringConvertible|azy(?:SequenceProtocol|CollectionProtocol))|A(?:nyObject|bsoluteValuable))\\b" + }, + { + "comment": "Protocols in the standard library in Swift 2 only", + "name": "support.type.swift", + "match": "\\b(?:Ran(?:domAccessIndexType|geReplaceableCollectionType)|GeneratorType|M(?:irror(?:Type|PathType)|utable(?:Sliceable|CollectionType))|B(?:i(?:twiseOperationsType|directionalIndexType)|oolean(?:Type|LiteralConvertible))|S(?:tring(?:InterpolationConvertible|LiteralConvertible)|i(?:nkType|gned(?:NumberType|IntegerType))|e(?:tAlgebraType|quenceType)|liceable)|NilLiteralConvertible|C(?:ollectionType|VarArgType)|Inte(?:rvalType|ger(?:Type|LiteralConvertible|ArithmeticType))|O(?:utputStreamType|ptionSetType)|DictionaryLiteralConvertible|Un(?:signedIntegerType|icode(?:ScalarLiteralConvertible|CodecType))|E(?:rrorType|xten(?:sibleCollectionType|dedGraphemeClusterLiteralConvertible))|F(?:orwardIndexType|loat(?:ingPointType|LiteralConvertible))|A(?:nyCollectionType|rrayLiteralConvertible))\\b" + } + ] + }, + "builtin-types-builtin-struct-type": { + "patterns": [ + { + "comment": "Structs in the standard library in Swift 3", + "name": "support.type.swift", + "match": "\\b(?:R(?:e(?:peat(?:ed)?|versed(?:RandomAccess(?:Collection|Index)|Collection|Index))|an(?:domAccessSlice|ge(?:Replaceable(?:RandomAccessSlice|BidirectionalSlice|Slice)|Generator)?))|Generator(?:Sequence|OfOne)|M(?:irror|utable(?:Ran(?:domAccessSlice|geReplaceable(?:RandomAccessSlice|BidirectionalSlice|Slice))|BidirectionalSlice|Slice)|anagedBufferPointer)|B(?:idirectionalSlice|ool)|S(?:t(?:aticString|ri(?:ng|deT(?:hrough(?:Generator|Iterator)?|o(?:Generator|Iterator)?)))|et(?:I(?:ndex|terator))?|lice)|HalfOpenInterval|C(?:haracter(?:View)?|o(?:ntiguousArray|untable(?:Range|ClosedRange)|llectionOfOne)|OpaquePointer|losed(?:Range(?:I(?:ndex|terator))?|Interval)|VaListPointer)|I(?:n(?:t(?:16|8|32|64)?|d(?:ices|ex(?:ing(?:Generator|Iterator))?))|terator(?:Sequence|OverOne)?)|Zip2(?:Sequence|Iterator)|O(?:paquePointer|bjectIdentifier)|D(?:ictionary(?:I(?:ndex|terator)|Literal)?|ouble|efault(?:RandomAccessIndices|BidirectionalIndices|Indices))|U(?:n(?:safe(?:RawPointer|Mutable(?:RawPointer|BufferPointer|Pointer)|BufferPointer(?:Generator|Iterator)?|Pointer)|icodeScalar(?:View)?|foldSequence|managed)|TF(?:16(?:View)?|8(?:View)?|32)|Int(?:16|8|32|64)?)|Join(?:Generator|ed(?:Sequence|Iterator))|PermutationGenerator|E(?:numerate(?:Generator|Sequence|d(?:Sequence|Iterator))|mpty(?:Generator|Collection|Iterator))|Fl(?:oat(?:80)?|atten(?:Generator|BidirectionalCollection(?:Index)?|Sequence|Collection(?:Index)?|Iterator))|L(?:egacyChildren|azy(?:RandomAccessCollection|Map(?:RandomAccessCollection|Generator|BidirectionalCollection|Sequence|Collection|Iterator)|BidirectionalCollection|Sequence|Collection|Filter(?:Generator|BidirectionalCollection|Sequence|Collection|I(?:ndex|terator))))|A(?:ny(?:RandomAccessCollection|Generator|BidirectionalCollection|Sequence|Hashable|Collection|I(?:ndex|terator))|utoreleasingUnsafeMutablePointer|rray(?:Slice)?))\\b" + }, + { + "comment": "Structs in the standard library in Swift 2 only", + "name": "support.type.swift", + "match": "\\b(?:R(?:everse(?:RandomAccess(?:Collection|Index)|Collection|Index)|awByte)|Map(?:Generator|Sequence|Collection)|S(?:inkOf|etGenerator)|Zip2Generator|DictionaryGenerator|Filter(?:Generator|Sequence|Collection(?:Index)?)|LazyForwardCollection|Any(?:RandomAccessIndex|BidirectionalIndex|Forward(?:Collection|Index)))\\b" + } + ] + }, + "builtin-types-builtin-typealias": { + "patterns": [ + { + "comment": "Typealiases in the standard library in Swift 3", + "name": "support.type.swift", + "match": "\\b(?:Raw(?:Significand|Exponent|Value)|B(?:ooleanLiteralType|uffer|ase)|S(?:t(?:orage|r(?:i(?:ngLiteralType|de)|eam(?:1|2)))|ubSequence)|NativeBuffer|C(?:hild(?:ren)?|Bool|S(?:hort|ignedChar)|odeUnit|Char(?:16|32)?|Int|Double|Unsigned(?:Short|Char|Int|Long(?:Long)?)|Float|WideChar|Long(?:Long)?)|I(?:n(?:t(?:Max|egerLiteralType)|d(?:ices|ex(?:Distance)?))|terator)|Distance|U(?:n(?:icodeScalar(?:Type|Index|View|LiteralType)|foldFirstSequence)|TF(?:16(?:Index|View)|8Index)|IntMax)|E(?:lement(?:s)?|x(?:tendedGraphemeCluster(?:Type|LiteralType)|ponent))|V(?:oid|alue)|Key|Float(?:32|LiteralType|64)|AnyClass)\\b" + }, + { + "comment": "Typealiases in the standard library in Swift 2 only", + "name": "support.type.swift", + "match": "\\b(?:Generator|PlaygroundQuickLook|UWord|Word)\\b" + } + ] + }, + "code-block": { + "begin": "\\{", + "end": "\\}", + "beginCaptures": { + "0": { + "name": "punctuation.section.scope.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.scope.end.swift" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + }, + "comments": { + "patterns": [ + { + "name": "comment.line.number-sign.swift", + "match": "\\A^(#!).*$\\n?", + "captures": { + "1": { + "name": "punctuation.definition.comment.swift" + } + } + }, + { + "name": "comment.block.documentation.swift", + "begin": "/\\*\\*(?!/)", + "end": "\\*/", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.end.swift" + } + }, + "patterns": [ + { + "include": "#comments-nested" + } + ] + }, + { + "name": "comment.block.documentation.playground.swift", + "begin": "/\\*:", + "end": "\\*/", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.end.swift" + } + }, + "patterns": [ + { + "include": "#comments-nested" + } + ] + }, + { + "name": "comment.block.swift", + "begin": "/\\*", + "end": "\\*/", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.end.swift" + } + }, + "patterns": [ + { + "include": "#comments-nested" + } + ] + }, + { + "name": "invalid.illegal.unexpected-end-of-block-comment.swift", + "match": "\\*/" + }, + { + "begin": "(^[ \\t]+)?(?=//)", + "end": "(?!\\G)", + "beginCaptures": { + "1": { + "name": "punctuation.whitespace.comment.leading.swift" + } + }, + "patterns": [ + { + "name": "comment.line.triple-slash.documentation.swift", + "begin": "///", + "end": "$", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.swift" + } + } + }, + { + "name": "comment.line.double-slash.documentation.swift", + "begin": "//:", + "end": "$", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.swift" + } + } + }, + { + "name": "comment.line.double-slash.swift", + "begin": "//", + "end": "$", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.swift" + } + } + } + ] + } + ] + }, + "comments-nested": { + "begin": "/\\*", + "end": "\\*/", + "patterns": [ + { + "include": "#comments-nested" + } + ] + }, + "compiler-control": { + "patterns": [ + { + "contentName": "comment.block.preprocessor.swift", + "begin": "^\\s*(#)(if|elseif)\\s+(false)\\b.*?(?=$|//|/\\*)", + "end": "(?=^\\s*(#(elseif|else|endif)\\b))", + "beginCaptures": { + "0": { + "name": "meta.preprocessor.conditional.swift" + }, + "1": { + "name": "punctuation.definition.preprocessor.swift" + }, + "2": { + "name": "keyword.control.import.preprocessor.conditional.swift" + }, + "3": { + "name": "constant.language.boolean.swift" + } + } + }, + { + "name": "meta.preprocessor.conditional.swift", + "captures": { + "1": { + "name": "punctuation.definition.preprocessor.swift" + }, + "2": { + "name": "keyword.control.import.preprocessor.conditional.swift" + } + }, + "begin": "^\\s*(#)(if|elseif)\\s+", + "end": "(?=\\s*(?://|/\\*))|$", + "patterns": [ + { + "name": "keyword.operator.logical.swift", + "match": "(&&|\\|\\|)" + }, + { + "name": "constant.language.boolean.swift", + "match": "\\b(true|false)\\b" + }, + { + "match": "\\b(arch)\\s*(\\()\\s*(?:(arm|arm64|powerpc64|powerpc64le|i386|x86_64|s390x)|\\w+)\\s*(\\))", + "captures": { + "1": { + "name": "keyword.other.condition.swift" + }, + "2": { + "name": "punctuation.definition.parameters.begin.swift" + }, + "3": { + "name": "support.constant.platform.architecture.swift" + }, + "4": { + "name": "punctuation.definition.parameters.end.swift" + } + } + }, + { + "match": "\\b(os)\\s*(\\()\\s*(?:(macOS|OSX|iOS|tvOS|watchOS|visionOS|Android|Linux|FreeBSD|Windows|PS4)|\\w+)\\s*(\\))", + "captures": { + "1": { + "name": "keyword.other.condition.swift" + }, + "2": { + "name": "punctuation.definition.parameters.begin.swift" + }, + "3": { + "name": "support.constant.platform.os.swift" + }, + "4": { + "name": "punctuation.definition.parameters.end.swift" + } + } + }, + { + "match": "\\b(canImport)\\s*(\\()([\\p{L}_][\\p{L}_\\p{N}\\p{M}]*)(\\))", + "captures": { + "1": { + "name": "keyword.other.condition.swift" + }, + "2": { + "name": "punctuation.definition.parameters.begin.swift" + }, + "3": { + "name": "entity.name.type.module.swift" + }, + "4": { + "name": "punctuation.definition.parameters.end.swift" + } + } + }, + { + "begin": "\\b(targetEnvironment)\\s*(\\()", + "end": "(\\))|$", + "beginCaptures": { + "1": { + "name": "keyword.other.condition.swift" + }, + "2": { + "name": "punctuation.definition.parameters.begin.swift" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.parameters.end.swift" + } + }, + "patterns": [ + { + "name": "support.constant.platform.environment.swift", + "match": "\\b(simulator|UIKitForMac)\\b" + } + ] + }, + { + "begin": "\\b(swift|compiler)\\s*(\\()", + "end": "(\\))|$", + "beginCaptures": { + "1": { + "name": "keyword.other.condition.swift" + }, + "2": { + "name": "punctuation.definition.parameters.begin.swift" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.parameters.end.swift" + } + }, + "patterns": [ + { + "name": "keyword.operator.comparison.swift", + "match": ">=|<" + }, + { + "name": "constant.numeric.swift", + "match": "\\b[0-9]+(?:\\.[0-9]+)*\\b" + } + ] + } + ] + }, + { + "name": "meta.preprocessor.conditional.swift", + "match": "^\\s*(#)(else|endif)(.*?)(?=$|//|/\\*)", + "captures": { + "1": { + "name": "punctuation.definition.preprocessor.swift" + }, + "2": { + "name": "keyword.control.import.preprocessor.conditional.swift" + }, + "3": { + "patterns": [ + { + "name": "invalid.illegal.character-not-allowed-here.swift", + "match": "\\S+" + } + ] + } + } + }, + { + "name": "meta.preprocessor.sourcelocation.swift", + "match": "^\\s*(#)(sourceLocation)((\\()([^)]*)(\\)))(.*?)(?=$|//|/\\*)", + "captures": { + "1": { + "name": "punctuation.definition.preprocessor.swift" + }, + "2": { + "name": "keyword.control.import.preprocessor.sourcelocation.swift" + }, + "4": { + "name": "punctuation.definition.parameters.begin.swift" + }, + "5": { + "patterns": [ + { + "begin": "(file)\\s*(:)\\s*(?=\")", + "end": "(?!\\G)", + "beginCaptures": { + "1": { + "name": "support.variable.parameter.swift" + }, + "2": { + "name": "punctuation.separator.key-value.swift" + } + }, + "patterns": [ + { + "include": "#literals" + } + ] + }, + { + "match": "(line)\\s*(:)\\s*([0-9]+)", + "captures": { + "1": { + "name": "support.variable.parameter.swift" + }, + "2": { + "name": "punctuation.separator.key-value.swift" + }, + "3": { + "name": "constant.numeric.integer.swift" + } + } + }, + { + "name": "punctuation.separator.parameters.swift", + "match": "," + }, + { + "name": "invalid.illegal.character-not-allowed-here.swift", + "match": "\\S+" + } + ] + }, + "6": { + "name": "punctuation.definition.parameters.begin.swift" + }, + "7": { + "patterns": [ + { + "name": "invalid.illegal.character-not-allowed-here.swift", + "match": "\\S+" + } + ] + } + } + } + ] + }, + "conditionals": { + "patterns": [ + { + "begin": "(?&|\\^~.])(->)(?![/=\\-+!*%<>&|\\^~.])", + "captures": { + "1": { + "name": "keyword.operator.type.function.swift" + } + } + }, + { + "comment": "Swift 3: A & B", + "match": "(?&|\\^~.])(&)(?![/=\\-+!*%<>&|\\^~.])", + "captures": { + "1": { + "name": "keyword.operator.type.composition.swift" + } + } + }, + { + "name": "keyword.operator.type.optional.swift", + "match": "[?!]" + }, + { + "name": "keyword.operator.function.variadic-parameter.swift", + "match": "\\.\\.\\." + }, + { + "comment": "Swift 2: protocol", + "name": "keyword.other.type.composition.swift", + "match": "\\bprotocol\\b" + }, + { + "name": "keyword.other.type.metatype.swift", + "match": "(?<=\\.)(?:Protocol|Type)\\b" + }, + { + "include": "#declarations-available-types-tuple-type" + }, + { + "include": "#declarations-available-types-collection-type" + }, + { + "include": "#declarations-generic-argument-clause" + } + ] + }, + "declarations-available-types-collection-type": { + "comment": "array and dictionary types [Value] and [Key: Value]", + "begin": "\\[", + "end": "\\]|(?=[>){}])", + "beginCaptures": { + "0": { + "name": "punctuation.section.collection-type.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.collection-type.end.swift" + } + }, + "patterns": [ + { + "include": "#declarations-available-types" + }, + { + "include": "#literals-numeric" + }, + { + "name": "support.variable.inferred.swift", + "match": "\\b_\\b" + }, + { + "name": "keyword.other.inline-array.swift", + "match": "(?<=\\s)\\bof\\b(?=\\s+[\\p{L}_\\d\\p{N}\\p{M}\\[(])" + }, + { + "begin": ":", + "end": "(?=\\]|[>){}])", + "beginCaptures": { + "0": { + "name": "punctuation.separator.key-value.swift" + } + }, + "patterns": [ + { + "name": "invalid.illegal.extra-colon-in-dictionary-type.swift", + "match": ":" + }, + { + "include": "#declarations-available-types" + } + ] + } + ] + }, + "declarations-available-types-tuple-type": { + "begin": "\\(", + "end": "\\)|(?=[>\\]{}])", + "beginCaptures": { + "0": { + "name": "punctuation.section.tuple-type.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.tuple-type.end.swift" + } + }, + "patterns": [ + { + "include": "#declarations-available-types" + } + ] + }, + "declarations-extension": { + "name": "meta.definition.type.$1.swift", + "begin": "\\b(extension)\\s+", + "end": "(?<=\\})", + "beginCaptures": { + "1": { + "name": "storage.type.$1.swift" + } + }, + "patterns": [ + { + "name": "entity.name.type.swift", + "begin": "\\G(?!\\s*[:{\\n])", + "end": "(?=\\s*[:{\\n])|(?!\\G)(?=\\s*where\\b)", + "patterns": [ + { + "include": "#declarations-available-types" + } + ] + }, + { + "include": "#comments" + }, + { + "comment": "SE-0143: Conditional Conformances", + "include": "#declarations-generic-where-clause" + }, + { + "include": "#declarations-inheritance-clause" + }, + { + "name": "meta.definition.type.body.swift", + "begin": "\\{", + "end": "\\}", + "beginCaptures": { + "0": { + "name": "punctuation.definition.type.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.type.end.swift" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + } + ] + }, + "declarations-function": { + "name": "meta.definition.function.swift", + "begin": "(?x)\n\\b\n(func)\n\\s+\n(\n (?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k)\n | (?:\n (\n (? # operator-head\n [/=\\-+!*%<>&|^~?]\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n )\n (\n \\g\n | (? # operator-character\n [\\x{0300}-\\x{036F}]\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n )*\n )\n | ( \\. ( \\g | \\g | \\. )+ ) # Dot operators\n )\n)\n\\s*\n(?=\\(|<)", + "end": "(?<=\\})|$(?# functions in protocol declarations or generated interfaces have no body)", + "beginCaptures": { + "1": { + "name": "storage.type.function.swift" + }, + "2": { + "name": "entity.name.function.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.definition.identifier.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#declarations-generic-parameter-clause" + }, + { + "include": "#declarations-parameter-clause" + }, + { + "include": "#declarations-function-result" + }, + { + "include": "#async-throws" + }, + { + "comment": "Swift 3: generic constraints after the parameters and return type", + "include": "#declarations-generic-where-clause" + }, + { + "name": "meta.definition.function.body.swift", + "begin": "(\\{)", + "end": "(\\})", + "beginCaptures": { + "1": { + "name": "punctuation.section.function.begin.swift" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.section.function.end.swift" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + } + ] + }, + "declarations-function-initializer": { + "name": "meta.definition.function.initializer.swift", + "begin": "(?&|\\^~.])(->)(?![/=\\-+!*%<>&|\\^~.])\\s*", + "end": "(?!\\G)(?=\\{|\\bwhere\\b|;|=)|$", + "beginCaptures": { + "1": { + "name": "keyword.operator.function-result.swift" + } + }, + "patterns": [ + { + "name": "storage.modifier.swift", + "match": "\\bsending\\b" + }, + { + "include": "#declarations-available-types" + } + ] + }, + "declarations-function-subscript": { + "name": "meta.definition.function.subscript.swift", + "begin": "(?|(?=[)\\]{}])", + "beginCaptures": { + "0": { + "name": "punctuation.separator.generic-argument-clause.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.separator.generic-argument-clause.end.swift" + } + }, + "patterns": [ + { + "include": "#literals-numeric" + }, + { + "include": "#declarations-available-types" + } + ] + }, + "declarations-generic-parameter-clause": { + "name": "meta.generic-parameter-clause.swift", + "begin": "<", + "end": ">|(?=[^\\w\\d:<>\\s,=&`])(?# characters besides these are never valid in a generic param list -- even if it's not really a valid clause, we should stop trying to parse it if we see one of them.)", + "beginCaptures": { + "0": { + "name": "punctuation.separator.generic-parameter-clause.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.separator.generic-parameter-clause.end.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "comment": "Swift 2: constraints inside the generic param list", + "include": "#declarations-generic-where-clause" + }, + { + "name": "keyword.other.declaration-specifier.swift", + "match": "\\blet\\b" + }, + { + "name": "keyword.control.loop.swift", + "match": "\\beach\\b" + }, + { + "match": "\\b((?!\\d)\\w[\\w\\d]*)\\b", + "captures": { + "1": { + "name": "variable.language.generic-parameter.swift" + } + } + }, + { + "name": "punctuation.separator.generic-parameters.swift", + "match": "," + }, + { + "name": "meta.generic-parameter-constraint.swift", + "begin": "(:)\\s*", + "end": "(?=[,>]|(?!\\G)\\bwhere\\b)", + "beginCaptures": { + "1": { + "name": "punctuation.separator.generic-parameter-constraint.swift" + } + }, + "patterns": [ + { + "name": "entity.other.inherited-class.swift", + "begin": "\\G", + "end": "(?=[,>]|(?!\\G)\\bwhere\\b)", + "patterns": [ + { + "include": "#declarations-type-identifier" + }, + { + "include": "#declarations-type-operators" + } + ] + } + ] + } + ] + }, + "declarations-generic-where-clause": { + "name": "meta.generic-where-clause.swift", + "begin": "\\b(where)\\b\\s*", + "end": "(?!\\G)$|(?=[>{};\\n]|//|/\\*)", + "beginCaptures": { + "1": { + "name": "keyword.other.generic-constraint-introducer.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#declarations-generic-where-clause-requirement-list" + } + ] + }, + "declarations-generic-where-clause-requirement-list": { + "begin": "\\G|,\\s*", + "end": "(?=[,>{};\\n]|//|/\\*)", + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#constraint" + }, + { + "include": "#declarations-available-types" + }, + { + "name": "meta.generic-where-clause.same-type-requirement.swift", + "begin": "(?&|\\^~.])(==)(?![/=\\-+!*%<>&|\\^~.])", + "end": "(?=\\s*[,>{};\\n]|//|/\\*)", + "beginCaptures": { + "1": { + "name": "keyword.operator.generic-constraint.same-type.swift" + } + }, + "patterns": [ + { + "include": "#declarations-available-types" + } + ] + }, + { + "name": "meta.generic-where-clause.conformance-requirement.swift", + "begin": "(?&|\\^~.])(:)(?![/=\\-+!*%<>&|\\^~.])", + "end": "(?=\\s*[,>{};\\n]|//|/\\*)", + "beginCaptures": { + "1": { + "name": "keyword.operator.generic-constraint.conforms-to.swift" + } + }, + "patterns": [ + { + "contentName": "entity.other.inherited-class.swift", + "begin": "\\G\\s*", + "end": "(?=\\s*[,>{};\\n]|//|/\\*)", + "patterns": [ + { + "include": "#declarations-available-types" + } + ] + } + ] + } + ] + }, + "declarations-import": { + "name": "meta.import.swift", + "begin": "(?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k)", + "captures": { + "1": { + "name": "punctuation.definition.identifier.swift" + }, + "2": { + "name": "punctuation.definition.identifier.swift" + } + } + }, + { + "name": "entity.name.type.swift", + "match": "(?x)\n(?<=\\G|\\.)\n\\$[0-9]+" + }, + { + "name": "entity.name.type.swift", + "match": "(?x)\n(?<=\\G|\\.)\n(?:\n (\n (? # operator-head\n [/=\\-+!*%<>&|^~?]\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n )\n (\n \\g\n | (? # operator-character\n [\\x{0300}-\\x{036F}]\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n )*\n )\n | ( \\. ( \\g | \\g | \\. )+ ) # Dot operators\n)\n(?=\\.|;|$|//|/\\*|\\s)", + "captures": { + "1": { + "patterns": [ + { + "name": "invalid.illegal.dot-not-allowed-here.swift", + "match": "\\." + } + ] + } + } + }, + { + "name": "punctuation.separator.import.swift", + "match": "\\." + }, + { + "name": "invalid.illegal.character-not-allowed-here.swift", + "begin": "(?!\\s*(;|$|//|/\\*))", + "end": "(?=\\s*(;|$|//|/\\*))" + } + ] + } + ] + }, + "declarations-inheritance-clause": { + "name": "meta.inheritance-clause.swift", + "begin": "(:)(?=\\s*\\{)|(:)\\s*", + "end": "(?!\\G)$|(?=[={}]|(?!\\G)\\bwhere\\b)", + "beginCaptures": { + "1": { + "name": "invalid.illegal.empty-inheritance-clause.swift" + }, + "2": { + "name": "punctuation.separator.inheritance-clause.swift" + } + }, + "patterns": [ + { + "begin": "\\bclass\\b", + "end": "(?=[={}]|(?!\\G)\\bwhere\\b)", + "beginCaptures": { + "0": { + "name": "storage.type.class.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#declarations-inheritance-clause-more-types" + } + ] + }, + { + "begin": "\\G", + "end": "(?!\\G)$|(?=[={}]|(?!\\G)\\bwhere\\b)", + "patterns": [ + { + "include": "#attributes" + }, + { + "include": "#comments" + }, + { + "include": "#declarations-inheritance-clause-inherited-type" + }, + { + "include": "#declarations-inheritance-clause-more-types" + }, + { + "include": "#declarations-type-operators" + } + ] + } + ] + }, + "declarations-inheritance-clause-inherited-type": { + "name": "entity.other.inherited-class.swift", + "begin": "(?=[`\\p{L}_])", + "end": "(?!\\G)", + "patterns": [ + { + "include": "#declarations-type-identifier" + } + ] + }, + "declarations-inheritance-clause-more-types": { + "name": "meta.inheritance-list.more-types", + "begin": ",\\s*", + "end": "(?!\\G)(?!//|/\\*)|(?=[,={}]|(?!\\G)\\bwhere\\b)", + "patterns": [ + { + "include": "#attributes" + }, + { + "include": "#comments" + }, + { + "include": "#declarations-inheritance-clause-inherited-type" + }, + { + "include": "#declarations-inheritance-clause-more-types" + }, + { + "include": "#declarations-type-operators" + } + ] + }, + "declarations-macro": { + "name": "meta.definition.macro.swift", + "begin": "(?x)\n\\b\n(macro)\n\\s+\n((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))\n\\s*\n(?=\\(|<|=)", + "end": "$|(?=;|//|/\\*|\\}|=)", + "beginCaptures": { + "1": { + "name": "storage.type.function.swift" + }, + "2": { + "name": "entity.name.function.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.definition.identifier.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#declarations-generic-parameter-clause" + }, + { + "include": "#declarations-parameter-clause" + }, + { + "include": "#declarations-function-result" + }, + { + "include": "#async-throws" + }, + { + "comment": "Swift 3: generic constraints after the parameters and return type", + "include": "#declarations-generic-where-clause" + } + ] + }, + "declarations-operator": { + "name": "meta.definition.operator.swift", + "begin": "(?x)\n(?:\n \\b(prefix|infix|postfix)\n \\s+\n)?\n\\b\n(operator)\n\\s+\n(\n (\n (? # operator-head\n [/=\\-+!*%<>&|^~?]\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n )\n (\n \\g\n | \\. # Invalid dot\n | (? # operator-character\n [\\x{0300}-\\x{036F}]\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n )*+\n )\n | ( \\. ( \\g | \\g | \\. )++ ) # Dot operators\n)\n\\s*", + "end": "(;)|$\\n?|(?=//|/\\*)", + "beginCaptures": { + "1": { + "name": "storage.modifier.swift" + }, + "2": { + "name": "storage.type.function.operator.swift" + }, + "3": { + "name": "entity.name.function.operator.swift" + }, + "4": { + "comment": "workaround for https://github.com/microsoft/vscode-textmate/issues/140#issuecomment-1793610346", + "name": "entity.name.function.operator.swift", + "patterns": [ + { + "name": "invalid.illegal.dot-not-allowed-here.swift", + "match": "\\." + } + ] + } + }, + "endCaptures": { + "1": { + "name": "punctuation.terminator.statement.swift" + } + }, + "patterns": [ + { + "include": "#declarations-operator-swift2" + }, + { + "include": "#declarations-operator-swift3" + }, + { + "name": "invalid.illegal.character-not-allowed-here.swift", + "match": "((?!$|;|//|/\\*)\\S)+" + } + ] + }, + "declarations-operator-swift2": { + "begin": "\\G(\\{)", + "end": "(\\})", + "beginCaptures": { + "1": { + "name": "punctuation.definition.operator.begin.swift" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.operator.end.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "match": "\\b(associativity)\\s+(left|right)\\b", + "captures": { + "1": { + "name": "storage.modifier.swift" + }, + "2": { + "name": "keyword.other.operator.associativity.swift" + } + } + }, + { + "match": "\\b(precedence)\\s+([0-9]+)\\b", + "captures": { + "1": { + "name": "storage.modifier.swift" + }, + "2": { + "name": "constant.numeric.integer.swift" + } + } + }, + { + "match": "\\b(assignment)\\b", + "captures": { + "1": { + "name": "storage.modifier.swift" + } + } + } + ] + }, + "declarations-operator-swift3": { + "match": "\\G(:)\\s*((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))", + "captures": { + "2": { + "name": "entity.other.inherited-class.swift", + "patterns": [ + { + "include": "#declarations-types-precedencegroup" + } + ] + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.definition.identifier.swift" + } + } + }, + "declarations-parameter-clause": { + "name": "meta.parameter-clause.swift", + "begin": "(\\()", + "end": "(\\))(?:\\s*(async)\\b)?", + "beginCaptures": { + "1": { + "name": "punctuation.definition.parameters.begin.swift" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.parameters.end.swift" + }, + "2": { + "name": "storage.modifier.async.swift" + } + }, + "patterns": [ + { + "include": "#declarations-parameter-list" + } + ] + }, + "declarations-parameter-list": { + "patterns": [ + { + "comment": "External parameter labels are considered part of the function name", + "match": "((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))\\s+((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))(?=\\s*:)", + "captures": { + "1": { + "name": "entity.name.function.swift" + }, + "2": { + "name": "punctuation.definition.identifier.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "variable.parameter.function.swift" + }, + "5": { + "name": "punctuation.definition.identifier.swift" + }, + "6": { + "name": "punctuation.definition.identifier.swift" + } + } + }, + { + "comment": "If no external label is given, the name is both the external label and the internal variable name", + "match": "(((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k)))(?=\\s*:)", + "captures": { + "1": { + "name": "variable.parameter.function.swift" + }, + "2": { + "name": "entity.name.function.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.definition.identifier.swift" + } + } + }, + { + "begin": ":\\s*(?!\\s)", + "end": "(?=[,)])", + "patterns": [ + { + "name": "storage.modifier.swift", + "match": "\\bsending\\b" + }, + { + "include": "#declarations-available-types" + }, + { + "name": "invalid.illegal.extra-colon-in-parameter-list.swift", + "match": ":" + }, + { + "comment": "a parameter's default value", + "begin": "=", + "end": "(?=[,)])", + "beginCaptures": { + "0": { + "name": "keyword.operator.assignment.swift" + } + }, + "patterns": [ + { + "include": "#expressions" + } + ] + } + ] + } + ] + }, + "declarations-precedencegroup": { + "name": "meta.definition.precedencegroup.swift", + "begin": "\\b(precedencegroup)\\s+((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))\\s*(?=\\{)", + "end": "(?!\\G)", + "beginCaptures": { + "1": { + "name": "storage.type.precedencegroup.swift" + }, + "2": { + "name": "entity.name.type.precedencegroup.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.definition.identifier.swift" + } + }, + "patterns": [ + { + "begin": "\\{", + "end": "\\}", + "beginCaptures": { + "0": { + "name": "punctuation.definition.precedencegroup.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.precedencegroup.end.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "match": "\\b(higherThan|lowerThan)\\s*:\\s*((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))", + "captures": { + "1": { + "name": "storage.modifier.swift" + }, + "2": { + "name": "entity.other.inherited-class.swift", + "patterns": [ + { + "include": "#declarations-types-precedencegroup" + } + ] + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.definition.identifier.swift" + } + } + }, + { + "match": "\\b(associativity)\\b(?:\\s*:\\s*(right|left|none)\\b)?", + "captures": { + "1": { + "name": "storage.modifier.swift" + }, + "2": { + "name": "keyword.other.operator.associativity.swift" + } + } + }, + { + "match": "\\b(assignment)\\b(?:\\s*:\\s*(true|false)\\b)?", + "captures": { + "1": { + "name": "storage.modifier.swift" + }, + "2": { + "name": "constant.language.boolean.swift" + } + } + } + ] + } + ] + }, + "declarations-protocol": { + "name": "meta.definition.type.protocol.swift", + "begin": "\\b(protocol)\\s+((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))", + "end": "(?<=\\})", + "beginCaptures": { + "1": { + "name": "storage.type.$1.swift" + }, + "2": { + "name": "entity.name.type.$1.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.definition.identifier.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#declarations-inheritance-clause" + }, + { + "comment": "SE-0142: Permit where clauses to constrain associated types", + "include": "#declarations-generic-where-clause" + }, + { + "name": "meta.definition.type.body.swift", + "begin": "\\{", + "end": "\\}", + "beginCaptures": { + "0": { + "name": "punctuation.definition.type.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.type.end.swift" + } + }, + "patterns": [ + { + "include": "#declarations-protocol-protocol-method" + }, + { + "include": "#declarations-protocol-protocol-initializer" + }, + { + "include": "#declarations-protocol-associated-type" + }, + { + "include": "$self" + } + ] + } + ] + }, + "declarations-protocol-associated-type": { + "name": "meta.definition.associatedtype.swift", + "begin": "\\b(associatedtype)\\s+((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))\\s*", + "end": "(?!\\G)$|(?=[;}]|$)", + "beginCaptures": { + "1": { + "name": "keyword.other.declaration-specifier.swift" + }, + "2": { + "name": "variable.language.associatedtype.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.definition.identifier.swift" + } + }, + "patterns": [ + { + "include": "#declarations-inheritance-clause" + }, + { + "comment": "SE-0142: Permit where clauses to constrain associated types", + "include": "#declarations-generic-where-clause" + }, + { + "include": "#declarations-typealias-assignment" + } + ] + }, + "declarations-protocol-protocol-initializer": { + "name": "meta.definition.function.initializer.swift", + "begin": "(?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k)\n | (?:\n (\n (? # operator-head\n [/=\\-+!*%<>&|^~?]\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n )\n (\n \\g\n | (? # operator-character\n [\\x{0300}-\\x{036F}]\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n )*\n )\n | ( \\. ( \\g | \\g | \\. )+ ) # Dot operators\n )\n )\n\\s*\n(?=\\(|<)", + "end": "$|(?=;|//|/\\*|\\})", + "beginCaptures": { + "1": { + "name": "storage.type.function.swift" + }, + "2": { + "name": "entity.name.function.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.definition.identifier.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#declarations-generic-parameter-clause" + }, + { + "include": "#declarations-parameter-clause" + }, + { + "include": "#declarations-function-result" + }, + { + "include": "#async-throws" + }, + { + "comment": "Swift 3: generic constraints after the parameters and return type", + "include": "#declarations-generic-where-clause" + }, + { + "name": "invalid.illegal.function-body-not-allowed-in-protocol.swift", + "begin": "\\{", + "end": "\\}", + "beginCaptures": { + "0": { + "name": "punctuation.section.function.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.function.end.swift" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + } + ] + }, + "declarations-type": { + "patterns": [ + { + "name": "meta.definition.type.$1.swift", + "begin": "\\b(class(?!\\s+(?:func|var|let)\\b)|struct|actor)\\b\\s*((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))", + "end": "(?<=\\})", + "beginCaptures": { + "1": { + "name": "storage.type.$1.swift" + }, + "2": { + "name": "entity.name.type.$1.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.definition.identifier.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#declarations-generic-parameter-clause" + }, + { + "comment": "Swift 3: generic constraints after the generic param list", + "include": "#declarations-generic-where-clause" + }, + { + "include": "#declarations-inheritance-clause" + }, + { + "name": "meta.definition.type.body.swift", + "begin": "\\{", + "end": "\\}", + "beginCaptures": { + "0": { + "name": "punctuation.definition.type.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.type.end.swift" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + } + ] + }, + { + "include": "#declarations-type-enum" + } + ] + }, + "declarations-type-enum": { + "name": "meta.definition.type.$1.swift", + "begin": "\\b(enum)\\s+((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))", + "end": "(?<=\\})", + "beginCaptures": { + "1": { + "name": "storage.type.$1.swift" + }, + "2": { + "name": "entity.name.type.$1.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.definition.identifier.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#declarations-generic-parameter-clause" + }, + { + "comment": "Swift 3: generic constraints after the generic param list", + "include": "#declarations-generic-where-clause" + }, + { + "include": "#declarations-inheritance-clause" + }, + { + "name": "meta.definition.type.body.swift", + "begin": "\\{", + "end": "\\}", + "beginCaptures": { + "0": { + "name": "punctuation.definition.type.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.type.end.swift" + } + }, + "patterns": [ + { + "include": "#declarations-type-enum-enum-case-clause" + }, + { + "include": "$self" + } + ] + } + ] + }, + "declarations-type-enum-associated-values": { + "begin": "\\G\\(", + "end": "\\)", + "beginCaptures": { + "0": { + "name": "punctuation.definition.parameters.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.end.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "begin": "(?x)\n(?:(_)|((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*\\k))\n\\s+\n(((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*\\k))\n\\s*(:)", + "end": "(?=[,)\\]])", + "beginCaptures": { + "1": { + "name": "entity.name.function.swift" + }, + "2": { + "name": "invalid.illegal.distinct-labels-not-allowed.swift" + }, + "5": { + "name": "variable.parameter.function.swift" + }, + "7": { + "name": "punctuation.separator.argument-label.swift" + } + }, + "patterns": [ + { + "include": "#declarations-available-types" + } + ] + }, + { + "begin": "(((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*\\k))\\s*(:)", + "end": "(?=[,)\\]])", + "beginCaptures": { + "1": { + "name": "entity.name.function.swift" + }, + "2": { + "name": "variable.parameter.function.swift" + }, + "4": { + "name": "punctuation.separator.argument-label.swift" + } + }, + "patterns": [ + { + "include": "#declarations-available-types" + } + ] + }, + { + "comment": "an element without a label (i.e. anything else)", + "begin": "(?![,)\\]])(?=\\S)", + "end": "(?=[,)\\]])", + "patterns": [ + { + "include": "#declarations-available-types" + }, + { + "name": "invalid.illegal.extra-colon-in-parameter-list.swift", + "match": ":" + } + ] + } + ] + }, + "declarations-type-enum-enum-case": { + "begin": "(?x)((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))\\s*", + "end": "(?<=\\))|(?![=(])", + "beginCaptures": { + "1": { + "name": "variable.other.enummember.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#declarations-type-enum-associated-values" + }, + { + "include": "#declarations-type-enum-raw-value-assignment" + } + ] + }, + "declarations-type-enum-enum-case-clause": { + "begin": "\\b(case)\\b\\s*", + "end": "(?=[;}])|(?!\\G)(?!//|/\\*)(?=[^\\s,])", + "beginCaptures": { + "1": { + "name": "storage.type.enum.case.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#declarations-type-enum-enum-case" + }, + { + "include": "#declarations-type-enum-more-cases" + } + ] + }, + "declarations-type-enum-more-cases": { + "name": "meta.enum-case.more-cases", + "begin": ",\\s*", + "end": "(?!\\G)(?!//|/\\*)(?=[;}]|[^\\s,])", + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#declarations-type-enum-enum-case" + }, + { + "include": "#declarations-type-enum-more-cases" + } + ] + }, + "declarations-type-enum-raw-value-assignment": { + "begin": "(=)\\s*", + "end": "(?!\\G)", + "beginCaptures": { + "1": { + "name": "keyword.operator.assignment.swift" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#literals" + } + ] + }, + "declarations-type-identifier": { + "begin": "((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))\\s*", + "end": "(?!<)", + "beginCaptures": { + "1": { + "name": "meta.type-name.swift", + "patterns": [ + { + "include": "#builtin-types" + } + ] + }, + "2": { + "name": "punctuation.definition.identifier.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + } + }, + "patterns": [ + { + "begin": "(?=<)", + "end": "(?!\\G)", + "patterns": [ + { + "include": "#declarations-generic-argument-clause" + } + ] + } + ] + }, + "declarations-type-operators": { + "patterns": [ + { + "comment": "Swift 3: A & B", + "match": "(?&|\\^~.])(&)(?![/=\\-+!*%<>&|\\^~.])", + "captures": { + "1": { + "name": "keyword.operator.type.composition.swift" + } + } + }, + { + "comment": "SE-0390: Noncopyable structs and enums", + "match": "(?&|\\^~.])(~)(?![/=\\-+!*%<>&|\\^~.])", + "captures": { + "1": { + "name": "keyword.operator.type.requirement-suppression.swift" + } + } + } + ] + }, + "declarations-typealias": { + "name": "meta.definition.typealias.swift", + "begin": "\\b(typealias)\\s+((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))\\s*", + "end": "(?!\\G)$|(?=;|//|/\\*|$)", + "beginCaptures": { + "1": { + "name": "keyword.other.declaration-specifier.swift" + }, + "2": { + "name": "entity.name.type.typealias.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.definition.identifier.swift" + } + }, + "patterns": [ + { + "begin": "\\G(?=<)", + "end": "(?!\\G)", + "patterns": [ + { + "include": "#declarations-generic-parameter-clause" + } + ] + }, + { + "include": "#declarations-typealias-assignment" + } + ] + }, + "declarations-typealias-assignment": { + "begin": "(=)\\s*", + "end": "(?!\\G)$|(?=;|//|/\\*|$)", + "beginCaptures": { + "1": { + "name": "keyword.operator.assignment.swift" + } + }, + "patterns": [ + { + "include": "#declarations-available-types" + } + ] + }, + "declarations-typed-variable-declaration": { + "begin": "(?x)\n\\b(?:(async)\\s+)?(let|var)\\b\\s+\n(?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k)\\s*\n:", + "end": "(?=$|[={])", + "beginCaptures": { + "1": { + "name": "storage.modifier.async.swift" + }, + "2": { + "name": "keyword.other.declaration-specifier.swift" + } + }, + "patterns": [ + { + "include": "#declarations-available-types" + } + ] + }, + "declarations-types-precedencegroup": { + "patterns": [ + { + "comment": "Precedence groups in the standard library", + "name": "support.type.swift", + "match": "\\b(?:BitwiseShift|Assignment|RangeFormation|Casting|Addition|NilCoalescing|Comparison|LogicalConjunction|LogicalDisjunction|Default|Ternary|Multiplication|FunctionArrow)Precedence\\b" + } + ] + }, + "expressions": { + "comment": "trailing closures need to be parsed before other member references", + "patterns": [ + { + "include": "#expressions-without-trailing-closures-or-member-references" + }, + { + "include": "#expressions-trailing-closure" + }, + { + "include": "#member-reference" + } + ] + }, + "expressions-trailing-closure": { + "patterns": [ + { + "comment": "foo { body } -- a call with a trailing closure and no argument clause", + "name": "meta.function-call.trailing-closure-only.swift", + "match": "(#?(?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))(?=\\s*\\{)", + "captures": { + "1": { + "name": "support.function.any-method.swift" + }, + "2": { + "name": "punctuation.definition.identifier.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + } + } + }, + { + "comment": "foo: { body } -- labeled-trailing-closure (SE-0279)", + "match": "((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))\\s*(:)(?=\\s*\\{)", + "captures": { + "1": { + "name": "support.function.any-method.trailing-closure-label.swift" + }, + "2": { + "name": "punctuation.definition.identifier.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.separator.argument-label.swift" + } + } + } + ] + }, + "expressions-without-trailing-closures": { + "patterns": [ + { + "include": "#expressions-without-trailing-closures-or-member-references" + }, + { + "include": "#member-references" + } + ] + }, + "expressions-without-trailing-closures-or-member-references": { + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#code-block" + }, + { + "include": "#attributes" + }, + { + "include": "#expressions-without-trailing-closures-or-member-references-closure-parameter" + }, + { + "include": "#literals" + }, + { + "include": "#operators" + }, + { + "include": "#builtin-types" + }, + { + "include": "#builtin-functions" + }, + { + "include": "#builtin-global-functions" + }, + { + "include": "#builtin-properties" + }, + { + "include": "#expressions-without-trailing-closures-or-member-references-compound-name" + }, + { + "include": "#conditionals" + }, + { + "include": "#keywords" + }, + { + "include": "#expressions-without-trailing-closures-or-member-references-availability-condition" + }, + { + "include": "#expressions-without-trailing-closures-or-member-references-function-or-macro-call-expression" + }, + { + "include": "#expressions-without-trailing-closures-or-member-references-macro-expansion" + }, + { + "include": "#expressions-without-trailing-closures-or-member-references-subscript-expression" + }, + { + "include": "#expressions-without-trailing-closures-or-member-references-parenthesized-expression" + }, + { + "name": "support.variable.discard-value.swift", + "match": "\\b_\\b" + } + ] + }, + "expressions-without-trailing-closures-or-member-references-availability-condition": { + "begin": "\\B(#(?:un)?available)(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "support.function.availability-condition.swift" + }, + "2": { + "name": "punctuation.definition.arguments.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.swift" + } + }, + "patterns": [ + { + "match": "\\s*\\b((?:iOS|macOS|OSX|watchOS|tvOS|visionOS|UIKitForMac)(?:ApplicationExtension)?)\\b(?:\\s+([0-9]+(?:\\.[0-9]+)*\\b))", + "captures": { + "1": { + "name": "keyword.other.platform.os.swift" + }, + "2": { + "name": "constant.numeric.swift" + } + } + }, + { + "match": "(\\*)\\s*(.*?)(?=[,)])", + "captures": { + "1": { + "name": "keyword.other.platform.all.swift" + }, + "2": { + "name": "invalid.illegal.character-not-allowed-here.swift" + } + } + }, + { + "name": "invalid.illegal.character-not-allowed-here.swift", + "match": "[^\\s,)]+" + } + ] + }, + "expressions-without-trailing-closures-or-member-references-closure-parameter": { + "name": "variable.language.closure-parameter.swift", + "match": "\\$[0-9]+" + }, + "expressions-without-trailing-closures-or-member-references-compound-name": { + "comment": "a reference to a function with disambiguating argument labels, such as foo(_:), foo(bar:), etc.", + "match": "(?x)\n((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k)) # function name\n\\(\n (\n (\n ((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k)) # argument label\n : # colon\n )+\n )\n\\)", + "captures": { + "1": { + "name": "entity.name.function.compound-name.swift" + }, + "2": { + "name": "punctuation.definition.entity.swift" + }, + "3": { + "name": "punctuation.definition.entity.swift" + }, + "4": { + "patterns": [ + { + "name": "entity.name.function.compound-name.swift", + "match": "(?`?)(?!_:)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k):", + "captures": { + "1": { + "name": "punctuation.definition.entity.swift" + }, + "2": { + "name": "punctuation.definition.entity.swift" + } + } + } + ] + } + } + }, + "expressions-without-trailing-closures-or-member-references-expression-element-list": { + "patterns": [ + { + "include": "#comments" + }, + { + "comment": "an element with a label", + "begin": "((?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))\\s*(:)", + "end": "(?=[,)\\]])", + "beginCaptures": { + "1": { + "name": "support.function.any-method.swift" + }, + "2": { + "name": "punctuation.definition.identifier.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.separator.argument-label.swift" + } + }, + "patterns": [ + { + "include": "#expressions" + } + ] + }, + { + "comment": "an element without a label (i.e. anything else)", + "begin": "(?![,)\\]])(?=\\S)", + "end": "(?=[,)\\]])", + "patterns": [ + { + "include": "#expressions" + } + ] + } + ] + }, + "expressions-without-trailing-closures-or-member-references-function-or-macro-call-expression": { + "patterns": [ + { + "comment": "foo(args) -- a call whose callee is a highlightable name", + "name": "meta.function-call.swift", + "begin": "(#?(?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))\\s*(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "support.function.any-method.swift" + }, + "2": { + "name": "punctuation.definition.identifier.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + }, + "4": { + "name": "punctuation.definition.arguments.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.swift" + } + }, + "patterns": [ + { + "include": "#expressions-without-trailing-closures-or-member-references-expression-element-list" + } + ] + }, + { + "comment": "[Int](args) -- a call whose callee is a more complicated expression", + "name": "meta.function-call.swift", + "begin": "(?<=[`\\])}>\\p{L}_\\p{N}\\p{M}])\\s*(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.arguments.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.swift" + } + }, + "patterns": [ + { + "include": "#expressions-without-trailing-closures-or-member-references-expression-element-list" + } + ] + } + ] + }, + "expressions-without-trailing-closures-or-member-references-macro-expansion": { + "name": "support.function.any-method.swift", + "match": "(#(?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))" + }, + "expressions-without-trailing-closures-or-member-references-parenthesized-expression": { + "comment": "correctly matching closure expressions is too hard (depends on trailing \"in\") so we just tack on some basics to the end of parenthesized-expression", + "begin": "\\(", + "end": "(\\))\\s*((?:\\b(?:async|throws|rethrows)\\s)*)", + "beginCaptures": { + "0": { + "name": "punctuation.section.tuple.begin.swift" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.section.tuple.end.swift" + }, + "2": { + "patterns": [ + { + "name": "invalid.illegal.rethrows-only-allowed-on-function-declarations.swift", + "match": "\\brethrows\\b" + }, + { + "include": "#async-throws" + } + ] + } + }, + "patterns": [ + { + "include": "#expressions-without-trailing-closures-or-member-references-expression-element-list" + } + ] + }, + "expressions-without-trailing-closures-or-member-references-subscript-expression": { + "name": "meta.subscript-expression.swift", + "begin": "(?<=[`\\p{L}_\\p{N}\\p{M}])\\s*(\\[)", + "end": "\\]", + "beginCaptures": { + "1": { + "name": "punctuation.definition.arguments.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.swift" + } + }, + "patterns": [ + { + "include": "#expressions-without-trailing-closures-or-member-references-expression-element-list" + } + ] + }, + "keywords": { + "patterns": [ + { + "name": "keyword.control.branch.swift", + "match": "(?\n (?> # no backtracking, avoids issues with negative lookbehind at end\n (?:\n \\\\Q\n (?:(?!\\\\E)(?!/).)*+\n # A quoted sequence may not have a closing E, in which case it extends to the end of the regex\n (?:\\\\E | (?=/))\n | \\\\.\n | \\(\\?\\#[^)]*\\)\n | \\(\\?\n # InterpolatedCallout\n (?>\n {[^{].*?}\n | {{[^{].*?}}\n | {{{[^{].*?}}}\n | {{{{[^{].*?}}}}\n | {{{{{[^{].*?}}}}}\n | {{{{{{.+?}}}}}}\n )\n (?:\\[(?!\\d)\\w+\\])?\n [X<>]?\n \\)\n # Allow nested character classes to a limited depth\n | \\[(?:\n \\\\. |\n [^\\[\\]\\\\] |\n \\[(?:\n \\\\. |\n [^\\[\\]\\\\] |\n \\[(?:\n \\\\. |\n [^\\[\\]\\\\] |\n \\[(?:\n \\\\. |\n [^\\[\\]\\\\]\n )+\\]\n )+\\]\n )+\\]\n )+\\]\n | \\(\\g?+\\)\n | (?:(?!/)[^()\\[\\\\])+ # any character (until end)\n )+\n )\n )?+\n (?\n (?> # no backtracking, avoids issues with negative lookbehind at end\n (?:\n \\\\Q\n (?:(?!\\\\E)(?!/\\2).)*+\n # A quoted sequence may not have a closing E, in which case it extends to the end of the regex\n (?:\\\\E | (?=/\\2))\n | \\\\.\n | \\(\\?\\#[^)]*\\)\n | \\(\\?\n # InterpolatedCallout\n (?>\n {[^{].*?}\n | {{[^{].*?}}\n | {{{[^{].*?}}}\n | {{{{[^{].*?}}}}\n | {{{{{[^{].*?}}}}}\n | {{{{{{.+?}}}}}}\n )\n (?:\\[(?!\\d)\\w+\\])?\n [X<>]?\n \\)\n # Allow nested character classes to a limited depth\n | \\[(?:\n \\\\. |\n [^\\[\\]\\\\] |\n \\[(?:\n \\\\. |\n [^\\[\\]\\\\] |\n \\[(?:\n \\\\. |\n [^\\[\\]\\\\] |\n \\[(?:\n \\\\. |\n [^\\[\\]\\\\]\n )+\\]\n )+\\]\n )+\\]\n )+\\]\n | \\(\\g?+\\)\n | (?:(?!/\\2)[^()\\[\\\\])+ # any character (until end)\n )+\n )\n)?+\n(/\\2) # (4)\n| \\#+/.+(\\n)", + "captures": { + "0": { + "patterns": [ + { + "include": "#literals-regular-expression-literal-regex-guts" + } + ] + }, + "1": { + "name": "punctuation.definition.string.begin.regexp.swift" + }, + "4": { + "name": "punctuation.definition.string.end.regexp.swift" + }, + "5": { + "name": "invalid.illegal.returns-not-allowed.regexp" + } + } + } + ] + }, + "literals-regular-expression-literal-backreference-or-subpattern": { + "comment": "These patterns are separated to work around issues like https://github.com/microsoft/vscode-textmate/issues/164", + "patterns": [ + { + "comment": "'\\g{' NamedOrNumberRef '}'", + "match": "(?x)(\\\\g\\{) (?: ((?!\\d)\\w+) (?:([+-])(\\d+))? | ([+-]?\\d+) (?:([+-])(\\d+))? ) (\\})", + "captures": { + "1": { + "name": "constant.character.escape.backslash.regexp" + }, + "2": { + "name": "variable.other.group-name.regexp" + }, + "3": { + "name": "keyword.operator.recursion-level.regexp" + }, + "4": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "5": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "6": { + "name": "keyword.operator.recursion-level.regexp" + }, + "7": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "8": { + "name": "constant.character.escape.backslash.regexp" + } + } + }, + { + "comment": "'\\g' NumberRef", + "match": "(?x)(\\\\g) ([+-]?\\d+) (?:([+-])(\\d+))?", + "captures": { + "1": { + "name": "constant.character.escape.backslash.regexp" + }, + "2": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "3": { + "name": "keyword.operator.recursion-level.regexp" + }, + "4": { + "name": "constant.numeric.integer.decimal.regexp" + } + } + }, + { + "comment": "'\\k<' NamedOrNumberRef '>'\n '\\g<' NamedOrNumberRef '>'", + "match": "(?x)(\\\\[gk]<) (?: ((?!\\d)\\w+) (?:([+-])(\\d+))? | ([+-]?\\d+) (?:([+-])(\\d+))? ) (>)", + "captures": { + "1": { + "name": "constant.character.escape.backslash.regexp" + }, + "2": { + "name": "variable.other.group-name.regexp" + }, + "3": { + "name": "keyword.operator.recursion-level.regexp" + }, + "4": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "5": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "6": { + "name": "keyword.operator.recursion-level.regexp" + }, + "7": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "8": { + "name": "constant.character.escape.backslash.regexp" + } + } + }, + { + "comment": "\"\\k'\" NamedOrNumberRef \"'\"\n \"\\g'\" NamedOrNumberRef \"'\"", + "match": "(?x)(\\\\[gk]') (?: ((?!\\d)\\w+) (?:([+-])(\\d+))? | ([+-]?\\d+) (?:([+-])(\\d+))? ) (')", + "captures": { + "1": { + "name": "constant.character.escape.backslash.regexp" + }, + "2": { + "name": "variable.other.group-name.regexp" + }, + "3": { + "name": "keyword.operator.recursion-level.regexp" + }, + "4": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "5": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "6": { + "name": "keyword.operator.recursion-level.regexp" + }, + "7": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "8": { + "name": "constant.character.escape.backslash.regexp" + } + } + }, + { + "comment": "'\\k{' NamedRef '}'", + "match": "(?x)(\\\\k\\{) ((?!\\d)\\w+) (?:([+-])(\\d+))? (\\})", + "captures": { + "1": { + "name": "constant.character.escape.backslash.regexp" + }, + "2": { + "name": "variable.other.group-name.regexp" + }, + "3": { + "name": "keyword.operator.recursion-level.regexp" + }, + "4": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "5": { + "name": "constant.character.escape.backslash.regexp" + } + } + }, + { + "name": "keyword.other.back-reference.regexp", + "match": "\\\\[1-9][0-9]+" + }, + { + "comment": "'(?P=' NamedRef ')'", + "match": "(?x)(\\(\\?(?:P[=>]|&)) ((?!\\d)\\w+) (?:([+-])(\\d+))? (\\))", + "captures": { + "1": { + "name": "keyword.other.back-reference.regexp" + }, + "2": { + "name": "variable.other.group-name.regexp" + }, + "3": { + "name": "keyword.operator.recursion-level.regexp" + }, + "4": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "5": { + "name": "keyword.other.back-reference.regexp" + } + } + }, + { + "name": "keyword.other.back-reference.regexp", + "match": "\\(\\?R\\)" + }, + { + "comment": "'(?' NumberRef ')'", + "match": "(?x)(\\(\\?) ([+-]?\\d+) (?:([+-])(\\d+))? (\\))", + "captures": { + "1": { + "name": "keyword.other.back-reference.regexp" + }, + "2": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "3": { + "name": "keyword.operator.recursion-level.regexp" + }, + "4": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "5": { + "name": "keyword.other.back-reference.regexp" + } + } + } + ] + }, + "literals-regular-expression-literal-backtracking-directive-or-global-matching-option": { + "match": "(?x)\n(\\(\\*)\n(?:\n (ACCEPT|FAIL|F|MARK(?=:)|(?=:)|COMMIT|PRUNE|SKIP|THEN)\n (?:(:)([^)]+))?\n | (?:(LIMIT_(?:DEPTH|HEAP|MATCH))(=)(\\d+))\n | (\n CRLF | CR | ANYCRLF | ANY | LF | NUL\n | BSR_ANYCRLF | BSR_UNICODE\n | NOTEMPTY_ATSTART | NOTEMPTY\n | NO_AUTO_POSSESS | NO_DOTSTAR_ANCHOR\n | NO_JIT | NO_START_OPT | UTF | UCP\n )\n)\n(\\))", + "captures": { + "1": { + "name": "keyword.control.directive.regexp" + }, + "2": { + "name": "keyword.control.directive.regexp" + }, + "3": { + "name": "keyword.control.directive.regexp" + }, + "4": { + "name": "variable.language.tag.regexp" + }, + "5": { + "name": "keyword.control.directive.regexp" + }, + "6": { + "name": "keyword.operator.assignment.regexp" + }, + "7": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "8": { + "name": "keyword.control.directive.regexp" + }, + "9": { + "name": "keyword.control.directive.regexp" + } + } + }, + "literals-regular-expression-literal-callout": { + "name": "meta.callout.regexp", + "match": "(?x)\n# PCRECallout\n(\\()(?\\?C)\n (?:\n (?\\d+)\n | `(?(?:[^`]|``)*)`\n | '(?(?:[^']|'')*)'\n | \"(?(?:[^\"]|\"\")*)\"\n | \\^(?(?:[^\\^]|\\^\\^)*)\\^\n | %(?(?:[^%]|%%)*)%\n | \\#(?(?:[^#]|\\#\\#)*)\\#\n | \\$(?(?:[^$]|\\$\\$)*)\\$\n | \\{(?(?:[^}]|\\}\\})*)\\}\n )?\n(\\))\n# NamedCallout\n| (\\()(?\\*)\n (?(?!\\d)\\w+)\n (?:\\[(?(?!\\d)\\w+)\\])?\n (?:\\{ [^,}]+ (?:,[^,}]+)* \\})?\n (\\))\n# InterpolatedCallout\n| (\\()(?\\?)\n (?>(\\{(?:\\g<-1>|(?!{).*?)\\}))\n (?:\\[(?(?!\\d)\\w+)\\])?\n (?[X<>]?)\n (\\))", + "captures": { + "1": { + "name": "punctuation.definition.group.regexp" + }, + "2": { + "name": "keyword.control.callout.regexp" + }, + "3": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "4": { + "name": "entity.name.function.callout.regexp" + }, + "5": { + "name": "entity.name.function.callout.regexp" + }, + "6": { + "name": "entity.name.function.callout.regexp" + }, + "7": { + "name": "entity.name.function.callout.regexp" + }, + "8": { + "name": "entity.name.function.callout.regexp" + }, + "9": { + "name": "entity.name.function.callout.regexp" + }, + "10": { + "name": "entity.name.function.callout.regexp" + }, + "11": { + "name": "entity.name.function.callout.regexp" + }, + "12": { + "name": "punctuation.definition.group.regexp" + }, + "13": { + "name": "punctuation.definition.group.regexp" + }, + "14": { + "name": "keyword.control.callout.regexp" + }, + "15": { + "name": "entity.name.function.callout.regexp" + }, + "16": { + "name": "variable.language.tag-name.regexp" + }, + "17": { + "name": "punctuation.definition.group.regexp" + }, + "18": { + "name": "punctuation.definition.group.regexp" + }, + "19": { + "name": "keyword.control.callout.regexp" + }, + "21": { + "name": "variable.language.tag-name.regexp" + }, + "22": { + "name": "keyword.control.callout.regexp" + }, + "23": { + "name": "punctuation.definition.group.regexp" + } + } + }, + "literals-regular-expression-literal-character-properties": { + "name": "constant.other.character-class.set.regexp", + "match": "(?x)\n\\\\[pP]\\{ ([\\s\\w-]+(?:=[\\s\\w-]+)?) \\}\n| (\\[:) ([\\s\\w-]+(?:=[\\s\\w-]+)?) (:\\])", + "captures": { + "1": { + "name": "support.variable.character-property.regexp" + }, + "2": { + "name": "punctuation.definition.character-class.regexp" + }, + "3": { + "name": "support.variable.character-property.regexp" + }, + "4": { + "name": "punctuation.definition.character-class.regexp" + } + } + }, + "literals-regular-expression-literal-custom-char-class": { + "patterns": [ + { + "name": "constant.other.character-class.set.regexp", + "begin": "(\\[)(\\^)?", + "end": "\\]", + "beginCaptures": { + "1": { + "name": "punctuation.definition.character-class.regexp" + }, + "2": { + "name": "keyword.operator.negation.regexp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.character-class.regexp" + } + }, + "patterns": [ + { + "include": "#literals-regular-expression-literal-custom-char-class-members" + } + ] + } + ] + }, + "literals-regular-expression-literal-custom-char-class-members": { + "comment": "TODO: should also include atoms?", + "patterns": [ + { + "comment": "\\b inside a character class represents a backspace", + "name": "constant.character.escape.backslash.regexp", + "match": "\\\\b" + }, + { + "include": "#literals-regular-expression-literal-custom-char-class" + }, + { + "include": "#literals-regular-expression-literal-quote" + }, + { + "include": "#literals-regular-expression-literal-set-operators" + }, + { + "include": "#literals-regular-expression-literal-unicode-scalars" + }, + { + "include": "#literals-regular-expression-literal-character-properties" + } + ] + }, + "literals-regular-expression-literal-group-option-toggle": { + "comment": "A matching option sequence may be part of an \"isolated group\" which has an implicit scope that wraps the remaining elements of the current group", + "name": "keyword.other.option-toggle.regexp", + "match": "(?x)\n\\(\\?\n(?:\n \\^(?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})*\n | (?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})+\n | (?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})* - (?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})*\n)\n\\)" + }, + "literals-regular-expression-literal-group-or-conditional": { + "patterns": [ + { + "name": "meta.group.absent.regexp", + "begin": "(\\()(\\?~)", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.group.regexp" + }, + "2": { + "name": "keyword.control.conditional.absent.regexp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.group.regexp" + } + }, + "patterns": [ + { + "include": "#literals-regular-expression-literal-regex-guts" + } + ] + }, + { + "name": "meta.group.conditional.regexp", + "begin": "(?x)\n# KnownConditionalStart\n(\\() (?\\?\\()\n (?:\n (? (?[+-]?\\d+)(?:(?[+-])(?\\d+))? )\n | (?R) \\g?\n | (?R&) (? (?(?!\\d)\\w+) (?:(?[+-])(?\\d+))? )\n | (?<) (?:\\g|\\g) (?>)\n | (?') (?:\\g|\\g) (?')\n | (?DEFINE)\n | (?VERSION)(?>?=)(?\\d+\\.\\d+)\n )\n(?\\))\n| (\\()(?\\?)(?=\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.group.regexp" + }, + "2": { + "name": "keyword.control.conditional.regexp" + }, + "4": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "5": { + "name": "keyword.operator.recursion-level.regexp" + }, + "6": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "7": { + "name": "keyword.control.conditional.regexp" + }, + "8": { + "name": "keyword.control.conditional.regexp" + }, + "10": { + "name": "variable.other.group-name.regexp" + }, + "11": { + "name": "keyword.operator.recursion-level.regexp" + }, + "12": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "13": { + "name": "keyword.control.conditional.regexp" + }, + "14": { + "name": "keyword.control.conditional.regexp" + }, + "15": { + "name": "keyword.control.conditional.regexp" + }, + "16": { + "name": "keyword.control.conditional.regexp" + }, + "17": { + "name": "keyword.control.conditional.regexp" + }, + "18": { + "name": "keyword.control.conditional.regexp" + }, + "19": { + "name": "keyword.operator.comparison.regexp" + }, + "20": { + "name": "constant.numeric.integer.decimal.regexp" + }, + "21": { + "name": "keyword.control.conditional.regexp" + }, + "22": { + "name": "punctuation.definition.group.regexp" + }, + "23": { + "name": "keyword.control.conditional.regexp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.group.regexp" + } + }, + "patterns": [ + { + "include": "#literals-regular-expression-literal-regex-guts" + } + ] + }, + { + "name": "meta.group.regexp", + "begin": "(?x)\n(\\()\n(\n # BasicGroupKind\n (\\?)\n (?:\n ([:|>=!*] | <[=!*])\n # named groups\n | P?< (?:((?!\\d)\\w+) (-))? ((?!\\d)\\w+) >\n | ' (?:((?!\\d)\\w+) (-))? ((?!\\d)\\w+) '\n # matching options\n | (?:\n \\^(?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})*\n | (?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})+\n | (?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})* - (?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})*\n ): # case without : is handled by group-option-toggle\n )\n # PCRE2GroupKind\n | \\*(\n atomic\n |pla|positive_lookahead\n |nla|negative_lookahead\n |plb|positive_lookbehind\n |nlb|negative_lookbehind\n |napla|non_atomic_positive_lookahead\n |naplb|non_atomic_positive_lookbehind\n |sr|script_run\n |asr|atomic_script_run\n ):\n)?+", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.group.regexp" + }, + "2": { + "name": "keyword.other.group-options.regexp" + }, + "3": { + "name": "punctuation.definition.group.regexp" + }, + "4": { + "name": "punctuation.definition.group.regexp" + }, + "5": { + "name": "variable.other.group-name.regexp" + }, + "6": { + "name": "keyword.operator.balancing-group.regexp" + }, + "7": { + "name": "variable.other.group-name.regexp" + }, + "8": { + "name": "variable.other.group-name.regexp" + }, + "9": { + "name": "keyword.operator.balancing-group.regexp" + }, + "10": { + "name": "variable.other.group-name.regexp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.group.regexp" + } + }, + "patterns": [ + { + "include": "#literals-regular-expression-literal-regex-guts" + } + ] + } + ] + }, + "literals-regular-expression-literal-line-comment": { + "name": "comment.line.regexp", + "match": "(\\#).*$", + "captures": { + "1": { + "name": "punctuation.definition.comment.regexp" + } + } + }, + "literals-regular-expression-literal-quote": { + "name": "string.quoted.other.regexp.swift", + "begin": "\\\\Q", + "end": "\\\\E|(\\n)", + "beginCaptures": { + "0": { + "name": "constant.character.escape.backslash.regexp" + } + }, + "endCaptures": { + "0": { + "name": "constant.character.escape.backslash.regexp" + }, + "1": { + "name": "invalid.illegal.returns-not-allowed.regexp" + } + } + }, + "literals-regular-expression-literal-regex-guts": { + "patterns": [ + { + "include": "#literals-regular-expression-literal-quote" + }, + { + "name": "comment.block.regexp", + "begin": "\\(\\?\\#", + "end": "\\)", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.begin.regexp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.end.regexp" + } + } + }, + { + "name": "meta.embedded.expression.regexp", + "begin": "<\\{", + "end": "\\}>", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.regexp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.regexp" + } + } + }, + { + "include": "#literals-regular-expression-literal-unicode-scalars" + }, + { + "include": "#literals-regular-expression-literal-character-properties" + }, + { + "name": "keyword.control.anchor.regexp", + "match": "[$^]|\\\\[AbBGyYzZ]|\\\\K" + }, + { + "include": "#literals-regular-expression-literal-backtracking-directive-or-global-matching-option" + }, + { + "include": "#literals-regular-expression-literal-callout" + }, + { + "include": "#literals-regular-expression-literal-backreference-or-subpattern" + }, + { + "name": "constant.character.character-class.regexp", + "match": "\\.|\\\\[CdDhHNORsSvVwWX]" + }, + { + "name": "constant.character.entity.control-character.regexp", + "match": "\\\\c." + }, + { + "name": "constant.character.escape.backslash.regexp", + "match": "\\\\[^c]" + }, + { + "name": "keyword.operator.or.regexp", + "match": "\\|" + }, + { + "name": "keyword.operator.quantifier.regexp", + "match": "[*+?]" + }, + { + "name": "keyword.operator.quantifier.regexp", + "match": "\\{\\s*\\d+\\s*(?:,\\s*\\d*\\s*)?\\}|\\{\\s*,\\s*\\d+\\s*\\}" + }, + { + "include": "#literals-regular-expression-literal-custom-char-class" + }, + { + "include": "#literals-regular-expression-literal-group-option-toggle" + }, + { + "include": "#literals-regular-expression-literal-group-or-conditional" + } + ] + }, + "literals-regular-expression-literal-set-operators": { + "patterns": [ + { + "name": "keyword.operator.intersection.regexp.swift", + "match": "&&" + }, + { + "name": "keyword.operator.subtraction.regexp.swift", + "match": "--" + }, + { + "name": "keyword.operator.symmetric-difference.regexp.swift", + "match": "\\~\\~" + } + ] + }, + "literals-regular-expression-literal-unicode-scalars": { + "name": "constant.character.numeric.regexp", + "match": "(?x)\n\\\\u\\{\\s*(?:[0-9a-fA-F]+\\s*)+\\}\n| \\\\u[0-9a-fA-F]{4}\n| \\\\x\\{[0-9a-fA-F]+\\}\n| \\\\x[0-9a-fA-F]{0,2}\n| \\\\U[0-9a-fA-F]{8}\n| \\\\o\\{[0-7]+\\}\n| \\\\0[0-7]{0,3}\n| \\\\N\\{(?:U\\+[0-9a-fA-F]{1,8} | [\\s\\w-]+)\\}" + }, + "literals-string": { + "patterns": [ + { + "comment": "SE-0168: Multi-Line String Literals", + "name": "string.quoted.double.block.swift", + "begin": "\"\"\"", + "end": "\"\"\"(#*)", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.swift" + }, + "1": { + "name": "invalid.illegal.extra-closing-delimiter.swift" + } + }, + "patterns": [ + { + "name": "invalid.illegal.content-after-opening-delimiter.swift", + "match": "\\G.+(?=\"\"\")|\\G.+" + }, + { + "name": "constant.character.escape.newline.swift", + "match": "\\\\\\s*\\n" + }, + { + "include": "#literals-string-string-guts" + }, + { + "comment": "Allow \\(\"\"\"...\"\"\") to appear inside a block string", + "name": "invalid.illegal.content-before-closing-delimiter.swift", + "match": "\\S((?!\\\\\\().)*(?=\"\"\")" + } + ] + }, + { + "name": "string.quoted.double.block.raw.swift", + "begin": "#\"\"\"(?!#)(?=(?:[^\"]|\"(?!#))*$)", + "end": "\"\"\"#(#*)", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.swift" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.swift" + }, + "1": { + "name": "invalid.illegal.extra-closing-delimiter.swift" + } + }, + "patterns": [ + { + "name": "invalid.illegal.content-after-opening-delimiter.swift", + "match": "\\G.+(?=\"\"\")|\\G.+" + }, + { + "name": "constant.character.escape.newline.swift", + "match": "\\\\#\\s*\\n" + }, + { + "include": "#literals-string-raw-string-guts" + }, + { + "comment": "Allow \\(\"\"\"...\"\"\") to appear inside a block string", + "name": "invalid.illegal.content-before-closing-delimiter.swift", + "match": "\\S((?!\\\\#\\().)*(?=\"\"\")" + } + ] + }, + { + "name": "string.quoted.double.block.raw.swift", + "begin": "(?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k))", + "captures": { + "1": { + "name": "variable.other.swift" + }, + "2": { + "name": "punctuation.definition.identifier.swift" + }, + "3": { + "name": "punctuation.definition.identifier.swift" + } + } + } + ] + }, + "operators": { + "patterns": [ + { + "comment": "Type casting", + "name": "keyword.operator.type-casting.swift", + "match": "\\b(is\\b|as([!?]\\B|\\b))" + }, + { + "comment": "This rule helps us speed up the matching.", + "begin": "(?x)\n(?=\n (? # operator-head\n [/=\\-+!*%<>&|^~?]\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n )\n | \\.\n (\n \\g # operator-head\n | \\.\n | [\\x{0300}-\\x{036F}] # operator-character\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n)", + "end": "(?!\\G)", + "patterns": [ + { + "comment": "Prefix unary operator", + "match": "(?x)\n\\G # Matching from the beginning ensures\n # that we start with operator-head\n(?<=^|[\\s(\\[{,;:])\n(\n (?!(//|/\\*|\\*/))\n (\n [/=\\-+!*%<>&|^~?] # operator-head\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n \n | [\\x{0300}-\\x{036F}] # operator-character\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n)++\n(?![\\s)\\]},;:]|\\z)", + "captures": { + "0": { + "patterns": [ + { + "name": "keyword.operator.increment-or-decrement.swift", + "match": "\\G(\\+\\+|\\-\\-)$" + }, + { + "name": "keyword.operator.arithmetic.unary.swift", + "match": "\\G(\\+|\\-)$" + }, + { + "name": "keyword.operator.logical.not.swift", + "match": "\\G!$" + }, + { + "name": "keyword.operator.bitwise.not.swift", + "match": "\\G~$" + }, + { + "name": "keyword.operator.custom.prefix.swift", + "match": ".+" + } + ] + } + } + }, + { + "comment": "Postfix unary operator", + "match": "(?x)\n\\G # Matching from the beginning ensures\n # that we start with operator-head\n(?&|^~?] # operator-head\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n \n | [\\x{0300}-\\x{036F}] # operator-character\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n)++\n(?=[\\s)\\]},;:]|\\z)", + "captures": { + "0": { + "patterns": [ + { + "name": "keyword.operator.increment-or-decrement.swift", + "match": "\\G(\\+\\+|\\-\\-)$" + }, + { + "name": "keyword.operator.increment-or-decrement.swift", + "match": "\\G!$" + }, + { + "name": "keyword.operator.custom.postfix.swift", + "match": ".+" + } + ] + } + } + }, + { + "comment": "Infix operator", + "match": "(?x)\n\\G # Matching from the beginning ensures\n # that we start with operator-head\n(\n (?!(//|/\\*|\\*/))\n (\n [/=\\-+!*%<>&|^~?] # operator-head\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n \n | [\\x{0300}-\\x{036F}] # operator-character\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n)++", + "captures": { + "0": { + "patterns": [ + { + "name": "keyword.operator.assignment.swift", + "match": "\\G=$" + }, + { + "name": "keyword.operator.assignment.compound.swift", + "match": "\\G(\\+|\\-|\\*|/|%|<<|>>|&|\\^|\\||&&|\\|\\|)=$" + }, + { + "name": "keyword.operator.arithmetic.swift", + "match": "\\G(\\+|\\-|\\*|/)$" + }, + { + "name": "keyword.operator.arithmetic.overflow.swift", + "match": "\\G&(\\+|\\-|\\*)$" + }, + { + "name": "keyword.operator.arithmetic.remainder.swift", + "match": "\\G%$" + }, + { + "name": "keyword.operator.comparison.swift", + "match": "\\G(==|!=|>|<|>=|<=|~=)$" + }, + { + "name": "keyword.operator.coalescing.swift", + "match": "\\G\\?\\?$" + }, + { + "name": "keyword.operator.logical.swift", + "match": "\\G(&&|\\|\\|)$" + }, + { + "name": "keyword.operator.bitwise.swift", + "match": "\\G(&|\\||\\^|<<|>>)$" + }, + { + "name": "keyword.operator.bitwise.swift", + "match": "\\G(===|!==)$" + }, + { + "name": "keyword.operator.ternary.swift", + "match": "\\G\\?$" + }, + { + "name": "keyword.operator.custom.infix.swift", + "match": ".+" + } + ] + } + } + }, + { + "comment": "Dot prefix unary operator", + "match": "(?x)\n\\G # Matching from the beginning ensures\n # that we start with operator-head\n(?<=^|[\\s(\\[{,;:])\n\\. # dot\n(\n (?!(//|/\\*|\\*/))\n (\n \\. # dot\n | [/=\\-+!*%<>&|^~?] # operator-head\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n \n | [\\x{0300}-\\x{036F}] # operator-character\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n)++\n(?![\\s)\\]},;:]|\\z)", + "captures": { + "0": { + "patterns": [ + { + "name": "keyword.operator.custom.prefix.dot.swift", + "match": ".+" + } + ] + } + } + }, + { + "comment": "Dot postfix unary operator", + "match": "(?x)\n\\G # Matching from the beginning ensures\n # that we start with operator-head\n(?&|^~?] # operator-head\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n \n | [\\x{0300}-\\x{036F}] # operator-character\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n)++\n(?=[\\s)\\]},;:]|\\z)", + "captures": { + "0": { + "patterns": [ + { + "name": "keyword.operator.custom.postfix.dot.swift", + "match": ".+" + } + ] + } + } + }, + { + "comment": "Dot infix operator", + "match": "(?x)\n\\G # Matching from the beginning ensures\n # that we start with operator-head\n\\. # dot\n(\n (?!(//|/\\*|\\*/))\n (\n \\. # dot\n | [/=\\-+!*%<>&|^~?] # operator-head\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n \n | [\\x{0300}-\\x{036F}] # operator-character\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n)++", + "captures": { + "0": { + "patterns": [ + { + "name": "keyword.operator.range.swift", + "match": "\\G\\.\\.[.<]$" + }, + { + "name": "keyword.operator.custom.infix.dot.swift", + "match": ".+" + } + ] + } + } + } + ] + }, + { + "name": "keyword.operator.ternary.swift", + "match": ":" + } + ] + }, + "root": { + "patterns": [ + { + "include": "#compiler-control" + }, + { + "include": "#declarations" + }, + { + "include": "#expressions" + } + ] + } + } +} \ No newline at end of file diff --git a/desktop/internal/editor/syntax/grammars/zig.tmLanguage.json b/desktop/internal/editor/syntax/grammars/zig.tmLanguage.json new file mode 100644 index 0000000000..2ad0761b39 --- /dev/null +++ b/desktop/internal/editor/syntax/grammars/zig.tmLanguage.json @@ -0,0 +1,340 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "zig", + "scopeName": "source.zig", + "fileTypes": ["zig", "zon"], + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#strings" + }, + { + "include": "#keywords" + }, + { + "include": "#operators" + }, + { + "include": "#punctuation" + }, + { + "include": "#numbers" + }, + { + "include": "#support" + }, + { + "include": "#variables" + } + ], + "repository": { + "variables": { + "patterns": [ + { + "name": "meta.function.declaration.zig", + "patterns": [ + { + "match": "\\b(fn)\\s+([A-Z][a-zA-Z0-9]*)\\b", + "captures": { + "1": { + "name": "storage.type.function.zig" + }, + "2": { + "name": "entity.name.type.zig" + } + } + }, + { + "match": "\\b(fn)\\s+([_a-zA-Z][_a-zA-Z0-9]*)\\b", + "captures": { + "1": { + "name": "storage.type.function.zig" + }, + "2": { + "name": "entity.name.function.zig" + } + } + }, + { + "begin": "\\b(fn)\\s+@\"", + "end": "\"", + "name": "entity.name.function.string.zig", + "beginCaptures": { + "1": { + "name": "storage.type.function.zig" + } + }, + "patterns": [ + { + "include": "#stringcontent" + } + ] + }, + { + "name": "keyword.default.zig", + "match": "\\b(const|var|fn)\\b" + } + ] + }, + { + "name": "meta.function.call.zig", + "patterns": [ + { + "match": "([A-Z][a-zA-Z0-9]*)(?=\\s*\\()", + "name": "entity.name.type.zig" + }, + { + "match": "([_a-zA-Z][_a-zA-Z0-9]*)(?=\\s*\\()", + "name": "entity.name.function.zig" + } + ] + }, + { + "name": "meta.variable.zig", + "patterns": [ + { + "match": "\\b[_a-zA-Z][_a-zA-Z0-9]*\\b", + "name": "variable.zig" + }, + { + "begin": "@\"", + "end": "\"", + "name": "variable.string.zig", + "patterns": [ + { + "include": "#stringcontent" + } + ] + } + ] + } + ] + }, + "keywords": { + "patterns": [ + { + "match": "\\binline\\b(?!\\s*\\bfn\\b)", + "name": "keyword.control.repeat.zig" + }, + { + "match": "\\b(while|for)\\b", + "name": "keyword.control.repeat.zig" + }, + { + "name": "keyword.storage.zig", + "match": "\\b(extern|packed|export|pub|noalias|inline|comptime|volatile|align|linksection|threadlocal|allowzero|noinline|callconv)\\b" + }, + { + "name": "keyword.structure.zig", + "match": "\\b(struct|enum|union|opaque)\\b" + }, + { + "name": "keyword.statement.zig", + "match": "\\b(asm|unreachable)\\b" + }, + { + "name": "keyword.control.flow.zig", + "match": "\\b(break|return|continue|defer|errdefer)\\b" + }, + { + "name": "keyword.control.async.zig", + "match": "\\b(resume|suspend|nosuspend)\\b" + }, + { + "name": "keyword.control.trycatch.zig", + "match": "\\b(try|catch)\\b" + }, + { + "name": "keyword.control.conditional.zig", + "match": "\\b(if|else|switch|orelse)\\b" + }, + { + "name": "keyword.constant.default.zig", + "match": "\\b(null|undefined)\\b" + }, + { + "name": "keyword.constant.bool.zig", + "match": "\\b(true|false)\\b" + }, + { + "name": "keyword.default.zig", + "match": "\\b(test|and|or)\\b" + }, + { + "name": "keyword.type.zig", + "match": "\\b(bool|void|noreturn|type|error|anyerror|anyframe|anytype|anyopaque)\\b" + }, + { + "name": "keyword.type.integer.zig", + "match": "\\b(f16|f32|f64|f80|f128|u\\d+|i\\d+|isize|usize|comptime_int|comptime_float)\\b" + }, + { + "name": "keyword.type.c.zig", + "match": "\\b(c_char|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble)\\b" + } + ] + }, + "operators": { + "patterns": [ + { + "name": "keyword.operator.c-pointer.zig", + "match": "(?<=\\[)\\*c(?=\\])" + }, + { + "name": "keyword.operator.comparison.zig", + "match": "(\\b(and|or)\\b)|(==|!=|<=|>=|<|>)" + }, + { + "name": "keyword.operator.arithmetic.zig", + "match": "(-%?|\\+%?|\\*%?|/|%)=?" + }, + { + "name": "keyword.operator.bitwise.zig", + "match": "(<<%?|>>|!|~|&|\\^|\\|)=?" + }, + { + "name": "keyword.operator.special.zig", + "match": "(==|\\+\\+|\\*\\*|->)" + }, + { + "name": "keyword.operator.assignment.zig", + "match": "=" + }, + { + "name": "keyword.operator.question.zig", + "match": "\\?" + } + ] + }, + "comments": { + "patterns": [ + { + "name": "comment.line.documentation.zig", + "begin": "//[!/](?=[^/])", + "end": "$", + "patterns": [ + { + "include": "#commentContents" + } + ] + }, + { + "name": "comment.line.double-slash.zig", + "begin": "//", + "end": "$", + "patterns": [ + { + "include": "#commentContents" + } + ] + } + ] + }, + "commentContents": { + "patterns": [ + { + "match": "\\b(TODO|FIXME|XXX|NOTE)\\b:?", + "name": "keyword.todo.zig" + } + ] + }, + "punctuation": { + "patterns": [ + { + "name": "punctuation.accessor.zig", + "match": "\\." + }, + { + "name": "punctuation.comma.zig", + "match": "," + }, + { + "name": "punctuation.separator.key-value.zig", + "match": ":" + }, + { + "name": "punctuation.terminator.statement.zig", + "match": ";" + } + ] + }, + "strings": { + "patterns": [ + { + "name": "string.quoted.double.zig", + "begin": "\"", + "end": "\"", + "patterns": [ + { + "include": "#stringcontent" + } + ] + }, + { + "name": "string.multiline.zig", + "begin": "\\\\\\\\", + "end": "$" + }, + { + "name": "string.quoted.single.zig", + "match": "'([^'\\\\]|\\\\(x\\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.))'" + } + ] + }, + "stringcontent": { + "patterns": [ + { + "name": "constant.character.escape.zig", + "match": "\\\\([nrt'\"\\\\]|(x[0-9a-fA-F]{2})|(u\\{[0-9a-fA-F]+\\}))" + }, + { + "name": "invalid.illegal.unrecognized-string-escape.zig", + "match": "\\\\." + } + ] + }, + "numbers": { + "patterns": [ + { + "name": "constant.numeric.hexfloat.zig", + "match": "\\b0x[0-9a-fA-F][0-9a-fA-F_]*(\\.[0-9a-fA-F][0-9a-fA-F_]*)?([pP][+-]?[0-9a-fA-F_]+)?\\b" + }, + { + "name": "constant.numeric.float.zig", + "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?([eE][+-]?[0-9_]+)?\\b" + }, + { + "name": "constant.numeric.decimal.zig", + "match": "\\b[0-9][0-9_]*\\b" + }, + { + "name": "constant.numeric.hexadecimal.zig", + "match": "\\b0x[a-fA-F0-9_]+\\b" + }, + { + "name": "constant.numeric.octal.zig", + "match": "\\b0o[0-7_]+\\b" + }, + { + "name": "constant.numeric.binary.zig", + "match": "\\b0b[01_]+\\b" + }, + { + "name": "constant.numeric.invalid.zig", + "match": "\\b[0-9](([eEpP][+-])|[0-9a-zA-Z_])*(\\.(([eEpP][+-])|[0-9a-zA-Z_])*)?([eEpP][+-])?[0-9a-zA-Z_]*\\b" + } + ] + }, + "support": { + "patterns": [ + { + "comment": "Built-in functions", + "name": "support.function.builtin.zig", + "match": "@[_a-zA-Z][_a-zA-Z0-9]*" + } + ] + } + } +} diff --git a/desktop/internal/editor/syntax/language.go b/desktop/internal/editor/syntax/language.go index 9624d3ec04..730f9dd0d8 100644 --- a/desktop/internal/editor/syntax/language.go +++ b/desktop/internal/editor/syntax/language.go @@ -21,19 +21,36 @@ var grammarFiles embed.FS // with grammars of their own (API-25). var bundledGrammars = map[string]string{ "source.c": "grammars/c.tmLanguage.json", + "source.cmake": "grammars/cmake.tmLanguage.json", "source.cpp": "grammars/cpp.tmLanguage.json", "source.cpp.embedded.macro": "grammars/cpp.embedded.macro.tmLanguage.json", + "source.cs": "grammars/csharp.tmLanguage.json", "source.css": "grammars/css.tmLanguage.json", + "source.dockerfile": "grammars/docker.tmLanguage.json", "source.dotenv": "grammars/dotenv.tmLanguage.json", "source.go": "grammars/go.tmLanguage.json", + "source.graphql": "grammars/graphql.tmLanguage.json", + "source.groovy": "grammars/groovy.tmLanguage.json", "source.ini": "grammars/ini.tmLanguage.json", "source.java": "grammars/java.tmLanguage.json", "source.js": "grammars/JavaScript.tmLanguage.json", "source.js.jsx": "grammars/JavaScriptReact.tmLanguage.json", "source.json": "grammars/JSON.tmLanguage.json", "source.json.comments": "grammars/JSONC.tmLanguage.json", + "source.kotlin": "grammars/kotlin.tmLanguage.json", + "source.lua": "grammars/lua.tmLanguage.json", "source.makefile": "grammars/make.tmLanguage.json", + "source.objc": "grammars/objective-c.tmLanguage.json", + "source.objcpp": "grammars/objective-c++.tmLanguage.json", + "source.php": "grammars/php.tmLanguage.json", + "source.powershell": "grammars/powershell.tmLanguage.json", + "source.proto": "grammars/proto3.tmLanguage.json", + "source.python": "grammars/MagicPython.tmLanguage.json", + "source.ruby": "grammars/ruby.tmLanguage.json", "source.rust": "grammars/rust.tmLanguage.json", + "source.shell": "grammars/shell-unix-bash.tmLanguage.json", + "source.sql": "grammars/sql.tmLanguage.json", + "source.swift": "grammars/swift.tmLanguage.json", "source.toml": "grammars/toml.tmLanguage.json", "source.ts": "grammars/TypeScript.tmLanguage.json", "source.tsx": "grammars/TypeScriptReact.tmLanguage.json", @@ -43,8 +60,11 @@ var bundledGrammars = map[string]string{ "source.yaml.1.2": "grammars/yaml-1.2.tmLanguage.json", "source.yaml.1.3": "grammars/yaml-1.3.tmLanguage.json", "source.yaml.embedded": "grammars/yaml-embedded.tmLanguage.json", + "source.zig": "grammars/zig.tmLanguage.json", "text.html.basic": "grammars/html.tmLanguage.json", + "text.html.derivative": "grammars/html-derivative.tmLanguage.json", "text.html.markdown": "grammars/markdown.tmLanguage.json", + "text.html.php": "grammars/php-html.tmLanguage.json", "text.xml": "grammars/xml.tmLanguage.json", } diff --git a/desktop/internal/editor/syntax/language_test.go b/desktop/internal/editor/syntax/language_test.go index 0b2edd2645..9fce41ee78 100644 --- a/desktop/internal/editor/syntax/language_test.go +++ b/desktop/internal/editor/syntax/language_test.go @@ -289,10 +289,10 @@ func TestLanguageTokenNames(t *testing.T) { "value": "string.yaml.plain", `"s"`: "string.yaml", "1\n": "number.yaml", "true": "keyword.yaml", "&x": "namespace.yaml", "*x": "namespace.yaml", "!!str": "tag.yaml", "# c": "comment.yaml", "- i": "operators.yaml", }}, - {"markdown", "---\ntitle: x\n---\n# Head\n> quote\n- item `code` **b** *i* [text](http://x)\n```go\nfunc main() {}\n```\n", map[string]string{ + {"markdown", "---\ntitle: x\n---\n# Head\n> quote\n- item `code` **b** *i* [text](http://x)\n```go\nfunc main() {}\n```\n```objc\n@interface A\n@end\n```\n", map[string]string{ "title": "type.yaml", "# ": "keyword.md", "Head": "keyword.md.heading", "> ": "comment.md", "- ": "keyword.md", "`code`": "variable.md", "**b**": "strong", "*i*": "emphasis", "text": "md.link", "http": "string.link.md", - "```go": "string.md", "func": "keyword", + "```go": "string.md", "func": "keyword", "@interface": "keyword", }}, {"ini", "; c\n[section]\nkey = \"v\"\n", map[string]string{ "; c": "comment.ini", "[": "metatag.ini", "section": "metatag.ini", "key": "key.ini", "=": "delimiter.ini", `"v"`: "string.ini", @@ -316,7 +316,43 @@ func TestLanguageTokenNames(t *testing.T) { "fn": "keyword", "let": "keyword", "1;": "number", "= 1": "delimiter", "::": "delimiter", }}, {"cpp", "#include \nint main() { return not 0 && sizeof(int); }\n", map[string]string{ - "int": "keyword", "return": "keyword", "0 ": "number", "not": "keyword", "&&": "delimiter", "sizeof": "keyword", + "#include": "keyword", "int": "keyword", "return": "keyword", "0 ": "number", "not": "keyword", "&&": "delimiter", + "sizeof": "keyword", + }}, + {"python", "class A(Base):\n def f(self):\n return self is not None and r'\\d+'\n", map[string]string{ + "class": "keyword", "Base": "type.identifier", "def": "keyword", "self": "variable", "is": "keyword", "not": "keyword", + "and": "keyword", "r'": "regexp", "+'": "regexp", + }}, + {"shell", "N=\"${1:-x}\"\necho \"$N\" | grep 'a' && exit 2\n", map[string]string{ + "N=": "variable", "${1": "variable", ":-": "delimiter", "echo": "function", "$N": "variable", "|": "delimiter", + "'a'": "string", "&&": "delimiter", "2\n": "number", + }}, + {"kotlin", "fun f(x: Int) = \"n: ${x.inc()} $x\"\n", map[string]string{ + "fun": "keyword", "Int": "type.identifier", "\"n": "string", "${": "delimiter", "x.inc()": "", "} ": "delimiter", + "$x": "variable", + }}, + {"groovy", "class T extends Base {\n def r = /a\\d+/\n def s = \"${x.y}\"\n}\n", map[string]string{ + "class": "keyword", "Base": "type.identifier", "/a": "regexp", "+/": "regexp", "${": "delimiter", "x.y": "", + }}, + {"php", "

\">&

\n", map[string]string{ + "": "metatag.php", "&": "string.escape.html", "\n@interface P : NSObject\n@end\n", map[string]string{ + "#import": "keyword", "": "string", "@interface": "keyword", "P ": "type.identifier", + "NSObject": "type.identifier", "@end": "keyword", + }}, + {"csharp", "var s = $\"a {x}\" + @\"b\";\nif (o is string) {}\n", map[string]string{ + "var": "keyword", "$\"a": "string", "{x": "delimiter", "x}": "variable", "@\"b\"": "string", "is": "keyword", }}, } { t.Run(c.language, func(t *testing.T) { @@ -360,10 +396,11 @@ func TestIncludedGrammarsLoadWhenReached(t *testing.T) { func TestPluginLanguageWithoutGrammarKeepsBundledColors(t *testing.T) { r := NewRegistry() family := PluginLanguage{ID: "clangd", Extensions: []string{"c", "h", "cpp", "m", "unknownext"}} - if failed, _ := r.SetPluginLanguages([]PluginLanguage{family}); len(failed) != 0 { + dart := PluginLanguage{ID: "dartls", Extensions: []string{"dart"}} + if failed, _ := r.SetPluginLanguages([]PluginLanguage{family, dart}); len(failed) != 0 { t.Fatalf("failed %v", failed) } - for path, want := range map[string]string{"src/main.c": "c", `inc\Util.H`: "c", "app.cpp": "cpp"} { + for path, want := range map[string]string{"src/main.c": "c", `inc\Util.H`: "c", "app.cpp": "cpp", "view.m": "objective-c"} { language, ok := r.ForPath(path) if !ok || language.ID != "clangd" { t.Fatalf("ForPath(%q) = %+v, %v, want the plugin's clangd", path, language, ok) @@ -379,7 +416,7 @@ func TestPluginLanguageWithoutGrammarKeepsBundledColors(t *testing.T) { } // Neither a bundled language without a grammar nor a name no bundled language takes is // colored. - for _, path := range []string{"view.m", "file.unknownext"} { + for _, path := range []string{"main.dart", "file.unknownext"} { if s := r.SyntaxForPath(path); s != nil { t.Fatalf("SyntaxForPath(%q) = %v, want none", path, s) } diff --git a/desktop/internal/editor/syntax/languages.go b/desktop/internal/editor/syntax/languages.go index 336ef6083f..cd9f5f3c26 100644 --- a/desktop/internal/editor/syntax/languages.go +++ b/desktop/internal/editor/syntax/languages.go @@ -27,11 +27,17 @@ var JavaRules = []Rule{ } // codeRules are what the previous editor's Monarch tokenizers colored differently from its -// TextMate classification: a number is one number token, whatever its prefix, exponent or suffix -// are scoped, inside the number's scope or, as Go scopes them, beside it; a string's quotes are part of the string; an operator is a keyword when it is a -// word and a delimiter when it is a symbol; and a bracket is a delimiter. The word operators are -// enclosing because C++ names one keyword.operator.wordlike and, inside it, keyword.operator.and. +// TextMate classification: a regular expression literal is one regexp token, whatever its parts +// are scoped; a number is one number token, whatever its prefix, exponent or suffix are scoped, +// inside the number's scope or, as Go scopes them, beside it; a string's quotes are part of the +// string; an operator is a keyword when it is a word and a delimiter when it is a symbol; and a +// bracket is a delimiter. The word operators are known by the scopes that only words have; the +// first are enclosing because C++ names one keyword.operator.wordlike and, inside it, +// keyword.operator.and. Where a grammar scopes words and symbols alike, as Ruby's +// keyword.operator.logical takes both "and" and "&&", or PowerShell's both "-and" and "!", both +// are delimiters, as Dark+ colors them alike. var codeRules = []Rule{ + {Scope: "string.regexp", Token: "regexp", Enclosing: true}, {Scope: "constant.numeric", Token: "number", Enclosing: true}, {Scope: "keyword.operator.expression", Token: "keyword", Enclosing: true}, {Scope: "keyword.operator.wordlike", Token: "keyword", Enclosing: true}, @@ -41,11 +47,36 @@ var codeRules = []Rule{ {Scope: "keyword.operator.sizeof", Token: "keyword", Enclosing: true}, {Scope: "keyword.operator.type.asserts", Token: "keyword", Enclosing: true}, {Scope: "keyword.operator.type.modifier", Token: "keyword", Enclosing: true}, + {Scope: "keyword.operator.cast", Token: "keyword", Enclosing: true}, + {Scope: "keyword.operator.memory", Token: "keyword", Enclosing: true}, + {Scope: "keyword.operator.logical.python", Token: "keyword"}, + {Scope: "keyword.operator.logical.lua", Token: "keyword"}, + {Scope: "keyword.operator.as", Token: "keyword"}, + {Scope: "keyword.operator.in", Token: "keyword"}, + {Scope: "keyword.operator.instanceof", Token: "keyword"}, + {Scope: "keyword.operator.type.php", Token: "keyword"}, + {Scope: "keyword.operator.type-casting", Token: "keyword"}, + // The mark a keyword or constant begins with, as # of C's #include, @ of Objective-C's + // @interface, $ of PowerShell's $true or : of Ruby's :name, is part of it. + {Scope: "constant.language", Token: "keyword", Enclosing: true}, + {Scope: "punctuation.definition.directive", Token: "keyword"}, + {Scope: "punctuation.definition.keyword", Token: "keyword"}, + {Scope: "punctuation.definition.storage", Token: "keyword"}, + // A variable the language provides, as JavaScript's document or PowerShell's $_, is a + // variable, and the class a class extends is a type, as Dark+ colors them. + {Scope: "support.variable", Token: "variable"}, + {Scope: "entity.other.inherited-class", Token: "type.identifier"}, {Scope: "keyword.other.unit", Token: "number"}, {Scope: "keyword.operator.minus.exponent", Token: "number"}, {Scope: "keyword.operator.plus.exponent", Token: "number"}, {Scope: "keyword.operator.exponent", Token: "number"}, {Scope: "punctuation.definition.string", Token: "string"}, + // The sigil of a variable, as $ in shell and PHP or @ in Ruby, is part of the variable. + {Scope: "punctuation.definition.variable", Token: "variable"}, + // The code a string interpolates is not part of the string: what the grammar leaves unnamed + // in ${...}, as JavaScript and Kotlin scope it, or in Groovy's, has no name. + {Scope: "meta.template.expression", Token: ""}, + {Scope: "source.groovy.embedded", Token: ""}, {Scope: "keyword.operator", Token: "delimiter"}, {Scope: "storage.type.function.arrow", Token: "delimiter"}, {Scope: "meta.brace.round", Token: "delimiter.parenthesis"}, @@ -56,10 +87,6 @@ var codeRules = []Rule{ // with Monarch tokenizers: codeRules, then DefaultRules. var CodeRules = WithDefaults(codeRules...) -// ScriptRules are the rules of JavaScript and TypeScript: a regular expression literal is one -// regexp token, as the previous editor colored it, whatever its parts are scoped; then CodeRules. -var ScriptRules = WithDefaults(append([]Rule{{Scope: "string.regexp", Token: "regexp", Enclosing: true}}, codeRules...)...) - // The rules of markup and configuration languages give their tokens the names the previous // editor's Monarch tokenizers gave them, with the language's suffix, so that the color schemes // written against those names, such as "tag.html" or "key.toml", style them the same. @@ -76,6 +103,26 @@ var HTMLRules = []Rule{ {Scope: "constant.character.entity", Token: "string.escape.html"}, } +// PHPRules are the rules of PHP. A PHP file is HTML with PHP code in it: the HTML is named as +// HTMLRules name it, and the code, which the grammar embeds under meta.embedded.block.php or +// meta.embedded.line.php, as CodeRules name it, with the around it metatags as the +// previous editor's PHP tokenizer named them. HTMLRules' rules for every comment and string +// would also take the code's, so these name only HTML's, by their ".html" scopes. The ones +// whose parts CodeRules would name apart, as an attribute value's quotes, are enclosing. +var PHPRules = append([]Rule{ + {Scope: "comment.block.html", Token: "comment.html", Enclosing: true}, + {Scope: "meta.tag.metadata.doctype", Token: "metatag.html", Enclosing: true}, + {Scope: "constant.character.entity", Token: "string.escape.html", Enclosing: true}, + {Scope: "string.quoted.double.html", Token: "attribute.value.html", Enclosing: true}, + {Scope: "string.quoted.single.html", Token: "attribute.value.html", Enclosing: true}, + {Scope: "string.unquoted.html", Token: "attribute.value.html", Enclosing: true}, + {Scope: "punctuation.section.embedded", Token: "metatag.php"}, + {Scope: "entity.name.tag", Token: "tag.html"}, + {Scope: "punctuation.definition.tag", Token: "delimiter.html"}, + {Scope: "entity.other.attribute-name", Token: "attribute.name.html"}, + {Scope: "punctuation.separator.key-value.html", Token: "delimiter.html"}, +}, CodeRules...) + // XMLRules are the rules of XML. Strings only occur in attribute values and declarations; // CDATA sections are plain text. var XMLRules = []Rule{ @@ -288,34 +335,34 @@ var bundledLanguages = []Language{ {ID: "makefile", Scope: "source.makefile", Extensions: []string{".mk", ".mak"}, FileNames: []string{"makefile", "gnumakefile"}, FilePrefixes: []string{"makefile."}, Comments: hashComments, Brackets: cBrackets, AutoClosing: bracketClosing}, - {ID: "cmake", Extensions: []string{".cmake"}, FileNames: []string{"cmakelists.txt"}, + {ID: "cmake", Scope: "source.cmake", Rules: CodeRules, Extensions: []string{".cmake"}, FileNames: []string{"cmakelists.txt"}, Comments: hashComments, Brackets: cBrackets, AutoClosing: bracketClosing}, - {ID: "groovy", Extensions: []string{".groovy", ".gradle"}, FileNames: []string{"jenkinsfile"}, + {ID: "groovy", Scope: "source.groovy", Rules: CodeRules, Extensions: []string{".groovy", ".gradle"}, FileNames: []string{"jenkinsfile"}, Comments: cComments, Brackets: cBrackets, AutoClosing: bracketClosing}, - {ID: "kotlin", Extensions: []string{".kt", ".kts", ".gradle.kts"}, + {ID: "kotlin", Scope: "source.kotlin", Rules: CodeRules, Extensions: []string{".kt", ".kts", ".gradle.kts"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "powershell", Extensions: []string{".ps1", ".psm1", ".psd1"}, + {ID: "powershell", Scope: "source.powershell", Rules: CodeRules, Extensions: []string{".ps1", ".psm1", ".psd1"}, Comments: Comments{Line: "#", Block: Pair{"<#", "#>"}}, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "bat", Extensions: []string{".bat", ".cmd"}, Comments: Comments{Line: "REM"}, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "shell", Extensions: []string{".sh", ".bash", ".zsh"}, + {ID: "shell", Scope: "source.shell", Rules: CodeRules, Extensions: []string{".sh", ".bash", ".zsh"}, FileNames: []string{".bashrc", ".zshrc", ".bash_profile", ".zprofile", ".profile"}, Comments: hashComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "dotenv", Scope: "source.dotenv", Rules: DotenvRules, Extensions: []string{".env"}, FileNames: []string{".env"}, FilePrefixes: []string{".env."}, Comments: hashComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "dockerfile", Extensions: []string{".dockerfile"}, FileNames: []string{"dockerfile", "containerfile"}, + {ID: "dockerfile", Scope: "source.dockerfile", Rules: CodeRules, Extensions: []string{".dockerfile"}, FileNames: []string{"dockerfile", "containerfile"}, FilePrefixes: []string{"dockerfile.", "containerfile."}, Comments: hashComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "c", Scope: "source.c", Rules: CodeRules, Extensions: []string{".c", ".h"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "cpp", Scope: "source.cpp", Rules: CodeRules, Extensions: []string{".cpp", ".cc", ".cxx", ".c++", ".hpp", ".hh", ".hxx", ".h++", ".inl", ".ipp"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "csharp", Extensions: []string{".cs", ".csx", ".cake"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, + {ID: "csharp", Scope: "source.cs", Rules: CodeRules, Extensions: []string{".cs", ".csx", ".cake"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "css", Scope: "source.css", Rules: CSSRules, Extensions: []string{".css"}, Comments: Comments{Block: Pair{"/*", "*/"}}, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "dart", Extensions: []string{".dart"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "elixir", Extensions: []string{".ex", ".exs"}, Comments: hashComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "go", Scope: "source.go", Rules: CodeRules, Extensions: []string{".go"}, Comments: cComments, Brackets: cBrackets, AutoClosing: scriptClosing}, - {ID: "graphql", Extensions: []string{".graphql", ".gql"}, Comments: hashComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, + {ID: "graphql", Scope: "source.graphql", Rules: CodeRules, Extensions: []string{".graphql", ".gql"}, Comments: hashComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, // ' is not paired: it marks primes in names, as foldl'. {ID: "haskell", Extensions: []string{".hs"}, Comments: Comments{Line: "--", Block: Pair{"{-", "-}"}}, Brackets: cBrackets, AutoClosing: []Pair{{"{", "}"}, {"[", "]"}, {"(", ")"}, {`"`, `"`}}}, @@ -325,9 +372,9 @@ var bundledLanguages = []Language{ Comments: markupBlock, Brackets: markupBrackets, AutoClosing: markupClosing}, {ID: "ini", Scope: "source.ini", Rules: INIRules, Extensions: []string{".ini", ".properties", ".cfg", ".conf", ".gitconfig"}, FileNames: []string{".gitconfig", ".editorconfig"}, Comments: hashComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "javascript", Scope: "source.js", Rules: ScriptRules, Extensions: []string{".js", ".es6", ".mjs", ".cjs"}, + {ID: "javascript", Scope: "source.js", Rules: CodeRules, Extensions: []string{".js", ".es6", ".mjs", ".cjs"}, FileNames: []string{"jakefile"}, Comments: cComments, Brackets: cBrackets, AutoClosing: scriptClosing}, - {ID: "javascriptreact", Scope: "source.js.jsx", Rules: ScriptRules, Extensions: []string{".jsx"}, + {ID: "javascriptreact", Scope: "source.js.jsx", Rules: CodeRules, Extensions: []string{".jsx"}, Comments: cComments, Brackets: cBrackets, AutoClosing: scriptClosing}, {ID: "jsonc", Scope: "source.json.comments", Rules: JSONRules, Extensions: []string{".jsonc", ".code-workspace", ".jshintrc", ".jscsrc", ".eslintrc", ".babelrc"}, @@ -337,19 +384,19 @@ var bundledLanguages = []Language{ {ID: "json", Scope: "source.json", Rules: JSONRules, Extensions: []string{".json", ".bowerrc", ".har"}, Comments: cComments, Brackets: jsonBrackets, AutoClosing: jsonClosing}, {ID: "less", Extensions: []string{".less"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "lua", Extensions: []string{".lua"}, Comments: Comments{Line: "--", Block: Pair{"--[[", "]]"}}, + {ID: "lua", Scope: "source.lua", Rules: CodeRules, Extensions: []string{".lua"}, Comments: Comments{Line: "--", Block: Pair{"--[[", "]]"}}, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "markdown", Scope: "text.html.markdown", Rules: MarkdownRules, Extensions: []string{".md", ".markdown", ".mdown", ".mkdn", ".mkd", ".mdwn", ".mdtxt", ".mdtext"}, Comments: markupBlock, Brackets: cBrackets, AutoClosing: []Pair{{"{", "}"}, {"[", "]"}, {"(", ")"}, {"<", ">"}}}, - {ID: "objective-c", Extensions: []string{".m"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "objective-cpp", Extensions: []string{".mm"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, + {ID: "objective-c", Scope: "source.objc", Rules: CodeRules, Extensions: []string{".m"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, + {ID: "objective-cpp", Scope: "source.objcpp", Rules: CodeRules, Extensions: []string{".mm"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "perl", Extensions: []string{".pl", ".pm"}, Comments: hashComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "php", Extensions: []string{".php", ".php4", ".php5", ".phtml", ".ctp"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "proto", Extensions: []string{".proto"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "python", Extensions: []string{".py", ".rpy", ".pyw", ".cpy", ".gyp", ".gypi"}, + {ID: "php", Scope: "text.html.php", Rules: PHPRules, Extensions: []string{".php", ".php4", ".php5", ".phtml", ".ctp"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, + {ID: "proto", Scope: "source.proto", Rules: CodeRules, Extensions: []string{".proto"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, + {ID: "python", Scope: "source.python", Rules: CodeRules, Extensions: []string{".py", ".rpy", ".pyw", ".cpy", ".gyp", ".gypi"}, Comments: Comments{Line: "#", Block: Pair{"'''", "'''"}}, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "r", Extensions: []string{".r", ".rhistory", ".rmd", ".rprofile", ".rt"}, Comments: hashComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "ruby", Extensions: []string{".rb", ".rbx", ".rjs", ".gemspec", ".pp"}, FileNames: []string{"rakefile", "gemfile"}, + {ID: "ruby", Scope: "source.ruby", Rules: CodeRules, Extensions: []string{".rb", ".rbx", ".rjs", ".gemspec", ".pp"}, FileNames: []string{"rakefile", "gemfile"}, Comments: Comments{Line: "#", Block: Pair{"=begin", "=end"}}, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "rust", Scope: "source.rust", Rules: CodeRules, Extensions: []string{".rs", ".rlib"}, Comments: cComments, Brackets: cBrackets, AutoClosing: []Pair{{"{", "}"}, {"[", "]"}, {"(", ")"}, {`"`, `"`}}}, @@ -358,17 +405,17 @@ var bundledLanguages = []Language{ Comments: Comments{Line: ";", Block: Pair{"#|", "|#"}}, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "scss", Extensions: []string{".scss"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "sol", Extensions: []string{".sol"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "sql", Extensions: []string{".sql"}, Comments: Comments{Line: "--", Block: Pair{"/*", "*/"}}, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "swift", Extensions: []string{".swift"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "typescript", Scope: "source.ts", Rules: ScriptRules, Extensions: []string{".ts", ".cts", ".mts"}, + {ID: "sql", Scope: "source.sql", Rules: CodeRules, Extensions: []string{".sql"}, Comments: Comments{Line: "--", Block: Pair{"/*", "*/"}}, Brackets: cBrackets, AutoClosing: cAutoClosing}, + {ID: "swift", Scope: "source.swift", Rules: CodeRules, Extensions: []string{".swift"}, Comments: cComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, + {ID: "typescript", Scope: "source.ts", Rules: CodeRules, Extensions: []string{".ts", ".cts", ".mts"}, Comments: cComments, Brackets: cBrackets, AutoClosing: scriptClosing}, - {ID: "typescriptreact", Scope: "source.tsx", Rules: ScriptRules, Extensions: []string{".tsx"}, + {ID: "typescriptreact", Scope: "source.tsx", Rules: CodeRules, Extensions: []string{".tsx"}, Comments: cComments, Brackets: cBrackets, AutoClosing: scriptClosing}, {ID: "xml", Scope: "text.xml", Rules: XMLRules, Extensions: []string{".xml", ".xsd", ".dtd", ".ascx", ".csproj", ".config", ".props", ".targets", ".wxi", ".wxl", ".wxs", ".xaml", ".svg", ".svgz", ".opf", ".xslt", ".xsl"}, Comments: markupBlock, Brackets: markupBrackets, AutoClosing: markupClosing}, {ID: "yaml", Scope: "source.yaml", Rules: YAMLRules, Extensions: []string{".yaml", ".yml"}, Comments: hashComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, - {ID: "zig", Extensions: []string{".zig", ".zon"}, Comments: Comments{Line: "//"}, Brackets: cBrackets, AutoClosing: cAutoClosing}, + {ID: "zig", Scope: "source.zig", Rules: CodeRules, Extensions: []string{".zig", ".zon"}, Comments: Comments{Line: "//"}, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "toml", Scope: "source.toml", Rules: TOMLRules, Extensions: []string{".toml"}, Comments: hashComments, Brackets: cBrackets, AutoClosing: cAutoClosing}, {ID: "plaintext", Extensions: []string{".txt"}}, } diff --git a/desktop/internal/editor/textmate/grammar.go b/desktop/internal/editor/textmate/grammar.go index cd060a266f..3c459e878d 100644 --- a/desktop/internal/editor/textmate/grammar.go +++ b/desktop/internal/editor/textmate/grammar.go @@ -5,6 +5,7 @@ import ( "fmt" "maps" "regexp" + "slices" "sort" "strconv" "strings" @@ -15,7 +16,7 @@ import ( ) // RawGrammar is a TextMate grammar as its JSON file has it. Only what tokenizing reads is -// kept; injections are not supported. +// kept: injectionSelector is not, since no grammar is injected into another. // // A grammar is read the way the kernel validates a plugin's grammar (plugins/grammar.rs in // Lithe-core-rust), so that the rules the editor runs are the rules the kernel checked: keys @@ -27,6 +28,8 @@ type RawGrammar struct { Name string Patterns []*RawRule Repository map[string]*RawRule + // Injections are the grammar's injections in the order vscode-textmate collects them. + Injections []RawInjection } // RawRule is one rule of a RawGrammar. @@ -81,6 +84,9 @@ func ParseGrammar(data []byte) (*RawGrammar, error) { Patterns: d.patterns("patterns", object["patterns"]), Repository: d.repository("repository", object["repository"]), } + if injections := object["injections"]; injections != nil { + grammar.Injections = d.injections(injections, data) + } if d.err != nil { return nil, fmt.Errorf("textmate grammar: %w", d.err) } @@ -245,6 +251,30 @@ func (d *decoder) repository(key string, value any) map[string]*RawRule { return repository } +// injections reads the injections object of the grammar in data, in the order +// vscode-textmate collects them, leaving out rules written as null. +func (d *decoder) injections(value any, data []byte) []RawInjection { + entries, ok := value.(map[string]any) + if !ok { + d.fail("injections", "an object") + return nil + } + keys := injectionKeys(data) + if len(keys) != len(entries) { + // The file decoded, so its keys read again; this only keeps the order deterministic. + keys = slices.Sorted(maps.Keys(entries)) + } + injections := make([]RawInjection, 0, len(entries)) + d.push("injections", -1) + for _, key := range keys { + if rule := d.rule(entries[key], key, -1); rule != nil { + injections = append(injections, RawInjection{Selector: key, Rule: rule}) + } + } + d.pop() + return injections +} + // captures reads captures written as an object or as an array. An object key is a group // number as strconv.Atoi reads it, with an optional sign; a key that is not a number or is // negative is a note, such as vscode-textmate's own location field. When keys such as "1" and @@ -435,6 +465,8 @@ type Grammar struct { // each use rather than keep it. rules atomic.Pointer[[]*rule] root int + // injections are the root grammar's injections, sorted by priority; they never change. + injections []injection // compileMu guards compiler, which compiles included grammars when they are reached. compileMu sync.Mutex @@ -787,6 +819,7 @@ func compileGrammar(raw *RawGrammar, source *grammarSource) *Grammar { c.top = c.grammarRepo(raw, nil) c.included[raw.ScopeName] = c.top g.root = c.ruleID(c.top.self, c.top) + g.injections = c.collectInjections(raw.Injections) c.publish() rootName := c.rules[g.root].name.text if rootName == "" { diff --git a/desktop/internal/editor/textmate/injection.go b/desktop/internal/editor/textmate/injection.go new file mode 100644 index 0000000000..b507a50188 --- /dev/null +++ b/desktop/internal/editor/textmate/injection.go @@ -0,0 +1,301 @@ +package textmate + +import ( + "bytes" + "encoding/json" + "regexp" + "sort" + "strconv" +) + +// RawInjection is one entry of a grammar's injections: a scope selector and the rule whose +// patterns are tried, alongside the current rule's, wherever the selector matches. +type RawInjection struct { + Selector string + Rule *RawRule +} + +// injection is one selector of a compiled grammar's injections. A selector key with several +// comma-separated parts, such as "L:a, b", is one injection for each part, all with the rule +// of that key, as vscode-textmate's collectInjections makes them. +type injection struct { + selector *selector + // priority is -1 for a part written "L:", 1 for "R:" and 0 otherwise. Injections are kept + // sorted by it, and an "L:" injection wins over the current rule's match at the same start. + priority int + rule int +} + +// collectInjections compiles the injections of the grammar being compiled, as +// vscode-textmate's Grammar._collectInjections does for its root grammar. The injections of +// a grammar it includes never apply, and no grammar is injected into another through an +// injectionSelector, so only the root's own are collected. +func (c *compiler) collectInjections(raw []RawInjection) []injection { + var out []injection + for _, raw := range raw { + parts := parseSelector(raw.Selector) + if len(parts) == 0 { + continue + } + id := c.ruleID(raw.Rule, c.top) + for _, part := range parts { + out = append(out, injection{selector: part.selector, priority: part.priority, rule: id}) + } + } + sort.SliceStable(out, func(i, j int) bool { return out[i].priority < out[j].priority }) + return out +} + +// selectorKind is what one node of a parsed scope selector tests. +type selectorKind uint8 + +const ( + // selectorPath matches scopes that contain its names in order, each the scope itself or a + // prefix of it that ends before a dot. + selectorPath selectorKind = iota + // selectorNot matches what its operand does not; with no operand it matches nothing. + selectorNot + // selectorAll matches what every operand matches, everything when there is none. + selectorAll + // selectorAny matches what one of its operands matches. + selectorAny +) + +// selector is a scope selector parsed as vscode-textmate's matcher.ts parses it. +type selector struct { + kind selectorKind + names []string + operands []*selector +} + +// selectorPart is one comma-separated part of a selector key with its priority. +type selectorPart struct { + selector *selector + priority int +} + +// selectorToken is what matcher.ts's tokenizer takes from a selector: a priority prefix, a +// scope name, or punctuation. Everything else is skipped. +var selectorToken = regexp.MustCompile(`[LR]:|[\w.:][\w.:\-]*|[,|\-()]`) + +// isSelectorName is matcher.ts's isIdentifier: a token with a word character, dot or colon, +// which a priority prefix also has. +func isSelectorName(token string) bool { + return token != "" && token != "," && token != "|" && token != "-" && token != "(" && token != ")" +} + +// selectorParser is matcher.ts's recursive descent over the tokens of one selector. +type selectorParser struct { + tokens []string + next int + // token is the current token, "" past the end. + token string +} + +func (p *selectorParser) advance() { + p.token = "" + if p.next < len(p.tokens) { + p.token = p.tokens[p.next] + p.next++ + } +} + +// parseSelector is matcher.ts's createMatchers: the parts of a selector key with their +// priorities. A part that starts with a two-character token ending in a colon takes it as its +// priority; one other than "L:" or "R:" counts as no priority. +func parseSelector(key string) []selectorPart { + p := &selectorParser{tokens: selectorToken.FindAllString(key, -1)} + p.advance() + var parts []selectorPart + for p.token != "" { + priority := 0 + if len(p.token) == 2 && p.token[1] == ':' { + switch p.token[0] { + case 'R': + priority = 1 + case 'L': + priority = -1 + } + p.advance() + } + parts = append(parts, selectorPart{selector: p.conjunction(), priority: priority}) + if p.token != "," { + break + } + p.advance() + } + return parts +} + +// conjunction is operands that must all match. +func (p *selectorParser) conjunction() *selector { + all := &selector{kind: selectorAll} + for operand := p.operand(); operand != nil; operand = p.operand() { + all.operands = append(all.operands, operand) + } + return all +} + +// inner is the expression in parentheses: conjunctions separated by "|" or ",", one of which +// must match. +func (p *selectorParser) inner() *selector { + either := &selector{kind: selectorAny} + for { + either.operands = append(either.operands, p.conjunction()) + if p.token != "|" && p.token != "," { + return either + } + for p.token == "|" || p.token == "," { + p.advance() + } + } +} + +// operand is a negation, a parenthesized expression, or a run of names; nil when the current +// token starts none of them. +func (p *selectorParser) operand() *selector { + switch { + case p.token == "-": + p.advance() + return &selector{kind: selectorNot, operands: []*selector{p.operand()}} + case p.token == "(": + p.advance() + inner := p.inner() + if p.token == ")" { + p.advance() + } + return inner + case isSelectorName(p.token): + path := &selector{kind: selectorPath} + for isSelectorName(p.token) { + path.names = append(path.names, p.token) + p.advance() + } + return path + } + return nil +} + +// matches says the selector matches scopes, the stack a position is in. +func (s *selector) matches(scopes *ScopeStack) bool { + switch s.kind { + case selectorPath: + return pathMatches(s.names, scopes) + case selectorNot: + return s.operands[0] != nil && !s.operands[0].matches(scopes) + case selectorAll: + for _, operand := range s.operands { + if !operand.matches(scopes) { + return false + } + } + return true + default: + for _, operand := range s.operands { + if operand.matches(scopes) { + return true + } + } + return false + } +} + +// pathMatches is vscode-textmate's nameMatcher: the names match scopes that, outermost first, +// contain a scope matching each name in order. Matching each name to the innermost scope that +// can take it, from the last name back, finds such scopes exactly when matching from the first +// name forward does, and walks the stack without copying it. +func pathMatches(names []string, scopes *ScopeStack) bool { + at := scopes + for i := len(names) - 1; i >= 0; i-- { + for at != nil && !scopeMatches(at.scope, names[i]) { + at = at.parent + } + if at == nil { + return false + } + at = at.parent + } + return true +} + +// scopeMatches says name selects scope: it is the scope, or a prefix of it followed by a dot. +func scopeMatches(scope, name string) bool { + if scope == "" { + return false + } + if scope == name { + return true + } + return len(scope) > len(name) && scope[len(name)] == '.' && scope[:len(name)] == name +} + +// injectionKeys returns the keys of the injections object of the grammar in data in the order +// a JavaScript object has them, which is the order vscode-textmate collects injections in: +// keys that are array indices first, by value, then the others as the file first writes them. +// A repeated "injections" key takes its last object, as decoding does. +func injectionKeys(data []byte) []string { + dec := json.NewDecoder(bytes.NewReader(data)) + if token, err := dec.Token(); err != nil || token != json.Delim('{') { + return nil + } + var keys []string + for dec.More() { + token, err := dec.Token() + if err != nil { + return nil + } + var value json.RawMessage + if err := dec.Decode(&value); err != nil { + return nil + } + if token == "injections" { + keys = objectKeys(value) + } + } + return keys +} + +// objectKeys returns the keys of the JSON object in data, each once, in JavaScript order. +func objectKeys(data []byte) []string { + dec := json.NewDecoder(bytes.NewReader(data)) + if token, err := dec.Token(); err != nil || token != json.Delim('{') { + return nil + } + var indices, names []string + seen := map[string]bool{} + for dec.More() { + token, err := dec.Token() + if err != nil { + return nil + } + var skipped json.RawMessage + if err := dec.Decode(&skipped); err != nil { + return nil + } + key, _ := token.(string) + if seen[key] { + continue + } + seen[key] = true + if _, ok := arrayIndex(key); ok { + indices = append(indices, key) + } else { + names = append(names, key) + } + } + sort.Slice(indices, func(i, j int) bool { + a, _ := arrayIndex(indices[i]) + b, _ := arrayIndex(indices[j]) + return a < b + }) + return append(indices, names...) +} + +// arrayIndex reads key as a JavaScript array index: a canonical decimal integer below 2^32-1. +func arrayIndex(key string) (uint64, bool) { + n, err := strconv.ParseUint(key, 10, 32) + if err != nil || n == 1<<32-1 || strconv.FormatUint(n, 10) != key { + return 0, false + } + return n, true +} diff --git a/desktop/internal/editor/textmate/injection_test.go b/desktop/internal/editor/textmate/injection_test.go new file mode 100644 index 0000000000..3a95df068e --- /dev/null +++ b/desktop/internal/editor/textmate/injection_test.go @@ -0,0 +1,134 @@ +package textmate + +import ( + "fmt" + "strings" + "testing" +) + +// TestMatchesVSCodeTextMate checks injections against vscode-textmate with sample.injection +// and the injection grammar of testdata/grammars; the tests here cover what it cannot. + +func TestParseGrammarReadsInjectionsInJavaScriptOrder(t *testing.T) { + raw := parseTestGrammar(t, `{"scopeName": "source.a", "injections": { + "b": {"match": "1"}, "10": {"match": "2"}, "a": {"match": "3"}, "2": {"match": "4"}, + "b": {"match": "5"}, "4294967295": {"match": "6"}, "01": {"match": "7"}, "c": null + }}`) + var got []string + for _, injection := range raw.Injections { + got = append(got, injection.Selector+"="+injection.Rule.Match) + } + want := "2=4 10=2 b=5 a=3 4294967295=6 01=7" + if strings.Join(got, " ") != want { + t.Fatalf("injections %v, want %s", got, want) + } +} + +func TestParseGrammarRejectsWrongInjections(t *testing.T) { + for source, path := range map[string]string{ + `{"scopeName": "source.a", "injections": []}`: "injections", + `{"scopeName": "source.a", "injections": {"source": 1}}`: "injections.source", + `{"scopeName": "source.a", "injections": {"source": {"match": 1}}}`: "injections.source.match", + } { + _, err := ParseGrammar([]byte(source)) + if err == nil || !strings.Contains(err.Error(), path) { + t.Errorf("ParseGrammar(%s) = %v, want an error at %s", source, err, path) + } + } +} + +// scopeStack returns the stack of the space-separated scopes, outermost first. +func scopeStack(g *Grammar, scopes string) *ScopeStack { + fields := strings.Fields(scopes) + stack := &ScopeStack{scope: fields[0], depth: 1} + return g.pushScopes(stack, strings.Join(fields[1:], " ")) +} + +func TestSelectorsMatchAsVSCodeTextMate(t *testing.T) { + g := testGrammar(t, "source.injection") + for _, c := range []struct { + selector, scopes string + want []bool + }{ + {"text.html", "text.html.basic", []bool{true}}, + {"text.htm", "text.html.basic", []bool{false}}, + {"text.html.basic.x", "text.html.basic", []bool{false}}, + // Names match in order, skipping scopes between them. + {"source.php string", "text.html.php meta.embedded source.php string.quoted", []bool{true}}, + {"string source.php", "text.html.php meta.embedded source.php string.quoted", []bool{false}}, + {"source.php source.php", "text.html.php source.php", []bool{false}}, + {"source.php source.php", "source.php meta source.php", []bool{true}}, + {"text - string", "text.html string.quoted", []bool{false}}, + {"text - string", "text.html", []bool{true}}, + {"text -", "text.html", []bool{false}}, + {"- string", "text.html", []bool{true}}, + {"text - (string | comment)", "text.html comment.line", []bool{false}}, + {"text - (string, comment", "text.html comment.line", []bool{false}}, + {"(string, comment) text", "text.html", []bool{false}}, + {"a, b", "b", []bool{false, true}}, + {"", "a", nil}, + {"L:", "a", []bool{true}}, + // The names a wildcard leaves never match a scope. + {"meta.tag.*.html", "meta.tag.any.html", []bool{false}}, + } { + parts := parseSelector(c.selector) + var got []bool + for _, part := range parts { + got = append(got, part.selector.matches(scopeStack(g, c.scopes))) + } + if fmt.Sprint(got) != fmt.Sprint(c.want) { + t.Errorf("%q on %q = %v, want %v", c.selector, c.scopes, got, c.want) + } + } +} + +func TestSelectorPriorities(t *testing.T) { + var got []int + for _, part := range parseSelector("L:a, R:b, c, X: d, L:") { + got = append(got, part.priority) + } + if fmt.Sprint(got) != "[-1 1 0 0 -1]" { + t.Fatalf("priorities %v", got) + } +} + +// tokenTexts tokenizes line with g and writes each token as its text and innermost scope. +func tokenTexts(t *testing.T, g *Grammar, line string) string { + t.Helper() + tokens, _, _ := g.NewTokenizer().TokenizeLine(nil, []byte(line), nil, 0) + var out []string + for i, token := range tokens { + end := len(line) + if i+1 < len(tokens) { + end = tokens[i+1].Start + } + out = append(out, fmt.Sprintf("%q=%s", line[token.Start:end], token.Scopes.Scope())) + } + return strings.Join(out, " ") +} + +func TestInjectedBeginEndRuleAddsOnlyItsPatterns(t *testing.T) { + g, _ := registryOf(parseTestGrammar(t, `{"scopeName": "source.a", "patterns": [], "injections": { + "source.a": {"begin": "B", "end": "E", "name": "never.a", "patterns": [{"match": "P", "name": "p.a"}]} + }}`)).Grammar("source.a") + got := tokenTexts(t, g, "B P E") + if want := `"B "=source.a "P"=p.a " E"=source.a`; got != want { + t.Fatalf("tokens %s, want %s", got, want) + } +} + +func TestIncludedGrammarsInjectNothing(t *testing.T) { + registry := NewRegistry() + registry.Add(parseTestGrammar(t, `{"scopeName": "source.a", "patterns": [{"include": "source.b"}], + "injections": {"source": {"patterns": [{"match": "A", "name": "a.a"}]}}}`)) + registry.Add(parseTestGrammar(t, `{"scopeName": "source.b", "patterns": [{"match": "x", "name": "x.b"}], + "injections": {"source": {"patterns": [{"match": "B", "name": "b.b"}]}}}`)) + a, _ := registry.Grammar("source.a") + if got, want := tokenTexts(t, a, "A B x"), `"A"=a.a " B "=source.a "x"=x.b`; got != want { + t.Errorf("source.a: tokens %s, want %s", got, want) + } + b, _ := registry.Grammar("source.b") + if got, want := tokenTexts(t, b, "A B x"), `"A "=source.b "B"=b.b " "=source.b "x"=x.b`; got != want { + t.Errorf("source.b: tokens %s, want %s", got, want) + } +} diff --git a/desktop/internal/editor/textmate/regex.go b/desktop/internal/editor/textmate/regex.go index 6ec2168d6e..66df22953b 100644 --- a/desktop/internal/editor/textmate/regex.go +++ b/desktop/internal/editor/textmate/regex.go @@ -51,9 +51,13 @@ func compilePattern(source string, noA, noG bool) (*regexp2.Regexp, error) { // which charSet writes them with. POSIX brackets ([:alpha:]) and \x{...}, which may list // several code points, have no .NET form and are spelled out. // - \R, \N, \O and \X become their definitions; an unknown escaped letter is the letter. +// - The absent operator (?~X) becomes (?:(?:(?!X)\O)*), a range in which no match of X +// starts, where Oniguruma's is a range that no match of X lies wholly inside. The two +// differ only on a match of X that starts in the range and ends past it, which no bundled +// grammar allows: C#'s only use, (?~\*/)$, ends at a line break, which no "*/" crosses. // // What has no translation, such as \K, a call of the whole pattern (\g<0>) or the absent -// operator, is an error, so the rule that uses it never matches. +// operator's other forms, (?~|...), is an error, so the rule that uses it never matches. type translator struct { src []rune pos int @@ -98,6 +102,8 @@ type frame struct { // group is the number of the capturing group the frame is, or 0, and source where its "(" // is in src. group, source int + // close is what the group's ")" becomes, when it is not ")". + close string } // groupSpan is where a capturing group is in src, from its "(" to past its ")", and whether @@ -182,7 +188,11 @@ func (t *translator) run() error { } last := t.frames[len(t.frames)-1] t.frames = t.frames[:len(t.frames)-1] - t.out = append(t.out, ')') + if last.close != "" { + t.write(last.close) + } else { + t.out = append(t.out, ')') + } t.pos++ t.atom, t.extended = last.start, last.extended if last.group > 0 && !t.resolved { @@ -353,6 +363,11 @@ func (t *translator) open() error { return t.condition(start) case c == 'i' || c == 'm' || c == 'x' || c == '-': return t.flags(start) + case c == '~' && t.peek(3) != '|': + // The absent operator; see translator. + t.frames = append(t.frames, frame{start: start, extended: t.extended, close: `)(?s:.))*)`}) + t.write("(?:(?:(?!") + t.pos += 3 default: return fmt.Errorf("unsupported group (?%c", c) } diff --git a/desktop/internal/editor/textmate/testdata/Dockerfile b/desktop/internal/editor/textmate/testdata/Dockerfile new file mode 100644 index 0000000000..27aacefb51 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/Dockerfile @@ -0,0 +1,14 @@ +# syntax=docker/dockerfile:1 +FROM golang:1.22 AS build +ARG VERSION=dev +ENV CGO_ENABLED=0 \ + GOOS=linux +WORKDIR /src +COPY --chown=app:app . . +RUN go build -ldflags "-X main.version=${VERSION}" -o /out/app ./cmd/app \ + && echo 'done' +FROM scratch +COPY --from=build /out/app /app +EXPOSE 8080/tcp +HEALTHCHECK CMD ["/app", "health"] +ENTRYPOINT ["/app"] diff --git a/desktop/internal/editor/textmate/testdata/Dockerfile.tokens b/desktop/internal/editor/textmate/testdata/Dockerfile.tokens new file mode 100644 index 0000000000..0c19858477 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/Dockerfile.tokens @@ -0,0 +1,15 @@ +[[0,"source.dockerfile comment.line.number-sign.dockerfile punctuation.definition.comment.dockerfile"],[1,"source.dockerfile comment.line.number-sign.dockerfile"]] +[[0,"source.dockerfile keyword.other.special-method.dockerfile"],[4,"source.dockerfile"],[17,"source.dockerfile keyword.other.special-method.dockerfile"],[19,"source.dockerfile"]] +[[0,"source.dockerfile keyword.other.special-method.dockerfile"],[3,"source.dockerfile"],[4,"source.dockerfile"]] +[[0,"source.dockerfile keyword.other.special-method.dockerfile"],[3,"source.dockerfile"],[4,"source.dockerfile"]] +[[0,"source.dockerfile"]] +[[0,"source.dockerfile keyword.other.special-method.dockerfile"],[7,"source.dockerfile"],[8,"source.dockerfile"]] +[[0,"source.dockerfile keyword.other.special-method.dockerfile"],[4,"source.dockerfile"],[5,"source.dockerfile"]] +[[0,"source.dockerfile keyword.other.special-method.dockerfile"],[3,"source.dockerfile"],[4,"source.dockerfile"],[22,"source.dockerfile string.quoted.double.dockerfile"],[23,"source.dockerfile string.quoted.double.dockerfile"],[49,"source.dockerfile string.quoted.double.dockerfile"],[50,"source.dockerfile"]] +[[0,"source.dockerfile"],[12,"source.dockerfile string.quoted.single.dockerfile"],[13,"source.dockerfile string.quoted.single.dockerfile"],[17,"source.dockerfile string.quoted.single.dockerfile"]] +[[0,"source.dockerfile keyword.other.special-method.dockerfile"],[4,"source.dockerfile"],[5,"source.dockerfile"]] +[[0,"source.dockerfile keyword.other.special-method.dockerfile"],[4,"source.dockerfile"],[5,"source.dockerfile"]] +[[0,"source.dockerfile keyword.other.special-method.dockerfile"],[6,"source.dockerfile"],[7,"source.dockerfile"]] +[[0,"source.dockerfile keyword.other.special-method.dockerfile"],[11,"source.dockerfile"],[12,"source.dockerfile"],[17,"source.dockerfile string.quoted.double.dockerfile"],[18,"source.dockerfile string.quoted.double.dockerfile"],[22,"source.dockerfile string.quoted.double.dockerfile"],[23,"source.dockerfile"],[25,"source.dockerfile string.quoted.double.dockerfile"],[26,"source.dockerfile string.quoted.double.dockerfile"],[32,"source.dockerfile string.quoted.double.dockerfile"],[33,"source.dockerfile"]] +[[0,"source.dockerfile keyword.other.special-method.dockerfile"],[10,"source.dockerfile"],[11,"source.dockerfile"],[12,"source.dockerfile string.quoted.double.dockerfile"],[13,"source.dockerfile string.quoted.double.dockerfile"],[17,"source.dockerfile string.quoted.double.dockerfile"],[18,"source.dockerfile"]] +[[0,"source.dockerfile"]] diff --git a/desktop/internal/editor/textmate/testdata/grammars/NOTICE.txt b/desktop/internal/editor/textmate/testdata/grammars/NOTICE.txt index 643e02db4d..4d5d6de732 100644 --- a/desktop/internal/editor/textmate/testdata/grammars/NOTICE.txt +++ b/desktop/internal/editor/textmate/testdata/grammars/NOTICE.txt @@ -1,10 +1,5 @@ Grammars the tests run in addition to the bundled ones in internal/editor/syntax/grammars. They -are test data only and are not part of the client; their languages get grammars from plugins. -The files are copied without changes. +are test data only and are not part of the client. -- cmake.tmLanguage.json: microsoft/vscode-cmake-tools syntaxes/CMake.tmLanguage.json at commit - e0969b894e56d8ea5e6641d48a82e5ba3babcc38. MIT, LICENSE.cmake.txt. -- groovy.tmLanguage.json: microsoft/vscode extensions/groovy/syntaxes/groovy.tmLanguage.json at - commit 498770fb016918e2f34e586fc5b26a7342f450a1. MIT, LICENSE.vscode.txt. Converted from - textmate/groovy.tmbundle 85d8f7c97ae473ccb9473f6c8d27e4ec957f4be1 under the Original TextMate - License, reproduced in LICENSE.groovy.txt. +- injection.tmLanguage.json: written for the tests, so that sample.injection checks how + injections are collected, ordered and matched against vscode-textmate. diff --git a/desktop/internal/editor/textmate/testdata/grammars/injection.tmLanguage.json b/desktop/internal/editor/textmate/testdata/grammars/injection.tmLanguage.json new file mode 100644 index 0000000000..fad7cf1938 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/grammars/injection.tmLanguage.json @@ -0,0 +1,99 @@ +{ + "comment": "Written for the tests: each injection checks one part of how vscode-textmate collects, orders and matches injections. sample.injection uses them all.", + "name": "Injection test", + "scopeName": "source.injection", + "patterns": [ + { "include": "#string" }, + { "include": "#block" }, + { "include": "#bracket" }, + { "match": "\\bkw\\b", "name": "keyword.normal.injection" }, + { "match": "@\\w+", "name": "normal.at.injection" }, + { + "match": "(<)([^>]*)(>)", + "captures": { + "1": { "name": "punctuation.angle.injection" }, + "2": { "name": "meta.inside.injection", "patterns": [{ "match": "\\w+", "name": "inner.word.injection" }] }, + "3": { "name": "punctuation.angle.injection" } + } + } + ], + "repository": { + "string": { + "begin": "\"", + "end": "\"", + "name": "string.quoted.double.injection", + "patterns": [{ "match": "\\\\.", "name": "constant.character.escape.injection" }] + }, + "block": { + "begin": "\\{", + "end": "\\}", + "name": "meta.block.injection", + "patterns": [{ "include": "$self" }] + }, + "bracket": { + "begin": "\\[", + "end": "\\]", + "name": "1.bracket.injection" + } + }, + "injections": { + "source.injection": { + "comment": "Listed before \"1\", which a JavaScript object still puts first, so at the same start \"1\" wins.", + "patterns": [{ "match": "&\\w+", "name": "named.amp.injection" }] + }, + "1": { + "patterns": [{ "match": "&\\w+", "name": "index.amp.injection" }] + }, + "L:source.injection - string": { + "comment": "L: wins over the rule's own match at the same start.", + "patterns": [{ "match": "@\\w+", "name": "left.at.injection" }] + }, + "source.injection - (string, meta.block)": { + "comment": "The comma inside the parentheses is an or, not a new part. At the same start the rule's own match wins.", + "patterns": [ + { "match": "\\bkw\\b", "name": "injected.kw.injection" }, + { "match": "#\\w+", "name": "hash.injection" } + ] + }, + "source.injection string.quoted": { + "patterns": [{ "match": "TODO", "name": "markup.todo.injection" }] + }, + "string.quote": { + "comment": "A prefix of a scope selects it only up to a dot.", + "patterns": [{ "match": "\\w+", "name": "wrong.prefix.injection" }] + }, + "R:source.injection": { + "comment": "Sorted after the part without a priority that follows it.", + "patterns": [{ "match": "%\\w+", "name": "right.percent.injection" }] + }, + "source": { + "patterns": [{ "match": "%\\w+", "name": "plain.percent.injection" }] + }, + "L:, R:source.injection meta.block": { + "comment": "A part with only a priority matches everywhere.", + "patterns": [{ "match": "\\^", "name": "caret.injection" }] + }, + "source.injection -": { + "comment": "A negation of nothing matches nothing.", + "patterns": [{ "match": "~", "name": "never.tilde.injection" }] + }, + "(string.quoted": { + "comment": "An unclosed parenthesis still parses.", + "patterns": [{ "match": "\\$\\w+", "name": "dollar.injection" }] + }, + "meta.inside": { + "comment": "Captures tokenized again with patterns see the injections too.", + "patterns": [{ "match": "!", "name": "bang.injection" }] + }, + "meta.block": { + "patterns": [{ "match": "DUP", "name": "dup.first.injection" }] + }, + "meta.block ": { + "patterns": [{ "match": "DUP\\w*", "name": "dup.spaced.injection" }] + }, + "meta.block": { + "comment": "A repeated key keeps the place of its first and the rule of its last.", + "patterns": [{ "match": "DUP", "name": "dup.last.injection" }] + } + } +} diff --git a/desktop/internal/editor/textmate/testdata/sample.cs b/desktop/internal/editor/textmate/testdata/sample.cs new file mode 100644 index 0000000000..220d799373 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; + +namespace Demo.App; + +/// Documentation. +/** + * Block documentation. + * a * / b + */ +[Serializable] +public sealed class User : Base, IComparable +{ + private const int Limit = 0x1F; + public string Name { get; init; } = "anon"; + + public async Task CountAsync(double scale = 1.5e3) + { + // a comment + var list = new List { 1, 2, 3 }; + if (list is { Count: > 0 } && Name != null) + { + Console.WriteLine($"Hello {Name}, {list.Count} items\n" + @"C:\path"); + } + return await Task.FromResult(null); + } +} diff --git a/desktop/internal/editor/textmate/testdata/sample.cs.tokens b/desktop/internal/editor/textmate/testdata/sample.cs.tokens new file mode 100644 index 0000000000..790f61bd36 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.cs.tokens @@ -0,0 +1,28 @@ +[[0,"source.cs keyword.other.directive.using.cs"],[5,"source.cs"],[6,"source.cs entity.name.type.namespace.cs"],[12,"source.cs punctuation.terminator.statement.cs"]] +[[0,"source.cs keyword.other.directive.using.cs"],[5,"source.cs"],[6,"source.cs entity.name.type.namespace.cs"],[12,"source.cs punctuation.accessor.cs"],[13,"source.cs entity.name.type.namespace.cs"],[24,"source.cs punctuation.accessor.cs"],[25,"source.cs entity.name.type.namespace.cs"],[32,"source.cs punctuation.terminator.statement.cs"]] +[[0,"source.cs"]] +[[0,"source.cs storage.type.namespace.cs"],[9,"source.cs"],[10,"source.cs entity.name.type.namespace.cs"],[14,"source.cs punctuation.accessor.cs"],[15,"source.cs entity.name.type.namespace.cs"],[18,"source.cs punctuation.terminator.statement.cs"]] +[[0,"source.cs"]] +[[0,"source.cs comment.block.documentation.cs punctuation.definition.comment.cs"],[3,"source.cs comment.block.documentation.cs"],[4,"source.cs comment.block.documentation.cs meta.tag.cs punctuation.definition.tag.cs"],[5,"source.cs comment.block.documentation.cs meta.tag.cs entity.name.tag.cs entity.name.tag.localname.cs"],[12,"source.cs comment.block.documentation.cs meta.tag.cs punctuation.definition.tag.cs"],[13,"source.cs comment.block.documentation.cs"],[27,"source.cs comment.block.documentation.cs meta.tag.cs punctuation.definition.tag.cs"],[29,"source.cs comment.block.documentation.cs meta.tag.cs entity.name.tag.cs entity.name.tag.localname.cs"],[36,"source.cs comment.block.documentation.cs meta.tag.cs punctuation.definition.tag.cs"]] +[[0,"source.cs comment.block.documentation.cs punctuation.definition.comment.cs"]] +[[0,"source.cs comment.block.documentation.cs punctuation.whitespace.comment.leading.cs"],[1,"source.cs comment.block.documentation.cs punctuation.definition.comment.cs"],[2,"source.cs comment.block.documentation.cs"],[3,"source.cs comment.block.documentation.cs meta.tag.cs punctuation.definition.tag.cs"],[4,"source.cs comment.block.documentation.cs meta.tag.cs entity.name.tag.cs entity.name.tag.localname.cs"],[9,"source.cs comment.block.documentation.cs meta.tag.cs"],[10,"source.cs comment.block.documentation.cs meta.tag.cs entity.other.attribute-name.cs entity.other.attribute-name.localname.cs"],[14,"source.cs comment.block.documentation.cs meta.tag.cs punctuation.separator.equals.cs"],[15,"source.cs comment.block.documentation.cs meta.tag.cs string.quoted.double.cs punctuation.definition.string.begin.cs"],[16,"source.cs comment.block.documentation.cs meta.tag.cs string.quoted.double.cs"],[17,"source.cs comment.block.documentation.cs meta.tag.cs string.quoted.double.cs punctuation.definition.string.end.cs"],[18,"source.cs comment.block.documentation.cs meta.tag.cs punctuation.definition.tag.cs"],[19,"source.cs comment.block.documentation.cs"],[39,"source.cs comment.block.documentation.cs meta.tag.cs punctuation.definition.tag.cs"],[41,"source.cs comment.block.documentation.cs meta.tag.cs entity.name.tag.cs entity.name.tag.localname.cs"],[46,"source.cs comment.block.documentation.cs meta.tag.cs punctuation.definition.tag.cs"]] +[[0,"source.cs comment.block.documentation.cs punctuation.whitespace.comment.leading.cs"],[1,"source.cs comment.block.documentation.cs punctuation.definition.comment.cs"],[2,"source.cs comment.block.documentation.cs"]] +[[0,"source.cs comment.block.documentation.cs punctuation.whitespace.comment.leading.cs"],[1,"source.cs comment.block.documentation.cs punctuation.definition.comment.cs"]] +[[0,"source.cs punctuation.squarebracket.open.cs"],[1,"source.cs entity.name.type.cs"],[13,"source.cs punctuation.squarebracket.close.cs"]] +[[0,"source.cs storage.modifier.public.cs"],[6,"source.cs"],[7,"source.cs storage.modifier.sealed.cs"],[13,"source.cs"],[14,"source.cs storage.type.class.cs"],[19,"source.cs"],[20,"source.cs entity.name.type.class.cs"],[24,"source.cs"],[25,"source.cs punctuation.separator.colon.cs"],[26,"source.cs"],[27,"source.cs entity.name.type.cs"],[31,"source.cs punctuation.separator.comma.cs"],[32,"source.cs"],[33,"source.cs entity.name.type.cs"],[44,"source.cs punctuation.definition.typeparameters.begin.cs"],[45,"source.cs entity.name.type.cs"],[49,"source.cs punctuation.definition.typeparameters.end.cs"]] +[[0,"source.cs punctuation.curlybrace.open.cs"]] +[[0,"source.cs"],[4,"source.cs storage.modifier.private.cs"],[11,"source.cs"],[12,"source.cs storage.modifier.const.cs"],[17,"source.cs"],[18,"source.cs keyword.type.int.cs"],[21,"source.cs"],[22,"source.cs entity.name.variable.field.cs"],[27,"source.cs"],[28,"source.cs keyword.operator.assignment.cs"],[29,"source.cs"],[30,"source.cs constant.numeric.other.preffix.hex.cs"],[32,"source.cs constant.numeric.hex.cs"],[34,"source.cs punctuation.terminator.statement.cs"]] +[[0,"source.cs"],[4,"source.cs storage.modifier.public.cs"],[10,"source.cs"],[11,"source.cs keyword.type.string.cs"],[17,"source.cs"],[18,"source.cs entity.name.variable.property.cs"],[22,"source.cs"],[23,"source.cs punctuation.curlybrace.open.cs"],[24,"source.cs"],[25,"source.cs storage.type.accessor.get.cs"],[28,"source.cs punctuation.terminator.statement.cs"],[29,"source.cs"],[30,"source.cs storage.type.accessor.init.cs"],[34,"source.cs punctuation.terminator.statement.cs"],[35,"source.cs"],[36,"source.cs punctuation.curlybrace.close.cs"],[37,"source.cs"],[38,"source.cs keyword.operator.assignment.cs"],[39,"source.cs"],[40,"source.cs string.quoted.double.cs punctuation.definition.string.begin.cs"],[41,"source.cs string.quoted.double.cs"],[45,"source.cs string.quoted.double.cs punctuation.definition.string.end.cs"],[46,"source.cs punctuation.terminator.statement.cs"]] +[[0,"source.cs"]] +[[0,"source.cs"],[4,"source.cs storage.modifier.public.cs"],[10,"source.cs"],[11,"source.cs storage.modifier.async.cs"],[16,"source.cs"],[17,"source.cs entity.name.type.cs"],[21,"source.cs punctuation.definition.typeparameters.begin.cs"],[22,"source.cs keyword.type.int.cs"],[25,"source.cs punctuation.separator.question-mark.cs"],[26,"source.cs punctuation.definition.typeparameters.end.cs"],[27,"source.cs"],[28,"source.cs entity.name.function.cs"],[38,"source.cs punctuation.parenthesis.open.cs"],[39,"source.cs keyword.type.double.cs"],[45,"source.cs"],[46,"source.cs entity.name.variable.parameter.cs"],[51,"source.cs"],[52,"source.cs keyword.operator.assignment.cs"],[53,"source.cs"],[54,"source.cs constant.numeric.decimal.cs"],[55,"source.cs constant.numeric.other.separator.decimals.cs"],[56,"source.cs constant.numeric.decimal.cs"],[57,"source.cs constant.numeric.other.exponent.cs"],[58,"source.cs constant.numeric.decimal.cs"],[59,"source.cs punctuation.parenthesis.close.cs"]] +[[0,"source.cs"],[4,"source.cs punctuation.curlybrace.open.cs"]] +[[0,"source.cs comment.line.double-slash.cs punctuation.whitespace.comment.leading.cs"],[8,"source.cs comment.line.double-slash.cs punctuation.definition.comment.cs"],[10,"source.cs comment.line.double-slash.cs"]] +[[0,"source.cs"],[8,"source.cs storage.type.var.cs"],[11,"source.cs"],[12,"source.cs entity.name.variable.local.cs"],[16,"source.cs"],[17,"source.cs keyword.operator.assignment.cs"],[18,"source.cs"],[19,"source.cs keyword.operator.expression.new.cs"],[22,"source.cs"],[23,"source.cs entity.name.type.cs"],[27,"source.cs punctuation.definition.typeparameters.begin.cs"],[28,"source.cs keyword.type.int.cs"],[31,"source.cs punctuation.definition.typeparameters.end.cs"],[32,"source.cs"],[33,"source.cs punctuation.curlybrace.open.cs"],[34,"source.cs"],[35,"source.cs constant.numeric.decimal.cs"],[36,"source.cs punctuation.separator.comma.cs"],[37,"source.cs"],[38,"source.cs constant.numeric.decimal.cs"],[39,"source.cs punctuation.separator.comma.cs"],[40,"source.cs"],[41,"source.cs constant.numeric.decimal.cs"],[42,"source.cs"],[43,"source.cs punctuation.curlybrace.close.cs"],[44,"source.cs punctuation.terminator.statement.cs"]] +[[0,"source.cs"],[8,"source.cs keyword.control.conditional.if.cs"],[10,"source.cs"],[11,"source.cs punctuation.parenthesis.open.cs"],[12,"source.cs variable.other.readwrite.cs"],[16,"source.cs"],[17,"source.cs keyword.operator.expression.pattern.is.cs"],[19,"source.cs"],[20,"source.cs punctuation.curlybrace.open.cs"],[21,"source.cs"],[22,"source.cs variable.other.object.property.cs"],[27,"source.cs punctuation.separator.colon.cs"],[28,"source.cs"],[29,"source.cs keyword.operator.relational.cs"],[30,"source.cs"],[31,"source.cs constant.numeric.decimal.cs"],[32,"source.cs"],[33,"source.cs punctuation.curlybrace.close.cs"],[34,"source.cs"],[35,"source.cs keyword.operator.logical.cs"],[37,"source.cs"],[38,"source.cs variable.other.readwrite.cs"],[42,"source.cs"],[43,"source.cs keyword.operator.comparison.cs"],[45,"source.cs"],[46,"source.cs constant.language.null.cs"],[50,"source.cs punctuation.parenthesis.close.cs"]] +[[0,"source.cs"],[8,"source.cs punctuation.curlybrace.open.cs"]] +[[0,"source.cs"],[12,"source.cs variable.other.object.cs"],[19,"source.cs punctuation.accessor.cs"],[20,"source.cs entity.name.function.cs"],[29,"source.cs punctuation.parenthesis.open.cs"],[30,"source.cs string.quoted.double.cs punctuation.definition.string.begin.cs"],[32,"source.cs string.quoted.double.cs"],[38,"source.cs string.quoted.double.cs meta.embedded.interpolation.cs punctuation.definition.interpolation.begin.cs"],[39,"source.cs string.quoted.double.cs meta.embedded.interpolation.cs variable.other.readwrite.cs"],[43,"source.cs string.quoted.double.cs meta.embedded.interpolation.cs punctuation.definition.interpolation.end.cs"],[44,"source.cs string.quoted.double.cs"],[46,"source.cs string.quoted.double.cs meta.embedded.interpolation.cs punctuation.definition.interpolation.begin.cs"],[47,"source.cs string.quoted.double.cs meta.embedded.interpolation.cs variable.other.object.cs"],[51,"source.cs string.quoted.double.cs meta.embedded.interpolation.cs punctuation.accessor.cs"],[52,"source.cs string.quoted.double.cs meta.embedded.interpolation.cs variable.other.object.property.cs"],[57,"source.cs string.quoted.double.cs meta.embedded.interpolation.cs punctuation.definition.interpolation.end.cs"],[58,"source.cs string.quoted.double.cs"],[64,"source.cs string.quoted.double.cs constant.character.escape.cs"],[66,"source.cs string.quoted.double.cs punctuation.definition.string.end.cs"],[67,"source.cs"],[68,"source.cs keyword.operator.arithmetic.cs"],[69,"source.cs"],[70,"source.cs string.quoted.double.cs punctuation.definition.string.begin.cs"],[72,"source.cs string.quoted.double.cs"],[79,"source.cs string.quoted.double.cs punctuation.definition.string.end.cs"],[80,"source.cs punctuation.parenthesis.close.cs"],[81,"source.cs punctuation.terminator.statement.cs"]] +[[0,"source.cs"],[8,"source.cs punctuation.curlybrace.close.cs"]] +[[0,"source.cs"],[8,"source.cs keyword.control.flow.return.cs"],[14,"source.cs"],[15,"source.cs keyword.operator.expression.await.cs"],[20,"source.cs"],[21,"source.cs variable.other.object.cs"],[25,"source.cs punctuation.accessor.cs"],[26,"source.cs entity.name.function.cs"],[36,"source.cs punctuation.definition.typeparameters.begin.cs"],[37,"source.cs keyword.type.int.cs"],[40,"source.cs punctuation.separator.question-mark.cs"],[41,"source.cs punctuation.definition.typeparameters.end.cs"],[42,"source.cs punctuation.parenthesis.open.cs"],[43,"source.cs constant.language.null.cs"],[47,"source.cs punctuation.parenthesis.close.cs"],[48,"source.cs punctuation.terminator.statement.cs"]] +[[0,"source.cs"],[4,"source.cs punctuation.curlybrace.close.cs"]] +[[0,"source.cs punctuation.curlybrace.close.cs"]] +[[0,"source.cs"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.graphql b/desktop/internal/editor/textmate/testdata/sample.graphql new file mode 100644 index 0000000000..23ac59d029 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.graphql @@ -0,0 +1,25 @@ +# A query +query GetUser($id: ID!, $first: Int = 10) @cached(ttl: 60) { + user(id: $id) { + id + name + ...UserFields + posts(first: $first, orderBy: {field: CREATED_AT, direction: DESC}) { + edges { node { title } } + } + } +} + +fragment UserFields on User { + email + isActive +} + +"""A user.""" +type User implements Node { + id: ID! + score: Float = 1.5 + role: Role @deprecated(reason: "no") +} + +enum Role { ADMIN USER } diff --git a/desktop/internal/editor/textmate/testdata/sample.graphql.tokens b/desktop/internal/editor/textmate/testdata/sample.graphql.tokens new file mode 100644 index 0000000000..84631439b7 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.graphql.tokens @@ -0,0 +1,26 @@ +[[0,"source.graphql comment.line.graphql.js"]] +[[0,"source.graphql keyword.operation.graphql"],[5,"source.graphql"],[6,"source.graphql entity.name.function.graphql"],[13,"source.graphql meta.brace.round.graphql"],[14,"source.graphql meta.variables.graphql variable.parameter.graphql"],[17,"source.graphql meta.variables.graphql punctuation.colon.graphql"],[18,"source.graphql meta.variables.graphql"],[19,"source.graphql meta.variables.graphql support.type.builtin.graphql"],[21,"source.graphql meta.variables.graphql keyword.operator.nulltype.graphql"],[22,"source.graphql meta.variables.graphql punctuation.comma.graphql"],[23,"source.graphql meta.variables.graphql"],[24,"source.graphql meta.variables.graphql variable.parameter.graphql"],[30,"source.graphql meta.variables.graphql punctuation.colon.graphql"],[31,"source.graphql meta.variables.graphql"],[32,"source.graphql meta.variables.graphql support.type.builtin.graphql"],[35,"source.graphql meta.variables.graphql"],[36,"source.graphql meta.variables.graphql punctuation.assignment.graphql"],[37,"source.graphql meta.variables.graphql"],[38,"source.graphql meta.variables.graphql constant.numeric.float.graphql"],[40,"source.graphql meta.brace.round.graphql"],[41,"source.graphql"],[42,"source.graphql entity.name.function.directive.graphql"],[49,"source.graphql meta.arguments.graphql meta.brace.round.directive.graphql"],[50,"source.graphql meta.arguments.graphql variable.parameter.graphql"],[53,"source.graphql meta.arguments.graphql punctuation.colon.graphql"],[54,"source.graphql meta.arguments.graphql"],[55,"source.graphql meta.arguments.graphql constant.numeric.float.graphql"],[57,"source.graphql meta.arguments.graphql meta.brace.round.directive.graphql"],[58,"source.graphql meta.selectionset.graphql"],[59,"source.graphql meta.selectionset.graphql punctuation.operation.graphql"]] +[[0,"source.graphql meta.selectionset.graphql"],[2,"source.graphql meta.selectionset.graphql variable.graphql"],[6,"source.graphql meta.selectionset.graphql meta.arguments.graphql meta.brace.round.directive.graphql"],[7,"source.graphql meta.selectionset.graphql meta.arguments.graphql variable.parameter.graphql"],[9,"source.graphql meta.selectionset.graphql meta.arguments.graphql punctuation.colon.graphql"],[10,"source.graphql meta.selectionset.graphql meta.arguments.graphql"],[11,"source.graphql meta.selectionset.graphql meta.arguments.graphql variable.graphql"],[14,"source.graphql meta.selectionset.graphql meta.arguments.graphql meta.brace.round.directive.graphql"],[15,"source.graphql meta.selectionset.graphql meta.selectionset.graphql"],[16,"source.graphql meta.selectionset.graphql meta.selectionset.graphql punctuation.operation.graphql"]] +[[0,"source.graphql meta.selectionset.graphql meta.selectionset.graphql"],[4,"source.graphql meta.selectionset.graphql meta.selectionset.graphql variable.graphql"]] +[[0,"source.graphql meta.selectionset.graphql meta.selectionset.graphql"],[4,"source.graphql meta.selectionset.graphql meta.selectionset.graphql variable.graphql"]] +[[0,"source.graphql meta.selectionset.graphql meta.selectionset.graphql"],[4,"source.graphql meta.selectionset.graphql meta.selectionset.graphql keyword.operator.spread.graphql"],[7,"source.graphql meta.selectionset.graphql meta.selectionset.graphql variable.fragment.graphql"]] +[[0,"source.graphql meta.selectionset.graphql meta.selectionset.graphql"],[4,"source.graphql meta.selectionset.graphql meta.selectionset.graphql variable.graphql"],[9,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql meta.brace.round.directive.graphql"],[10,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql variable.parameter.graphql"],[15,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql punctuation.colon.graphql"],[16,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql"],[17,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql variable.graphql"],[23,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql punctuation.comma.graphql"],[24,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql"],[25,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql variable.parameter.graphql"],[32,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql punctuation.colon.graphql"],[33,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql meta.objectvalues.graphql"],[34,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql meta.objectvalues.graphql meta.brace.curly.graphql"],[35,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql meta.objectvalues.graphql constant.object.key.graphql string.unquoted.graphql"],[40,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql meta.objectvalues.graphql punctuation.graphql"],[41,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql meta.objectvalues.graphql constant.character.enum.graphql"],[52,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql meta.objectvalues.graphql"],[53,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql meta.objectvalues.graphql"],[54,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql meta.objectvalues.graphql constant.object.key.graphql string.unquoted.graphql"],[63,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql meta.objectvalues.graphql punctuation.graphql"],[64,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql meta.objectvalues.graphql constant.character.enum.graphql"],[69,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql meta.objectvalues.graphql meta.brace.curly.graphql"],[70,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.arguments.graphql meta.brace.round.directive.graphql"],[71,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql"],[72,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql punctuation.operation.graphql"]] +[[0,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql"],[6,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql variable.graphql"],[11,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql"],[12,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql punctuation.operation.graphql"],[13,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql"],[14,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql variable.graphql"],[18,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql"],[19,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql punctuation.operation.graphql"],[20,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql"],[21,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql variable.graphql"],[26,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql"],[27,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql punctuation.operation.graphql"],[28,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql"],[29,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql punctuation.operation.graphql"]] +[[0,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql"],[4,"source.graphql meta.selectionset.graphql meta.selectionset.graphql meta.selectionset.graphql punctuation.operation.graphql"]] +[[0,"source.graphql meta.selectionset.graphql meta.selectionset.graphql"],[2,"source.graphql meta.selectionset.graphql meta.selectionset.graphql punctuation.operation.graphql"]] +[[0,"source.graphql meta.selectionset.graphql punctuation.operation.graphql"]] +[[0,"source.graphql"]] +[[0,"source.graphql meta.fragment.graphql keyword.fragment.graphql"],[8,"source.graphql meta.fragment.graphql"],[9,"source.graphql meta.fragment.graphql entity.name.fragment.graphql"],[19,"source.graphql meta.fragment.graphql"],[20,"source.graphql meta.fragment.graphql keyword.on.graphql"],[22,"source.graphql meta.fragment.graphql"],[23,"source.graphql meta.fragment.graphql support.type.graphql"],[27,"source.graphql meta.fragment.graphql meta.selectionset.graphql"],[28,"source.graphql meta.fragment.graphql meta.selectionset.graphql punctuation.operation.graphql"]] +[[0,"source.graphql meta.fragment.graphql meta.selectionset.graphql"],[2,"source.graphql meta.fragment.graphql meta.selectionset.graphql variable.graphql"]] +[[0,"source.graphql meta.fragment.graphql meta.selectionset.graphql"],[2,"source.graphql meta.fragment.graphql meta.selectionset.graphql variable.graphql"]] +[[0,"source.graphql meta.fragment.graphql meta.selectionset.graphql punctuation.operation.graphql"]] +[[0,"source.graphql"]] +[[0,"source.graphql comment.block.documentation.graphql"],[3,"source.graphql comment.block.documentation.graphql"],[10,"source.graphql comment.block.documentation.graphql"]] +[[0,"source.graphql meta.type.interface.graphql keyword.type.graphql"],[4,"source.graphql meta.type.interface.graphql"],[5,"source.graphql meta.type.interface.graphql support.type.graphql"],[9,"source.graphql meta.type.interface.graphql"],[10,"source.graphql meta.type.interface.graphql keyword.implements.graphql"],[20,"source.graphql meta.type.interface.graphql"],[21,"source.graphql meta.type.interface.graphql support.type.graphql"],[25,"source.graphql meta.type.interface.graphql"],[26,"source.graphql meta.type.interface.graphql meta.type.object.graphql punctuation.operation.graphql"]] +[[0,"source.graphql meta.type.interface.graphql meta.type.object.graphql"],[2,"source.graphql meta.type.interface.graphql meta.type.object.graphql variable.graphql"],[4,"source.graphql meta.type.interface.graphql meta.type.object.graphql punctuation.colon.graphql"],[5,"source.graphql meta.type.interface.graphql meta.type.object.graphql"],[6,"source.graphql meta.type.interface.graphql meta.type.object.graphql support.type.builtin.graphql"],[8,"source.graphql meta.type.interface.graphql meta.type.object.graphql keyword.operator.nulltype.graphql"]] +[[0,"source.graphql meta.type.interface.graphql meta.type.object.graphql"],[2,"source.graphql meta.type.interface.graphql meta.type.object.graphql variable.graphql"],[7,"source.graphql meta.type.interface.graphql meta.type.object.graphql punctuation.colon.graphql"],[8,"source.graphql meta.type.interface.graphql meta.type.object.graphql"],[9,"source.graphql meta.type.interface.graphql meta.type.object.graphql support.type.builtin.graphql"],[14,"source.graphql meta.type.interface.graphql meta.type.object.graphql"],[15,"source.graphql meta.type.interface.graphql meta.type.object.graphql punctuation.assignment.graphql"],[16,"source.graphql meta.type.interface.graphql meta.type.object.graphql"],[17,"source.graphql meta.type.interface.graphql meta.type.object.graphql constant.numeric.float.graphql"]] +[[0,"source.graphql meta.type.interface.graphql meta.type.object.graphql"],[2,"source.graphql meta.type.interface.graphql meta.type.object.graphql variable.graphql"],[6,"source.graphql meta.type.interface.graphql meta.type.object.graphql punctuation.colon.graphql"],[7,"source.graphql meta.type.interface.graphql meta.type.object.graphql"],[8,"source.graphql meta.type.interface.graphql meta.type.object.graphql support.type.graphql"],[12,"source.graphql meta.type.interface.graphql meta.type.object.graphql"],[13,"source.graphql meta.type.interface.graphql meta.type.object.graphql entity.name.function.directive.graphql"],[24,"source.graphql meta.type.interface.graphql meta.type.object.graphql meta.arguments.graphql meta.brace.round.directive.graphql"],[25,"source.graphql meta.type.interface.graphql meta.type.object.graphql meta.arguments.graphql variable.parameter.graphql"],[31,"source.graphql meta.type.interface.graphql meta.type.object.graphql meta.arguments.graphql punctuation.colon.graphql"],[32,"source.graphql meta.type.interface.graphql meta.type.object.graphql meta.arguments.graphql"],[33,"source.graphql meta.type.interface.graphql meta.type.object.graphql meta.arguments.graphql string.quoted.double.graphql punctuation.definition.string.begin.graphql"],[34,"source.graphql meta.type.interface.graphql meta.type.object.graphql meta.arguments.graphql string.quoted.double.graphql"],[36,"source.graphql meta.type.interface.graphql meta.type.object.graphql meta.arguments.graphql string.quoted.double.graphql punctuation.definition.string.end.graphql"],[37,"source.graphql meta.type.interface.graphql meta.type.object.graphql meta.arguments.graphql meta.brace.round.directive.graphql"]] +[[0,"source.graphql meta.type.interface.graphql meta.type.object.graphql punctuation.operation.graphql"]] +[[0,"source.graphql"]] +[[0,"source.graphql meta.enum.graphql keyword.enum.graphql"],[4,"source.graphql meta.enum.graphql"],[5,"source.graphql meta.enum.graphql support.type.enum.graphql"],[9,"source.graphql meta.enum.graphql meta.type.object.graphql"],[10,"source.graphql meta.enum.graphql meta.type.object.graphql punctuation.operation.graphql"],[11,"source.graphql meta.enum.graphql meta.type.object.graphql constant.character.enum.graphql"],[17,"source.graphql meta.enum.graphql meta.type.object.graphql constant.character.enum.graphql"],[22,"source.graphql meta.enum.graphql meta.type.object.graphql"],[23,"source.graphql meta.enum.graphql meta.type.object.graphql punctuation.operation.graphql"]] +[[0,"source.graphql"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.html b/desktop/internal/editor/textmate/testdata/sample.html index 282bf2610b..4dffce736d 100644 --- a/desktop/internal/editor/textmate/testdata/sample.html +++ b/desktop/internal/editor/textmate/testdata/sample.html @@ -19,6 +19,7 @@

Hello

Text with a link and © 2026.

+

1 < 2 and bold

A picture
diff --git a/desktop/internal/editor/textmate/testdata/sample.html.tokens b/desktop/internal/editor/textmate/testdata/sample.html.tokens index fea5a03434..52d04fee5d 100644 --- a/desktop/internal/editor/textmate/testdata/sample.html.tokens +++ b/desktop/internal/editor/textmate/testdata/sample.html.tokens @@ -19,6 +19,7 @@ [[0,"text.html.basic"],[2,"text.html.basic meta.tag.structure.main.start.html punctuation.definition.tag.begin.html"],[3,"text.html.basic meta.tag.structure.main.start.html entity.name.tag.html"],[7,"text.html.basic meta.tag.structure.main.start.html"],[8,"text.html.basic meta.tag.structure.main.start.html meta.attribute.id.html entity.other.attribute-name.html"],[10,"text.html.basic meta.tag.structure.main.start.html meta.attribute.id.html punctuation.separator.key-value.html"],[11,"text.html.basic meta.tag.structure.main.start.html meta.attribute.id.html string.quoted.double.html punctuation.definition.string.begin.html"],[12,"text.html.basic meta.tag.structure.main.start.html meta.attribute.id.html string.quoted.double.html"],[16,"text.html.basic meta.tag.structure.main.start.html meta.attribute.id.html string.quoted.double.html punctuation.definition.string.end.html"],[17,"text.html.basic meta.tag.structure.main.start.html punctuation.definition.tag.end.html"]] [[0,"text.html.basic"],[4,"text.html.basic meta.tag.structure.h1.start.html punctuation.definition.tag.begin.html"],[5,"text.html.basic meta.tag.structure.h1.start.html entity.name.tag.html"],[7,"text.html.basic meta.tag.structure.h1.start.html"],[8,"text.html.basic meta.tag.structure.h1.start.html meta.attribute.class.html entity.other.attribute-name.html"],[13,"text.html.basic meta.tag.structure.h1.start.html meta.attribute.class.html punctuation.separator.key-value.html"],[14,"text.html.basic meta.tag.structure.h1.start.html meta.attribute.class.html string.quoted.double.html punctuation.definition.string.begin.html"],[15,"text.html.basic meta.tag.structure.h1.start.html meta.attribute.class.html string.quoted.double.html"],[20,"text.html.basic meta.tag.structure.h1.start.html meta.attribute.class.html string.quoted.double.html punctuation.definition.string.end.html"],[21,"text.html.basic meta.tag.structure.h1.start.html punctuation.definition.tag.end.html"],[22,"text.html.basic"],[27,"text.html.basic meta.tag.structure.h1.end.html punctuation.definition.tag.begin.html"],[29,"text.html.basic meta.tag.structure.h1.end.html entity.name.tag.html"],[31,"text.html.basic meta.tag.structure.h1.end.html punctuation.definition.tag.end.html"]] [[0,"text.html.basic"],[4,"text.html.basic meta.tag.structure.p.start.html punctuation.definition.tag.begin.html"],[5,"text.html.basic meta.tag.structure.p.start.html entity.name.tag.html"],[6,"text.html.basic meta.tag.structure.p.start.html punctuation.definition.tag.end.html"],[7,"text.html.basic"],[17,"text.html.basic meta.tag.inline.a.start.html punctuation.definition.tag.begin.html"],[18,"text.html.basic meta.tag.inline.a.start.html entity.name.tag.html"],[19,"text.html.basic meta.tag.inline.a.start.html"],[20,"text.html.basic meta.tag.inline.a.start.html meta.attribute.href.html entity.other.attribute-name.html"],[24,"text.html.basic meta.tag.inline.a.start.html meta.attribute.href.html punctuation.separator.key-value.html"],[25,"text.html.basic meta.tag.inline.a.start.html meta.attribute.href.html string.quoted.double.html punctuation.definition.string.begin.html"],[26,"text.html.basic meta.tag.inline.a.start.html meta.attribute.href.html string.quoted.double.html"],[45,"text.html.basic meta.tag.inline.a.start.html meta.attribute.href.html string.quoted.double.html punctuation.definition.string.end.html"],[46,"text.html.basic meta.tag.inline.a.start.html"],[47,"text.html.basic meta.tag.inline.a.start.html meta.attribute.target.html entity.other.attribute-name.html"],[53,"text.html.basic meta.tag.inline.a.start.html meta.attribute.target.html punctuation.separator.key-value.html"],[54,"text.html.basic meta.tag.inline.a.start.html meta.attribute.target.html string.quoted.double.html punctuation.definition.string.begin.html"],[55,"text.html.basic meta.tag.inline.a.start.html meta.attribute.target.html string.quoted.double.html"],[61,"text.html.basic meta.tag.inline.a.start.html meta.attribute.target.html string.quoted.double.html punctuation.definition.string.end.html"],[62,"text.html.basic meta.tag.inline.a.start.html punctuation.definition.tag.end.html"],[63,"text.html.basic"],[69,"text.html.basic meta.tag.inline.a.end.html punctuation.definition.tag.begin.html"],[71,"text.html.basic meta.tag.inline.a.end.html entity.name.tag.html"],[72,"text.html.basic meta.tag.inline.a.end.html punctuation.definition.tag.end.html"],[73,"text.html.basic"],[78,"text.html.basic constant.character.entity.named.copy.html punctuation.definition.entity.html"],[79,"text.html.basic constant.character.entity.named.copy.html"],[83,"text.html.basic constant.character.entity.named.copy.html punctuation.definition.entity.html"],[84,"text.html.basic"],[90,"text.html.basic meta.tag.structure.p.end.html punctuation.definition.tag.begin.html"],[92,"text.html.basic meta.tag.structure.p.end.html entity.name.tag.html"],[93,"text.html.basic meta.tag.structure.p.end.html punctuation.definition.tag.end.html"]] +[[0,"text.html.basic"],[4,"text.html.basic meta.tag.structure.p.start.html punctuation.definition.tag.begin.html"],[5,"text.html.basic meta.tag.structure.p.start.html entity.name.tag.html"],[6,"text.html.basic meta.tag.structure.p.start.html punctuation.definition.tag.end.html"],[7,"text.html.basic"],[9,"text.html.basic invalid.illegal.bad-angle-bracket.html"],[10,"text.html.basic"],[17,"text.html.basic meta.tag.inline.b.start.html punctuation.definition.tag.begin.html"],[18,"text.html.basic meta.tag.inline.b.start.html entity.name.tag.html"],[19,"text.html.basic meta.tag.inline.b.start.html punctuation.definition.tag.end.html"],[20,"text.html.basic"],[24,"text.html.basic meta.tag.inline.b.end.html punctuation.definition.tag.begin.html"],[26,"text.html.basic meta.tag.inline.b.end.html entity.name.tag.html"],[27,"text.html.basic meta.tag.inline.b.end.html punctuation.definition.tag.end.html"],[28,"text.html.basic"],[29,"text.html.basic comment.block.html punctuation.definition.comment.html"],[33,"text.html.basic comment.block.html"],[40,"text.html.basic comment.block.html punctuation.definition.comment.html"],[43,"text.html.basic meta.tag.structure.p.end.html punctuation.definition.tag.begin.html"],[45,"text.html.basic meta.tag.structure.p.end.html entity.name.tag.html"],[46,"text.html.basic meta.tag.structure.p.end.html punctuation.definition.tag.end.html"]] [[0,"text.html.basic"],[4,"text.html.basic meta.tag.object.img.void.html punctuation.definition.tag.begin.html"],[5,"text.html.basic meta.tag.object.img.void.html entity.name.tag.html"],[8,"text.html.basic meta.tag.object.img.void.html"],[9,"text.html.basic meta.tag.object.img.void.html meta.attribute.src.html entity.other.attribute-name.html"],[12,"text.html.basic meta.tag.object.img.void.html meta.attribute.src.html punctuation.separator.key-value.html"],[13,"text.html.basic meta.tag.object.img.void.html meta.attribute.src.html string.quoted.double.html punctuation.definition.string.begin.html"],[14,"text.html.basic meta.tag.object.img.void.html meta.attribute.src.html string.quoted.double.html"],[19,"text.html.basic meta.tag.object.img.void.html meta.attribute.src.html string.quoted.double.html punctuation.definition.string.end.html"],[20,"text.html.basic meta.tag.object.img.void.html"],[21,"text.html.basic meta.tag.object.img.void.html meta.attribute.alt.html entity.other.attribute-name.html"],[24,"text.html.basic meta.tag.object.img.void.html meta.attribute.alt.html punctuation.separator.key-value.html"],[25,"text.html.basic meta.tag.object.img.void.html meta.attribute.alt.html string.quoted.double.html punctuation.definition.string.begin.html"],[26,"text.html.basic meta.tag.object.img.void.html meta.attribute.alt.html string.quoted.double.html"],[35,"text.html.basic meta.tag.object.img.void.html meta.attribute.alt.html string.quoted.double.html punctuation.definition.string.end.html"],[36,"text.html.basic meta.tag.object.img.void.html"],[37,"text.html.basic meta.tag.object.img.void.html meta.attribute.width.html entity.other.attribute-name.html"],[42,"text.html.basic meta.tag.object.img.void.html meta.attribute.width.html punctuation.separator.key-value.html"],[43,"text.html.basic meta.tag.object.img.void.html meta.attribute.width.html string.unquoted.html"],[46,"text.html.basic meta.tag.object.img.void.html punctuation.definition.tag.end.html"]] [[0,"text.html.basic"],[4,"text.html.basic meta.tag.inline.br.void.html punctuation.definition.tag.begin.html"],[5,"text.html.basic meta.tag.inline.br.void.html entity.name.tag.html"],[7,"text.html.basic meta.tag.inline.br.void.html punctuation.definition.tag.end.html"]] [[0,"text.html.basic"],[4,"text.html.basic meta.tag.structure.button.start.html punctuation.definition.tag.begin.html"],[5,"text.html.basic meta.tag.structure.button.start.html entity.name.tag.html"],[11,"text.html.basic meta.tag.structure.button.start.html"],[12,"text.html.basic meta.tag.structure.button.start.html meta.attribute.type.html entity.other.attribute-name.html"],[16,"text.html.basic meta.tag.structure.button.start.html meta.attribute.type.html punctuation.separator.key-value.html"],[17,"text.html.basic meta.tag.structure.button.start.html meta.attribute.type.html string.quoted.double.html punctuation.definition.string.begin.html"],[18,"text.html.basic meta.tag.structure.button.start.html meta.attribute.type.html string.quoted.double.html"],[24,"text.html.basic meta.tag.structure.button.start.html meta.attribute.type.html string.quoted.double.html punctuation.definition.string.end.html"],[25,"text.html.basic meta.tag.structure.button.start.html"],[26,"text.html.basic meta.tag.structure.button.start.html meta.attribute.event-handler.click.html entity.other.attribute-name.html"],[33,"text.html.basic meta.tag.structure.button.start.html meta.attribute.event-handler.click.html punctuation.separator.key-value.html"],[34,"text.html.basic meta.tag.structure.button.start.html meta.attribute.event-handler.click.html meta.embedded.line.js string.quoted.double.html punctuation.definition.string.begin.html"],[35,"text.html.basic meta.tag.structure.button.start.html meta.attribute.event-handler.click.html meta.embedded.line.js string.quoted.double.html source.js meta.function-call.js entity.name.function.js"],[40,"text.html.basic meta.tag.structure.button.start.html meta.attribute.event-handler.click.html meta.embedded.line.js string.quoted.double.html source.js meta.brace.round.js"],[41,"text.html.basic meta.tag.structure.button.start.html meta.attribute.event-handler.click.html meta.embedded.line.js string.quoted.double.html source.js string.quoted.single.js punctuation.definition.string.begin.js"],[42,"text.html.basic meta.tag.structure.button.start.html meta.attribute.event-handler.click.html meta.embedded.line.js string.quoted.double.html source.js string.quoted.single.js"],[45,"text.html.basic meta.tag.structure.button.start.html meta.attribute.event-handler.click.html meta.embedded.line.js string.quoted.double.html source.js string.quoted.single.js punctuation.definition.string.end.js"],[46,"text.html.basic meta.tag.structure.button.start.html meta.attribute.event-handler.click.html meta.embedded.line.js string.quoted.double.html source.js meta.brace.round.js"],[47,"text.html.basic meta.tag.structure.button.start.html meta.attribute.event-handler.click.html meta.embedded.line.js string.quoted.double.html punctuation.definition.string.end.html source.js"],[48,"text.html.basic meta.tag.structure.button.start.html"],[49,"text.html.basic meta.tag.structure.button.start.html meta.attribute.disabled.html entity.other.attribute-name.html"],[57,"text.html.basic meta.tag.structure.button.start.html punctuation.definition.tag.end.html"],[58,"text.html.basic"],[63,"text.html.basic meta.tag.structure.button.end.html punctuation.definition.tag.begin.html"],[65,"text.html.basic meta.tag.structure.button.end.html entity.name.tag.html"],[71,"text.html.basic meta.tag.structure.button.end.html punctuation.definition.tag.end.html"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.injection b/desktop/internal/editor/textmate/testdata/sample.injection new file mode 100644 index 0000000000..7d679099fc --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.injection @@ -0,0 +1,6 @@ +kw @at #hash %pct & ^ ~ TODO +"kw @at #hash TODO $var \" quote ^ ~" +{ kw @at #hash %pct DUP DUPx ^ "TODO $in" } +[ & %pct ] & + after and <> +{ { nested ^ @deep } } tail @end diff --git a/desktop/internal/editor/textmate/testdata/sample.injection.tokens b/desktop/internal/editor/textmate/testdata/sample.injection.tokens new file mode 100644 index 0000000000..2b8d07a042 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.injection.tokens @@ -0,0 +1,7 @@ +[[0,"source.injection keyword.normal.injection"],[2,"source.injection"],[3,"source.injection left.at.injection"],[6,"source.injection"],[7,"source.injection hash.injection"],[12,"source.injection"],[13,"source.injection plain.percent.injection"],[17,"source.injection"],[18,"source.injection named.amp.injection"],[22,"source.injection"],[23,"source.injection caret.injection"],[24,"source.injection"]] +[[0,"source.injection string.quoted.double.injection"],[1,"source.injection string.quoted.double.injection"],[14,"source.injection string.quoted.double.injection markup.todo.injection"],[18,"source.injection string.quoted.double.injection"],[19,"source.injection string.quoted.double.injection dollar.injection"],[23,"source.injection string.quoted.double.injection"],[24,"source.injection string.quoted.double.injection constant.character.escape.injection"],[26,"source.injection string.quoted.double.injection"],[33,"source.injection string.quoted.double.injection caret.injection"],[34,"source.injection string.quoted.double.injection"],[36,"source.injection string.quoted.double.injection"]] +[[0,"source.injection meta.block.injection"],[1,"source.injection meta.block.injection"],[2,"source.injection meta.block.injection keyword.normal.injection"],[4,"source.injection meta.block.injection"],[5,"source.injection meta.block.injection left.at.injection"],[8,"source.injection meta.block.injection"],[15,"source.injection meta.block.injection plain.percent.injection"],[19,"source.injection meta.block.injection"],[20,"source.injection meta.block.injection dup.last.injection"],[23,"source.injection meta.block.injection"],[24,"source.injection meta.block.injection dup.last.injection"],[27,"source.injection meta.block.injection"],[29,"source.injection meta.block.injection caret.injection"],[30,"source.injection meta.block.injection"],[31,"source.injection meta.block.injection string.quoted.double.injection"],[32,"source.injection meta.block.injection string.quoted.double.injection markup.todo.injection"],[36,"source.injection meta.block.injection string.quoted.double.injection"],[37,"source.injection meta.block.injection string.quoted.double.injection dollar.injection"],[40,"source.injection meta.block.injection string.quoted.double.injection"],[41,"source.injection meta.block.injection"],[42,"source.injection meta.block.injection"]] +[[0,"source.injection 1.bracket.injection"],[1,"source.injection 1.bracket.injection"],[2,"source.injection 1.bracket.injection index.amp.injection"],[6,"source.injection 1.bracket.injection"],[7,"source.injection 1.bracket.injection plain.percent.injection"],[11,"source.injection 1.bracket.injection"],[12,"source.injection 1.bracket.injection"],[13,"source.injection"],[14,"source.injection named.amp.injection"]] +[[0,"source.injection punctuation.angle.injection"],[1,"source.injection meta.inside.injection inner.word.injection"],[3,"source.injection meta.inside.injection bang.injection"],[4,"source.injection meta.inside.injection inner.word.injection"],[6,"source.injection meta.inside.injection"],[7,"source.injection meta.inside.injection left.at.injection"],[9,"source.injection punctuation.angle.injection"],[10,"source.injection"],[17,"source.injection punctuation.angle.injection"],[18,"source.injection meta.inside.injection bang.injection"],[19,"source.injection punctuation.angle.injection"],[20,"source.injection"],[25,"source.injection punctuation.angle.injection"],[26,"source.injection punctuation.angle.injection"]] +[[0,"source.injection meta.block.injection"],[1,"source.injection meta.block.injection"],[2,"source.injection meta.block.injection meta.block.injection"],[3,"source.injection meta.block.injection meta.block.injection"],[11,"source.injection meta.block.injection meta.block.injection caret.injection"],[12,"source.injection meta.block.injection meta.block.injection"],[13,"source.injection meta.block.injection meta.block.injection left.at.injection"],[18,"source.injection meta.block.injection meta.block.injection"],[19,"source.injection meta.block.injection meta.block.injection"],[20,"source.injection meta.block.injection"],[21,"source.injection meta.block.injection punctuation.angle.injection"],[22,"source.injection meta.block.injection meta.inside.injection inner.word.injection"],[23,"source.injection meta.block.injection meta.inside.injection bang.injection"],[24,"source.injection meta.block.injection meta.inside.injection inner.word.injection"],[25,"source.injection meta.block.injection punctuation.angle.injection"],[26,"source.injection meta.block.injection"],[27,"source.injection meta.block.injection"],[28,"source.injection"],[34,"source.injection left.at.injection"]] +[[0,"source.injection"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.kt b/desktop/internal/editor/textmate/testdata/sample.kt new file mode 100644 index 0000000000..092235bdc9 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.kt @@ -0,0 +1,25 @@ +package demo.app + +import kotlin.math.max + +/** Documentation. */ +@JvmInline +value class Id(val raw: Long) + +data class User(val name: String, var age: Int = 0) : Base(), Comparable { + override fun compareTo(other: User): Int = age - other.age + + fun greet(): String { + // comment + val list = listOf(1, 2, 0x1F, 3.5f) + return "Hi $name, ${list.size} items\n" + } +} + +suspend fun main() { + val user = User("Ann") ?: return + when (user.age) { + in 0..17 -> println("minor") + else -> println('x') + } +} diff --git a/desktop/internal/editor/textmate/testdata/sample.kt.tokens b/desktop/internal/editor/textmate/testdata/sample.kt.tokens new file mode 100644 index 0000000000..bf0019720c --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.kt.tokens @@ -0,0 +1,26 @@ +[[0,"source.kotlin meta.package.kotlin keyword.hard.package.kotlin"],[7,"source.kotlin meta.package.kotlin"],[8,"source.kotlin meta.package.kotlin entity.name.package.kotlin"]] +[[0,"source.kotlin"]] +[[0,"source.kotlin meta.import.kotlin keyword.soft.kotlin"],[6,"source.kotlin meta.import.kotlin"],[7,"source.kotlin meta.import.kotlin entity.name.package.kotlin"]] +[[0,"source.kotlin"]] +[[0,"source.kotlin comment.block.javadoc.kotlin"],[3,"source.kotlin comment.block.javadoc.kotlin"],[19,"source.kotlin comment.block.javadoc.kotlin"]] +[[0,"source.kotlin entity.name.type.annotation.kotlin"]] +[[0,"source.kotlin storage.modifier.other.kotlin"],[5,"source.kotlin"],[6,"source.kotlin keyword.hard.class.kotlin"],[11,"source.kotlin"],[12,"source.kotlin entity.name.type.class.kotlin"],[14,"source.kotlin"],[15,"source.kotlin keyword.hard.kotlin"],[18,"source.kotlin"],[19,"source.kotlin"],[22,"source.kotlin"],[24,"source.kotlin entity.name.type.kotlin"],[28,"source.kotlin"]] +[[0,"source.kotlin"]] +[[0,"source.kotlin storage.modifier.other.kotlin"],[4,"source.kotlin"],[5,"source.kotlin keyword.hard.class.kotlin"],[10,"source.kotlin"],[11,"source.kotlin entity.name.type.class.kotlin"],[15,"source.kotlin"],[16,"source.kotlin keyword.hard.kotlin"],[19,"source.kotlin"],[20,"source.kotlin"],[24,"source.kotlin"],[26,"source.kotlin entity.name.type.kotlin"],[32,"source.kotlin"],[34,"source.kotlin keyword.hard.kotlin"],[37,"source.kotlin"],[38,"source.kotlin"],[41,"source.kotlin"],[43,"source.kotlin entity.name.type.kotlin"],[46,"source.kotlin"],[47,"source.kotlin keyword.operator.assignment.kotlin"],[48,"source.kotlin"],[49,"source.kotlin constant.numeric.decimal.kotlin"],[50,"source.kotlin"],[52,"source.kotlin"],[54,"source.kotlin entity.name.type.kotlin"],[58,"source.kotlin"],[62,"source.kotlin entity.name.function.call.kotlin"],[72,"source.kotlin"],[73,"source.kotlin entity.name.type.kotlin"],[77,"source.kotlin"],[78,"source.kotlin"],[79,"source.kotlin"]] +[[0,"source.kotlin"],[4,"source.kotlin storage.modifier.other.kotlin"],[12,"source.kotlin"],[13,"source.kotlin keyword.hard.fun.kotlin"],[16,"source.kotlin"],[17,"source.kotlin entity.name.function.declaration.kotlin"],[26,"source.kotlin"],[32,"source.kotlin"],[34,"source.kotlin entity.name.type.kotlin"],[38,"source.kotlin"],[39,"source.kotlin"],[41,"source.kotlin entity.name.type.kotlin"],[44,"source.kotlin"],[45,"source.kotlin keyword.operator.assignment.kotlin"],[46,"source.kotlin"],[51,"source.kotlin keyword.operator.arithmetic.kotlin"],[52,"source.kotlin"]] +[[0,"source.kotlin"]] +[[0,"source.kotlin"],[4,"source.kotlin keyword.hard.fun.kotlin"],[7,"source.kotlin"],[8,"source.kotlin entity.name.function.declaration.kotlin"],[13,"source.kotlin"],[15,"source.kotlin"],[17,"source.kotlin entity.name.type.kotlin"],[23,"source.kotlin"],[24,"source.kotlin"]] +[[0,"source.kotlin"],[8,"source.kotlin comment.line.double-slash.kotlin"],[10,"source.kotlin comment.line.double-slash.kotlin"]] +[[0,"source.kotlin"],[8,"source.kotlin keyword.hard.kotlin"],[11,"source.kotlin"],[12,"source.kotlin"],[17,"source.kotlin keyword.operator.assignment.kotlin"],[18,"source.kotlin"],[19,"source.kotlin entity.name.function.call.kotlin"],[25,"source.kotlin"],[26,"source.kotlin constant.numeric.decimal.kotlin"],[27,"source.kotlin"],[29,"source.kotlin constant.numeric.decimal.kotlin"],[30,"source.kotlin"],[32,"source.kotlin constant.numeric.hex.kotlin"],[36,"source.kotlin"],[38,"source.kotlin constant.numeric.decimal.kotlin"],[42,"source.kotlin"]] +[[0,"source.kotlin"],[8,"source.kotlin keyword.control.kotlin"],[14,"source.kotlin"],[15,"source.kotlin string.quoted.double.kotlin"],[16,"source.kotlin string.quoted.double.kotlin"],[19,"source.kotlin string.quoted.double.kotlin variable.string-escape.kotlin"],[24,"source.kotlin string.quoted.double.kotlin"],[26,"source.kotlin string.quoted.double.kotlin meta.template.expression.kotlin punctuation.definition.template-expression.begin"],[28,"source.kotlin string.quoted.double.kotlin meta.template.expression.kotlin"],[37,"source.kotlin string.quoted.double.kotlin meta.template.expression.kotlin punctuation.definition.template-expression.end"],[38,"source.kotlin string.quoted.double.kotlin"],[44,"source.kotlin string.quoted.double.kotlin constant.character.escape.kotlin"],[46,"source.kotlin string.quoted.double.kotlin"]] +[[0,"source.kotlin"]] +[[0,"source.kotlin"]] +[[0,"source.kotlin"]] +[[0,"source.kotlin storage.modifier.other.kotlin"],[7,"source.kotlin"],[8,"source.kotlin keyword.hard.fun.kotlin"],[11,"source.kotlin"],[12,"source.kotlin entity.name.function.declaration.kotlin"],[16,"source.kotlin"]] +[[0,"source.kotlin"],[4,"source.kotlin keyword.hard.kotlin"],[7,"source.kotlin"],[8,"source.kotlin"],[13,"source.kotlin keyword.operator.assignment.kotlin"],[14,"source.kotlin"],[15,"source.kotlin entity.name.function.call.kotlin"],[19,"source.kotlin"],[20,"source.kotlin string.quoted.double.kotlin"],[21,"source.kotlin string.quoted.double.kotlin"],[24,"source.kotlin string.quoted.double.kotlin"],[25,"source.kotlin"],[30,"source.kotlin keyword.control.kotlin"]] +[[0,"source.kotlin"],[4,"source.kotlin keyword.control.kotlin"],[8,"source.kotlin"]] +[[0,"source.kotlin"],[8,"source.kotlin keyword.hard.kotlin"],[10,"source.kotlin"],[11,"source.kotlin constant.numeric.decimal.kotlin"],[12,"source.kotlin keyword.operator.range.kotlin"],[14,"source.kotlin constant.numeric.decimal.kotlin"],[16,"source.kotlin"],[17,"source.kotlin storage.type.function.arrow.kotlin"],[19,"source.kotlin"],[20,"source.kotlin entity.name.function.call.kotlin"],[27,"source.kotlin"],[28,"source.kotlin string.quoted.double.kotlin"],[29,"source.kotlin string.quoted.double.kotlin"],[34,"source.kotlin string.quoted.double.kotlin"],[35,"source.kotlin"]] +[[0,"source.kotlin"],[8,"source.kotlin keyword.control.kotlin"],[12,"source.kotlin"],[13,"source.kotlin storage.type.function.arrow.kotlin"],[15,"source.kotlin"],[16,"source.kotlin entity.name.function.call.kotlin"],[23,"source.kotlin"],[24,"source.kotlin string.quoted.single.kotlin"],[25,"source.kotlin string.quoted.single.kotlin"],[26,"source.kotlin string.quoted.single.kotlin"],[27,"source.kotlin"]] +[[0,"source.kotlin"]] +[[0,"source.kotlin"]] +[[0,"source.kotlin"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.lua b/desktop/internal/editor/textmate/testdata/sample.lua new file mode 100644 index 0000000000..b8cc746702 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.lua @@ -0,0 +1,20 @@ +-- A comment +--[[ A block +comment ]] +local M = {} +local count = 0x1F + 1.5e3 + +function M.greet(name, ...) + local greeting = "Hello, " .. (name or 'world') .. "\n" + if #greeting > 10 and not false then + print(greeting) + end + for i = 1, 10 do + count = count + i + end + return setmetatable({}, { __index = M }) +end + +local s = [[long +string]] +return M diff --git a/desktop/internal/editor/textmate/testdata/sample.lua.tokens b/desktop/internal/editor/textmate/testdata/sample.lua.tokens new file mode 100644 index 0000000000..3bade3fd83 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.lua.tokens @@ -0,0 +1,21 @@ +[[0,"source.lua comment.line.double-dash.lua punctuation.definition.comment.lua"],[2,"source.lua comment.line.double-dash.lua"]] +[[0,"source.lua comment.block.lua punctuation.definition.comment.begin.lua"],[4,"source.lua comment.block.lua"]] +[[0,"source.lua comment.block.lua"],[8,"source.lua comment.block.lua punctuation.definition.comment.end.lua"]] +[[0,"source.lua keyword.local.lua"],[5,"source.lua"],[6,"source.lua variable.other.lua"],[7,"source.lua"],[8,"source.lua keyword.operator.lua"],[9,"source.lua"]] +[[0,"source.lua keyword.local.lua"],[5,"source.lua"],[6,"source.lua variable.other.lua"],[11,"source.lua"],[12,"source.lua keyword.operator.lua"],[13,"source.lua"],[14,"source.lua constant.numeric.float.hexadecimal.lua"],[18,"source.lua"],[19,"source.lua keyword.operator.lua"],[20,"source.lua"],[21,"source.lua constant.numeric.float.lua"]] +[[0,"source.lua"]] +[[0,"source.lua meta.function.lua keyword.control.lua"],[8,"source.lua meta.function.lua"],[9,"source.lua meta.function.lua entity.name.function.lua"],[10,"source.lua meta.function.lua"],[11,"source.lua meta.function.lua entity.name.function.lua"],[16,"source.lua meta.function.lua meta.parameter.lua punctuation.definition.parameters.begin.lua"],[17,"source.lua meta.function.lua meta.parameter.lua variable.parameter.function.lua"],[21,"source.lua meta.function.lua meta.parameter.lua punctuation.separator.arguments.lua"],[22,"source.lua meta.function.lua meta.parameter.lua"],[26,"source.lua meta.function.lua meta.parameter.lua punctuation.definition.parameters.finish.lua"]] +[[0,"source.lua"],[2,"source.lua keyword.local.lua"],[7,"source.lua"],[8,"source.lua variable.other.lua"],[16,"source.lua"],[17,"source.lua keyword.operator.lua"],[18,"source.lua"],[19,"source.lua string.quoted.double.lua punctuation.definition.string.begin.lua"],[20,"source.lua string.quoted.double.lua"],[27,"source.lua string.quoted.double.lua punctuation.definition.string.end.lua"],[29,"source.lua keyword.operator.lua"],[31,"source.lua"],[33,"source.lua variable.other.lua"],[37,"source.lua"],[38,"source.lua keyword.operator.logical.lua"],[40,"source.lua"],[41,"source.lua string.quoted.single.lua punctuation.definition.string.begin.lua"],[42,"source.lua string.quoted.single.lua"],[47,"source.lua string.quoted.single.lua punctuation.definition.string.end.lua"],[48,"source.lua"],[50,"source.lua keyword.operator.lua"],[52,"source.lua"],[53,"source.lua string.quoted.double.lua punctuation.definition.string.begin.lua"],[54,"source.lua string.quoted.double.lua constant.character.escape.lua"],[56,"source.lua string.quoted.double.lua punctuation.definition.string.end.lua"]] +[[0,"source.lua"],[2,"source.lua keyword.control.lua"],[4,"source.lua"],[5,"source.lua keyword.operator.lua"],[6,"source.lua variable.other.lua"],[14,"source.lua"],[15,"source.lua keyword.operator.lua"],[16,"source.lua"],[17,"source.lua constant.numeric.float.lua"],[19,"source.lua"],[20,"source.lua keyword.operator.logical.lua"],[23,"source.lua"],[24,"source.lua keyword.operator.logical.lua"],[27,"source.lua"],[28,"source.lua constant.language.lua"],[33,"source.lua"],[34,"source.lua keyword.control.lua"]] +[[0,"source.lua"],[4,"source.lua support.function.lua"],[9,"source.lua"],[10,"source.lua variable.other.lua"],[18,"source.lua"]] +[[0,"source.lua"],[2,"source.lua keyword.control.lua"]] +[[0,"source.lua"],[2,"source.lua keyword.control.lua"],[5,"source.lua"],[6,"source.lua variable.other.lua"],[7,"source.lua"],[8,"source.lua keyword.operator.lua"],[9,"source.lua"],[10,"source.lua constant.numeric.float.lua"],[11,"source.lua"],[13,"source.lua constant.numeric.float.lua"],[15,"source.lua"],[16,"source.lua keyword.control.lua"]] +[[0,"source.lua"],[4,"source.lua variable.other.lua"],[9,"source.lua"],[10,"source.lua keyword.operator.lua"],[11,"source.lua"],[12,"source.lua variable.other.lua"],[17,"source.lua"],[18,"source.lua keyword.operator.lua"],[19,"source.lua"],[20,"source.lua variable.other.lua"]] +[[0,"source.lua"],[2,"source.lua keyword.control.lua"]] +[[0,"source.lua"],[2,"source.lua keyword.control.lua"],[8,"source.lua"],[9,"source.lua support.function.lua"],[21,"source.lua"],[28,"source.lua variable.other.lua"],[35,"source.lua"],[36,"source.lua keyword.operator.lua"],[37,"source.lua"],[38,"source.lua variable.other.lua"],[39,"source.lua"]] +[[0,"source.lua keyword.control.lua"]] +[[0,"source.lua"]] +[[0,"source.lua keyword.local.lua"],[5,"source.lua"],[6,"source.lua variable.other.lua"],[7,"source.lua"],[8,"source.lua keyword.operator.lua"],[9,"source.lua"],[10,"source.lua string.quoted.other.multiline.lua punctuation.definition.string.begin.lua"],[12,"source.lua string.quoted.other.multiline.lua"]] +[[0,"source.lua string.quoted.other.multiline.lua"],[6,"source.lua string.quoted.other.multiline.lua punctuation.definition.string.end.lua"]] +[[0,"source.lua keyword.control.lua"],[6,"source.lua"],[7,"source.lua variable.other.lua"]] +[[0,"source.lua"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.m b/desktop/internal/editor/textmate/testdata/sample.m new file mode 100644 index 0000000000..e93222d82b --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.m @@ -0,0 +1,22 @@ +#import +#import "Model.h" + +// A comment +@interface Person : NSObject +@property (nonatomic, copy) NSString *name; +@property (nonatomic) NSInteger age; +- (instancetype)initWithName:(NSString *)name; ++ (void)greet; +@end + +@implementation Person +- (instancetype)initWithName:(NSString *)name { + self = [super init]; + if (self != nil && name.length > 0) { + _name = [name copy]; + _age = 0x1F; + } + NSLog(@"Hello, %@! %d\n", name, 42); + return self; +} +@end diff --git a/desktop/internal/editor/textmate/testdata/sample.m.tokens b/desktop/internal/editor/textmate/testdata/sample.m.tokens new file mode 100644 index 0000000000..d83e61d433 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.m.tokens @@ -0,0 +1,23 @@ +[[0,"source.objc meta.preprocessor.include.objc keyword.control.directive.import.objc punctuation.definition.directive.objc"],[1,"source.objc meta.preprocessor.include.objc keyword.control.directive.import.objc"],[7,"source.objc meta.preprocessor.include.objc"],[8,"source.objc meta.preprocessor.include.objc string.quoted.other.lt-gt.include.objc punctuation.definition.string.begin.objc"],[9,"source.objc meta.preprocessor.include.objc string.quoted.other.lt-gt.include.objc"],[32,"source.objc meta.preprocessor.include.objc string.quoted.other.lt-gt.include.objc punctuation.definition.string.end.objc"]] +[[0,"source.objc meta.preprocessor.include.objc keyword.control.directive.import.objc punctuation.definition.directive.objc"],[1,"source.objc meta.preprocessor.include.objc keyword.control.directive.import.objc"],[7,"source.objc meta.preprocessor.include.objc"],[8,"source.objc meta.preprocessor.include.objc string.quoted.double.include.objc punctuation.definition.string.begin.objc"],[9,"source.objc meta.preprocessor.include.objc string.quoted.double.include.objc"],[16,"source.objc meta.preprocessor.include.objc string.quoted.double.include.objc punctuation.definition.string.end.objc"]] +[[0,"source.objc"]] +[[0,"source.objc comment.line.double-slash.objc punctuation.definition.comment.objc"],[2,"source.objc comment.line.double-slash.objc"]] +[[0,"source.objc meta.interface-or-protocol.objc storage.type.objc punctuation.definition.storage.type.objc"],[1,"source.objc meta.interface-or-protocol.objc storage.type.objc"],[10,"source.objc meta.interface-or-protocol.objc"],[11,"source.objc meta.interface-or-protocol.objc entity.name.type.objc"],[17,"source.objc meta.interface-or-protocol.objc"],[18,"source.objc meta.interface-or-protocol.objc punctuation.definition.entity.other.inherited-class.objc"],[19,"source.objc meta.interface-or-protocol.objc"],[20,"source.objc meta.interface-or-protocol.objc entity.other.inherited-class.objc"],[28,"source.objc meta.interface-or-protocol.objc meta.divider.objc"],[29,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.protocol-list.objc punctuation.section.scope.begin.objc"],[30,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.protocol-list.objc support.other.protocol.objc"],[39,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.protocol-list.objc punctuation.section.scope.end.objc"]] +[[0,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.property-with-attributes.objc keyword.other.property.objc punctuation.definition.keyword.objc"],[1,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.property-with-attributes.objc keyword.other.property.objc"],[9,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.property-with-attributes.objc"],[10,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.property-with-attributes.objc punctuation.section.scope.begin.objc"],[11,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.property-with-attributes.objc keyword.other.property.attribute.objc"],[20,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.property-with-attributes.objc"],[22,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.property-with-attributes.objc keyword.other.property.attribute.objc"],[26,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.property-with-attributes.objc punctuation.section.scope.end.objc"],[27,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc"],[28,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc support.class.cocoa.objc"],[36,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc"],[37,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc keyword.operator.objc"],[38,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc"],[42,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc punctuation.terminator.statement.objc"]] +[[0,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.property-with-attributes.objc keyword.other.property.objc punctuation.definition.keyword.objc"],[1,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.property-with-attributes.objc keyword.other.property.objc"],[9,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.property-with-attributes.objc"],[10,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.property-with-attributes.objc punctuation.section.scope.begin.objc"],[11,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.property-with-attributes.objc keyword.other.property.attribute.objc"],[20,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.property-with-attributes.objc punctuation.section.scope.end.objc"],[21,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc"],[22,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc support.type.cocoa.leopard.objc"],[31,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc"],[35,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc punctuation.terminator.statement.objc"]] +[[0,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc"],[2,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.return-type.objc punctuation.definition.type.begin.objc"],[3,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.return-type.objc storage.type.objc"],[15,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.return-type.objc punctuation.definition.type.end.objc"],[16,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.return-type.objc entity.name.function.objc"],[28,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.argument-type.objc entity.name.function.name-of-parameter.objc punctuation.separator.arguments.objc"],[29,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.argument-type.objc punctuation.definition.type.begin.objc"],[30,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.argument-type.objc support.class.cocoa.objc"],[38,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.argument-type.objc"],[39,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.argument-type.objc keyword.operator.objc"],[40,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.argument-type.objc punctuation.definition.type.end.objc"],[41,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.argument-type.objc variable.parameter.function.objc"],[45,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc"]] +[[0,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc"],[2,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.return-type.objc punctuation.definition.type.begin.objc"],[3,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.return-type.objc storage.type.built-in.primitive.objc"],[7,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.return-type.objc punctuation.definition.type.end.objc"],[8,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc meta.return-type.objc entity.name.function.objc"],[13,"source.objc meta.interface-or-protocol.objc meta.scope.interface.objc meta.function.objc"]] +[[0,"source.objc meta.interface-or-protocol.objc storage.type.objc punctuation.definition.storage.type.objc"],[1,"source.objc meta.interface-or-protocol.objc storage.type.objc"]] +[[0,"source.objc"]] +[[0,"source.objc meta.implementation.objc storage.type.objc punctuation.definition.storage.type.objc"],[1,"source.objc meta.implementation.objc storage.type.objc"],[15,"source.objc meta.implementation.objc"],[16,"source.objc meta.implementation.objc entity.name.type.objc"]] +[[0,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc"],[2,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc meta.return-type.objc punctuation.definition.type.begin.objc"],[3,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc meta.return-type.objc storage.type.objc"],[15,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc meta.return-type.objc punctuation.definition.type.end.objc"],[16,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc meta.return-type.objc entity.name.function.objc"],[28,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc meta.argument-type.objc entity.name.function.name-of-parameter.objc punctuation.separator.arguments.objc"],[29,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc meta.argument-type.objc punctuation.definition.type.begin.objc"],[30,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc meta.argument-type.objc support.class.cocoa.objc"],[38,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc meta.argument-type.objc"],[39,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc meta.argument-type.objc keyword.operator.objc"],[40,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc meta.argument-type.objc punctuation.definition.type.end.objc"],[41,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc meta.argument-type.objc variable.parameter.function.objc"],[45,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.function.objc"],[46,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc punctuation.section.block.begin.bracket.curly.objc"]] +[[0,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc"],[4,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc variable.language.objc"],[8,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc"],[9,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc keyword.operator.assignment.objc"],[10,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc"],[11,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.bracketed.objc punctuation.section.scope.begin.objc"],[12,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.bracketed.objc variable.language.objc"],[17,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.bracketed.objc"],[18,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.bracketed.objc meta.function-call.objc support.function.any-method.objc"],[22,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.bracketed.objc punctuation.section.scope.end.objc"],[23,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc punctuation.terminator.statement.objc"]] +[[0,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc"],[4,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc keyword.control.objc"],[6,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc"],[7,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc punctuation.section.parens.begin.bracket.round.objc"],[8,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc variable.language.objc"],[12,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc"],[13,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc keyword.operator.comparison.objc"],[15,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc"],[16,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc constant.language.objc"],[19,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc"],[20,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc keyword.operator.logical.objc"],[22,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc"],[23,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc variable.other.object.access.objc"],[27,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc punctuation.separator.dot-access.objc"],[28,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc variable.other.member.objc"],[34,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc"],[35,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc keyword.operator.comparison.objc"],[36,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc"],[37,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc constant.numeric.decimal.objc"],[38,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc punctuation.section.parens.end.bracket.round.objc"],[39,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc"],[40,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc punctuation.section.block.begin.bracket.curly.objc"]] +[[0,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc"],[14,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc keyword.operator.assignment.objc"],[15,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc"],[16,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.bracketed.objc punctuation.section.scope.begin.objc"],[17,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.bracketed.objc"],[22,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.bracketed.objc meta.function-call.objc support.function.any-method.objc"],[26,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.bracketed.objc punctuation.section.scope.end.objc"],[27,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc punctuation.terminator.statement.objc"]] +[[0,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc"],[13,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc keyword.operator.assignment.objc"],[14,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc"],[15,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc keyword.other.unit.hexadecimal.objc"],[17,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc constant.numeric.hexadecimal.objc"],[19,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc punctuation.terminator.statement.objc"]] +[[0,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc"],[4,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc punctuation.section.block.end.bracket.curly.objc"]] +[[0,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc punctuation.whitespace.support.function.leading.cocoa.objc"],[4,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc support.function.cocoa.objc"],[9,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc punctuation.section.parens.begin.bracket.round.objc"],[10,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc string.quoted.double.objc punctuation.definition.string.begin.objc"],[12,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc string.quoted.double.objc"],[19,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc string.quoted.double.objc constant.other.placeholder.objc"],[21,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc string.quoted.double.objc"],[23,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc string.quoted.double.objc constant.other.placeholder.objc"],[25,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc string.quoted.double.objc constant.character.escape.objc"],[27,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc string.quoted.double.objc punctuation.definition.string.end.objc"],[28,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc punctuation.separator.delimiter.objc"],[29,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc"],[34,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc punctuation.separator.delimiter.objc"],[35,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc"],[36,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc constant.numeric.decimal.objc"],[38,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc meta.parens.block.objc punctuation.section.parens.end.bracket.round.objc"],[39,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc punctuation.terminator.statement.objc"]] +[[0,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc"],[4,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc keyword.control.objc"],[10,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc"],[11,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc variable.language.objc"],[15,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc punctuation.terminator.statement.objc"]] +[[0,"source.objc meta.implementation.objc meta.scope.implementation.objc meta.function-with-body.objc meta.block.objc punctuation.section.block.end.bracket.curly.objc"]] +[[0,"source.objc meta.implementation.objc storage.type.objc punctuation.definition.storage.type.objc"],[1,"source.objc meta.implementation.objc storage.type.objc"]] +[[0,"source.objc"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.md.tokens b/desktop/internal/editor/textmate/testdata/sample.md.tokens index 94949e6d43..f35b1ef119 100644 --- a/desktop/internal/editor/textmate/testdata/sample.md.tokens +++ b/desktop/internal/editor/textmate/testdata/sample.md.tokens @@ -35,7 +35,7 @@ [[0,"text.html.markdown markup.table.markdown punctuation.definition.table.markdown"],[1,"text.html.markdown markup.table.markdown"],[2,"text.html.markdown markup.table.markdown punctuation.separator.table.markdown"],[8,"text.html.markdown markup.table.markdown"],[9,"text.html.markdown markup.table.markdown punctuation.definition.table.markdown"],[10,"text.html.markdown markup.table.markdown"],[11,"text.html.markdown markup.table.markdown punctuation.separator.table.markdown"],[16,"text.html.markdown markup.table.markdown"],[17,"text.html.markdown markup.table.markdown punctuation.definition.table.markdown"]] [[0,"text.html.markdown markup.table.markdown punctuation.definition.table.markdown"],[1,"text.html.markdown markup.table.markdown"],[2,"text.html.markdown markup.table.markdown"],[3,"text.html.markdown markup.table.markdown"],[9,"text.html.markdown markup.table.markdown punctuation.definition.table.markdown"],[10,"text.html.markdown markup.table.markdown"],[15,"text.html.markdown markup.table.markdown"],[16,"text.html.markdown markup.table.markdown"],[17,"text.html.markdown markup.table.markdown punctuation.definition.table.markdown"]] [[0,"text.html.markdown"]] -[[0,"text.html.markdown meta.paragraph.markdown"]] +[[0,"text.html.markdown meta.tag.structure.div.start.html punctuation.definition.tag.begin.html"],[1,"text.html.markdown meta.tag.structure.div.start.html entity.name.tag.html"],[4,"text.html.markdown meta.tag.structure.div.start.html"],[5,"text.html.markdown meta.tag.structure.div.start.html meta.attribute.align.html invalid.deprecated.entity.other.attribute-name.html"],[10,"text.html.markdown meta.tag.structure.div.start.html meta.attribute.align.html punctuation.separator.key-value.html"],[11,"text.html.markdown meta.tag.structure.div.start.html meta.attribute.align.html string.quoted.double.html punctuation.definition.string.begin.html"],[12,"text.html.markdown meta.tag.structure.div.start.html meta.attribute.align.html string.quoted.double.html"],[18,"text.html.markdown meta.tag.structure.div.start.html meta.attribute.align.html string.quoted.double.html punctuation.definition.string.end.html"],[19,"text.html.markdown meta.tag.structure.div.start.html punctuation.definition.tag.end.html"],[20,"text.html.markdown"],[27,"text.html.markdown meta.tag.inline.b.start.html punctuation.definition.tag.begin.html"],[28,"text.html.markdown meta.tag.inline.b.start.html entity.name.tag.html"],[29,"text.html.markdown meta.tag.inline.b.start.html punctuation.definition.tag.end.html"],[30,"text.html.markdown"],[34,"text.html.markdown meta.tag.inline.b.end.html punctuation.definition.tag.begin.html"],[36,"text.html.markdown meta.tag.inline.b.end.html entity.name.tag.html"],[37,"text.html.markdown meta.tag.inline.b.end.html punctuation.definition.tag.end.html"],[38,"text.html.markdown meta.tag.structure.div.end.html punctuation.definition.tag.begin.html"],[40,"text.html.markdown meta.tag.structure.div.end.html entity.name.tag.html"],[43,"text.html.markdown meta.tag.structure.div.end.html punctuation.definition.tag.end.html"]] [[0,"text.html.markdown"]] [[0,"text.html.markdown meta.separator.markdown"]] [[0,"text.html.markdown"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.mm b/desktop/internal/editor/textmate/testdata/sample.mm new file mode 100644 index 0000000000..0084598976 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.mm @@ -0,0 +1,22 @@ +#import +#include + +namespace demo { +template +class Box { +public: + explicit Box(T value) : value_(value) {} + T get() const { return value_; } +private: + T value_; +}; +} + +// A comment +@implementation Wrapper +- (void)run { + std::vector items{1, 2, 0x1F}; + auto box = demo::Box(items.size()); + NSLog(@"Items: %zu", static_cast(box.get())); +} +@end diff --git a/desktop/internal/editor/textmate/testdata/sample.mm.tokens b/desktop/internal/editor/textmate/testdata/sample.mm.tokens new file mode 100644 index 0000000000..cdb50c6874 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.mm.tokens @@ -0,0 +1,23 @@ +[[0,"source.objcpp meta.preprocessor.include.objcpp keyword.control.directive.import.objcpp punctuation.definition.directive.objcpp"],[1,"source.objcpp meta.preprocessor.include.objcpp keyword.control.directive.import.objcpp"],[7,"source.objcpp meta.preprocessor.include.objcpp"],[8,"source.objcpp meta.preprocessor.include.objcpp string.quoted.other.lt-gt.include.objcpp punctuation.definition.string.begin.objcpp"],[9,"source.objcpp meta.preprocessor.include.objcpp string.quoted.other.lt-gt.include.objcpp"],[32,"source.objcpp meta.preprocessor.include.objcpp string.quoted.other.lt-gt.include.objcpp punctuation.definition.string.end.objcpp"]] +[[0,"source.objcpp meta.preprocessor.include.objcpp keyword.control.directive.include.objcpp punctuation.definition.directive.objcpp"],[1,"source.objcpp meta.preprocessor.include.objcpp keyword.control.directive.include.objcpp"],[8,"source.objcpp meta.preprocessor.include.objcpp"],[9,"source.objcpp meta.preprocessor.include.objcpp string.quoted.other.lt-gt.include.objcpp punctuation.definition.string.begin.objcpp"],[10,"source.objcpp meta.preprocessor.include.objcpp string.quoted.other.lt-gt.include.objcpp"],[16,"source.objcpp meta.preprocessor.include.objcpp string.quoted.other.lt-gt.include.objcpp punctuation.definition.string.end.objcpp"]] +[[0,"source.objcpp"]] +[[0,"source.objcpp meta.namespace-block.objcpp storage.type.namespace.objcpp"],[9,"source.objcpp meta.namespace-block.objcpp"],[10,"source.objcpp meta.namespace-block.objcpp entity.name.type.objcpp"],[14,"source.objcpp meta.namespace-block.objcpp"],[15,"source.objcpp meta.namespace-block.objcpp punctuation.definition.scope.objcpp"]] +[[0,"source.objcpp meta.namespace-block.objcpp template.definition.objcpp storage.type.template.objcpp"],[8,"source.objcpp meta.namespace-block.objcpp template.definition.objcpp"],[9,"source.objcpp meta.namespace-block.objcpp template.definition.objcpp meta.template.angle-brackets.start.objcpp"],[10,"source.objcpp meta.namespace-block.objcpp template.definition.objcpp storage.type.template.objcpp"],[19,"source.objcpp meta.namespace-block.objcpp template.definition.objcpp entity.name.type.template.objcpp"],[20,"source.objcpp meta.namespace-block.objcpp template.definition.objcpp meta.template.angle-brackets.end.objcpp"]] +[[0,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp storage.type.class.objcpp"],[5,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp"],[6,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp entity.name.type.objcpp"],[9,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp"],[10,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp punctuation.section.block.begin.bracket.curly.objcpp"]] +[[0,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp storage.type.modifier.access.objcpp"]] +[[0,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp"],[4,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp storage.modifier.objcpp"],[12,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp"],[13,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.objcpp meta.function.definition.parameters.objcpp entity.name.function.objcpp"],[16,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.objcpp meta.function.definition.parameters.objcpp punctuation.section.parameters.begin.bracket.round.objcpp"],[17,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.objcpp meta.function.definition.parameters.objcpp"],[19,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.objcpp meta.function.definition.parameters.objcpp variable.parameter.probably.objcpp"],[24,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.objcpp meta.function.definition.parameters.objcpp punctuation.section.parameters.end.bracket.round.objcpp"],[25,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp"],[26,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.constructor.initializer-list.objcpp punctuation.definition.parameters.objcpp"],[27,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.constructor.initializer-list.objcpp"],[28,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.constructor.initializer-list.objcpp meta.function.objcpp meta.function.definition.parameters.objcpp entity.name.function.objcpp"],[34,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.constructor.initializer-list.objcpp meta.function.objcpp meta.function.definition.parameters.objcpp punctuation.section.parameters.begin.bracket.round.objcpp"],[35,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.constructor.initializer-list.objcpp meta.function.objcpp meta.function.definition.parameters.objcpp"],[40,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.constructor.initializer-list.objcpp meta.function.objcpp meta.function.definition.parameters.objcpp punctuation.section.parameters.end.bracket.round.objcpp"],[41,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.constructor.initializer-list.objcpp"],[42,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.block.objcpp punctuation.section.block.begin.bracket.curly.objcpp"],[43,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.block.objcpp punctuation.section.block.end.bracket.curly.objcpp"]] +[[0,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp"],[6,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.objcpp meta.function.definition.parameters.objcpp entity.name.function.objcpp"],[9,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.objcpp meta.function.definition.parameters.objcpp punctuation.section.parameters.begin.bracket.round.objcpp"],[10,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.function.objcpp meta.function.definition.parameters.objcpp punctuation.section.parameters.end.bracket.round.objcpp"],[11,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp"],[12,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp storage.modifier.objcpp"],[17,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp"],[18,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.block.objcpp punctuation.section.block.begin.bracket.curly.objcpp"],[19,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.block.objcpp"],[20,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.block.objcpp keyword.control.objcpp"],[26,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.block.objcpp"],[33,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.block.objcpp punctuation.terminator.statement.objcpp"],[34,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.block.objcpp"],[35,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp meta.block.objcpp punctuation.section.block.end.bracket.curly.objcpp"]] +[[0,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp storage.type.modifier.access.objcpp"]] +[[0,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp"],[12,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp punctuation.terminator.statement.objcpp"]] +[[0,"source.objcpp meta.namespace-block.objcpp meta.class-struct-block.objcpp punctuation.section.block.end.bracket.curly.objcpp"],[1,"source.objcpp meta.namespace-block.objcpp punctuation.terminator.statement.objcpp"]] +[[0,"source.objcpp meta.namespace-block.objcpp punctuation.definition.scope.objcpp"]] +[[0,"source.objcpp"]] +[[0,"source.objcpp comment.line.double-slash.objcpp punctuation.definition.comment.objcpp"],[2,"source.objcpp comment.line.double-slash.objcpp"]] +[[0,"source.objcpp meta.implementation.objcpp storage.type.objcpp punctuation.definition.storage.type.objcpp"],[1,"source.objcpp meta.implementation.objcpp storage.type.objcpp"],[15,"source.objcpp meta.implementation.objcpp"],[16,"source.objcpp meta.implementation.objcpp entity.name.type.objcpp"]] +[[0,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.function.objcpp"],[2,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.function.objcpp meta.return-type.objcpp punctuation.definition.type.begin.objcpp"],[3,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.function.objcpp meta.return-type.objcpp storage.type.built-in.primitive.objcpp"],[7,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.function.objcpp meta.return-type.objcpp punctuation.definition.type.end.objcpp"],[8,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.function.objcpp meta.return-type.objcpp entity.name.function.objcpp"],[11,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.function.objcpp"],[12,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp punctuation.section.block.begin.bracket.curly.objcpp"]] +[[0,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp"],[4,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp punctuation.separator.namespace.access.objcpp entity.scope.name.objcpp"],[7,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp punctuation.separator.namespace.access.objcpp punctuation.separator.namespace.access.objcpp"],[9,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp"],[15,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp keyword.operator.comparison.objcpp"],[16,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp storage.type.built-in.primitive.objcpp"],[19,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp keyword.operator.comparison.objcpp"],[20,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp"],[26,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp punctuation.section.block.begin.bracket.curly.objcpp"],[27,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.decimal.objcpp"],[28,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp punctuation.separator.delimiter.objcpp"],[29,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp"],[30,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.decimal.objcpp"],[31,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp punctuation.separator.delimiter.objcpp"],[32,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp"],[33,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp keyword.other.unit.hexadecimal.objcpp"],[35,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp constant.numeric.hexadecimal.objcpp"],[37,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp punctuation.section.block.end.bracket.curly.objcpp"],[38,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp punctuation.terminator.statement.objcpp"]] +[[0,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp"],[13,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp keyword.operator.assignment.objcpp"],[14,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp"],[15,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp punctuation.separator.namespace.access.objcpp entity.scope.name.objcpp"],[19,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp punctuation.separator.namespace.access.objcpp punctuation.separator.namespace.access.objcpp"],[21,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp"],[24,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp keyword.operator.comparison.objcpp"],[25,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp storage.type.built-in.primitive.objcpp"],[28,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp keyword.operator.comparison.objcpp"],[29,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp punctuation.section.parens.begin.bracket.round.objcpp"],[30,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp variable.other.object.access.objcpp"],[35,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp punctuation.separator.dot-access.objcpp"],[36,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp entity.name.function.member.objcpp"],[40,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp punctuation.section.arguments.begin.bracket.round.function.member.objcpp"],[41,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp punctuation.section.arguments.end.bracket.round.function.member.objcpp"],[42,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp punctuation.section.parens.end.bracket.round.objcpp"],[43,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp punctuation.terminator.statement.objcpp"]] +[[0,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp punctuation.whitespace.support.function.leading.cocoa.objcpp"],[4,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp support.function.cocoa.objcpp"],[9,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp punctuation.section.parens.begin.bracket.round.objcpp"],[10,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp string.quoted.double.objcpp punctuation.definition.string.begin.objcpp"],[12,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp string.quoted.double.objcpp"],[19,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp string.quoted.double.objcpp constant.other.placeholder.objcpp"],[22,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp string.quoted.double.objcpp punctuation.definition.string.end.objcpp"],[23,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp punctuation.separator.delimiter.objcpp"],[24,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp"],[25,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp keyword.operator.cast.objcpp"],[36,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp keyword.operator.comparison.objcpp"],[37,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp storage.type.built-in.objcpp"],[43,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp keyword.operator.comparison.objcpp"],[44,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp meta.parens.block.objcpp punctuation.section.parens.begin.bracket.round.objcpp"],[45,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp meta.parens.block.objcpp variable.other.object.access.objcpp"],[48,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp meta.parens.block.objcpp punctuation.separator.dot-access.objcpp"],[49,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp meta.parens.block.objcpp entity.name.function.member.objcpp"],[52,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp meta.parens.block.objcpp punctuation.section.arguments.begin.bracket.round.function.member.objcpp"],[53,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp meta.parens.block.objcpp punctuation.section.arguments.end.bracket.round.function.member.objcpp"],[54,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp meta.parens.block.objcpp punctuation.section.parens.end.bracket.round.objcpp"],[55,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp meta.parens.block.objcpp punctuation.section.parens.end.bracket.round.objcpp"],[56,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp punctuation.terminator.statement.objcpp"]] +[[0,"source.objcpp meta.implementation.objcpp meta.scope.implementation.objcpp meta.function-with-body.objcpp meta.block.objcpp punctuation.section.block.end.bracket.curly.objcpp"]] +[[0,"source.objcpp meta.implementation.objcpp storage.type.objcpp punctuation.definition.storage.type.objcpp"],[1,"source.objcpp meta.implementation.objcpp storage.type.objcpp"]] +[[0,"source.objcpp"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.php b/desktop/internal/editor/textmate/testdata/sample.php new file mode 100644 index 0000000000..239cab5732 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.php @@ -0,0 +1,29 @@ + + + + + $x * 2, [1, 2.5, 3]); + return "Hello {$this->name}, " . count($items) . ' times' . PHP_EOL; + } +} +?> +

&

+ + + + diff --git a/desktop/internal/editor/textmate/testdata/sample.php.tokens b/desktop/internal/editor/textmate/testdata/sample.php.tokens new file mode 100644 index 0000000000..f0f0b59d38 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.php.tokens @@ -0,0 +1,30 @@ +[[0,"text.html.php meta.tag.metadata.doctype.html punctuation.definition.tag.begin.html"],[2,"text.html.php meta.tag.metadata.doctype.html entity.name.tag.html"],[9,"text.html.php meta.tag.metadata.doctype.html"],[10,"text.html.php meta.tag.metadata.doctype.html entity.other.attribute-name.html"],[14,"text.html.php meta.tag.metadata.doctype.html punctuation.definition.tag.end.html"]] +[[0,"text.html.php meta.tag.structure.html.start.html punctuation.definition.tag.begin.html"],[1,"text.html.php meta.tag.structure.html.start.html entity.name.tag.html"],[5,"text.html.php meta.tag.structure.html.start.html"],[6,"text.html.php meta.tag.structure.html.start.html meta.attribute.lang.html entity.other.attribute-name.html"],[10,"text.html.php meta.tag.structure.html.start.html meta.attribute.lang.html punctuation.separator.key-value.html"],[11,"text.html.php meta.tag.structure.html.start.html meta.attribute.lang.html string.quoted.double.html punctuation.definition.string.begin.html"],[12,"text.html.php meta.tag.structure.html.start.html meta.attribute.lang.html string.quoted.double.html"],[14,"text.html.php meta.tag.structure.html.start.html meta.attribute.lang.html string.quoted.double.html punctuation.definition.string.end.html"],[15,"text.html.php meta.tag.structure.html.start.html punctuation.definition.tag.end.html"]] +[[0,"text.html.php comment.block.html punctuation.definition.comment.html"],[4,"text.html.php comment.block.html"],[21,"text.html.php comment.block.html punctuation.definition.comment.html"]] +[[0,"text.html.php meta.tag.structure.body.start.html punctuation.definition.tag.begin.html"],[1,"text.html.php meta.tag.structure.body.start.html entity.name.tag.html"],[5,"text.html.php meta.tag.structure.body.start.html"],[6,"text.html.php meta.tag.structure.body.start.html meta.attribute.class.html entity.other.attribute-name.html"],[11,"text.html.php meta.tag.structure.body.start.html meta.attribute.class.html punctuation.separator.key-value.html"],[12,"text.html.php meta.tag.structure.body.start.html meta.attribute.class.html string.quoted.double.html punctuation.definition.string.begin.html"],[13,"text.html.php meta.tag.structure.body.start.html meta.attribute.class.html string.quoted.double.html"],[17,"text.html.php meta.tag.structure.body.start.html meta.attribute.class.html string.quoted.double.html punctuation.definition.string.end.html"],[18,"text.html.php meta.tag.structure.body.start.html punctuation.definition.tag.end.html"]] +[[0,"text.html.php meta.embedded.block.php punctuation.section.embedded.begin.php"]] +[[0,"text.html.php meta.embedded.block.php source.php keyword.control.declare.php"],[7,"text.html.php meta.embedded.block.php source.php punctuation.definition.begin.bracket.round.php"],[8,"text.html.php meta.embedded.block.php source.php constant.other.php"],[20,"text.html.php meta.embedded.block.php source.php keyword.operator.assignment.php"],[21,"text.html.php meta.embedded.block.php source.php constant.numeric.decimal.php"],[22,"text.html.php meta.embedded.block.php source.php punctuation.definition.end.bracket.round.php"],[23,"text.html.php meta.embedded.block.php source.php punctuation.terminator.expression.php"]] +[[0,"text.html.php meta.embedded.block.php source.php"]] +[[0,"text.html.php meta.embedded.block.php source.php meta.namespace.php keyword.other.namespace.php"],[9,"text.html.php meta.embedded.block.php source.php meta.namespace.php"],[10,"text.html.php meta.embedded.block.php source.php meta.namespace.php entity.name.type.namespace.php"],[13,"text.html.php meta.embedded.block.php source.php meta.namespace.php entity.name.type.namespace.php punctuation.separator.inheritance.php"],[14,"text.html.php meta.embedded.block.php source.php meta.namespace.php entity.name.type.namespace.php"],[20,"text.html.php meta.embedded.block.php source.php punctuation.terminator.expression.php"]] +[[0,"text.html.php meta.embedded.block.php source.php"]] +[[0,"text.html.php meta.embedded.block.php source.php comment.block.documentation.phpdoc.php punctuation.definition.comment.php"],[3,"text.html.php meta.embedded.block.php source.php comment.block.documentation.phpdoc.php"],[19,"text.html.php meta.embedded.block.php source.php comment.block.documentation.phpdoc.php punctuation.definition.comment.php"]] +[[0,"text.html.php meta.embedded.block.php source.php meta.class.php storage.modifier.php storage.modifier.inheritance.final.php"],[5,"text.html.php meta.embedded.block.php source.php meta.class.php"],[6,"text.html.php meta.embedded.block.php source.php meta.class.php storage.type.class.php"],[11,"text.html.php meta.embedded.block.php source.php meta.class.php"],[12,"text.html.php meta.embedded.block.php source.php meta.class.php entity.name.type.class.php"],[16,"text.html.php meta.embedded.block.php source.php meta.class.php"],[17,"text.html.php meta.embedded.block.php source.php meta.class.php storage.modifier.extends.php"],[24,"text.html.php meta.embedded.block.php source.php meta.class.php"],[25,"text.html.php meta.embedded.block.php source.php meta.class.php entity.other.inherited-class.php"],[30,"text.html.php meta.embedded.block.php source.php meta.class.php"],[31,"text.html.php meta.embedded.block.php source.php meta.class.php storage.modifier.implements.php"],[41,"text.html.php meta.embedded.block.php source.php meta.class.php"],[42,"text.html.php meta.embedded.block.php source.php meta.class.php support.class.builtin.php"]] +[[0,"text.html.php meta.embedded.block.php source.php meta.class.php punctuation.definition.class.begin.bracket.curly.php"]] +[[0,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[4,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php storage.modifier.php storage.modifier.visibility.private.php"],[11,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[12,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php storage.type.const.php"],[17,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[18,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php constant.other.php"],[23,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[24,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php keyword.operator.assignment.php"],[25,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[26,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php constant.numeric.hex.php"],[30,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php punctuation.terminator.expression.php"]] +[[0,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"]] +[[0,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[4,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php storage.modifier.php storage.modifier.visibility.public.php"],[10,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php"],[11,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php storage.type.function.php"],[19,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php"],[20,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php support.function.constructor.php"],[31,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php punctuation.definition.parameters.begin.bracket.round.php"],[32,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.promoted-property.php storage.modifier.php storage.modifier.visibility.private.php"],[39,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.promoted-property.php"],[40,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.promoted-property.php keyword.other.type.php"],[46,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.promoted-property.php"],[47,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.promoted-property.php variable.other.php punctuation.definition.variable.php"],[48,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.promoted-property.php variable.other.php"],[52,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.promoted-property.php"],[53,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.promoted-property.php keyword.operator.assignment.php"],[54,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.promoted-property.php"],[55,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.promoted-property.php string.quoted.double.php punctuation.definition.string.begin.php"],[56,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.promoted-property.php string.quoted.double.php"],[60,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.promoted-property.php string.quoted.double.php punctuation.definition.string.end.php"],[61,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php punctuation.definition.parameters.end.bracket.round.php"],[62,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php"],[63,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php punctuation.definition.begin.bracket.curly.php"],[64,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php punctuation.definition.end.bracket.curly.php"]] +[[0,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"]] +[[0,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[4,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php storage.modifier.php storage.modifier.visibility.public.php"],[10,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php"],[11,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php storage.type.function.php"],[19,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php"],[20,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php entity.name.function.php"],[25,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php punctuation.definition.parameters.begin.bracket.round.php"],[26,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.typehinted.php keyword.operator.nullable-type.php"],[27,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.typehinted.php keyword.other.type.php"],[30,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.typehinted.php"],[31,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.typehinted.php variable.other.php punctuation.definition.variable.php"],[32,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.typehinted.php variable.other.php"],[37,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.typehinted.php"],[38,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.typehinted.php keyword.operator.assignment.php"],[39,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.typehinted.php"],[40,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php meta.function.parameters.php meta.function.parameter.typehinted.php constant.numeric.decimal.php"],[41,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php punctuation.definition.parameters.end.bracket.round.php"],[42,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php keyword.operator.return-value.php"],[43,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php"],[44,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function.php keyword.other.type.php"]] +[[0,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[4,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php punctuation.definition.begin.bracket.curly.php"]] +[[0,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php punctuation.whitespace.comment.leading.php"],[8,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php comment.line.double-slash.php punctuation.definition.comment.php"],[10,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php comment.line.double-slash.php"]] +[[0,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[8,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php variable.other.php punctuation.definition.variable.php"],[9,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php variable.other.php"],[14,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[15,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php keyword.operator.assignment.php"],[16,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[17,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php support.function.array.php"],[26,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php punctuation.definition.arguments.begin.bracket.round.php"],[27,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php meta.function.closure.php storage.type.function.php"],[29,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php meta.function.closure.php punctuation.definition.parameters.begin.bracket.round.php"],[30,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php meta.function.closure.php meta.function.parameters.php meta.function.parameter.no-default.php variable.other.php punctuation.definition.variable.php"],[31,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php meta.function.closure.php meta.function.parameters.php meta.function.parameter.no-default.php variable.other.php"],[32,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php meta.function.closure.php punctuation.definition.parameters.end.bracket.round.php"],[33,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php meta.function.closure.php"],[34,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php meta.function.closure.php punctuation.definition.arrow.php"],[36,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php"],[37,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php variable.other.php punctuation.definition.variable.php"],[38,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php variable.other.php"],[39,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php"],[40,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php keyword.operator.arithmetic.php"],[41,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php"],[42,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php constant.numeric.decimal.php"],[43,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php punctuation.separator.delimiter.php"],[44,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php"],[45,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php punctuation.section.array.begin.php"],[46,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php constant.numeric.decimal.php"],[47,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php punctuation.separator.delimiter.php"],[48,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php"],[49,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php constant.numeric.decimal.php"],[50,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php constant.numeric.decimal.php punctuation.separator.decimal.period.php"],[51,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php constant.numeric.decimal.php"],[52,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php punctuation.separator.delimiter.php"],[53,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php"],[54,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php constant.numeric.decimal.php"],[55,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php punctuation.section.array.end.php"],[56,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php punctuation.definition.arguments.end.bracket.round.php"],[57,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php punctuation.terminator.expression.php"]] +[[0,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[8,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php keyword.control.return.php"],[14,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[15,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php string.quoted.double.php punctuation.definition.string.begin.php"],[16,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php string.quoted.double.php"],[22,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php string.quoted.double.php punctuation.definition.variable.php"],[23,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php string.quoted.double.php variable.language.this.php punctuation.definition.variable.php"],[24,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php string.quoted.double.php variable.language.this.php"],[28,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php string.quoted.double.php keyword.operator.class.php"],[30,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php string.quoted.double.php variable.other.property.php"],[34,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php string.quoted.double.php punctuation.definition.variable.php"],[35,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php string.quoted.double.php"],[37,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php string.quoted.double.php punctuation.definition.string.end.php"],[38,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[39,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php keyword.operator.string.php"],[40,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[41,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php support.function.array.php"],[46,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php punctuation.definition.arguments.begin.bracket.round.php"],[47,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php variable.other.php punctuation.definition.variable.php"],[48,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php variable.other.php"],[53,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php meta.function-call.php punctuation.definition.arguments.end.bracket.round.php"],[54,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[55,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php keyword.operator.string.php"],[56,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[57,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php string.quoted.single.php punctuation.definition.string.begin.php"],[58,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php string.quoted.single.php"],[64,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php string.quoted.single.php punctuation.definition.string.end.php"],[65,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[66,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php keyword.operator.string.php"],[67,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[68,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php support.constant.core.php"],[75,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php punctuation.terminator.expression.php"]] +[[0,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php"],[4,"text.html.php meta.embedded.block.php source.php meta.class.php meta.class.body.php punctuation.definition.end.bracket.curly.php"]] +[[0,"text.html.php meta.embedded.block.php source.php meta.class.php punctuation.definition.class.end.bracket.curly.php"]] +[[0,"text.html.php meta.embedded.block.php punctuation.section.embedded.end.php source.php"],[1,"text.html.php meta.embedded.block.php punctuation.section.embedded.end.php"]] +[[0,"text.html.php meta.tag.structure.p.start.html punctuation.definition.tag.begin.html"],[1,"text.html.php meta.tag.structure.p.start.html entity.name.tag.html"],[2,"text.html.php meta.tag.structure.p.start.html"],[3,"text.html.php meta.tag.structure.p.start.html meta.attribute.title.html entity.other.attribute-name.html"],[8,"text.html.php meta.tag.structure.p.start.html meta.attribute.title.html punctuation.separator.key-value.html"],[9,"text.html.php meta.tag.structure.p.start.html meta.attribute.title.html string.quoted.double.html punctuation.definition.string.begin.html"],[10,"text.html.php meta.tag.structure.p.start.html meta.attribute.title.html string.quoted.double.html meta.embedded.line.php punctuation.section.embedded.begin.php"],[13,"text.html.php meta.tag.structure.p.start.html meta.attribute.title.html string.quoted.double.html meta.embedded.line.php source.php"],[14,"text.html.php meta.tag.structure.p.start.html meta.attribute.title.html string.quoted.double.html meta.embedded.line.php source.php meta.function-call.php support.function.string.php"],[30,"text.html.php meta.tag.structure.p.start.html meta.attribute.title.html string.quoted.double.html meta.embedded.line.php source.php meta.function-call.php punctuation.definition.arguments.begin.bracket.round.php"],[31,"text.html.php meta.tag.structure.p.start.html meta.attribute.title.html string.quoted.double.html meta.embedded.line.php source.php meta.function-call.php variable.other.php punctuation.definition.variable.php"],[32,"text.html.php meta.tag.structure.p.start.html meta.attribute.title.html string.quoted.double.html meta.embedded.line.php source.php meta.function-call.php variable.other.php"],[37,"text.html.php meta.tag.structure.p.start.html meta.attribute.title.html string.quoted.double.html meta.embedded.line.php source.php meta.function-call.php punctuation.definition.arguments.end.bracket.round.php"],[38,"text.html.php meta.tag.structure.p.start.html meta.attribute.title.html string.quoted.double.html meta.embedded.line.php source.php"],[39,"text.html.php meta.tag.structure.p.start.html meta.attribute.title.html string.quoted.double.html meta.embedded.line.php punctuation.section.embedded.end.php source.php"],[40,"text.html.php meta.tag.structure.p.start.html meta.attribute.title.html string.quoted.double.html meta.embedded.line.php punctuation.section.embedded.end.php"],[41,"text.html.php meta.tag.structure.p.start.html meta.attribute.title.html string.quoted.double.html punctuation.definition.string.end.html"],[42,"text.html.php meta.tag.structure.p.start.html punctuation.definition.tag.end.html"],[43,"text.html.php constant.character.entity.named.amp.html punctuation.definition.entity.html"],[44,"text.html.php constant.character.entity.named.amp.html"],[47,"text.html.php constant.character.entity.named.amp.html punctuation.definition.entity.html"],[48,"text.html.php"],[49,"text.html.php meta.embedded.line.php punctuation.section.embedded.begin.php"],[54,"text.html.php meta.embedded.line.php source.php"],[55,"text.html.php meta.embedded.line.php source.php support.function.construct.output.php"],[59,"text.html.php meta.embedded.line.php source.php"],[60,"text.html.php meta.embedded.line.php source.php variable.other.php punctuation.definition.variable.php"],[61,"text.html.php meta.embedded.line.php source.php variable.other.php"],[65,"text.html.php meta.embedded.line.php source.php punctuation.terminator.expression.php"],[66,"text.html.php meta.embedded.line.php source.php"],[67,"text.html.php meta.embedded.line.php punctuation.section.embedded.end.php source.php"],[68,"text.html.php meta.embedded.line.php punctuation.section.embedded.end.php"],[69,"text.html.php meta.tag.structure.p.end.html punctuation.definition.tag.begin.html"],[71,"text.html.php meta.tag.structure.p.end.html entity.name.tag.html"],[72,"text.html.php meta.tag.structure.p.end.html punctuation.definition.tag.end.html"]] +[[0,"text.html.php meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.begin.html"],[1,"text.html.php meta.embedded.block.html meta.tag.metadata.script.start.html entity.name.tag.html"],[7,"text.html.php meta.embedded.block.html meta.tag.metadata.script.start.html punctuation.definition.tag.end.html"],[8,"text.html.php meta.embedded.block.html source.js meta.var.expr.js storage.type.js"],[13,"text.html.php meta.embedded.block.html source.js meta.var.expr.js"],[14,"text.html.php meta.embedded.block.html source.js meta.var.expr.js meta.var-single-variable.expr.js meta.definition.variable.js variable.other.constant.js"],[15,"text.html.php meta.embedded.block.html source.js meta.var.expr.js meta.var-single-variable.expr.js"],[16,"text.html.php meta.embedded.block.html source.js meta.var.expr.js keyword.operator.assignment.js"],[17,"text.html.php meta.embedded.block.html source.js meta.var.expr.js"],[18,"text.html.php meta.embedded.block.html source.js meta.var.expr.js constant.numeric.decimal.js"],[19,"text.html.php meta.embedded.block.html source.js punctuation.terminator.statement.js"],[20,"text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html source.js-ignored-vscode"],[21,"text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.begin.html"],[22,"text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html entity.name.tag.html"],[28,"text.html.php meta.embedded.block.html meta.tag.metadata.script.end.html punctuation.definition.tag.end.html"]] +[[0,"text.html.php meta.embedded.block.html meta.tag.metadata.style.start.html punctuation.definition.tag.begin.html"],[1,"text.html.php meta.embedded.block.html meta.tag.metadata.style.start.html entity.name.tag.html"],[6,"text.html.php meta.embedded.block.html meta.tag.metadata.style.start.html punctuation.definition.tag.end.html"],[7,"text.html.php meta.embedded.block.html source.css"],[9,"text.html.php meta.embedded.block.html source.css meta.property-list.css punctuation.section.property-list.begin.bracket.curly.css"],[10,"text.html.php meta.embedded.block.html source.css meta.property-list.css"],[11,"text.html.php meta.embedded.block.html source.css meta.property-list.css meta.property-name.css support.type.property-name.css"],[16,"text.html.php meta.embedded.block.html source.css meta.property-list.css punctuation.separator.key-value.css"],[17,"text.html.php meta.embedded.block.html source.css meta.property-list.css"],[18,"text.html.php meta.embedded.block.html source.css meta.property-list.css meta.property-value.css support.constant.color.w3c-standard-color-name.css"],[21,"text.html.php meta.embedded.block.html source.css meta.property-list.css punctuation.terminator.rule.css"],[22,"text.html.php meta.embedded.block.html source.css meta.property-list.css"],[23,"text.html.php meta.embedded.block.html source.css meta.property-list.css punctuation.section.property-list.end.bracket.curly.css"],[24,"text.html.php meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.begin.html source.css-ignored-vscode"],[25,"text.html.php meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.begin.html"],[26,"text.html.php meta.embedded.block.html meta.tag.metadata.style.end.html entity.name.tag.html"],[31,"text.html.php meta.embedded.block.html meta.tag.metadata.style.end.html punctuation.definition.tag.end.html"]] +[[0,"text.html.php meta.tag.structure.body.end.html punctuation.definition.tag.begin.html"],[2,"text.html.php meta.tag.structure.body.end.html entity.name.tag.html"],[6,"text.html.php meta.tag.structure.body.end.html punctuation.definition.tag.end.html"]] +[[0,"text.html.php meta.tag.structure.html.end.html punctuation.definition.tag.begin.html"],[2,"text.html.php meta.tag.structure.html.end.html entity.name.tag.html"],[6,"text.html.php meta.tag.structure.html.end.html punctuation.definition.tag.end.html"]] +[[0,"text.html.php"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.proto b/desktop/internal/editor/textmate/testdata/sample.proto new file mode 100644 index 0000000000..a62b37d2de --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package demo.v1; + +import "google/protobuf/timestamp.proto"; + +option go_package = "example.com/demo/v1;demov1"; + +// A user. +message User { + string name = 1; + int64 id = 2 [deprecated = true]; + repeated string tags = 3; + map scores = 4; + google.protobuf.Timestamp created = 5; + enum Role { + ROLE_UNSPECIFIED = 0; + ROLE_ADMIN = 1; + } + oneof contact { string email = 6; } +} + +service Users { + rpc Get(GetRequest) returns (User); + rpc Watch(stream GetRequest) returns (stream User) {} +} diff --git a/desktop/internal/editor/textmate/testdata/sample.proto.tokens b/desktop/internal/editor/textmate/testdata/sample.proto.tokens new file mode 100644 index 0000000000..2a0b84a26a --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.proto.tokens @@ -0,0 +1,27 @@ +[[0,"source.proto keyword.other.proto"],[6,"source.proto"],[7,"source.proto keyword.operator.assignment.proto"],[8,"source.proto"],[9,"source.proto string.quoted.double.proto.syntax"],[17,"source.proto punctuation.terminator.proto"]] +[[0,"source.proto"]] +[[0,"source.proto keyword.other.proto"],[7,"source.proto"],[8,"source.proto string.unquoted.proto.package"],[15,"source.proto punctuation.terminator.proto"]] +[[0,"source.proto"]] +[[0,"source.proto keyword.other.proto"],[6,"source.proto"],[7,"source.proto string.quoted.double.proto.import"],[40,"source.proto punctuation.terminator.proto"]] +[[0,"source.proto"]] +[[0,"source.proto keyword.other.proto"],[6,"source.proto"],[7,"source.proto support.other.proto"],[17,"source.proto"],[18,"source.proto keyword.operator.assignment.proto"],[19,"source.proto"],[20,"source.proto string.quoted.double.proto"],[48,"source.proto punctuation.terminator.proto"]] +[[0,"source.proto"]] +[[0,"source.proto comment.line.double-slash.proto"],[2,"source.proto comment.line.double-slash.proto"]] +[[0,"source.proto keyword.other.proto"],[7,"source.proto"],[8,"source.proto entity.name.class.message.proto"],[12,"source.proto"]] +[[0,"source.proto"],[2,"source.proto storage.type.proto"],[8,"source.proto"],[9,"source.proto variable.other.proto"],[13,"source.proto"],[14,"source.proto keyword.operator.assignment.proto"],[15,"source.proto"],[16,"source.proto constant.numeric.proto"],[17,"source.proto punctuation.terminator.proto"]] +[[0,"source.proto"],[2,"source.proto storage.type.proto"],[7,"source.proto"],[8,"source.proto variable.other.proto"],[10,"source.proto"],[11,"source.proto keyword.operator.assignment.proto"],[12,"source.proto"],[13,"source.proto constant.numeric.proto"],[14,"source.proto"],[15,"source.proto"],[16,"source.proto support.other.proto"],[26,"source.proto"],[29,"source.proto constant.language.proto"],[33,"source.proto"],[34,"source.proto punctuation.terminator.proto"]] +[[0,"source.proto"],[2,"source.proto storage.modifier.proto"],[10,"source.proto"],[11,"source.proto storage.type.proto"],[17,"source.proto"],[18,"source.proto variable.other.proto"],[22,"source.proto"],[23,"source.proto keyword.operator.assignment.proto"],[24,"source.proto"],[25,"source.proto constant.numeric.proto"],[26,"source.proto punctuation.terminator.proto"]] +[[0,"source.proto"],[2,"source.proto storage.type.proto"],[5,"source.proto punctuation.definition.typeparameters.begin.proto"],[6,"source.proto storage.type.proto"],[12,"source.proto"],[14,"source.proto storage.type.proto"],[19,"source.proto punctuation.definition.typeparameters.end.proto"],[20,"source.proto"],[21,"source.proto variable.other.proto"],[27,"source.proto"],[28,"source.proto keyword.operator.assignment.proto"],[29,"source.proto"],[30,"source.proto constant.numeric.proto"],[31,"source.proto punctuation.terminator.proto"]] +[[0,"source.proto"],[2,"source.proto storage.type.proto"],[27,"source.proto"],[28,"source.proto variable.other.proto"],[35,"source.proto"],[36,"source.proto keyword.operator.assignment.proto"],[37,"source.proto"],[38,"source.proto constant.numeric.proto"],[39,"source.proto punctuation.terminator.proto"]] +[[0,"source.proto"],[2,"source.proto keyword.other.proto"],[6,"source.proto"],[7,"source.proto entity.name.class.proto"],[11,"source.proto"]] +[[0,"source.proto"],[4,"source.proto variable.other.proto"],[20,"source.proto"],[21,"source.proto keyword.operator.assignment.proto"],[22,"source.proto"],[23,"source.proto constant.numeric.proto"],[24,"source.proto punctuation.terminator.proto"]] +[[0,"source.proto"],[4,"source.proto variable.other.proto"],[14,"source.proto"],[15,"source.proto keyword.operator.assignment.proto"],[16,"source.proto"],[17,"source.proto constant.numeric.proto"],[18,"source.proto punctuation.terminator.proto"]] +[[0,"source.proto"],[2,"source.proto"]] +[[0,"source.proto"],[2,"source.proto keyword.other.proto"],[7,"source.proto"],[8,"source.proto variable.other.proto"],[15,"source.proto"],[17,"source.proto"],[18,"source.proto storage.type.proto"],[24,"source.proto"],[25,"source.proto variable.other.proto"],[30,"source.proto"],[31,"source.proto keyword.operator.assignment.proto"],[32,"source.proto"],[33,"source.proto constant.numeric.proto"],[34,"source.proto punctuation.terminator.proto"],[35,"source.proto"],[36,"source.proto"]] +[[0,"source.proto"]] +[[0,"source.proto"]] +[[0,"source.proto keyword.other.proto"],[7,"source.proto"],[8,"source.proto entity.name.class.message.proto"],[13,"source.proto"]] +[[0,"source.proto"],[2,"source.proto keyword.other.proto"],[5,"source.proto"],[6,"source.proto entity.name.function"],[9,"source.proto"],[10,"source.proto entity.name.class.proto"],[20,"source.proto"],[22,"source.proto keyword.other.proto"],[29,"source.proto"],[31,"source.proto entity.name.class.proto"],[35,"source.proto"],[36,"source.proto punctuation.terminator.proto"]] +[[0,"source.proto"],[2,"source.proto keyword.other.proto"],[5,"source.proto"],[6,"source.proto entity.name.function"],[11,"source.proto"],[12,"source.proto keyword.other.proto"],[18,"source.proto"],[19,"source.proto entity.name.class.proto"],[29,"source.proto"],[31,"source.proto keyword.other.proto"],[38,"source.proto"],[40,"source.proto keyword.other.proto"],[46,"source.proto"],[47,"source.proto entity.name.class.proto"],[51,"source.proto"],[54,"source.proto"]] +[[0,"source.proto"]] +[[0,"source.proto"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.ps1 b/desktop/internal/editor/textmate/testdata/sample.ps1 new file mode 100644 index 0000000000..5b2b244bae --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.ps1 @@ -0,0 +1,20 @@ +<# +.SYNOPSIS + A block comment. +#> +param( + [Parameter(Mandatory = $true)] + [string] $Name = "world", + [int] $Count = 0x1F +) +# A comment +function Get-Greeting { + [CmdletBinding()] + param([string] $Who) + return "Hello, $Who! $($Count + 1)`n" +} +$items = @(1, 2, 3) | Where-Object { $_ -gt 1 } +if ($items.Count -ge 2 -and $null -ne $Name) { + Write-Host 'single $quoted' -ForegroundColor Green +} +$env:PATH += ";C:\tools" diff --git a/desktop/internal/editor/textmate/testdata/sample.ps1.tokens b/desktop/internal/editor/textmate/testdata/sample.ps1.tokens new file mode 100644 index 0000000000..43d320d2cb --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.ps1.tokens @@ -0,0 +1,21 @@ +[[0,"source.powershell comment.block.powershell punctuation.definition.comment.block.begin.powershell"]] +[[0,"source.powershell comment.block.powershell comment.documentation.embedded.powershell constant.string.documentation.powershell"],[1,"source.powershell comment.block.powershell comment.documentation.embedded.powershell keyword.operator.documentation.powershell"]] +[[0,"source.powershell comment.block.powershell"]] +[[0,"source.powershell comment.block.powershell punctuation.definition.comment.block.end.powershell"]] +[[0,"source.powershell keyword.control.powershell"],[5,"source.powershell meta.group.simple.subexpression.powershell punctuation.section.group.begin.powershell"]] +[[0,"source.powershell meta.group.simple.subexpression.powershell"],[4,"source.powershell meta.group.simple.subexpression.powershell meta.attribute.powershell punctuation.section.bracket.begin.powershell"],[5,"source.powershell meta.group.simple.subexpression.powershell meta.attribute.powershell support.function.attribute.powershell"],[14,"source.powershell meta.group.simple.subexpression.powershell meta.attribute.powershell punctuation.section.group.begin.powershell"],[15,"source.powershell meta.group.simple.subexpression.powershell meta.attribute.powershell variable.parameter.attribute.powershell"],[24,"source.powershell meta.group.simple.subexpression.powershell meta.attribute.powershell"],[25,"source.powershell meta.group.simple.subexpression.powershell meta.attribute.powershell keyword.operator.assignment.powershell"],[26,"source.powershell meta.group.simple.subexpression.powershell meta.attribute.powershell"],[27,"source.powershell meta.group.simple.subexpression.powershell meta.attribute.powershell constant.language.powershell punctuation.definition.variable.powershell"],[28,"source.powershell meta.group.simple.subexpression.powershell meta.attribute.powershell constant.language.powershell"],[32,"source.powershell meta.group.simple.subexpression.powershell meta.attribute.powershell punctuation.section.group.end.powershell"],[33,"source.powershell meta.group.simple.subexpression.powershell meta.attribute.powershell punctuation.section.bracket.end.powershell"]] +[[0,"source.powershell meta.group.simple.subexpression.powershell"],[4,"source.powershell meta.group.simple.subexpression.powershell punctuation.section.bracket.begin.powershell"],[5,"source.powershell meta.group.simple.subexpression.powershell storage.type.powershell"],[11,"source.powershell meta.group.simple.subexpression.powershell punctuation.section.bracket.end.powershell"],[12,"source.powershell meta.group.simple.subexpression.powershell"],[13,"source.powershell meta.group.simple.subexpression.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell"],[14,"source.powershell meta.group.simple.subexpression.powershell variable.other.readwrite.powershell"],[18,"source.powershell meta.group.simple.subexpression.powershell"],[19,"source.powershell meta.group.simple.subexpression.powershell keyword.operator.assignment.powershell"],[20,"source.powershell meta.group.simple.subexpression.powershell"],[21,"source.powershell meta.group.simple.subexpression.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell"],[22,"source.powershell meta.group.simple.subexpression.powershell string.quoted.double.powershell"],[27,"source.powershell meta.group.simple.subexpression.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell"],[28,"source.powershell meta.group.simple.subexpression.powershell keyword.operator.other.powershell"]] +[[0,"source.powershell meta.group.simple.subexpression.powershell"],[4,"source.powershell meta.group.simple.subexpression.powershell punctuation.section.bracket.begin.powershell"],[5,"source.powershell meta.group.simple.subexpression.powershell storage.type.powershell"],[8,"source.powershell meta.group.simple.subexpression.powershell punctuation.section.bracket.end.powershell"],[9,"source.powershell meta.group.simple.subexpression.powershell"],[10,"source.powershell meta.group.simple.subexpression.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell"],[11,"source.powershell meta.group.simple.subexpression.powershell variable.other.readwrite.powershell"],[16,"source.powershell meta.group.simple.subexpression.powershell"],[17,"source.powershell meta.group.simple.subexpression.powershell keyword.operator.assignment.powershell"],[18,"source.powershell meta.group.simple.subexpression.powershell"],[19,"source.powershell meta.group.simple.subexpression.powershell constant.numeric.hex.powershell"]] +[[0,"source.powershell meta.group.simple.subexpression.powershell punctuation.section.group.end.powershell"]] +[[0,"source.powershell comment.line.powershell punctuation.definition.comment.powershell"],[1,"source.powershell comment.line.powershell"]] +[[0,"source.powershell meta.function.powershell storage.type.powershell"],[8,"source.powershell meta.function.powershell"],[9,"source.powershell meta.function.powershell entity.name.function.powershell"],[21,"source.powershell"],[22,"source.powershell meta.scriptblock.powershell punctuation.section.braces.begin.powershell"]] +[[0,"source.powershell meta.scriptblock.powershell"],[4,"source.powershell meta.scriptblock.powershell meta.attribute.powershell punctuation.section.bracket.begin.powershell"],[5,"source.powershell meta.scriptblock.powershell meta.attribute.powershell support.function.attribute.powershell"],[18,"source.powershell meta.scriptblock.powershell meta.attribute.powershell punctuation.section.group.begin.powershell"],[19,"source.powershell meta.scriptblock.powershell meta.attribute.powershell punctuation.section.group.end.powershell"],[20,"source.powershell meta.scriptblock.powershell meta.attribute.powershell punctuation.section.bracket.end.powershell"]] +[[0,"source.powershell meta.scriptblock.powershell"],[4,"source.powershell meta.scriptblock.powershell keyword.control.powershell"],[9,"source.powershell meta.scriptblock.powershell meta.group.simple.subexpression.powershell punctuation.section.group.begin.powershell"],[10,"source.powershell meta.scriptblock.powershell meta.group.simple.subexpression.powershell punctuation.section.bracket.begin.powershell"],[11,"source.powershell meta.scriptblock.powershell meta.group.simple.subexpression.powershell storage.type.powershell"],[17,"source.powershell meta.scriptblock.powershell meta.group.simple.subexpression.powershell punctuation.section.bracket.end.powershell"],[18,"source.powershell meta.scriptblock.powershell meta.group.simple.subexpression.powershell"],[19,"source.powershell meta.scriptblock.powershell meta.group.simple.subexpression.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell"],[20,"source.powershell meta.scriptblock.powershell meta.group.simple.subexpression.powershell variable.other.readwrite.powershell"],[23,"source.powershell meta.scriptblock.powershell meta.group.simple.subexpression.powershell punctuation.section.group.end.powershell"]] +[[0,"source.powershell meta.scriptblock.powershell"],[4,"source.powershell meta.scriptblock.powershell keyword.control.powershell"],[10,"source.powershell meta.scriptblock.powershell"],[11,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell"],[12,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell"],[19,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell"],[20,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell variable.other.readwrite.powershell"],[23,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell"],[25,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell meta.embedded.substatement.powershell keyword.other.substatement.powershell punctuation.definition.substatement.powershell punctuation.section.embedded.substatement.begin.powershell"],[26,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell meta.embedded.substatement.powershell punctuation.section.group.begin.powershell punctuation.section.embedded.substatement.begin.powershell"],[27,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell meta.embedded.substatement.powershell interpolated.complex.source.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell"],[28,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell meta.embedded.substatement.powershell interpolated.complex.source.powershell variable.other.readwrite.powershell"],[33,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell meta.embedded.substatement.powershell interpolated.complex.source.powershell"],[34,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell meta.embedded.substatement.powershell interpolated.complex.source.powershell keyword.operator.assignment.powershell"],[35,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell meta.embedded.substatement.powershell interpolated.complex.source.powershell"],[36,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell meta.embedded.substatement.powershell interpolated.complex.source.powershell constant.numeric.integer.powershell"],[37,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell meta.embedded.substatement.powershell punctuation.section.group.end.powershell punctuation.section.embedded.substatement.end.powershell"],[38,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell constant.character.escape.powershell"],[40,"source.powershell meta.scriptblock.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell"]] +[[0,"source.powershell meta.scriptblock.powershell punctuation.section.braces.end.powershell"]] +[[0,"source.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell"],[1,"source.powershell variable.other.readwrite.powershell"],[6,"source.powershell"],[7,"source.powershell keyword.operator.assignment.powershell"],[8,"source.powershell"],[9,"source.powershell meta.group.array-expression.powershell keyword.other.array.begin.powershell"],[10,"source.powershell meta.group.array-expression.powershell punctuation.section.group.begin.powershell"],[11,"source.powershell meta.group.array-expression.powershell constant.numeric.integer.powershell"],[12,"source.powershell meta.group.array-expression.powershell keyword.operator.other.powershell"],[13,"source.powershell meta.group.array-expression.powershell"],[14,"source.powershell meta.group.array-expression.powershell constant.numeric.integer.powershell"],[15,"source.powershell meta.group.array-expression.powershell keyword.operator.other.powershell"],[16,"source.powershell meta.group.array-expression.powershell"],[17,"source.powershell meta.group.array-expression.powershell constant.numeric.integer.powershell"],[18,"source.powershell meta.group.array-expression.powershell punctuation.section.group.end.powershell"],[19,"source.powershell"],[20,"source.powershell keyword.operator.other.powershell"],[21,"source.powershell"],[22,"source.powershell support.function.powershell"],[34,"source.powershell"],[35,"source.powershell meta.scriptblock.powershell punctuation.section.braces.begin.powershell"],[36,"source.powershell meta.scriptblock.powershell"],[37,"source.powershell meta.scriptblock.powershell support.variable.automatic.powershell punctuation.definition.variable.powershell"],[38,"source.powershell meta.scriptblock.powershell support.variable.automatic.powershell"],[39,"source.powershell meta.scriptblock.powershell"],[40,"source.powershell meta.scriptblock.powershell keyword.operator.comparison.powershell"],[43,"source.powershell meta.scriptblock.powershell"],[44,"source.powershell meta.scriptblock.powershell constant.numeric.integer.powershell"],[45,"source.powershell meta.scriptblock.powershell"],[46,"source.powershell meta.scriptblock.powershell punctuation.section.braces.end.powershell"]] +[[0,"source.powershell keyword.control.powershell"],[2,"source.powershell"],[3,"source.powershell meta.group.simple.subexpression.powershell punctuation.section.group.begin.powershell"],[4,"source.powershell meta.group.simple.subexpression.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell"],[5,"source.powershell meta.group.simple.subexpression.powershell variable.other.readwrite.powershell"],[10,"source.powershell meta.group.simple.subexpression.powershell variable.other.readwrite.powershell variable.other.member.powershell"],[16,"source.powershell meta.group.simple.subexpression.powershell"],[17,"source.powershell meta.group.simple.subexpression.powershell keyword.operator.comparison.powershell"],[20,"source.powershell meta.group.simple.subexpression.powershell"],[21,"source.powershell meta.group.simple.subexpression.powershell constant.numeric.integer.powershell"],[22,"source.powershell meta.group.simple.subexpression.powershell"],[23,"source.powershell meta.group.simple.subexpression.powershell keyword.operator.logical.powershell"],[27,"source.powershell meta.group.simple.subexpression.powershell"],[28,"source.powershell meta.group.simple.subexpression.powershell constant.language.powershell punctuation.definition.variable.powershell"],[29,"source.powershell meta.group.simple.subexpression.powershell constant.language.powershell"],[33,"source.powershell meta.group.simple.subexpression.powershell"],[34,"source.powershell meta.group.simple.subexpression.powershell keyword.operator.comparison.powershell"],[37,"source.powershell meta.group.simple.subexpression.powershell"],[38,"source.powershell meta.group.simple.subexpression.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell"],[39,"source.powershell meta.group.simple.subexpression.powershell variable.other.readwrite.powershell"],[43,"source.powershell meta.group.simple.subexpression.powershell punctuation.section.group.end.powershell"],[44,"source.powershell"],[45,"source.powershell meta.scriptblock.powershell punctuation.section.braces.begin.powershell"]] +[[0,"source.powershell meta.scriptblock.powershell"],[4,"source.powershell meta.scriptblock.powershell support.function.powershell"],[14,"source.powershell meta.scriptblock.powershell"],[15,"source.powershell meta.scriptblock.powershell string.quoted.single.powershell punctuation.definition.string.begin.powershell"],[16,"source.powershell meta.scriptblock.powershell string.quoted.single.powershell"],[30,"source.powershell meta.scriptblock.powershell string.quoted.single.powershell punctuation.definition.string.end.powershell"],[31,"source.powershell meta.scriptblock.powershell"],[32,"source.powershell meta.scriptblock.powershell keyword.operator.assignment.powershell"],[33,"source.powershell meta.scriptblock.powershell"]] +[[0,"source.powershell meta.scriptblock.powershell punctuation.section.braces.end.powershell"]] +[[0,"source.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell"],[1,"source.powershell variable.other.readwrite.powershell support.variable.drive.powershell"],[5,"source.powershell variable.other.readwrite.powershell"],[9,"source.powershell"],[10,"source.powershell keyword.operator.assignment.powershell"],[12,"source.powershell"],[13,"source.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell"],[14,"source.powershell string.quoted.double.powershell"],[23,"source.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell"]] +[[0,"source.powershell"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.py b/desktop/internal/editor/textmate/testdata/sample.py new file mode 100644 index 0000000000..8087989277 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +"""Module docstring.""" +import os +from typing import Optional + +@dataclass(frozen=True) +class Point(Base): + x: int = 0 + + def norm(self, scale: float = 1.5e3) -> Optional[float]: + # A comment + if self.x > 0 and not None: + return f"{self.x!r:>10} items\n" + r'\d+' + b"\x00" + return [i ** 2 for i in range(0x1F) if i % 2 == 0] + +async def main(): + await asyncio.sleep(1) + lambda y: y + 1 diff --git a/desktop/internal/editor/textmate/testdata/sample.py.tokens b/desktop/internal/editor/textmate/testdata/sample.py.tokens new file mode 100644 index 0000000000..c2a407ad76 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.py.tokens @@ -0,0 +1,19 @@ +[[0,"source.python comment.line.number-sign.python punctuation.definition.comment.python"],[1,"source.python comment.line.number-sign.python"]] +[[0,"source.python string.quoted.docstring.multi.python punctuation.definition.string.begin.python"],[3,"source.python string.quoted.docstring.multi.python"],[20,"source.python string.quoted.docstring.multi.python punctuation.definition.string.end.python"]] +[[0,"source.python keyword.control.import.python"],[6,"source.python"],[7,"source.python"]] +[[0,"source.python keyword.control.import.python"],[4,"source.python"],[5,"source.python"],[11,"source.python"],[12,"source.python keyword.control.import.python"],[18,"source.python"],[19,"source.python"]] +[[0,"source.python"]] +[[0,"source.python meta.function.decorator.python entity.name.function.decorator.python punctuation.definition.decorator.python"],[1,"source.python meta.function.decorator.python entity.name.function.decorator.python"],[10,"source.python meta.function.decorator.python punctuation.definition.arguments.begin.python"],[11,"source.python meta.function.decorator.python meta.function-call.arguments.python variable.parameter.function-call.python"],[17,"source.python meta.function.decorator.python meta.function-call.arguments.python keyword.operator.assignment.python"],[18,"source.python meta.function.decorator.python meta.function-call.arguments.python constant.language.python"],[22,"source.python meta.function.decorator.python punctuation.definition.arguments.end.python"]] +[[0,"source.python meta.class.python storage.type.class.python"],[5,"source.python meta.class.python"],[6,"source.python meta.class.python entity.name.type.class.python"],[11,"source.python meta.class.python meta.class.inheritance.python punctuation.definition.inheritance.begin.python"],[12,"source.python meta.class.python meta.class.inheritance.python entity.other.inherited-class.python"],[16,"source.python meta.class.python meta.class.inheritance.python punctuation.definition.inheritance.end.python"],[17,"source.python meta.class.python punctuation.section.class.begin.python"]] +[[0,"source.python"],[4,"source.python"],[5,"source.python punctuation.separator.colon.python"],[6,"source.python"],[7,"source.python support.type.python"],[10,"source.python"],[11,"source.python keyword.operator.assignment.python"],[12,"source.python"],[13,"source.python constant.numeric.dec.python"]] +[[0,"source.python"]] +[[0,"source.python meta.function.python"],[4,"source.python meta.function.python storage.type.function.python"],[7,"source.python meta.function.python"],[8,"source.python meta.function.python entity.name.function.python"],[12,"source.python meta.function.python meta.function.parameters.python punctuation.definition.parameters.begin.python"],[13,"source.python meta.function.python meta.function.parameters.python variable.parameter.function.language.python variable.parameter.function.language.special.self.python"],[17,"source.python meta.function.python meta.function.parameters.python punctuation.separator.parameters.python"],[18,"source.python meta.function.python meta.function.parameters.python"],[19,"source.python meta.function.python meta.function.parameters.python variable.parameter.function.language.python"],[24,"source.python meta.function.python meta.function.parameters.python punctuation.separator.annotation.python"],[25,"source.python meta.function.python meta.function.parameters.python"],[26,"source.python meta.function.python meta.function.parameters.python support.type.python"],[31,"source.python meta.function.python meta.function.parameters.python"],[32,"source.python meta.function.python meta.function.parameters.python keyword.operator.assignment.python"],[33,"source.python meta.function.python meta.function.parameters.python"],[34,"source.python meta.function.python meta.function.parameters.python constant.numeric.float.python"],[39,"source.python meta.function.python meta.function.parameters.python punctuation.definition.parameters.end.python"],[40,"source.python meta.function.python"],[41,"source.python meta.function.python punctuation.separator.annotation.result.python"],[43,"source.python meta.function.python"],[44,"source.python meta.function.python meta.item-access.python meta.indexed-name.python"],[52,"source.python meta.function.python meta.item-access.python punctuation.definition.arguments.begin.python"],[53,"source.python meta.function.python meta.item-access.python meta.item-access.arguments.python support.type.python"],[58,"source.python meta.function.python meta.item-access.python punctuation.definition.arguments.end.python"],[59,"source.python meta.function.python punctuation.section.function.begin.python"]] +[[0,"source.python"],[8,"source.python comment.line.number-sign.python punctuation.definition.comment.python"],[9,"source.python comment.line.number-sign.python"]] +[[0,"source.python"],[8,"source.python keyword.control.flow.python"],[10,"source.python"],[11,"source.python variable.language.special.self.python"],[15,"source.python meta.member.access.python punctuation.separator.period.python"],[16,"source.python meta.member.access.python meta.attribute.python"],[17,"source.python"],[18,"source.python keyword.operator.comparison.python"],[19,"source.python"],[20,"source.python constant.numeric.dec.python"],[21,"source.python"],[22,"source.python keyword.operator.logical.python"],[25,"source.python"],[26,"source.python keyword.operator.logical.python"],[29,"source.python"],[30,"source.python constant.language.python"],[34,"source.python punctuation.separator.colon.python"]] +[[0,"source.python"],[12,"source.python keyword.control.flow.python"],[18,"source.python"],[19,"source.python meta.fstring.python string.interpolated.python string.quoted.single.python storage.type.string.python"],[20,"source.python meta.fstring.python punctuation.definition.string.begin.python string.interpolated.python string.quoted.single.python"],[21,"source.python meta.fstring.python constant.character.format.placeholder.other.python"],[22,"source.python meta.fstring.python variable.language.special.self.python"],[26,"source.python meta.fstring.python meta.member.access.python punctuation.separator.period.python"],[27,"source.python meta.fstring.python meta.member.access.python meta.attribute.python"],[28,"source.python meta.fstring.python storage.type.format.python"],[30,"source.python meta.fstring.python storage.type.format.python"],[34,"source.python meta.fstring.python constant.character.format.placeholder.other.python"],[35,"source.python meta.fstring.python string.interpolated.python string.quoted.single.python"],[41,"source.python meta.fstring.python constant.character.escape.python"],[43,"source.python meta.fstring.python punctuation.definition.string.end.python string.interpolated.python string.quoted.single.python"],[44,"source.python"],[45,"source.python keyword.operator.arithmetic.python"],[46,"source.python"],[47,"source.python string.regexp.quoted.single.python storage.type.string.python"],[48,"source.python string.regexp.quoted.single.python punctuation.definition.string.begin.python"],[49,"source.python string.regexp.quoted.single.python support.other.escape.special.regexp"],[51,"source.python string.regexp.quoted.single.python keyword.operator.quantifier.regexp"],[52,"source.python string.regexp.quoted.single.python punctuation.definition.string.end.python"],[53,"source.python"],[54,"source.python keyword.operator.arithmetic.python"],[55,"source.python"],[56,"source.python string.quoted.binary.single.python storage.type.string.python"],[57,"source.python string.quoted.binary.single.python punctuation.definition.string.begin.python"],[58,"source.python string.quoted.binary.single.python constant.character.escape.python"],[62,"source.python string.quoted.binary.single.python punctuation.definition.string.end.python"]] +[[0,"source.python"],[8,"source.python keyword.control.flow.python"],[14,"source.python"],[15,"source.python punctuation.definition.list.begin.python"],[16,"source.python"],[17,"source.python"],[18,"source.python keyword.operator.arithmetic.python"],[20,"source.python"],[21,"source.python constant.numeric.dec.python"],[22,"source.python"],[23,"source.python keyword.control.flow.python"],[26,"source.python"],[27,"source.python"],[28,"source.python"],[29,"source.python keyword.control.flow.python"],[31,"source.python"],[32,"source.python meta.function-call.python support.function.builtin.python"],[37,"source.python meta.function-call.python punctuation.definition.arguments.begin.python"],[38,"source.python meta.function-call.python meta.function-call.arguments.python constant.numeric.hex.python storage.type.number.python"],[40,"source.python meta.function-call.python meta.function-call.arguments.python constant.numeric.hex.python"],[42,"source.python meta.function-call.python punctuation.definition.arguments.end.python"],[43,"source.python"],[44,"source.python keyword.control.flow.python"],[46,"source.python"],[47,"source.python"],[48,"source.python"],[49,"source.python keyword.operator.arithmetic.python"],[50,"source.python"],[51,"source.python constant.numeric.dec.python"],[52,"source.python"],[53,"source.python keyword.operator.comparison.python"],[55,"source.python"],[56,"source.python constant.numeric.dec.python"],[57,"source.python punctuation.definition.list.end.python"]] +[[0,"source.python"]] +[[0,"source.python meta.function.python storage.type.function.async.python"],[5,"source.python meta.function.python"],[6,"source.python meta.function.python storage.type.function.python"],[9,"source.python meta.function.python"],[10,"source.python meta.function.python entity.name.function.python"],[14,"source.python meta.function.python meta.function.parameters.python punctuation.definition.parameters.begin.python"],[15,"source.python meta.function.python meta.function.parameters.python punctuation.definition.parameters.end.python"],[16,"source.python meta.function.python punctuation.section.function.begin.python"]] +[[0,"source.python"],[4,"source.python keyword.control.flow.python"],[9,"source.python"],[10,"source.python"],[17,"source.python meta.member.access.python punctuation.separator.period.python"],[18,"source.python meta.member.access.python meta.function-call.python meta.function-call.generic.python"],[23,"source.python meta.member.access.python meta.function-call.python punctuation.definition.arguments.begin.python"],[24,"source.python meta.member.access.python meta.function-call.python meta.function-call.arguments.python constant.numeric.dec.python"],[25,"source.python meta.member.access.python meta.function-call.python punctuation.definition.arguments.end.python"]] +[[0,"source.python"],[4,"source.python meta.lambda-function.python storage.type.function.lambda.python"],[10,"source.python meta.lambda-function.python meta.function.lambda.parameters.python"],[11,"source.python meta.lambda-function.python meta.function.lambda.parameters.python variable.parameter.function.language.python"],[12,"source.python meta.lambda-function.python punctuation.section.function.lambda.begin.python"],[13,"source.python"],[14,"source.python"],[15,"source.python"],[16,"source.python keyword.operator.arithmetic.python"],[17,"source.python"],[18,"source.python constant.numeric.dec.python"]] +[[0,"source.python"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.rb b/desktop/internal/editor/textmate/testdata/sample.rb new file mode 100644 index 0000000000..59a55e1ba0 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true +require 'json' + +module Shop + # A product + class Product < Base + attr_reader :name, :price + DEFAULT = 1.5e3 + + def initialize(name, price = 0) + @name = name + @@count ||= 0 + $stdout.puts "Created #{name} at #{price}\n" + end + + def discounted?(rate: 0.1) + return false if price.nil? + price * (1 - rate) > 10 && name =~ /^A\d+/ + end + end +end + +[1, 2, 3].each { |x| puts x } diff --git a/desktop/internal/editor/textmate/testdata/sample.rb.tokens b/desktop/internal/editor/textmate/testdata/sample.rb.tokens new file mode 100644 index 0000000000..a7815c8387 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.rb.tokens @@ -0,0 +1,24 @@ +[[0,"source.ruby comment.line.number-sign.ruby punctuation.definition.comment.ruby"],[1,"source.ruby comment.line.number-sign.ruby"]] +[[0,"source.ruby meta.require.ruby keyword.other.special-method.ruby"],[7,"source.ruby meta.require.ruby"],[8,"source.ruby meta.require.ruby string.quoted.single.ruby punctuation.definition.string.begin.ruby"],[9,"source.ruby meta.require.ruby string.quoted.single.ruby"],[13,"source.ruby meta.require.ruby string.quoted.single.ruby punctuation.definition.string.end.ruby"]] +[[0,"source.ruby"]] +[[0,"source.ruby meta.module.ruby keyword.control.module.ruby"],[6,"source.ruby meta.module.ruby"],[7,"source.ruby meta.module.ruby entity.name.type.module.ruby"]] +[[0,"source.ruby punctuation.whitespace.comment.leading.ruby"],[2,"source.ruby comment.line.number-sign.ruby punctuation.definition.comment.ruby"],[3,"source.ruby comment.line.number-sign.ruby"]] +[[0,"source.ruby"],[2,"source.ruby meta.class.ruby keyword.control.class.ruby"],[7,"source.ruby meta.class.ruby"],[8,"source.ruby meta.class.ruby entity.name.type.class.ruby"],[15,"source.ruby meta.class.ruby"],[16,"source.ruby meta.class.ruby punctuation.separator.inheritance.ruby"],[17,"source.ruby meta.class.ruby"],[18,"source.ruby meta.class.ruby entity.other.inherited-class.ruby"]] +[[0,"source.ruby"],[4,"source.ruby keyword.other.special-method.ruby"],[15,"source.ruby"],[16,"source.ruby constant.language.symbol.ruby punctuation.definition.constant.ruby"],[17,"source.ruby constant.language.symbol.ruby"],[21,"source.ruby punctuation.separator.object.ruby"],[22,"source.ruby"],[23,"source.ruby constant.language.symbol.ruby punctuation.definition.constant.ruby"],[24,"source.ruby constant.language.symbol.ruby"]] +[[0,"source.ruby"],[4,"source.ruby variable.other.constant.ruby"],[11,"source.ruby"],[12,"source.ruby keyword.operator.assignment.ruby"],[13,"source.ruby"],[14,"source.ruby constant.numeric.ruby"]] +[[0,"source.ruby"]] +[[0,"source.ruby"],[4,"source.ruby meta.function.method.with-arguments.ruby keyword.control.def.ruby"],[7,"source.ruby meta.function.method.with-arguments.ruby"],[8,"source.ruby meta.function.method.with-arguments.ruby entity.name.function.ruby"],[18,"source.ruby meta.function.method.with-arguments.ruby punctuation.definition.parameters.ruby"],[19,"source.ruby meta.function.method.with-arguments.ruby variable.parameter.function.ruby"],[23,"source.ruby meta.function.method.with-arguments.ruby punctuation.separator.object.ruby"],[24,"source.ruby meta.function.method.with-arguments.ruby"],[25,"source.ruby meta.function.method.with-arguments.ruby variable.parameter.function.ruby"],[30,"source.ruby meta.function.method.with-arguments.ruby"],[31,"source.ruby meta.function.method.with-arguments.ruby keyword.operator.assignment.ruby"],[32,"source.ruby meta.function.method.with-arguments.ruby"],[33,"source.ruby meta.function.method.with-arguments.ruby constant.numeric.ruby"],[34,"source.ruby meta.function.method.with-arguments.ruby punctuation.definition.parameters.ruby"]] +[[0,"source.ruby"],[6,"source.ruby variable.other.readwrite.instance.ruby punctuation.definition.variable.ruby"],[7,"source.ruby variable.other.readwrite.instance.ruby"],[11,"source.ruby"],[12,"source.ruby keyword.operator.assignment.ruby"],[13,"source.ruby"]] +[[0,"source.ruby"],[6,"source.ruby variable.other.readwrite.class.ruby punctuation.definition.variable.ruby"],[8,"source.ruby variable.other.readwrite.class.ruby"],[13,"source.ruby"],[14,"source.ruby keyword.operator.assignment.augmented.ruby"],[17,"source.ruby"],[18,"source.ruby constant.numeric.ruby"]] +[[0,"source.ruby"],[6,"source.ruby variable.other.readwrite.global.ruby punctuation.definition.variable.ruby"],[7,"source.ruby variable.other.readwrite.global.ruby"],[13,"source.ruby punctuation.separator.method.ruby"],[14,"source.ruby support.function.kernel.ruby"],[18,"source.ruby"],[19,"source.ruby string.quoted.double.interpolated.ruby punctuation.definition.string.begin.ruby"],[20,"source.ruby string.quoted.double.interpolated.ruby"],[28,"source.ruby string.quoted.double.interpolated.ruby meta.embedded.line.ruby punctuation.section.embedded.begin.ruby"],[30,"source.ruby string.quoted.double.interpolated.ruby meta.embedded.line.ruby source.ruby"],[34,"source.ruby string.quoted.double.interpolated.ruby meta.embedded.line.ruby punctuation.section.embedded.end.ruby"],[35,"source.ruby string.quoted.double.interpolated.ruby"],[39,"source.ruby string.quoted.double.interpolated.ruby meta.embedded.line.ruby punctuation.section.embedded.begin.ruby"],[41,"source.ruby string.quoted.double.interpolated.ruby meta.embedded.line.ruby source.ruby"],[46,"source.ruby string.quoted.double.interpolated.ruby meta.embedded.line.ruby punctuation.section.embedded.end.ruby"],[47,"source.ruby string.quoted.double.interpolated.ruby constant.character.escape.ruby"],[49,"source.ruby string.quoted.double.interpolated.ruby punctuation.definition.string.end.ruby"]] +[[0,"source.ruby"],[4,"source.ruby keyword.control.ruby"]] +[[0,"source.ruby"]] +[[0,"source.ruby"],[4,"source.ruby meta.function.method.with-arguments.ruby keyword.control.def.ruby"],[7,"source.ruby meta.function.method.with-arguments.ruby"],[8,"source.ruby meta.function.method.with-arguments.ruby entity.name.function.ruby"],[19,"source.ruby meta.function.method.with-arguments.ruby punctuation.definition.parameters.ruby"],[20,"source.ruby meta.function.method.with-arguments.ruby constant.other.symbol.hashkey.parameter.function.ruby"],[24,"source.ruby meta.function.method.with-arguments.ruby constant.other.symbol.hashkey.parameter.function.ruby punctuation.definition.constant.ruby"],[25,"source.ruby meta.function.method.with-arguments.ruby"],[26,"source.ruby meta.function.method.with-arguments.ruby constant.numeric.ruby"],[29,"source.ruby meta.function.method.with-arguments.ruby punctuation.definition.parameters.ruby"]] +[[0,"source.ruby"],[6,"source.ruby keyword.control.pseudo-method.ruby"],[12,"source.ruby"],[13,"source.ruby constant.language.boolean.ruby"],[18,"source.ruby"],[19,"source.ruby keyword.control.ruby"],[21,"source.ruby"],[27,"source.ruby punctuation.separator.method.ruby"],[28,"source.ruby meta.function-call.ruby entity.name.function.ruby"]] +[[0,"source.ruby"],[12,"source.ruby keyword.operator.arithmetic.ruby"],[13,"source.ruby"],[14,"source.ruby punctuation.section.function.ruby"],[15,"source.ruby constant.numeric.ruby"],[16,"source.ruby"],[17,"source.ruby keyword.operator.arithmetic.ruby"],[18,"source.ruby"],[23,"source.ruby punctuation.section.function.ruby"],[24,"source.ruby"],[25,"source.ruby keyword.operator.comparison.ruby"],[26,"source.ruby"],[27,"source.ruby constant.numeric.ruby"],[29,"source.ruby"],[30,"source.ruby keyword.operator.logical.ruby"],[32,"source.ruby"],[38,"source.ruby keyword.operator.comparison.ruby"],[40,"source.ruby"],[41,"source.ruby string.regexp.interpolated.ruby punctuation.section.regexp.ruby"],[42,"source.ruby string.regexp.interpolated.ruby"],[44,"source.ruby string.regexp.interpolated.ruby constant.character.escape.ruby"],[46,"source.ruby string.regexp.interpolated.ruby"],[47,"source.ruby string.regexp.interpolated.ruby punctuation.section.regexp.ruby"]] +[[0,"source.ruby"],[4,"source.ruby keyword.control.ruby"]] +[[0,"source.ruby"],[2,"source.ruby keyword.control.ruby"]] +[[0,"source.ruby keyword.control.ruby"]] +[[0,"source.ruby"]] +[[0,"source.ruby punctuation.section.array.begin.ruby"],[1,"source.ruby constant.numeric.ruby"],[2,"source.ruby punctuation.separator.object.ruby"],[3,"source.ruby"],[4,"source.ruby constant.numeric.ruby"],[5,"source.ruby punctuation.separator.object.ruby"],[6,"source.ruby"],[7,"source.ruby constant.numeric.ruby"],[8,"source.ruby punctuation.section.array.end.ruby"],[9,"source.ruby punctuation.separator.method.ruby"],[10,"source.ruby meta.function-call.ruby entity.name.function.ruby"],[14,"source.ruby"],[15,"source.ruby punctuation.section.scope.begin.ruby"],[16,"source.ruby meta.syntax.ruby.start-block"],[17,"source.ruby meta.block.parameters.ruby punctuation.separator.variable.ruby"],[18,"source.ruby meta.block.parameters.ruby variable.other.block.ruby"],[19,"source.ruby meta.block.parameters.ruby punctuation.separator.variable.ruby"],[20,"source.ruby"],[21,"source.ruby support.function.kernel.ruby"],[25,"source.ruby"],[28,"source.ruby punctuation.section.scope.end.ruby"]] +[[0,"source.ruby"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.sh b/desktop/internal/editor/textmate/testdata/sample.sh new file mode 100644 index 0000000000..a7162fc18e --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# Build the thing +set -euo pipefail +NAME="${1:-world}" +readonly COUNT=$((2 + 3)) +greet() { + local who=$1 + echo "Hello, $who! ${NAME^^}" >&2 + printf '%s\n' 'single $quoted' +} +for f in *.txt; do + if [[ -f "$f" && $COUNT -gt 1 ]]; then + cat "$f" | grep -E '^a' || true + fi +done +case "$NAME" in + a*) greet "$(whoami)" ;; + *) exit 1 ;; +esac +cat <= '2024-01-01' +GROUP BY u.id +HAVING COUNT(*) > 10 +ORDER BY total DESC; +INSERT INTO users (name) VALUES ("quoted"), (NULL); diff --git a/desktop/internal/editor/textmate/testdata/sample.sql.tokens b/desktop/internal/editor/textmate/testdata/sample.sql.tokens new file mode 100644 index 0000000000..bb1279540c --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.sql.tokens @@ -0,0 +1,17 @@ +[[0,"source.sql comment.line.double-dash.sql punctuation.definition.comment.sql"],[2,"source.sql comment.line.double-dash.sql"]] +[[0,"source.sql meta.create.sql keyword.other.create.sql"],[6,"source.sql meta.create.sql"],[7,"source.sql meta.create.sql keyword.other.sql"],[12,"source.sql meta.create.sql"],[13,"source.sql meta.create.sql entity.name.function.sql"],[15,"source.sql"],[16,"source.sql keyword.other.sql"],[19,"source.sql"],[20,"source.sql keyword.other.sql"],[26,"source.sql"]] +[[0,"source.sql"],[7,"source.sql storage.type.sql"],[14,"source.sql"],[15,"source.sql storage.modifier.sql"],[26,"source.sql"]] +[[0,"source.sql"],[4,"source.sql keyword.other.sql"],[8,"source.sql"],[9,"source.sql storage.type.sql"],[16,"source.sql"],[17,"source.sql constant.numeric.sql"],[20,"source.sql"],[21,"source.sql"],[22,"source.sql keyword.other.DDL.create.II.sql"],[30,"source.sql"],[31,"source.sql storage.modifier.sql"],[38,"source.sql"],[39,"source.sql string.quoted.single.sql punctuation.definition.string.begin.sql"],[40,"source.sql string.quoted.single.sql"],[49,"source.sql string.quoted.single.sql punctuation.definition.string.end.sql"],[50,"source.sql"]] +[[0,"source.sql"],[10,"source.sql storage.type.sql"],[17,"source.sql"],[18,"source.sql constant.numeric.sql"],[20,"source.sql"],[22,"source.sql constant.numeric.sql"],[23,"source.sql"],[25,"source.sql keyword.operator.comparison.sql"],[26,"source.sql"],[27,"source.sql constant.numeric.sql"],[28,"source.sql"]] +[[0,"source.sql"]] +[[0,"source.sql comment.block punctuation.definition.comment.sql"],[2,"source.sql comment.block"]] +[[0,"source.sql comment.block"],[11,"source.sql comment.block punctuation.definition.comment.sql"]] +[[0,"source.sql keyword.other.DML.sql"],[6,"source.sql"],[7,"source.sql constant.other.database-name.sql"],[8,"source.sql"],[9,"source.sql constant.other.table-name.sql"],[11,"source.sql"],[13,"source.sql support.function.aggregate.sql"],[18,"source.sql"],[19,"source.sql keyword.operator.star.sql"],[20,"source.sql"],[22,"source.sql keyword.other.alias.sql"],[24,"source.sql"],[32,"source.sql support.function.aggregate.sql"],[35,"source.sql"],[36,"source.sql constant.other.database-name.sql"],[37,"source.sql"],[38,"source.sql constant.other.table-name.sql"],[43,"source.sql"]] +[[0,"source.sql keyword.other.DML.sql"],[4,"source.sql"]] +[[0,"source.sql keyword.other.DML.sql"],[9,"source.sql"],[19,"source.sql keyword.other.DDL.create.II.sql"],[21,"source.sql"],[22,"source.sql constant.other.database-name.sql"],[23,"source.sql"],[24,"source.sql constant.other.table-name.sql"],[31,"source.sql"],[32,"source.sql keyword.operator.comparison.sql"],[33,"source.sql"],[34,"source.sql constant.other.database-name.sql"],[35,"source.sql"],[36,"source.sql constant.other.table-name.sql"]] +[[0,"source.sql keyword.other.DML.sql"],[5,"source.sql"],[6,"source.sql constant.other.database-name.sql"],[7,"source.sql"],[8,"source.sql constant.other.table-name.sql"],[12,"source.sql"],[13,"source.sql keyword.other.DML.sql"],[17,"source.sql"],[18,"source.sql string.quoted.single.sql punctuation.definition.string.begin.sql"],[19,"source.sql string.quoted.single.sql"],[21,"source.sql string.quoted.single.sql punctuation.definition.string.end.sql"],[22,"source.sql"],[23,"source.sql keyword.other.DML.sql"],[26,"source.sql"],[27,"source.sql constant.other.database-name.sql"],[28,"source.sql"],[29,"source.sql constant.other.table-name.sql"],[39,"source.sql"],[40,"source.sql keyword.operator.comparison.sql"],[42,"source.sql"],[43,"source.sql string.quoted.single.sql punctuation.definition.string.begin.sql"],[44,"source.sql string.quoted.single.sql"],[54,"source.sql string.quoted.single.sql punctuation.definition.string.end.sql"]] +[[0,"source.sql keyword.other.DML.sql"],[8,"source.sql"],[9,"source.sql constant.other.database-name.sql"],[10,"source.sql"],[11,"source.sql constant.other.table-name.sql"]] +[[0,"source.sql keyword.other.DML.sql"],[6,"source.sql"],[7,"source.sql support.function.aggregate.sql"],[12,"source.sql"],[13,"source.sql keyword.operator.star.sql"],[14,"source.sql"],[16,"source.sql keyword.operator.comparison.sql"],[17,"source.sql"],[18,"source.sql constant.numeric.sql"]] +[[0,"source.sql keyword.other.DML.sql"],[8,"source.sql"],[15,"source.sql keyword.other.order.sql"],[19,"source.sql"]] +[[0,"source.sql keyword.other.DML.sql"],[11,"source.sql"],[19,"source.sql keyword.other.sql"],[23,"source.sql"],[25,"source.sql keyword.other.DML.II.sql"],[31,"source.sql"],[33,"source.sql string.quoted.double.sql punctuation.definition.string.begin.sql"],[34,"source.sql string.quoted.double.sql"],[40,"source.sql string.quoted.double.sql punctuation.definition.string.end.sql"],[41,"source.sql"],[45,"source.sql keyword.other.DDL.create.II.sql"],[49,"source.sql"]] +[[0,"source.sql"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.swift b/desktop/internal/editor/textmate/testdata/sample.swift new file mode 100644 index 0000000000..2ed36dc349 --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.swift @@ -0,0 +1,23 @@ +import Foundation + +/// Documentation. +@MainActor +final class ViewModel: ObservableObject, Identifiable { + @Published private(set) var count: Int = 0 + let id = UUID() + static let limit = 0x1F + + init(count: Int = 0) { + self.count = count + } + + // A comment + func increment(by step: Double = 1.5e3) async throws -> String? { + guard count < Self.limit else { return nil } + count += 1 + return "Count: \(count)\n" + } +} + +enum Direction { case north, south } +let closure: (Int) -> Bool = { $0 > 2 } diff --git a/desktop/internal/editor/textmate/testdata/sample.swift.tokens b/desktop/internal/editor/textmate/testdata/sample.swift.tokens new file mode 100644 index 0000000000..7b7ba9148a --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.swift.tokens @@ -0,0 +1,24 @@ +[[0,"source.swift meta.import.swift keyword.control.import.swift"],[6,"source.swift meta.import.swift"],[7,"source.swift meta.import.swift entity.name.type.swift"]] +[[0,"source.swift"]] +[[0,"source.swift comment.line.triple-slash.documentation.swift punctuation.definition.comment.swift"],[3,"source.swift comment.line.triple-slash.documentation.swift"]] +[[0,"source.swift meta.attribute.swift storage.modifier.attribute.swift punctuation.definition.attribute.swift"],[1,"source.swift meta.attribute.swift storage.modifier.attribute.swift"]] +[[0,"source.swift storage.modifier.swift"],[5,"source.swift"],[6,"source.swift meta.definition.type.class.swift storage.type.class.swift"],[11,"source.swift meta.definition.type.class.swift"],[12,"source.swift meta.definition.type.class.swift entity.name.type.class.swift"],[21,"source.swift meta.definition.type.class.swift meta.inheritance-clause.swift punctuation.separator.inheritance-clause.swift"],[22,"source.swift meta.definition.type.class.swift meta.inheritance-clause.swift"],[23,"source.swift meta.definition.type.class.swift meta.inheritance-clause.swift entity.other.inherited-class.swift meta.type-name.swift"],[39,"source.swift meta.definition.type.class.swift meta.inheritance-clause.swift meta.inheritance-list.more-types"],[41,"source.swift meta.definition.type.class.swift meta.inheritance-clause.swift meta.inheritance-list.more-types entity.other.inherited-class.swift meta.type-name.swift"],[53,"source.swift meta.definition.type.class.swift meta.inheritance-clause.swift meta.inheritance-list.more-types entity.other.inherited-class.swift"],[54,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift punctuation.definition.type.begin.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[4,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.attribute.swift storage.modifier.attribute.swift punctuation.definition.attribute.swift"],[5,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.attribute.swift storage.modifier.attribute.swift"],[14,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[15,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift keyword.other.declaration-specifier.accessibility.swift"],[22,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.function-call.swift punctuation.definition.arguments.begin.swift"],[23,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.function-call.swift storage.type.function.swift"],[26,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.function-call.swift punctuation.definition.arguments.end.swift"],[27,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[28,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift keyword.other.declaration-specifier.swift"],[31,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[38,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[39,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift support.type.swift"],[42,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[43,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift keyword.operator.custom.infix.swift"],[44,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[45,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift constant.numeric.integer.decimal.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[4,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift keyword.other.declaration-specifier.swift"],[7,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[11,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift keyword.operator.custom.infix.swift"],[12,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[13,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.function-call.swift support.function.any-method.swift"],[17,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.function-call.swift punctuation.definition.arguments.begin.swift"],[18,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.function-call.swift punctuation.definition.arguments.end.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[4,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift storage.modifier.swift"],[10,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[11,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift keyword.other.declaration-specifier.swift"],[14,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[21,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift keyword.operator.custom.infix.swift"],[22,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[23,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift constant.numeric.integer.hexadecimal.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[4,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift storage.type.function.swift"],[8,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.parameter-clause.swift punctuation.definition.parameters.begin.swift"],[9,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.parameter-clause.swift variable.parameter.function.swift entity.name.function.swift"],[14,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.parameter-clause.swift"],[16,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.parameter-clause.swift support.type.swift"],[19,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.parameter-clause.swift"],[20,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.parameter-clause.swift keyword.operator.assignment.swift"],[21,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.parameter-clause.swift"],[22,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.parameter-clause.swift constant.numeric.integer.decimal.swift"],[23,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.parameter-clause.swift punctuation.definition.parameters.end.swift"],[24,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift"],[25,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.definition.function.body.swift punctuation.section.function.begin.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.definition.function.body.swift"],[8,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.definition.function.body.swift variable.language.swift"],[12,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.definition.function.body.swift"],[13,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.definition.function.body.swift support.variable.swift"],[18,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.definition.function.body.swift"],[19,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.definition.function.body.swift keyword.operator.custom.infix.swift"],[20,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.definition.function.body.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.definition.function.body.swift"],[4,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.initializer.swift meta.definition.function.body.swift punctuation.section.function.end.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift punctuation.whitespace.comment.leading.swift"],[4,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift comment.line.double-slash.swift punctuation.definition.comment.swift"],[6,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift comment.line.double-slash.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift"],[4,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift storage.type.function.swift"],[8,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift"],[9,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift entity.name.function.swift"],[18,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.parameter-clause.swift punctuation.definition.parameters.begin.swift"],[19,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.parameter-clause.swift entity.name.function.swift"],[21,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.parameter-clause.swift"],[22,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.parameter-clause.swift variable.parameter.function.swift"],[26,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.parameter-clause.swift"],[28,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.parameter-clause.swift support.type.swift"],[34,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.parameter-clause.swift"],[35,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.parameter-clause.swift keyword.operator.assignment.swift"],[36,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.parameter-clause.swift"],[37,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.parameter-clause.swift constant.numeric.float.decimal.swift"],[42,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.parameter-clause.swift punctuation.definition.parameters.end.swift"],[43,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.parameter-clause.swift"],[44,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.parameter-clause.swift storage.modifier.async.swift"],[49,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift"],[50,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift storage.modifier.exception.swift"],[56,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift"],[57,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.function-result.swift keyword.operator.function-result.swift"],[59,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.function-result.swift"],[60,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.function-result.swift support.type.swift"],[66,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.function-result.swift keyword.operator.type.optional.swift"],[67,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.function-result.swift"],[68,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift punctuation.section.function.begin.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift"],[8,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift keyword.control.branch.swift"],[13,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift"],[20,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift keyword.operator.custom.infix.swift"],[21,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift"],[22,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift variable.language.swift"],[26,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift"],[33,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift keyword.control.branch.swift"],[37,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift"],[38,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift punctuation.section.scope.begin.swift"],[39,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift"],[40,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift keyword.control.transfer.swift"],[46,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift"],[47,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift constant.language.nil.swift"],[50,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift"],[51,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift punctuation.section.scope.end.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift"],[14,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift keyword.operator.custom.infix.swift"],[16,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift"],[17,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift constant.numeric.integer.decimal.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift"],[8,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift keyword.control.transfer.swift"],[14,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift"],[15,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift string.quoted.double.single-line.swift punctuation.definition.string.begin.swift"],[16,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift string.quoted.double.single-line.swift"],[23,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift string.quoted.double.single-line.swift meta.embedded.line.swift punctuation.section.embedded.begin.swift"],[25,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift string.quoted.double.single-line.swift meta.embedded.line.swift source.swift"],[30,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift string.quoted.double.single-line.swift meta.embedded.line.swift punctuation.section.embedded.end.swift"],[31,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift string.quoted.double.single-line.swift constant.character.escape.swift"],[33,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift string.quoted.double.single-line.swift punctuation.definition.string.end.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift"],[4,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift meta.definition.function.swift meta.definition.function.body.swift punctuation.section.function.end.swift"]] +[[0,"source.swift meta.definition.type.class.swift meta.definition.type.body.swift punctuation.definition.type.end.swift"]] +[[0,"source.swift"]] +[[0,"source.swift meta.definition.type.enum.swift storage.type.enum.swift"],[4,"source.swift meta.definition.type.enum.swift"],[5,"source.swift meta.definition.type.enum.swift entity.name.type.enum.swift"],[14,"source.swift meta.definition.type.enum.swift"],[15,"source.swift meta.definition.type.enum.swift meta.definition.type.body.swift punctuation.definition.type.begin.swift"],[16,"source.swift meta.definition.type.enum.swift meta.definition.type.body.swift"],[17,"source.swift meta.definition.type.enum.swift meta.definition.type.body.swift storage.type.enum.case.swift"],[21,"source.swift meta.definition.type.enum.swift meta.definition.type.body.swift"],[22,"source.swift meta.definition.type.enum.swift meta.definition.type.body.swift variable.other.enummember.swift"],[27,"source.swift meta.definition.type.enum.swift meta.definition.type.body.swift meta.enum-case.more-cases"],[29,"source.swift meta.definition.type.enum.swift meta.definition.type.body.swift meta.enum-case.more-cases variable.other.enummember.swift"],[34,"source.swift meta.definition.type.enum.swift meta.definition.type.body.swift meta.enum-case.more-cases"],[35,"source.swift meta.definition.type.enum.swift meta.definition.type.body.swift punctuation.definition.type.end.swift"]] +[[0,"source.swift keyword.other.declaration-specifier.swift"],[3,"source.swift"],[12,"source.swift"],[13,"source.swift punctuation.section.tuple-type.begin.swift"],[14,"source.swift support.type.swift"],[17,"source.swift punctuation.section.tuple-type.end.swift"],[18,"source.swift"],[19,"source.swift keyword.operator.type.function.swift"],[21,"source.swift"],[22,"source.swift support.type.swift"],[26,"source.swift"],[27,"source.swift keyword.operator.custom.infix.swift"],[28,"source.swift"],[29,"source.swift punctuation.section.scope.begin.swift"],[30,"source.swift"],[31,"source.swift variable.language.closure-parameter.swift"],[33,"source.swift"],[34,"source.swift keyword.operator.custom.infix.swift"],[35,"source.swift"],[36,"source.swift constant.numeric.integer.decimal.swift"],[37,"source.swift"],[38,"source.swift punctuation.section.scope.end.swift"]] +[[0,"source.swift"]] diff --git a/desktop/internal/editor/textmate/testdata/sample.zig b/desktop/internal/editor/textmate/testdata/sample.zig new file mode 100644 index 0000000000..5153ad4c1f --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.zig @@ -0,0 +1,21 @@ +const std = @import("std"); + +/// Documentation. +pub const Point = struct { + x: i32 = 0, + y: f64 = 1.5e3, + + pub fn norm(self: Point) f64 { + // A comment + return @sqrt(self.y * self.y) + @as(f64, @floatFromInt(self.x)); + } +}; + +pub fn main() !void { + const stdout = std.io.getStdOut().writer(); + var list = [_]u8{ 'a', 0x1F, 3 }; + if (list.len > 0 and true) { + try stdout.print("Hello, {s}!\n", .{"world"}); + } + errdefer unreachable; +} diff --git a/desktop/internal/editor/textmate/testdata/sample.zig.tokens b/desktop/internal/editor/textmate/testdata/sample.zig.tokens new file mode 100644 index 0000000000..6ead88d2ce --- /dev/null +++ b/desktop/internal/editor/textmate/testdata/sample.zig.tokens @@ -0,0 +1,22 @@ +[[0,"source.zig keyword.default.zig"],[5,"source.zig"],[6,"source.zig variable.zig"],[9,"source.zig"],[10,"source.zig keyword.operator.assignment.zig"],[11,"source.zig"],[12,"source.zig support.function.builtin.zig"],[19,"source.zig"],[20,"source.zig string.quoted.double.zig"],[21,"source.zig string.quoted.double.zig"],[24,"source.zig string.quoted.double.zig"],[25,"source.zig"],[26,"source.zig punctuation.terminator.statement.zig"]] +[[0,"source.zig"]] +[[0,"source.zig comment.line.documentation.zig"],[3,"source.zig comment.line.documentation.zig"]] +[[0,"source.zig keyword.storage.zig"],[3,"source.zig"],[4,"source.zig keyword.default.zig"],[9,"source.zig"],[10,"source.zig variable.zig"],[15,"source.zig"],[16,"source.zig keyword.operator.assignment.zig"],[17,"source.zig"],[18,"source.zig keyword.structure.zig"],[24,"source.zig"]] +[[0,"source.zig"],[4,"source.zig variable.zig"],[5,"source.zig punctuation.separator.key-value.zig"],[6,"source.zig"],[7,"source.zig keyword.type.integer.zig"],[10,"source.zig"],[11,"source.zig keyword.operator.assignment.zig"],[12,"source.zig"],[13,"source.zig constant.numeric.float.zig"],[14,"source.zig punctuation.comma.zig"]] +[[0,"source.zig"],[4,"source.zig variable.zig"],[5,"source.zig punctuation.separator.key-value.zig"],[6,"source.zig"],[7,"source.zig keyword.type.integer.zig"],[10,"source.zig"],[11,"source.zig keyword.operator.assignment.zig"],[12,"source.zig"],[13,"source.zig constant.numeric.float.zig"],[18,"source.zig punctuation.comma.zig"]] +[[0,"source.zig"]] +[[0,"source.zig"],[4,"source.zig keyword.storage.zig"],[7,"source.zig"],[8,"source.zig storage.type.function.zig"],[10,"source.zig"],[11,"source.zig entity.name.function.zig"],[15,"source.zig"],[16,"source.zig variable.zig"],[20,"source.zig punctuation.separator.key-value.zig"],[21,"source.zig"],[22,"source.zig variable.zig"],[27,"source.zig"],[29,"source.zig keyword.type.integer.zig"],[32,"source.zig"]] +[[0,"source.zig"],[8,"source.zig comment.line.double-slash.zig"],[10,"source.zig comment.line.double-slash.zig"]] +[[0,"source.zig"],[8,"source.zig keyword.control.flow.zig"],[14,"source.zig"],[15,"source.zig support.function.builtin.zig"],[20,"source.zig"],[21,"source.zig variable.zig"],[25,"source.zig punctuation.accessor.zig"],[26,"source.zig variable.zig"],[27,"source.zig"],[28,"source.zig keyword.operator.arithmetic.zig"],[29,"source.zig"],[30,"source.zig variable.zig"],[34,"source.zig punctuation.accessor.zig"],[35,"source.zig variable.zig"],[36,"source.zig"],[38,"source.zig keyword.operator.arithmetic.zig"],[39,"source.zig"],[40,"source.zig support.function.builtin.zig"],[43,"source.zig"],[44,"source.zig keyword.type.integer.zig"],[47,"source.zig punctuation.comma.zig"],[48,"source.zig"],[49,"source.zig support.function.builtin.zig"],[62,"source.zig"],[63,"source.zig variable.zig"],[67,"source.zig punctuation.accessor.zig"],[68,"source.zig variable.zig"],[69,"source.zig"],[71,"source.zig punctuation.terminator.statement.zig"]] +[[0,"source.zig"]] +[[0,"source.zig"],[1,"source.zig punctuation.terminator.statement.zig"]] +[[0,"source.zig"]] +[[0,"source.zig keyword.storage.zig"],[3,"source.zig"],[4,"source.zig storage.type.function.zig"],[6,"source.zig"],[7,"source.zig entity.name.function.zig"],[11,"source.zig"],[14,"source.zig keyword.operator.bitwise.zig"],[15,"source.zig keyword.type.zig"],[19,"source.zig"]] +[[0,"source.zig"],[4,"source.zig keyword.default.zig"],[9,"source.zig"],[10,"source.zig variable.zig"],[16,"source.zig"],[17,"source.zig keyword.operator.assignment.zig"],[18,"source.zig"],[19,"source.zig variable.zig"],[22,"source.zig punctuation.accessor.zig"],[23,"source.zig variable.zig"],[25,"source.zig punctuation.accessor.zig"],[26,"source.zig entity.name.function.zig"],[35,"source.zig"],[37,"source.zig punctuation.accessor.zig"],[38,"source.zig entity.name.function.zig"],[44,"source.zig"],[46,"source.zig punctuation.terminator.statement.zig"]] +[[0,"source.zig"],[4,"source.zig keyword.default.zig"],[7,"source.zig"],[8,"source.zig variable.zig"],[12,"source.zig"],[13,"source.zig keyword.operator.assignment.zig"],[14,"source.zig"],[16,"source.zig variable.zig"],[17,"source.zig"],[18,"source.zig keyword.type.integer.zig"],[20,"source.zig"],[22,"source.zig string.quoted.single.zig"],[25,"source.zig punctuation.comma.zig"],[26,"source.zig"],[27,"source.zig constant.numeric.hexfloat.zig"],[31,"source.zig punctuation.comma.zig"],[32,"source.zig"],[33,"source.zig constant.numeric.float.zig"],[34,"source.zig"],[36,"source.zig punctuation.terminator.statement.zig"]] +[[0,"source.zig"],[4,"source.zig keyword.control.conditional.zig"],[6,"source.zig"],[8,"source.zig variable.zig"],[12,"source.zig punctuation.accessor.zig"],[13,"source.zig variable.zig"],[16,"source.zig"],[17,"source.zig keyword.operator.comparison.zig"],[18,"source.zig"],[19,"source.zig constant.numeric.float.zig"],[20,"source.zig"],[21,"source.zig keyword.default.zig"],[24,"source.zig"],[25,"source.zig keyword.constant.bool.zig"],[29,"source.zig"]] +[[0,"source.zig"],[8,"source.zig keyword.control.trycatch.zig"],[11,"source.zig"],[12,"source.zig variable.zig"],[18,"source.zig punctuation.accessor.zig"],[19,"source.zig entity.name.function.zig"],[24,"source.zig"],[25,"source.zig string.quoted.double.zig"],[26,"source.zig string.quoted.double.zig"],[37,"source.zig string.quoted.double.zig constant.character.escape.zig"],[39,"source.zig string.quoted.double.zig"],[40,"source.zig punctuation.comma.zig"],[41,"source.zig"],[42,"source.zig punctuation.accessor.zig"],[43,"source.zig"],[44,"source.zig string.quoted.double.zig"],[45,"source.zig string.quoted.double.zig"],[50,"source.zig string.quoted.double.zig"],[51,"source.zig"],[53,"source.zig punctuation.terminator.statement.zig"]] +[[0,"source.zig"]] +[[0,"source.zig"],[4,"source.zig keyword.control.flow.zig"],[12,"source.zig"],[13,"source.zig keyword.statement.zig"],[24,"source.zig punctuation.terminator.statement.zig"]] +[[0,"source.zig"]] +[[0,"source.zig"]] diff --git a/desktop/internal/editor/textmate/testdata/samples.json b/desktop/internal/editor/textmate/testdata/samples.json index 29545ca9e0..f9054ae6fe 100644 --- a/desktop/internal/editor/textmate/testdata/samples.json +++ b/desktop/internal/editor/textmate/testdata/samples.json @@ -20,5 +20,22 @@ "sample.jsonc": "source.json.comments", "sample.toml": "source.toml", "sample.xml": "text.xml", - "sample.ini": "source.ini" + "sample.ini": "source.ini", + "sample.py": "source.python", + "sample.sh": "source.shell", + "sample.kt": "source.kotlin", + "Dockerfile": "source.dockerfile", + "sample.sql": "source.sql", + "sample.php": "text.html.php", + "sample.rb": "source.ruby", + "sample.swift": "source.swift", + "sample.cs": "source.cs", + "sample.lua": "source.lua", + "sample.ps1": "source.powershell", + "sample.zig": "source.zig", + "sample.proto": "source.proto", + "sample.m": "source.objc", + "sample.mm": "source.objcpp", + "sample.graphql": "source.graphql", + "sample.injection": "source.injection" } diff --git a/desktop/internal/editor/textmate/textmate_test.go b/desktop/internal/editor/textmate/textmate_test.go index e0b7f61b00..d61645f943 100644 --- a/desktop/internal/editor/textmate/textmate_test.go +++ b/desktop/internal/editor/textmate/textmate_test.go @@ -82,6 +82,8 @@ func TestTranslate(t *testing.T) { {`[\x{41 42}-]`, `[AB\-]`}, {`a{2,0}`, `(?>a{0,2})`}, {`(?x)?\g`, `(x)?(?<1>x)`}, + {`(?~\*/)$`, `(?:(?:(?!\*/)(?s:.))*)$`}, + {`(?~ab)?c`, `(?:(?:(?!ab)(?s:.))*)?c`}, } for _, c := range cases { got, err := translate(c.in, false, false) @@ -99,7 +101,7 @@ func TestTranslate(t *testing.T) { if got, _ := translate(`\Gx|\Ay`, true, true); got != `(?!)x|(?!)y` { t.Errorf("anchors not disallowed: %q", got) } - for _, unsupported := range []string{`\K`, `\g`, `\g<0>`, `(?~x)`, `(`, `)`} { + for _, unsupported := range []string{`\K`, `\g`, `\g<0>`, `(?~|x)`, `(?~|x|y)`, `(`, `)`} { if _, err := translate(unsupported, false, false); err == nil { t.Errorf("translate(%q) succeeded", unsupported) } @@ -125,6 +127,10 @@ func TestTranslatedMatches(t *testing.T) { {pattern: `[\x{41 43}]+`, input: "BCAB", match: "CA"}, {pattern: `x[^"]{2,0}`, input: "xabc", match: "xab"}, {pattern: `[[:^alpha:]]+`, input: "ab12c", match: "12"}, + // The absent operator stops before what it must not contain, and C#'s use of it sees + // whether a line is free of "*/" to its end. + {pattern: `/\*(?~\*/)`, input: "x /* a */ b */", match: "/* a "}, + {pattern: `a(?=(?~\*/)$)`, input: "a * / b\n", match: "a"}, } for _, c := range cases { re, err := compilePattern(c.pattern, false, false) diff --git a/desktop/internal/editor/textmate/tokenizer.go b/desktop/internal/editor/textmate/tokenizer.go index 0664bc8bf4..8467255076 100644 --- a/desktop/internal/editor/textmate/tokenizer.go +++ b/desktop/internal/editor/textmate/tokenizer.go @@ -248,6 +248,15 @@ type Tokenizer struct { groups []span // line is the text of the line, kept here so that it is not allocated per line. line text + + // injectedAt is the scope stack injected was computed for: whether each of the grammar's + // injections applies there. + injectedAt *ScopeStack + injected []bool + // ruleMatch and injectionMatch hold the groups of the current rule's best match and the + // injections' while both are searched, since a later search may reuse the cache slot a + // match is in. + ruleMatch, injectionMatch []int } // rawToken is a token with its start in runes. @@ -327,7 +336,7 @@ func (t *Tokenizer) tokenizeText(s *text, first bool, pos int, stack *StateStack if !deadline.IsZero() && time.Now().After(deadline) { return stack, true } - id, caps := t.matchRule(s, first, pos, stack, anchor) + id, caps := t.matchRuleOrInjections(s, first, pos, stack, anchor) if caps == nil { t.produce(stack.content, length) return stack, false @@ -415,11 +424,12 @@ func (t *Tokenizer) checkWhileConditions(s *text, first bool, pos int, stack *St if node.hasEndRule { p = r.resolvedPattern(r.while, node.endRule) } - _, caps := t.search(s, pos, first, pos == anchor, nil, entry{rule: whileRuleID, pat: p}, false) - if caps == nil { + _, m := t.search(s, pos, first, pos == anchor, nil, entry{rule: whileRuleID, pat: p}, false) + if m == nil { stack = node.parent break } + caps := t.keep(m) t.produce(node.content, caps[0].start) t.captures(s, first, node, r.whileCaptures, caps) t.produce(node.content, caps[0].end) @@ -432,9 +442,82 @@ func (t *Tokenizer) checkWhileConditions(s *text, first bool, pos int, stack *St return stack, pos, first, anchor } +// matchRuleOrInjections is vscode-textmate's matchRuleOrInjections: it finds the match the +// innermost rule of stack makes in s from pos, and the match the injections whose selectors +// match the scopes there make, and returns the rule the winner starts and its groups. The +// injections' match wins when it starts earlier, or at the same start when its selector part +// is written "L:". +func (t *Tokenizer) matchRuleOrInjections(s *text, first bool, pos int, stack *StateStack, anchor int) (int, []span) { + id, m := t.matchRule(s, first, pos, stack, anchor) + if len(t.g.injections) == 0 { + if m == nil { + return 0, nil + } + return id, t.keep(m) + } + if m != nil { + t.ruleMatch = append(t.ruleMatch[:0], m...) + m = t.ruleMatch + } + injected, im, left := t.matchInjections(s, first, pos, stack, anchor) + if im != nil && (m == nil || im[0] < m[0] || left && im[0] == m[0]) { + return injected, t.keep(im) + } + if m == nil { + return 0, nil + } + return id, t.keep(m) +} + +// matchInjections is vscode-textmate's matchInjections: of the injections whose selectors +// match the scopes stack has, in priority order, the first to find the leftmost match in s +// from pos. It returns the rule the match starts, the match as search reports it, and whether +// the injection's priority is "L:". +// +// An injection written as a begin/end rule is searched with its patterns but not its end. +// vscode-textmate searches that end too and takes a match of it for the end of whatever rule +// is open, which at the grammar's root fails; no grammar is known to rely on it. +func (t *Tokenizer) matchInjections(s *text, first bool, pos int, stack *StateStack, anchor int) (int, []int, bool) { + applies := t.injectionsAt(stack.content) + var best []int + bestRule, bestPriority := 0, 0 + for i, inj := range t.g.injections { + if !applies[i] { + continue + } + id, m := t.search(s, pos, first, pos == anchor, t.g.rule(inj.rule).scanner(t.g), entry{}, false) + if m == nil || best != nil && m[0] >= best[0] { + // Injections are in priority order, so the earlier one wins at the same start. + continue + } + t.injectionMatch = append(t.injectionMatch[:0], m...) + best, bestRule, bestPriority = t.injectionMatch, id, inj.priority + if best[0] == pos { + break + } + } + return bestRule, best, bestPriority == -1 +} + +// injectionsAt says, for each of the grammar's injections, whether its selector matches +// scopes. The answer is kept for the last stack asked about, which the positions of a line +// mostly share. +func (t *Tokenizer) injectionsAt(scopes *ScopeStack) []bool { + if t.injected != nil && t.injectedAt == scopes { + return t.injected + } + t.injected = t.injected[:0] + for _, inj := range t.g.injections { + t.injected = append(t.injected, inj.selector.matches(scopes)) + } + t.injectedAt = scopes + return t.injected +} + // matchRule finds the leftmost match in s from pos among the patterns of the innermost rule -// of stack, its end pattern included, and returns the rule it starts and its groups. -func (t *Tokenizer) matchRule(s *text, first bool, pos int, stack *StateStack, anchor int) (int, []span) { +// of stack, its end pattern included, and returns the rule it starts and the match as search +// reports it. +func (t *Tokenizer) matchRule(s *text, first bool, pos int, stack *StateStack, anchor int) (int, []int) { r := t.g.rule(stack.rule) entries := r.scanner(t.g) if r.kind != beginEndRule { @@ -449,9 +532,10 @@ func (t *Tokenizer) matchRule(s *text, first bool, pos int, stack *StateStack, a // search finds the leftmost match in s from pos among entries and end, if end has a pattern, // which comes first unless endLast is set. Of matches that start at the same place the first -// in that order wins. It returns the winning entry's rule and the match's groups, or nil -// groups when nothing matches. -func (t *Tokenizer) search(s *text, pos int, allowA, allowG bool, entries []entry, end entry, endLast bool) (int, []span) { +// in that order wins. It returns the winning entry's rule and the match as find reports it, +// or nil when nothing matches; the match belongs to the cache, so keep copies its groups out +// before the next search. +func (t *Tokenizer) search(s *text, pos int, allowA, allowG bool, entries []entry, end entry, endLast bool) (int, []int) { var best []int bestRule := 0 try := func(e entry) bool { @@ -477,7 +561,7 @@ func (t *Tokenizer) search(s *text, pos int, allowA, allowG bool, entries []entr if best == nil { return 0, nil } - return bestRule, t.keep(best) + return bestRule, best } // find searches s from pos with one pattern, answering from the cache where an earlier diff --git a/desktop/internal/fileicons/LICENSE-MIT-vscode-cmake-tools.txt b/desktop/internal/fileicons/LICENSE-MIT-vscode-cmake-tools.txt new file mode 100644 index 0000000000..5887d872b3 --- /dev/null +++ b/desktop/internal/fileicons/LICENSE-MIT-vscode-cmake-tools.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 vector-of-bool + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/desktop/internal/fileicons/LICENSE-lua-logo.txt b/desktop/internal/fileicons/LICENSE-lua-logo.txt new file mode 100644 index 0000000000..989fcd0258 --- /dev/null +++ b/desktop/internal/fileicons/LICENSE-lua-logo.txt @@ -0,0 +1,18 @@ +Terms of the Lua logo, as published at https://www.lua.org/images/ and in the header of +https://www.lua.org/images/lua-logo-nolabel.ps: + +Copyright (c) 1998 Lua.org. Graphic design by Alexandre Nakonechnyj. + +Permission is hereby granted, without written agreement and without license +or royalty fees, to use, copy, and distribute this logo for any purpose, +including commercial applications, subject to the following conditions: + +* The origin of this logo must not be misrepresented; you must not + claim that you drew the original logo. We recommend that you give credit + to the graphics designer in all printed matter that includes the logo. + +* The only modification you can make is to adapt the orbiting text to + your product name. + +* The logo can be used in any scale as long as the relative proportions + of its elements are maintained. diff --git a/desktop/internal/fileicons/NOTICE b/desktop/internal/fileicons/NOTICE index 11e18ebed0..9a884b0325 100644 --- a/desktop/internal/fileicons/NOTICE +++ b/desktop/internal/fileicons/NOTICE @@ -3,7 +3,7 @@ File-type and folder icons of the Lithe desktop client. Most SVGs in svg/ are the file-tree icons the previous Lithe macOS client shipped in macos/Resources/IDEAIcons/, restored byte for byte from commit f1e8d8139^ of this repository; the Build tool window icons listed last were copied byte for byte from the -upstream repository. Except for the two noted below, they come from the JetBrains IntelliJ +upstream repository. Except for the icons noted below, they come from the JetBrains IntelliJ Platform Community repository (https://github.com/JetBrains/intellij-community) and are distributed under the Apache License 2.0; see LICENSE-APACHE-2.0.txt. The previous client's NOTICE.txt records the source paths and revisions of the restored icons, chiefly: @@ -42,11 +42,40 @@ license.svg and makefile.svg (and their _dark siblings) are original Lithe icons because the Community set has no LICENSE or Makefile glyph; they follow the Lithe repository license. +The icons of the languages whose grammars the editor bundles but the Community set has no +glyph for were copied from these sources: + +- graphql.svg and graphql_dark.svg: platform/icons/src/expui/fileTypes/ of the IntelliJ + Community repository (revision 54d2b2d53eeea48df651d4242122370c391d4973), byte for byte, + under the Apache License 2.0. +- protoFile.svg and protoFile_dark.svg: protobuf/protoeditor-core/resources/icons/newui/ of + the JetBrains intellij-plugins repository (https://github.com/JetBrains/intellij-plugins, + revision 6dfd13ea5346f031c617c558bb6f48381731ddb3), byte for byte, under the Apache License + 2.0; see LICENSE-APACHE-2.0.txt. +- lua.svg: icons/file_type_lua.svg of vscode-icons (https://github.com/vscode-icons/vscode-icons, + revision 814aab8318900f47efeae6f1c4691494ae764199), with its named colors gray and navy + written as #808080 and #000080, because the icon compiler reads only numeric colors. It draws + the official Lua logo, Copyright (c) 1998 Lua.org, graphic design by Alexandre Nakonechnyj, + which may be used unchanged at any scale under the terms in LICENSE-lua-logo.txt; + vscode-icons distributes its icons under CC BY-SA 4.0 + (https://creativecommons.org/licenses/by-sa/4.0/). +- zig.svg: adapted from zig-mark.svg of the official Zig logo repository + (https://github.com/ziglang/logo, revision 4f97e7a9ebce12fa48511c0b6502b6190005bc0e), the + logomark that the Zig extension for Visual Studio Code also shows, licensed under CC BY-SA + 4.0 (https://creativecommons.org/licenses/by-sa/4.0/). The same polygons were placed in a + 16x16 view box and their shape-rendering hints dropped; the adaptation is under CC BY-SA 4.0. +- cmake.svg: adapted from res/logo.svg of CMake Tools for Visual Studio Code + (https://github.com/microsoft/vscode-cmake-tools, revision + c757bfc851ca01d18601b64178ea40190e72d5d1), MIT, Copyright (c) 2018 vector-of-bool; see + LICENSE-MIT-vscode-cmake-tools.txt. Only the four triangles of the CMake mark were kept, + without the CMake Tools wrench, and placed in a 16x16 view box. + Copyright JetBrains s.r.o. and contributors. Lithe does not include JetBrains product logos. Modification: icons.go is not the SVGs themselves. scripts/desktop/generate-desktop-file-icons.sh rewrites each SVG into filled paths only (its strokes become outlines of the same color) -with picosvg and compiles the result into gfx.Icon values. The SVG sources in svg/ are -unmodified. The generator changes underscores in SVG filenames to hyphens when deriving Go -names, so db_set_breakpoint.svg is exposed as DbSetBreakpoint. +with picosvg and compiles the result into gfx.Icon values. Apart from lua.svg, zig.svg and +cmake.svg, changed as described above, the SVG sources in svg/ are unmodified. The generator changes +underscores in SVG filenames to hyphens when deriving Go names, so db_set_breakpoint.svg is +exposed as DbSetBreakpoint. diff --git a/desktop/internal/fileicons/fileicons.go b/desktop/internal/fileicons/fileicons.go index b961406463..163b3d54b7 100644 --- a/desktop/internal/fileicons/fileicons.go +++ b/desktop/internal/fileicons/fileicons.go @@ -55,6 +55,16 @@ const ( kindShell // kindPowerShell identifies a PowerShell script. kindPowerShell + // kindLua identifies a Lua file. + kindLua + // kindZig identifies a Zig source or ZON file. + kindZig + // kindProtobuf identifies a Protocol Buffers definition. + kindProtobuf + // kindGraphQL identifies a GraphQL schema or query file. + kindGraphQL + // kindCMake identifies a CMake script or CMakeLists.txt. + kindCMake // kindJavaScript identifies a JavaScript or TypeScript file. kindJavaScript // kindCSS identifies a CSS-family stylesheet. @@ -140,6 +150,11 @@ var kindIcons = [kindCount][2]*gfx.Icon{ kindCSharp: {&Csharp, &CsharpDark}, kindShell: {&Shell, &ShellDark}, kindPowerShell: {&Powershell, &PowershellDark}, + kindLua: {&Lua, nil}, + kindZig: {&Zig, nil}, + kindProtobuf: {&ProtoFile, &ProtoFileDark}, + kindGraphQL: {&Graphql, &GraphqlDark}, + kindCMake: {&Cmake, nil}, kindJavaScript: {&JavaScript, &JavaScriptDark}, kindCSS: {&Css, &CssDark}, kindHTML: {&Html, &HtmlDark}, @@ -343,6 +358,10 @@ func fileKind(name string) kind { if lowerName == "makefile" || lowerName == "gnumakefile" { return kindMakefile } + // CMakeLists.txt needs a name check because its extension is that of plain text. + if lowerName == "cmakelists.txt" { + return kindCMake + } stem, ext := splitExt(lowerName) if stem == "readme" { return kindReadme @@ -401,6 +420,16 @@ func fileKind(name string) kind { return kindShell case "ps1", "psm1", "psd1", "ps1xml", "psc1", "pssc": return kindPowerShell + case "lua": + return kindLua + case "zig", "zon": + return kindZig + case "proto": + return kindProtobuf + case "graphql", "gql": + return kindGraphQL + case "cmake": + return kindCMake case "css", "scss", "sass", "less": return kindCSS case "html", "htm", "xhtml", "vue", "svelte": diff --git a/desktop/internal/fileicons/fileicons_test.go b/desktop/internal/fileicons/fileicons_test.go index f1deae2897..16f1606640 100644 --- a/desktop/internal/fileicons/fileicons_test.go +++ b/desktop/internal/fileicons/fileicons_test.go @@ -41,6 +41,15 @@ func TestFileKind(t *testing.T) { {"main.go", kindGoSource}, {"Makefile", kindMakefile}, {"rules.mk", kindMakefile}, + {"order.lua", kindLua}, + {"main.zig", kindZig}, + {"build.zig.zon", kindZig}, + {"order.proto", kindProtobuf}, + {"schema.graphql", kindGraphQL}, + {"query.gql", kindGraphQL}, + {"CMakeLists.txt", kindCMake}, + {"toolchain.cmake", kindCMake}, + {"notes.txt", kindText}, {".gitignore", kindGitignore}, {".editorconfig", kindEditorConfig}, {"build.gradle.kts", kindKotlin}, diff --git a/desktop/internal/fileicons/icons.go b/desktop/internal/fileicons/icons.go index e84f2d70f1..a2f899161e 100644 --- a/desktop/internal/fileicons/icons.go +++ b/desktop/internal/fileicons/icons.go @@ -4,7 +4,7 @@ // Most SVGs in svg/ are the file-tree icons the previous Lithe macOS client shipped in // macos/Resources/IDEAIcons/, restored byte for byte from commit f1e8d8139^ of this // repository; the Build tool window icons listed last were copied byte for byte from the -// upstream repository. Except for the two noted below, they come from the JetBrains IntelliJ +// upstream repository. Except for the icons noted below, they come from the JetBrains IntelliJ // Platform Community repository (https://github.com/JetBrains/intellij-community) and are // distributed under the Apache License 2.0; see LICENSE-APACHE-2.0.txt. The previous // client's NOTICE.txt records the source paths and revisions of the restored icons, chiefly: @@ -43,14 +43,43 @@ // because the Community set has no LICENSE or Makefile glyph; they follow the Lithe // repository license. // +// The icons of the languages whose grammars the editor bundles but the Community set has no +// glyph for were copied from these sources: +// +// - graphql.svg and graphql_dark.svg: platform/icons/src/expui/fileTypes/ of the IntelliJ +// Community repository (revision 54d2b2d53eeea48df651d4242122370c391d4973), byte for byte, +// under the Apache License 2.0. +// - protoFile.svg and protoFile_dark.svg: protobuf/protoeditor-core/resources/icons/newui/ of +// the JetBrains intellij-plugins repository (https://github.com/JetBrains/intellij-plugins, +// revision 6dfd13ea5346f031c617c558bb6f48381731ddb3), byte for byte, under the Apache License +// 2.0; see LICENSE-APACHE-2.0.txt. +// - lua.svg: icons/file_type_lua.svg of vscode-icons (https://github.com/vscode-icons/vscode-icons, +// revision 814aab8318900f47efeae6f1c4691494ae764199), with its named colors gray and navy +// written as #808080 and #000080, because the icon compiler reads only numeric colors. It draws +// the official Lua logo, Copyright (c) 1998 Lua.org, graphic design by Alexandre Nakonechnyj, +// which may be used unchanged at any scale under the terms in LICENSE-lua-logo.txt; +// vscode-icons distributes its icons under CC BY-SA 4.0 +// (https://creativecommons.org/licenses/by-sa/4.0/). +// - zig.svg: adapted from zig-mark.svg of the official Zig logo repository +// (https://github.com/ziglang/logo, revision 4f97e7a9ebce12fa48511c0b6502b6190005bc0e), the +// logomark that the Zig extension for Visual Studio Code also shows, licensed under CC BY-SA +// 4.0 (https://creativecommons.org/licenses/by-sa/4.0/). The same polygons were placed in a +// 16x16 view box and their shape-rendering hints dropped; the adaptation is under CC BY-SA 4.0. +// - cmake.svg: adapted from res/logo.svg of CMake Tools for Visual Studio Code +// (https://github.com/microsoft/vscode-cmake-tools, revision +// c757bfc851ca01d18601b64178ea40190e72d5d1), MIT, Copyright (c) 2018 vector-of-bool; see +// LICENSE-MIT-vscode-cmake-tools.txt. Only the four triangles of the CMake mark were kept, +// without the CMake Tools wrench, and placed in a 16x16 view box. +// // Copyright JetBrains s.r.o. and contributors. Lithe does not include JetBrains product // logos. // // Modification: icons.go is not the SVGs themselves. scripts/desktop/generate-desktop-file-icons.sh // rewrites each SVG into filled paths only (its strokes become outlines of the same color) -// with picosvg and compiles the result into gfx.Icon values. The SVG sources in svg/ are -// unmodified. The generator changes underscores in SVG filenames to hyphens when deriving Go -// names, so db_set_breakpoint.svg is exposed as DbSetBreakpoint. +// with picosvg and compiles the result into gfx.Icon values. Apart from lua.svg, zig.svg and +// cmake.svg, changed as described above, the SVG sources in svg/ are unmodified. The generator changes +// underscores in SVG filenames to hyphens when deriving Go names, so db_set_breakpoint.svg is +// exposed as DbSetBreakpoint. package fileicons @@ -732,6 +761,40 @@ var ClassDark = gfx.Icon{ }, } +// cmake is a compiled vector icon. +var Cmake = gfx.Icon{ + ViewBox: 16.0, + Stroke: 2.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Layers: []gfx.IconLayer{ + {Fill: gfx.Color{Red: 0.0235294, Green: 0.309804, Blue: 0.54902, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(7.864, 1.04), + gfx.LineTo(1.037, 14.53), + gfx.LineTo(8.483, 8.213), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.141176, Green: 0.596078, Blue: 0.278431, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(14.537, 14.963), + gfx.LineTo(5.359, 11.25), + gfx.LineTo(1.0, 14.963), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.745098, Green: 0.129412, Blue: 0.156863, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(15.0, 14.847), + gfx.LineTo(8.173, 1.27), + gfx.LineTo(9.164, 12.496), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.803922, Green: 0.803922, Blue: 0.807843, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(8.869, 12.379), + gfx.LineTo(8.52, 8.56), + gfx.LineTo(5.589, 11.065), + gfx.ClosePath(), + }}, + }, +} + // cpp is a compiled vector icon. var Cpp = gfx.Icon{ ViewBox: 16.0, @@ -2389,6 +2452,148 @@ var Go = gfx.Icon{ }, } +// graphql is a compiled vector icon. +var Graphql = gfx.Icon{ + ViewBox: 16.0, + Stroke: 2.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Layers: []gfx.IconLayer{ + {Fill: gfx.Color{Red: 0.87451, Green: 0.0, Blue: 0.596078, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(9.5, 2.0), + gfx.CubicTo(9.5, 2.081, 9.494, 2.161, 9.481, 2.239), + gfx.LineTo(12.498, 3.884), + gfx.CubicTo(12.763, 3.645, 13.115, 3.5, 13.5, 3.5), + gfx.CubicTo(14.328, 3.5, 15.0, 4.172, 15.0, 5.0), + gfx.CubicTo(15.0, 5.653, 14.583, 6.209, 14.0, 6.415), + gfx.LineTo(14.0, 9.585), + gfx.CubicTo(14.583, 9.791, 15.0, 10.347, 15.0, 11.0), + gfx.CubicTo(15.0, 11.828, 14.328, 12.5, 13.5, 12.5), + gfx.CubicTo(13.115, 12.5, 12.764, 12.355, 12.498, 12.116), + gfx.LineTo(9.481, 13.762), + gfx.CubicTo(9.494, 13.839, 9.5, 13.919, 9.5, 14.0), + gfx.CubicTo(9.5, 14.828, 8.828, 15.5, 8.0, 15.5), + gfx.CubicTo(7.172, 15.5, 6.5, 14.828, 6.5, 14.0), + gfx.CubicTo(6.5, 13.919, 6.506, 13.839, 6.519, 13.762), + gfx.LineTo(3.502, 12.116), + gfx.CubicTo(3.236, 12.355, 2.885, 12.5, 2.5, 12.5), + gfx.CubicTo(1.672, 12.5, 1.0, 11.828, 1.0, 11.0), + gfx.CubicTo(1.0, 10.347, 1.417, 9.791, 2.0, 9.585), + gfx.LineTo(2.0, 6.415), + gfx.CubicTo(1.417, 6.209, 1.0, 5.653, 1.0, 5.0), + gfx.CubicTo(1.0, 4.172, 1.672, 3.5, 2.5, 3.5), + gfx.CubicTo(2.885, 3.5, 3.237, 3.645, 3.502, 3.884), + gfx.LineTo(6.519, 2.239), + gfx.CubicTo(6.506, 2.161, 6.5, 2.081, 6.5, 2.0), + gfx.CubicTo(6.5, 1.172, 7.172, 0.5, 8.0, 0.5), + gfx.CubicTo(8.828, 0.5, 9.5, 1.172, 9.5, 2.0), + gfx.ClosePath(), + gfx.MoveTo(7.965, 3.5), + gfx.LineTo(3.902, 10.0), + gfx.LineTo(12.098, 10.0), + gfx.LineTo(8.035, 3.5), + gfx.CubicTo(8.023, 3.5, 8.012, 3.5, 8.0, 3.5), + gfx.CubicTo(7.988, 3.5, 7.976, 3.5, 7.965, 3.5), + gfx.ClosePath(), + gfx.MoveTo(12.0, 11.0), + gfx.LineTo(4.0, 11.0), + gfx.CubicTo(4.0, 11.081, 3.994, 11.161, 3.981, 11.239), + gfx.LineTo(6.998, 12.884), + gfx.CubicTo(7.263, 12.645, 7.615, 12.5, 8.0, 12.5), + gfx.CubicTo(8.385, 12.5, 8.737, 12.645, 9.002, 12.884), + gfx.LineTo(12.019, 11.239), + gfx.CubicTo(12.007, 11.161, 12.0, 11.081, 12.0, 11.0), + gfx.ClosePath(), + gfx.MoveTo(8.984, 3.132), + gfx.LineTo(13.0, 9.557), + gfx.LineTo(13.0, 6.415), + gfx.CubicTo(12.417, 6.209, 12.0, 5.653, 12.0, 5.0), + gfx.CubicTo(12.0, 4.919, 12.006, 4.839, 12.019, 4.762), + gfx.LineTo(9.002, 3.116), + gfx.CubicTo(8.996, 3.122, 8.99, 3.127, 8.984, 3.132), + gfx.ClosePath(), + gfx.MoveTo(7.015, 3.132), + gfx.CubicTo(7.01, 3.127, 7.004, 3.121, 6.998, 3.116), + gfx.LineTo(3.981, 4.762), + gfx.CubicTo(3.994, 4.839, 4.0, 4.919, 4.0, 5.0), + gfx.CubicTo(4.0, 5.653, 3.583, 6.209, 3.0, 6.415), + gfx.LineTo(3.0, 9.556), + gfx.ClosePath(), + }}, + }, +} + +// graphql-dark is a compiled vector icon. +var GraphqlDark = gfx.Icon{ + ViewBox: 16.0, + Stroke: 2.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Layers: []gfx.IconLayer{ + {Fill: gfx.Color{Red: 1.0, Green: 0.192157, Blue: 0.792157, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(9.5, 2.0), + gfx.CubicTo(9.5, 2.081, 9.494, 2.161, 9.481, 2.239), + gfx.LineTo(12.498, 3.884), + gfx.CubicTo(12.763, 3.645, 13.115, 3.5, 13.5, 3.5), + gfx.CubicTo(14.328, 3.5, 15.0, 4.172, 15.0, 5.0), + gfx.CubicTo(15.0, 5.653, 14.583, 6.209, 14.0, 6.415), + gfx.LineTo(14.0, 9.585), + gfx.CubicTo(14.583, 9.791, 15.0, 10.347, 15.0, 11.0), + gfx.CubicTo(15.0, 11.828, 14.328, 12.5, 13.5, 12.5), + gfx.CubicTo(13.115, 12.5, 12.764, 12.355, 12.498, 12.116), + gfx.LineTo(9.481, 13.762), + gfx.CubicTo(9.494, 13.839, 9.5, 13.919, 9.5, 14.0), + gfx.CubicTo(9.5, 14.828, 8.828, 15.5, 8.0, 15.5), + gfx.CubicTo(7.172, 15.5, 6.5, 14.828, 6.5, 14.0), + gfx.CubicTo(6.5, 13.919, 6.506, 13.839, 6.519, 13.762), + gfx.LineTo(3.502, 12.116), + gfx.CubicTo(3.236, 12.355, 2.885, 12.5, 2.5, 12.5), + gfx.CubicTo(1.672, 12.5, 1.0, 11.828, 1.0, 11.0), + gfx.CubicTo(1.0, 10.347, 1.417, 9.791, 2.0, 9.585), + gfx.LineTo(2.0, 6.415), + gfx.CubicTo(1.417, 6.209, 1.0, 5.653, 1.0, 5.0), + gfx.CubicTo(1.0, 4.172, 1.672, 3.5, 2.5, 3.5), + gfx.CubicTo(2.885, 3.5, 3.237, 3.645, 3.502, 3.884), + gfx.LineTo(6.519, 2.239), + gfx.CubicTo(6.506, 2.161, 6.5, 2.081, 6.5, 2.0), + gfx.CubicTo(6.5, 1.172, 7.172, 0.5, 8.0, 0.5), + gfx.CubicTo(8.828, 0.5, 9.5, 1.172, 9.5, 2.0), + gfx.ClosePath(), + gfx.MoveTo(7.965, 3.5), + gfx.LineTo(3.902, 10.0), + gfx.LineTo(12.098, 10.0), + gfx.LineTo(8.035, 3.5), + gfx.CubicTo(8.023, 3.5, 8.012, 3.5, 8.0, 3.5), + gfx.CubicTo(7.988, 3.5, 7.976, 3.5, 7.965, 3.5), + gfx.ClosePath(), + gfx.MoveTo(12.0, 11.0), + gfx.LineTo(4.0, 11.0), + gfx.CubicTo(4.0, 11.081, 3.994, 11.161, 3.981, 11.239), + gfx.LineTo(6.998, 12.884), + gfx.CubicTo(7.263, 12.645, 7.615, 12.5, 8.0, 12.5), + gfx.CubicTo(8.385, 12.5, 8.737, 12.645, 9.002, 12.884), + gfx.LineTo(12.019, 11.239), + gfx.CubicTo(12.007, 11.161, 12.0, 11.081, 12.0, 11.0), + gfx.ClosePath(), + gfx.MoveTo(8.984, 3.132), + gfx.LineTo(13.0, 9.557), + gfx.LineTo(13.0, 6.415), + gfx.CubicTo(12.417, 6.209, 12.0, 5.653, 12.0, 5.0), + gfx.CubicTo(12.0, 4.919, 12.006, 4.839, 12.019, 4.762), + gfx.LineTo(9.002, 3.116), + gfx.CubicTo(8.996, 3.122, 8.99, 3.127, 8.984, 3.132), + gfx.ClosePath(), + gfx.MoveTo(7.015, 3.132), + gfx.CubicTo(7.01, 3.127, 7.004, 3.121, 6.998, 3.116), + gfx.LineTo(3.981, 4.762), + gfx.CubicTo(3.994, 4.839, 4.0, 4.919, 4.0, 5.0), + gfx.CubicTo(4.0, 5.653, 3.583, 6.209, 3.0, 6.415), + gfx.LineTo(3.0, 9.556), + gfx.ClosePath(), + }}, + }, +} + // groovy is a compiled vector icon. var Groovy = gfx.Icon{ ViewBox: 16.0, @@ -4172,6 +4377,260 @@ var LockDark = gfx.Icon{ }, } +// lua is a compiled vector icon. +var Lua = gfx.Icon{ + ViewBox: 32.0, + Stroke: 2.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Layers: []gfx.IconLayer{ + {Fill: gfx.Color{Red: 0.501961, Green: 0.501961, Blue: 0.501961, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(24.357, 27.239), + gfx.QuadTo(24.026, 27.485, 23.681, 27.711), + gfx.QuadTo(23.498, 27.831, 23.312, 27.945), + gfx.LineTo(23.14, 27.664), + gfx.QuadTo(23.321, 27.553, 23.5, 27.436), + gfx.QuadTo(23.837, 27.214, 24.161, 26.974), + gfx.ClosePath(), + gfx.MoveTo(28.477, 9.625), + gfx.QuadTo(28.763, 10.187, 28.998, 10.769), + gfx.LineTo(28.692, 10.892), + gfx.QuadTo(28.463, 10.323, 28.183, 9.775), + gfx.ClosePath(), + gfx.MoveTo(5.984, 6.182), + gfx.QuadTo(6.425, 5.733, 6.902, 5.325), + gfx.LineTo(7.117, 5.576), + gfx.QuadTo(6.651, 5.974, 6.22, 6.413), + gfx.ClosePath(), + gfx.MoveTo(6.296, 26.114), + gfx.QuadTo(5.845, 25.681, 5.433, 25.209), + gfx.LineTo(5.682, 24.992), + gfx.QuadTo(6.084, 25.453, 6.524, 25.876), + gfx.ClosePath(), + gfx.MoveTo(4.647, 24.222), + gfx.QuadTo(4.281, 23.718, 3.962, 23.186), + gfx.LineTo(4.245, 23.016), + gfx.QuadTo(4.557, 23.536, 4.914, 24.028), + gfx.ClosePath(), + gfx.MoveTo(4.403, 8.11), + gfx.QuadTo(4.752, 7.598, 5.145, 7.118), + gfx.LineTo(5.4, 7.328), + gfx.QuadTo(5.016, 7.796, 4.676, 8.295), + gfx.ClosePath(), + gfx.MoveTo(10.347, 28.823), + gfx.QuadTo(9.78, 28.574, 9.238, 28.276), + gfx.LineTo(9.397, 27.987), + gfx.QuadTo(9.926, 28.278, 10.479, 28.521), + gfx.ClosePath(), + gfx.MoveTo(2.512, 19.834), + gfx.QuadTo(2.343, 19.24, 2.227, 18.634), + gfx.LineTo(2.551, 18.572), + gfx.QuadTo(2.664, 19.164, 2.829, 19.744), + gfx.ClosePath(), + gfx.MoveTo(2.405, 12.552), + gfx.QuadTo(2.556, 11.954, 2.759, 11.372), + gfx.LineTo(3.071, 11.48), + gfx.QuadTo(2.873, 12.049, 2.725, 12.633), + gfx.ClosePath(), + gfx.MoveTo(22.219, 28.55), + gfx.QuadTo(21.667, 28.825, 21.093, 29.049), + gfx.LineTo(20.973, 28.742), + gfx.QuadTo(21.533, 28.523, 22.072, 28.255), + gfx.ClosePath(), + gfx.MoveTo(9.972, 3.335), + gfx.QuadTo(10.529, 3.07, 11.106, 2.856), + gfx.LineTo(11.221, 3.165), + gfx.QuadTo(10.657, 3.375, 10.114, 3.633), + gfx.ClosePath(), + gfx.MoveTo(17.544, 29.924), + gfx.QuadTo(16.932, 29.992, 16.316, 30.006), + gfx.LineTo(16.309, 29.676), + gfx.QuadTo(16.91, 29.662, 17.507, 29.596), + gfx.ClosePath(), + gfx.MoveTo(29.909, 14.314), + gfx.QuadTo(29.982, 14.925, 30.002, 15.54), + gfx.LineTo(29.672, 15.551), + gfx.QuadTo(29.653, 14.95, 29.581, 14.353), + gfx.ClosePath(), + gfx.MoveTo(17.137, 2.025), + gfx.QuadTo(17.75, 2.074, 18.356, 2.178), + gfx.LineTo(18.3, 2.503), + gfx.QuadTo(17.709, 2.402, 17.11, 2.353), + gfx.ClosePath(), + gfx.MoveTo(28.872, 21.522), + gfx.QuadTo(28.629, 22.087, 28.339, 22.629), + gfx.LineTo(28.048, 22.473), + gfx.QuadTo(28.332, 21.944, 28.568, 21.392), + gfx.ClosePath(), + gfx.MoveTo(29.987, 16.772), + gfx.QuadTo(29.952, 17.385, 29.864, 17.993), + gfx.LineTo(29.538, 17.946), + gfx.QuadTo(29.624, 17.352, 29.657, 16.754), + gfx.ClosePath(), + gfx.MoveTo(21.851, 3.259), + gfx.QuadTo(22.408, 3.516, 22.942, 3.821), + gfx.LineTo(22.778, 4.108), + gfx.QuadTo(22.257, 3.81, 21.713, 3.559), + gfx.ClosePath(), + gfx.MoveTo(12.279, 2.478), + gfx.QuadTo(12.871, 2.316, 13.476, 2.206), + gfx.LineTo(13.535, 2.531), + gfx.QuadTo(12.944, 2.638, 12.366, 2.797), + gfx.ClosePath(), + gfx.MoveTo(26.201, 25.599), + gfx.QuadTo(25.781, 26.045, 25.322, 26.454), + gfx.LineTo(25.102, 26.207), + gfx.QuadTo(25.551, 25.808, 25.961, 25.372), + gfx.ClosePath(), + gfx.MoveTo(12.672, 29.61), + gfx.QuadTo(12.075, 29.464, 11.494, 29.268), + gfx.LineTo(11.599, 28.955), + gfx.QuadTo(12.167, 29.147, 12.75, 29.289), + gfx.ClosePath(), + gfx.MoveTo(2.049, 17.418), + gfx.QuadTo(1.987, 16.808, 1.979, 16.195), + gfx.LineTo(2.309, 16.19), + gfx.QuadTo(2.317, 16.789, 2.378, 17.385), + gfx.ClosePath(), + gfx.MoveTo(2.015, 14.971), + gfx.QuadTo(2.059, 14.359, 2.157, 13.754), + gfx.LineTo(2.483, 13.807), + gfx.QuadTo(2.388, 14.398, 2.344, 14.995), + gfx.ClosePath(), + gfx.MoveTo(15.09, 29.98), + gfx.QuadTo(14.479, 29.94, 13.873, 29.847), + gfx.LineTo(13.923, 29.521), + gfx.QuadTo(14.514, 29.612, 15.111, 29.65), + gfx.ClosePath(), + gfx.MoveTo(14.689, 2.039), + gfx.QuadTo(15.299, 1.982, 15.912, 1.979), + gfx.LineTo(15.914, 2.309), + gfx.QuadTo(15.316, 2.312, 14.72, 2.368), + gfx.ClosePath(), + gfx.MoveTo(29.636, 19.197), + gfx.QuadTo(29.496, 19.793, 29.305, 20.375), + gfx.LineTo(28.991, 20.272), + gfx.QuadTo(29.178, 19.704, 29.315, 19.121), + gfx.ClosePath(), + gfx.MoveTo(29.409, 11.936), + gfx.QuadTo(29.587, 12.521, 29.712, 13.12), + gfx.LineTo(29.389, 13.187), + gfx.QuadTo(29.267, 12.603, 29.093, 12.032), + gfx.ClosePath(), + gfx.MoveTo(7.878, 4.565), + gfx.QuadTo(8.376, 4.21, 8.903, 3.901), + gfx.LineTo(9.07, 4.186), + gfx.QuadTo(8.555, 4.488, 8.069, 4.834), + gfx.ClosePath(), + gfx.MoveTo(27.708, 23.69), + gfx.QuadTo(27.373, 24.2, 26.994, 24.679), + gfx.LineTo(26.735, 24.475), + gfx.QuadTo(27.105, 24.007, 27.432, 23.509), + gfx.ClosePath(), + gfx.MoveTo(19.562, 2.439), + gfx.QuadTo(20.153, 2.594, 20.727, 2.8), + gfx.LineTo(20.615, 3.11), + gfx.QuadTo(20.055, 2.909, 19.478, 2.758), + gfx.ClosePath(), + gfx.MoveTo(8.204, 27.648), + gfx.QuadTo(7.697, 27.309, 7.221, 26.927), + gfx.LineTo(7.428, 26.67), + gfx.QuadTo(7.892, 27.043, 8.387, 27.373), + gfx.ClosePath(), + gfx.MoveTo(3.379, 22.107), + gfx.QuadTo(3.113, 21.56, 2.897, 20.993), + gfx.LineTo(3.205, 20.875), + gfx.QuadTo(3.417, 21.429, 3.675, 21.963), + gfx.ClosePath(), + gfx.MoveTo(19.941, 29.443), + gfx.QuadTo(19.359, 29.614, 18.765, 29.734), + gfx.LineTo(18.7, 29.41), + gfx.QuadTo(19.28, 29.293, 19.848, 29.127), + gfx.ClosePath(), + gfx.MoveTo(3.215, 10.23), + gfx.QuadTo(3.464, 9.678, 3.76, 9.149), + gfx.LineTo(4.048, 9.31), + gfx.QuadTo(3.759, 9.826, 3.516, 10.366), + gfx.ClosePath(), + gfx.MoveTo(23.993, 4.486), + gfx.QuadTo(24.313, 4.709, 24.622, 4.95), + gfx.LineTo(24.418, 5.21), + gfx.QuadTo(24.117, 4.975, 23.805, 4.757), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.0, Green: 0.0, Blue: 0.501961, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(5.29, 16.0), + gfx.CubicTo(5.29, 19.8263, 7.33131, 23.362, 10.645, 25.2751), + gfx.CubicTo(13.9587, 27.1883, 18.0413, 27.1883, 21.355, 25.2751), + gfx.CubicTo(24.6687, 23.362, 26.71, 19.8263, 26.71, 16.0), + gfx.CubicTo(26.71, 12.1737, 24.6687, 8.63803, 21.355, 6.72487), + gfx.CubicTo(18.0413, 4.81171, 13.9587, 4.81171, 10.645, 6.72487), + gfx.CubicTo(7.33131, 8.63803, 5.29, 12.1737, 5.29, 16.0), + gfx.MoveTo(23.57, 5.29), + gfx.CubicTo(23.57, 6.41181, 24.1685, 7.44841, 25.14, 8.00932), + gfx.CubicTo(26.1115, 8.57023, 27.3085, 8.57023, 28.28, 8.00932), + gfx.CubicTo(29.2515, 7.44841, 29.85, 6.41181, 29.85, 5.29), + gfx.CubicTo(29.85, 4.16819, 29.2515, 3.13159, 28.28, 2.57068), + gfx.CubicTo(27.3085, 2.00977, 26.1115, 2.00977, 25.14, 2.57068), + gfx.CubicTo(24.1685, 3.13159, 23.57, 4.16819, 23.57, 5.29), + }}, + {Fill: gfx.Color{Red: 1.0, Green: 1.0, Blue: 1.0, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(17.29, 11.56), + gfx.CubicTo(17.29, 12.6818, 17.8885, 13.7184, 18.86, 14.2793), + gfx.CubicTo(19.8315, 14.8402, 21.0285, 14.8402, 22.0, 14.2793), + gfx.CubicTo(22.9715, 13.7184, 23.57, 12.6818, 23.57, 11.56), + gfx.CubicTo(23.57, 10.4382, 22.9715, 9.40159, 22.0, 8.84068), + gfx.CubicTo(21.0285, 8.27977, 19.8315, 8.27977, 18.86, 8.84068), + gfx.CubicTo(17.8885, 9.40159, 17.29, 10.4382, 17.29, 11.56), + gfx.MoveTo(13.1, 21.35), + gfx.LineTo(13.1, 20.56), + gfx.LineTo(9.63, 20.56), + gfx.LineTo(9.63, 14.33), + gfx.LineTo(8.73, 14.33), + gfx.LineTo(8.73, 21.35), + gfx.ClosePath(), + gfx.MoveTo(17.92, 21.35), + gfx.LineTo(17.92, 16.3), + gfx.LineTo(17.12, 16.3), + gfx.LineTo(17.12, 19.09), + gfx.CubicTo(17.12, 20.12, 16.58, 20.79, 15.74, 20.79), + gfx.CubicTo(15.4657, 20.8164, 15.1935, 20.7224, 14.994, 20.5325), + gfx.CubicTo(14.7944, 20.3425, 14.6871, 20.0752, 14.7, 19.8), + gfx.LineTo(14.7, 16.3), + gfx.LineTo(13.9, 16.3), + gfx.LineTo(13.9, 20.12), + gfx.CubicTo(13.9, 20.95, 14.53, 21.49, 15.5, 21.49), + gfx.CubicTo(16.192, 21.516, 16.8433, 21.1635, 17.2, 20.57), + gfx.LineTo(17.2, 21.35), + gfx.ClosePath(), + gfx.MoveTo(23.8, 21.33), + gfx.LineTo(23.8, 20.73), + gfx.LineTo(23.62, 20.74), + gfx.QuadTo(23.19, 20.74, 23.18, 20.34), + gfx.LineTo(23.18, 17.54), + gfx.QuadTo(23.17, 16.17, 21.28, 16.16), + gfx.CubicTo(20.06, 16.16, 19.31, 16.63, 19.26, 17.8), + gfx.LineTo(20.07, 17.8), + gfx.CubicTo(20.14, 17.18, 20.5, 16.9, 21.26, 16.9), + gfx.QuadTo(22.36, 16.92, 22.38, 17.65), + gfx.LineTo(22.38, 17.86), + gfx.CubicTo(22.38, 18.2, 22.18, 18.34, 21.55, 18.42), + gfx.CubicTo(20.9988, 18.445, 20.4536, 18.546, 19.93, 18.72), + gfx.CubicTo(19.3631, 18.902, 18.9923, 19.4458, 19.03, 20.04), + gfx.CubicTo(19.03, 20.95, 19.67, 21.49, 20.7, 21.49), + gfx.CubicTo(21.3464, 21.4837, 21.9629, 21.2169, 22.41, 20.75), + gfx.CubicTo(22.498, 21.1387, 22.8415, 21.4159, 23.24, 21.42), + gfx.CubicTo(23.4271, 21.4126, 23.6123, 21.3789, 23.79, 21.32), + gfx.MoveTo(22.39, 19.6), + gfx.CubicTo(22.2963, 20.3469, 21.6175, 20.8783, 20.87, 20.79), + gfx.CubicTo(20.24, 20.79, 19.87, 20.57, 19.87, 20.02), + gfx.CubicTo(19.87, 19.49, 20.23, 19.26, 21.09, 19.13), + gfx.CubicTo(21.5359, 19.1099, 21.9753, 19.0152, 22.39, 18.85), + gfx.ClosePath(), + }}, + }, +} + // makefile is a compiled vector icon. var Makefile = gfx.Icon{ ViewBox: 16.0, @@ -5476,6 +5935,180 @@ var PropertiesDark = gfx.Icon{ }, } +// protoFile is a compiled vector icon. +var ProtoFile = gfx.Icon{ + ViewBox: 16.0, + Stroke: 2.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Layers: []gfx.IconLayer{ + {Fill: gfx.Color{Red: 0.929412, Green: 0.952941, Blue: 1.0, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(11.0, 2.0), + gfx.CubicTo(11.552, 2.0, 12.0, 2.448, 12.0, 3.0), + gfx.LineTo(12.0, 9.0), + gfx.LineTo(11.0, 9.0), + gfx.CubicTo(10.448, 9.0, 10.0, 9.448, 10.0, 10.0), + gfx.LineTo(10.0, 14.0), + gfx.LineTo(5.0, 14.0), + gfx.CubicTo(4.448, 14.0, 4.0, 13.552, 4.0, 13.0), + gfx.LineTo(4.0, 6.0), + gfx.LineTo(6.0, 6.0), + gfx.CubicTo(7.105, 6.0, 8.0, 5.105, 8.0, 4.0), + gfx.LineTo(8.0, 2.0), + gfx.LineTo(11.0, 2.0), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.929412, Green: 0.952941, Blue: 1.0, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(7.0, 4.0), + gfx.CubicTo(7.0, 4.069, 6.993, 4.136, 6.979, 4.201), + gfx.CubicTo(6.886, 4.657, 6.483, 5.0, 6.0, 5.0), + gfx.LineTo(4.414, 5.0), + gfx.LineTo(7.0, 2.414), + gfx.LineTo(7.0, 4.0), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.207843, Green: 0.454902, Blue: 0.941176, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(11.0, 1.0), + gfx.CubicTo(12.105, 1.0, 13.0, 1.895, 13.0, 3.0), + gfx.LineTo(13.0, 9.0), + gfx.LineTo(12.0, 9.0), + gfx.LineTo(12.0, 3.0), + gfx.CubicTo(12.0, 2.448, 11.552, 2.0, 11.0, 2.0), + gfx.LineTo(8.0, 2.0), + gfx.LineTo(8.0, 4.0), + gfx.CubicTo(8.0, 5.105, 7.105, 6.0, 6.0, 6.0), + gfx.LineTo(4.0, 6.0), + gfx.LineTo(4.0, 13.0), + gfx.CubicTo(4.0, 13.552, 4.448, 14.0, 5.0, 14.0), + gfx.LineTo(10.0, 14.0), + gfx.LineTo(10.0, 15.0), + gfx.LineTo(5.0, 15.0), + gfx.CubicTo(3.895, 15.0, 3.0, 14.105, 3.0, 13.0), + gfx.LineTo(3.0, 5.414), + gfx.CubicTo(3.0, 5.149, 3.105, 4.895, 3.293, 4.707), + gfx.LineTo(6.707, 1.293), + gfx.CubicTo(6.895, 1.105, 7.149, 1.0, 7.414, 1.0), + gfx.ClosePath(), + gfx.MoveTo(4.414, 5.0), + gfx.LineTo(6.0, 5.0), + gfx.CubicTo(6.552, 5.0, 7.0, 4.552, 7.0, 4.0), + gfx.LineTo(7.0, 2.414), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.423529, Green: 0.439216, Blue: 0.494118, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(11.09, 16.0), + gfx.LineTo(11.09, 10.014), + gfx.LineTo(13.082, 10.014), + gfx.CubicTo(13.482, 10.014, 13.829, 10.091, 14.124, 10.244), + gfx.CubicTo(14.425, 10.397, 14.657, 10.613, 14.821, 10.891), + gfx.CubicTo(14.985, 11.165, 15.067, 11.487, 15.067, 11.859), + gfx.CubicTo(15.067, 12.225, 14.982, 12.548, 14.813, 12.827), + gfx.CubicTo(14.649, 13.105, 14.419, 13.321, 14.124, 13.474), + gfx.CubicTo(13.829, 13.627, 13.482, 13.704, 13.082, 13.704), + gfx.LineTo(12.115, 13.704), + gfx.LineTo(12.115, 16.0), + gfx.LineTo(11.09, 16.0), + gfx.ClosePath(), + gfx.MoveTo(12.115, 12.777), + gfx.LineTo(13.082, 12.777), + gfx.CubicTo(13.367, 12.777, 13.594, 12.695, 13.763, 12.531), + gfx.CubicTo(13.938, 12.362, 14.025, 12.138, 14.025, 11.859), + gfx.CubicTo(14.025, 11.575, 13.938, 11.351, 13.763, 11.187), + gfx.CubicTo(13.594, 11.023, 13.367, 10.941, 13.082, 10.941), + gfx.LineTo(12.115, 10.941), + gfx.LineTo(12.115, 12.777), + gfx.ClosePath(), + }}, + }, +} + +// protoFile-dark is a compiled vector icon. +var ProtoFileDark = gfx.Icon{ + ViewBox: 16.0, + Stroke: 2.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Layers: []gfx.IconLayer{ + {Fill: gfx.Color{Red: 0.145098, Green: 0.196078, Blue: 0.301961, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(11.0, 2.0), + gfx.CubicTo(11.552, 2.0, 12.0, 2.448, 12.0, 3.0), + gfx.LineTo(12.0, 9.0), + gfx.LineTo(11.0, 9.0), + gfx.CubicTo(10.448, 9.0, 10.0, 9.448, 10.0, 10.0), + gfx.LineTo(10.0, 14.0), + gfx.LineTo(5.0, 14.0), + gfx.CubicTo(4.448, 14.0, 4.0, 13.552, 4.0, 13.0), + gfx.LineTo(4.0, 6.0), + gfx.LineTo(6.0, 6.0), + gfx.CubicTo(7.105, 6.0, 8.0, 5.105, 8.0, 4.0), + gfx.LineTo(8.0, 2.0), + gfx.LineTo(11.0, 2.0), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.145098, Green: 0.196078, Blue: 0.301961, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(7.0, 4.0), + gfx.CubicTo(7.0, 4.069, 6.993, 4.136, 6.979, 4.201), + gfx.CubicTo(6.886, 4.657, 6.483, 5.0, 6.0, 5.0), + gfx.LineTo(4.414, 5.0), + gfx.LineTo(7.0, 2.414), + gfx.LineTo(7.0, 4.0), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.329412, Green: 0.541176, Blue: 0.968627, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(11.0, 1.0), + gfx.CubicTo(12.105, 1.0, 13.0, 1.895, 13.0, 3.0), + gfx.LineTo(13.0, 9.0), + gfx.LineTo(12.0, 9.0), + gfx.LineTo(12.0, 3.0), + gfx.CubicTo(12.0, 2.448, 11.552, 2.0, 11.0, 2.0), + gfx.LineTo(8.0, 2.0), + gfx.LineTo(8.0, 4.0), + gfx.CubicTo(8.0, 5.105, 7.105, 6.0, 6.0, 6.0), + gfx.LineTo(4.0, 6.0), + gfx.LineTo(4.0, 13.0), + gfx.CubicTo(4.0, 13.552, 4.448, 14.0, 5.0, 14.0), + gfx.LineTo(10.0, 14.0), + gfx.LineTo(10.0, 15.0), + gfx.LineTo(5.0, 15.0), + gfx.CubicTo(3.895, 15.0, 3.0, 14.105, 3.0, 13.0), + gfx.LineTo(3.0, 5.414), + gfx.CubicTo(3.0, 5.149, 3.105, 4.895, 3.293, 4.707), + gfx.LineTo(6.707, 1.293), + gfx.CubicTo(6.895, 1.105, 7.149, 1.0, 7.414, 1.0), + gfx.ClosePath(), + gfx.MoveTo(4.414, 5.0), + gfx.LineTo(6.0, 5.0), + gfx.CubicTo(6.552, 5.0, 7.0, 4.552, 7.0, 4.0), + gfx.LineTo(7.0, 2.414), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.807843, Green: 0.815686, Blue: 0.839216, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(11.09, 16.0), + gfx.LineTo(11.09, 10.014), + gfx.LineTo(13.082, 10.014), + gfx.CubicTo(13.482, 10.014, 13.829, 10.091, 14.124, 10.244), + gfx.CubicTo(14.425, 10.397, 14.657, 10.613, 14.821, 10.891), + gfx.CubicTo(14.985, 11.165, 15.067, 11.487, 15.067, 11.859), + gfx.CubicTo(15.067, 12.225, 14.982, 12.548, 14.813, 12.827), + gfx.CubicTo(14.649, 13.105, 14.419, 13.321, 14.124, 13.474), + gfx.CubicTo(13.829, 13.627, 13.482, 13.704, 13.082, 13.704), + gfx.LineTo(12.115, 13.704), + gfx.LineTo(12.115, 16.0), + gfx.LineTo(11.09, 16.0), + gfx.ClosePath(), + gfx.MoveTo(12.115, 12.777), + gfx.LineTo(13.082, 12.777), + gfx.CubicTo(13.367, 12.777, 13.594, 12.695, 13.763, 12.531), + gfx.CubicTo(13.938, 12.362, 14.025, 12.138, 14.025, 11.859), + gfx.CubicTo(14.025, 11.575, 13.938, 11.351, 13.763, 11.187), + gfx.CubicTo(13.594, 11.023, 13.367, 10.941, 13.082, 10.941), + gfx.LineTo(12.115, 10.941), + gfx.LineTo(12.115, 12.777), + gfx.ClosePath(), + }}, + }, +} + // python is a compiled vector icon. var Python = gfx.Icon{ ViewBox: 16.0, @@ -7787,3 +8420,98 @@ var YamlDark = gfx.Icon{ }}, }, } + +// zig is a compiled vector icon. +var Zig = gfx.Icon{ + ViewBox: 16.0, + Stroke: 2.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Layers: []gfx.IconLayer{ + {Fill: gfx.Color{Red: 0.968627, Green: 0.643137, Blue: 0.113725, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(5.209, 3.608), + gfx.LineTo(3.562, 5.621), + gfx.LineTo(2.739, 4.34), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.968627, Green: 0.643137, Blue: 0.113725, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(5.209, 3.608), + gfx.LineTo(4.019, 4.615), + gfx.LineTo(3.562, 5.621), + gfx.LineTo(3.013, 5.621), + gfx.LineTo(3.013, 10.288), + gfx.LineTo(3.836, 10.288), + gfx.LineTo(2.83, 10.745), + gfx.LineTo(2.098, 12.3), + gfx.LineTo(1.0, 12.3), + gfx.LineTo(1.0, 3.608), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.968627, Green: 0.643137, Blue: 0.113725, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(3.836, 10.288), + gfx.LineTo(2.098, 12.3), + gfx.LineTo(1.366, 11.294), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.968627, Green: 0.643137, Blue: 0.113725, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(6.124, 3.608), + gfx.LineTo(6.673, 4.889), + gfx.LineTo(4.385, 5.621), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.968627, Green: 0.643137, Blue: 0.113725, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(6.124, 3.608), + gfx.LineTo(11.156, 3.608), + gfx.LineTo(11.156, 5.621), + gfx.LineTo(4.385, 5.621), + gfx.LineTo(6.124, 4.523), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.968627, Green: 0.643137, Blue: 0.113725, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(11.614, 10.288), + gfx.LineTo(9.875, 12.3), + gfx.LineTo(9.235, 11.111), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.968627, Green: 0.643137, Blue: 0.113725, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(11.614, 10.288), + gfx.LineTo(10.15, 11.111), + gfx.LineTo(9.875, 12.3), + gfx.LineTo(4.843, 12.3), + gfx.LineTo(4.843, 10.288), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.968627, Green: 0.643137, Blue: 0.113725, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(14.725, 1.595), + gfx.LineTo(5.758, 12.3), + gfx.LineTo(1.275, 14.405), + gfx.LineTo(10.241, 3.608), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.968627, Green: 0.643137, Blue: 0.113725, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(13.901, 3.608), + gfx.LineTo(13.81, 5.255), + gfx.LineTo(12.163, 5.712), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.968627, Green: 0.643137, Blue: 0.113725, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(15.0, 3.608), + gfx.LineTo(15.0, 12.3), + gfx.LineTo(10.699, 12.3), + gfx.LineTo(11.98, 11.203), + gfx.LineTo(12.438, 10.288), + gfx.LineTo(12.986, 10.288), + gfx.LineTo(12.986, 5.712), + gfx.LineTo(12.163, 5.712), + gfx.LineTo(13.078, 4.889), + gfx.LineTo(13.901, 3.608), + gfx.ClosePath(), + }}, + {Fill: gfx.Color{Red: 0.968627, Green: 0.643137, Blue: 0.113725, Alpha: 1.0}, Commands: []gfx.PathCommand{ + gfx.MoveTo(12.438, 10.288), + gfx.LineTo(12.895, 11.66), + gfx.LineTo(10.699, 12.3), + gfx.ClosePath(), + }}, + }, +} diff --git a/desktop/internal/fileicons/icons_tree.go b/desktop/internal/fileicons/icons_tree.go index afdf5e2c4a..f2f5f387ef 100644 --- a/desktop/internal/fileicons/icons_tree.go +++ b/desktop/internal/fileicons/icons_tree.go @@ -4,7 +4,7 @@ // Most SVGs in svg/ are the file-tree icons the previous Lithe macOS client shipped in // macos/Resources/IDEAIcons/, restored byte for byte from commit f1e8d8139^ of this // repository; the Build tool window icons listed last were copied byte for byte from the -// upstream repository. Except for the two noted below, they come from the JetBrains IntelliJ +// upstream repository. Except for the icons noted below, they come from the JetBrains IntelliJ // Platform Community repository (https://github.com/JetBrains/intellij-community) and are // distributed under the Apache License 2.0; see LICENSE-APACHE-2.0.txt. The previous // client's NOTICE.txt records the source paths and revisions of the restored icons, chiefly: @@ -43,14 +43,43 @@ // because the Community set has no LICENSE or Makefile glyph; they follow the Lithe // repository license. // +// The icons of the languages whose grammars the editor bundles but the Community set has no +// glyph for were copied from these sources: +// +// - graphql.svg and graphql_dark.svg: platform/icons/src/expui/fileTypes/ of the IntelliJ +// Community repository (revision 54d2b2d53eeea48df651d4242122370c391d4973), byte for byte, +// under the Apache License 2.0. +// - protoFile.svg and protoFile_dark.svg: protobuf/protoeditor-core/resources/icons/newui/ of +// the JetBrains intellij-plugins repository (https://github.com/JetBrains/intellij-plugins, +// revision 6dfd13ea5346f031c617c558bb6f48381731ddb3), byte for byte, under the Apache License +// 2.0; see LICENSE-APACHE-2.0.txt. +// - lua.svg: icons/file_type_lua.svg of vscode-icons (https://github.com/vscode-icons/vscode-icons, +// revision 814aab8318900f47efeae6f1c4691494ae764199), with its named colors gray and navy +// written as #808080 and #000080, because the icon compiler reads only numeric colors. It draws +// the official Lua logo, Copyright (c) 1998 Lua.org, graphic design by Alexandre Nakonechnyj, +// which may be used unchanged at any scale under the terms in LICENSE-lua-logo.txt; +// vscode-icons distributes its icons under CC BY-SA 4.0 +// (https://creativecommons.org/licenses/by-sa/4.0/). +// - zig.svg: adapted from zig-mark.svg of the official Zig logo repository +// (https://github.com/ziglang/logo, revision 4f97e7a9ebce12fa48511c0b6502b6190005bc0e), the +// logomark that the Zig extension for Visual Studio Code also shows, licensed under CC BY-SA +// 4.0 (https://creativecommons.org/licenses/by-sa/4.0/). The same polygons were placed in a +// 16x16 view box and their shape-rendering hints dropped; the adaptation is under CC BY-SA 4.0. +// - cmake.svg: adapted from res/logo.svg of CMake Tools for Visual Studio Code +// (https://github.com/microsoft/vscode-cmake-tools, revision +// c757bfc851ca01d18601b64178ea40190e72d5d1), MIT, Copyright (c) 2018 vector-of-bool; see +// LICENSE-MIT-vscode-cmake-tools.txt. Only the four triangles of the CMake mark were kept, +// without the CMake Tools wrench, and placed in a 16x16 view box. +// // Copyright JetBrains s.r.o. and contributors. Lithe does not include JetBrains product // logos. // // Modification: icons.go is not the SVGs themselves. scripts/desktop/generate-desktop-file-icons.sh // rewrites each SVG into filled paths only (its strokes become outlines of the same color) -// with picosvg and compiles the result into gfx.Icon values. The SVG sources in svg/ are -// unmodified. The generator changes underscores in SVG filenames to hyphens when deriving Go -// names, so db_set_breakpoint.svg is exposed as DbSetBreakpoint. +// with picosvg and compiles the result into gfx.Icon values. Apart from lua.svg, zig.svg and +// cmake.svg, changed as described above, the SVG sources in svg/ are unmodified. The generator changes +// underscores in SVG filenames to hyphens when deriving Go names, so db_set_breakpoint.svg is +// exposed as DbSetBreakpoint. package fileicons diff --git a/desktop/internal/fileicons/svg/cmake.svg b/desktop/internal/fileicons/svg/cmake.svg new file mode 100644 index 0000000000..b4b8ed9340 --- /dev/null +++ b/desktop/internal/fileicons/svg/cmake.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/desktop/internal/fileicons/svg/graphql.svg b/desktop/internal/fileicons/svg/graphql.svg new file mode 100644 index 0000000000..d4dd36ac36 --- /dev/null +++ b/desktop/internal/fileicons/svg/graphql.svg @@ -0,0 +1,4 @@ + + + + diff --git a/desktop/internal/fileicons/svg/graphql_dark.svg b/desktop/internal/fileicons/svg/graphql_dark.svg new file mode 100644 index 0000000000..a0095957db --- /dev/null +++ b/desktop/internal/fileicons/svg/graphql_dark.svg @@ -0,0 +1,4 @@ + + + + diff --git a/desktop/internal/fileicons/svg/lua.svg b/desktop/internal/fileicons/svg/lua.svg new file mode 100644 index 0000000000..e9e079b58f --- /dev/null +++ b/desktop/internal/fileicons/svg/lua.svg @@ -0,0 +1,2 @@ + + diff --git a/desktop/internal/fileicons/svg/protoFile.svg b/desktop/internal/fileicons/svg/protoFile.svg new file mode 100644 index 0000000000..029143753b --- /dev/null +++ b/desktop/internal/fileicons/svg/protoFile.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/desktop/internal/fileicons/svg/protoFile_dark.svg b/desktop/internal/fileicons/svg/protoFile_dark.svg new file mode 100644 index 0000000000..6f8d450eb1 --- /dev/null +++ b/desktop/internal/fileicons/svg/protoFile_dark.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/desktop/internal/fileicons/svg/zig.svg b/desktop/internal/fileicons/svg/zig.svg new file mode 100644 index 0000000000..9324b94533 --- /dev/null +++ b/desktop/internal/fileicons/svg/zig.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/desktop/internal/workbench/bundled_grammars_visual_test.go b/desktop/internal/workbench/bundled_grammars_visual_test.go new file mode 100644 index 0000000000..a51003545b --- /dev/null +++ b/desktop/internal/workbench/bundled_grammars_visual_test.go @@ -0,0 +1,132 @@ +//go:build vivahead && lithevisual + +package workbench + +import ( + "image" + "image/color" + "image/draw" + "image/png" + "os" + "path/filepath" + "testing" + + "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/1lck/Lithe-IDEA/desktop/internal/store" + "github.com/vivaui/viva/app" + "github.com/vivaui/viva/headless" +) + +// bundledGrammarSamples are one short file of every language whose grammar the editor bundles +// for #2112, in the order the contact sheet lays them out. The first line names the language. +var bundledGrammarSamples = []struct{ name, source string }{ + {"order.py", "# Python\nfrom dataclasses import dataclass\n\n@dataclass\nclass Order(Base):\n price: int = 0\n\n def total(self, count: int) -> int:\n \"\"\"Price of count items.\"\"\"\n return self.price * count if count > 0 else None\n"}, + {"deploy.sh", "#!/usr/bin/env bash\n# Shell\nset -euo pipefail\nNAME=\"${1:-lithe}\"\nfor f in ./dist/*.tar.gz; do\n echo \"Uploading $f for $NAME\" | tee -a log.txt\ndone\n[[ -n \"$NAME\" ]] && exit 0\n"}, + {"Order.kt", "// Kotlin\npackage shop\n\ndata class Order(val name: String, val price: Int = 0) {\n fun total(count: Int): Int = price * count\n\n override fun toString() = \"Order $name: ${total(2)}\"\n}\n"}, + {"Greeter.groovy", "// Groovy\nclass Greeter extends Base {\n def pattern = /\\d+/\n\n String greet(String name) {\n def count = 3\n return \"Hello, ${name} x $count\"\n }\n}\n"}, + {"CMakeLists.txt", "# CMake\ncmake_minimum_required(VERSION 3.20)\nproject(Demo LANGUAGES CXX)\nset(CMAKE_CXX_STANDARD 20)\nadd_executable(demo src/main.cpp)\nif(WIN32)\n target_compile_definitions(demo PRIVATE USE_WIN=1)\nendif()\n"}, + {"Dockerfile", "# Dockerfile\nFROM golang:1.22 AS build\nWORKDIR /src\nCOPY . .\nRUN go build -o /out/app ./cmd/app\n\nFROM gcr.io/distroless/base\nENV PORT=8080\nEXPOSE 8080\nENTRYPOINT [\"/app\"]\n"}, + {"query.sql", "-- SQL\nCREATE TABLE orders (\n id INTEGER PRIMARY KEY,\n name VARCHAR(64) NOT NULL,\n price DECIMAL(10, 2) DEFAULT 0\n);\nSELECT name, COUNT(*) AS total\nFROM orders WHERE price > 10.5\nGROUP BY name ORDER BY total DESC;\n"}, + {"index.php", "\n
    \n\n
  • name ?>\"> &
  • \n\n
\n Int {\n return price * count\n }\n}\n"}, + {"Order.cs", "// C#\nusing System;\n\npublic class Order : Base\n{\n public string Name { get; init; } = \"\";\n public int Total(int count) => count > 0 ? Price * count : 0;\n public override string ToString() => $\"Order {Name}\";\n}\n"}, + {"order.lua", "-- Lua\nlocal Order = {}\nOrder.__index = Order\n\nfunction Order.new(name, price)\n local self = setmetatable({}, Order)\n self.name, self.price = name, price or 0\n return self\nend\n"}, + {"deploy.ps1", "# PowerShell\nparam([string]$Name = \"lithe\")\n$files = Get-ChildItem -Path ./dist -Filter *.zip\nforeach ($f in $files) {\n if ($f.Length -gt 0 -and $true) {\n Write-Host \"Uploading $($f.Name) for $Name\"\n }\n}\n"}, + {"main.zig", "// Zig\nconst std = @import(\"std\");\n\npub fn main() !void {\n const stdout = std.io.getStdOut().writer();\n var total: u32 = 0;\n for (0..10) |i| total += @intCast(i);\n try stdout.print(\"total: {d}\\n\", .{total});\n}\n"}, + {"order.proto", "// Protobuf\nsyntax = \"proto3\";\npackage shop;\n\nmessage Order {\n string name = 1;\n int32 price = 2;\n repeated string tags = 3;\n}\n\nservice Orders { rpc Get(Order) returns (Order); }\n"}, + {"Order.m", "// Objective-C\n#import \n\n@interface Order : NSObject\n@property (nonatomic, copy) NSString *name;\n@end\n\n@implementation Order\n- (NSInteger)total:(NSInteger)count { return count * 2; }\n@end\n"}, + {"Bridge.mm", "// Objective-C++\n#import \n#include \n\n@implementation Bridge\n- (NSUInteger)count {\n std::vector items{1, 2, 3};\n return static_cast(items.size());\n}\n@end\n"}, + {"Makefile", "# Makefile\nGO ?= go\nBIN := bin/app\n\n.PHONY: build test\nbuild: $(BIN)\n$(BIN): $(wildcard *.go)\n\t$(GO) build -o $@ ./cmd/app\ntest:\n\t$(GO) test ./... -count=1\n"}, + {"schema.graphql", "# GraphQL\ntype Order {\n id: ID!\n name: String!\n price: Int @deprecated(reason: \"Use total\")\n}\n\nquery Orders($first: Int = 10) {\n orders(first: $first) { id name }\n}\n"}, +} + +// TestVisualBundledGrammars captures each sample of bundledGrammarSamples in the editor and lays +// the top left of the editors out in one contact sheet per theme, grammars-.png, beside +// the whole window of the PHP sample, grammars-php-.png. The same test on a revision +// without the grammars shows what they change. It needs only LITHE_VISUAL_OUTPUT_DIR. +func TestVisualBundledGrammars(t *testing.T) { + out := os.Getenv("LITHE_VISUAL_OUTPUT_DIR") + if out == "" { + t.Skip("set LITHE_VISUAL_OUTPUT_DIR") + } + if err := os.MkdirAll(out, 0755); err != nil { + t.Fatal(err) + } + const width, height = 1440, 900 + // A tile is the editor's top left, in points: the gutter and the longest sample line, and + // the most lines a sample has. + const tileWidth, tileHeight, columns, gap = 600, 290, 4, 2 + for _, look := range []struct{ theme, language string }{{"dark", "zh-Hans"}, {"light", "en"}} { + t.Run(look.theme, func(t *testing.T) { + prefs := store.At(t.TempDir()) + if err := prefs.Save(settingsFile, settings{Theme: themeChoice(look.theme), Language: look.language, DisableAutoSave: true}); err != nil { + t.Fatal(err) + } + root := filepath.Join(t.TempDir(), "GrammarsDemo") + if err := os.MkdirAll(root, 0700); err != nil { + t.Fatal(err) + } + for _, sample := range bundledGrammarSamples { + if err := os.WriteFile(filepath.Join(root, sample.name), []byte(sample.source), 0600); err != nil { + t.Fatal(err) + } + } + var session *headless.Session + h := newHarnessWithDriver(t, Options{Kernel: &testKernel{Client: core.NewClient()}, Store: prefs, Languages: []string{look.language}}, func(config app.Config) (*app.Driver, func(), error) { + config.Width, config.Height = width, height + var err error + session, err = headless.Open(config, nil, headless.Options{}) + if err != nil { + return nil, nil, err + } + return session.Driver(), session.Close, nil + }) + h.open(root) + p := h.app.project + var sheet *image.RGBA + for index, sample := range bundledGrammarSamples { + path := filepath.Join(root, sample.name) + h.app.openFile(p, path) + h.settleChain() + d := p.docs.byPath(path) + if d == nil { + t.Fatalf("%s did not open", sample.name) + } + h.app.invalidator.Invalidate() + h.settleChain() + frame, err := session.Image() + if err != nil { + t.Fatal(err) + } + scale := float64(frame.Bounds().Dx()) / width + editor := h.topHit(d.hit) + px := func(points float64) int { return int(points*scale + 0.5) } + tile := image.Rect(px(float64(editor.X)), px(float64(editor.Y)), px(float64(editor.X)+tileWidth), px(float64(editor.Y)+tileHeight)) + if !tile.In(frame.Bounds()) { + t.Fatalf("%s: the editor at %v is smaller than a tile", sample.name, editor) + } + if sheet == nil { + rows := (len(bundledGrammarSamples) + columns - 1) / columns + sheet = image.NewRGBA(image.Rect(0, 0, columns*tile.Dx()+(columns-1)*px(gap), rows*tile.Dy()+(rows-1)*px(gap))) + draw.Draw(sheet, sheet.Bounds(), image.NewUniform(color.Gray{Y: 0x80}), image.Point{}, draw.Src) + } + at := image.Pt(index%columns*(tile.Dx()+px(gap)), index/columns*(tile.Dy()+px(gap))) + draw.Draw(sheet, image.Rectangle{Min: at, Max: at.Add(tile.Size())}, frame, tile.Min, draw.Src) + if sample.name == "index.php" { + if err := session.Screenshot(filepath.Join(out, "grammars-php-"+look.theme+".png")); err != nil { + t.Fatal(err) + } + } + } + file, err := os.Create(filepath.Join(out, "grammars-"+look.theme+".png")) + if err != nil { + t.Fatal(err) + } + defer file.Close() + if err := png.Encode(file, sheet); err != nil { + t.Fatal(err) + } + }) + } +} diff --git a/docs/assets/bundled-grammars/after/grammars-dark.png b/docs/assets/bundled-grammars/after/grammars-dark.png new file mode 100644 index 0000000000..d2f7ea2ef5 Binary files /dev/null and b/docs/assets/bundled-grammars/after/grammars-dark.png differ diff --git a/docs/assets/bundled-grammars/after/grammars-light.png b/docs/assets/bundled-grammars/after/grammars-light.png new file mode 100644 index 0000000000..b4d41673c6 Binary files /dev/null and b/docs/assets/bundled-grammars/after/grammars-light.png differ diff --git a/docs/assets/bundled-grammars/after/grammars-php-dark.png b/docs/assets/bundled-grammars/after/grammars-php-dark.png new file mode 100644 index 0000000000..9a4dee3d5a Binary files /dev/null and b/docs/assets/bundled-grammars/after/grammars-php-dark.png differ diff --git a/docs/assets/bundled-grammars/after/grammars-php-light.png b/docs/assets/bundled-grammars/after/grammars-php-light.png new file mode 100644 index 0000000000..4723ce3afc Binary files /dev/null and b/docs/assets/bundled-grammars/after/grammars-php-light.png differ diff --git a/docs/assets/bundled-grammars/before/grammars-dark.png b/docs/assets/bundled-grammars/before/grammars-dark.png new file mode 100644 index 0000000000..c690a88008 Binary files /dev/null and b/docs/assets/bundled-grammars/before/grammars-dark.png differ diff --git a/docs/assets/bundled-grammars/before/grammars-light.png b/docs/assets/bundled-grammars/before/grammars-light.png new file mode 100644 index 0000000000..eeebb9dcc8 Binary files /dev/null and b/docs/assets/bundled-grammars/before/grammars-light.png differ diff --git a/docs/assets/bundled-grammars/before/grammars-php-dark.png b/docs/assets/bundled-grammars/before/grammars-php-dark.png new file mode 100644 index 0000000000..7fb2e55cd2 Binary files /dev/null and b/docs/assets/bundled-grammars/before/grammars-php-dark.png differ diff --git a/docs/assets/bundled-grammars/before/grammars-php-light.png b/docs/assets/bundled-grammars/before/grammars-php-light.png new file mode 100644 index 0000000000..8a43ae88cf Binary files /dev/null and b/docs/assets/bundled-grammars/before/grammars-php-light.png differ diff --git a/scripts/desktop/build-desktop-core.sh b/scripts/desktop/build-desktop-core.sh index 1601377545..ef20502b79 100755 --- a/scripts/desktop/build-desktop-core.sh +++ b/scripts/desktop/build-desktop-core.sh @@ -27,6 +27,10 @@ native_path() { fi } +# Lithe-core-rust main at 885f2a6, #83 squash-merged (the same tree as its branch at d10ee76, on +# top of cf2f260): a plugin's TextMate grammar may declare injections, an object of scope selectors +# each with a rule, which the editor tries beside the current rule's patterns wherever the selector +# matches, as vscode-textmate does for a root grammar (#2112). # Lithe-core-rust main at cf2f260, #82 squash-merged (the same tree as its branch at 4d0dc1c, on # top of 18a370d): lsp.problems.query also lays out the Problems tool window's tree (the rows # visible under the group nodes the desktop closes, the diagnostic each row previews and opens, a @@ -195,7 +199,7 @@ PINNED_CORE_REPOSITORY="https://github.com/Lithe-IDEA/Lithe-core-rust.git" # the contract, plugin guides, reference and SDKs live only in shared/plugins; on top of #16 (reported Git queries folded in the console), # #15 (git.write cherryPick, revert and reset fields), #14 (word-level changed ranges of diff # rows), #13, #8, #7, #6 and #4. -PINNED_CORE_REVISION="cf2f26095bb352f69d248f840dd7d6126747482e" +PINNED_CORE_REVISION="885f2a6958a9e475c88c5fb39d48068f41b08ae1" PROFILE="debug" while [[ $# -gt 0 ]]; do case "$1" in diff --git a/shared/platform-feature-matrix/features/editor-language-basics.json b/shared/platform-feature-matrix/features/editor-language-basics.json index 47f667389d..793caaaad1 100644 --- a/shared/platform-feature-matrix/features/editor-language-basics.json +++ b/shared/platform-feature-matrix/features/editor-language-basics.json @@ -2,14 +2,17 @@ "id": "editor-language-basics", "area": "编辑器", "group": "文本编辑", - "capability": "语法高亮与编辑器模型、关闭或切换模型后丢弃过期符号高亮回调;基础构建和脚本语法及常见文件关联", + "capability": "语法高亮与编辑器模型、关闭或切换模型后丢弃过期符号高亮回调;基础构建和脚本语法及常见文件关联;内置 Python、Shell、Kotlin、Groovy、CMake、Dockerfile、SQL、PHP、Ruby、Swift、C#、Lua、PowerShell、Zig、Protobuf、Objective-C/C++、Makefile、GraphQL 语法,PHP 通过 TextMate injections 嵌在 HTML 中", "macos": { "implementationStatus": "partial", "verificationStatus": "pending", "evidence": [ "desktop/internal/editor/syntax/languages.go", "desktop/internal/editor/textmate", - "desktop/internal/workbench/semantic_tokens.go" + "desktop/internal/workbench/semantic_tokens.go", + "desktop/internal/editor/syntax/grammars", + "desktop/internal/editor/syntax/language_test.go", + "desktop/internal/editor/textmate/injection.go" ] }, "windows": { @@ -18,12 +21,15 @@ "evidence": [ "desktop/internal/editor/syntax/languages.go", "desktop/internal/editor/textmate", - "desktop/internal/workbench/semantic_tokens.go" + "desktop/internal/workbench/semantic_tokens.go", + "desktop/internal/editor/syntax/grammars", + "desktop/internal/editor/syntax/language_test.go", + "desktop/internal/editor/textmate/injection.go" ] }, "owner": "Editor", - "notes": "Viva:语言识别与 TextMate 语法高亮位于 editor/syntax 与 editor/textmate,语义高亮回调由 workbench/semantic_tokens.go 管理。模型切换后丢弃过期回调的具体路径未逐行核对。", - "verification": "分别打开 Markdown、普通文本和由测试内联的合成插件声明语法的文件,确认语言识别、语法高亮和模型切换;开启缩略图并滚动,确认滚动条轨道不透出编辑器代码。macOS 运行 scripts/macos/probe/probe-macos-monaco.sh --workbench-tests,验证原生关闭文档后到达的 Monaco 焦点和光标消息取消,主视图和分屏切换后不出现同步失败红条,其他文档仍可编辑并完成同步;已关闭文档的文本编辑与保存请求仍必须拒绝。真实产品另检查关闭文件、关闭搜索预览、删除文件后的文档切换及未保存输入保护。 原生探针捕获真实 Monaco 高亮回调,先在存活视图产生查询,再关闭主视图、分屏或差异视图,显式执行旧回调,确认没有空模型 URI 异常、存活文档仍可编辑且文本不变。升级固定 Monaco 版本时复核兼容钩子并运行三个回归;Windows 另在 WebView2 验证。 macOS Lithe 深色行号为 #4B5059,当前行为 #A1A3AB,行号为普通编辑字体小1pt且跟随字号设置。 macOS 编辑器边栏从左到右为行号、运行/导航标记;主方法使用原始16pt IDEA 描边 Run SVG 与明暗变体,断点在行号区显示并保持原点击调试请求。真实 WebKit 检查图标位置及引擎命中区域。Windows 未开启 lineNumbersFirst。 行号后及动作后留白均4pt,折叠按钮单独占16pt槽,原始9×9 IDEA fold/unfold SVG 保留明暗颜色与1pt描边;实际点击折叠/断点和运行图标互不串联,不影响差异审阅布局。 测试类未运行状态使用 IDEA 原始16pt Run All 明暗描边图标,测试方法和结果状态语义保持不变。没有导航标记时收回空导航槽,运行控件和折叠控件之间为4pt;导航标记出现、主题配置及切换文件后槽位仍正确。 普通行号栏按实际行号字体与最大行号位数计算,最低16pt用于断点,不固定预留5位;验证9/99/100/1000行增长及缩回、字体字号变更、分屏独立宽度,Git blame 维持注释空间并能恢复普通栏宽。 macOS Lithe 深色结构线普通色 #323438、高亮色 #4E5157;仅光标紧邻多行代码块配对花括号时显示对应高亮线,块内普通语句、文本选择及字符串或注释中的括号不触发,分屏各自独立。原生 WebKit 回归覆盖实际引导线颜色、嵌套块与配置更新;完整产品视觉验收仍 pending。 macOS 普通行号列左偏移8pt(4pt空注释区+4pt间隔),数字列宽仍按实际字体和位数计算,断点不额外计入左偏移;真实WebKit验证9/99/100/1000行、字号/字体、分屏、运行/折叠命中和Git blame恢复,行号至Run仍4pt,未出现额外右侧空槽。 macOS软换行开关移入WebKit的标准HTML按钮,移除原生覆盖层的光标竞争;保留共享22pt外观、SVG、选中/禁用、查找栏隐藏及原设置持久化,真实WebKit验证完整命中区域均pointer、点击桥接与选区保持,缩略图开关后位置正确。 普通快速修复提示采用IDEA原始16pt intentionBulb明暗SVG,覆盖代码区与gutter位置,保留原Monaco动作和菜单。 macOS 首次打开文件时默认折叠至少两条导入语句,语言服务准备期间也可用;类体与方法默认展开,手动展开后切换标签保持展开,单条导入不折叠。复用 Monaco foldingImportsByDefault,真实 WebKit 检查可见折叠状态与源码不变;Windows 未启用。 macOS 主编辑区和分屏初次附加模型时,等待 Monaco 初始折叠与视图状态恢复再显示内容,避免展开导入区随后收起的闪动;无固定延时。真实 WebKit 用受控 folding provider 验证计算期间不呈现展开代码、完成后首个可见状态已折叠。 TextMate 注释分隔符 punctuation.definition.comment 映射为 comment,斜杠与正文同色;WebKit 深浅主题验证行/块/文档注释前景色与 token 类型一致,除法运算符不受影响。 Windows 连续打开超过 8 个文件以触发表面复用,随后在新文件执行重命名、查看参数提示和 Code Lens;延迟加载结束后与切换为较短文件后定位均正确,旧模型释放或解绑时不返回旧位置。 基础高亮运行 probe-macos-monaco.sh --workbench-tests:共享 fixture 检查文件名关联、Make 变量函数、CMake 命令、Groovy 字符串与 PowerShell/Batch 注释,并确认可编辑;Windows 运行 language-detection.test.ts,再在真实 WebView2 打开同批文件检查高亮与离线资源加载。 WebKit 回归先在全新环境启用 makefile 插件并打开后撤回,确认原模型恢复注释高亮;再用真实 Groovy worker ready 事件闸门控制首次差异加载与插件启用的顺序,确认过期 worker 释放、插件优先以及撤回后仍可重新加载内置语法。", + "notes": "Viva:语言识别与 TextMate 语法高亮位于 editor/syntax 与 editor/textmate,语义高亮回调由 workbench/semantic_tokens.go 管理。模型切换后丢弃过期回调的具体路径未逐行核对。 内置语法为固定的 VS Code 内置扩展及其上游 TextMate 语法原文(许可与来源见 editor/syntax/grammars/NOTICE.txt),首次打开对应语言时才解析;分词器按 vscode-textmate 9.3.2 运行根语法的 injections(L:/R: 优先级、逗号分隔选择器),并把 Oniguruma 的 absent 运算符 (?~X) 译成等价写法;黄金样本由 vscode-textmate 生成,分类规则对齐 Dark+。", + "verification": "分别打开 Markdown、普通文本和由测试内联的合成插件声明语法的文件,确认语言识别、语法高亮和模型切换;开启缩略图并滚动,确认滚动条轨道不透出编辑器代码。macOS 运行 scripts/macos/probe/probe-macos-monaco.sh --workbench-tests,验证原生关闭文档后到达的 Monaco 焦点和光标消息取消,主视图和分屏切换后不出现同步失败红条,其他文档仍可编辑并完成同步;已关闭文档的文本编辑与保存请求仍必须拒绝。真实产品另检查关闭文件、关闭搜索预览、删除文件后的文档切换及未保存输入保护。 原生探针捕获真实 Monaco 高亮回调,先在存活视图产生查询,再关闭主视图、分屏或差异视图,显式执行旧回调,确认没有空模型 URI 异常、存活文档仍可编辑且文本不变。升级固定 Monaco 版本时复核兼容钩子并运行三个回归;Windows 另在 WebView2 验证。 macOS Lithe 深色行号为 #4B5059,当前行为 #A1A3AB,行号为普通编辑字体小1pt且跟随字号设置。 macOS 编辑器边栏从左到右为行号、运行/导航标记;主方法使用原始16pt IDEA 描边 Run SVG 与明暗变体,断点在行号区显示并保持原点击调试请求。真实 WebKit 检查图标位置及引擎命中区域。Windows 未开启 lineNumbersFirst。 行号后及动作后留白均4pt,折叠按钮单独占16pt槽,原始9×9 IDEA fold/unfold SVG 保留明暗颜色与1pt描边;实际点击折叠/断点和运行图标互不串联,不影响差异审阅布局。 测试类未运行状态使用 IDEA 原始16pt Run All 明暗描边图标,测试方法和结果状态语义保持不变。没有导航标记时收回空导航槽,运行控件和折叠控件之间为4pt;导航标记出现、主题配置及切换文件后槽位仍正确。 普通行号栏按实际行号字体与最大行号位数计算,最低16pt用于断点,不固定预留5位;验证9/99/100/1000行增长及缩回、字体字号变更、分屏独立宽度,Git blame 维持注释空间并能恢复普通栏宽。 macOS Lithe 深色结构线普通色 #323438、高亮色 #4E5157;仅光标紧邻多行代码块配对花括号时显示对应高亮线,块内普通语句、文本选择及字符串或注释中的括号不触发,分屏各自独立。原生 WebKit 回归覆盖实际引导线颜色、嵌套块与配置更新;完整产品视觉验收仍 pending。 macOS 普通行号列左偏移8pt(4pt空注释区+4pt间隔),数字列宽仍按实际字体和位数计算,断点不额外计入左偏移;真实WebKit验证9/99/100/1000行、字号/字体、分屏、运行/折叠命中和Git blame恢复,行号至Run仍4pt,未出现额外右侧空槽。 macOS软换行开关移入WebKit的标准HTML按钮,移除原生覆盖层的光标竞争;保留共享22pt外观、SVG、选中/禁用、查找栏隐藏及原设置持久化,真实WebKit验证完整命中区域均pointer、点击桥接与选区保持,缩略图开关后位置正确。 普通快速修复提示采用IDEA原始16pt intentionBulb明暗SVG,覆盖代码区与gutter位置,保留原Monaco动作和菜单。 macOS 首次打开文件时默认折叠至少两条导入语句,语言服务准备期间也可用;类体与方法默认展开,手动展开后切换标签保持展开,单条导入不折叠。复用 Monaco foldingImportsByDefault,真实 WebKit 检查可见折叠状态与源码不变;Windows 未启用。 macOS 主编辑区和分屏初次附加模型时,等待 Monaco 初始折叠与视图状态恢复再显示内容,避免展开导入区随后收起的闪动;无固定延时。真实 WebKit 用受控 folding provider 验证计算期间不呈现展开代码、完成后首个可见状态已折叠。 TextMate 注释分隔符 punctuation.definition.comment 映射为 comment,斜杠与正文同色;WebKit 深浅主题验证行/块/文档注释前景色与 token 类型一致,除法运算符不受影响。 Windows 连续打开超过 8 个文件以触发表面复用,随后在新文件执行重命名、查看参数提示和 Code Lens;延迟加载结束后与切换为较短文件后定位均正确,旧模型释放或解绑时不返回旧位置。 基础高亮运行 probe-macos-monaco.sh --workbench-tests:共享 fixture 检查文件名关联、Make 变量函数、CMake 命令、Groovy 字符串与 PowerShell/Batch 注释,并确认可编辑;Windows 运行 language-detection.test.ts,再在真实 WebView2 打开同批文件检查高亮与离线资源加载。 WebKit 回归先在全新环境启用 makefile 插件并打开后撤回,确认原模型恢复注释高亮;再用真实 Groovy worker ready 事件闸门控制首次差异加载与插件启用的顺序,确认过期 worker 释放、插件优先以及撤回后仍可重新加载内置语法。 打开 .py、.sh、.kt、.groovy、CMakeLists.txt、Dockerfile、.sql、.php、.rb、.swift、.cs、.lua、.ps1、.zig、.proto、.m、.mm、Makefile、.graphql,确认关键字、字符串、注释、数字、类型和函数的颜色与 VS Code Dark+ 一致;PHP 文件里的 HTML 标签、属性、实体和 / 段各自着色,HTML 属性值中的 仍按 PHP 着色。macOS 与 Windows 原生窗口视觉验收待做。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": { diff --git a/shared/platform-feature-matrix/features/plugin-editor-grammars.json b/shared/platform-feature-matrix/features/plugin-editor-grammars.json index 44a409a852..0271a0fc24 100644 --- a/shared/platform-feature-matrix/features/plugin-editor-grammars.json +++ b/shared/platform-feature-matrix/features/plugin-editor-grammars.json @@ -10,7 +10,8 @@ "desktop/internal/core/plugin_session_test.go", "desktop/internal/core/plugin_session.go", "desktop/internal/editor/textmate/grammar.go", - "desktop/internal/editor/syntax/language.go" + "desktop/internal/editor/syntax/language.go", + "desktop/internal/editor/textmate/injection.go" ] }, "windows": { @@ -20,12 +21,13 @@ "desktop/internal/core/plugin_session_test.go", "desktop/internal/core/plugin_session.go", "desktop/internal/editor/textmate/grammar.go", - "desktop/internal/editor/syntax/language.go" + "desktop/internal/editor/syntax/language.go", + "desktop/internal/editor/textmate/injection.go" ] }, "owner": "Extensions", - "verification": "当前 macOS Core 桥接测试验证 languages 3 TextMate 声明、原文和 scope 解码、编辑器解析、无效语法拒绝及仅配置声明,并确认撤回的 languages 2 被拒绝;Windows 待执行。完成宿主后安装纯语法插件并打开 .http,验证启用、禁用、配置独立应用、病态语法不阻塞输入和保存以及安装目录哈希不变;两平台的原生窗口与完整插件生命周期均待验收。插件声明的语言没有 grammar 且 ID 不是内置语言时(如调试插件用 clangd 声明 .c/.h/.cpp),打开 main.c 仍显示内置 C 语法颜色,文档语言 ID 仍为插件声明的 ID。", - "notes": "固定 Core 已支持 TextMate languages 3 并拒绝 Monarch languages 2;Viva 内置 TextMate 引擎已有测试,但插件发现、可信安装、语法注册与撤回尚未接入,不能把 Core 能力当作插件已可用。公开插件文档在本 PR 合并后按规则同步。插件语言没有自带 grammar、ID 也不是内置语言时只用于给插件的语言服务器和调试器路由文件,syntax.Registry.SyntaxForPath 让这些文件按文件名使用内置语言的语法着色,不再整片无高亮。", + "verification": "当前 macOS Core 桥接测试验证 languages 3 TextMate 声明、原文和 scope 解码、编辑器解析、无效语法拒绝及仅配置声明,并确认撤回的 languages 2 被拒绝;Windows 待执行。完成宿主后安装纯语法插件并打开 .http,验证启用、禁用、配置独立应用、病态语法不阻塞输入和保存以及安装目录哈希不变;两平台的原生窗口与完整插件生命周期均待验收。插件声明的语言没有 grammar 且 ID 不是内置语言时(如调试插件用 clangd 声明 .c/.h/.cpp),打开 main.c 仍显示内置 C 语法颜色,文档语言 ID 仍为插件声明的 ID。 插件语法声明 injections 时,宿主测试确认选择器命中处按 L:/R: 优先级尝试注入规则,不合规的 injections 由 Core 拒绝。", + "notes": "固定 Core 已支持 TextMate languages 3 并拒绝 Monarch languages 2;Viva 内置 TextMate 引擎已有测试,但插件发现、可信安装、语法注册与撤回尚未接入,不能把 Core 能力当作插件已可用。公开插件文档在本 PR 合并后按规则同步。插件语言没有自带 grammar、ID 也不是内置语言时只用于给插件的语言服务器和调试器路由文件,syntax.Registry.SyntaxForPath 让这些文件按文件名使用内置语言的语法着色,不再整片无高亮。 固定 Core 校验插件语法的 injections(以 scope 选择器为键的规则对象,最多 64 项,选择器 1–1024 字节,规则计入 16384 条上限),编辑器按 vscode-textmate 对根语法的方式运行它们;被包含语法的 injections 不生效,injectionSelector 不运行也不检查,插件语法不能注入别的语法。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": { diff --git a/shared/platform-feature-matrix/features/project-file-type-icons.json b/shared/platform-feature-matrix/features/project-file-type-icons.json index 79704a28e3..321a9cb89c 100644 --- a/shared/platform-feature-matrix/features/project-file-type-icons.json +++ b/shared/platform-feature-matrix/features/project-file-type-icons.json @@ -2,7 +2,7 @@ "id": "project-file-type-icons", "area": "工作台", "group": "项目侧边栏", - "capability": "项目树、标签页和搜索结果为常见项目文件显示专用图标:.gitignore/.gitattributes 用 Git 图标,go.mod/go.sum 用 Go 图标,Makefile 与 *.mk 用 Makefile 图标,package.json 用 Node.js 图标,bun.lock、Cargo.lock、package-lock.json 等锁文件用锁图标,README 用信息图标,*.java 用 Java 图标,LICENSE/COPYING 用许可证图标", + "capability": "项目树、标签页和搜索结果为常见项目文件显示专用图标:.gitignore/.gitattributes 用 Git 图标,go.mod/go.sum 用 Go 图标,Makefile 与 *.mk 用 Makefile 图标,package.json 用 Node.js 图标,bun.lock、Cargo.lock、package-lock.json 等锁文件用锁图标,README 用信息图标,*.java 用 Java 图标,LICENSE/COPYING 用许可证图标;Lua、Zig(含 .zon)、Protobuf、GraphQL 和 CMake(*.cmake 与 CMakeLists.txt)文件用各自的语言图标", "macos": { "implementationStatus": "implemented", "verificationStatus": "pending", @@ -10,7 +10,9 @@ "desktop/internal/fileicons/fileicons.go", "desktop/internal/workbench/filetree_view.go", "desktop/internal/workbench/tabstrip.go", - "desktop/internal/workbench/search_everywhere_view.go" + "desktop/internal/workbench/search_everywhere_view.go", + "desktop/internal/fileicons/fileicons_test.go", + "desktop/internal/fileicons/NOTICE" ] }, "windows": { @@ -20,11 +22,13 @@ "desktop/internal/fileicons/fileicons.go", "desktop/internal/workbench/filetree_view.go", "desktop/internal/workbench/tabstrip.go", - "desktop/internal/workbench/search_everywhere_view.go" + "desktop/internal/workbench/search_everywhere_view.go", + "desktop/internal/fileicons/fileicons_test.go", + "desktop/internal/fileicons/NOTICE" ] }, "owner": "Workbench", - "verification": "在深浅主题下打开含 go.mod、go.sum、Makefile、.gitignore、.gitattributes、bun.lock、package.json、README.md、LICENSE、NOTICE、Main.java 的项目,核对项目树、编辑器标签和 Search Everywhere/快速打开中的图标与上述分类一致,不再显示问号或纯文本图标;NOTICE 等未分类文本仍显示文本图标。Windows 使用 IDEA Icons 主题核对同一组文件,PowerShell 文件仍显示原 Windows 四格图标。", + "verification": "在深浅主题下打开含 go.mod、go.sum、Makefile、.gitignore、.gitattributes、bun.lock、package.json、README.md、LICENSE、NOTICE、Main.java 的项目,核对项目树、编辑器标签和 Search Everywhere/快速打开中的图标与上述分类一致,不再显示问号或纯文本图标;NOTICE 等未分类文本仍显示文本图标。Windows 使用 IDEA Icons 主题核对同一组文件,PowerShell 文件仍显示原 Windows 四格图标。打开含 order.lua、main.zig、order.proto、schema.graphql、CMakeLists.txt 的项目,深浅主题下分别显示 Lua、Zig、Protobuf、GraphQL 和 CMake 图标,不再显示问号或文本图标。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": { @@ -49,5 +53,5 @@ ] } }, - "notes": "Viva:fileicons/fileicons.go 的 fileKind 覆盖 .gitignore/.gitattributes、go.mod/go.sum、Makefile 与 *.mk、package.json、*.lock(含 bun.lock、Cargo.lock)、README、LICENSE、*.java(svg/java.svg 与 java_dark.svg 取自旧版 macOS 客户端 IDEAIcons/expui/fileTypes);项目树、标签页和 Search Everywhere 调用 ForFile。NOTICE 不在分类中,仍显示文本图标。" + "notes": "Viva:fileicons/fileicons.go 的 fileKind 覆盖 .gitignore/.gitattributes、go.mod/go.sum、Makefile 与 *.mk、package.json、*.lock(含 bun.lock、Cargo.lock)、README、LICENSE、*.java(svg/java.svg 与 java_dark.svg 取自旧版 macOS 客户端 IDEAIcons/expui/fileTypes);项目树、标签页和 Search Everywhere 调用 ForFile。NOTICE 不在分类中,仍显示文本图标。 2026-11-17(#2112):graphql 与 protoFile 取自 JetBrains(intellij-community expui/fileTypes 与 intellij-plugins protobuf newui,Apache 2.0,带深色版本);lua.svg 是 vscode-icons 绘制的官方 Lua 标志(Lua.org 标志条款,只把具名颜色改成十六进制);zig.svg 改编自 ziglang/logo 的官方 zig-mark(CC BY-SA 4.0);cmake.svg 取 vscode-cmake-tools 标志里的 CMake 三角(MIT,去掉扳手)。这三个品牌图标保持官方配色,深色主题共用同一张。来源与修改见 fileicons/NOTICE。" }