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 clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.