+1 for JavaParser. I used it recently on a project, and it *just works*.

On Thu, Nov 3, 2016 at 8:39 AM, Vitaly Peressada <[email protected]>
wrote:

> Thanks, Alex. Will give javaparser a try.
>
>
> On Thursday, 3 November 2016 14:06:31 UTC, Alex Miller wrote:
>>
>> While writing a parser for Java with instaparse would probably be a fun
>> exercise, there are certainly several available Java parsers you could just
>> use immediately rather than writing one.
>>
>> One easily findable example:
>> https://github.com/javaparser/javaparser
>>
>>
>> On Thursday, November 3, 2016 at 8:29:32 AM UTC-5, Vitaly Peressada wrote:
>>>
>>> Hi All,
>>>
>>> Does anyone have experience with parsing java with instaparse? I want to
>>> parse java REST services source, something like
>>>
>>> ------------------------------------------
>>> import javax.ws.rs.Consumes;
>>> import javax.ws.rs.GET;
>>> import javax.ws.rs.POST;
>>> import javax.ws.rs.Path;
>>> import javax.ws.rs.Produces;
>>> import javax.ws.rs.QueryParam;
>>> import javax.ws.rs.core.MediaType;
>>> import javax.ws.rs.core.Response;
>>>
>>> import org.springframework.stereotype.Component;
>>>
>>> @Component
>>> @Path("/mypath")
>>> public class MyRestfulService {
>>>
>>>     @Autowired
>>>     private Dependency dependency;
>>>
>>>     @GET
>>>     @Path("/query")
>>>     @Produces(MediaType.APPLICATION_XML)
>>>     public Response getMyData(@QueryParam("param1") String param1,
>>> @QueryParam("param2") String param2) {
>>>       ...
>>>     }
>>>
>>>     @POST
>>>     @Path("/xml")
>>>     @Consumes(MediaType.APPLICATION_XML)
>>>     @Produces(MediaType.APPLICATION_XML)
>>>     public Response getMyDataFromXml(XmlMyRequest request) {
>>>      ...
>>>     }
>>>
>>>     ...
>>> }
>>> -------------------------------------------------------------------
>>>
>>> I think ANTLR would have full java support but I do want to use
>>> instaparse. How difficult would be to write a grammar? I am interested in
>>> getting method (get/post), path, query string and XML request (for post)
>>> endpoints.
>>>
>> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to