Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jeanphilippe.bernardy@gmail.com
committed
Jul 23, 2008
1 parent
f5e956a
commit 4127b8c
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,39 @@ | |||
-- -*- haskell -*- | |||
-- | |||
-- Lexical syntax for illiterate Haskell 98. | |||
-- | |||
-- (c) Simon Marlow 2003, with the caveat that much of this is | |||
-- translated directly from the syntax in the Haskell 98 report. | |||
-- | |||
|
|||
{ | |||
module Yi.Lexer.Compilation (initState, alexScanToken, Token(..)) where | |||
import Yi.Lexer.Alex | |||
import Yi.Regex | |||
} | |||
|
|||
$digit = 0-9 | |||
$any = [.\n] | |||
@number = $digit+ | |||
|
|||
tokens :- | |||
^.+":" @number ":" @number ":" .*$ { \str st -> let Just (_before, arr, _after) = matchOnceText re $ map snd str | |||
in (st, Report (fst $ arr!1) (read $ fst $ arr!2) (read $ fst $ arr!3) (fst $ arr!4)) } | |||
^[.]+$ ; -- text | |||
\n ; -- just ignore newlines. | |||
|
|||
{ | |||
re :: Regex | |||
re = makeRegex "^(.+):([0-9]+):([0-9]+):(.*)$" | |||
|
|||
type HlState = () | |||
data Token | |||
= Report String Int Int String | |||
| Text String | |||
deriving Show | |||
|
|||
stateToInit () = 0 | |||
initState = () | |||
|
|||
#include "alex.hsinc" | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters