├── .github ├── dependabot.yml └── workflows │ └── publish.yml ├── .gitignore ├── .vscode └── launch.json ├── .vscodeignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── language-configuration.json ├── package-lock.json ├── package.json └── syntaxes ├── pdl.tmLanguage.YAML-tmLanguage └── pdl.tmLanguage.json /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "npm" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | - package-ecosystem: "github-actions" 8 | directory: "/" 9 | schedule: 10 | interval: "weekly" 11 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish Extension 2 | 3 | on: 4 | push: 5 | tags: 6 | - "*" 7 | 8 | jobs: 9 | publish: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v4 13 | - uses: actions/setup-node@v4 14 | with: 15 | node-version: 20 16 | - run: npm ci 17 | - name: Parse tag for package and version 18 | id: parse_tag 19 | uses: actions-ecosystem/action-regex-match@v2 20 | with: 21 | text: ${{ github.ref }} 22 | regex: "^refs/tags/(.+)$" 23 | - name: Publish to Open VSX Registry 24 | id: publish_to_open_vsx 25 | uses: HaaLeo/publish-vscode-extension@v2 26 | with: 27 | pat: ${{ secrets.OPEN_VSX_TOKEN }} 28 | - name: Upload packages 29 | uses: actions/upload-artifact@v4 30 | with: 31 | name: vsix 32 | path: ${{ steps.publish_to_open_vsx.outputs.vsixPath }} 33 | - name: Create draft release 34 | id: create_release 35 | uses: actions/create-release@v1 36 | env: 37 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions. 38 | with: 39 | tag_name: ${{ github.ref }} 40 | release_name: ${{ steps.parse_tag.outputs.group1 }} 41 | - name: Upload packages to release 42 | uses: shogo82148/actions-upload-release-asset@v1 43 | with: 44 | upload_url: ${{ steps.create_release.outputs.upload_url }} 45 | asset_path: ${{ steps.publish_to_open_vsx.outputs.vsixPath }} 46 | asset_content_type: application/vsix 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}" 14 | ] 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 0.2.2 4 | 5 | Fixed highlighting of enums with ranges (i.e. nested braces). 6 | 7 | ## 0.2.1 8 | 9 | Fixed link to PDL reference documentation. 10 | 11 | ## 0.2.0 12 | 13 | Changed language ID to avoid clash with Chrome DevTools PDL. 14 | 15 | ## 0.1.0 16 | 17 | - Initial release, TextMate grammar for PDL syntax highlighting. 18 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | We'd love to accept your patches and contributions to this project. There are 4 | just a few small guidelines you need to follow. 5 | 6 | ## Contributor License Agreement 7 | 8 | Contributions to this project must be accompanied by a Contributor License 9 | Agreement (CLA). You (or your employer) retain the copyright to your 10 | contribution; this simply gives us permission to use and redistribute your 11 | contributions as part of the project. Head over to 12 | to see your current agreements on file or 13 | to sign a new one. 14 | 15 | You generally only need to submit a CLA once, so if you've already submitted one 16 | (even if it was for a different project), you probably don't need to do it 17 | again. 18 | 19 | ## Code reviews 20 | 21 | All submissions, including submissions by project members, require review. We 22 | use GitHub pull requests for this purpose. Consult 23 | [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more 24 | information on using pull requests. 25 | 26 | ## Community Guidelines 27 | 28 | This project follows 29 | [Google's Open Source Community Guidelines](https://opensource.google/conduct/). 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PDL language support 2 | 3 | Syntax highlighting for 4 | [Packet Description Language](https://github.com/google/pdl/blob/main/doc/reference.md), 5 | as used for various Android networking components. 6 | 7 | This is not an officially supported Google product. 8 | 9 | ## Release Notes 10 | 11 | ### 0.2.2 12 | 13 | Fixed highlighting of enums with ranges (i.e. nested braces). 14 | 15 | ### 0.2.1 16 | 17 | Fixed link to PDL reference documentation. 18 | 19 | ### 0.2.0 20 | 21 | Changed language ID to avoid clash with Chrome DevTools PDL. 22 | 23 | ### 0.1.0 24 | 25 | Initial release with a basic PDL grammar for syntax highlighting. 26 | 27 | ## Contributing 28 | 29 | If you want to contribute to the project, see details of 30 | [how we accept contributions](CONTRIBUTING.md). 31 | -------------------------------------------------------------------------------- /language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "//", 4 | "blockComment": [ "/*", "*/" ] 5 | }, 6 | // Symbols used as brackets. 7 | "brackets": [ 8 | ["{", "}"], 9 | ["[", "]"], 10 | ["(", ")"] 11 | ], 12 | // Symbols that are auto closed when typing. 13 | "autoClosingPairs": [ 14 | ["{", "}"], 15 | ["[", "]"], 16 | ["(", ")"], 17 | ["\"", "\""], 18 | ], 19 | // Symbols that can be used to surround a selection. 20 | "surroundingPairs": [ 21 | ["{", "}"], 22 | ["(", ")"], 23 | ["\"", "\""], 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pdl-language", 3 | "version": "0.2.2", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "pdl-language", 9 | "version": "0.2.2", 10 | "license": "Apache-2.0", 11 | "devDependencies": { 12 | "js-yaml": "^4.1.0" 13 | }, 14 | "engines": { 15 | "vscode": "^1.52.0" 16 | } 17 | }, 18 | "node_modules/argparse": { 19 | "version": "2.0.1", 20 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", 21 | "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", 22 | "dev": true 23 | }, 24 | "node_modules/js-yaml": { 25 | "version": "4.1.0", 26 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", 27 | "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", 28 | "dev": true, 29 | "dependencies": { 30 | "argparse": "^2.0.1" 31 | }, 32 | "bin": { 33 | "js-yaml": "bin/js-yaml.js" 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pdl-language", 3 | "displayName": "Packet Description Language", 4 | "description": "Syntax highlighting for the Packet Description Language.", 5 | "version": "0.2.2", 6 | "engines": { 7 | "vscode": "^1.52.0" 8 | }, 9 | "categories": [ 10 | "Programming Languages" 11 | ], 12 | "keywords": [ 13 | "PDL", 14 | "Android" 15 | ], 16 | "publisher": "Google", 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/google/pdl-language.git" 20 | }, 21 | "license": "Apache-2.0", 22 | "contributes": { 23 | "languages": [ 24 | { 25 | "id": "pdl_android", 26 | "aliases": [ 27 | "Packet Description Language", 28 | "PDL", 29 | "pdl" 30 | ], 31 | "extensions": [ 32 | ".pdl" 33 | ], 34 | "configuration": "./language-configuration.json" 35 | } 36 | ], 37 | "grammars": [ 38 | { 39 | "language": "pdl_android", 40 | "scopeName": "source.pdl", 41 | "path": "./syntaxes/pdl.tmLanguage.json" 42 | } 43 | ] 44 | }, 45 | "devDependencies": { 46 | "js-yaml": "^4.1.0" 47 | } 48 | } -------------------------------------------------------------------------------- /syntaxes/pdl.tmLanguage.YAML-tmLanguage: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | $schema: 'https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json' 16 | fileTypes: 17 | - pdl 18 | scopeName: source.pdl 19 | name: Packet Description Language 20 | foldingStartMarker: '\{\s*$' 21 | foldingStopMarker: '^\s*\}' 22 | patterns: 23 | - include: '#main' 24 | repository: 25 | main: 26 | patterns: 27 | - include: '#comments' 28 | - include: '#endianness' 29 | - include: '#declaration' 30 | - match: '([^\s])' 31 | name: invalid.illegal.pdl 32 | comments: 33 | patterns: 34 | - include: '#multi_line_comment' 35 | - match: (//).* 36 | name: comment.line.double-slash.pdl 37 | captures: 38 | '1': {name: punctuation.definition.comment.pdl} 39 | endianness: 40 | patterns: 41 | - match: \b(little_endian_packets|big_endian_packets)\b 42 | name: keyword.pdl 43 | declaration: 44 | patterns: 45 | - name: meta.enum.pdl 46 | begin: '(enum)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(:)\s*([0-9]+)\s*(\{)' 47 | beginCaptures: 48 | '1': {name: storage.type.enum.pdl} 49 | '2': {name: entity.name.type.enum.pdl} 50 | '3': {name: punctuation.separator.pdl} 51 | '4': {name: constant.numeric.decimal.pdl} 52 | '5': {name: punctuation.section.braces.begin.pdl} 53 | end: '(\})' 54 | endCaptures: 55 | '1': {name: punctuation.section.braces.end.pdl} 56 | patterns: 57 | - include: '#enum_body' 58 | - name: meta.enum.pdl 59 | begin: '(enum)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(:)\s*(0[xX][0-9a-fA-F]+)\s*(\{)' 60 | beginCaptures: 61 | '1': {name: storage.type.enum.pdl} 62 | '2': {name: entity.name.type.enum.pdl} 63 | '3': {name: punctuation.separator.pdl} 64 | '4': {name: constant.numeric.hex.pdl} 65 | '5': {name: punctuation.section.braces.begin.pdl} 66 | end: '(\})' 67 | endCaptures: 68 | '1': {name: punctuation.section.braces.end.pdl} 69 | patterns: 70 | - include: '#enum_body' 71 | - name: meta.packet.pdl 72 | begin: '(packet)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(\{)' 73 | beginCaptures: 74 | '1': {name: storage.type.packet.pdl} 75 | '2': {name: entity.name.type.packet.pdl} 76 | '3': {name: punctuation.section.braces.begin.pdl} 77 | end: '(\})' 78 | endCaptures: 79 | '1': {name: punctuation.section.braces.end.pdl} 80 | patterns: 81 | - include: '#field_list' 82 | - name: meta.packet.pdl 83 | begin: '(packet)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(:)\s*([a-zA-Z][a-zA-Z0-9_]*)\s*(\{)' 84 | beginCaptures: 85 | '1': {name: storage.type.packet.pdl} 86 | '2': {name: entity.name.type.packet.pdl} 87 | '3': {name: punctuation.separator.pdl} 88 | '4': {name: entity.name.pdl} 89 | '5': {name: punctuation.section.braces.begin.pdl} 90 | end: '(\})' 91 | endCaptures: 92 | '1': {name: punctuation.section.braces.end.pdl} 93 | patterns: 94 | - include: '#field_list' 95 | - name: meta.packet.pdl 96 | begin: '(packet)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(:)\s*([a-zA-Z][a-zA-Z0-9_]*)\s*(\()' 97 | beginCaptures: 98 | '1': {name: storage.type.packet.pdl} 99 | '2': {name: entity.name.type.packet.pdl} 100 | '3': {name: punctuation.separator.pdl} 101 | '4': {name: entity.name.pdl} 102 | '5': {name: punctuation.begin.pdl} 103 | end: '(\))' 104 | endCaptures: 105 | '1': {name: punctuation.section.braces.end.pdl} 106 | patterns: 107 | - include: '#constraint_list' 108 | - name: meta.struct.pdl 109 | begin: '(struct)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(\{)' 110 | beginCaptures: 111 | '1': {name: storage.type.struct.pdl} 112 | '2': {name: entity.name.type.struct.pdl} 113 | '3': {name: punctuation.section.braces.begin.pdl} 114 | end: '(\})' 115 | endCaptures: 116 | '1': {name: punctuation.section.braces.end.pdl} 117 | patterns: 118 | - include: '#field_list' 119 | - name: meta.struct.pdl 120 | begin: '(struct)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(:)\s*([a-zA-Z][a-zA-Z0-9_]*)\s*(\{)' 121 | beginCaptures: 122 | '1': {name: storage.type.struct.pdl} 123 | '2': {name: entity.name.type.struct.pdl} 124 | '3': {name: punctuation.separator.pdl} 125 | '4': {name: entity.name.pdl} 126 | '5': {name: punctuation.section.braces.begin.pdl} 127 | end: '(\})' 128 | endCaptures: 129 | '1': {name: punctuation.section.braces.end.pdl} 130 | patterns: 131 | - include: '#field_list' 132 | - name: meta.struct.pdl 133 | begin: '(struct)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(:)\s*([a-zA-Z][a-zA-Z0-9_]*)\s*(\()' 134 | beginCaptures: 135 | '1': {name: storage.type.struct.pdl} 136 | '2': {name: entity.name.type.struct.pdl} 137 | '3': {name: punctuation.separator.pdl} 138 | '4': {name: entity.name.pdl} 139 | '5': {name: punctuation.begin.pdl} 140 | end: '(\))' 141 | endCaptures: 142 | '1': {name: punctuation.section.braces.end.pdl} 143 | patterns: 144 | - include: '#constraint_list' 145 | - begin: '(\{)' 146 | beginCaptures: 147 | '1': {name: punctuation.begin.pdl} 148 | end: '(\})' 149 | endCaptures: 150 | '1': {name: punctuation.section.braces.end.pdl} 151 | patterns: 152 | - include: '#field_list' 153 | - name: meta.group.pdl 154 | begin: '(group)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(\{)' 155 | beginCaptures: 156 | '1': {name: storage.type.group.pdl} 157 | '2': {name: entity.name.type.group.pdl} 158 | '3': {name: punctuation.section.braces.begin.pdl} 159 | end: '(\})' 160 | endCaptures: 161 | '1': {name: punctuation.section.braces.end.pdl} 162 | patterns: 163 | - include: '#field_list' 164 | - name: meta.checksum.pdl 165 | match: '(checksum)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(:)\s*([0-9]+)\s*(")([^\"]*)(")' 166 | captures: 167 | '1': {name: storage.type.checksum.pdl} 168 | '2': {name: entity.name.type.checksum.pdl} 169 | '3': {name: punctuation.separator.pdl} 170 | '4': {name: constant.numeric.decimal.pdl} 171 | '5': {name: punctuation.definition.string.begin.aidl} 172 | '6': {name: string.quoted.double.aidl} 173 | '7': {name: punctuation.definition.string.end.aidl} 174 | - name: meta.checksum.pdl 175 | match: '(checksum)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(:)\s*(0[xX][0-9a-fA-F]+)\s*(")([^\"]*)(")' 176 | captures: 177 | '1': {name: storage.type.checksum.pdl} 178 | '2': {name: entity.name.type.checksum.pdl} 179 | '3': {name: punctuation.separator.pdl} 180 | '4': {name: constant.numeric.hex.pdl} 181 | '5': {name: punctuation.definition.string.begin.aidl} 182 | '6': {name: string.quoted.double.aidl} 183 | '7': {name: punctuation.definition.string.end.aidl} 184 | - name: meta.custom_field.pdl 185 | match: '(custom_field)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(")([^\"]*)(")' 186 | captures: 187 | '1': {name: storage.type.custom_field.pdl} 188 | '2': {name: entity.name.type.custom_field.pdl} 189 | '3': {name: punctuation.definition.string.begin.aidl} 190 | '4': {name: string.quoted.double.aidl} 191 | '5': {name: punctuation.definition.string.end.aidl} 192 | - name: meta.custom_field.pdl 193 | match: '(custom_field)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(:)\s*([0-9]+)\s*(")([^\"]*)(")' 194 | captures: 195 | '1': {name: storage.type.custom_field.pdl} 196 | '2': {name: entity.name.type.custom_field.pdl} 197 | '3': {name: punctuation.separator.pdl} 198 | '4': {name: constant.numeric.decimal.pdl} 199 | '5': {name: punctuation.definition.string.begin.aidl} 200 | '6': {name: string.quoted.double.aidl} 201 | '7': {name: punctuation.definition.string.end.aidl} 202 | - name: meta.custom_field.pdl 203 | match: '(custom_field)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(:)\s*(0[xX][0-9a-fA-F]+)\s*(")([^\"]*)(")' 204 | captures: 205 | '1': {name: storage.type.custom_field.pdl} 206 | '2': {name: entity.name.type.custom_field.pdl} 207 | '3': {name: punctuation.separator.pdl} 208 | '4': {name: constant.numeric.hex.pdl} 209 | '5': {name: punctuation.definition.string.begin.aidl} 210 | '6': {name: string.quoted.double.aidl} 211 | '7': {name: punctuation.definition.string.end.aidl} 212 | - name: meta.test.pdl 213 | begin: '(test)\s+([a-zA-Z][a-zA-Z0-9_]*)\s*(\{)' 214 | beginCaptures: 215 | '1': {name: storage.type.enum.pdl} 216 | '2': {name: entity.name.type.enum.pdl} 217 | '3': {name: punctuation.section.braces.begin.pdl} 218 | end: '(\})' 219 | endCaptures: 220 | '1': {name: punctuation.section.braces.end.pdl} 221 | patterns: 222 | - include: '#test_case_list' 223 | enum_body: 224 | patterns: 225 | - include: '#comments' 226 | - include: '#enum_body_inner' 227 | - begin: '(\{)' 228 | beginCaptures: 229 | '1': {name: punctuation.section.braces.begin.pdl} 230 | end: '(\})' 231 | endCaptures: 232 | '1': {name: punctuation.section.braces.end.pdl} 233 | patterns: 234 | - include: '#enum_body_inner' 235 | enum_body_inner: 236 | patterns: 237 | - include: '#comments' 238 | - match: = 239 | name: keyword.operator.assignment.pdl 240 | - include: '#integer' 241 | - match: ',' 242 | name: punctuation.separator.pdl 243 | - match: '[a-zA-Z][a-zA-Z0-9_]*' 244 | name: entity.name.constant.pdl 245 | field_list: 246 | patterns: 247 | - include: '#comments' 248 | - match: '[:,]' 249 | name: punctuation.separator.pdl 250 | - begin: (\[) 251 | beginCaptures: 252 | '1': {name: punctuation.begin.pdl} 253 | end: (\]) 254 | endCaptures: 255 | '1': {name: punctuation.section.braces.end.pdl} 256 | patterns: 257 | - include: '#field_size' 258 | - begin: '(\{)' 259 | beginCaptures: 260 | '1': {name: punctuation.section.braces.begin.pdl} 261 | end: '(\})' 262 | endCaptures: 263 | '1': {name: punctuation.section.braces.end.pdl} 264 | patterns: 265 | - include: '#constraint_list' 266 | - begin: '(\()' 267 | beginCaptures: 268 | '1': {name: punctuation.begin.pdl} 269 | end: '(\))' 270 | endCaptures: 271 | '1': {name: punctuation.end.pdl} 272 | patterns: 273 | - include: '#field_parentheses' 274 | - match: (_body_|_size_|_count_|_payload_|_fixed_|_checksum_start_|_padding_|_reserved_) 275 | name: keyword.pdl 276 | - include: '#identifier' 277 | - include: '#integer' 278 | - match: '([^\s])' 279 | name: invalid.illegal.pdl 280 | field_parentheses: 281 | patterns: 282 | - match: ':' 283 | name: punctuation.separator.pdl 284 | - match: '(_payload_|_body_)' 285 | name: keyword.pdl 286 | - include: '#identifier' 287 | - include: '#integer' 288 | - match: '([^\s])' 289 | name: invalid.illegal.pdl 290 | field_size: 291 | patterns: 292 | - match: (\+)\s*([0-9]+) # SIZE_MODIFIER 293 | captures: 294 | '1': {name: keyword.operator.arithmetic.pdl} 295 | '2': {name: constant.numeric.decimal.pdl} 296 | - include: '#integer' 297 | - match: '([^\s])' 298 | name: invalid.illegal.pdl 299 | constraint_list: 300 | patterns: 301 | - match: ',' 302 | name: punctuation.separator.pdl 303 | - match: '=' 304 | name: punctuation.pdl 305 | - include: '#integer' 306 | - include: '#identifier' 307 | test_case_list: 308 | patterns: 309 | - match: ',' 310 | name: punctuation.separator.pdl 311 | - include: '#string' 312 | - match: '([^\s])' 313 | name: invalid.illegal.pdl 314 | identifier: 315 | patterns: 316 | - match: '[a-zA-Z][a-zA-Z0-9_]*' 317 | name: entity.name.pdl 318 | integer: 319 | patterns: 320 | - match: '0[xX][0-9a-fA-F]+' 321 | name: constant.numeric.hex.pdl 322 | - match: '[0-9]+' 323 | name: constant.numeric.decimal.pdl 324 | string: 325 | patterns: 326 | - match: '(")([^\"]*)(")' 327 | captures: 328 | '1': {name: punctuation.definition.string.begin.aidl} 329 | '2': {name: string.quoted.double.aidl} 330 | '3': {name: punctuation.definition.string.end.aidl} 331 | multi_line_comment: 332 | patterns: 333 | - begin: (/\*\*) 334 | beginCaptures: 335 | '1': {name: punctuation.definition.comment.aidl} 336 | name: comment.block.documentation.aidl 337 | end: (\*/) 338 | endCaptures: 339 | '1': {name: punctuation.definition.comment.aidl} 340 | - begin: (/\*) 341 | beginCaptures: 342 | '1': {name: punctuation.definition.comment.aidl} 343 | name: comment.block.aidl 344 | end: (\*/) 345 | endCaptures: 346 | '1': {name: punctuation.definition.comment.aidl} 347 | -------------------------------------------------------------------------------- /syntaxes/pdl.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", 3 | "fileTypes": [ 4 | "pdl" 5 | ], 6 | "scopeName": "source.pdl", 7 | "name": "Packet Description Language", 8 | "foldingStartMarker": "\\{\\s*$", 9 | "foldingStopMarker": "^\\s*\\}", 10 | "patterns": [ 11 | { 12 | "include": "#main" 13 | } 14 | ], 15 | "repository": { 16 | "main": { 17 | "patterns": [ 18 | { 19 | "include": "#comments" 20 | }, 21 | { 22 | "include": "#endianness" 23 | }, 24 | { 25 | "include": "#declaration" 26 | }, 27 | { 28 | "match": "([^\\s])", 29 | "name": "invalid.illegal.pdl" 30 | } 31 | ] 32 | }, 33 | "comments": { 34 | "patterns": [ 35 | { 36 | "include": "#multi_line_comment" 37 | }, 38 | { 39 | "match": "(//).*", 40 | "name": "comment.line.double-slash.pdl", 41 | "captures": { 42 | "1": { 43 | "name": "punctuation.definition.comment.pdl" 44 | } 45 | } 46 | } 47 | ] 48 | }, 49 | "endianness": { 50 | "patterns": [ 51 | { 52 | "match": "\\b(little_endian_packets|big_endian_packets)\\b", 53 | "name": "keyword.pdl" 54 | } 55 | ] 56 | }, 57 | "declaration": { 58 | "patterns": [ 59 | { 60 | "name": "meta.enum.pdl", 61 | "begin": "(enum)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(:)\\s*([0-9]+)\\s*(\\{)", 62 | "beginCaptures": { 63 | "1": { 64 | "name": "storage.type.enum.pdl" 65 | }, 66 | "2": { 67 | "name": "entity.name.type.enum.pdl" 68 | }, 69 | "3": { 70 | "name": "punctuation.separator.pdl" 71 | }, 72 | "4": { 73 | "name": "constant.numeric.decimal.pdl" 74 | }, 75 | "5": { 76 | "name": "punctuation.section.braces.begin.pdl" 77 | } 78 | }, 79 | "end": "(\\})", 80 | "endCaptures": { 81 | "1": { 82 | "name": "punctuation.section.braces.end.pdl" 83 | } 84 | }, 85 | "patterns": [ 86 | { 87 | "include": "#enum_body" 88 | } 89 | ] 90 | }, 91 | { 92 | "name": "meta.enum.pdl", 93 | "begin": "(enum)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(:)\\s*(0[xX][0-9a-fA-F]+)\\s*(\\{)", 94 | "beginCaptures": { 95 | "1": { 96 | "name": "storage.type.enum.pdl" 97 | }, 98 | "2": { 99 | "name": "entity.name.type.enum.pdl" 100 | }, 101 | "3": { 102 | "name": "punctuation.separator.pdl" 103 | }, 104 | "4": { 105 | "name": "constant.numeric.hex.pdl" 106 | }, 107 | "5": { 108 | "name": "punctuation.section.braces.begin.pdl" 109 | } 110 | }, 111 | "end": "(\\})", 112 | "endCaptures": { 113 | "1": { 114 | "name": "punctuation.section.braces.end.pdl" 115 | } 116 | }, 117 | "patterns": [ 118 | { 119 | "include": "#enum_body" 120 | } 121 | ] 122 | }, 123 | { 124 | "name": "meta.packet.pdl", 125 | "begin": "(packet)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(\\{)", 126 | "beginCaptures": { 127 | "1": { 128 | "name": "storage.type.packet.pdl" 129 | }, 130 | "2": { 131 | "name": "entity.name.type.packet.pdl" 132 | }, 133 | "3": { 134 | "name": "punctuation.section.braces.begin.pdl" 135 | } 136 | }, 137 | "end": "(\\})", 138 | "endCaptures": { 139 | "1": { 140 | "name": "punctuation.section.braces.end.pdl" 141 | } 142 | }, 143 | "patterns": [ 144 | { 145 | "include": "#field_list" 146 | } 147 | ] 148 | }, 149 | { 150 | "name": "meta.packet.pdl", 151 | "begin": "(packet)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(:)\\s*([a-zA-Z][a-zA-Z0-9_]*)\\s*(\\{)", 152 | "beginCaptures": { 153 | "1": { 154 | "name": "storage.type.packet.pdl" 155 | }, 156 | "2": { 157 | "name": "entity.name.type.packet.pdl" 158 | }, 159 | "3": { 160 | "name": "punctuation.separator.pdl" 161 | }, 162 | "4": { 163 | "name": "entity.name.pdl" 164 | }, 165 | "5": { 166 | "name": "punctuation.section.braces.begin.pdl" 167 | } 168 | }, 169 | "end": "(\\})", 170 | "endCaptures": { 171 | "1": { 172 | "name": "punctuation.section.braces.end.pdl" 173 | } 174 | }, 175 | "patterns": [ 176 | { 177 | "include": "#field_list" 178 | } 179 | ] 180 | }, 181 | { 182 | "name": "meta.packet.pdl", 183 | "begin": "(packet)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(:)\\s*([a-zA-Z][a-zA-Z0-9_]*)\\s*(\\()", 184 | "beginCaptures": { 185 | "1": { 186 | "name": "storage.type.packet.pdl" 187 | }, 188 | "2": { 189 | "name": "entity.name.type.packet.pdl" 190 | }, 191 | "3": { 192 | "name": "punctuation.separator.pdl" 193 | }, 194 | "4": { 195 | "name": "entity.name.pdl" 196 | }, 197 | "5": { 198 | "name": "punctuation.begin.pdl" 199 | } 200 | }, 201 | "end": "(\\))", 202 | "endCaptures": { 203 | "1": { 204 | "name": "punctuation.section.braces.end.pdl" 205 | } 206 | }, 207 | "patterns": [ 208 | { 209 | "include": "#constraint_list" 210 | } 211 | ] 212 | }, 213 | { 214 | "name": "meta.struct.pdl", 215 | "begin": "(struct)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(\\{)", 216 | "beginCaptures": { 217 | "1": { 218 | "name": "storage.type.struct.pdl" 219 | }, 220 | "2": { 221 | "name": "entity.name.type.struct.pdl" 222 | }, 223 | "3": { 224 | "name": "punctuation.section.braces.begin.pdl" 225 | } 226 | }, 227 | "end": "(\\})", 228 | "endCaptures": { 229 | "1": { 230 | "name": "punctuation.section.braces.end.pdl" 231 | } 232 | }, 233 | "patterns": [ 234 | { 235 | "include": "#field_list" 236 | } 237 | ] 238 | }, 239 | { 240 | "name": "meta.struct.pdl", 241 | "begin": "(struct)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(:)\\s*([a-zA-Z][a-zA-Z0-9_]*)\\s*(\\{)", 242 | "beginCaptures": { 243 | "1": { 244 | "name": "storage.type.struct.pdl" 245 | }, 246 | "2": { 247 | "name": "entity.name.type.struct.pdl" 248 | }, 249 | "3": { 250 | "name": "punctuation.separator.pdl" 251 | }, 252 | "4": { 253 | "name": "entity.name.pdl" 254 | }, 255 | "5": { 256 | "name": "punctuation.section.braces.begin.pdl" 257 | } 258 | }, 259 | "end": "(\\})", 260 | "endCaptures": { 261 | "1": { 262 | "name": "punctuation.section.braces.end.pdl" 263 | } 264 | }, 265 | "patterns": [ 266 | { 267 | "include": "#field_list" 268 | } 269 | ] 270 | }, 271 | { 272 | "name": "meta.struct.pdl", 273 | "begin": "(struct)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(:)\\s*([a-zA-Z][a-zA-Z0-9_]*)\\s*(\\()", 274 | "beginCaptures": { 275 | "1": { 276 | "name": "storage.type.struct.pdl" 277 | }, 278 | "2": { 279 | "name": "entity.name.type.struct.pdl" 280 | }, 281 | "3": { 282 | "name": "punctuation.separator.pdl" 283 | }, 284 | "4": { 285 | "name": "entity.name.pdl" 286 | }, 287 | "5": { 288 | "name": "punctuation.begin.pdl" 289 | } 290 | }, 291 | "end": "(\\))", 292 | "endCaptures": { 293 | "1": { 294 | "name": "punctuation.section.braces.end.pdl" 295 | } 296 | }, 297 | "patterns": [ 298 | { 299 | "include": "#constraint_list" 300 | } 301 | ] 302 | }, 303 | { 304 | "begin": "(\\{)", 305 | "beginCaptures": { 306 | "1": { 307 | "name": "punctuation.begin.pdl" 308 | } 309 | }, 310 | "end": "(\\})", 311 | "endCaptures": { 312 | "1": { 313 | "name": "punctuation.section.braces.end.pdl" 314 | } 315 | }, 316 | "patterns": [ 317 | { 318 | "include": "#field_list" 319 | } 320 | ] 321 | }, 322 | { 323 | "name": "meta.group.pdl", 324 | "begin": "(group)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(\\{)", 325 | "beginCaptures": { 326 | "1": { 327 | "name": "storage.type.group.pdl" 328 | }, 329 | "2": { 330 | "name": "entity.name.type.group.pdl" 331 | }, 332 | "3": { 333 | "name": "punctuation.section.braces.begin.pdl" 334 | } 335 | }, 336 | "end": "(\\})", 337 | "endCaptures": { 338 | "1": { 339 | "name": "punctuation.section.braces.end.pdl" 340 | } 341 | }, 342 | "patterns": [ 343 | { 344 | "include": "#field_list" 345 | } 346 | ] 347 | }, 348 | { 349 | "name": "meta.checksum.pdl", 350 | "match": "(checksum)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(:)\\s*([0-9]+)\\s*(\")([^\\\"]*)(\")", 351 | "captures": { 352 | "1": { 353 | "name": "storage.type.checksum.pdl" 354 | }, 355 | "2": { 356 | "name": "entity.name.type.checksum.pdl" 357 | }, 358 | "3": { 359 | "name": "punctuation.separator.pdl" 360 | }, 361 | "4": { 362 | "name": "constant.numeric.decimal.pdl" 363 | }, 364 | "5": { 365 | "name": "punctuation.definition.string.begin.aidl" 366 | }, 367 | "6": { 368 | "name": "string.quoted.double.aidl" 369 | }, 370 | "7": { 371 | "name": "punctuation.definition.string.end.aidl" 372 | } 373 | } 374 | }, 375 | { 376 | "name": "meta.checksum.pdl", 377 | "match": "(checksum)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(:)\\s*(0[xX][0-9a-fA-F]+)\\s*(\")([^\\\"]*)(\")", 378 | "captures": { 379 | "1": { 380 | "name": "storage.type.checksum.pdl" 381 | }, 382 | "2": { 383 | "name": "entity.name.type.checksum.pdl" 384 | }, 385 | "3": { 386 | "name": "punctuation.separator.pdl" 387 | }, 388 | "4": { 389 | "name": "constant.numeric.hex.pdl" 390 | }, 391 | "5": { 392 | "name": "punctuation.definition.string.begin.aidl" 393 | }, 394 | "6": { 395 | "name": "string.quoted.double.aidl" 396 | }, 397 | "7": { 398 | "name": "punctuation.definition.string.end.aidl" 399 | } 400 | } 401 | }, 402 | { 403 | "name": "meta.custom_field.pdl", 404 | "match": "(custom_field)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(\")([^\\\"]*)(\")", 405 | "captures": { 406 | "1": { 407 | "name": "storage.type.custom_field.pdl" 408 | }, 409 | "2": { 410 | "name": "entity.name.type.custom_field.pdl" 411 | }, 412 | "3": { 413 | "name": "punctuation.definition.string.begin.aidl" 414 | }, 415 | "4": { 416 | "name": "string.quoted.double.aidl" 417 | }, 418 | "5": { 419 | "name": "punctuation.definition.string.end.aidl" 420 | } 421 | } 422 | }, 423 | { 424 | "name": "meta.custom_field.pdl", 425 | "match": "(custom_field)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(:)\\s*([0-9]+)\\s*(\")([^\\\"]*)(\")", 426 | "captures": { 427 | "1": { 428 | "name": "storage.type.custom_field.pdl" 429 | }, 430 | "2": { 431 | "name": "entity.name.type.custom_field.pdl" 432 | }, 433 | "3": { 434 | "name": "punctuation.separator.pdl" 435 | }, 436 | "4": { 437 | "name": "constant.numeric.decimal.pdl" 438 | }, 439 | "5": { 440 | "name": "punctuation.definition.string.begin.aidl" 441 | }, 442 | "6": { 443 | "name": "string.quoted.double.aidl" 444 | }, 445 | "7": { 446 | "name": "punctuation.definition.string.end.aidl" 447 | } 448 | } 449 | }, 450 | { 451 | "name": "meta.custom_field.pdl", 452 | "match": "(custom_field)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(:)\\s*(0[xX][0-9a-fA-F]+)\\s*(\")([^\\\"]*)(\")", 453 | "captures": { 454 | "1": { 455 | "name": "storage.type.custom_field.pdl" 456 | }, 457 | "2": { 458 | "name": "entity.name.type.custom_field.pdl" 459 | }, 460 | "3": { 461 | "name": "punctuation.separator.pdl" 462 | }, 463 | "4": { 464 | "name": "constant.numeric.hex.pdl" 465 | }, 466 | "5": { 467 | "name": "punctuation.definition.string.begin.aidl" 468 | }, 469 | "6": { 470 | "name": "string.quoted.double.aidl" 471 | }, 472 | "7": { 473 | "name": "punctuation.definition.string.end.aidl" 474 | } 475 | } 476 | }, 477 | { 478 | "name": "meta.test.pdl", 479 | "begin": "(test)\\s+([a-zA-Z][a-zA-Z0-9_]*)\\s*(\\{)", 480 | "beginCaptures": { 481 | "1": { 482 | "name": "storage.type.enum.pdl" 483 | }, 484 | "2": { 485 | "name": "entity.name.type.enum.pdl" 486 | }, 487 | "3": { 488 | "name": "punctuation.section.braces.begin.pdl" 489 | } 490 | }, 491 | "end": "(\\})", 492 | "endCaptures": { 493 | "1": { 494 | "name": "punctuation.section.braces.end.pdl" 495 | } 496 | }, 497 | "patterns": [ 498 | { 499 | "include": "#test_case_list" 500 | } 501 | ] 502 | } 503 | ] 504 | }, 505 | "enum_body": { 506 | "patterns": [ 507 | { 508 | "include": "#comments" 509 | }, 510 | { 511 | "include": "#enum_body_inner" 512 | }, 513 | { 514 | "begin": "(\\{)", 515 | "beginCaptures": { 516 | "1": { 517 | "name": "punctuation.section.braces.begin.pdl" 518 | } 519 | }, 520 | "end": "(\\})", 521 | "endCaptures": { 522 | "1": { 523 | "name": "punctuation.section.braces.end.pdl" 524 | } 525 | }, 526 | "patterns": [ 527 | { 528 | "include": "#enum_body_inner" 529 | } 530 | ] 531 | } 532 | ] 533 | }, 534 | "enum_body_inner": { 535 | "patterns": [ 536 | { 537 | "include": "#comments" 538 | }, 539 | { 540 | "match": "=", 541 | "name": "keyword.operator.assignment.pdl" 542 | }, 543 | { 544 | "include": "#integer" 545 | }, 546 | { 547 | "match": ",", 548 | "name": "punctuation.separator.pdl" 549 | }, 550 | { 551 | "match": "[a-zA-Z][a-zA-Z0-9_]*", 552 | "name": "entity.name.constant.pdl" 553 | } 554 | ] 555 | }, 556 | "field_list": { 557 | "patterns": [ 558 | { 559 | "include": "#comments" 560 | }, 561 | { 562 | "match": "[:,]", 563 | "name": "punctuation.separator.pdl" 564 | }, 565 | { 566 | "begin": "(\\[)", 567 | "beginCaptures": { 568 | "1": { 569 | "name": "punctuation.begin.pdl" 570 | } 571 | }, 572 | "end": "(\\])", 573 | "endCaptures": { 574 | "1": { 575 | "name": "punctuation.section.braces.end.pdl" 576 | } 577 | }, 578 | "patterns": [ 579 | { 580 | "include": "#field_size" 581 | } 582 | ] 583 | }, 584 | { 585 | "begin": "(\\{)", 586 | "beginCaptures": { 587 | "1": { 588 | "name": "punctuation.section.braces.begin.pdl" 589 | } 590 | }, 591 | "end": "(\\})", 592 | "endCaptures": { 593 | "1": { 594 | "name": "punctuation.section.braces.end.pdl" 595 | } 596 | }, 597 | "patterns": [ 598 | { 599 | "include": "#constraint_list" 600 | } 601 | ] 602 | }, 603 | { 604 | "begin": "(\\()", 605 | "beginCaptures": { 606 | "1": { 607 | "name": "punctuation.begin.pdl" 608 | } 609 | }, 610 | "end": "(\\))", 611 | "endCaptures": { 612 | "1": { 613 | "name": "punctuation.end.pdl" 614 | } 615 | }, 616 | "patterns": [ 617 | { 618 | "include": "#field_parentheses" 619 | } 620 | ] 621 | }, 622 | { 623 | "match": "(_body_|_size_|_count_|_payload_|_fixed_|_checksum_start_|_padding_|_reserved_)", 624 | "name": "keyword.pdl" 625 | }, 626 | { 627 | "include": "#identifier" 628 | }, 629 | { 630 | "include": "#integer" 631 | }, 632 | { 633 | "match": "([^\\s])", 634 | "name": "invalid.illegal.pdl" 635 | } 636 | ] 637 | }, 638 | "field_parentheses": { 639 | "patterns": [ 640 | { 641 | "match": ":", 642 | "name": "punctuation.separator.pdl" 643 | }, 644 | { 645 | "match": "(_payload_|_body_)", 646 | "name": "keyword.pdl" 647 | }, 648 | { 649 | "include": "#identifier" 650 | }, 651 | { 652 | "include": "#integer" 653 | }, 654 | { 655 | "match": "([^\\s])", 656 | "name": "invalid.illegal.pdl" 657 | } 658 | ] 659 | }, 660 | "field_size": { 661 | "patterns": [ 662 | { 663 | "match": "(\\+)\\s*([0-9]+)", 664 | "captures": { 665 | "1": { 666 | "name": "keyword.operator.arithmetic.pdl" 667 | }, 668 | "2": { 669 | "name": "constant.numeric.decimal.pdl" 670 | } 671 | } 672 | }, 673 | { 674 | "include": "#integer" 675 | }, 676 | { 677 | "match": "([^\\s])", 678 | "name": "invalid.illegal.pdl" 679 | } 680 | ] 681 | }, 682 | "constraint_list": { 683 | "patterns": [ 684 | { 685 | "match": ",", 686 | "name": "punctuation.separator.pdl" 687 | }, 688 | { 689 | "match": "=", 690 | "name": "punctuation.pdl" 691 | }, 692 | { 693 | "include": "#integer" 694 | }, 695 | { 696 | "include": "#identifier" 697 | } 698 | ] 699 | }, 700 | "test_case_list": { 701 | "patterns": [ 702 | { 703 | "match": ",", 704 | "name": "punctuation.separator.pdl" 705 | }, 706 | { 707 | "include": "#string" 708 | }, 709 | { 710 | "match": "([^\\s])", 711 | "name": "invalid.illegal.pdl" 712 | } 713 | ] 714 | }, 715 | "identifier": { 716 | "patterns": [ 717 | { 718 | "match": "[a-zA-Z][a-zA-Z0-9_]*", 719 | "name": "entity.name.pdl" 720 | } 721 | ] 722 | }, 723 | "integer": { 724 | "patterns": [ 725 | { 726 | "match": "0[xX][0-9a-fA-F]+", 727 | "name": "constant.numeric.hex.pdl" 728 | }, 729 | { 730 | "match": "[0-9]+", 731 | "name": "constant.numeric.decimal.pdl" 732 | } 733 | ] 734 | }, 735 | "string": { 736 | "patterns": [ 737 | { 738 | "match": "(\")([^\\\"]*)(\")", 739 | "captures": { 740 | "1": { 741 | "name": "punctuation.definition.string.begin.aidl" 742 | }, 743 | "2": { 744 | "name": "string.quoted.double.aidl" 745 | }, 746 | "3": { 747 | "name": "punctuation.definition.string.end.aidl" 748 | } 749 | } 750 | } 751 | ] 752 | }, 753 | "multi_line_comment": { 754 | "patterns": [ 755 | { 756 | "begin": "(/\\*\\*)", 757 | "beginCaptures": { 758 | "1": { 759 | "name": "punctuation.definition.comment.aidl" 760 | } 761 | }, 762 | "name": "comment.block.documentation.aidl", 763 | "end": "(\\*/)", 764 | "endCaptures": { 765 | "1": { 766 | "name": "punctuation.definition.comment.aidl" 767 | } 768 | } 769 | }, 770 | { 771 | "begin": "(/\\*)", 772 | "beginCaptures": { 773 | "1": { 774 | "name": "punctuation.definition.comment.aidl" 775 | } 776 | }, 777 | "name": "comment.block.aidl", 778 | "end": "(\\*/)", 779 | "endCaptures": { 780 | "1": { 781 | "name": "punctuation.definition.comment.aidl" 782 | } 783 | } 784 | } 785 | ] 786 | } 787 | } 788 | } 789 | --------------------------------------------------------------------------------