Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 19c2623532
Fetching contributors…

Cannot retrieve contributors at this time

40 lines (29 sloc) 1.014 kb
open Ocaml
open Tgrammar
type pt_type =
| PT_Record of (string * pt_type option) list
| PT_ListTuple of pt_type list
| PT_String of string
| PT_Char of char
| PT_Int of int
| PT_Int64 of int64
| PT_Float of float
| PT_Bool of bool
| PT_Unit
}}
quote <- '"'
literal <- quote (Default.stringchar* $_) quote {{ __2 }}
recel <- literal ":" pt {{ (__1,Some __3) }}
/ literal {{ (__1,None) }}
recels <- recel ("," recel {{ __2 }})* {{ __1::__2 }}
record <- "{" recels "}" {{ PT_Record __2 }}
lstels <- pt ("," pt {{ __2 }})* {{ __1::__2 }}
listtuple <- "[" lstels "]" {{ PT_ListTuple __2 }}
string <- literal {{ PT_String __1 }}
char <- Default.charsinglequote {{ PT_Char __1 }}
integer <- Default.int {{ PT_Int __1 }}
integer64 <- Default.int64 {{ PT_Int64 __1 }}
float <- Default.float {{ PT_Float __1 }}
bool <- Default.bool {{ PT_Bool __1 }}
unit <- "()" {{ PT_Unit }}
+pt : { pt_type } <- (record / listtuple / string / char / float / integer / integer64 / bool / unit) {{ __1 }}
Jump to Line
Something went wrong with that request. Please try again.