1 ;;; xparse.el --- AUCTeX style for `xparse.sty' version 4467.
3 ;; Copyright (C) 2013 Free Software Foundation, Inc.
5 ;; Maintainer: auctex-devel@gnu.org
6 ;; Author: Mosè Giordano <giordano.mose@libero.it>
9 ;; This file is part of AUCTeX.
11 ;; AUCTeX is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 3, or (at your option)
16 ;; AUCTeX is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with AUCTeX; see the file COPYING. If not, write to the Free
23 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
28 ;; This file adds basic support for `xparse.sty' version 4467. It
29 ;; doesn't parse argument specification of macros and environments.
33 (defvar LaTeX-xparse-macro-regexp
34 (concat "\\\\\\(?:Declare\\|New\\|Renew\\|Provide\\|DeclareExpandable\\)"
35 "DocumentCommand[ \t\n\r]*{?[ \t\n\r]*\\\\\\([A-Za-z]+\\)[ \t\n\r]*}?"
36 ;; The following is the opening brace of argument specification and is
37 ;; needed to skip internal macros containing `:' or `_'.
39 "Matches macros by xparse package.")
41 (defvar LaTeX-xparse-environment-regexp
42 (concat "\\\\\\(?:Declare\\|New\\|Renew\\|Provide\\)DocumentEnvironment"
43 "[ \t\n\r]*{[ \t\n\r]*\\([A-Za-z]+\\)[ \t\n\r]*}")
44 "Matches environments by xparse package.")
49 (TeX-auto-add-regexp `(,LaTeX-xparse-macro-regexp 1 TeX-auto-symbol))
51 `(,LaTeX-xparse-environment-regexp 1 LaTeX-auto-environment))
55 ;; Declaring commands and environments
56 '("DeclareDocumentCommand" TeX-arg-define-macro "Argument specification" t)
57 '("NewDocumentCommand" TeX-arg-define-macro "Argument specification" t)
58 '("RenewDocumentCommand" TeX-arg-macro "Argument specification" t)
59 '("ProvideDocumentCommand" TeX-arg-define-macro "Argument specification" t)
60 '("DeclareDocumentEnvironment" TeX-arg-define-environment
61 "Argument specification" t t)
62 '("NewDocumentEnvironment" TeX-arg-define-environment
63 "Argument specification" t t)
64 '("RenewDocumentEnvironment" TeX-arg-environment
65 "Argument specification" t t)
66 '("ProvideDocumentEnvironment" TeX-arg-define-environment
67 "Argument specification" t t)
68 ;; Fully-expandable document commands
69 '("DeclareExpandableDocumentCommand"
70 TeX-arg-define-macro "Argument specification" t)
71 ;; Testing special values
83 ;; Argument processors
86 '("SplitArgument" "Number" "Token")
89 '("ProcessList" "List" "Functiom")
90 ;; Access to the argument specification
91 '("GetDocumentCommandArgSpec" TeX-arg-macro)
92 '("GetDocumentEnvironmmentArgSpec" TeX-arg-environment)
93 '("ShowDocumentCommandArgSpec" TeX-arg-macro)
94 '("ShowDocumentEnvironmentArgSpec" TeX-arg-environment))
96 (when (and (featurep 'font-latex)
97 (eq TeX-install-font-lock 'font-latex-setup))
98 (font-latex-add-keywords '(("DeclareDocumentCommand" "|{{{")
99 ("NewDocumentCommand" "|{{{")
100 ("RenewDocumentCommand" "|{{{")
101 ("ProvideDocumentCommand" "|{{{")
102 ("DeclareExpandableDocumentCommand" "|{{{")
103 ("DeclareDocumentEnvironment" "{{{{")
104 ("NewDocumentEnvironment" "{{{{")
105 ("RenewDocumentEnvironment" "{{{{")
106 ("ProvideDocumentEnvironment" "{{{{"))
110 (defun LaTeX-xparse-package-options ()
111 "Read the xparse package options from the user."
112 (TeX-read-key-val t '(("log-declarations" ("true" "false")))))
114 ;;; xparse.el ends here