<ahref="https://en.wikipedia.org/wiki/S-Expression"title="wp: S-Expression"target="_blank">S-Expressions</a> are one convenient way to parse and store data.
Write a simple reader/parser for S-Expressions that handles quoted and unquoted strings, integers and floats.
The function should read a single but nested S-Expression from a string and return it as a (nested) array.
Newlines and other whitespace may be ignored unless contained within a quoted string.
“<tt>()</tt>” inside quoted strings are not interpreted, but treated as part of the string.
Handling escaped quotes inside a string is optional; thus “<tt>(foo"bar)</tt>” maybe treated as a string “<tt>foo"bar</tt>”, or as an error.
For this, the reader need not recognize “<tt>\</tt>” for escaping, but should, in addition, recognize numbers if the language has appropriate datatypes.
Note that with the exception of “<tt>()"</tt>” (“<tt>\</tt>” if escaping is supported) and whitespace there are no special characters. Anything else is allowed without quotes.
The reader should be able to read the following input
<pre>
((data "quoted data" 123 4.5)
(data (!@# (4.5) "(more" "data)")))
</pre>
and turn it into a native datastructure. (see the <ahref="https://rosettacode.org/wiki/S-Expressions#Pike"title="#Pike"target="_blank">Pike</a>, <ahref="https://rosettacode.org/wiki/S-Expressions#Python"title="#Python"target="_blank">Python</a> and <ahref="https://rosettacode.org/wiki/S-Expressions#Ruby"title="#Ruby"target="_blank">Ruby</a> implementations for examples of native data structures.)
testString: assert.deepEqual(parseSexpr(basicSExpr), basicSolution, "<code>parseSexpr('(data1 data2 data3)')</code> should return an array with 3 elements");