Function: haskell-lexeme-looking-at-token
haskell-lexeme-looking-at-token is a natively compiled function
defined in haskell-lexeme.el.
Signature
(haskell-lexeme-looking-at-token &rest FLAGS)
Documentation
Like looking-at but understands Haskell lexemes.
Moves point forward over whitespace. Returns a symbol describing
type of Haskell token recognized. Use match-string,
match-beginning and match-end with argument 0 to query match
result.
Possible results are:
- 'special: for chars [](){},;
- \=comment: for single line comments
- 'nested-comment: for multiline comments
- 'qsymid: for qualified identifiers or symbols
- 'string: for strings literals
- 'char: for char literals
- 'number: for decimal, float, hexadecimal and octal number literals
- 'template-haskell-quote: for a string of apostrophes for template
haskell
- 'template-haskell-quasi-quote: for a string of apostrophes for template
haskell
Note that for qualified symbols (match-string 1) returns the unqualified identifier or symbol. Further qualification for symbol or identifier can be done with:
(haskell-lexeme-classify-by-first-char (char-after (match-beginning 1)))
See haskell-lexeme-classify-by-first-char for details.
Source Code
;; Defined in /nix/store/9lz2mhw95f9fqxr9mnq46k3f6qz3aq83-emacs-packages-deps/share/emacs/site-lisp/elpa/haskell-mode-20260904.1042/haskell-lexeme.el
(defun haskell-lexeme-looking-at-token (&rest flags)
"Like `looking-at' but understands Haskell lexemes.
Moves point forward over whitespace. Returns a symbol describing
type of Haskell token recognized. Use `match-string',
`match-beginning' and `match-end' with argument 0 to query match
result.
Possible results are:
- \\='special: for chars [](){}`,;
- \\='comment: for single line comments
- \\='nested-comment: for multiline comments
- \\='qsymid: for qualified identifiers or symbols
- \\='string: for strings literals
- \\='char: for char literals
- \\='number: for decimal, float, hexadecimal and octal number literals
- \\='template-haskell-quote: for a string of apostrophes for template
haskell
- \\='template-haskell-quasi-quote: for a string of apostrophes for template
haskell
Note that for qualified symbols (match-string 1) returns the
unqualified identifier or symbol. Further qualification for
symbol or identifier can be done with:
(haskell-lexeme-classify-by-first-char (char-after (match-beginning 1)))
See `haskell-lexeme-classify-by-first-char' for details."
(while
;; Due to how unterminated strings terminate at newline, some
;; newlines have syntax set to generic string delimeter. We want
;; those to be treated as whitespace anyway
(or
(> (skip-syntax-forward "-") 0)
(and (not (member 'newline flags))
(> (skip-chars-forward "\n") 0))))
(let
((case-fold-search nil)
(point (point)))
(or
(and
(equal (string-to-syntax "<")
(get-char-property (point) 'syntax-table))
(progn
(set-match-data (list point (line-end-position)))
'literate-comment))
(and (looking-at "\n")
'newline)
(and (looking-at "{-")
(save-excursion
(forward-comment 1)
(set-match-data (list point (point)))
'nested-comment))
(and (haskell-lexeme-looking-at-char-literal)
'char)
(and (haskell-lexeme-looking-at-string-literal)
'string)
(and (looking-at "[][(){}`,;]")
(if (haskell-lexeme-looking-at-quasi-quote-literal)
'template-haskell-quasi-quote
'special))
(and (haskell-lexeme-looking-at-qidsym)
(if (save-match-data
(string-match "\\`---*\\'" (match-string-no-properties 0)))
(progn
(set-match-data (list point (line-end-position)))
'comment)
'qsymid))
(and (looking-at haskell-lexeme-number)
'number)
(and (looking-at "'+")
'template-haskell-quote)
(and (looking-at ".")
'illegal))))