Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix highlight hyphen leading operators #313

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gengar
Copy link

@gengar gengar commented Mar 20, 2024

The "-" case always matches on "[^0-9>]" and never on latter.

The "-" case always matches on "[^0-9>]" and never on latter.
@monnier
Copy link
Contributor

monnier commented Mar 20, 2024 via email

@gengar
Copy link
Author

gengar commented Mar 20, 2024

OK, here is a example:

(let ((operator-char     "[-!$%&*+./:<=>?@^|~]")
      (operator-char-no> "[-!$%&*+./:<=?@^|~]"))
  (let ((reg1 (concat "\\(-\\)\\(?:[^0-9>]\\|\\("
                      operator-char-no> operator-char "*\\)\\)"))
        (reg2 (concat "\\(-\\)\\("
                      operator-char-no>
                      operator-char "*\\|\\(?:[^0-9>]\\)\\)"))
        (str "-$$$"))
    (string-match reg1 str)
    (print (match-string 0 str)) ; => "-$"
    (print (match-string 2 str)) ; => nil

    (string-match reg2 str)
    (print (match-string 0 str)) ; => "-$$$"
    (print (match-string 2 str)) ; => "$$$"
    nil))

I would expect to tuareg-mode highlights the whole symbol like -$$$.

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.

2 participants