|
2 | 2 | ;; Joel Holdbrooks <cjholdbrooks@gmail.com> |
3 | 3 |
|
4 | 4 | (ns vim-clojure-static.generate |
5 | | - (:require [clojure.java.shell :as shell] |
6 | | - [clojure.set :as set] |
| 5 | + (:require [clojure.set :as set] |
7 | 6 | [clojure.string :as string])) |
8 | 7 |
|
9 | 8 | ;; |
|
222 | 221 | (fmt "script=" :script) |
223 | 222 | (fmt "block=" :block)]))) |
224 | 223 |
|
225 | | -(defn vim-nfa-dump |
226 | | - "Run a patched version of Vim compiled with -DDEBUG on a new file containing |
227 | | - buffer, then move the NFA log to log-path. The patch is located at |
228 | | - vim/custom-nfa-log.patch" |
229 | | - [vim-path buffer log-path] |
230 | | - (let [file "tmp/nfa-test-file.clj"] |
231 | | - (spit file buffer) |
232 | | - (shell/sh vim-path "-u" "NONE" "-N" "-S" "vim/test-runtime.vim" file) |
233 | | - (shell/sh "mv" "nfa_regexp.log" log-path))) |
234 | | - |
235 | 224 | (comment |
236 | 225 | ;; Generate the vim literal definitions for pasting into the runtime files. |
237 | 226 | (spit "tmp/clojure-defs.vim" |
|
251 | 240 | vim-unicode-category-char-classes |
252 | 241 | vim-unicode-script-char-classes |
253 | 242 | vim-unicode-block-char-classes)) |
254 | | - (spit "tmp/nfa-test-file.clj" |
| 243 | + ;; Generate an example file with all possible character property literals. |
| 244 | + (spit "tmp/all-char-props.clj" |
255 | 245 | comprehensive-clojure-character-property-regexps) |
256 | | - ;; Create regexp engine dump files and compare number of operations. |
257 | | - (let [syn-path "../syntax/clojure.vim" |
258 | | - orig-syn-buf (slurp syn-path) |
259 | | - vim-path (or (System/getenv "VIMDEBUG") "vim") |
260 | | - buf (format "#\"\\p{%s}\"\n" "Ll") |
261 | | - buf-hash (hash buf)] |
262 | | - (try |
263 | | - (mapv (fn [path] |
264 | | - (let [syn-buf (slurp path) |
265 | | - syn-hash (hash syn-buf) |
266 | | - log-path (format "tmp/debug:%d:%d.log" buf-hash syn-hash)] |
267 | | - (spit syn-path syn-buf) |
268 | | - (vim-nfa-dump vim-path buf log-path) |
269 | | - (count (re-seq #"\n" (slurp log-path))))) |
270 | | - ["../syntax/clojure.vim" "tmp/altsyntax.vim"]) |
271 | | - (finally |
272 | | - (spit syn-path orig-syn-buf)))) |
273 | 246 | ) |
0 commit comments