arangodb / arangodb

🥑 ArangoDB is a native multi-model database with flexible data models for documents, graphs, and key-values. Build high performance applications using a convenient SQL-like query language or JavaScript extensions.
https://www.arangodb.com
Other
13.57k stars 836 forks source link

Jison to parse AQL grammer for syntax highlighting in Aardvark? #1745

Closed Simran-B closed 7 years ago

Simran-B commented 8 years ago

Jison is basically Bison/Flex for JavaScript and seems to use a very similar if not the same syntax: http://zaa.ch/jison/docs/

I wonder if we could use it for syntax highlighting in the web frontend. It would certainly require some work, because of the C++ coded logic in the grammar, but maybe we can just ignore that to some degree. We would need to port logic still, if we want to offer linting or similar.

hkernbach commented 7 years ago

Closing this issue now. The new aql editor (3.1 and 3.0) offers syntax highlighting and also visualizes error locations.

Simran-B commented 7 years ago

What we have is probably sufficient. The notion of this issue was that sometimes the highlighting is not quite correct, e.g. the first count should be blue because it is part of a language construct, but the second one is actually a variable name:

image

BTW: it would be great to have AQL grammer support for syntax highlighting in the documentation, using JS only works very limited.

jsteemann commented 7 years ago

My personal opinion is that the syntax highlighting we have is not perfect, but good enough. Maintaining the AQL grammar in the front end as a JavaScript version is probably not worth the trouble.

jsteemann commented 7 years ago

It would be good if we could generate standalone grammar files from the Bison grammar that we have, and use this standalone grammar for arbitrary syntax highlighters.

Simran-B commented 7 years ago

Gitbook seems to use Highlight.js for syntax highlighting, language definition guide: http://highlightjs.readthedocs.io/en/latest/language-guide.html