-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathparse-it.el
56 lines (43 loc) · 1.79 KB
/
parse-it.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
;;; parse-it.el --- Basic Parser in Emacs Lisp -*- lexical-binding: t; -*-
;; Copyright (C) 2019-2025 Shen, Jen-Chieh
;; Created date 2019-10-10 11:50:37
;; Author: Shen, Jen-Chieh <[email protected]>
;; URL: https://github.com/jcs-elpa/parse-it
;; Version: 0.2.1
;; Package-Requires: ((emacs "25.1") (s "1.12.0"))
;; Keywords: convenience parse parser lex lexer ast
;; This file is NOT part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Basic Parser in Emacs Lisp.
;;
;;; Code:
(require 'parse-it-util)
(require 'parse-it-ast)
(require 'parse-it-lex)
(defgroup parse-it nil
"Basic Parser in Emacs Lisp."
:prefix "parse-it-"
:group 'tools
:link '(url-link :tag "Repository" "https://github.com/jcs-elpa/parse-it"))
;;;###autoload
(defun parse-it (lan &optional path)
"Parse the PATH with symbol language LAN support.
If optional argument is nil; then it will use current buffer instead."
(let ((mod-name (intern (format "parse-it-%s" (symbol-name lan)))))
(if (and (ignore-errors (require mod-name))
(functionp mod-name))
(funcall mod-name path)
(user-error "Language '%s' is not supported" lan))))
(provide 'parse-it)
;;; parse-it.el ends here