New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library names in package files may not contain hyphens #4292

Open
ianbollinger opened this Issue Jan 15, 2018 · 4 comments

Comments

Projects
None yet
5 participants
@ianbollinger
Copy link

ianbollinger commented Jan 15, 2018

idris --build will terminate with an error if an .ipkg file references a library with a hyphen in its name. Presumably it will fail for other valid file names, but I haven't investigated yet.

Steps to Reproduce

A minimal .ipkg file that produces the error:

package example
libs = example-1.0
modules = Example

Expected Behavior

The package links successfully.

Observed Behavior

$ idris --build example.ipkg
Uncaught error: user error (example.ipkg:2:15:
  |
2 | libs = example-1.0
  |               ^
unexpected '-'
expecting "author", "brief", "bugtracker", "executable", "homepage", "libs", "license", "main", "maintainer", "makefile", "modules", "objs", "opts", "pkgs", "readme", "sourcedir", "sourceloc", "tests", "version", ',', or end of input
)

Workaround

package example
opts = "--cg-opt='-L example-1.0"
modules = Example

Comments

I'm guessing this is a relatively trivial fix, so I'll take a look at fixing it shortly. I just wanted to document it in case I forgot about it.

@ahmadsalim

This comment has been minimized.

Copy link
Contributor

ahmadsalim commented Jan 16, 2018

Thanks for reporting the issue. PRs more than welcome!

@luc-tielen

This comment has been minimized.

Copy link

luc-tielen commented May 17, 2018

Something like the following? Can't test it right now:

diff --git a/src/Idris/Parser/Helpers.hs b/src/Idris/Parser/Helpers.hs
index 25a41ea7..704a6903 100644
--- a/src/Idris/Parser/Helpers.hs
+++ b/src/Idris/Parser/Helpers.hs
@@ -271,7 +271,7 @@ reservedIdentifiers = HS.fromList
 identifierOrReserved :: Parsing m => m String
 identifierOrReserved = token $ P.try $ do
   c <- P.satisfy isAlpha <|> P.oneOf "_"
-  cs <- P.many (P.satisfy isAlphaNum <|> P.oneOf "_'.")
+  cs <- P.many (P.satisfy isAlphaNum <|> P.oneOf "_'-.")
   return $ c : cs

 char :: Parsing m => Char -> m Char

Maybe a more sophisticated fix is needed so - is not allowed at end?

@unalos

This comment has been minimized.

Copy link
Contributor

unalos commented Dec 17, 2018

.\Data\Complex.idr:58:25-46:
724   |
72558 |     (*) (a:+b) (c:+d) = ((a*c-b*d):+(b*c+a*d))
726   |                         ~~~~~~~~~~~~~~~~~~~~~~
727When checking right hand side of Prelude.Interfaces.Data.Complex.Complex a implementation of Prelude.Interfaces.Num, method * with expected type
728        Complex a

The proposed fix is too wide and impacts parsing of numerical operators. I've narrowed it.

Pull request #4623

@foolswood

This comment has been minimized.

Copy link
Contributor

foolswood commented Feb 22, 2019

@unalos should this issue be closed as having been resolved?

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