fix syntax hightlight for vcm

This commit is contained in:
MihailRis 2025-07-19 11:47:05 +03:00
parent 73d6d530f2
commit 411f0e53a6
2 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,6 @@
language = "VCM"
extensions = ["vcm"]
line-comment-start = "#"
line-comment = "#"
keywords = [
"on", "off"
]

View File

@ -151,6 +151,12 @@ public:
return std::wstring(source.substr(start, pos - start));
}
void emitLineComment(devtools::Location start) {
auto string = readUntilEOL();
emitToken(TokenTag::COMMENT, std::wstring(string), start);
skipLine();
}
std::vector<Token> tokenize() {
skipWhitespace();
while (hasNext()) {
@ -229,16 +235,18 @@ public:
}
if (is_lua_operator_start(c)) {
auto text = parseOperator();
if (text == L"--") {
auto string = readUntilEOL();
emitToken(TokenTag::COMMENT, std::wstring(string), start);
skipLine();
if (text == syntax.lineComment) {
emitLineComment(start);
continue;
}
emitToken(TokenTag::OPERATOR, std::move(text), start);
continue;
}
auto text = readUntilWhitespace();
if (text.find(syntax.lineComment) == 0) {
emitLineComment(start);
continue;
}
emitToken(TokenTag::UNEXPECTED, std::wstring(text), start);
}
return std::move(tokens);