Closed jmacmahon closed 5 months ago
Update: everything works fine on Linux + Clang
OK, after some digging I have found the following:
L'...'
syntax in C is a way of writing values of type wchar_t
.sizeof(wchar_t) == 4
, i.e. 32 bits, so literals greater than \U0000FFFF
work fine.sizeof(wchar_t) == 2
, i.e. 16 bits, so literals greater than \U0000FFFF
cause compile errors.punctuation_chars.h
, these character literals are assigned to int32_t
, which ought to be big enough to hold the high-valued characters, but since they are written using the L'...'
syntax, they must first go through wchar_t
.It seems to me that the best solution would be to write these characters as integer literals instead of wchar_t
literals, if that makes sense?
Hi @jmacmahon thanks for debugging the problem!
It seems to me that the best solution would be to write these characters as integer literals instead of wchar_t literals, if that makes sense?
That makes sense, feel free to send a PR if you want!
/cc @SilverRainZ in case you have some opinions about this.
Hi,
I was working on a PR but got sidetracked trying to work out why the tests still passed on Windows despite the error - I assumed that there was no CI for Windows hence the error not being caught, but I see that in fact there is CI for Windows, but the tests nevertheless passed.
I was able to reproduce the unexpectedly-passing tests on my local Windows machine, but I couldn't work out why they were passing. In fact, I was able to completely delete the punctuation_chars.h
file from my repo and run npm run test
and have all the tests still pass.
So, I can do a PR with my suggested change, but actually I have no way of knowing if it would fix the problem since I can't get the tests to work right.
@jmacmahon you may be missing running npm run build
before running the tests.
Unfortunately the tests still unexpectedly pass even if I do npm run build
before npm run test
- although you are right that deleting the entire file does cause these to fail as expected.
(As an aside, I found that npm run build
modified src/parser.c
file with some number differences, but I think this is unrelated?)
Well, why the tests unexpectedly passed on Windows is beyond me, but I have submitted a PR anyway to fix the original problem.
Hello,
I am setting up tree-sitter on a fresh installation today, and experiencing the following errors:
I'm not too familiar with tree-sitter internals or C, but from some googling I think this
L'\U00010100'
is somehow not correct? Possibly this is related to the fix for #53.Sorry I can't be of more help in diagnosing this - I'm happy to run any tests you might suggest.
I will try and see if the problem is reproducible on Linux + Clang.