Changeset 31
- Timestamp:
- Nov 23, 2007, 3:21:14 PM (18 years ago)
- Author:
- neil.c.c.brown
- Message:
-
Fixed the syntax highlighting to use keywords (not emph) while still separating the symbols from the keywords. Also simplified the QuickCheck example.
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
docs/trunk/200711-tock-seminars/200711-tock-slides.tex
r30 r31 65 65 % To separate out word keywords from symbol keywords for different formatting, 66 66 % we define the word keywords as emph items (use emphstyle): 67 { (削除) emph={data,type,newtype,let,do,where,if,then,else,return} (削除ここまで),67 {(追記) classoffset=0 (追記ここまで), 68 68 %If we don't specify at least one "non-other" keyword, listings doesn't work, hence: 69 69 morekeywords={hduisahfiuabfyasbyoasvbfuyvosf}, 70 70 otherkeywords={::,=,==,->,=>,>>,>>=,,ドル++,<-}, 71 (追記) classoffset=1, (追記ここまで) 72 (追記) morekeywords={data,type,newtype,let,do,where,if,then,else,return}, (追記ここまで) 73 (追記) % For some (unknown) reason, setting classoffset = 0 again after this line (追記ここまで) 74 (追記) % breaks the highlighting. (追記ここまで) 71 75 morecomment=[l]{--}, 72 76 % morestring=[b]', … … 88 92 columns=flexible, 89 93 basicstyle=\small, 90 emphstyle=\color{KentBlue}\bfseries, 91 keywordstyle=\color{KentBlue}\bfseries\ttfamily, 94 emphstyle=\color{KentRed}\bfseries, 95 keywordstyle=[1]{\color{KentBlue}\bfseries}, 96 keywordstyle=[0]{\color{KentBlue}\bfseries\ttfamily}, 92 97 identifierstyle=, 93 98 commentstyle=\color{KentGreen}\itshape, … … 395 400 \begin{lstlisting} 396 401 -- HUnit example: 402 (追記) (追記ここまで) 397 403 assertEqual "Test 0" 398 404 "foo_bar" … … 401 407 -- QuickCheck example: 402 408 403 -- Generates a list of random numbers that sums to the given total: 404 randList :: Int -> RandomMonad [Int] 405 406 prop_randList n 407 = check (execRandom (seed n) (randList (n/10))) 408 where 409 check ns = (all (> 0) ns) && (sum ns == n) 409 prop_Reverse :: [Int] -> Bool 410 prop_Reverse xs = reverse (reverse xs) == xs 410 411 \end{lstlisting} 411 412 \end{frame}
Note:
See TracChangeset
for help on using the changeset viewer.