Comments (5)
Tree-sitter regexes are single-line by default so I think the explicit newline is actually throwing it off. Other grammars like JS, Python or Bash use .*
sans newline for single-line comments; the Java grammar has what seems like an unnecessary negative (anything but a newline) character class.
I've created #74 , please check it out!
from tree-sitter-sql.
Could a lazy /.*?\n/ do the trick?
Yeah I think that would do it, want to open a PR for it?
from tree-sitter-sql.
I tried locally and couldn't make it work. Am I doing something wrong?
Here's what I do, using helix:
- In
$HELIX_RUNTIME/grammars
runrm sql.so
- In
$HELIX_RUNTIME/grammars/sources/sql
editgrammar.js
- Run
hx --grammar build
- Open a fresh hx instance to check if it changed something.
It confirms rebuilding sql - but my changes to grammar.js
appear to have no effect at all. (Even if I change "--"
for something bogus, comments in the SQL file are still highlighted as comments.)
Could you try verifying the fix?
from tree-sitter-sql.
I have tested it on my machine and the suggested regex does not fix the issue:
comment: _ => seq('--', /.*?\n/),
with following SQL:
--
CREATE TABLE tx_digibordauthentication_activity_log
(
uid int(11) unsigned NOT NULL auto_increment,
);
produces this AST:
(program [0, 0] - [5, 0]
(comment [0, 0] - [2, 0])
(ERROR [2, 0] - [4, 2]
(keyword_not [3, 23] - [3, 26])
(keyword_null [3, 27] - [3, 31])
(keyword_auto_increment [3, 32] - [3, 46])))
playground.sql 0 ms (ERROR [2, 0] - [4, 2])
from tree-sitter-sql.
Fixed by #74
from tree-sitter-sql.
Related Issues (20)
- Array dereference not supported
- Field expression not supported
- Additional dollar quote support HOT 2
- Highlighting queries rely on neovim-only `lua-match` HOT 4
- segfault HOT 16
- Scanner.c is missing on npm, therefore preventing the package installation HOT 3
- Include parser files in Release Assets HOT 5
- Syntax highlighting appears to give up in Postgres function bodies HOT 1
- Syntax highlighting breaks when using $ in VALUES HOT 4
- Invalid node type "keyword_without" on nightly HOT 2
- Cargo.toml missing on gh-pages branch HOT 3
- Trailing Comma - Snowflake HOT 4
- IGNORE NULLS breaks window function parsing HOT 1
- Support for check constraints HOT 1
- UNIQUE constraint not parsed correctly
- Cannot run in a macOS environment
- Support for COPY FROM STDIN HOT 10
- specific statement after a specific pg alter table is not parsed correctly HOT 4
- Improve partial query handling HOT 2
- Add backslashed single quotes to grammar HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tree-sitter-sql.