-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into step-3rd-parser-lvt
- Loading branch information
Showing
15 changed files
with
413 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Leviator Lang Extension for Visual Studio Code | ||
|
||
We are thrilled to introduce our Leviator lang extension, providing enhanced syntax highlighting for an optimized coding experience. While currently available exclusively for vscode, we have ambitious plans to extend support to JetBrains and Vim in the future. | ||
|
||
### Installation | ||
|
||
To install the Leviator Language extension for **Visual Studio Code**, follow the steps below: | ||
|
||
1. Navigate to the "lvtext" directory in our [Leviator GitHub repository](https://github.com/X-R-G-B/Leviator/lvtext). | ||
2. Refer to the detailed installation instructions provided in the [README.md](https://github.com/X-R-G-B/Leviator/blob/lvtext/vscode/leviator-lang/README.md) file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ source-repository head | |
|
||
library | ||
exposed-modules: | ||
Alias | ||
AST | ||
Expression | ||
Lib | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{- | ||
-- EPITECH PROJECT, 2023 | ||
-- Leviator compiler | ||
-- File description: | ||
-- Alias | ||
-} | ||
|
||
module Alias ( | ||
proceedAlias, | ||
) where | ||
|
||
import Expression | ||
import Parser | ||
import ParseUtil | ||
import Control.Applicative | ||
|
||
data Alias = Alias String String | ||
|
||
instance Show Alias.Alias where | ||
show (Alias.Alias str1 str2) = "ALIAS `" ++ str1 ++ "`:`" ++ str2 ++ "`" | ||
|
||
parseAliasKeyword :: Parser String | ||
parseAliasKeyword = parseString "alias " | ||
|
||
parseAliasName :: Parser String | ||
parseAliasName = parseAllCharUntil " " | ||
|
||
parseAliasValue :: Parser String | ||
parseAliasValue = parseAllCharUntil ";\n" | ||
|
||
parseAlias' :: Parser String | ||
parseAlias' = (parseAliasKeyword *> parseAliasName <* many (parseChar ' ')) | ||
|
||
parseAlias :: Parser Alias.Alias | ||
parseAlias = Parser f | ||
where | ||
f str = case runParser parseAlias' str of | ||
Nothing -> Nothing | ||
Just (key, xs) -> case runParser parseAliasValue xs of | ||
Nothing -> Nothing | ||
Just (value, ys) -> Just (Alias.Alias key value, ys) | ||
|
||
replaceAliasInString :: Alias.Alias -> String -> String | ||
replaceAliasInString _ [] = [] | ||
replaceAliasInString (Alias.Alias key value) (x:xs) | ||
| take (length key) (x:xs) == key = | ||
value ++ replaceAliasInString | ||
(Alias.Alias key value) | ||
(drop (length key) (x:xs)) | ||
| otherwise = x : replaceAliasInString (Alias.Alias key value) xs | ||
|
||
replaceAlias :: Alias -> [Expression] -> [Expression] | ||
replaceAlias _ [] = [] | ||
replaceAlias alias ((Expression.Alias _):xs) = | ||
replaceAlias alias xs | ||
replaceAlias (Alias.Alias key value) ((Expression.Function str):xs) = | ||
(Expression.Function (replaceAliasInString (Alias.Alias key value) str)) | ||
: (replaceAlias (Alias.Alias key value) xs) | ||
replaceAlias (Alias.Alias key value) ((Expression.Comment str):xs) = | ||
(Expression.Comment (replaceAliasInString (Alias.Alias key value) str)) | ||
: (replaceAlias (Alias.Alias key value) xs) | ||
|
||
replaceAllAlias :: [Alias] -> [Expression] -> [Expression] | ||
replaceAllAlias [] exprs = exprs | ||
replaceAllAlias _ [] = [] | ||
replaceAllAlias (x:xs) exprs = replaceAllAlias xs newExprs | ||
where | ||
newExprs = replaceAlias x exprs | ||
|
||
getListAlias :: [Expression] -> [Alias] | ||
getListAlias [] = [] | ||
getListAlias ((Expression.Alias str):xs) = case runParser parseAlias str of | ||
Just (alias, _) -> alias : getListAlias xs | ||
Nothing -> getListAlias xs | ||
getListAlias (_:xs) = getListAlias xs | ||
|
||
proceedAlias :: [Expression] -> [Expression] | ||
proceedAlias exprs = replaceAllAlias lstAlias exprs | ||
where | ||
lstAlias = getListAlias exprs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.vscode/** | ||
.vscode-test/** | ||
.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## About | ||
|
||
Extension to enable syntax highlighting for [Leviator](https://github.com/X-R-G-B/Leviator) in [Visual Studio Code](https://code.visualstudio.com/). | ||
|
||
## Installation | ||
|
||
1. Find your vscode extension directory (default: `~/.vscode/extensions`) | ||
2. Copy or move the "./lvtext/vscode/leviator-lang" directory into the vscode extension directory | ||
3. Reload vscode | ||
|
||
## Usage | ||
|
||
Open a Leviator file (`.lvt`) and enjoy the syntax highlighting. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"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": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"], | ||
["\"", "\""], | ||
["'", "'"] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "leviator-lang", | ||
"displayName": "Leviator Lang", | ||
"version": "0.0.1", | ||
"description": "Syntax highlighting for leviator lang", | ||
"author": { | ||
"name": "GTX", | ||
"url": "https://github.com/X-R-G-B" | ||
}, | ||
"icon": "assets/icon.png", | ||
"engines": { | ||
"vscode": "^1.85.0" | ||
}, | ||
"publisher": "X-L-R-G-B", | ||
"categories": [ | ||
"Programming Languages" | ||
], | ||
"pricing": "Free", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/X-R-G-B/Leviator" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/X-R-G-B/Leviator/issues" | ||
}, | ||
"homepage": "https://github.com/X-R-G-B/Leviator/blob/main/README.md", | ||
"contributes": { | ||
"languages": [{ | ||
"id": "leviator", | ||
"aliases": ["Leviator", "leviator"], | ||
"extensions": [".lvt"], | ||
"configuration": "./language-configuration.json" | ||
}], | ||
"grammars": [{ | ||
"language": "leviator", | ||
"scopeName": "source.lvt", | ||
"path": "./syntaxes/leviator.tmLanguage.json" | ||
}] | ||
} | ||
} |
Oops, something went wrong.