Guest User

Untitled

a guest
Feb 16th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. Index: coff.ml
  2. ===================================================================
  3. --- coff.ml (revision 195)
  4. +++ coff.ml (working copy)
  5. @@ -601,7 +601,7 @@
  6. else find_end (i - 1)
  7. in
  8. let l = find_end (String.length s) in
  9. - let rec aux0 i = if i = l then [] else match s.[i] with
  10. + let rec aux0 i = if i >= l then [] else match s.[i] with
  11. | ' ' -> aux0 (i+1)
  12. | '-' | '/' -> aux1 (i+1) (i+1)
  13. | _ -> raise Exit
  14. @@ -623,10 +623,11 @@
  15. | ' ' -> (cmd, String.sub s i0 (i - i0) :: args) :: aux0 (i+1)
  16. | ',' -> aux2 cmd (String.sub s i0 (i - i0) :: args) (i+1)
  17. | _ -> aux4 cmd args i0 (i+1)
  18. - and aux5 cmd args i = match s.[i] with
  19. - | ' ' -> (cmd,args) :: aux0 (i+1)
  20. - | ',' -> aux2 cmd args (i+1)
  21. - | _ -> raise Exit
  22. + and aux5 cmd args i = if i >= l then (cmd,args) :: aux0 l
  23. + else match s.[i] with
  24. + | ' ' -> (cmd,args) :: aux0 (i+1)
  25. + | ',' -> aux2 cmd args (i+1)
  26. + | _ -> raise Exit
  27. in
  28. try List.map (fun (cmd,args) -> (cmd,List.rev args)) (aux0 0)
  29. with _ ->
Add Comment
Please, Sign In to add comment