Skip to content

Commit

Permalink
Use rx instead of a manually created regex
Browse files Browse the repository at this point in the history
  • Loading branch information
smoeding committed May 30, 2024
1 parent ddc4528 commit edd6a1f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions puppet-ts-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
;; Maintainer: Stefan Möding <[email protected]>
;; Version: 0.1.0
;; Created: <2024-03-02 13:05:03 stm>
;; Updated: <2024-05-30 08:28:01 stm>
;; Updated: <2024-05-30 08:29:29 stm>
;; URL: https://github.com/smoeding/puppet-ts-mode
;; Keywords: languages
;; Package-Requires: ((emacs "29.1"))
Expand Down Expand Up @@ -845,9 +845,11 @@ module and file according to Puppet's autoloading rules."
(moddirs (mapcar (lambda (dir) (expand-file-name module dir))
puppet-ts-module-path))
;; the regexp to find the resource definition in the file
(resdef (concat "^\\(class\\|define\\|type\\|function\\)\\s-+"
resource
"\\((\\|{\\|\\s-\\|$\\)"))
(resdef (rx bol
(or "class" "define" "function" "type")
(1+ whitespace)
(literal resource)
word-boundary))
;; files to visit when searching for the resource
(files '()))
;; Check the current module directory (if the buffer actually
Expand Down

0 comments on commit edd6a1f

Please sign in to comment.