1 |
slyfox 11/07/31 15:38:07 |
2 |
|
3 |
Added: alex-2.3.5-missing-test.patch |
4 |
alex-2.3.5-ghc-7.2.patch |
5 |
Log: |
6 |
Version bump. Added tests support. |
7 |
|
8 |
(Portage version: 2.1.10.7/cvs/Linux x86_64) |
9 |
|
10 |
Revision Changes Path |
11 |
1.1 dev-haskell/alex/files/alex-2.3.5-missing-test.patch |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-haskell/alex/files/alex-2.3.5-missing-test.patch?rev=1.1&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-haskell/alex/files/alex-2.3.5-missing-test.patch?rev=1.1&content-type=text/plain |
15 |
|
16 |
Index: alex-2.3.5-missing-test.patch |
17 |
=================================================================== |
18 |
commit 883587ca4feecab72381991533b2f686a57a4d57 |
19 |
Author: Sergei Trofimovich <slyfox@g.o> |
20 |
Date: Mon Jul 25 08:20:13 2011 +0300 |
21 |
|
22 |
added missing tokens_bytestring test |
23 |
|
24 |
Signed-off-by: Sergei Trofimovich <slyfox@g.o> |
25 |
|
26 |
diff --git a/alex.cabal b/alex.cabal |
27 |
index b262af7..c6f6e22 100644 |
28 |
--- a/alex.cabal |
29 |
+++ b/alex.cabal |
30 |
@@ -57,6 +57,7 @@ extra-source-files: |
31 |
tests/tokens.x |
32 |
tests/tokens_gscan.x |
33 |
tests/tokens_posn.x |
34 |
+ tests/tokens_bytestring.x |
35 |
|
36 |
flag small_base |
37 |
description: Choose the new smaller, split-up base package. |
38 |
diff --git a/tests/tokens_bytestring.x b/tests/tokens_bytestring.x |
39 |
new file mode 100644 |
40 |
index 0000000..0cb23c8 |
41 |
--- /dev/null |
42 |
+++ b/tests/tokens_bytestring.x |
43 |
@@ -0,0 +1,46 @@ |
44 |
+{ |
45 |
+{-# LANGUAGE OverloadedStrings #-} |
46 |
+module Main (main) where |
47 |
+import System.Exit |
48 |
+import Data.ByteString.Lazy.Char8 (unpack) |
49 |
+} |
50 |
+ |
51 |
+%wrapper "posn-bytestring" |
52 |
+ |
53 |
+$digit = 0-9 -- digits |
54 |
+$alpha = [a-zA-Z] -- alphabetic characters |
55 |
+ |
56 |
+tokens :- |
57 |
+ |
58 |
+ $white+ ; |
59 |
+ "--".* ; |
60 |
+ let { tok (\p s -> Let p) } |
61 |
+ in { tok (\p s -> In p) } |
62 |
+ $digit+ { tok (\p s -> Int p (read (unpack s))) } |
63 |
+ [\=\+\-\*\/\(\)] { tok (\p s -> Sym p (head (unpack s))) } |
64 |
+ $alpha [$alpha $digit \_ \']* { tok (\p s -> Var p (unpack s)) } |
65 |
+ |
66 |
+{ |
67 |
+-- Each right-hand side has type :: AlexPosn -> String -> Token |
68 |
+ |
69 |
+-- Some action helpers: |
70 |
+tok f p s = f p s |
71 |
+ |
72 |
+-- The token type: |
73 |
+data Token = |
74 |
+ Let AlexPosn | |
75 |
+ In AlexPosn | |
76 |
+ Sym AlexPosn Char | |
77 |
+ Var AlexPosn String | |
78 |
+ Int AlexPosn Int | |
79 |
+ Err AlexPosn |
80 |
+ deriving (Eq,Show) |
81 |
+ |
82 |
+main = if test1 /= result1 then exitFailure |
83 |
+ else exitWith ExitSuccess |
84 |
+ |
85 |
+test1 = alexScanTokens " let in 012334\n=+*foo bar__'" |
86 |
+result1 = [Let (AlexPn 2 1 3),In (AlexPn 6 1 7),Int (AlexPn 9 1 10) 12334,Sym (AlexPn 16 2 1) '=',Sym (AlexPn 17 2 2) '+',Sym (AlexPn 18 2 3) '*',Var (AlexPn 19 2 4) "foo",Var (AlexPn 23 2 8) "bar__'"] |
87 |
+ |
88 |
+ |
89 |
+} |
90 |
|
91 |
|
92 |
|
93 |
1.1 dev-haskell/alex/files/alex-2.3.5-ghc-7.2.patch |
94 |
|
95 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-haskell/alex/files/alex-2.3.5-ghc-7.2.patch?rev=1.1&view=markup |
96 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-haskell/alex/files/alex-2.3.5-ghc-7.2.patch?rev=1.1&content-type=text/plain |
97 |
|
98 |
Index: alex-2.3.5-ghc-7.2.patch |
99 |
=================================================================== |
100 |
diff --git a/alex.cabal b/alex.cabal |
101 |
index d04467b..b262af7 100644 |
102 |
--- a/alex.cabal |
103 |
+++ b/alex.cabal |
104 |
@@ -72,7 +72,7 @@ executable alex |
105 |
|
106 |
build-depends: base < 5 |
107 |
|
108 |
- extensions: CPP |
109 |
+ extensions: CPP, BangPatterns |
110 |
ghc-options: -Wall |
111 |
other-modules: |
112 |
AbsSyn |
113 |
diff --git a/doc/configure.ac b/doc/configure.ac |
114 |
index 51fa85d..6e772c0 100644 |
115 |
--- a/doc/configure.ac |
116 |
+++ b/doc/configure.ac |
117 |
@@ -9,5 +9,5 @@ FP_DIR_DOCBOOK_XSL([/usr/share/xml/docbook/stylesheet/nwalsh/current /usr/share/ |
118 |
|
119 |
AC_PATH_PROG(DbLatexCmd,dblatex) |
120 |
|
121 |
-AC_CONFIG_FILES([config.mk]) |
122 |
+AC_CONFIG_FILES([config.mk alex.1]) |
123 |
AC_OUTPUT |