From 864ee8fdef435893832a2698159407bd9b43f274 Mon Sep 17 00:00:00 2001 From: Erasin Date: Tue, 21 Feb 2023 07:04:17 +0800 Subject: [PATCH] Add GNU gettext PO grammar (#5996) --- book/src/generated/lang-support.md | 1 + languages.toml | 11 +++++++++++ runtime/queries/po/highlights.scm | 15 +++++++++++++++ runtime/queries/po/textobjects.scm | 6 ++++++ 4 files changed, 33 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 1cdc9e6ca..cdecb9b04 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 38dedb441..1caef6b2d 100644 --- a/languages.toml +++ b/languages.toml @@ -2193,3 +2193,14 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "yuck" source = { git = "https://github.com/Philipp-M/tree-sitter-yuck", rev = "9e97da5773f82123a8c8cccf8f7e795d140ed7d1" } + +[[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 000000000..b090f129d --- /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 000000000..70abcb149 --- /dev/null +++ b/runtime/queries/po/textobjects.scm @@ -0,0 +1,6 @@ +(msgid) @parameter.inside + +(comment) @comment.inside +(comment)+ @comment.around + +