Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

. examples

  • Loading branch information...
commit 725a5843bb424f90735998c3d021b2a59f2d5d64 1 parent 46525ce
@kschiess kschiess authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 lib/parslet/parser.rb
View
15 lib/parslet/parser.rb
@@ -12,6 +12,21 @@
# pp MyParser.new.parse('bbbb') # => Parslet::Atoms::ParseFailed:
# # Don't know what to do with bbbb at line 1 char 1.
#
+# Parslet::Parser is also a grammar atom. This means that you can mix full
+# fledged parsers freely with small parts of a different parser.
+#
+# Example:
+# class ParserA < Parslet::Parser
+# root :aaa
+# rule(:aaa) { str('a').repeat(3,3) }
+# end
+# class ParserB < Parslet::Parser
+# root :expression
+# rule(:expression) { str('b') >> ParserA.new >> str('b') }
+# end
+#
+# In the above example, ParserB would parse something like 'baaab'.
+#
class Parslet::Parser < Parslet::Atoms::Base
include Parslet
Please sign in to comment.
Something went wrong with that request. Please try again.