Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open Buffer
- type scanning = InputVarName | InputRest;;
- let testcharsq x = match x with
- | 'A'..'Z' | 'a'..'z' -> true
- | _ -> false;;
- (* We're getting a string. *)
- let process x =
- let s = ref InputRest in
- let r = Buffer.create 100 in
- for i = 0 to (String.length(x)-1) do
- if x.[i] = '$' then s := InputVarName;
- if !s = InputRest then add_char r x.[i];
- if !s = InputVarName and testcharsq x.[i] then
- ();
- done;
- contents r;;
- open Printf;;
- printf "%s" (process "abc$or");;
- ---
- File "p.ml", line 13, characters 24-27:
- Error: Syntax error
Advertisement
Add Comment
Please, Sign In to add comment