Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
deimonn committed Apr 26, 2024
0 parents commit 7fdbf16
Show file tree
Hide file tree
Showing 15 changed files with 2,750 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": 2020,
"sourceType": "module"
},
"plugins": [
"@stylistic",
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked"
],
"rules": {
"@stylistic/quotes": ["error", "double"],
"@stylistic/semi": ["error", "never"],
"@stylistic/indent": ["error", 4],
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"curly": "error",
"eqeqeq": "error",
"no-throw-literal": "error",
"prefer-const": "error"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
]
}
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Temporary files created by various text editors.
*~

# Merge files created by git.
*.orig
# Reject files created by git.
*.rej

# Vim swap files.
.*.sw?
.sw?

# OS X specific files.
.DS_store

# Build artifacts and outputs.
/out
/dist
/node_modules
/*.vsix
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// A launch configuration that compiles the extension and then opens it 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": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "watch"
}
]
}
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
23 changes: 23 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"label": "watch",
"type": "npm",
"script": "watch",
"options": {
"shell": {
"executable": "cmd.exe",
"args": ["/d", "/c"]
}
},
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
}
}
]
}
9 changes: 9 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.vscode/**
.vscode-test/**
.gitignore
.yarnrc
src/**
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.0](https://github.com/deimonn/code-re2c/releases/tag/v0.1.0) - 2024-04-26

- Initial release
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2024 Deimonn (a.k.a. Nahuel S. Cisterna)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Code re2c

Experimental linting and syntax highlighting for [re2c]!

## How to use

### File associations

`re2c` code blocks will be automatically detected within C, C++, Go and Rust
source files. In addition, this extension also creates the following default
associations:

Extension | Language
-- | --
`*.re`, `*.c.re` | C
`*.cc.re`, `*.cpp.re`, `*.cxx.re` | C++
`*.go.re` | Go
`*.rs.re` | Rust

If you don't like the default `*.re` being tied to C, you can override it by
just modifying your `files.associations` in your `settings.json` file. For
example, to make the default language C++:

```JSON
"files.associations": {
"*.re": "cpp"
}
```

### Linting

Linting occurs only when you open a document or save it, as it relies on running
and parsing command output.

A [re2c] binary somewhere in your system is required for it. If its not on your
`PATH`, you can manually set the path to it in your settings:

```JSON
"code-re2c.re2c.path": "/path/to/re2c"
```

By default, only the `-W` flag is passed to the re2c binary. You can override
the arguments to pass in your settings:

```JSON
"code-re2c.re2c.arguments": ["-W", "-Werror-empty-character-class"]
```

[re2c]: http://re2c.org/

## Known issues

- Flex syntax mode is unsupported. Syntax highlighting is bound to be skewed
when using features pertaining to it.

- Code blocks of C/C++/Go/Rust *within* a re2c block won't get properly colored.
TextMate is simply too much of a headache to implement such a thing.
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7fdbf16

Please sign in to comment.