From 6519bc0db706a7d9f1cf8588a00ddc9eb68b6e25 Mon Sep 17 00:00:00 2001 From: Erasin Date: Wed, 15 Feb 2023 15:09:30 +0800 Subject: [PATCH] Add GNU gettext PO grammar --- book/src/generated/lang-support.md | 1 + languages.toml | 12 ++++++++++++ runtime/queries/po/highlights.scm | 15 +++++++++++++++ runtime/queries/po/textobjects.scm | 6 ++++++ 4 files changed, 34 insertions(+) create mode 100644 runtime/queries/po/highlights.scm create mode 100644 runtime/queries/po/textobjects.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index c31ddd3d2f89..a96352965693 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -98,6 +98,7 @@ | pem | ✓ | | | | | perl | ✓ | ✓ | ✓ | | | php | ✓ | ✓ | ✓ | `intelephense` | +| po | ✓ | ✓ | | | | ponylang | ✓ | ✓ | ✓ | | | prisma | ✓ | | | `prisma-language-server` | | prolog | | | | `swipl` | diff --git a/languages.toml b/languages.toml index eaf73b4151f0..8e12486acab7 100644 --- a/languages.toml +++ b/languages.toml @@ -2167,3 +2167,15 @@ comment-token = "#" [[grammar]] name = "hosts" source = { git = "https://github.com/ath3/tree-sitter-hosts", rev = "301b9379ce7dfc8bdbe2c2699a6887dcb73953f9" } + +[[language]] +name = "po" +scope = "source.po" +file-types = ["po", "pot"] +roots = [] +comment-token = "#" + +[[grammar]] +name = "po" +source = { git = "https://github.com/erasin/tree-sitter-po", rev = "417cee9abb2053ed26b19e7de972398f2da9b29e" } + diff --git a/runtime/queries/po/highlights.scm b/runtime/queries/po/highlights.scm new file mode 100644 index 000000000000..b090f129df46 --- /dev/null +++ b/runtime/queries/po/highlights.scm @@ -0,0 +1,15 @@ +[ + (msgctxt) + (msgid) + (msgid_plural) + (msgstr) +]@keyword + +(comment) @comment +(comment (comment_reference (text) @string.special.path)) +(comment (comment_flag (text) @label)) + +(number) @constant.numeric +(string) @string + +(ERROR) @error diff --git a/runtime/queries/po/textobjects.scm b/runtime/queries/po/textobjects.scm new file mode 100644 index 000000000000..70abcb14918b --- /dev/null +++ b/runtime/queries/po/textobjects.scm @@ -0,0 +1,6 @@ +(msgid) @parameter.inside + +(comment) @comment.inside +(comment)+ @comment.around + +