Hello Matt. Le ven. 18 déc. 2020 à 16:16, Matt Juntunen <matt.juntu...@hotmail.com> a écrit : > > Hi all, > > I've created a simple text parser
Did you consider leaving that job to a specialized tool[1] ? Because... > class [1] as part of writing the 3D file format IO functionality for > GEOMETRY-101. One of the primary goals of the class is to provide > standardized and informative parse errors that include line and column > numbers from the text input. ... that's what they do. ;-) > (Nothing is worse than attempting to process a file and receiving a > completely generic, unhelpful exception message.) That portion is working > well. However, I'm wondering what exception type to use for these > standardized parse errors. I'm currently using IllegalStateException since > you can conceptualize the parser as a state machine. However, I feel like > there is probably a better solution. > > Any ideas? Any reason for not reusing an existing tool? If not, I'd be weary to introduce/maintain such a (usually lengthy) code. In either case (using an existing library or implementing the parser if there is indeed a good reason to do it), I'd think that it is a good time to create a new maven module for hosting this functionality; it is more than a usage "example", and could become the indispensable complement to the "core" modules (as IIUC the parser creates the Java objects specific to this component). Regards, Gilles [1] E.g. https://javacc.github.io/javacc (I'm not using it, I've not tested it). > [...] --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org