Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rec integrateWhiteSpaceAndComments (tokens:Token list) acc =
- match tokens with
- | Kind(Comment(_), comment) :: r ->
- let comments = comment.LeadingComments @ [{comment with LeadingComments = []}]
- match r with
- | h :: t -> integrateWhiteSpaceAndComments ({h with LeadingComments = comments} :: t) acc
- | _ -> failwith "Comment cannot be last in the document (there should be an EndOfFile after at least)"
- | h :: Kind(WhiteSpace, ws) :: t -> integrateWhiteSpaceAndComments t ({h with TrailingWhiteSpace = h.TrailingWhiteSpace + ws.Text} :: acc)
- | [] -> acc |> List.rev
- | h :: t -> integrateWhiteSpaceAndComments t (h :: acc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement