Skip to content

fix: delimiters in rs, go, java and lua - #77

Open
lvolland wants to merge 1 commit into
speed-highlight:mainfrom
lvolland:fix/delimiters-rs-go-java-lua
Open

fix: delimiters in rs, go, java and lua#77
lvolland wants to merge 1 commit into
speed-highlight:mainfrom
lvolland:fix/delimiters-rs-go-java-lua

Conversation

@lvolland

@lvolland lvolland commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

four multi-char delimiters aren't recognized, so each one swallows the rest of the line — or the file.

struct S<'a>(&'a str);
fmt.Println(`SELECT "n" FROM nums`)
--[[ block ]]
String s = """
	hello "world"
	""";

today: rust 'a reads as an unterminated char literal and eats the signature (str "'a>(msg: &'"), go backticks aren't a string at all, lua block comments only close on --]], and java text blocks split into "" + ".

expected: type, str, cmnt, str.

one rule added per language, two chars dropped from the lua one. the java rule is py.js line 23 with a literal instead of the backreference, since java has only one delimiter: /"""(\\[^]|(?!""")[^])*(""")?/g. closing delimiters stay optional so half-typed code keeps its color. +180 bytes in src, dist/ untouched, fixture lines added for all four.

notes

  • rust: the lifetime rule sits before expand: 'str' on purpose. with str first, &'a str goes back to str "'a>(msg: &'". the (?!') is what keeps 'x' a char literal.
  • uppercase lifetimes ('A) still fall through, same as before — didn't want to widen the rule for it.
  • an unterminated """ or backtick now colors to end of file. that's the price of the optional closer.
  • lua block comments now close on ]], not --]]. the --[[ ... --]] toggle idiom still works.
  • no fixture line for the unterminated cases: an open text block would eat the rest of the file 🙂
  • existing fixture content tokenizes byte-identically before and after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant