README.rdoc in sexpistol-0.0.1 vs README.rdoc in sexpistol-0.0.2
- old
+ new
@@ -3,33 +3,35 @@
Sexpistol is a simple library for parsing S-Expressions in Ruby. Sexpistol takes an S-Expression and turns it into a native Ruby data structure made up of nested sets of arrays.
=== Example
(define test (lambda () (
- (print "blah")
+ (print "Hello world!\n")
(print 1)
(print 9.01)
+ (print 2.0e10)
(print (+ 10 12 13))
)))
would be parsed by Sexpistol like so:
[:define, :test, [:lambda, [], [
- [:print, "blah"],
+ [:print, "Hello world!\n"],
[:print, 1],
[:print, 9.01],
- [:print, [:"+", 10, 12, 13]]
+ [:print, 2.0e10],
+ [:print, [:+, 10, 12, 13]]
]]]
=== Type mappings
Sexpistol supports all of the standard datatypes and converts them directly to their Ruby equivalents:
* Lists (a b c)
* Integers (1 2 3)
-* Floats (1.0 2.0 42.9)
+* Floats (1.0 2.0 42.9 3e6 1.2e2)
* Strings ("\t\"Hello world!\"\n")
-* Symbols (symbol Symbol __symbol__ symbo_l symbol? symbol!)
+* Symbols (symbol Symbol ____symbol____ symbo_l symbol? symbol! + - / ++ a+ e$, etc...)
Sexpistol also supports mapping the Ruby keyword literals (nil, true, false) to their native Ruby types, although this is disabled by default for compatibility. To enable it use `@parser.ruby_keyword_literals = true`, eg:
@parser = Sexpistol.new
@parser.parse_string("nil false true")
\ No newline at end of file