Hi,
SmaCC ships with a JS parser. Please take a look at it.
Cheers,
Doru
--
> On Apr 16, 2017, at 3:42 PM, chrismihaylyk <chrismihaylyk@gmail.com> wrote:
>
> Hello, friends!
>
> I'm creating MongoDBBrowser that have all CRUD operations and I need a
> parser that translates javascript queries to MongoDB into the queries (for
> making selects, inserts etc.) using MongoQuery class.
> For example, I have query
>
> db.SomeCollection.find( {$or: [ { name: { $regex: /test/i } }, {
> description: { $regex: /test/i } } ] } )
>
> that is manually rewriting into
> someCollection select: {
>�� �� �� �� '$or' -> {
>�� �� �� �� �� �� �� �� { 'name' -> {
>�� �� �� �� �� �� �� �� �� �� �� �� '$regex' -> 'test' .
>�� �� �� �� �� �� �� �� �� �� �� �� '$options' -> 'i' } asDictionary } asDictionary.
>�� �� �� �� �� �� �� �� { 'description' -> {
>�� �� �� �� �� �� �� �� �� �� �� �� '$regex' -> 'test' .
>�� �� �� �� �� �� �� �� �� �� �� �� '$options' -> 'i' } asDictionary } asDictionary
>�� �� �� �� }
> } asDictionary
>
> But I need to have a parser that will do it automatically.
>
> Maybe there are already exist one? If not, how to write my own?
> Please help.
>
> Thanks a lot, Khrystyna=)
>
>
>
> --
> View this message in context: http://forum.world.st/Parser-for-javascript-mongodb-json- notation-selects-tp4942299. html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
www.tudorgirba.com
www.feenk.com
"Reasonable is what we are accustomed with."