mirror of
https://github.com/safishamsi/graphify.git
synced 2026-09-29 00:45:58 +00:00
Merge PR #745: add .luau extension support (Roblox Luau)
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ class FileType(str, Enum):
|
||||
|
||||
_MANIFEST_PATH = "graphify-out/manifest.json"
|
||||
|
||||
CODE_EXTENSIONS = {'.py', '.ts', '.js', '.jsx', '.tsx', '.mjs', '.ejs', '.go', '.rs', '.java', '.cpp', '.cc', '.cxx', '.c', '.h', '.hpp', '.rb', '.swift', '.kt', '.kts', '.cs', '.scala', '.php', '.lua', '.toc', '.zig', '.ps1', '.ex', '.exs', '.m', '.mm', '.jl', '.vue', '.svelte', '.dart', '.v', '.sv', '.sql', '.r', '.f', '.F', '.f90', '.F90', '.f95', '.F95', '.f03', '.F03', '.f08', '.F08'}
|
||||
CODE_EXTENSIONS = {'.py', '.ts', '.js', '.jsx', '.tsx', '.mjs', '.ejs', '.go', '.rs', '.java', '.cpp', '.cc', '.cxx', '.c', '.h', '.hpp', '.rb', '.swift', '.kt', '.kts', '.cs', '.scala', '.php', '.lua', '.luau', '.toc', '.zig', '.ps1', '.ex', '.exs', '.m', '.mm', '.jl', '.vue', '.svelte', '.dart', '.v', '.sv', '.sql', '.r', '.f', '.F', '.f90', '.F90', '.f95', '.F95', '.f03', '.F03', '.f08', '.F08'}
|
||||
DOC_EXTENSIONS = {'.md', '.mdx', '.txt', '.rst', '.html', '.yaml', '.yml'}
|
||||
PAPER_EXTENSIONS = {'.pdf'}
|
||||
IMAGE_EXTENSIONS = {'.png', '.jpg', '.jpeg', '.gif', '.webp', '.svg'}
|
||||
|
||||
@@ -4087,6 +4087,7 @@ _DISPATCH: dict[str, Any] = {
|
||||
".php": extract_php,
|
||||
".swift": extract_swift,
|
||||
".lua": extract_lua,
|
||||
".luau": extract_lua,
|
||||
".toc": extract_lua,
|
||||
".zig": extract_zig,
|
||||
".ps1": extract_powershell,
|
||||
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
-- Luau sample (Roblox): typed Lua superset.
|
||||
-- tree-sitter-lua doesn't parse the type annotations, but extracts
|
||||
-- function declarations and call edges fine.
|
||||
|
||||
local Server = {}
|
||||
Server.__index = Server
|
||||
|
||||
type ServerConfig = {
|
||||
port: number,
|
||||
name: string?,
|
||||
}
|
||||
|
||||
function Server.new(config: ServerConfig): Server
|
||||
local self = setmetatable({}, Server)
|
||||
self.port = config.port
|
||||
self.name = config.name or "default"
|
||||
return self
|
||||
end
|
||||
|
||||
function Server:start(): ()
|
||||
print(string.format("listening on :%d", self.port))
|
||||
end
|
||||
|
||||
function Server:stop(): ()
|
||||
print("stopped")
|
||||
end
|
||||
|
||||
local function main()
|
||||
local s = Server.new({ port = 8080 })
|
||||
s:start()
|
||||
end
|
||||
|
||||
main()
|
||||
|
||||
return Server
|
||||
@@ -61,7 +61,7 @@ def test_collect_files_from_dir():
|
||||
supported = {".py", ".js", ".ts", ".tsx", ".go", ".rs",
|
||||
".java", ".c", ".cpp", ".cc", ".cxx", ".rb",
|
||||
".cs", ".kt", ".kts", ".scala", ".php", ".h", ".hpp",
|
||||
".swift", ".lua", ".toc", ".zig", ".ps1", ".ex", ".exs",
|
||||
".swift", ".lua", ".luau", ".toc", ".zig", ".ps1", ".ex", ".exs",
|
||||
".m", ".mm"}
|
||||
assert all(f.suffix in supported for f in files)
|
||||
assert len(files) > 0
|
||||
|
||||
Reference in New Issue
Block a user