Skip to content

Commit

Permalink
Compiles with Alex 3.0.5 and 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Zimmerman committed Oct 14, 2013
1 parent 2e6461f commit 71b4b60
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 73 deletions.
10 changes: 6 additions & 4 deletions src-dev/Language/JavaScript/Parser/Lexer.x
Expand Up @@ -203,7 +203,7 @@ tokens :-
-- Identifier = {ID Head}{ID Tail}*
-- <reg,divide> @IDHead(@IDTail)* { \loc len str -> keywordOrIdent (take len str) loc }
<reg,divide> @IdentifierStart(@IdentifierPart)* { \ap@(loc,_,str) len -> keywordOrIdent (take len str) (toTokenPosn loc) }
<reg,divide> @IdentifierStart(@IdentifierPart)* { \ap@(loc,_,_,str) len -> keywordOrIdent (take len str) (toTokenPosn loc) }
-- StringLiteral = '"' ( {String Chars1} | '\' {Printable} )* '"'
-- | '' ( {String Chars2} | '\' {Printable} )* ''
Expand Down Expand Up @@ -378,7 +378,8 @@ lexToken = do
lexToken
AlexToken inp' len action -> do
alexSetInput inp'
token <- action (ignorePendingBytes inp) len
-- token <- action (ignorePendingBytes inp) len
token <- action inp len
setLastToken token
return token

Expand Down Expand Up @@ -448,8 +449,9 @@ alexEOF = do return (EOFToken tokenPosnEmpty [])
tailToken :: Alex Token
tailToken = do return (TailToken tokenPosnEmpty [])

adapt :: (TokenPosn -> Int -> String -> Alex Token) -> (AlexPosn,Char,String) -> Int -> Alex Token
adapt f loc@(p@(AlexPn offset line col),_,inp) len =
-- adapt :: (TokenPosn -> Int -> String -> Alex Token) -> (AlexPosn,Char,String) -> Int -> Alex Token
adapt :: (TokenPosn -> Int -> String -> Alex Token) -> AlexInput -> Int -> Alex Token
adapt f loc@(p@(AlexPn offset line col),_,_,inp) len =
(f (TokenPn offset line col) len inp)

{-
Expand Down

0 comments on commit 71b4b60

Please sign in to comment.