Created
April 3, 2012 01:15
-
-
Save klaeufer/2288528 to your computer and use it in GitHub Desktop.
Lexer-only example for F# lexing and parsing example from F# Programming Wikibook
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
open System | |
open Sql | |
let x = " | |
SELECT x, y, z | |
FROM t1 | |
LEFT JOIN t2 | |
INNER JOIN t3 ON t3.ID = t2.ID | |
WHERE x = 50 AND y = 20 | |
ORDER BY x ASC, y DESC, z | |
" | |
let lexbuf = Lexing.LexBuffer<_>.FromString x | |
while not lexbuf.IsPastEndOfStream do | |
printfn "%A" (SqlLexer.tokenize lexbuf) | |
Console.WriteLine("(press any key)") | |
Console.ReadKey(true) |> ignore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment