Advertisement
Guest User

Untitled

a guest
Jan 24th, 2014
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.75 KB | None | 0 0
  1.         let rec integrateWhiteSpaceAndComments (tokens:Token list) acc =
  2.             match tokens with
  3.             | Kind(Comment(_), comment) :: r ->
  4.                 let comments = comment.LeadingComments @ [{comment with LeadingComments = []}]
  5.  
  6.                 match r with
  7.                 | h :: t -> integrateWhiteSpaceAndComments ({h with LeadingComments = comments} :: t) acc
  8.                 | _ -> failwith "Comment cannot be last in the document (there should be an EndOfFile after at least)"
  9.             | h :: Kind(WhiteSpace, ws) :: t -> integrateWhiteSpaceAndComments t ({h with TrailingWhiteSpace = h.TrailingWhiteSpace + ws.Text} :: acc)
  10.             | [] -> acc |> List.rev
  11.             | h :: t -> integrateWhiteSpaceAndComments t (h :: acc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement