From f718695a6efc71910a4228c13120dbb76feab4ab Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sun, 9 Jun 2024 01:11:46 +0200 Subject: [PATCH] feat: Add syntax highlight file for GNU nano (#4560) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- grammars/nano/README.md | 15 +++++++++++++++ grammars/nano/prql.nanorc | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 grammars/nano/README.md create mode 100644 grammars/nano/prql.nanorc diff --git a/grammars/nano/README.md b/grammars/nano/README.md new file mode 100644 index 000000000000..92a1f2797ac3 --- /dev/null +++ b/grammars/nano/README.md @@ -0,0 +1,15 @@ +# Syntax highlighting for GNU nano + +This is a syntax highlighting file the [GNU nano](https://nano-editor.org/) text +editor. + +## Installation + +To install place the `prql.nanorc` file in the `~/.nano/` directory and and +include the following line in your `.nanorc` file. + + include "~/.nano/prql.nanorc" + +You can append it with this command: + + echo 'include "~/.nano/prql.nanorc"' >> ~/.nanorc diff --git a/grammars/nano/prql.nanorc b/grammars/nano/prql.nanorc new file mode 100644 index 000000000000..a8d7317bbe01 --- /dev/null +++ b/grammars/nano/prql.nanorc @@ -0,0 +1,39 @@ +## Syntax highlighting for PRQL. + +syntax python "\.prql$" +magic "PRQL script" +comment "#" + +# Types. +color green "\<(int(8|16|32|64|128)?|float(32|64)|bool|text|date|time|timestamp)\>" + +# Keywords. +color yellow "\" + +# Transforms. +color brightcyan "\<(aggregate|derive|filter|from|group|join|select|sort|take|window)\>" + +# Special values. +color brightmagenta "\<(false|null|true|this|that)\>" + +# Decorators. +color cyan start="@\{" end="\}" + +# Mono-quoted strings. +color brightgreen "[frs]?'([^'\]|\\.)*'|[frs]?"([^"\]|\\.)*"|'''|"""" +color normal "'''|"""" +# Comments. +color gray "(^|[[:blank:]])#.*" +# Triple-quoted strings. +color brightgreen start="[frs]?'''([^'),]|$)" end="(^|[^(\])'''" +color brightgreen start="[frs]?"""([^"),]|$)" end="(^|[^(\])"""" + +# Backslash escapes. +color lime "\\($|[\'"bfnrt]|[0-3]?[0-7]?[0-7]|x[[:xdigit:]]{2})" +color lime "\\(N\{[[:alpha:]]+\}|u\{[[:xdigit:]]{1,6}\})" + +# Reminders. +color brightwhite,yellow "\<(FIXME|TODO)\>" + +# Trailing whitespace. +color ,green "[[:space:]]+$"