저는 WoW Bundle for Visual Studio Code의 저자이자 관리자입니다.tmLanguage의 인용 된 (문자열) 상수의 범위를 올바르게 지정 하시겠습니까?
블리자드의 월드 오브 워크래프트 API에서 이벤트 이름, 위젯 스크립트 핸들러 또는 특정 함수 매개 변수와 같은 많은 상수는 문자열입니다. 이러한 문자열은 작은 따옴표 나 큰 따옴표로 묶을 수 있으며 일부 문자열은 대/소문자를 구분하지 않습니다. 예를 들어 :
<!-- This is only an excerpt, there are many more of these :) -->
<key>repository</key>
<dict>
<key>string-parameters</key>
<dict>
<key>match</key>
<string>(?i)(Button|Frame|Slider|StatusBar|TOP|LEFT|BOTTOM|RIGHT|BACKGROUND|ARTWORK|LOW|MEDIUM|HIGH)</string>
<key>name</key>
<string>support.constant.wow.parameter.lua</string>
</dict>
<key>event-names</key>
<dict>
<key>match</key>
<string>(PLAYER_ENTERING_WORLD|ADDON_LOADED)</string>
<key>name</key>
<string>support.constant.wow.event.lua</string>
</dict>
<key>script-handlers</key>
<dict>
<key>match</key>
<string>(OnLoad|OnShow|OnEvent)</string>
<key>name</key>
<string>support.constant.wow.hander.lua</string>
</dict>
</dict>
을 나는 주변 범위 내에서 그들과 같습니다 : 범위를
local myFrame = CreateFrame('Button', nil, UIParent)
myFrame:SetPoint('CENTER', 0, 0)
MyFrame:RegisterEvent('PLAYER_ENTERING_WORLD')
myFrame:SetScript('OnEvent', myEventHandler)
내 tmLanguage 파일에서 그 특별한 문자열, 나는 저장소에서 그들을 선언
<dict>
<key>name</key>
<string>support.constant.wow.quoted.single.lua</string>
<key>begin</key>
<string>'</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.constant.begin.lua</string>
</dict>
</dict>
<key>end</key>
<string>'</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.constant.end.lua</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#string-parameters</string>
</dict>
<dict>
<key>include</key>
<string>#event-names</string>
</dict>
<dict>
<key>include</key>
<string>#script-handlers</string>
</dict>
</array>
</dict>
물론, 나는이 두 블록 (작은 따옴표를위한 것, 큰 따옴표를위한 것 중 하나)을 가지고 있고, 전에 앞에 su를 만들기 위해 블록을 선언한다. 다시 우선합니다.
이렇게 ... 거의 작동합니다. 분명히 (가 #string-parameters
의 repo에서 단어 Frame
을 포함로) 전체 문자열이 여전히 유효한 것으로 분석됩니다
local myFrame = CreateFrame('Frame Type That Does Not Exist', nil, UIParent)
가 수행해야합니다
local myFrame = CreateFrame(' Frame ', nil, UIParent) -- Notice the spaces around Frame
또는, 더 나쁜 : 같은 선언에서
아니.
리포지토리의 공백없이 한 단어 만 일치하는지 어떻게 확인합니까? 정규 표현식을 여러 가지 방법으로 수정하려고했지만 아무 소용이 없습니다.
답변이 부족하여 마침내 다른 경로를 취하여 제대로 문자열을 색칠했습니다. 어느 누구도 결국 대답을 드릴 수 있도록 질문을 공개하겠습니다. –