Skip to content

Commit

Permalink
Merge pull request #4970 from 23Skidoo/travis-make-lexer
Browse files Browse the repository at this point in the history
Enable 'make lexer' in travis-meta.
  • Loading branch information
23Skidoo authored Dec 24, 2017
2 parents a963ff4 + 4f53062 commit bf99f8a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 91 deletions.
91 changes: 0 additions & 91 deletions Cabal/Distribution/Parsec/Lexer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import qualified Data.Text.Encoding as T
import qualified Data.Text.Encoding.Error as T
#endif


#if __GLASGOW_HASKELL__ >= 603
#include "ghcconfig.h"
#elif defined(__GLASGOW_HASKELL__)
Expand Down Expand Up @@ -87,7 +86,6 @@ alex_deflt = AlexA# "\xff\xff\xff\xff\xff\xff\xff\xff\x2b\x00\x27\x00\x1b\x00\xf
alex_accept = listArray (0::Int,47) [AlexAcc (alex_action_0),AlexAcc (alex_action_20),AlexAcc (alex_action_16),AlexAcc (alex_action_3),AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAcc (alex_action_1),AlexAcc (alex_action_1),AlexAccSkip,AlexAcc (alex_action_3),AlexAcc (alex_action_4),AlexAcc (alex_action_5),AlexAccSkip,AlexAccSkip,AlexAcc (alex_action_8),AlexAcc (alex_action_8),AlexAcc (alex_action_8),AlexAcc (alex_action_9),AlexAcc (alex_action_9),AlexAcc (alex_action_10),AlexAcc (alex_action_11),AlexAcc (alex_action_12),AlexAcc (alex_action_13),AlexAcc (alex_action_14),AlexAcc (alex_action_15),AlexAcc (alex_action_15),AlexAcc (alex_action_16),AlexAccSkip,AlexAcc (alex_action_18),AlexAcc (alex_action_19),AlexAcc (alex_action_19),AlexAccSkip,AlexAcc (alex_action_22),AlexAcc (alex_action_23),AlexAcc (alex_action_24),AlexAcc (alex_action_25),AlexAcc (alex_action_25)]
{-# LINE 152 "boot/Lexer.x" #-}


-- | Tokens of outer cabal file structure. Field values are treated opaquely.
data Token = TokSym !ByteString -- ^ Haskell-like identifier, number or operator
| TokStr !ByteString -- ^ String in quotes
Expand Down Expand Up @@ -159,7 +157,6 @@ lexToken = do
--traceShow t $ return tok
return t


checkPosition :: Position -> ByteString -> ByteString -> Int -> Lex ()
#ifdef CABAL_PARSEC_DEBUG
checkPosition pos@(Position lineno colno) inp inp' len_chars = do
Expand Down Expand Up @@ -190,7 +187,6 @@ ltest code s =
let (ws, xs) = execLexer (setStartCode code >> lexAll) (B.Char8.pack s)
in traverse_ print ws >> traverse_ print xs


mkLexState :: ByteString -> LexState
mkLexState input = LexState
{ curPos = Position 1 1
Expand All @@ -216,7 +212,6 @@ lines' s1
-> [l]
#endif


bol_field_braces,bol_field_layout,bol_section,in_field_braces,in_field_layout,in_section :: Int
bol_field_braces = 1
bol_field_layout = 2
Expand Down Expand Up @@ -266,67 +261,9 @@ alex_action_25 = \_ _ _ -> adjustPos retPos >> setStartCode bol_field_braces >>

# 17 "/usr/include/stdc-predef.h" 3 4











































{-# LINE 10 "<command-line>" #-}
{-# LINE 1 "/opt/ghc/7.10.3/lib/ghc-7.10.3/include/ghcversion.h" #-}

















{-# LINE 10 "<command-line>" #-}
{-# LINE 1 "templates/GenericTemplate.hs" #-}
-- -----------------------------------------------------------------------------
Expand All @@ -340,10 +277,6 @@ alex_action_25 = \_ _ _ -> adjustPos retPos >> setStartCode bol_field_braces >>

{-# LINE 21 "templates/GenericTemplate.hs" #-}





-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.
#if __GLASGOW_HASKELL__ > 706
#define GTE(n,m) (tagToEnum# (n >=# m))
Expand All @@ -354,7 +287,6 @@ alex_action_25 = \_ _ _ -> adjustPos retPos >> setStartCode bol_field_braces >>
#endif
{-# LINE 51 "templates/GenericTemplate.hs" #-}


data AlexAddr = AlexA# Addr#
-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.
#if __GLASGOW_HASKELL__ < 503
Expand All @@ -374,10 +306,6 @@ alexIndexInt16OffAddr (AlexA# arr) off =
indexInt16OffAddr# arr off
#endif





{-# INLINE alexIndexInt32OffAddr #-}
alexIndexInt32OffAddr (AlexA# arr) off =
#ifdef WORDS_BIGENDIAN
Expand All @@ -395,21 +323,13 @@ alexIndexInt32OffAddr (AlexA# arr) off =
indexInt32OffAddr# arr off
#endif






#if __GLASGOW_HASKELL__ < 503
quickIndex arr i = arr ! i
#else
-- GHC >= 503, unsafeAt is available from Data.Array.Base.
quickIndex = unsafeAt
#endif




-- -----------------------------------------------------------------------------
-- Main lexing routines

Expand All @@ -429,28 +349,19 @@ alexScanUser user input (I# (sc))
case alexGetByte input of
Nothing ->



AlexEOF
Just _ ->



AlexError input'

(AlexLastSkip input'' len, _) ->



AlexSkip input'' len

(AlexLastAcc k input''' len, _) ->



AlexToken input''' len k


-- Push the input through the DFA, remembering the most recent accepting
-- state it encountered.

Expand All @@ -464,8 +375,6 @@ alex_scan_tkn user orig_input len input s last_acc =
Nothing -> (new_acc, input)
Just (c, new_input) ->



case fromIntegral c of { (I# (ord_c)) ->
let
base = alexIndexInt32OffAddr alex_base s
Expand Down
2 changes: 2 additions & 0 deletions Cabal/misc/travis-diff-files.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh
set -eax

git status > /dev/null # See 09a71929e433f36b27fd6a4938469d3bbbd5e191
git diff-files -p --exit-code
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ lexer : $(LEXER_HS)

$(LEXER_HS) : boot/Lexer.x
alex --latin1 --ghc -o $@ $^
cat -s $@ > Lexer.tmp
mv Lexer.tmp $@

lib : $(LEXER_HS)
cabal new-build --enable-tests Cabal
Expand Down
1 change: 1 addition & 0 deletions travis-meta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export PATH=/opt/cabal/head/bin:$PATH
#./Cabal/misc/gen-authors.sh > AUTHORS

# Regenerate files
timed make lexer
timed make gen-extra-source-files

# Fail if the diff is not empty.
Expand Down

0 comments on commit bf99f8a

Please sign in to comment.