Guest User

Untitled

a guest
Oct 22nd, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #require "re.posix";;
  2.  
  3. (* open Base ;;
  4. open Core ;; *)
  5.  
  6. (* type <record-name> =
  7. {
  8. <field>: <type>;
  9. <field>: <type>;
  10. } *)
  11.  
  12. type service_info =
  13. {
  14. service_name : string ;
  15. port : int ;
  16. protocol : string ;
  17. }
  18. ;;
  19.  
  20. (* #require "re.postix";; *)
  21.  
  22. let service_info_of_string line =
  23. let matches =
  24. Re.exec (Re.Posix.compile_pat "([a-zA-Z]+)[t]+([0-9]+)/([a-zA-Z]+)") line
  25. in
  26. {
  27. service_name = Re.get matches 1;
  28. port = Int.of_string (Re.get matches 2);
  29. protocol = Re.get matches 3;
  30. }
  31. ;;
  32.  
  33. print_endline "foobar"
  34.  
  35. dune build hello_world.exe
  36. ppx hello_world.pp.ml (exit 1)
  37. (cd _build/default && .ppx/jbuild/ppx_jane/ppx.exe -o hello_world.pp.ml --impl hello_world.ml --dump-ast)
  38. File "hello_world.ml", line 385, characters 0-1:
  39. Error: Syntax error
  40.  
  41. (executable
  42. ((name hello_world)
  43. (libraries (core))
  44. (preprocess (pps (ppx_jane)))))
Add Comment
Please, Sign In to add comment