Improve shell and m4 syntax

Julien LepillerMon Jun 28 02:19:08+0200 2021

1b603dc

Improve shell and m4 syntax

gitile/highlight/shell.scm

3131
            lex-m4
3232
            lex-autoconf))
3333
34-
(define %variable-char-set char-set:letter+digit)
34+
(define %variable-char-set
35+
  (char-set-union (char-set #\_) char-set:letter+digit))
3536
3637
(define %shell-builtins
3738
  '("alias" "bg" "bind" "break" "builtin" "caller" "cd" "command" "compgen"

336337
      (lex-tag 'comment (lex-delimited "DNL" #:until "\n"))
337338
      (lex-string ",")
338339
      lex-whitespace
339-
      (lex-delimited quote-in #:until quote-out #:nested? #t)
340-
      (lex-char-set (char-set-complement (char-set #\,)))))
340+
      (lex-tag 'string (lex-delimited quote-in #:until quote-out #:nested? #t))
341+
      (lex-char-set (char-set-complement (char-set #\, #\))))))
341342
342343
  (define lex-macro
343344
    (lex-all
344345
      (lex-any
345346
        (lex-tag 'builtin (lex-filter
346347
                            (lambda (str)
347-
                              (pk 'builtin? str)
348348
                              (any (cut string=? <> str) builtins))
349349
                            (lex-char-set %macro-char-set)))
350350
        (lex-tag 'variable (lex-char-set %macro-char-set)))

359359
      (lex-tag 'comment (lex-delimited "#" #:until "\n"))
360360
      (lex-tag 'comment (lex-delimited "dnl" #:until "\n"))
361361
      (lex-tag 'comment (lex-delimited "DNL" #:until "\n"))
362+
      lex-whitespace
362363
      lex-macro
363364
      base-lexer)))
364365