Skip to content

fix(filter): nbt,predicates,gamemode allow =! operator #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions syntax/mcfunction/mcfunction.vim
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ hi def link mcInt mcValue
hi def link mcFloat mcValue

syn match mcUIntRange contained contains=mcBadDecimal,mcUInt,mcRangeDots /\d*\%(\.\+\d*\)\?/
syn match mcIntRange contained contains=mcBadDecimal,mcInt,mcRangeDots /-\?\d*\%(\.\+-\?\d*\)\?/
syn match mcIntRange contained contains=mcBadDecimal,mcInt,mcRangeDots /-\?\d*\%(\.\.-\?\d*\)\?/
syn match mcUFloatRange contained contains=mcUFloat,mcRangeDots /[[:digit:].]*\%(\.\.[[:digit:].]*\)\?/
syn match mcFloatRange contained contains=mcFloat,mcRangeDots /[[:digit:].-]*\%(\.\.[[:digit:].-]*\)\?/
syn match mcRangeDots contained /\.\./
Expand Down Expand Up @@ -1431,13 +1431,12 @@ syn keyword mcFilterKeyword contained advancements skipwhite nextgroup=mcF
syn keyword mcFilterKeyword contained predicate skipwhite nextgroup=mcFilterEqPredicate

" ... = ...
syn match mcFilterEqGamemode contained /=/ skipwhite nextgroup=mcGamemode
syn match mcFilterEqNBT contained /=/ skipwhite nextgroup=mcNBTTag
syn match mcFilterEqPredicate contained /=/ skipwhite nextgroup=mcNsPredicate
syn match mcFilterEqGamemode contained /=!\?/ skipwhite nextgroup=mcGamemode
syn match mcFilterEqNBT contained /=!\?/ skipwhite nextgroup=mcNBTTag
syn match mcFilterEqPredicate contained /=!\?/ skipwhite nextgroup=mcNsPredicate
syn match mcFilterEqSort contained /=/ skipwhite nextgroup=mcFilterSort
syn match mcFilterEqScores contained /=/ skipwhite nextgroup=mcFilterScores
syn match mcFilterEqAdvances contained /=/ skipwhite nextgroup=mcFilterAdvancements
syn match mcFilterEqScore contained /=/ skipwhite nextgroup=mcFilterIR1,mcFilterIR2
syn match mcFilterEqAdvance contained /=/ skipwhite nextgroup=mcFilterAdvancementCriterion,mcBool
syn match mcFilterEqName contained /=!\?/ skipwhite nextgroup=mcPlayerName
syn match mcFilterEqTeam contained /=!\?/ skipwhite nextgroup=mcTeam
Expand All @@ -1462,16 +1461,20 @@ hi def link mcYRotation mcXRotation
hi def link mcXRotation mcValue

" Lists
syn region mcFilterScores matchgroup=mcOp start=/{/rs=e end=/}/ oneline contained contains=mcObjectiveNameFilter
syn region mcFilterAdvancements matchgroup=mcOp start=/{/rs=e end=/}/ oneline contained contains=mcNsAdvancementFilter
syn region mcFilterScores matchgroup=mcNBTBracket start=/{/rs=e end=/}/ oneline contained contains=mcFilterScoresPair,mcFilterComma
syn region mcFilterAdvancements matchgroup=mcNBTBracket start=/{/rs=e end=/}/ oneline contained contains=mcNsAdvancementFilter
call s:addInstance('NsAdvancement','Filter','mcFilterEqAdvance')
syn region mcFilterAdvancementCriterion matchgroup=mcOp start=/{/rs=e end=/}/ oneline contained contains=mcAdvancementCriterion
syn region mcFilterAdvancementCriterion matchgroup=mcNBTBracket start=/{/rs=e end=/}/ oneline contained contains=mcAdvancementCriterion

syn match mcFilterScoresObjective /[A-Za-z_]\w\+/ contained
syn match mcFilterScoresPair /\w\+=\(\d\|[-.]\)\+/ contained contains=mcFilterScoresObjective,mcIntRange

" Links
hi def link mcFilterKeyword mcKeyword
hi def link mcFilterSort mcKeyword
hi def link mcFilterComma mcFilterEq
hi def link mcFilterScoresObjective mcObjective
hi def link mcFilterScoresPair mcOp

for x in split('Gamemode NBT Tag Sort Scores Advances Score Advance Name Team Type Tag F UI UFR XR YR', ' ')
execute 'hi def link mcFilterEq'.x 'mcFilterEq'
Expand Down