Skip to content

Commit

Permalink
Getting the filepath from SrcSpan is often useful
Browse files Browse the repository at this point in the history
  • Loading branch information
Raoul Hidalgo Charman committed Jul 18, 2023
1 parent 8abd0af commit 5442105
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Language/Fortran/Extras/Encoding.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ commonEncode = encode
pprint77l :: IndentablePretty a => a -> String
pprint77l s = pprintAndRender Fortran77Legacy s Nothing

getFilePath :: SrcSpan -> FilePath
getFilePath (SrcSpan p _) = posFilePath p

showFileSpan :: SrcSpan -> String
showFileSpan s@(SrcSpan p _) = posFilePath p <> "-" <> show s

0 comments on commit 5442105

Please sign in to comment.