1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

Add some more vscode files

On top of existing TableGen file syntax highlighting, added
- IR syntax highlighting
- LIT test output patterMatcher
- etc.
This commit is contained in:
Yuanfang Chen 2020-03-05 18:14:01 -08:00
parent 2fa5d08920
commit 3469e7634a
20 changed files with 1011 additions and 101 deletions

View File

@ -1,18 +1,2 @@
This directory contains a "bundle" for doing syntax highlighting of TableGen
files for the Microsoft VSCode editor. The highlighting follows that done by
the TextMate "C" bundle as it is a translation of the textmate bundle to VSCode
using the "yo code" npm package. Currently, keywords, comments, and strings are
highlighted.
This colorizer was generate by the vscode-generator tool "Yo Code"
(https://github.com/Microsoft/vscode-generator-code) from the existing TableGen
text TableGen.tmLanguage syntax colorizer in utils/textmate. This README was
copied from utils/textmate/README.
To install this VSCode .td file colorizer, copy it to the following locations
per your Operating System:
- Windows: %USERPROFILE%\.vscode\extensions
- Mac: ~/.vscode/extensions
- Linux: ~/.vscode/extensions
"llvm" directory contains a VS Code Extension for doing syntax highlighting of
TableGen files and LLVM IR files.

4
utils/vscode/llvm/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
node_modules
*~
syntaxes/ll.tmLanguage.json
out/

View File

@ -0,0 +1,7 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
syntaxes/ll.tmLanguage.yaml
**/*.ts
**/tsconfig.json

View File

@ -0,0 +1,9 @@
# Change Log
All notable changes to the "llvm" 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

View File

@ -0,0 +1,46 @@
# VS Code Extension For LLVM Dev
## Features
- LLVM IR files (.ll) syntax highlighting.
(manually translated from `llvm/utils/vim/syntax/llvm.vim`)
- TableGen files (.td) syntax highlighting.
(translated from `llvm/utils/textmate`)
- PatternMatchers for LIT test output.
(`$llvm-lit`, `$llvm-filecheck`)
- Tasks to run LIT on current selected file.
(`Terminal` -> `Run Task` -> `llvm-lit`)
## Installation
```sh
sudo apt-get install nodejs-dev node-gyp npm
sudo npm install -g typescript npx vsce
```
### Install From Source
```sh
cd <extensions-installation-folder>
cp -r llvm/utils/vscode/llvm .
cd llvm
npm install
npm run vscode:prepublish
```
`<extensions-installation-folder>` is OS dependent.
Please refer to https://code.visualstudio.com/docs/editor/extension-gallery#_where-are-extensions-installed
### Install From Package (.vsix)
First package the extension according to
https://code.visualstudio.com/api/working-with-extensions/publishing-extension#usage.
Then install the package according to
https://code.visualstudio.com/docs/editor/extension-gallery#_install-from-a-vsix.
## Setup
Set `cmake.buildDirectory` to your build directory.
https://code.visualstudio.com/docs/getstarted/settings
https://vector-of-bool.github.io/docs/vscode-cmake-tools/settings.html#cmake-builddirectory

View File

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

323
utils/vscode/llvm/package-lock.json generated Normal file
View File

@ -0,0 +1,323 @@
{
"name": "llvm",
"version": "0.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@babel/code-frame": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz",
"integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==",
"dev": true,
"requires": {
"@babel/highlight": "^7.8.3"
}
},
"@babel/highlight": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz",
"integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==",
"dev": true,
"requires": {
"chalk": "^2.0.0",
"esutils": "^2.0.2",
"js-tokens": "^4.0.0"
}
},
"@types/node": {
"version": "8.10.59",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.59.tgz",
"integrity": "sha512-8RkBivJrDCyPpBXhVZcjh7cQxVBSmRk9QM7hOketZzp6Tg79c0N8kkpAIito9bnJ3HCVCHVYz+KHTEbfQNfeVQ==",
"dev": true
},
"@types/vscode": {
"version": "1.42.0",
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.42.0.tgz",
"integrity": "sha512-ds6TceMsh77Fs0Mq0Vap6Y72JbGWB8Bay4DrnJlf5d9ui2RSe1wis13oQm+XhguOeH1HUfLGzaDAoupTUtgabw==",
"dev": true
},
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"requires": {
"color-convert": "^1.9.0"
}
},
"argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"requires": {
"sprintf-js": "~1.0.2"
}
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"builtin-modules": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
"dev": true
},
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
}
},
"color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dev": true,
"requires": {
"color-name": "1.1.3"
}
},
"color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"dev": true
},
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"diff": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"dev": true
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
},
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true
},
"esutils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
"glob": {
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"dev": true,
"requires": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
"dev": true
},
"js-yaml": {
"version": "3.13.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
"integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
"dev": true,
"requires": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true,
"requires": {
"minimist": "0.0.8"
}
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"requires": {
"wrappy": "1"
}
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true
},
"path-parse": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
"dev": true
},
"resolve": {
"version": "1.15.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz",
"integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
}
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
},
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true
},
"supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
}
},
"tslib": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz",
"integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==",
"dev": true
},
"tslint": {
"version": "5.20.1",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz",
"integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
"builtin-modules": "^1.1.1",
"chalk": "^2.3.0",
"commander": "^2.12.1",
"diff": "^4.0.1",
"glob": "^7.1.1",
"js-yaml": "^3.13.1",
"minimatch": "^3.0.4",
"mkdirp": "^0.5.1",
"resolve": "^1.3.2",
"semver": "^5.3.0",
"tslib": "^1.8.0",
"tsutils": "^2.29.0"
}
},
"tsutils": {
"version": "2.29.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
"dev": true,
"requires": {
"tslib": "^1.8.1"
}
},
"typescript": {
"version": "3.8.3",
"resolved": "https://artifactory.sie.sony.com/artifactory/api/npm/ce-sie-private-npm-prod-virtual/typescript/-/typescript-3.8.3.tgz",
"integrity": "sha1-QJ64VE6gM1cRIFhp7EWKsQnuEGE=",
"dev": true
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
}
}
}

View File

@ -0,0 +1,122 @@
{
"name": "llvm",
"displayName": "llvm",
"description": "VS Code Externsion for LLVM development",
"publisher": "llvm-vs-code-extensions",
"version": "0.0.1",
"repository": "somewhere",
"engines": {
"vscode": "^1.42.0"
},
"categories": [
"Programming Languages"
],
"activationEvents": [
"onCommand:workbench.action.tasks.runTask"
],
"main": "./out/extension",
"contributes": {
"languages": [
{
"id": "tablegen",
"aliases": [
"TableGen",
"tablegen"
],
"extensions": [
".td"
],
"configuration": "./language-configuration-tablegen.json"
},
{
"id": "llvm",
"aliases": [
"LLVM IR",
"LLVM",
"llvm"
],
"extensions": [
".ll"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "tablegen",
"scopeName": "source.tablegen",
"path": "./syntaxes/TableGen.tmLanguage"
},
{
"language": "llvm",
"scopeName": "source.llvm",
"path": "./syntaxes/ll.tmLanguage.json"
}
],
"taskDefinitions": [
{
"type": "llvm-lit",
"required": [
"task"
],
"properties": {
"task": {
"type": "string",
"description": "The Rake task to customize"
}
}
}
],
"problemMatchers": [
{
"name": "llvm-lit",
"fileLocation": [
"absolute"
],
"label": "LLVM LIT",
"source": "llvm lit",
"severity": "error",
"pattern": [
{
"regexp": "^(.+):(\\d+)\\((\\d+)\\):\\s+(.+)$",
"kind": "location",
"file": 1,
"line": 2,
"code": 3,
"message": 4
}
]
},
{
"name": "llvm-filecheck",
"fileLocation": [
"absolute"
],
"label": "LLVM FileCheck",
"source": "llvm filecheck",
"pattern": [
{
"regexp": "^(.+):(\\d+):\\d+:\\s+(error|warning|note|remark):\\s+(.+)$",
"kind": "location",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
]
}
]
},
"devDependencies": {
"@types/node": "^8.10.59",
"@types/vscode": "^1.39.0",
"js-yaml": "^3.13.1",
"tslint": "^5.16.0",
"typescript": "^3.8.3"
},
"extensionDependencies": ["ms-vscode.cmake-tools"],
"scripts": {
"vscode:prepublish": "npx js-yaml syntaxes/ll.tmLanguage.yaml > syntaxes/ll.tmLanguage.json && tsc -b",
"watch": "tsc -b -w"
}
}

View File

@ -0,0 +1,15 @@
import * as vscode from 'vscode';
import { LITTaskProvider } from './litTaskProvider';
let litTaskProvider: vscode.Disposable | undefined;
let customTaskProvider: vscode.Disposable | undefined;
export function activate(_context: vscode.ExtensionContext): void {
litTaskProvider = vscode.tasks.registerTaskProvider(LITTaskProvider.LITType, new LITTaskProvider());
}
export function deactivate(): void {
if (litTaskProvider) {
litTaskProvider.dispose();
}
}

View File

@ -0,0 +1,79 @@
import * as vscode from 'vscode';
import * as fs from 'fs';
interface LITTaskDefinition extends vscode.TaskDefinition {
/**
* The task name
*/
task: string;
}
export class LITTaskProvider implements vscode.TaskProvider {
static LITType: string = 'llvm-lit';
private cmd: string;
private args: string[] = [];
private litPromise: Thenable<vscode.Task[]> | undefined = undefined;
constructor() {
const isWindows = process.platform === 'win32';
if (isWindows) {
this.cmd = "py"
this.args = ["-3", "${config:cmake.buildDirectory}\\bin\\llvm-lit.py", "-vv"]
} else {
this.cmd = "python3"
this.args = ["${config:cmake.buildDirectory}/bin/llvm-lit", "-vv"]
}
}
public provideTasks(): Thenable<vscode.Task[]> | undefined {
if (!this.litPromise) {
this.litPromise = this.getLITTasks();
}
return this.litPromise;
}
public resolveTask(_task: vscode.Task): vscode.Task | undefined {
const task = _task.definition.task;
if (task) {
let args: string[] = this.args;
const definition: LITTaskDefinition = <any>_task.definition;
if (definition.task === 'llvm-lit file') {
args.push("${file}")
} else if (definition.task === 'llvm-lit directory') {
args.push("${fileDirname}")
}
return new vscode.Task(
definition,
definition.task,
'llvm',
new vscode.ShellExecution(this.cmd, args),
["$llvm-lit", "$llvm-filecheck"]
);
}
return undefined;
}
private async getLITTasks(): Promise<vscode.Task[]> {
let result: vscode.Task[] = [];
let bld_dir: string | undefined = vscode.workspace.getConfiguration().get("cmake.buildDirectory");
if (bld_dir == undefined || !fs.existsSync(bld_dir)) {
return result;
}
let taskName = 'llvm-lit file';
result.push(new vscode.Task({ type: 'llvm-lit', task: taskName },
taskName, 'llvm',
new vscode.ShellExecution(this.cmd, this.args.concat(["${file}"])),
["$llvm-lit", "$llvm-filecheck"]));
taskName = 'llvm-lit directory';
result.push(new vscode.Task({ type: 'llvm-lit', task: taskName },
taskName, 'llvm',
new vscode.ShellExecution(this.cmd, this.args.concat(["${fileDirname}"])),
["$llvm-lit", "$llvm-filecheck"])
);
return result;
}
}

View File

@ -0,0 +1,329 @@
# https://macromates.com/manual/en/language_grammars
# https://macromates.com/manual/en/regular_expressions
# https://www.sublimetext.com/docs/3/scope_naming.html
# Coloring
# https://code.visualstudio.com/docs/getstarted/themes
# https://code.visualstudio.com/api/extension-guides/color-theme#syntax-colors
# https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide
# https://code.visualstudio.com/docs/cpp/colorization-cpp
$schema: https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json
name: LLVM IR
scopeName: source.llvm
patterns:
- match: "\\bvoid\\b|\
\\bhalf\\b|\
\\bfloat\\b|\
\\bdouble\\b|\
\\bx86_fp80\\b|\
\\bfp128\\b|\
\\bppc_fp128\\b|\
\\blabel\\b|\
\\bmetadata\\b|\
\\bx86_mmx\\b|\
\\btype\\b|\
\\blabel\\b|\
\\bopaque\\b|\
\\btoken\\b|\
\\bi\\d+\\**"
name: storage.type.llvm
- match: "!([a-zA-Z]+)\\s*\\("
captures:
1:
name: storage.type.llvm
- match: "\\badd\\b|\
\\baddrspacecast\\b|\
\\balloca\\b|\
\\band\\b|\
\\barcp\\b|\
\\bashr\\b|\
\\batomicrmw\\b|\
\\bbitcast\\b|\
\\bbr\\b|\
\\bcatchpad\\b|\
\\bcatchswitch\\b|\
\\bcatchret\\b|\
\\bcall\\b|\
\\bcallbr\\b|\
\\bcleanuppad\\b|\
\\bcleanupret\\b|\
\\bcmpxchg\\b|\
\\beq\\b|\
\\bexact\\b|\
\\bextractelement\\b|\
\\bextractvalue\\b|\
\\bfadd\\b|\
\\bfast\\b|\
\\bfcmp\\b|\
\\bfdiv\\b|\
\\bfence\\b|\
\\bfmul\\b|\
\\bfpext\\b|\
\\bfptosi\\b|\
\\bfptoui\\b|\
\\bfptrunc\\b|\
\\bfree\\b|\
\\bfrem\\b|\
\\bfsub\\b|\
\\bfneg\\b|\
\\bgetelementptr\\b|\
\\bicmp\\b|\
\\binbounds\\b|\
\\bindirectbr\\b|\
\\binsertelement\\b|\
\\binsertvalue\\b|\
\\binttoptr\\b|\
\\binvoke\\b|\
\\blandingpad\\b|\
\\bload\\b|\
\\blshr\\b|\
\\bmalloc\\b|\
\\bmax\\b|\
\\bmin\\b|\
\\bmul\\b|\
\\bnand\\b|\
\\bne\\b|\
\\bninf\\b|\
\\bnnan\\b|\
\\bnsw\\b|\
\\bnsz\\b|\
\\bnuw\\b|\
\\boeq\\b|\
\\boge\\b|\
\\bogt\\b|\
\\bole\\b|\
\\bolt\\b|\
\\bone\\b|\
\\bor\\b|\
\\bord\\b|\
\\bphi\\b|\
\\bptrtoint\\b|\
\\bresume\\b|\
\\bret\\b|\
\\bsdiv\\b|\
\\bselect\\b|\
\\bsext\\b|\
\\bsge\\b|\
\\bsgt\\b|\
\\bshl\\b|\
\\bshufflevector\\b|\
\\bsitofp\\b|\
\\bsle\\b|\
\\bslt\\b|\
\\bsrem\\b|\
\\bstore\\b|\
\\bsub\\b|\
\\bswitch\\b|\
\\btrunc\\b|\
\\budiv\\b|\
\\bueq\\b|\
\\buge\\b|\
\\bugt\\b|\
\\buitofp\\b|\
\\bule\\b|\
\\bult\\b|\
\\bumax\\b|\
\\bumin\\b|\
\\bune\\b|\
\\buno\\b|\
\\bunreachable\\b|\
\\bunwind\\b|\
\\burem\\b|\
\\bva_arg\\b|\
\\bxchg\\b|\
\\bxor\\b|\
\\bzext\\b"
name: keyword.instruction.llvm
- match: "\\bacq_rel\\b|\
\\bacquire\\b|\
\\baddrspace\\b|\
\\balias\\b|\
\\balign\\b|\
\\balignstack\\b|\
\\balwaysinline\\b|\
\\bappending\\b|\
\\bargmemonly\\b|\
\\barm_aapcscc\\b|\
\\barm_aapcs_vfpcc\\b|\
\\barm_apcscc\\b|\
\\basm\\b|\
\\batomic\\b|\
\\bavailable_externally\\b|\
\\bblockaddress\\b|\
\\bbuiltin\\b|\
\\bbyval\\b|\
\\bc\\b|\
\\bcatch\\b|\
\\bcaller\\b|\
\\bcc\\b|\
\\bccc\\b|\
\\bcleanup\\b|\
\\bcoldcc\\b|\
\\bcomdat\\b|\
\\bcommon\\b|\
\\bconstant\\b|\
\\bdatalayout\\b|\
\\bdeclare\\b|\
\\bdefault\\b|\
\\bdefine\\b|\
\\bdeplibs\\b|\
\\bdereferenceable\\b|\
\\bdistinct\\b|\
\\bdllexport\\b|\
\\bdllimport\\b|\
\\bdso_local\\b|\
\\bdso_preemptable\\b|\
\\bexcept\\b|\
\\bexternal\\b|\
\\bexternally_initialized\\b|\
\\bextern_weak\\b|\
\\bfastcc\\b|\
\\btailcc\\b|\
\\bfilter\\b|\
\\bfrom\\b|\
\\bgc\\b|\
\\bglobal\\b|\
\\bhhvmcc\\b|\
\\bhhvm_ccc\\b|\
\\bhidden\\b|\
\\bimmarg\\b|\
\\binitialexec\\b|\
\\binlinehint\\b|\
\\binreg\\b|\
\\binteldialect\\b|\
\\bintel_ocl_bicc\\b|\
\\binternal\\b|\
\\blinkonce\\b|\
\\blinkonce_odr\\b|\
\\blocaldynamic\\b|\
\\blocalexec\\b|\
\\blocal_unnamed_addr\\b|\
\\bminsize\\b|\
\\bmodule\\b|\
\\bmonotonic\\b|\
\\bmsp430_intrcc\\b|\
\\bmusttail\\b|\
\\bnaked\\b|\
\\bnest\\b|\
\\bnoalias\\b|\
\\bnobuiltin\\b|\
\\bnocapture\\b|\
\\bnoimplicitfloat\\b|\
\\bnoinline\\b|\
\\bnonlazybind\\b|\
\\bnonnull\\b|\
\\bnorecurse\\b|\
\\bnoredzone\\b|\
\\bnoreturn\\b|\
\\bnounwind\\b|\
\\boptnone\\b|\
\\boptsize\\b|\
\\bpersonality\\b|\
\\bprivate\\b|\
\\bprotected\\b|\
\\bptx_device\\b|\
\\bptx_kernel\\b|\
\\breadnone\\b|\
\\breadonly\\b|\
\\brelease\\b|\
\\breturned\\b|\
\\breturns_twice\\b|\
\\bsanitize_address\\b|\
\\bsanitize_memory\\b|\
\\bsanitize_thread\\b|\
\\bsection\\b|\
\\bseq_cst\\b|\
\\bsideeffect\\b|\
\\bsignext\\b|\
\\bsyncscope\\b|\
\\bsource_filename\\b|\
\\bspeculatable\\b|\
\\bspir_func\\b|\
\\bspir_kernel\\b|\
\\bsret\\b|\
\\bssp\\b|\
\\bsspreq\\b|\
\\bsspstrong\\b|\
\\bstrictfp\\b|\
\\bswiftcc\\b|\
\\bswiftself\\b|\
\\btail\\b|\
\\btarget\\b|\
\\bthread_local\\b|\
\\bto\\b|\
\\btriple\\b|\
\\bunnamed_addr\\b|\
\\bunordered\\b|\
\\buselistorder\\b|\
\\buselistorder_bb\\b|\
\\buwtable\\b|\
\\bvolatile\\b|\
\\bweak\\b|\
\\bweak_odr\\b|\
\\bwithin\\b|\
\\bwriteonly\\b|\
\\bx86_64_sysvcc\\b|\
\\bwin64cc\\b|\
\\bx86_fastcallcc\\b|\
\\bx86_stdcallcc\\b|\
\\bx86_thiscallcc\\b|\
\\bzeroext\\b"
name: storage.modifier.llvm
- match: "@[-a-zA-Z$._][-a-zA-Z$._0-9]*"
name: entity.name.function.llvm
- match: "[%@!]\\d+\\b"
name: variable.llvm
- match: "%[-a-zA-Z$._][-a-zA-Z$._0-9]*"
name: variable.llvm
- match: "(![-a-zA-Z$._][-a-zA-Z$._0-9]*)\\s*$"
captures:
1:
name: variable.llvm
- match: "(![-a-zA-Z$._][-a-zA-Z$._0-9]*)\\s*[=!]"
captures:
1:
name: variable.llvm
- begin: "\""
end: "\""
patterns:
- name: "constant.character.escape.untitled"
match: "\\."
name: string.quoted.double.llvm
- match: "[-a-zA-Z$._][-a-zA-Z$._0-9]*:"
name: entity.name.label.llvm
- match: "-?\\b\\d+\\.\\d*(e[+-]\\d+)?\\b"
name: constant.numeric.float
- match: "\\b0x\\x+\\b"
name: constant.numeric.float
- match: "-?\\b\\d+\\b"
name: constant.numeric.integer
- match: "\\btrue\\b|\
\\bfalse\\b|\
\\bnull\\b|\
\\bzeroinitializer\\b|\
\\bundef\\b|\
\\bnull\\b|\
\\bnone\\b"
name: constant.language
- match: "\\bDW_TAG_[a-z_]+\\b|\
\\bDW_ATE_[a-zA-Z_]+\\b|\
\\bDW_OP_[a-zA-Z0-9_]+\\b|\
\\bDW_LANG_[a-zA-Z0-9_]+\\b|\
\\bDW_VIRTUALITY_[a-z_]+\\b|\
\\bDIFlag[A-Za-z]+\\b"
name: constant.other
- match: ";\\s*PR\\d*\\s*$"
name: string.regexp
- match: ";\\s*REQUIRES:.*$"
name: string.regexp
- match: ";\\s*RUN:.*$"
name: string.regexp
- match: ";\\s*CHECK:.*$"
name: string.regexp
- match: ";\\s*CHECK-(NEXT|NOT|DAG|SAME|LABEL):.*$"
name: string.regexp
- match: ";\\s*XFAIL:.*$"
name: string.regexp
- match: ;.*$
name: comment.line.llvm

View File

@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "out",
"lib": [
"es6"
],
"sourceMap": true,
"rootDir": "src",
"strict": true /* enable all strict type-checking options */
/* Additional Checks */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
},
"exclude": [
"node_modules"
]
}

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/ll.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.

View File

@ -1,13 +0,0 @@
// A launch configuration that launches the extension inside a new window
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ]
}
]
}

View File

@ -1,4 +0,0 @@
# Change Log
- Initial release

View File

@ -1,13 +0,0 @@
# tablegen README
This VSCode colorizer extension is a translation of the textmate bunble to
VSCode using the "yo code" npm package. Currently, keywords, comments, and
strings are highlighted.
To install this VSCode .td file colorizer, copy it to the following locations
per your Operating System:
- Windows: %USERPROFILE%\.vscode\extensions
- Mac: ~/.vscode/extensions
- Linux: ~/.vscode/extensions

View File

@ -1,26 +0,0 @@
{
"name": "tablegen",
"displayName": "TableGen",
"description": "VSCode Language Colorizer for LLVM's TableGen language.",
"version": "0.0.1",
"publisher": "llvm",
"engines": {
"vscode": "^1.12.0"
},
"categories": [
"Languages"
],
"contributes": {
"languages": [{
"id": "tablegen",
"aliases": ["TableGen", "tablegen"],
"extensions": [".td"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "tablegen",
"scopeName": "source.tablegen",
"path": "./syntaxes/TableGen.tmLanguage"
}]
}
}

View File

@ -1,27 +0,0 @@
# 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 you extension.
* `syntaxes/TableGen.tmLanguage` - this is the Text mate grammar file that is used for tokenization
* `language-configuration.json` - this 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 highlight 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.