Open eddie-thomas opened 1 year ago
@eddie-thomas Hi Eddie, help is always welcome :) Some things to note:
Firstly, the best approach for implementation is probably using the lezer @dialect. Otherwise, people who only need Turtle might encounter syntax highlighting and possibly nodes belonging to TriG in their AST, which they didnt sign up for.
Secondly, the TriG grammar appears to be more extensive than the lines you shared. You can find the complete grammar here: TriG Grammar. Glancing over it real quick, it includes the same grammar and terminals as Turtle (duh its an extension of Turtle :p), but there are some differences (e.g., the @top declaration should be trigDoc, triples2, triplesOrGraph, etc.).
In reality, it's a more significant task than it initially seems. If you require a quick/temporary solution, I would recommend forking the repository and adding the missing grammar lines. However, if you're up for a challenge, you can attempt to implement TriG as a lezer @dialect and submit a PR.
Here are the high-level steps I suggest for making it work:
Ensure that TriG does not function in Turtle mode.
Some tips:
@aatauil Nice, thanks for the comprehensive help! I'll probably stick to the shorter route, I'll fork and maybe get serious about it.
Hello, love the work. I just found myself needing a codemirror turtle language processor so I can have a decent editor experience. Would love if you could introduce a concept of
Graph
in your AST. I thought I'd fork it, but the way I implemented it locally, it doesn't seem to be doing what I expect. I also would love to contribute if you're accepting open help.The main pieces I thought were needed:
^ Curly brackets added at the last line.
Here's the full grammar file.
Thanks, Eddie!