mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
field regexp is OK.
This commit is contained in:
parent
dd90bee74c
commit
6534817466
10
yasnippet.el
10
yasnippet.el
@ -45,6 +45,10 @@ current column if this variable is non-`nil'.")
|
|||||||
(defstruct yas/snippet
|
(defstruct yas/snippet
|
||||||
"The snippet structure of yasnippet."
|
"The snippet structure of yasnippet."
|
||||||
overlay fields exit-marker)
|
overlay fields exit-marker)
|
||||||
|
(defstruct yas/snippet-field-group
|
||||||
|
"A group of snippet field. They will all get updated when the
|
||||||
|
primary field is being edited."
|
||||||
|
primary fields next prev)
|
||||||
(defstruct yas/snippet-field
|
(defstruct yas/snippet-field
|
||||||
"The snippet-field structure of yasnippet."
|
"The snippet-field structure of yasnippet."
|
||||||
overlay state)
|
overlay state)
|
||||||
@ -56,6 +60,10 @@ current column if this variable is non-`nil'.")
|
|||||||
(defconst yas/escape-backquote
|
(defconst yas/escape-backquote
|
||||||
(concat "YASESCAPE" "BACKQUOTE" "PROTECTGUARD"))
|
(concat "YASESCAPE" "BACKQUOTE" "PROTECTGUARD"))
|
||||||
|
|
||||||
|
(defconst yas/field-regexp
|
||||||
|
(concat "$\\(?1:[0-9]+\\)" "\\|"
|
||||||
|
"${\\(?:\\(?1:[0-9]+\\):\\)?\\(?2:[^}]*\\)}"))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Internal functions
|
;; Internal functions
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@ -130,6 +138,8 @@ current column if `yas/indent-line' is non-`nil'."
|
|||||||
(yas/replace-all "\\`" yas/escape-backquote)
|
(yas/replace-all "\\`" yas/escape-backquote)
|
||||||
(yas/replace-all "\\$" yas/escape-dollar)
|
(yas/replace-all "\\$" yas/escape-dollar)
|
||||||
|
|
||||||
|
;; Step 5: Create overlays for each field
|
||||||
|
|
||||||
;; Step : restore all escape characters
|
;; Step : restore all escape characters
|
||||||
(yas/replace-all yas/escape-dollar "$")
|
(yas/replace-all yas/escape-dollar "$")
|
||||||
(yas/replace-all yas/escape-backquote "`")
|
(yas/replace-all yas/escape-backquote "`")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user