Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added new primitive parsing functions

  • Loading branch information...
commit 1e6b2e7e4fba5c02ff182c205da719d296871e39 1 parent 29466c8
@devhawk authored
View
13 Cashel/Cashel.Tests/primitives_test.fs
@@ -172,4 +172,15 @@ let test_skip_items () =
[<Fact>]
let test_skip_items_fail () =
- skip_items !!"ts" !!"test" |> should equal None
+ skip_items !!"ts" !!"test" |> should equal None
+
+[<Fact>]
+let test_space () =
+ let exp = Some (' ', !!" test")
+ space !!" test" |> should equal exp
+
+[<Fact>]
+let test_tab () =
+ let exp = Some ('\t', !!" test")
+ space !!"\t test" |> should equal exp
+
View
7 Cashel/Cashel/primitives.fs
@@ -104,3 +104,10 @@ let add_line_and_col cl =
| [] -> []
worker cl 1 1
+let lowercase = any_of ['a'..'z']
+let uppercase = any_of ['A'..'Z']
+let letter = lowercase +++ uppercase
+let digit = any_of ['0'..'9']
+let digitval = digit >>= (fun d -> result (int d - int '0'))
+let space = satisfy item (System.Char.IsWhiteSpace)
+let skip_space = repeat space |> forget
Please sign in to comment.
Something went wrong with that request. Please try again.