Advertisement
Guest User

Untitled

a guest
Jan 26th, 2014
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.67 KB | None | 0 0
  1. namespace Totem.Bootstrap.Lex
  2.  
  3. type TokenKind =
  4.     | Error of string
  5.     | Comment of string
  6.     | EndOfFile
  7.     | NewLine
  8.     | Indent
  9.     | WhiteSpace
  10.     | Symbol of Symbol
  11.     | Operator of Symbol list
  12.     | Keyword of Keyword
  13.     | Identifier of string
  14.     | Literal of Literal
  15.  
  16. and Literal =
  17.     | String of string
  18.     | Integer of int
  19.     | Long of int64
  20.     | Float of float32
  21.     | Double of double // more types follows
  22.  
  23. // another file:
  24. namespace Totem.Bootstrap.Syntax
  25.  
  26. module internal Parser =
  27.     let (|String|_|) (token:Token) =
  28.         match token.Kind with
  29.         | Lex.Literal (Lex.Literal.String (s)) -> Some (s, token)
  30.         | _ -> None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement