Set encoding for rpm-spec.sublime-syntax

This commit is contained in:
Anton Novojilov 2018-11-12 02:52:10 +03:00
commit c6a45ea904

View file

@ -1,137 +1,137 @@
%YAML 1.2 %YAML 1.2
--- ---
# http://www.sublimetext.com/docs/3/syntax.html # http://www.sublimetext.com/docs/3/syntax.html
name: RPM Spec name: RPM Spec
file_extensions: file_extensions:
- spec - spec
- .rpmmacros - .rpmmacros
first_line_match: "-[*]-( Mode:)? RPM Spec -[*]-" first_line_match: "-[*]-( Mode:)? RPM Spec -[*]-"
scope: source.spec scope: source.spec
contexts: contexts:
main: main:
- include: comments - include: comments
- include: string - include: string
- include: macro - include: macro
- include: definition - include: definition
- include: bash-variable - include: bash-variable
- include: keyword - include: keyword
- include: scriplet - include: scriplet
- include: function - include: function
- include: directive - include: directive
- include: changelog - include: changelog
macro: macro:
- match: (\%\{)([a-zA-Z_0-9 ?:!_-]{1,})(\}) - match: (\%\{)([a-zA-Z_0-9 ?:!_-]{1,})(\})
captures: captures:
0: variable.other.spec 0: variable.other.spec
1: variable.other.name.spec 1: variable.other.name.spec
string: string:
- match: '"' - match: '"'
scope: punctuation.definition.string.begin.spec scope: punctuation.definition.string.begin.spec
push: push:
- meta_scope: string.quoted.double.spec - meta_scope: string.quoted.double.spec
- match: '"' - match: '"'
scope: punctuation.definition.string.end.spec scope: punctuation.definition.string.end.spec
pop: true pop: true
- include: string-placeholder - include: string-placeholder
- include: string-escaped-char - include: string-escaped-char
- match: "'" - match: "'"
scope: punctuation.definition.string.begin.spec scope: punctuation.definition.string.begin.spec
push: push:
- meta_scope: string.quoted.single.spec - meta_scope: string.quoted.single.spec
- match: "'" - match: "'"
scope: punctuation.definition.string.end.spec scope: punctuation.definition.string.end.spec
pop: true pop: true
- include: string-placeholder - include: string-placeholder
- include: string-escaped-char - include: string-escaped-char
bash-variable: bash-variable:
- match: \$([a-zA-Z_0-9])*\b - match: \$([a-zA-Z_0-9])*\b
scope: variable.other.bash scope: variable.other.bash
keyword: keyword:
- match: \%(ifarch|then|fi|endif|elif|else|if)\b - match: \%(ifarch|then|fi|endif|elif|else|if)\b
scope: keyword.control.conditional.spec scope: keyword.control.conditional.spec
- match: '\b([0-9]+\.[0-9]*|\.[0-9]+)([eE][+-]?\d+)?\b' - match: '\b([0-9]+\.[0-9]*|\.[0-9]+)([eE][+-]?\d+)?\b'
scope: constant.numeric.float.decimal.spec scope: constant.numeric.float.decimal.spec
- match: '\b\d+\b' - match: '\b\d+\b'
scope: constant.numeric.integer.decimal.spec scope: constant.numeric.integer.decimal.spec
- match: '^[ \t]{0,}(cat|chmod|chown|cmake|cp|echo|exit|export|find|git|getent|groupadd|install|make|mkdir|ln|mv|patch|popd|pushd|rm|sed|service|svn|systemctl|touch|useradd)' - match: '^[ \t]{0,}(cat|chmod|chown|cmake|cp|echo|exit|export|find|git|getent|groupadd|install|make|mkdir|ln|mv|patch|popd|pushd|rm|sed|service|svn|systemctl|touch|useradd)'
scope: variable.function.spec scope: variable.function.spec
- match: \b(if|else|fi||elif|then|while|do|done)\b - match: \b(if|else|fi||elif|then|while|do|done)\b
scope: keyword.other scope: keyword.other
- match: (&1>|&2>|&>|&>>|1>|2>) - match: (&1>|&2>|&>|&>>|1>|2>)
scope: keyword.operator scope: keyword.operator
scriplet: scriplet:
- match: '\%(package|description|prep|setup|build|install|files|clean|pretrans|posttrans|preun|postun|changelog|post|pre|check|triggerun|triggerin|triggerpostun|verifyscript) ?(-[a-z]{1,4})? ?([a-zA-Z_\-0-9\.]*)?' - match: '\%(package|description|prep|setup|build|install|files|clean|pretrans|posttrans|preun|postun|changelog|post|pre|check|triggerun|triggerin|triggerpostun|verifyscript) ?(-[a-z]{1,4})? ?([a-zA-Z_\-0-9\.]*)?'
captures: captures:
0: keyword.other.spec 0: keyword.other.spec
1: keyword.other.name.spec 1: keyword.other.name.spec
2: keyword.other.options.spec 2: keyword.other.options.spec
3: keyword.other.target.spec 3: keyword.other.target.spec
function: function:
- match: \%(defattr|attr|dir|config|ghost|doc|verify|exclude)\b - match: \%(defattr|attr|dir|config|ghost|doc|verify|exclude)\b
scope: support.function.spec scope: support.function.spec
definition: definition:
- match: '(\%define|\%global) +([\d\w\S]+)' - match: '(\%define|\%global) +([\d\w\S]+)'
captures: captures:
0: spec.definition 0: spec.definition
1: support.function.spec 1: support.function.spec
2: entity.name.type 2: entity.name.type
directive: directive:
- match: '^(Summary|Name|Version|Release|Group|License|URL|Epoch|Source[0-9]{0,9}|Patch[0-9]{0,9}|Build(Root|Requires|Conflicts|PreReq)|Requires|Requires\(.*\)|Provides|Obsoletes|Conflicts|Vendor|BuildArch|ExclusiveArch|Auto(Req|ReqProv|Prov)|Recommends|Suggests|Packager):' - match: '^(Summary|Name|Version|Release|Group|License|URL|Epoch|Source[0-9]{0,9}|Patch[0-9]{0,9}|Build(Root|Requires|Conflicts|PreReq)|Requires|Requires\(.*\)|Provides|Obsoletes|Conflicts|Vendor|BuildArch|ExclusiveArch|Auto(Req|ReqProv|Prov)|Recommends|Suggests|Packager):'
scope: support.directive.spec scope: support.directive.spec
changelog: changelog:
- match: (\*) +([a-zA-Z]{3} +[a-zA-Z]{3} +[0-9]{1,2} +[0-9]{4}) +([^<]+)([^ ]+)?(?>[ \-]+)(.*) - match: (\*) +([a-zA-Z]{3} +[a-zA-Z]{3} +[0-9]{1,2} +[0-9]{4}) +([^<]+)([^ ]+)?(?>[ \-]+)(.*)
captures: captures:
0: spec.changelog.header 0: spec.changelog.header
1: spec.changelog.header.bullet 1: spec.changelog.header.bullet
2: spec.changelog.header.date 2: spec.changelog.header.date
3: spec.changelog.header.author 3: spec.changelog.header.author
4: spec.changelog.header.mail 4: spec.changelog.header.mail
5: spec.changelog.header.version 5: spec.changelog.header.version
set: changelog-comment set: changelog-comment
changelog-comment: changelog-comment:
- match: '^([- ])?.*' - match: '^([- ])?.*'
captures: captures:
0: spec.changelog.comment 0: spec.changelog.comment
1: spec.changelog.comment.bullet 1: spec.changelog.comment.bullet
- match: '^ ?$' - match: '^ ?$'
pop: true pop: true
comments: comments:
- match: (?=^\s*#) - match: (?=^\s*#)
push: push:
- match: \# - match: \#
scope: punctuation.definition.comment.spec scope: punctuation.definition.comment.spec
set: set:
- meta_scope: comment.line.number-sign.spec - meta_scope: comment.line.number-sign.spec
- include: pop-on-line-end - include: pop-on-line-end
- match: \# - match: \#
scope: punctuation.definition.comment.spec scope: punctuation.definition.comment.spec
push: push:
- meta_scope: comment.line.number-sign.spec - meta_scope: comment.line.number-sign.spec
- include: pop-on-line-end - include: pop-on-line-end
pop-on-line-end: pop-on-line-end:
- match: $ - match: $
pop: true pop: true
string-placeholder: string-placeholder:
- match: |- - match: |-
(?x)% (?x)%
[#0\- +']* # flags [#0\- +']* # flags
(\[\d+\])? # field (argument #) (\[\d+\])? # field (argument #)
[,;:_]? # separator character (AltiVec) [,;:_]? # separator character (AltiVec)
((-?\d+)|(\[\d+\])?\*)? # minimum field width ((-?\d+)|(\[\d+\])?\*)? # minimum field width
(\.((-?\d+)|(\[\d+\])?\*)?)? # precision (\.((-?\d+)|(\[\d+\])?\*)?)? # precision
[diouxXDOUeEfFgGaAcCsSpqnvtTbyYhHmMzZ%] # conversion type [diouxXDOUeEfFgGaAcCsSpqnvtTbyYhHmMzZ%] # conversion type
scope: constant.other.placeholder.spec scope: constant.other.placeholder.spec