From cde381803aa13d950a5e33d50cd952b4fd995318 Mon Sep 17 00:00:00 2001 From: Koki Fukuda Date: Fri, 19 Aug 2022 17:08:11 +0900 Subject: [PATCH] Update mcfunction lexer to support newer spec of commands --- lexers/embedded/mcfunction.xml | 4 ++-- lexers/testdata/mcfunction.actual | 6 +++++- lexers/testdata/mcfunction.expected | 25 ++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/lexers/embedded/mcfunction.xml b/lexers/embedded/mcfunction.xml index b1ff183f1..331052036 100644 --- a/lexers/embedded/mcfunction.xml +++ b/lexers/embedded/mcfunction.xml @@ -92,7 +92,7 @@ - + @@ -179,4 +179,4 @@ - \ No newline at end of file + diff --git a/lexers/testdata/mcfunction.actual b/lexers/testdata/mcfunction.actual index 44513c517..efaa3ab3e 100644 --- a/lexers/testdata/mcfunction.actual +++ b/lexers/testdata/mcfunction.actual @@ -9,5 +9,9 @@ gamemode creative @a # With argument kill @e[type=chicken,nested={a0=0,a1=1}] -# Ragne +# Range kill @e[y_rotation=0..180] + +# Legacy and new style +placefeature minecraft:bonus_chest ~ ~ ~ +place feature minecraft:bonus_chest ~ ~ ~ diff --git a/lexers/testdata/mcfunction.expected b/lexers/testdata/mcfunction.expected index 7e706e677..3639656dd 100644 --- a/lexers/testdata/mcfunction.expected +++ b/lexers/testdata/mcfunction.expected @@ -63,7 +63,7 @@ {"type":"LiteralNumberInteger","value":"1"}, {"type":"Punctuation","value":"}]"}, {"type":"TextWhitespace","value":"\n\n"}, - {"type":"CommentSingle","value":"# Ragne\n"}, + {"type":"CommentSingle","value":"# Range\n"}, {"type":"KeywordReserved","value":"kill"}, {"type":"TextWhitespace","value":" "}, {"type":"KeywordConstant","value":"@e"}, @@ -74,5 +74,28 @@ {"type":"Punctuation","value":".."}, {"type":"LiteralNumberInteger","value":"180"}, {"type":"Punctuation","value":"]"}, + {"type":"TextWhitespace","value":"\n\n"}, + {"type":"CommentSingle","value":"# Legacy and new style\n"}, + {"type":"Text","value":"placefeature"}, + {"type":"TextWhitespace","value":" "}, + {"type":"Text","value":"minecraft:bonus_chest"}, + {"type":"TextWhitespace","value":" "}, + {"type":"NameBuiltin","value":"~"}, + {"type":"TextWhitespace","value":" "}, + {"type":"NameBuiltin","value":"~"}, + {"type":"TextWhitespace","value":" "}, + {"type":"NameBuiltin","value":"~"}, + {"type":"TextWhitespace","value":"\n"}, + {"type":"KeywordReserved","value":"place"}, + {"type":"TextWhitespace","value":" "}, + {"type":"Text","value":"feature"}, + {"type":"TextWhitespace","value":" "}, + {"type":"Text","value":"minecraft:bonus_chest"}, + {"type":"TextWhitespace","value":" "}, + {"type":"NameBuiltin","value":"~"}, + {"type":"TextWhitespace","value":" "}, + {"type":"NameBuiltin","value":"~"}, + {"type":"TextWhitespace","value":" "}, + {"type":"NameBuiltin","value":"~"}, {"type":"TextWhitespace","value":"\n"} ]