Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug in beta tokenizer #178

@Qtax

Description

@Qtax

Just looking at the code I think there is a bug here:

https://github.com/scriptcoded/sql-highlight/blob/909c361424255f5af2a5e87b96dcd9e93e61123d/lib/index.js#L42C21-L42C21

This only matches litteral periods .. I assume that you meant to match any character /(?<unknown>.+?)/.

Without this change (now that it's using .matchAll()) anything in the input SQL string that does not match the regex will be removed from the results and not visible to the user. I assume that is undesired.

(Also of note that this approach will at most match a single character in every unknown group match.)

And a bit off topic, but I'm using this highlighter with a non-standard SQL flavor, which uses several additional keywords. These keywords will now be highlighted as identifiers. I hope the highlighting for those is not too disturbing. 😅

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions