Commit d53e1abb authored by Committed by Christian Hergert
yaml.lang: fix some cases of falsely recognized map keys
First, don't recognize keys inside of quoted strings. Currently, "a: b" is recognized as a map entry with `"a` as the key and `b"` as the value. Fix that by giving the "string" context a higher priority than the "map" context. Second, prevent some comments from being recognized as map entries. Specifically, cases like this: # foo: bar Even though the "map" context has lower priority than the "comment" context, this would still be recognized as a map entry, because the map regex would match the line starting with the leading space and thus be the leftmost match. Fix this by requiring the first character of a map key to not be a whitespace character. There is still a case where a map entry is recognized where it shouldn't be: foo # bar: baz However, I don't see a way to fix this without running into the performance problem described in the comment in the "map" context definition.
Showing with 2 additions and 2 deletions