Permalink
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (19 sloc) 591 Bytes
{
module Lexer
// Opens methods related to fslex.exe
open Microsoft.FSharp.Text.Lexing
let newline (lexbuf: LexBuffer<_>) =
lexbuf.StartPos <- lexbuf.StartPos.NextLine
}
// Regular expressions
let whitespace = [' ' '\t' ]
let newline = ('\n' | '\r' '\n')
rule tokenstream = parse
// --------------------------
| "hello" { Parser.HELLO }
// --------------------------
| whitespace { tokenstream lexbuf }
| newline { newline lexbuf; tokenstream lexbuf }
// --------------------------
| _ { failwith ("ParseError" + LexBuffer<_>.LexemeString lexbuf) }
| eof { Parser.EOF }