Skip to content

Commit

Permalink
feat: add pascal/delphi syntax highlighting support
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Apr 5, 2024
1 parent 02fa3f6 commit 337ef9a
Show file tree
Hide file tree
Showing 9 changed files with 695 additions and 15 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ This [EclipseⓇ](https://eclipse.org) plug-in adds syntax highlighting support
- NginX (`nginx.conf`) - https://www.nginx.com/
- Nushell (`*.nu`) - https://github.com/nushell/nushell
- PlantUML (`*.pu`) - https://plantuml.com/
- Pascal (`*.pas`) - https://en.wikipedia.org/wiki/Pascal_(programming_language)
- Prisma - https://www.prisma.io/
- Svelte - https://svelte.dev/
- TOML - https://toml.io/en/
Expand Down Expand Up @@ -83,11 +84,11 @@ To install the plugin into an existing Eclipse installation do:
| Apache HTTP Config <img src="plugin/syntaxes/apache-http/icon.png" width=16/> | file-extensions="conf, htaccess, htgroups, htpasswd" | [master@mrmlnc/vscode-apache](https://github.com/mrmlnc/vscode-apache/tree/0585b0bb3d390fc541aa27cfcfb83b3204156be3/)
| Astro <img src="plugin/syntaxes/astro/icon.png" width=16/> | file-extensions="astro" | [main@withastro/language-tools](https://github.com/withastro/language-tools/tree/0503392b80765c8a1292ddc9c063a1187425c187/packages/vscode)
| Entity Relationship <img src="plugin/syntaxes/er/icon.png" width=16/> | file-extensions="er" | [master@mikkel-ol/vsc-er-syntax-highlighting](https://github.com/mikkel-ol/vsc-er-syntax-highlighting/tree/160f6061a525858e4a17df97a4e3b51d0ff9c1bd/)
| GraphQL <img src="plugin/syntaxes/graphql/icon.png" width=16/> | file-extensions="gql, graphql, graphqls" | [main@graphql/graphiql](https://github.com/graphql/graphiql/tree/fc7de5a75f4b23dd62dd630b705895b5fa5d0a03/packages/vscode-graphql-syntax)
| GraphQL <img src="plugin/syntaxes/graphql/icon.png" width=16/> | file-extensions="gql, graphql, graphqls" | [main@graphql/graphiql](https://github.com/graphql/graphiql/tree/5d05105469c3f0cbeb5e294da1cf6ff2355e4eb5/packages/vscode-graphql-syntax)
| GraphViz DOT File | file-extensions="dot" | [master@textmate/graphviz.tmbundle](https://github.com/textmate/graphviz.tmbundle/tree/d1d489f893a0e6ef5d9021bf7dc1ffd08b3f9b90/Syntaxes)
| HashiCorp Sentinel | file-extensions="sentinel" | [main@hashicorp/syntax](https://github.com/hashicorp/syntax/tree/0fd4ee6911c847a7e7d0bad3f0f728d0e58414bc/)
| HashiCorp Terraform | file-extensions="tf, tfvars" | [main@hashicorp/syntax](https://github.com/hashicorp/syntax/tree/0fd4ee6911c847a7e7d0bad3f0f728d0e58414bc/)
| Haxe Source File | file-extensions="hx" | [master@vshaxe/haxe-TmLanguage](https://github.com/vshaxe/haxe-TmLanguage/tree/b3cb0d3a6835938603d006fce402205fa16c11dd/)
| Haxe | file-extensions="hx" | [master@vshaxe/haxe-TmLanguage](https://github.com/vshaxe/haxe-TmLanguage/tree/b3cb0d3a6835938603d006fce402205fa16c11dd/)
| HCL Config File | file-extensions="hcl" | [main@hashicorp/syntax](https://github.com/hashicorp/syntax/tree/0fd4ee6911c847a7e7d0bad3f0f728d0e58414bc/)
| helm-template <img src="plugin/syntaxes/helm/icon.png" width=16/> | file-patterns="\*\*/templates/\*\*/\*.tpl, \*\*/templates/\*\*/\*.yaml, \*\*/templates/\*\*/\*.yml, \*\*/templates/\*.tpl, \*\*/templates/\*.yaml, \*\*/templates/\*.yml" | [master@vscode-kubernetes-tools/vscode-kubernetes-tools](https://github.com/vscode-kubernetes-tools/vscode-kubernetes-tools/tree/14ed5ac64e0c444f17bfb3ab75593ef679975ccf/)
| Jinja C++ <img src="plugin/syntaxes/jinja/icon.png" width=16/> | file-extensions="c.j2, c.jinja, c.jinja2, cpp.j2, cpp.jinja, cpp.jinja2, h.j2, h.jinja, h.jinja2" | [main@samuelcolvin/jinjahtml-vscode](https://github.com/samuelcolvin/jinjahtml-vscode/tree/d8daf5fd43941deec8803be2335b35922e3e1eeb/)
Expand Down Expand Up @@ -125,10 +126,11 @@ To install the plugin into an existing Eclipse installation do:
| NGINX Conf <img src="plugin/syntaxes/nginx/icon.png" width=16/> | file-extensions="conf, conf.default, conf.template, fastcgi_params, mime.types, nginx, nginx.conf, scgi_params, uwsgi_params" | [main@ahmadalli/vscode-nginx-conf](https://github.com/ahmadalli/vscode-nginx-conf/tree/10414d948cc5e52fbf2a8207629427d4ae3bc8c4/)
| nushell <img src="plugin/syntaxes/nushell/nushell.png" width=16/> | file-extensions="nu" | [main@nushell/vscode-nushell-lang](https://github.com/nushell/vscode-nushell-lang/tree/92faaf74f87bcdff8eb70e0aab7c9118e64189f4/)
| OpenGL Shading Language <img src="plugin/syntaxes/glsl/icon.png" width=16/> | file-extensions="comp, csh, frag, fs, fsh, fshader, geom, glsl, gs, gsh, gshader, mesh, rahit, rcall, rchit, rgen, rint, rmiss, task, tesc, tese, vert, vs, vsh, vshader" | [master@GeForceLegend/vscode-glsl](https://github.com/GeForceLegend/vscode-glsl/tree/717034785b6128d7a8ca85f507bddf33eba4c3e7/)
| PlantUML <img src="plugin/syntaxes/plantuml/icon.png" width=16/> | file-extensions="iuml, plantuml, pu, puml, wsd" | [master@qjebbs/vscode-plantuml](https://github.com/qjebbs/vscode-plantuml/tree/8df1df99859952c58f96c2b695d453bf84d4a1c9/)
| Prisma <img src="plugin/syntaxes/prisma/prisma.png" width=16/> | file-extensions="prisma" | [main@prisma/language-tools](https://github.com/prisma/language-tools/tree/e42cf3511d23401237ef43ebc130b93e0064c0a9/packages/vscode)
| Starlark <img src="plugin/syntaxes/bazel/icon.png" width=16/> | file-extensions="BUILD, WORKSPACE, bazel, bzl, bzlmod, sky, star"<br />file-names="BUILD, WORKSPACE" | [master@bazelbuild/vscode-bazel](https://github.com/bazelbuild/vscode-bazel/tree/afc3aeddfce0821a10a0b1fa889855a2a12a2433/)
| Svelte <img src="plugin/syntaxes/svelte/icon.png" width=16/> | file-extensions="svelte" | [master@sveltejs/language-tools](https://github.com/sveltejs/language-tools/tree/4abe9b3bae4dda1b5885f82483f1d69177869333/packages/svelte-vscode)
| Pascal | file-extensions="dfm, dpk, dpr, fmx, lfm, lpr, p, pas" | [master@textmate/pascal.tmbundle](https://github.com/textmate/pascal.tmbundle/tree/3b11b782368065e55acce0423f385722771d28b0/Syntaxes)
| PlantUML <img src="plugin/syntaxes/plantuml/icon.png" width=16/> | file-extensions="iuml, plantuml, pu, puml, wsd" | [master@qjebbs/vscode-plantuml](https://github.com/qjebbs/vscode-plantuml/tree/03cb912befbbc011c4cc4bec760c487c067c4170/)
| Prisma <img src="plugin/syntaxes/prisma/prisma.png" width=16/> | file-extensions="prisma" | [main@prisma/language-tools](https://github.com/prisma/language-tools/tree/d9a5adf67d538fe93be6d8619f3a6c2d1e5a1f89/packages/vscode)
| Starlark <img src="plugin/syntaxes/bazel/icon.png" width=16/> | file-extensions="BUILD, WORKSPACE, bazel, bzl, bzlmod, sky, star"<br />file-names="BUILD, WORKSPACE" | [master@bazelbuild/vscode-bazel](https://github.com/bazelbuild/vscode-bazel/tree/09daa3defdc9307b7d57d81aef6e96558add5909/)
| Svelte <img src="plugin/syntaxes/svelte/icon.png" width=16/> | file-extensions="svelte" | [master@sveltejs/language-tools](https://github.com/sveltejs/language-tools/tree/15ccd2aaba04823566714da16e689e0fd419c863/packages/svelte-vscode)
| TOML Config File <img src="plugin/syntaxes/toml/icon.png" width=16/> | file-extensions="toml"<br />file-names="Cargo.lock, Pipfile, pdm.lock" | [master@juggernautjp/less-toml](https://github.com/juggernautjp/less-toml/tree/13eb891232e98c4a9c595bf8c657893c84edf3a9/) [[upstream]](https://github.com/textmate/toml.tmbundle/commit/e82b64c1e86396220786846201e9aa3f0a2d9ca2)

<!-- END-GENERATED -->
Expand Down
26 changes: 23 additions & 3 deletions plugin/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@
</extension>

<!-- ======================================== -->
<!-- haxe/haxe: Haxe Source File -->
<!-- haxe/haxe: Haxe -->
<!-- ======================================== -->
<extension point="org.eclipse.core.contenttype.contentTypes">
<content-type id="extra-syntax-highlighting.haxe" name="Haxe Source File" base-type="extra-syntax-highlighting.basetype" priority="normal"
<content-type id="extra-syntax-highlighting.haxe" name="Haxe" base-type="extra-syntax-highlighting.basetype" priority="normal"
file-extensions="hx" />
</extension>
<extension point="org.eclipse.tm4e.registry.grammars">
Expand All @@ -258,7 +258,7 @@
</extension>

<extension point="org.eclipse.tm4e.ui.snippets">
<snippet name="Haxe Source File Example" path="syntaxes/haxe/haxe.example.hx" scopeName="source.hx" />
<snippet name="Haxe Example" path="syntaxes/haxe/haxe.example.hx" scopeName="source.hx" />
</extension>

<!-- ======================================== -->
Expand Down Expand Up @@ -1076,6 +1076,26 @@
<snippet name="nushell Example" path="syntaxes/nushell/nushell.example.nu" scopeName="source.nushell" />
</extension>

<!-- ======================================== -->
<!-- pascal/pascal: Pascal -->
<!-- ======================================== -->
<extension point="org.eclipse.core.contenttype.contentTypes">
<content-type id="extra-syntax-highlighting.pascal" name="Pascal" base-type="extra-syntax-highlighting.basetype" priority="normal"
file-extensions="dfm,dpk,dpr,fmx,lfm,lpr,p,pas" />
</extension>
<extension point="org.eclipse.tm4e.registry.grammars">
<grammar scopeName="source.pascal" path="syntaxes/pascal/pascal.tmLanguage.plist" />
<scopeNameContentTypeBinding scopeName="source.pascal" contentTypeId="extra-syntax-highlighting.pascal" />
</extension>

<extension point="org.eclipse.tm4e.languageconfiguration.languageConfigurations">
<languageConfiguration contentTypeId="extra-syntax-highlighting.pascal" path="syntaxes/pascal/pascal.language-configuration.json" />
</extension>

<extension point="org.eclipse.tm4e.ui.snippets">
<snippet name="Pascal Example" path="syntaxes/pascal/pascal.example.pas" scopeName="source.pascal" />
</extension>

<!-- ======================================== -->
<!-- plantuml/plantuml: PlantUML -->
<!-- ======================================== -->
Expand Down
4 changes: 4 additions & 0 deletions plugin/syntaxes/pascal/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
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.
240 changes: 240 additions & 0 deletions plugin/syntaxes/pascal/dot.tmLanguage.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>pas</string>
<string>p</string>
</array>
<key>keyEquivalent</key>
<string>^~P</string>
<key>name</key>
<string>Pascal</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\b(?i:(absolute|abstract|all|and|and_then|array|as|asm|attribute|begin|bindable|case|class|const|constructor|destructor|div|do|downto|else|end|except|export|exports|external|far|file|finalization|finally|for|forward|generic|goto|helper|if|implementation|import|in|inherited|initialization|interface|interrupt|is|label|library|mod|module|name|near|nil|not|object|of|only|operator|or|or_else|otherwise|packed|pow|private|program|property|protected|public|published|qualified|record|repeat|resident|restricted|segment|set|specialize|shl|shr|then|to|try|type|unit|until|uses|value|var|view|virtual|while|with|xor))\b</string>
<key>name</key>
<string>keyword.control.pascal</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>storage.type.prototype.pascal</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.function.prototype.pascal</string>
</dict>
</dict>
<key>match</key>
<string>\b(?i:(function|procedure))\b\s+(\w+(\.\w+)?)(\(.*?\))?;\s*(?=(?i:attribute|forward|external))</string>
<key>name</key>
<string>meta.function.prototype.pascal</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>storage.type.function.pascal</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.function.pascal</string>
</dict>
</dict>
<key>match</key>
<string>\b(?i:(function|procedure))\b\s+(\w+(\.\w+)?)</string>
<key>name</key>
<string>meta.function.pascal</string>
</dict>
<dict>
<key>match</key>
<string>\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\b</string>
<key>name</key>
<string>constant.numeric.pascal</string>
</dict>
<dict>
<key>begin</key>
<string>(^[ \t]+)?(?=--)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.whitespace.comment.leading.pascal</string>
</dict>
</dict>
<key>end</key>
<string>(?!\G)</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>--</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.pascal</string>
</dict>
</dict>
<key>end</key>
<string>\n</string>
<key>name</key>
<string>comment.line.double-dash.pascal.one</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(^[ \t]+)?(?=//)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.whitespace.comment.leading.pascal</string>
</dict>
</dict>
<key>end</key>
<string>(?!\G)</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>//</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.pascal</string>
</dict>
</dict>
<key>end</key>
<string>\n</string>
<key>name</key>
<string>comment.line.double-slash.pascal.two</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>\(\*</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.pascal</string>
</dict>
</dict>
<key>end</key>
<string>\*\)</string>
<key>name</key>
<string>comment.block.pascal.one</string>
</dict>
<dict>
<key>begin</key>
<string>\{</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.pascal</string>
</dict>
</dict>
<key>end</key>
<string>\}</string>
<key>name</key>
<string>comment.block.pascal.two</string>
</dict>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.pascal</string>
</dict>
</dict>
<key>comment</key>
<string>Double quoted strings are an extension and (generally) support C-style escape sequences.</string>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.pascal</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.pascal</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\.</string>
<key>name</key>
<string>constant.character.escape.pascal</string>
</dict>
</array>
</dict>
<dict>
<key>applyEndPatternLast</key>
<integer>1</integer>
<key>begin</key>
<string>'</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.pascal</string>
</dict>
</dict>
<key>end</key>
<string>'</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.pascal</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.single.pascal</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>''</string>
<key>name</key>
<string>constant.character.escape.apostrophe.pascal</string>
</dict>
</array>
</dict>
</array>
<key>scopeName</key>
<string>source.pascal</string>
<key>uuid</key>
<string>F42FA544-6B1C-11D9-9517-000D93589AF6</string>
</dict>
</plist>

0 comments on commit 337ef9a

Please sign in to comment.