From 65348174665d23f97a99bab85a7db6169d598e8c Mon Sep 17 00:00:00 2001 From: Zhang Chiyuan Date: Mon, 3 Mar 2008 10:52:11 +0000 Subject: [PATCH] field regexp is OK. --- yasnippet.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/yasnippet.el b/yasnippet.el index a852163..268799f 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -45,6 +45,10 @@ current column if this variable is non-`nil'.") (defstruct yas/snippet "The snippet structure of yasnippet." 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 "The snippet-field structure of yasnippet." overlay state) @@ -56,6 +60,10 @@ current column if this variable is non-`nil'.") (defconst yas/escape-backquote (concat "YASESCAPE" "BACKQUOTE" "PROTECTGUARD")) +(defconst yas/field-regexp + (concat "$\\(?1:[0-9]+\\)" "\\|" + "${\\(?:\\(?1:[0-9]+\\):\\)?\\(?2:[^}]*\\)}")) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 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-dollar) + ;; Step 5: Create overlays for each field + ;; Step : restore all escape characters (yas/replace-all yas/escape-dollar "$") (yas/replace-all yas/escape-backquote "`")