Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Prolog syntax highlighting #2848

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,6 @@
[submodule "assets/syntaxes/02_Extra/vscode-wgsl"]
path = assets/syntaxes/02_Extra/vscode-wgsl
url = https://github.com/PolyMeilex/vscode-wgsl.git
[submodule "assets/syntaxes/02_Extra/Prolog"]
path = assets/syntaxes/02_Extra/Prolog
url = https://github.com/alnkpa/sublimeprolog
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
- Added auto detect syntax for `.jsonc` #2795 (@mxaddict)
- Added auto detect syntax for `.aws/{config,credentials}` #2795 (@mxaddict)
- Add syntax mapping for Wireguard config #2874 (@cyqsimon)
- Add Prolog syntax, see #2848 (@laalsaas)

## Themes

Expand Down
1 change: 1 addition & 0 deletions assets/syntaxes/02_Extra/Prolog
Submodule Prolog added at 9e8e14
137 changes: 137 additions & 0 deletions assets/syntaxes/02_Extra/Prolog.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: SWI-Prolog
comment: This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
file_extensions:
- pro
- prolog
- swiplrc
scope: source.prolog
contexts:
main:
- include: comments
- match: (?<=:-)\s*
push:
- meta_scope: meta.clause.body.prolog
- match: (\.)
captures:
1: keyword.control.clause.bodyend.prolog
pop: true
- include: comments
- include: builtin
- include: controlandkeywords
- include: atom
- include: variable
- include: constants
- match: .
scope: meta.clause.body.prolog
- match: '^\s*([a-z][a-zA-Z0-9_]*)(\(?)(?=.*:-.*)'
captures:
1: entity.name.function.clause.prolog
2: punctuation.definition.parameters.begin
push:
- meta_scope: meta.clause.head.prolog
- match: ((\)?))\s*(:-)
captures:
1: punctuation.definition.parameters.end
3: keyword.control.clause.bodybegin.prolog
pop: true
- include: atom
- include: variable
- include: constants
- match: '^\s*([a-z][a-zA-Z0-9_]*)(\(?)(?=.*-->.*)'
captures:
1: entity.name.function.dcg.prolog
2: punctuation.definition.parameters.begin
push:
- meta_scope: meta.dcg.head.prolog
- match: ((\)?))\s*(-->)
captures:
1: punctuation.definition.parameters.end
3: keyword.control.dcg.bodybegin.prolog
pop: true
- include: atom
- include: variable
- include: constants
- match: (?<=-->)\s*
push:
- meta_scope: meta.dcg.body.prolog
- match: (\.)
captures:
1: keyword.control.dcg.bodyend.prolog
pop: true
- include: comments
- include: controlandkeywords
- include: atom
- include: variable
- include: constants
- match: .
scope: meta.dcg.body.prolog
- match: '^\s*([a-zA-Z][a-zA-Z0-9_]*)(\(?)(?!.*(:-|-->).*)'
captures:
1: entity.name.function.fact.prolog
2: punctuation.definition.parameters.begin
push:
- meta_scope: meta.fact.prolog
- match: ((\)?))\s*(\.)(?!\d+)
captures:
1: punctuation.definition.parameters.end
3: keyword.control.fact.end.prolog
pop: true
- include: atom
- include: variable
- include: constants
atom:
- match: '(?<![a-zA-Z0-9_])[a-z][a-zA-Z0-9_]*(?!\s*\(|[a-zA-Z0-9_])'
scope: constant.other.atom.simple.prolog
- match: "'.*?'"
scope: constant.other.atom.quoted.prolog
- match: '\[\]'
scope: constant.other.atom.emptylist.prolog
builtin:
- match: \b(op|findall|write|nl|writeln|fail|use_module|module)\b
scope: keyword.other
comments:
- match: "%.*"
scope: comment.line.percent-sign.prolog
- match: /\*
captures:
0: punctuation.definition.comment.prolog
push:
- meta_scope: comment.block.prolog
- match: \*/
captures:
0: punctuation.definition.comment.prolog
pop: true
constants:
- match: '(?<![a-zA-Z]|/)(\d+|(\d+\.\d+))'
scope: constant.numeric.integer.prolog
- match: '".*?"'
scope: string.quoted.double.prolog
controlandkeywords:
- match: (->)
captures:
1: keyword.control.if.prolog
push:
- meta_scope: meta.if.prolog
- match: (;)
captures:
1: keyword.control.else.prolog
pop: true
- include: main
- include: builtin
- include: comments
- include: atom
- include: variable
- match: .
scope: meta.if.body.prolog
- match: "!"
scope: keyword.control.cut.prolog
- match: (\s(is)\s)|=:=|=?\\?=|\\\+|@?>|@?=?<|\+|\*|\-
scope: keyword.operator.prolog
variable:
- match: "(?<![a-zA-Z0-9_])[_A-Z][a-zA-Z0-9_]*"
scope: variable.parameter.uppercase.prolog
- match: (?<!\w)_
scope: variable.language.anonymous.prolog
4 changes: 3 additions & 1 deletion doc/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ in the `.sublime-syntax` format.

2. If the Sublime Text syntax is only available as a `.tmLanguage` file, open the file in
Sublime Text and convert it to a `.sublime-syntax` file via *Tools* -> *Developer* ->
*New Syntax from XXX.tmLanguage...*. Save the new file in the `assets/syntaxes` folder.
*New Syntax from XXX.tmLanguage...*. Alternatively, you can use the
[Sublime Syntax Convertor](https://github.com/aziz/SublimeSyntaxConvertor).
Save the new file in the `assets/syntaxes` folder.
If only `.tmLanguage.json` or `.tmLanguage.yml` file is available, use
[PackageDev](https://packagecontrol.io/packages/PackageDev) to convert it to `.tmLanguage.plist`
format and then rename the converted file to `.tmLanguage` file.
Expand Down
3 changes: 3 additions & 0 deletions src/assets/build_assets/acknowledgements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ fn include_license_in_acknowledgments(license_text: &str) -> bool {
// Apache 2.0
"Apache License Version 2.0, January 2004 http://www.apache.org/licenses/",
"Licensed under the Apache License, Version 2.0 (the \"License\");",

// MPL
"Mozilla Public License, version 2.0",
];

license_contains_marker(license_text, &markers)
Expand Down
Loading
Loading