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

Portable syntax highlighting #503

Closed
Closed
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
91 changes: 91 additions & 0 deletions tooling/syntax/dex.iro
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name = dex
file_extensions [] = dx;

styles [] {
.comment : style {
color = light_green
italic = true
textmate_scope = comment
pygments_scope = Comment
}
.keyword : style {
color = cyan
textmate_scope = keyword.other
pygments_scope = Keyword.Reserved
}
.numeric : style {
color = gold
textmate_scope = constant.numeric
pygments_scope = Number
}
.punctuation : style {
color = red
textmate_scope = punctuation
pygments_scope = Punctuation
}
.quoted_text : style {
color = brown
textmate_scope = string.quoted.double
pygments_scope = String
}
.escaped_text : style {
color = green
textmate_scope = constant.character.escape
pygments_scope = String.Escape
}
.type : style {
color = blue
textmate_scope = entity.name.type
pygments_scope = Keyword.Type
}
.operator : style {
color = orange
textmate_scope = keyword.operator
pygments_scope = Operator
}
}

contexts [] {
main : context {
: pattern {
regex \= (\b(def|for|rof|case|of|llam|Read|Write|Accum|data|interface|instance|where)\b)
styles [] = .keyword;
}
: pattern {
regex \= (\b(\d+\.\d+|\d+))
styles [] = .numeric;
}
: pattern {
regex \= (\(|\)|\[|\]|\{|\}|;)
styles [] = .punctuation;
}
: inline_push {
regex \= (")
styles [] = .punctuation;
: pop {
regex \= (")
styles [] = .punctuation;
}
: pattern {
regex \= (\\(?:\\|"))
styles [] = .escaped_text;
}
: pattern {
regex \= ([^"\\]+)
styles [] = .quoted_text;
}
}
: pattern {
regex \= (--[^o].*)
styles [] = .comment;
}
: pattern {
regex \= (\b[A-Z][a-zA-Z0-9]*)
styles [] = .type;
}
: pattern {
regex \= (((\.)|(,)|(!)|(\$)|(\^)|(&)|(\*)|(:)|(-)|(~)|(\+)|(/)|(=)|(<)|(>)|(\|)|(\?)|(\\)|(@)))
styles [] = .operator;
}
}
}
116 changes: 116 additions & 0 deletions tooling/syntax/dex.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0" >
<!-- Generated via Iro -->
<dict>
<key>fileTypes</key>
<array>
<string>dx</string>
</array>
<key>name</key>
<string>dex</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#main</string>
</dict>
</array>
<key>scopeName</key>
<string>source.dex</string>
<key>uuid</key>
<string></string>
<key>repository</key>
<dict>
<key>main</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(\b(def|for|rof|case|of|llam|Read|Write|Accum|data|interface|instance|where)\b)</string>
<key>name</key>
<string>keyword.other.dex</string>
</dict>
<dict>
<key>match</key>
<string>(\b(\d+\.\d+|\d+))</string>
<key>name</key>
<string>constant.numeric.dex</string>
</dict>
<dict>
<key>match</key>
<string>(\(|\)|\[|\]|\{|\}|;)</string>
<key>name</key>
<string>punctuation.dex</string>
</dict>
<dict>
<key>begin</key>
<string>(&quot;)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.dex</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#main__1</string>
</dict>
</array>
<key>end</key>
<string>(&quot;)</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.dex</string>
</dict>
</dict>
</dict>
<dict>
<key>match</key>
<string>(--[^o].*)</string>
<key>name</key>
<string>comment.dex</string>
</dict>
<dict>
<key>match</key>
<string>(\b[A-Z][a-zA-Z0-9]*)</string>
<key>name</key>
<string>entity.name.type.dex</string>
</dict>
<dict>
<key>match</key>
<string>(((\.)|(,)|(!)|(\$)|(\^)|(&amp;)|(\*)|(:)|(-)|(~)|(\+)|(/)|(=)|(&lt;)|(&gt;)|(\|)|(\?)|(\\)|(@)))</string>
<key>name</key>
<string>keyword.operator.dex</string>
</dict>
</array>
</dict>
<key>main__1</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(\\(?:\\|&quot;))</string>
<key>name</key>
<string>constant.character.escape.dex</string>
</dict>
<dict>
<key>match</key>
<string>([^\x{0022}\x{005c}]+)</string>
<key>name</key>
<string>string.quoted.double.dex</string>
</dict>
</array>
</dict>
</dict>
</dict>
</plist>
74 changes: 74 additions & 0 deletions tooling/syntax/dex.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"fileTypes": [
"dx"
],
"name": "dex",
"patterns": [
{
"include": "#main"
}
],
"scopeName": "source.dex",
"uuid": "",
"repository": {
"main": {
"patterns": [
{
"match": "(\\b(def|for|rof|case|of|llam|Read|Write|Accum|data|interface|instance|where)\\b)",
"name": "keyword.other.dex"
},
{
"match": "(\\b(\\d+\\.\\d+|\\d+))",
"name": "constant.numeric.dex"
},
{
"match": "(\\(|\\)|\\[|\\]|\\{|\\}|;)",
"name": "punctuation.dex"
},
{
"begin": "(\")",
"beginCaptures": {
"1": {
"name": "punctuation.dex"
}
},
"patterns": [
{
"include": "#main__1"
}
],
"end": "(\")",
"endCaptures": {
"1": {
"name": "punctuation.dex"
}
}
},
{
"match": "(--[^o].*)",
"name": "comment.dex"
},
{
"match": "(\\b[A-Z][a-zA-Z0-9]*)",
"name": "entity.name.type.dex"
},
{
"match": "(((\\.)|(,)|(!)|(\\$)|(\\^)|(&)|(\\*)|(:)|(-)|(~)|(\\+)|(\/)|(=)|(<)|(>)|(\\|)|(\\?)|(\\\\)|(@)))",
"name": "keyword.operator.dex"
}
]
},
"main__1": {
"patterns": [
{
"match": "(\\\\(?:\\\\|\"))",
"name": "constant.character.escape.dex"
},
{
"match": "([^\\x{0022}\\x{005c}]+)",
"name": "string.quoted.double.dex"
}
]
}
}
}
17 changes: 17 additions & 0 deletions tooling/syntax/vscode/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// A launch configuration that launches the extension inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
}
]
}
4 changes: 4 additions & 0 deletions tooling/syntax/vscode/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
9 changes: 9 additions & 0 deletions tooling/syntax/vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

All notable changes to the "dex-lang" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [Unreleased]

- Initial release
76 changes: 76 additions & 0 deletions tooling/syntax/vscode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# dex-lang README

This is the README for your extension "dex-lang". After writing up a brief
description, we recommend including the following sections.

## Features

Describe specific features of your extension including screenshots of your
extension in action. Image paths are relative to this README file.

For example if there is an image subfolder under your extension project
workspace:

\!\[feature X\]\(images/feature-x.png\)

> Tip: Many popular extensions utilize animations. This is an excellent way to
> show off your extension! We recommend short, focused animations that are easy
> to follow.

## Requirements

If you have any requirements or dependencies, add a section describing those and
how to install and configure them.

## Extension Settings

Include if your extension adds any VS Code settings through the
`contributes.configuration` extension point.

For example:

This extension contributes the following settings:

* `myExtension.enable`: enable/disable this extension
* `myExtension.thing`: set to `blah` to do something

## Known Issues

Calling out known issues can help limit users opening duplicate issues against
your extension.

## Release Notes

Users appreciate release notes as you update your extension.

### 1.0.0

Initial release of ...

### 1.0.1

Fixed issue #.

### 1.1.0

Added features X, Y, and Z.

--------------------------------------------------------------------------------

## Working with Markdown

**Note:** You can author your README using Visual Studio Code. Here are some
useful editor keyboard shortcuts:

* Split the editor (``Cmd+\` on macOS or``Ctrl+\` on Windows and Linux)
* Toggle preview (`Shift+CMD+V` on macOS or `Shift+Ctrl+V` on Windows and
Linux)
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (macOS) to see a list of
Markdown snippets

### For more information

* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)

**Enjoy!**
Loading