genotrance / nimtreesitter Goto Github PK
View Code? Open in Web Editor NEWtreesitter is a Nim wrapper for the tree-sitter library
License: MIT License
treesitter is a Nim wrapper for the tree-sitter library
License: MIT License
Hi,
I tried this small example, but it fails to build, it seems it fails to link binary.
import treesitter/api
import treesitter_ruby/ruby
var p = tsParserNew()
assert p.tsParserSetLanguage(treeSitterruby()) == true
let code = """
puts "Hello"
"""
let tree = p.tsParserParseString(nil, code.cstring, code.len.uint32)
p.tsParserDelete()
Error:
nim c ruby_parser.nim
...........................................................................
/home/lz/snippets/nim/ruby_parser.nim(12, 5) Hint: 'tree' is declared but not used [XDeclaredButNotUsed]
CC: ruby_parser.nim
Hint: [Link]
/bin/ld: /home/lz/.cache/nim/ruby_parser_d/scannerruby.o: in function `(anonymous namespace)::Heredoc::Heredoc()':
scanner.cc:(.text+0x14): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()'
/bin/ld: /home/lz/.cache/nim/ruby_parser_d/scannerruby.o: in function `(anonymous namespace)::Scanner::serialize(char*)':
scanner.cc:(.text+0x323): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const'
...
/bin/ld: /home/lz/.cache/nim/ruby_parser_d/scannerruby.o:(.data.rel.local.DW.ref.__gxx_personality_v0[DW.ref.__gxx_personality_v0]+0x0): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status
Error: execution of an external program failed: 'gcc -o /home/lz/snippets/nim/ruby_parser /home/lz/.cache/nim/ruby_parser_d/lib.c.o /home/lz/.cache/nim/ruby_parser_d/parserruby.o /home/lz/.cache/nim/ruby_parser_d/scannerruby.o /home/lz/.cache/nim/ruby_parser_d/stdlib_digitsutils.nim.c.o /home/lz/.cache/nim/ruby_parser_d/stdlib_assertions.nim.c.o /home/lz/.cache/nim/ruby_parser_d/stdlib_dollars.nim.c.o /home/lz/.cache/nim/ruby_parser_d/stdlib_system.nim.c.o /home/lz/.cache/nim/ruby_parser_d/@mruby_parser.nim.c.o -lm -lm -ldl'
nimble install treesitter_typescript
Downloading https://github.com/genotrance/nimtreesitter using git (subdir is 'treesitter_typescript')
Setting up Git repo: https://github.com/tree-sitter/tree-sitter-typescript
Pulling repository
Creating treesitter_typescript/typescript/typescript/src/parser.h
Creating treesitter_typescript/typescript.nim
Verifying dependencies for [email protected]
Warning: No .nimble or .nimble-link file found for /home/g/.nimble/pkgs/treesitter_typescript-0.1.1
Info: Dependency on nimgen@>= 0.5.0 already satisfied
Verifying dependencies for [email protected]
Info: Dependency on c2nim@>= 0.9.14 already satisfied
Verifying dependencies for [email protected]
Info: Dependency on regex@>= 0.10.0 already satisfied
Verifying dependencies for [email protected]
Info: Dependency on unicodedb@>= 0.7.2 already satisfied
Verifying dependencies for [email protected]
Info: Dependency on unicodeplus@>= 0.5.0 already satisfied
Verifying dependencies for [email protected]
Info: Dependency on unicodedb@>= 0.7 already satisfied
Verifying dependencies for [email protected]
Info: Dependency on treesitter@>= 0.1.1 already satisfied
Verifying dependencies for [email protected]
Info: Dependency on nimgen@>= 0.5.0 already satisfied
Verifying dependencies for [email protected]
Info: Dependency on c2nim@>= 0.9.14 already satisfied
Verifying dependencies for [email protected]
Info: Dependency on regex@>= 0.10.0 already satisfied
Verifying dependencies for [email protected]
Info: Dependency on unicodedb@>= 0.7.2 already satisfied
Verifying dependencies for [email protected]
Info: Dependency on unicodeplus@>= 0.5.0 already satisfied
Verifying dependencies for [email protected]
Info: Dependency on unicodedb@>= 0.7 already satisfied
Verifying dependencies for [email protected]
Installing [email protected]
oserr.nim(94) raiseOSError
Error: unhandled exception: File exists
Additional info: "/tmp/nimble_10505/githubcom_genotrancenimtreesitter/treesitter_typescript/treesitter_typescript/typescript/tsx/corpus/common" [OSError]
Not sure where exactly this error is coming from, any tips to debug?
It looks like tree-sitter repo has changed it's file structure so the sparse checkout globs need to be updated.
Output:
nimble install treesitter
Downloading https://github.com/genotrance/nimtreesitter using git (subdir is 'treesitter')
Setting up Git repo: https://github.com/tree-sitter/tree-sitter/
Pulling repository
Command failed: 1
git pull --depth=1 origin master
From https://github.com/tree-sitter/tree-sitter
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
error: Sparse checkout leaves no entry on working directory
stack trace: (most recent call last)
/private/tmp/nimblecache/nimscriptapi.nim(176, 29)
/private/tmp/nimble_4854/githubcom_genotrancenimtreesitter/treesitter/treesitter_4854.nims(34, 12) installBefore
/private/tmp/nimble_4854/githubcom_genotrancenimtreesitter/treesitter/treesitter_4854.nims(31, 8) setupTask
/Users/prestonknopp/.choosenim/toolchains/nim-0.20.0/lib/system/nimscript.nim(242, 7) exec
/Users/prestonknopp/.choosenim/toolchains/nim-0.20.0/lib/system/nimscript.nim(242, 7) Error: unhandled exception: FAILED: nimgen treesitter.cfg
Tip: 2 messages have been suppressed, use --verbose to show them.
Error: Exception raised during nimble script execution
Trying to install using nimble install treesitter --verbose
Reading official package list
Downloading https://github.com/genotrance/nimtreesitter using git (subdir is 'treesitter')
Cloning latest tagged version: v0.1.0
Attempting to execute hook installBefore in /tmp/nimble_22065/githubcom_genotrancenimtreesitter/treesitter/treesitter.nimble
Setting up Git repo: https://github.com/tree-sitter/tree-sitter/
Pulling repository
Command failed: 1
git pull --depth=1 origin master
From https://github.com/tree-sitter/tree-sitter
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
error: Sparse checkout leaves no entry on working directory
stack trace: (most recent call last)
/tmp/nimblecache/nimscriptapi.nim(177, 29)
/tmp/nimble_22065/githubcom_genotrancenimtreesitter/treesitter/treesitter_22065.nims(34, 12) installBefore
/tmp/nimble_22065/githubcom_genotrancenimtreesitter/treesitter/treesitter_22065.nims(31, 8) setupTask
/home/sokil/.choosenim/toolchains/nim-1.0.2/lib/system/nimscript.nim(252, 7) exec
/home/sokil/.choosenim/toolchains/nim-1.0.2/lib/system/nimscript.nim(252, 7) Error: unhandled exception: FAILED: nimgen treesitter.cfg [OSError]
Error: Exception raised during nimble script execution
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.