Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 54 lines (37 sloc) 1.472 kb
ba3ef46 @kschiess . Updates readme to include latest API
authored
1 INTRODUCTION
982ea5d @kschiess . a small readme
authored
2
550c91f @kschiess . updated the readme
authored
3 Parslet makes developing complex parsers easy. It does so by
4
243fca9 @kschiess + documentation
authored
5 * providing the best <b>error reporting</b> possible
6 * <b>not generating</b> reams of code for you to debug
550c91f @kschiess . updated the readme
authored
7
243fca9 @kschiess + documentation
authored
8 Parslet takes the long way around to make <b>your job</b> easier. It allows for
550c91f @kschiess . updated the readme
authored
9 incremental language construction. Often, you start out small, implementing
10 the atoms of your language first; _parslet_ takes pride in making this
11 possible.
12
13 Eager to try this out? Please see the associated web site:
14 http://kschiess.github.com/parslet
e89a175 @kschiess + An example for the readme (what the heck is this?)
authored
15
ba3ef46 @kschiess . Updates readme to include latest API
authored
16 SYNOPSIS
e89a175 @kschiess + An example for the readme (what the heck is this?)
authored
17
18 require 'parslet'
19 include Parslet
20
21 # Constructs a parser using a Parser Expression Grammar like DSL:
22 parser = str('"') >>
23 (
32e2a7c @kschiess . corrected the synopsis
authored
24 str('\\') >> any |
25 str('"').absnt? >> any
e89a175 @kschiess + An example for the readme (what the heck is this?)
authored
26 ).repeat.as(:string) >>
27 str('"')
88a01fc @kschiess + Adapted examples and introduced another simplification
authored
28
e89a175 @kschiess + An example for the readme (what the heck is this?)
authored
29 # Parse the string and capture parts of the interpretation (:string above)
30 tree = parser.parse(%Q{
31 "This is a \\"String\\" in which you can escape stuff"
32 }.strip)
33
34 tree # => {:string=>"This is a \\\"String\\\" in which you can escape stuff"}
35
ad19684 @kschiess .
authored
36 # Here's how you can grab results from that tree:
88a01fc @kschiess + Adapted examples and introduced another simplification
authored
37
38 transform = Parslet::Transform.new do
39 rule(:string => simple(:x)) {
40 puts "String contents (method 2): #{x}" }
41 end
42 transform.apply(tree)
32e2a7c @kschiess . corrected the synopsis
authored
43
3e222ab @kschiess . updated the readme
authored
44 COMPATIBILITY
45
46 This library should work with both ruby 1.8 and ruby 1.9.
ba3ef46 @kschiess . Updates readme to include latest API
authored
47
48 STATUS
e89a175 @kschiess + An example for the readme (what the heck is this?)
authored
49
ad19684 @kschiess .
authored
50 0.12.0
51
243fca9 @kschiess + documentation
authored
52 On the road to 1.0; improving documentation, trying to ease access to the API.
982ea5d @kschiess . a small readme
authored
53
54 (c) 2010 Kaspar Schiess
Something went wrong with that request. Please try again.