Skip to content
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

Invalid generated code when using a right_ctx #15

Closed
dagit opened this issue Dec 10, 2012 · 2 comments
Closed

Invalid generated code when using a right_ctx #15

dagit opened this issue Dec 10, 2012 · 2 comments

Comments

@dagit
Copy link

dagit commented Dec 10, 2012

I think I've hit a bug with using right_ctx regular expression. The following code works in alex 2.x, but fails with 3.0.2:

{
module AlexBug where
}
%wrapper "basic"

@opstr = [^:]+
$preop = \,

tokens :-
  $preop^ @opstr / \: { TokenOperation }

{
data Token = TokenOperation String
  deriving (Read, Show, Eq, Ord)
}

Error message:

$ cabal-dev install
Resolving dependencies...
Configuring alexbug-0.1.0.0...
Building alexbug-0.1.0.0...
Preprocessing executable 'alexbug' for alexbug-0.1.0.0...
[1 of 2] Compiling AlexBug          ( dist/build/alexbug/alexbug-tmp/AlexBug.hs, dist/build/alexbug/alexbug-tmp/AlexBug.o )

templates/wrappers.hs:428:119:
    Couldn't match expected type `AlexInput'
                with actual type `(t0, t1)'
    Expected type: t2 -> AlexInput -> Int -> AlexInput -> Bool
      Actual type: t2 -> (t0, t1) -> t3 -> t4 -> t5
    In the return type of a call of `alexPrevCharMatches'
    In the first argument of `alexAndPred', namely
      `alexPrevCharMatches (\ c -> c >= ',' && c <= ',' || False)'
Failed to install alexbug-0.1.0.0
cabal: Error: some packages failed to install:
alexbug-0.1.0.0 failed during the building phase. The exception was:
ExitFailure 1

Am I doing something wrong? If so, what should my alex definition look like? Thanks!

@antarestrader
Copy link
Contributor

See Pull request #20

@simonmar
Copy link
Member

Closed by #20

simonmar added a commit that referenced this issue Mar 10, 2013
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

No branches or pull requests

3 participants