tree-sitter / tree-sitter-cli

CLI tool for creating and testing tree-sitter parsers
MIT License
45 stars 15 forks source link

Document invalid grammar names #39

Closed Aerijo closed 6 years ago

Aerijo commented 6 years ago

I'm not sure where this issue begins, so I'm raising it here, but I noticed - in a grammar name (or possibly the file name) generates an invalid C parser. It looks like the grammar name is being passed directly to make the variable name, so only word characters will be accepted.

This should probably be added to the docs (I see they implicitly suggest using underscores in the example).

$> node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@8.9.3 | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CC(target) Release/obj.target/tree_sitter_quick-check_binding/src/parser.o
../src/parser.c:253:43: error: expected ';' after top level declarator
extern const TSLanguage *tree_sitter_quick-check() {
                                          ^
                                          ;
1 error generated.
make: *** [Release/obj.target/tree_sitter_quick-check_binding/src/parser.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
maxbrunsfeld commented 6 years ago

Yeah, I think adding an explicit error for this in here would make sense.