Skip to content

Conversation

kztk-m
Copy link

@kztk-m kztk-m commented Feb 21, 2024

This PR changes the behavior of field so that it can parse a field that does not end with a new line, addressing #54.

In the latest version, it seems to me that field is used only in extractPkgs. So, I have only tested extractPkgs in REPL.

It works as expected for my example used in #54.

$ cabal repl 
ghci> parseOnly extractPkgs (Data.Text.pack "packages: proj/*.cabal\n")
Right ["proj/*.cabal"]
ghci> parseOnly extractPkgs (Data.Text.pack "packages: proj/*.cabal")
Right ["proj/*.cabal"]

I also confirmed the following behavior is kept unchanged for this commit.

$ cabal repl 
ghci> import Data.Text.IO as T
ghci> T.readFile "./test/cabal.project"  >>= \s -> pure $ parseOnly extractPkgs s
Right ["optics/*.cabal","optics-core/*.cabal","optics-extra/*.cabal","optics-sop/*.cabal","optics-th/*.cabal","optics-vl/*.cabal","indexed-profunctors/*.cabal","template-haskell-optics/*.cabal","metametapost/*.cabal"]

I haven't checked how this change affects 0.1.2.7, which I understand is what is called 0.1.4.0 and uses the field function in places other than extractPkgs.

Added a function `skipToNextLineOrEOI` and changed `field` to call
the function instead. This function may consume no inputs, and hence
`many skipToNextLineOrEOI` can go to infinite loop.
@Avi-D-coder
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants