Changeset 30159 for lang/elisp
- Timestamp:
- 02/16/09 23:40:08 (4 years ago)
- Files:
-
- 1 modified
-
lang/elisp/pit/branches/fix-regexp/pit.el (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/elisp/pit/branches/fix-regexp/pit.el
r29403 r30159 69 69 (defalias 'alist/update 'alist/merge) 70 70 71 (defvar pit/profile-regexp 72 (rx bol 73 (? (or "\"" "'")) 74 "profile" 75 (? (or "\"" "'")) 76 ":" 77 (* space) 78 (? (or "\"" "'")) 79 (group 80 (+ (not (any "'" "\"")))))) 81 71 82 (defun pit/profile () 72 83 (when (file-exists-p pit/config) … … 74 85 (with-temp-buffer 75 86 (insert-file-contents pit/config) 76 (when (re-search-forward "^profile:[ ]*\\(.+\\)"nil t)87 (when (re-search-forward pit/profile-regexp nil t) 77 88 (match-string 1)))) 78 89 (profile/file … … 181 192 '((" +$" "") 182 193 ("---" "(setq result '(") 183 ("^\\([^ ].+\\):" "(\\1 (") 184 ("^[ ]+\\(.+\\):[ ]+?\\(.+\\)" "(\\1 . \"\\2\")") 194 ("\\(?:^\\(?:[\"']\\)?\\([^'\": ]+\\)['\"]?:\\)" "(\\1 (") 195 ("\\(?:^ +\\(?:[\"']\\)?\\([^'\"\n]+\\)\\(?:[\"']\\)?:\\(?: +\\)?\\(?:[\"']\\)?\\([^'\"\n]+\\).*\\)" 196 "(\\1 . \"\\2\")") 185 197 ("\\()\\)\n\\(^[^'].+(\\)" "))\\1\n\\2"))) 186 198 (goto-char (point-max)) … … 190 202 result))) 191 203 204 ;;; Test 205 (defvar pit/test-profile-yaml 206 "--- 207 profile: default") 208 209 (defvar pit/test-profile-yaml-quoted 210 "--- 211 \"profile\": 'default'") 212 213 214 (dont-compile 215 (when (fboundp 'expectations) 216 (expectations 217 (desc "pit/load") 218 (expect "default" 219 (with-temp-buffer 220 (insert pit/test-profile-yaml) 221 (goto-char (point-min)) 222 (when (re-search-forward pit/profile-regexp nil t) 223 (match-string 1)))) 224 225 (expect "default" 226 (with-temp-buffer 227 (insert pit/test-profile-yaml-quoted) 228 (goto-char (point-min)) 229 (when (re-search-forward pit/profile-regexp nil t) 230 (match-string 1)))) 231 ))) 232 233 192 234 (provide 'pit) 193 235
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)