Browse Source

EDL Support

master
Markus Becker 2 months ago
commit
25b051c031
9 changed files with 343 additions and 0 deletions
  1. +4
    -0
      .vscodeignore
  2. +9
    -0
      CHANGELOG.md
  3. +65
    -0
      README.md
  4. +12
    -0
      example.edl
  5. +30
    -0
      language-configuration.json
  6. +5
    -0
      package-lock.json
  7. +34
    -0
      package.json
  8. +155
    -0
      syntaxes/edl.tmLanguage.json
  9. +29
    -0
      vsc-extension-quickstart.md

+ 4
- 0
.vscodeignore View File

@@ -0,0 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md

+ 9
- 0
CHANGELOG.md View File

@@ -0,0 +1,9 @@
# Change Log

All notable changes to the "vsgx" 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

+ 65
- 0
README.md View File

@@ -0,0 +1,65 @@
# vsgx README

This is the README for your extension "vsgx". 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!**

+ 12
- 0
example.edl View File

@@ -0,0 +1,12 @@
enclave {
trusted {
public int ecall_copy([in, string] const char *str);
public int ecall_nocopy([user_check] const char *str);
public size_t ecall_copy_pointer([in, size = 1] const void *p);
public size_t ecall_nocopy_pointer([user_check] const void *p);
public int ecall_invoke_read([in, string] const char *filename);
};
untrusted {
int ocall_read_from_file([in, string] const char *filename, [out, size=buffer_size] char *buffer, size_t buffer_size);
};
};

+ 30
- 0
language-configuration.json View File

@@ -0,0 +1,30 @@
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "//",
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": [ "/*", "*/" ]
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
// symbols that that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}

+ 5
- 0
package-lock.json View File

@@ -0,0 +1,5 @@
{
"name": "vsgx",
"version": "0.0.1",
"lockfileVersion": 1
}

+ 34
- 0
package.json View File

@@ -0,0 +1,34 @@
{
"name": "vsgx",
"displayName": "vsgx",
"description": "Add intel-sgx language support",
"version": "0.0.1",
"engines": {
"vscode": "^1.41.0"
},
"categories": [
"Programming Languages"
],
"contributes": {
"languages": [
{
"id": "edl",
"aliases": [
"Enclave Definition Language",
"edl"
],
"extensions": [
".edl"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "edl",
"scopeName": "source.edl",
"path": "./syntaxes/edl.tmLanguage.json"
}
]
}
}

+ 155
- 0
syntaxes/edl.tmLanguage.json View File

@@ -0,0 +1,155 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Enclave Definition Language",
"patterns": [
{
"include": "#expressions"
}
],
"repository": {
"keywords": {
"patterns": [
{
"name": "keyword.other",
"match": "\\b(public|private)\\b"
},
{
"name": "entity.name.type",
"match": "\\b(int|size_t|char|long|const|void)\\b"
},
{
"name": "entity.name.type",
"match": "\\*"
}
]
},
"expressions": {
"patterns": [
{
"name": "entity.name.class",
"match": "\\b[a-z]+\\b"
},
{
"include": "#partitions"
}
]
},
"operations": {
"patterns": [
{
"name": "keyword.operator",
"match": "\\="
},
{
"name": "constant.numeric",
"match": "[0-9]+"
}
]
},
"partitions": {
"begin": "{",
"end": "}",
"beginCaptures": {
"0": { "name": "punctuation.paren.open" }
},
"endCaptures": {
"0": { "name": "punctuation.paren.close" }
},
"patterns": [
{
"name": "entity.name.section",
"match": "\\b(trusted|untrusted)\\b"
},
{
"include": "#partition"
}
]
},
"partition": {
"begin": "{",
"end": "}",
"beginCaptures": {
"0": { "name": "punctuation.paren.open" }
},
"endCaptures": {
"0": { "name": "punctuation.paren.close" }
},
"patterns": [
{
"include": "#functionName"
},
{
"include": "#functionArgs"
},
{
"include": "#keywords"
}
]
},
"functionName": {
"patterns": [
{
"name": "entity.name.function",
"match": "[a-zA-Z0-9_-]+ *(?=\\(.*\\))"
}
]
},
"functionArgs": {
"begin": "\\(",
"end": "\\)",
"beginCaptures": {
"0": { "name": "punctuation.paren.open" }
},
"endCaptures": {
"0": { "name": "punctuation.paren.close" }
},
"patterns": [
{
"include": "#keywords"
},
{
"include": "#destinations"
},
{
"name": "entity.name",
"match": "[a-zA-Z0-9]+"
}
]
},
"destinations": {
"begin": "\\[",
"end": "\\]",
"beginCaptures": {
"0": { "name": "punctuation.paren.open" }
},
"endCaptures": {
"0": { "name": "punctuation.paren.close" }
},
"patterns": [
{
"include": "#directions"
},
{
"include": "#operations"
},
{
"name": "keyword.operator",
"match": "(?!_)string|size *(?=\\=)"
},
{
"name": "entity.name",
"match": "[a-zA-Z0-9]+"
}
]
},
"directions": {
"patterns": [
{
"name": "keyword.operator",
"match": "\\bin|out|user_check\\b"
}
]
}
},
"scopeName": "source.edl"
}

+ 29
- 0
vsc-extension-quickstart.md View File

@@ -0,0 +1,29 @@
# Welcome to your VS Code Extension

## What's in the folder

* This folder contains all of the files necessary for your extension.
* `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension.
* `syntaxes/edl.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization.
* `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets.

## Get up and running straight away

* Make sure the language configuration settings in `language-configuration.json` are accurate.
* Press `F5` to open a new window with your extension loaded.
* Create a new file with a file name suffix matching your language.
* Verify that syntax highlighting works and that the language configuration settings are working.

## Make changes

* You can relaunch the extension from the debug toolbar after making changes to the files listed above.
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.

## Add more language features

* To add features such as intellisense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/docs

## Install your extension

* To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.

Loading…
Cancel
Save