shlomi-fish-homepage / bin / find_ascii_quotes.ml

shl...@iglu.org.… 7b03bb9 













shl...@iglu.org.… b113fd4 
shl...@iglu.org.… 7b03bb9 









open Xmlm

let find_quotes input filename =
    let el tag list = () in
    let data str =
        let row,col = Xmlm.pos input in
        let lines = (Str.split (Str.regexp "\n") str) in
        let rec iter rest idx = if rest != [] then begin
            let line = (List.hd rest) in
            if String.contains line '"' then begin
                Printf.printf "%s:%d:%s\n" filename (row+idx) line
            end ;
            (iter (List.tl rest) (idx+1))
            end in
        iter lines 0 in
    Xmlm.input_doc_tree ~el ~data input;;

let () =
     Array.iter (fun filename ->
	let ic = open_in filename in
	ignore (find_quotes
		(Xmlm.make_input ~entity:(fun e -> Some e) (`Channel ic))
		filename))
       (Array.sub Sys.argv 1 (Array.length Sys.argv - 1))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.