-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EditorConfig validator: support for line/column, offset info with ParsingException #9
Comments
As I have worked about this topic several month ago, I have pushed my POC at https://github.com/angelozerr/editorconfig-java-parser You can find a very basic demo which uses the parser: If you are interested tell me. |
@angelozerr Thanks for your validator! The syntax validator is definitely useful. However, the core library should not validate any property/value names, as the editor plugins should be able to make some extensions on their own, without modifying core libraries. |
Glad this idea please you.
The parser DO NOT that. It throws an exception if section is not closed, etc, but it doesn't validate option name, value.
At first, the EditorConfig parser is a parser of editorconfig content. You can compare it to SAX parser which works with handler. See https://github.com/angelozerr/editorconfig-java-parser/blob/master/fr.opensagres.editorconfig/src/fr/opensagres/editorconfig/handlers/EditorConfigHandler.java The parser is able to call those events. So after that you can implement handler like you wish:
|
It should be cool if we could have an utility method
validate
which waits a String content of an editorconfig and throws ParsingException when this content is not well formatted:Here a sample with miss of close of
[
for section names:The exception ParsingException should contains offset and line/column info where there is an error.
With this utility method
validate
, any IDE could support validation with marker.Many thanks!
The text was updated successfully, but these errors were encountered: