diff --git a/.github/workflows/syntax.yml b/.github/workflows/syntax.yml index a3d4f51..6653c88 100644 --- a/.github/workflows/syntax.yml +++ b/.github/workflows/syntax.yml @@ -28,8 +28,8 @@ jobs: packages: master - build: 'stable' packages: binary - - build: 4185 # Required for symbol transformation tests - packages: v4193 # Bash rewrite + - build: 4194 # Required for variables in first_line_match + packages: binary steps: - uses: actions/checkout@v4 - uses: SublimeText/syntax-test-action@v2 diff --git a/syntax/PEM.sublime-syntax b/syntax/PEM.sublime-syntax index 1b6a66a..ba0f5bc 100644 --- a/syntax/PEM.sublime-syntax +++ b/syntax/PEM.sublime-syntax @@ -25,44 +25,12 @@ hidden_file_extensions: - id_eddsa - id_rsa -first_line_match: |- - ^(?x: - (-{4}[ -]) - BEGIN [ ] - ( (?:[0-9A-Z -]+[ ])? (?: PUBLIC | PRIVATE ) [ ] KEY - | (?:[0-9A-Z -]+[ ])? CERTIFICATE (?:[ ] REQUEST )? - | (?:[0-9A-Z -]+[ ])? PARAMETERS - | X509 [ ] CRL - | PKCS7 - | PKCS [ ] \#7 [ ] SIGNED [ ] DATA - | CMS - | PGP [ ] MESSAGE (?:,[ ] PART [ ] \d+(?:/\d+)?)? - | PGP [ ] (?: PUBLIC | PRIVATE ) [ ] KEY [ ] BLOCK - | PGP [ ] SIGNATURE - ) - ([ -]-{4}) - ) +first_line_match: '{{first_line_match}}' contexts: main: - include: comments-number-sign - - match: |- - ^(?x: - (-{4}[ -]) - BEGIN [ ] - ( (?:[0-9A-Z -]+[ ])? (?: PUBLIC | PRIVATE ) [ ] KEY - | (?:[0-9A-Z -]+[ ])? CERTIFICATE (?:[ ] REQUEST )? - | (?:[0-9A-Z -]+[ ])? PARAMETERS - | X509 [ ] CRL - | PKCS7 - | PKCS [ ] \#7 [ ] SIGNED [ ] DATA - | CMS - | PGP [ ] MESSAGE (?:,[ ] PART [ ] \d+(?:/\d+)?)? - | PGP [ ] (?: PUBLIC | PRIVATE ) [ ] KEY [ ] BLOCK - | PGP [ ] SIGNATURE - ) - ([ -]-{4}) - ) + - match: '{{first_line_match}}' scope: punctuation.section.block.begin.pem push: pem-key - include: setext-headings @@ -146,3 +114,24 @@ contexts: not-heading: - match: '' pop: 1 + +############################################################################### + +variables: + first_line_match: |- + ^(?x: + (-{4}[ -]) + BEGIN [ ] + ( (?:[0-9A-Z -]+[ ])? (?: PUBLIC | PRIVATE ) [ ] KEY + | (?:[0-9A-Z -]+[ ])? CERTIFICATE (?:[ ] REQUEST )? + | (?:[0-9A-Z -]+[ ])? PARAMETERS + | X509 [ ] CRL + | PKCS7 + | PKCS [ ] \#7 [ ] SIGNED [ ] DATA + | CMS + | PGP [ ] MESSAGE (?:,[ ] PART [ ] \d+(?:/\d+)?)? + | PGP [ ] (?: PUBLIC | PRIVATE ) [ ] KEY [ ] BLOCK + | PGP [ ] SIGNATURE + ) + ([ -]-{4}) + )