remove old stuff
This commit is contained in:
@@ -1,166 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
import clang.cindex
|
||||
from clang.cindex import CursorKind, TypeKind, Type
|
||||
|
||||
|
||||
def map_type(clang_type: Type):
|
||||
canonical = clang_type.get_canonical()
|
||||
kind = canonical.kind
|
||||
spelling = (
|
||||
canonical.spelling.replace("const ", "")
|
||||
.replace("volatile ", "")
|
||||
.replace("restrict ", "")
|
||||
.replace("struct ", "")
|
||||
.replace("union ", "")
|
||||
)
|
||||
|
||||
if kind == TypeKind.POINTER:
|
||||
pointee = canonical.get_pointee()
|
||||
if pointee.kind == TypeKind.RECORD:
|
||||
decl = pointee.get_declaration()
|
||||
if not decl.is_definition():
|
||||
return "^void"
|
||||
|
||||
if pointee.kind == TypeKind.FUNCTIONPROTO:
|
||||
arg_types = []
|
||||
|
||||
for arg in pointee.get_canonical().argument_types():
|
||||
arg_types.append(map_type(arg))
|
||||
|
||||
mapped_return = map_type(pointee.get_canonical().get_result())
|
||||
args_str = ", ".join(arg_types)
|
||||
|
||||
return f"func({args_str}): {mapped_return}"
|
||||
|
||||
return f"^{map_type(pointee)}"
|
||||
|
||||
if kind == TypeKind.CONSTANTARRAY:
|
||||
element_type = canonical.get_array_element_type()
|
||||
size = canonical.get_array_size()
|
||||
return f"[{size}]{map_type(element_type)}"
|
||||
|
||||
if kind == TypeKind.INCOMPLETEARRAY:
|
||||
element_type = canonical.get_array_element_type()
|
||||
return f"[?]{map_type(element_type)}"
|
||||
|
||||
if kind == TypeKind.FUNCTIONPROTO or kind == TypeKind.FUNCTIONNOPROTO:
|
||||
arg_types = []
|
||||
|
||||
for arg in canonical.argument_types():
|
||||
arg_types.append(map_type(arg))
|
||||
|
||||
mapped_return = map_type(canonical.get_result())
|
||||
args_str = ", ".join(arg_types)
|
||||
|
||||
return f"func({args_str}): {mapped_return}"
|
||||
|
||||
if kind == TypeKind.VOID:
|
||||
return "void"
|
||||
|
||||
if kind == TypeKind.BOOL:
|
||||
return "bool"
|
||||
|
||||
if kind in [TypeKind.CHAR_S, TypeKind.SCHAR]:
|
||||
return "i8"
|
||||
if kind == TypeKind.CHAR_U or kind == TypeKind.UCHAR:
|
||||
return "u8"
|
||||
if kind == TypeKind.SHORT:
|
||||
return "i16"
|
||||
if kind == TypeKind.USHORT:
|
||||
return "u16"
|
||||
if kind == TypeKind.INT:
|
||||
return "i32"
|
||||
if kind == TypeKind.UINT:
|
||||
return "u32"
|
||||
if kind in [TypeKind.LONG, TypeKind.LONGLONG]:
|
||||
return "i64"
|
||||
if kind in [TypeKind.ULONG, TypeKind.ULONGLONG]:
|
||||
return "u64"
|
||||
|
||||
if kind == TypeKind.FLOAT:
|
||||
return "f32"
|
||||
if kind == TypeKind.DOUBLE or kind == TypeKind.LONGDOUBLE:
|
||||
return "f64"
|
||||
|
||||
if kind == TypeKind.RECORD:
|
||||
return spelling
|
||||
|
||||
raise Exception(f"Unresolved type: {spelling}")
|
||||
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python3 generate.py [path to header]", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
filename = sys.argv[1]
|
||||
|
||||
index = clang.cindex.Index.create()
|
||||
|
||||
tu = index.parse(filename, ["-x", "c", "-std=c23", "-I/usr/include"])
|
||||
|
||||
if tu.diagnostics:
|
||||
for diag in tu.diagnostics:
|
||||
if diag.severity >= clang.cindex.Diagnostic.Error:
|
||||
print(f"Error: {diag.spelling}", file=sys.stderr)
|
||||
|
||||
print(f'module "{os.path.basename(filename).split(".")[0]}"')
|
||||
print()
|
||||
|
||||
seen_structs = []
|
||||
|
||||
for cursor in tu.cursor.walk_preorder():
|
||||
if cursor.location.file and cursor.location.file.name != filename:
|
||||
continue
|
||||
|
||||
if cursor.kind == CursorKind.FUNCTION_DECL:
|
||||
name = cursor.spelling
|
||||
return_type = map_type(cursor.result_type)
|
||||
|
||||
params = []
|
||||
for arg in cursor.get_arguments():
|
||||
param_name = arg.spelling
|
||||
param_type = map_type(arg.type)
|
||||
params.append(f"{param_name}: {param_type}")
|
||||
|
||||
params_str = ", ".join(params)
|
||||
|
||||
print(f'export extern "{name}" func {name}({params_str}): {return_type}')
|
||||
|
||||
elif cursor.kind == CursorKind.STRUCT_DECL:
|
||||
if cursor.get_usr() in seen_structs:
|
||||
continue
|
||||
|
||||
seen_structs.append(cursor.get_usr())
|
||||
|
||||
if cursor.is_definition():
|
||||
name = cursor.spelling
|
||||
print(f"export struct {name}")
|
||||
print("{")
|
||||
for field in cursor.get_children():
|
||||
if field.kind == CursorKind.FIELD_DECL:
|
||||
field_name = field.spelling
|
||||
field_type = map_type(field.type)
|
||||
print(f" {field_name}: {field_type}")
|
||||
else:
|
||||
raise Exception(
|
||||
f"Unsupported child of struct: {field.spelling}: {field.kind}"
|
||||
)
|
||||
print("}")
|
||||
|
||||
elif cursor.kind == CursorKind.ENUM_DECL:
|
||||
name = cursor.spelling
|
||||
print(f"export enum {name} : u32")
|
||||
print("{")
|
||||
for field in cursor.get_children():
|
||||
if field.kind == CursorKind.ENUM_CONSTANT_DECL:
|
||||
field_name = field.spelling
|
||||
field_value = field.enum_value
|
||||
print(f" {field_name} = {field_value}")
|
||||
else:
|
||||
raise Exception(
|
||||
f"Unsupported child of enum: {field.spelling}: {field.kind}"
|
||||
)
|
||||
print("}")
|
||||
3
examples/.gitignore
vendored
3
examples/.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
.build
|
||||
out.a
|
||||
out
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
obj=$(nubc main.nub)
|
||||
clang $obj -o .build/out
|
||||
@@ -1,9 +0,0 @@
|
||||
module "main"
|
||||
|
||||
extern "puts" func puts(text: ^i8)
|
||||
|
||||
extern "main" func main(argc: i64, argv: [?]^i8): i64
|
||||
{
|
||||
puts("Hello, World!")
|
||||
return 0
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
obj=$(nubc main.nub generated/raylib.nub)
|
||||
clang $obj raylib-5.5_linux_amd64/lib/libraylib.a -lm -o .build/out
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,55 +0,0 @@
|
||||
import "raylib"
|
||||
|
||||
module "main"
|
||||
|
||||
extern "main" func main(argc: i64, argv: [?]^i8): i64
|
||||
{
|
||||
let uwu: []i32 = [1, 2]
|
||||
|
||||
raylib::SetConfigFlags(raylib::ConfigFlags.FLAG_VSYNC_HINT | raylib::ConfigFlags.FLAG_WINDOW_RESIZABLE)
|
||||
|
||||
raylib::InitWindow(1600, 900, "Hi from nub-lang")
|
||||
defer raylib::CloseWindow()
|
||||
|
||||
raylib::SetTargetFPS(240)
|
||||
|
||||
let width: i32 = 150
|
||||
let height: i32 = 150
|
||||
|
||||
let x: i32 = raylib::GetScreenWidth() / 2 - (width / 2)
|
||||
let y: i32 = raylib::GetScreenHeight() / 2 - (height / 2)
|
||||
|
||||
let direction: raylib::Vector2 = { x = 1 y = 1 }
|
||||
let speed: f32 = 250
|
||||
|
||||
let bgColor: raylib::Color = { r = 0 g = 0 b = 0 a = 255 }
|
||||
let color: raylib::Color = { r = 255 g = 255 b = 255 a = 255 }
|
||||
|
||||
while !raylib::WindowShouldClose()
|
||||
{
|
||||
if x <= 0 {
|
||||
direction.x = 1
|
||||
} else if x + width >= raylib::GetScreenWidth() {
|
||||
direction.x = -1
|
||||
}
|
||||
|
||||
if y <= 0 {
|
||||
direction.y = 1
|
||||
} else if y + height >= raylib::GetScreenHeight() {
|
||||
direction.y = -1
|
||||
}
|
||||
|
||||
x = x + @cast(direction.x * speed * raylib::GetFrameTime())
|
||||
y = y + @cast(direction.y * speed * raylib::GetFrameTime())
|
||||
|
||||
raylib::BeginDrawing()
|
||||
{
|
||||
raylib::ClearBackground(bgColor)
|
||||
raylib::DrawFPS(10, 10)
|
||||
raylib::DrawRectangle(x, y, width, height, color)
|
||||
}
|
||||
raylib::EndDrawing()
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,16 +0,0 @@
|
||||
Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
|
||||
|
||||
This software is provided "as-is", without any express or implied warranty. In no event
|
||||
will the authors be held liable for any damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose, including commercial
|
||||
applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you
|
||||
wrote the original software. If you use this software in a product, an acknowledgment
|
||||
in the product documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||
as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
@@ -1,150 +0,0 @@
|
||||
<img align="left" style="width:260px" src="https://github.com/raysan5/raylib/blob/master/logo/raylib_logo_animation.gif" width="288px">
|
||||
|
||||
**raylib is a simple and easy-to-use library to enjoy videogames programming.**
|
||||
|
||||
raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's especially well suited for prototyping, tooling, graphical applications, embedded systems and education.
|
||||
|
||||
*NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no debug button... just coding in the most pure spartan-programmers way.*
|
||||
|
||||
Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html)
|
||||
|
||||
---
|
||||
|
||||
<br>
|
||||
|
||||
[](https://github.com/raysan5/raylib/releases)
|
||||
[](https://github.com/raysan5/raylib/stargazers)
|
||||
[](https://github.com/raysan5/raylib/commits/master)
|
||||
[](https://github.com/sponsors/raysan5)
|
||||
[](https://repology.org/project/raylib/versions)
|
||||
[](LICENSE)
|
||||
|
||||
[](https://discord.gg/raylib)
|
||||
[](https://www.reddit.com/r/raylib/)
|
||||
[](https://www.youtube.com/c/raylib)
|
||||
[](https://www.twitch.tv/raysan5)
|
||||
|
||||
[](https://github.com/raysan5/raylib/actions?query=workflow%3AWindows)
|
||||
[](https://github.com/raysan5/raylib/actions?query=workflow%3ALinux)
|
||||
[](https://github.com/raysan5/raylib/actions?query=workflow%3AmacOS)
|
||||
[](https://github.com/raysan5/raylib/actions?query=workflow%3AWebAssembly)
|
||||
|
||||
[](https://github.com/raysan5/raylib/actions?query=workflow%3ACMakeBuilds)
|
||||
[](https://github.com/raysan5/raylib/actions/workflows/windows_examples.yml)
|
||||
[](https://github.com/raysan5/raylib/actions/workflows/linux_examples.yml)
|
||||
|
||||
features
|
||||
--------
|
||||
- **NO external dependencies**, all required libraries are [bundled into raylib](https://github.com/raysan5/raylib/tree/master/src/external)
|
||||
- Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!**
|
||||
- Written in plain C code (C99) using PascalCase/camelCase notation
|
||||
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3, ES 2.0, ES 3.0**)
|
||||
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
|
||||
- Multiple **Fonts** formats supported (TTF, OTF, FNT, BDF, sprite fonts)
|
||||
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
|
||||
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
|
||||
- Flexible Materials system, supporting classic maps and **PBR maps**
|
||||
- **Animated 3D models** supported (skeletal bones animation) (IQM, M3D, glTF)
|
||||
- Shaders support, including model shaders and **postprocessing** shaders
|
||||
- **Powerful math module** for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h)
|
||||
- Audio loading and playing with streaming support (WAV, QOA, OGG, MP3, FLAC, XM, MOD)
|
||||
- **VR stereo rendering** support with configurable HMD device parameters
|
||||
- Huge examples collection with [+140 code examples](https://github.com/raysan5/raylib/tree/master/examples)!
|
||||
- Bindings to [+70 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
|
||||
- **Free and open source**
|
||||
|
||||
basic example
|
||||
--------------
|
||||
This is a basic raylib example, it creates a window and draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/core/loader.html?name=core_basic_window).
|
||||
```c
|
||||
#include "raylib.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
InitWindow(800, 450, "raylib [core] example - basic window");
|
||||
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
BeginDrawing();
|
||||
ClearBackground(RAYWHITE);
|
||||
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
||||
EndDrawing();
|
||||
}
|
||||
|
||||
CloseWindow();
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
build and installation
|
||||
----------------------
|
||||
|
||||
raylib binary releases for Windows, Linux, macOS, Android and HTML5 are available at the [Github Releases page](https://github.com/raysan5/raylib/releases).
|
||||
|
||||
raylib is also available via multiple package managers on multiple OS distributions.
|
||||
|
||||
#### Installing and building raylib on multiple platforms
|
||||
|
||||
[raylib Wiki](https://github.com/raysan5/raylib/wiki#development-platforms) contains detailed instructions on building and usage on multiple platforms.
|
||||
|
||||
- [Working on Windows](https://github.com/raysan5/raylib/wiki/Working-on-Windows)
|
||||
- [Working on macOS](https://github.com/raysan5/raylib/wiki/Working-on-macOS)
|
||||
- [Working on GNU Linux](https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux)
|
||||
- [Working on Chrome OS](https://github.com/raysan5/raylib/wiki/Working-on-Chrome-OS)
|
||||
- [Working on FreeBSD](https://github.com/raysan5/raylib/wiki/Working-on-FreeBSD)
|
||||
- [Working on Raspberry Pi](https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi)
|
||||
- [Working for Android](https://github.com/raysan5/raylib/wiki/Working-for-Android)
|
||||
- [Working for Web (HTML5)](https://github.com/raysan5/raylib/wiki/Working-for-Web-(HTML5))
|
||||
- [Working anywhere with CMake](https://github.com/raysan5/raylib/wiki/Working-with-CMake)
|
||||
|
||||
*Note that the Wiki is open for edit, if you find some issues while building raylib for your target platform, feel free to edit the Wiki or open an issue related to it.*
|
||||
|
||||
#### Setup raylib with multiple IDEs
|
||||
|
||||
raylib has been developed on Windows platform using [Notepad++](https://notepad-plus-plus.org/) and [MinGW GCC](https://www.mingw-w64.org/) compiler but it can be used with other IDEs on multiple platforms.
|
||||
|
||||
[Projects directory](https://github.com/raysan5/raylib/tree/master/projects) contains several ready-to-use **project templates** to build raylib and code examples with multiple IDEs.
|
||||
|
||||
*Note that there are lots of IDEs supported, some of the provided templates could require some review, so please, if you find some issue with a template or you think they could be improved, feel free to send a PR or open a related issue.*
|
||||
|
||||
learning and docs
|
||||
------------------
|
||||
|
||||
raylib is designed to be learned using [the examples](https://github.com/raysan5/raylib/tree/master/examples) as the main reference. There is no standard API documentation but there is a [**cheatsheet**](https://www.raylib.com/cheatsheet/cheatsheet.html) containing all the functions available on the library a short description of each one of them, input parameters and result value names should be intuitive enough to understand how each function works.
|
||||
|
||||
Some additional documentation about raylib design can be found in [raylib GitHub Wiki](https://github.com/raysan5/raylib/wiki). Here are the relevant links:
|
||||
|
||||
- [raylib cheatsheet](https://www.raylib.com/cheatsheet/cheatsheet.html)
|
||||
- [raylib architecture](https://github.com/raysan5/raylib/wiki/raylib-architecture)
|
||||
- [raylib library design](https://github.com/raysan5/raylib/wiki)
|
||||
- [raylib examples collection](https://github.com/raysan5/raylib/tree/master/examples)
|
||||
- [raylib games collection](https://github.com/raysan5/raylib-games)
|
||||
|
||||
|
||||
contact and networks
|
||||
---------------------
|
||||
|
||||
raylib is present in several networks and raylib community is growing everyday. If you are using raylib and enjoying it, feel free to join us in any of these networks. The most active network is our [Discord server](https://discord.gg/raylib)! :)
|
||||
|
||||
- Webpage: [https://www.raylib.com](https://www.raylib.com)
|
||||
- Discord: [https://discord.gg/raylib](https://discord.gg/raylib)
|
||||
- Twitter: [https://www.twitter.com/raysan5](https://www.twitter.com/raysan5)
|
||||
- Twitch: [https://www.twitch.tv/raysan5](https://www.twitch.tv/raysan5)
|
||||
- Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
||||
- Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib)
|
||||
- YouTube: [https://www.youtube.com/channel/raylib](https://www.youtube.com/c/raylib)
|
||||
|
||||
contributors
|
||||
------------
|
||||
|
||||
<a href="https://github.com/raysan5/raylib/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=raysan5/raylib&max=500&columns=20&anon=1" />
|
||||
</a>
|
||||
|
||||
license
|
||||
-------
|
||||
|
||||
raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.
|
||||
|
||||
raylib uses internally some libraries for window/graphics/inputs management and also to support different file formats loading, all those libraries are embedded with and are available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib dependencies LICENSES](https://github.com/raysan5/raylib/wiki/raylib-dependencies) on [raylib Wiki](https://github.com/raysan5/raylib/wiki) for details.
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1 +0,0 @@
|
||||
libraylib.so.550
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
libraylib.so.5.5.0
|
||||
4
vscode-lsp/.gitignore
vendored
4
vscode-lsp/.gitignore
vendored
@@ -1,4 +0,0 @@
|
||||
node_modules
|
||||
out
|
||||
nub-*.vsix
|
||||
server
|
||||
17
vscode-lsp/.vscode/launch.json
vendored
17
vscode-lsp/.vscode/launch.json
vendored
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Run Extension",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}"
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/out/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "${defaultBuildTask}"
|
||||
}
|
||||
]
|
||||
}
|
||||
8
vscode-lsp/.vscode/settings.json
vendored
8
vscode-lsp/.vscode/settings.json
vendored
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"files.exclude": {},
|
||||
"search.exclude": {
|
||||
"out": true,
|
||||
"node_modules": true,
|
||||
},
|
||||
"typescript.tsc.autoDetect": "off"
|
||||
}
|
||||
18
vscode-lsp/.vscode/tasks.json
vendored
18
vscode-lsp/.vscode/tasks.json
vendored
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch",
|
||||
"problemMatcher": "$tsc-watch",
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
{
|
||||
"comments": {
|
||||
"lineComment": {
|
||||
"comment": "//"
|
||||
},
|
||||
"blockComment": [
|
||||
"/*",
|
||||
"*/"
|
||||
]
|
||||
},
|
||||
"brackets": [
|
||||
[
|
||||
"{",
|
||||
"}"
|
||||
],
|
||||
[
|
||||
"[",
|
||||
"]"
|
||||
],
|
||||
[
|
||||
"(",
|
||||
")"
|
||||
]
|
||||
],
|
||||
"autoClosingPairs": [
|
||||
{
|
||||
"open": "{",
|
||||
"close": "}"
|
||||
},
|
||||
{
|
||||
"open": "[",
|
||||
"close": "]"
|
||||
},
|
||||
{
|
||||
"open": "(",
|
||||
"close": ")"
|
||||
},
|
||||
{
|
||||
"open": "\"",
|
||||
"close": "\""
|
||||
},
|
||||
{
|
||||
"open": "'",
|
||||
"close": "'"
|
||||
}
|
||||
],
|
||||
"surroundingPairs": [
|
||||
[
|
||||
"{",
|
||||
"}"
|
||||
],
|
||||
[
|
||||
"[",
|
||||
"]"
|
||||
],
|
||||
[
|
||||
"(",
|
||||
")"
|
||||
],
|
||||
[
|
||||
"\"",
|
||||
"\""
|
||||
],
|
||||
[
|
||||
"'",
|
||||
"'"
|
||||
]
|
||||
]
|
||||
}
|
||||
4811
vscode-lsp/package-lock.json
generated
4811
vscode-lsp/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,57 +0,0 @@
|
||||
{
|
||||
"name": "nub",
|
||||
"displayName": "Nub Language Support",
|
||||
"description": "Language server client for nub lang",
|
||||
"version": "0.0.1",
|
||||
"publisher": "nub31",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.oliste.no/nub31/nub-lang"
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.105.0"
|
||||
},
|
||||
"categories": [
|
||||
"Programming Languages"
|
||||
],
|
||||
"main": "./out/extension.js",
|
||||
"files": [
|
||||
"out",
|
||||
"server",
|
||||
"syntaxes",
|
||||
"language-configuration.json"
|
||||
],
|
||||
"contributes": {
|
||||
"languages": [
|
||||
{
|
||||
"id": "nub",
|
||||
"extensions": [
|
||||
".nub"
|
||||
],
|
||||
"configuration": "./language-configuration.json"
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
{
|
||||
"language": "nub",
|
||||
"scopeName": "source.nub",
|
||||
"path": "./syntaxes/nub.tmLanguage.json"
|
||||
}
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"build": "esbuild src/extension.ts --bundle --platform=node --outfile=out/extension.js --external:vscode",
|
||||
"update-lsp": "mkdir -p server && dotnet publish -c Release ../compiler/NubLang.LSP/NubLang.LSP.csproj && cp ../compiler/NubLang.LSP/bin/Release/net9.0/linux-x64/publish/nublsp server/",
|
||||
"package": "npm run update-lsp && npm run build && vsce package --skip-license"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "22.x",
|
||||
"@types/vscode": "^1.105.0",
|
||||
"@vscode/vsce": "^3.6.2",
|
||||
"esbuild": "^0.25.11",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-languageclient": "^9.0.1"
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
import path from 'path';
|
||||
import vscode from 'vscode';
|
||||
import { LanguageClient, TransportKind } from 'vscode-languageclient/node';
|
||||
|
||||
let client: LanguageClient;
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext) {
|
||||
const serverExecutable = path.join(context.asAbsolutePath('server'), "nublsp");
|
||||
|
||||
client = new LanguageClient(
|
||||
'nub',
|
||||
'nub lsp client',
|
||||
{
|
||||
run: {
|
||||
command: serverExecutable,
|
||||
transport: TransportKind.stdio,
|
||||
},
|
||||
debug: {
|
||||
command: serverExecutable,
|
||||
transport: TransportKind.stdio,
|
||||
args: ['--debug'],
|
||||
}
|
||||
},
|
||||
{
|
||||
documentSelector: [
|
||||
{ scheme: 'file', language: 'nub' },
|
||||
{ scheme: 'file', pattern: '**/*.nub' }
|
||||
],
|
||||
synchronize: {
|
||||
fileEvents: vscode.workspace.createFileSystemWatcher('**/.clientrc')
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
client.start();
|
||||
}
|
||||
|
||||
export function deactivate(): Thenable<void> | undefined {
|
||||
if (!client) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return client.stop();
|
||||
}
|
||||
@@ -1,304 +0,0 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
||||
"name": "nub",
|
||||
"scopeName": "source.nub",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#modifiers"
|
||||
},
|
||||
{
|
||||
"include": "#types"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#numbers"
|
||||
},
|
||||
{
|
||||
"include": "#operators"
|
||||
},
|
||||
{
|
||||
"include": "#function-definition"
|
||||
},
|
||||
{
|
||||
"include": "#struct-definition"
|
||||
},
|
||||
{
|
||||
"include": "#function-call"
|
||||
},
|
||||
{
|
||||
"include": "#identifiers"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"comments": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "comment.line.double-slash.nub",
|
||||
"begin": "//",
|
||||
"end": "$"
|
||||
},
|
||||
{
|
||||
"name": "comment.block.nub",
|
||||
"begin": "/\\*",
|
||||
"end": "\\*/"
|
||||
}
|
||||
]
|
||||
},
|
||||
"keywords": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "keyword.control.nub",
|
||||
"match": "\\b(if|else|while|for|in|break|continue|return|let|defer)\\b"
|
||||
},
|
||||
{
|
||||
"name": "keyword.other.nub",
|
||||
"match": "\\b(func|struct|module|import)\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
"modifiers": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "storage.modifier.nub",
|
||||
"match": "\\b(export|extern)\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
"types": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#function-type"
|
||||
},
|
||||
{
|
||||
"name": "storage.type.primitive.nub",
|
||||
"match": "\\b(i8|i16|i32|i64|u8|u16|u32|u64|f32|f64|bool|string|cstring|void|any)\\b"
|
||||
},
|
||||
{
|
||||
"name": "storage.type.array.nub",
|
||||
"match": "\\[\\]"
|
||||
},
|
||||
{
|
||||
"name": "storage.type.pointer.nub",
|
||||
"match": "\\^"
|
||||
}
|
||||
]
|
||||
},
|
||||
"function-type": {
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "\\b(func)\\s*\\(",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.type.function.nub"
|
||||
}
|
||||
},
|
||||
"end": "(?<=\\))(?:\\s*:\\s*([^\\s,;{}()]+))?",
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "storage.type.nub"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#function-type-parameters"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"function-type-parameters": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "\\.\\.\\.",
|
||||
"name": "keyword.operator.variadic.nub"
|
||||
},
|
||||
{
|
||||
"include": "#types"
|
||||
},
|
||||
{
|
||||
"match": ",",
|
||||
"name": "punctuation.separator.nub"
|
||||
}
|
||||
]
|
||||
},
|
||||
"strings": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "string.quoted.double.nub",
|
||||
"begin": "\"",
|
||||
"end": "\"",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.character.escape.nub",
|
||||
"match": "\\\\(n|t|r|\\\\|\"|')"
|
||||
},
|
||||
{
|
||||
"name": "constant.character.escape.nub",
|
||||
"match": "\\\\[0-7]{1,3}"
|
||||
},
|
||||
{
|
||||
"name": "constant.character.escape.nub",
|
||||
"match": "\\\\x[0-9A-Fa-f]{1,2}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "string.quoted.single.nub",
|
||||
"begin": "'",
|
||||
"end": "'",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.character.escape.nub",
|
||||
"match": "\\\\(n|t|r|\\\\|\"|')"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"numbers": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.numeric.float.nub",
|
||||
"match": "\\b\\d+\\.\\d*([eE][+-]?\\d+)?[fF]?\\b"
|
||||
},
|
||||
{
|
||||
"name": "constant.numeric.integer.decimal.nub",
|
||||
"match": "\\b\\d+\\b"
|
||||
},
|
||||
{
|
||||
"name": "constant.numeric.integer.hexadecimal.nub",
|
||||
"match": "\\b0[xX][0-9A-Fa-f]+\\b"
|
||||
},
|
||||
{
|
||||
"name": "constant.numeric.integer.binary.nub",
|
||||
"match": "\\b0[bB][01]+\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
"operators": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "keyword.operator.assignment.nub",
|
||||
"match": "="
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.comparison.nub",
|
||||
"match": "(==|!=|<=|>=|<|>)"
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.arithmetic.nub",
|
||||
"match": "(\\+|\\-|\\*|/)"
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.logical.nub",
|
||||
"match": "(&&|\\|\\||!)"
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.address.nub",
|
||||
"match": "&"
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.dereference.nub",
|
||||
"match": "\\^"
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.member-access.nub",
|
||||
"match": "\\."
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.module-access.nub",
|
||||
"match": "::"
|
||||
}
|
||||
]
|
||||
},
|
||||
"function-definition": {
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "\\b(export\\s+|extern\\s+)?(func)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\(",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.modifier.nub"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.other.nub"
|
||||
},
|
||||
"3": {
|
||||
"name": "entity.name.function.nub"
|
||||
}
|
||||
},
|
||||
"end": "\\)",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#function-parameters"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"struct-definition": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "\\b(struct)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\b",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.other.nub"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.type.struct.nub"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"function-parameters": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "\\.\\.\\.",
|
||||
"name": "keyword.operator.variadic.nub"
|
||||
},
|
||||
{
|
||||
"match": "([a-zA-Z_][a-zA-Z0-9_]*)\\s*:\\s*",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "variable.parameter.nub"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"include": "#types"
|
||||
},
|
||||
{
|
||||
"include": "#identifiers"
|
||||
}
|
||||
]
|
||||
},
|
||||
"function-call": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "entity.name.function.call.nub"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"identifiers": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "variable.other.nub",
|
||||
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "Node16",
|
||||
"target": "ES2022",
|
||||
"outDir": "out",
|
||||
"lib": [
|
||||
"ES2022"
|
||||
],
|
||||
"sourceMap": true,
|
||||
"rootDir": "src",
|
||||
"strict": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user