Re: Can anyone give me a help about developing antlr formatter
No, I am going on vacation. Hiking the MacLehose trail. Peter Cheung schrieb am Do., 10. Okt. 2019, 19:50: > Hey Mario >Yes, i am from Hong Kong. Why come here? Business trip? > Thanks > From Peter > > From: Mario Schroeder > Sent: Thursday, October 10, 2019 3:48 PM > To: dev@netbeans.apache.org > Subject: Re: Can anyone give me a help about developing antlr formatter > > Peter, you are from Hong Kong?! What a coincidence that I will be there > within a week. Despite all the issues, I'm looking forward. > Sorry for the off topic. > > Am Do., 10. Okt. 2019 um 08:35 Uhr schrieb Peter Cheung < > mcheun...@hotmail.com>: > > > Dear Tim > > You are a great people and full of passion. In my home town (Hong > > Kong), people just "use" open source, not contributing it. > > Thanks > > From Peter > > > > From: Tim Boudreau > > Sent: Wednesday, October 9, 2019 1:42 PM > > To: dev@netbeans.apache.org > > Subject: Re: Can anyone give me a help about developing antlr formatter > > > > Okay. If you'd like to try some stuff, I could hook you up with some > > modules. Antlr support - syntax highlighting, navigator panels, syntax > > tree views, has been working for a while; formatting is pretty solid > now. > > I've spent the last week stabilizing the "live preview" functionality, > > which actually generates NetBeans language support with syntax > highlighting > > for *the grammar you are currently editing* - so you can have a syntax > > highlighted preview, and associate a file extension with that grammar and > > open those files and interact with them with full IDE support that is > > updated whenever you edit the grammar. > > > > Basically the PITA with developing Antlr grammars is when you break some > > rule that worked, change a whole bunch of other stuff before you know you > > broke it, and then have to figure out which thing you did caused the > > problem. So being able to visually, and instantly, see if something is > > broken seems like a basic thing that's needed to make grammar development > > much less painful. > > > > Here's a screen shot: > > https://timboudreau.com/files/screen/10-09-2019_01-39-44.png > > > > All that gets a bit complex: > > > > - User edits the grammar file > > - Listener on the grammar file notices and tells highlighters of > documents > > in the language of that grammar to request a reparse > > - They ask for a new parse from a parser which > > - Is actually going to run code in an isolated classloader that loads > > from an in-memory filesystem where the grammar and generated analyzer > code > > was compiled > > - Notices that the grammar file - whose document is mapped into that > > in-memory filesystem - has changed > > - Initiates a new run of Antlr generating parser and lexer > > - Compiles them into that memory filesystem > > - Generates the source for a thing that will call that parser with > > document contents, and retrieve the tokens, parse tree, etc. copied into > > proxy objects so the classloader does not leak types > > - Creates a new isolated classloader over the class output for all > that > > - Replaces that classloader in the proxy parser > > - Passes the document text into that parser, extracts the proxied > parse > > tree and wraps that in a NetBeans Parser.Result > > > > The good news is all that can happen in < 100ms. It works, but I've been > > chasing bugs in the choreography of that process to ensure the new parse > > runs against the right version of the grammar - each layer of that will > use > > the previous result if nothing has changed but the input text, and it > works > > out to being a big chain of lists of weakly referenced susbscribers to > > things that subscribe to other things (i.e. the parser subscribes to > > replacement of the classloader environment; the highlighters subscribe to > > changes on the parser). > > > > It requires a few hacks that will probably get turned into patches - > > there's no way via API to get the cache for Source objects for the > > in-language document to invalidate its cached parser results because > *some > > other document* changed, so that has to be done via reflection; and > > similarly, there is no direct way to force a Language instance to be > > discarded by its LanguageHierarchy, but if you don't, it will keep a > cache > > of token ids that
Re: Can anyone give me a help about developing antlr formatter
Hey Mario Yes, i am from Hong Kong. Why come here? Business trip? Thanks >From Peter From: Mario Schroeder Sent: Thursday, October 10, 2019 3:48 PM To: dev@netbeans.apache.org Subject: Re: Can anyone give me a help about developing antlr formatter Peter, you are from Hong Kong?! What a coincidence that I will be there within a week. Despite all the issues, I'm looking forward. Sorry for the off topic. Am Do., 10. Okt. 2019 um 08:35 Uhr schrieb Peter Cheung < mcheun...@hotmail.com>: > Dear Tim > You are a great people and full of passion. In my home town (Hong > Kong), people just "use" open source, not contributing it. > Thanks > From Peter > > From: Tim Boudreau > Sent: Wednesday, October 9, 2019 1:42 PM > To: dev@netbeans.apache.org > Subject: Re: Can anyone give me a help about developing antlr formatter > > Okay. If you'd like to try some stuff, I could hook you up with some > modules. Antlr support - syntax highlighting, navigator panels, syntax > tree views, has been working for a while; formatting is pretty solid now. > I've spent the last week stabilizing the "live preview" functionality, > which actually generates NetBeans language support with syntax highlighting > for *the grammar you are currently editing* - so you can have a syntax > highlighted preview, and associate a file extension with that grammar and > open those files and interact with them with full IDE support that is > updated whenever you edit the grammar. > > Basically the PITA with developing Antlr grammars is when you break some > rule that worked, change a whole bunch of other stuff before you know you > broke it, and then have to figure out which thing you did caused the > problem. So being able to visually, and instantly, see if something is > broken seems like a basic thing that's needed to make grammar development > much less painful. > > Here's a screen shot: > https://timboudreau.com/files/screen/10-09-2019_01-39-44.png > > All that gets a bit complex: > > - User edits the grammar file > - Listener on the grammar file notices and tells highlighters of documents > in the language of that grammar to request a reparse > - They ask for a new parse from a parser which > - Is actually going to run code in an isolated classloader that loads > from an in-memory filesystem where the grammar and generated analyzer code > was compiled > - Notices that the grammar file - whose document is mapped into that > in-memory filesystem - has changed > - Initiates a new run of Antlr generating parser and lexer > - Compiles them into that memory filesystem > - Generates the source for a thing that will call that parser with > document contents, and retrieve the tokens, parse tree, etc. copied into > proxy objects so the classloader does not leak types > - Creates a new isolated classloader over the class output for all that > - Replaces that classloader in the proxy parser > - Passes the document text into that parser, extracts the proxied parse > tree and wraps that in a NetBeans Parser.Result > > The good news is all that can happen in < 100ms. It works, but I've been > chasing bugs in the choreography of that process to ensure the new parse > runs against the right version of the grammar - each layer of that will use > the previous result if nothing has changed but the input text, and it works > out to being a big chain of lists of weakly referenced susbscribers to > things that subscribe to other things (i.e. the parser subscribes to > replacement of the classloader environment; the highlighters subscribe to > changes on the parser). > > It requires a few hacks that will probably get turned into patches - > there's no way via API to get the cache for Source objects for the > in-language document to invalidate its cached parser results because *some > other document* changed, so that has to be done via reflection; and > similarly, there is no direct way to force a Language instance to be > discarded by its LanguageHierarchy, but if you don't, it will keep a cache > of token ids that will be completely wrong (particularly if the grammar is > unparseable and you get a lexer with a dummy set of token ids with one > token, flip back to a valid language, and back again, which is the normal > state of life in an IDE). > > But for basic doing-stuff-with-Antlr it's in decent shape, and it's all > factored into many separate modules, so perhaps I could get some out there. > > -Tim > > > > > > > > > > > > > On Wed, Oct 2, 2019 at 2:08 AM Peter Cheung wrote: > > > Dear Tim > >Sorry i am doing my own antlr plugin > > https://gitlab.com/mcheung63/netbeans-antlr to support my compiler > > development which using antlr. If you plugin can well format antlr, then > i > > can focus my compiler rather than antlr in netbeans. > > thanks > > Peter > > > > > > -- > http://timboudreau.com >
Re: Can anyone give me a help about developing antlr formatter
Peter, you are from Hong Kong?! What a coincidence that I will be there within a week. Despite all the issues, I'm looking forward. Sorry for the off topic. Am Do., 10. Okt. 2019 um 08:35 Uhr schrieb Peter Cheung < mcheun...@hotmail.com>: > Dear Tim > You are a great people and full of passion. In my home town (Hong > Kong), people just "use" open source, not contributing it. > Thanks > From Peter > > From: Tim Boudreau > Sent: Wednesday, October 9, 2019 1:42 PM > To: dev@netbeans.apache.org > Subject: Re: Can anyone give me a help about developing antlr formatter > > Okay. If you'd like to try some stuff, I could hook you up with some > modules. Antlr support - syntax highlighting, navigator panels, syntax > tree views, has been working for a while; formatting is pretty solid now. > I've spent the last week stabilizing the "live preview" functionality, > which actually generates NetBeans language support with syntax highlighting > for *the grammar you are currently editing* - so you can have a syntax > highlighted preview, and associate a file extension with that grammar and > open those files and interact with them with full IDE support that is > updated whenever you edit the grammar. > > Basically the PITA with developing Antlr grammars is when you break some > rule that worked, change a whole bunch of other stuff before you know you > broke it, and then have to figure out which thing you did caused the > problem. So being able to visually, and instantly, see if something is > broken seems like a basic thing that's needed to make grammar development > much less painful. > > Here's a screen shot: > https://timboudreau.com/files/screen/10-09-2019_01-39-44.png > > All that gets a bit complex: > > - User edits the grammar file > - Listener on the grammar file notices and tells highlighters of documents > in the language of that grammar to request a reparse > - They ask for a new parse from a parser which > - Is actually going to run code in an isolated classloader that loads > from an in-memory filesystem where the grammar and generated analyzer code > was compiled > - Notices that the grammar file - whose document is mapped into that > in-memory filesystem - has changed > - Initiates a new run of Antlr generating parser and lexer > - Compiles them into that memory filesystem > - Generates the source for a thing that will call that parser with > document contents, and retrieve the tokens, parse tree, etc. copied into > proxy objects so the classloader does not leak types > - Creates a new isolated classloader over the class output for all that > - Replaces that classloader in the proxy parser > - Passes the document text into that parser, extracts the proxied parse > tree and wraps that in a NetBeans Parser.Result > > The good news is all that can happen in < 100ms. It works, but I've been > chasing bugs in the choreography of that process to ensure the new parse > runs against the right version of the grammar - each layer of that will use > the previous result if nothing has changed but the input text, and it works > out to being a big chain of lists of weakly referenced susbscribers to > things that subscribe to other things (i.e. the parser subscribes to > replacement of the classloader environment; the highlighters subscribe to > changes on the parser). > > It requires a few hacks that will probably get turned into patches - > there's no way via API to get the cache for Source objects for the > in-language document to invalidate its cached parser results because *some > other document* changed, so that has to be done via reflection; and > similarly, there is no direct way to force a Language instance to be > discarded by its LanguageHierarchy, but if you don't, it will keep a cache > of token ids that will be completely wrong (particularly if the grammar is > unparseable and you get a lexer with a dummy set of token ids with one > token, flip back to a valid language, and back again, which is the normal > state of life in an IDE). > > But for basic doing-stuff-with-Antlr it's in decent shape, and it's all > factored into many separate modules, so perhaps I could get some out there. > > -Tim > > > > > > > > > > > > > On Wed, Oct 2, 2019 at 2:08 AM Peter Cheung wrote: > > > Dear Tim > >Sorry i am doing my own antlr plugin > > https://gitlab.com/mcheung63/netbeans-antlr to support my compiler > > development which using antlr. If you plugin can well format antlr, then > i > > can focus my compiler rather than antlr in netbeans. > > thanks > > Peter > > > > > > -- > http://timboudreau.com >
Re: Can anyone give me a help about developing antlr formatter
Dear Tim You are a great people and full of passion. In my home town (Hong Kong), people just "use" open source, not contributing it. Thanks >From Peter From: Tim Boudreau Sent: Wednesday, October 9, 2019 1:42 PM To: dev@netbeans.apache.org Subject: Re: Can anyone give me a help about developing antlr formatter Okay. If you'd like to try some stuff, I could hook you up with some modules. Antlr support - syntax highlighting, navigator panels, syntax tree views, has been working for a while; formatting is pretty solid now. I've spent the last week stabilizing the "live preview" functionality, which actually generates NetBeans language support with syntax highlighting for *the grammar you are currently editing* - so you can have a syntax highlighted preview, and associate a file extension with that grammar and open those files and interact with them with full IDE support that is updated whenever you edit the grammar. Basically the PITA with developing Antlr grammars is when you break some rule that worked, change a whole bunch of other stuff before you know you broke it, and then have to figure out which thing you did caused the problem. So being able to visually, and instantly, see if something is broken seems like a basic thing that's needed to make grammar development much less painful. Here's a screen shot: https://timboudreau.com/files/screen/10-09-2019_01-39-44.png All that gets a bit complex: - User edits the grammar file - Listener on the grammar file notices and tells highlighters of documents in the language of that grammar to request a reparse - They ask for a new parse from a parser which - Is actually going to run code in an isolated classloader that loads from an in-memory filesystem where the grammar and generated analyzer code was compiled - Notices that the grammar file - whose document is mapped into that in-memory filesystem - has changed - Initiates a new run of Antlr generating parser and lexer - Compiles them into that memory filesystem - Generates the source for a thing that will call that parser with document contents, and retrieve the tokens, parse tree, etc. copied into proxy objects so the classloader does not leak types - Creates a new isolated classloader over the class output for all that - Replaces that classloader in the proxy parser - Passes the document text into that parser, extracts the proxied parse tree and wraps that in a NetBeans Parser.Result The good news is all that can happen in < 100ms. It works, but I've been chasing bugs in the choreography of that process to ensure the new parse runs against the right version of the grammar - each layer of that will use the previous result if nothing has changed but the input text, and it works out to being a big chain of lists of weakly referenced susbscribers to things that subscribe to other things (i.e. the parser subscribes to replacement of the classloader environment; the highlighters subscribe to changes on the parser). It requires a few hacks that will probably get turned into patches - there's no way via API to get the cache for Source objects for the in-language document to invalidate its cached parser results because *some other document* changed, so that has to be done via reflection; and similarly, there is no direct way to force a Language instance to be discarded by its LanguageHierarchy, but if you don't, it will keep a cache of token ids that will be completely wrong (particularly if the grammar is unparseable and you get a lexer with a dummy set of token ids with one token, flip back to a valid language, and back again, which is the normal state of life in an IDE). But for basic doing-stuff-with-Antlr it's in decent shape, and it's all factored into many separate modules, so perhaps I could get some out there. -Tim On Wed, Oct 2, 2019 at 2:08 AM Peter Cheung wrote: > Dear Tim >Sorry i am doing my own antlr plugin > https://gitlab.com/mcheung63/netbeans-antlr to support my compiler > development which using antlr. If you plugin can well format antlr, then i > can focus my compiler rather than antlr in netbeans. > thanks > Peter > > -- http://timboudreau.com
Re: Can anyone give me a help about developing antlr formatter
Okay. If you'd like to try some stuff, I could hook you up with some modules. Antlr support - syntax highlighting, navigator panels, syntax tree views, has been working for a while; formatting is pretty solid now. I've spent the last week stabilizing the "live preview" functionality, which actually generates NetBeans language support with syntax highlighting for *the grammar you are currently editing* - so you can have a syntax highlighted preview, and associate a file extension with that grammar and open those files and interact with them with full IDE support that is updated whenever you edit the grammar. Basically the PITA with developing Antlr grammars is when you break some rule that worked, change a whole bunch of other stuff before you know you broke it, and then have to figure out which thing you did caused the problem. So being able to visually, and instantly, see if something is broken seems like a basic thing that's needed to make grammar development much less painful. Here's a screen shot: https://timboudreau.com/files/screen/10-09-2019_01-39-44.png All that gets a bit complex: - User edits the grammar file - Listener on the grammar file notices and tells highlighters of documents in the language of that grammar to request a reparse - They ask for a new parse from a parser which - Is actually going to run code in an isolated classloader that loads from an in-memory filesystem where the grammar and generated analyzer code was compiled - Notices that the grammar file - whose document is mapped into that in-memory filesystem - has changed - Initiates a new run of Antlr generating parser and lexer - Compiles them into that memory filesystem - Generates the source for a thing that will call that parser with document contents, and retrieve the tokens, parse tree, etc. copied into proxy objects so the classloader does not leak types - Creates a new isolated classloader over the class output for all that - Replaces that classloader in the proxy parser - Passes the document text into that parser, extracts the proxied parse tree and wraps that in a NetBeans Parser.Result The good news is all that can happen in < 100ms. It works, but I've been chasing bugs in the choreography of that process to ensure the new parse runs against the right version of the grammar - each layer of that will use the previous result if nothing has changed but the input text, and it works out to being a big chain of lists of weakly referenced susbscribers to things that subscribe to other things (i.e. the parser subscribes to replacement of the classloader environment; the highlighters subscribe to changes on the parser). It requires a few hacks that will probably get turned into patches - there's no way via API to get the cache for Source objects for the in-language document to invalidate its cached parser results because *some other document* changed, so that has to be done via reflection; and similarly, there is no direct way to force a Language instance to be discarded by its LanguageHierarchy, but if you don't, it will keep a cache of token ids that will be completely wrong (particularly if the grammar is unparseable and you get a lexer with a dummy set of token ids with one token, flip back to a valid language, and back again, which is the normal state of life in an IDE). But for basic doing-stuff-with-Antlr it's in decent shape, and it's all factored into many separate modules, so perhaps I could get some out there. -Tim On Wed, Oct 2, 2019 at 2:08 AM Peter Cheung wrote: > Dear Tim >Sorry i am doing my own antlr plugin > https://gitlab.com/mcheung63/netbeans-antlr to support my compiler > development which using antlr. If you plugin can well format antlr, then i > can focus my compiler rather than antlr in netbeans. > thanks > Peter > > -- http://timboudreau.com
Re: Can anyone give me a help about developing antlr formatter
Dear Tim Sorry i am doing my own antlr plugin https://gitlab.com/mcheung63/netbeans-antlr to support my compiler development which using antlr. If you plugin can well format antlr, then i can focus my compiler rather than antlr in netbeans. thanks Peter
Re: Can anyone give me a help about developing antlr formatter
FYI - due to your question, I decided to prioritize Antlr formatting, and it is working - along with a generic API for writing formatters for any file format based on Antlr grammars. I should have something up on my update center in the next week or two. -Tim On Tue, Oct 1, 2019 at 12:02 PM Peter Cheung wrote: > I finally found an example > https://github.com/iconmaster5326/SourceNetbeansPlugin/blob/cb739ae7d1017e4db88fe2e517bf3e8d816ca4e3/src/com/iconmaster/srcplugin/editor/SourceReformatFactory.java > > > Thanks > From Peter > > From: Peter Cheung > Sent: Tuesday, September 24, 2019 8:07 PM > To: dev@netbeans.apache.org > Subject: Re: Can anyone give me a help about developing antlr formatter > > Thank you Tim > > From: Tim Boudreau > Sent: Monday, September 23, 2019 9:05 PM > To: dev@netbeans.apache.org > Subject: Re: Can anyone give me a help about developing antlr formatter > > The work in progress is on the "mavenize" branch here - > https://github.com/timboudreau/ANTLR4-Plugins-for-NetBeans - It is 44 > modules (comprising generic support for generating most of a plugin for any > Antlr grammar from annotations, and then in antlr-editing-plugins, a suite > of modules for Antlr itself) :-) > > There *was* an Antlr formatter, but this project started with working on an > exiting Antlr plugin I forked, evolved into generic Antlr support, and I'm > now in the process of reassembling the original Antlr-editing-only module > to eat my own dogfood, as a set of modules with all the features of the > original, plus lots more (like live-syntax highlighting of files in the > language of the grammar you're editing, which get updated when you edit the > grammar, visual syntax trees and more - one of the biggest PITA's of Antlr > development is writing a rule that overrides another rule and not knowing > it until long after you broke it and then trying to figure out *what* broke > it, so instant feedback as you edit a grammar is a necessity). > > I haven't add formatting back in yet, though. But I'll keep you posted. > > -Tim > > On Fri, Sep 20, 2019 at 1:17 AM Peter Cheung > wrote: > > > Dear Tim > >Yes, i want to format antlr lang. > > Thanks > > From Peter > > ____ > > From: Tim Boudreau > > Sent: Monday, September 16, 2019 7:48 AM > > To: dev@netbeans.apache.org > > Subject: Re: Can anyone give me a help about developing antlr formatter > > > > I have some stuff under development that might be useful for that. You > want > > to format a language that has an Antlr grammar, right? > > > > -Tim > > > > On Sun, Sep 15, 2019 at 11:43 AM Peter Cheung > > wrote: > > > > > Hi All > > > Can anyone give me a help about developing antlr formatter? Where > i > > > can get an example to develop a custom formatter? > > > Thanks > > > From Peter > > > > > M > > -- > > http://timboudreau.com > > > > > -- > http://timboudreau.com > -- http://timboudreau.com
Re: Can anyone give me a help about developing antlr formatter
I finally found an example https://github.com/iconmaster5326/SourceNetbeansPlugin/blob/cb739ae7d1017e4db88fe2e517bf3e8d816ca4e3/src/com/iconmaster/srcplugin/editor/SourceReformatFactory.java Thanks >From Peter From: Peter Cheung Sent: Tuesday, September 24, 2019 8:07 PM To: dev@netbeans.apache.org Subject: Re: Can anyone give me a help about developing antlr formatter Thank you Tim From: Tim Boudreau Sent: Monday, September 23, 2019 9:05 PM To: dev@netbeans.apache.org Subject: Re: Can anyone give me a help about developing antlr formatter The work in progress is on the "mavenize" branch here - https://github.com/timboudreau/ANTLR4-Plugins-for-NetBeans - It is 44 modules (comprising generic support for generating most of a plugin for any Antlr grammar from annotations, and then in antlr-editing-plugins, a suite of modules for Antlr itself) :-) There *was* an Antlr formatter, but this project started with working on an exiting Antlr plugin I forked, evolved into generic Antlr support, and I'm now in the process of reassembling the original Antlr-editing-only module to eat my own dogfood, as a set of modules with all the features of the original, plus lots more (like live-syntax highlighting of files in the language of the grammar you're editing, which get updated when you edit the grammar, visual syntax trees and more - one of the biggest PITA's of Antlr development is writing a rule that overrides another rule and not knowing it until long after you broke it and then trying to figure out *what* broke it, so instant feedback as you edit a grammar is a necessity). I haven't add formatting back in yet, though. But I'll keep you posted. -Tim On Fri, Sep 20, 2019 at 1:17 AM Peter Cheung wrote: > Dear Tim >Yes, i want to format antlr lang. > Thanks > From Peter > > From: Tim Boudreau > Sent: Monday, September 16, 2019 7:48 AM > To: dev@netbeans.apache.org > Subject: Re: Can anyone give me a help about developing antlr formatter > > I have some stuff under development that might be useful for that. You want > to format a language that has an Antlr grammar, right? > > -Tim > > On Sun, Sep 15, 2019 at 11:43 AM Peter Cheung > wrote: > > > Hi All > > Can anyone give me a help about developing antlr formatter? Where i > > can get an example to develop a custom formatter? > > Thanks > > From Peter > > > M > -- > http://timboudreau.com > -- http://timboudreau.com
Re: Can anyone give me a help about developing antlr formatter
Thank you Tim From: Tim Boudreau Sent: Monday, September 23, 2019 9:05 PM To: dev@netbeans.apache.org Subject: Re: Can anyone give me a help about developing antlr formatter The work in progress is on the "mavenize" branch here - https://github.com/timboudreau/ANTLR4-Plugins-for-NetBeans - It is 44 modules (comprising generic support for generating most of a plugin for any Antlr grammar from annotations, and then in antlr-editing-plugins, a suite of modules for Antlr itself) :-) There *was* an Antlr formatter, but this project started with working on an exiting Antlr plugin I forked, evolved into generic Antlr support, and I'm now in the process of reassembling the original Antlr-editing-only module to eat my own dogfood, as a set of modules with all the features of the original, plus lots more (like live-syntax highlighting of files in the language of the grammar you're editing, which get updated when you edit the grammar, visual syntax trees and more - one of the biggest PITA's of Antlr development is writing a rule that overrides another rule and not knowing it until long after you broke it and then trying to figure out *what* broke it, so instant feedback as you edit a grammar is a necessity). I haven't add formatting back in yet, though. But I'll keep you posted. -Tim On Fri, Sep 20, 2019 at 1:17 AM Peter Cheung wrote: > Dear Tim >Yes, i want to format antlr lang. > Thanks > From Peter > > From: Tim Boudreau > Sent: Monday, September 16, 2019 7:48 AM > To: dev@netbeans.apache.org > Subject: Re: Can anyone give me a help about developing antlr formatter > > I have some stuff under development that might be useful for that. You want > to format a language that has an Antlr grammar, right? > > -Tim > > On Sun, Sep 15, 2019 at 11:43 AM Peter Cheung > wrote: > > > Hi All > > Can anyone give me a help about developing antlr formatter? Where i > > can get an example to develop a custom formatter? > > Thanks > > From Peter > > > M > -- > http://timboudreau.com > -- http://timboudreau.com
Re: Can anyone give me a help about developing antlr formatter
The work in progress is on the "mavenize" branch here - https://github.com/timboudreau/ANTLR4-Plugins-for-NetBeans - It is 44 modules (comprising generic support for generating most of a plugin for any Antlr grammar from annotations, and then in antlr-editing-plugins, a suite of modules for Antlr itself) :-) There *was* an Antlr formatter, but this project started with working on an exiting Antlr plugin I forked, evolved into generic Antlr support, and I'm now in the process of reassembling the original Antlr-editing-only module to eat my own dogfood, as a set of modules with all the features of the original, plus lots more (like live-syntax highlighting of files in the language of the grammar you're editing, which get updated when you edit the grammar, visual syntax trees and more - one of the biggest PITA's of Antlr development is writing a rule that overrides another rule and not knowing it until long after you broke it and then trying to figure out *what* broke it, so instant feedback as you edit a grammar is a necessity). I haven't add formatting back in yet, though. But I'll keep you posted. -Tim On Fri, Sep 20, 2019 at 1:17 AM Peter Cheung wrote: > Dear Tim >Yes, i want to format antlr lang. > Thanks > From Peter > > From: Tim Boudreau > Sent: Monday, September 16, 2019 7:48 AM > To: dev@netbeans.apache.org > Subject: Re: Can anyone give me a help about developing antlr formatter > > I have some stuff under development that might be useful for that. You want > to format a language that has an Antlr grammar, right? > > -Tim > > On Sun, Sep 15, 2019 at 11:43 AM Peter Cheung > wrote: > > > Hi All > > Can anyone give me a help about developing antlr formatter? Where i > > can get an example to develop a custom formatter? > > Thanks > > From Peter > > > M > -- > http://timboudreau.com > -- http://timboudreau.com
Re: Can anyone give me a help about developing antlr formatter
Thanks everybody for the suggestions. @Mario Schroeder i will start from your plugin project as it seems a small focused example of how to add a new language editor to NetBeans. @Eric Bresie the plugin you mention is to develop ANTLR grammars and it will be certainly useful but it is not aimed to automatically generate the NetBeans Lexer and Parser plumbing. @Siddesh Rane the C++ module would be no doubt a thorough example of adding a new language editor to NetBeans but I am afraid I would get lost in its big sources. Regards, Alex Il giorno lun 23 set 2019 alle ore 09:44 Siddhesh Rane < siddheshr...@disroot.org> ha scritto: > The C++ module uses ANTLR for parsing and also provides formatting > support. That might be useful > > Regards > Siddhesh Rane > > September 23, 2019 4:08 AM, "Eric Bresie" wrote: > > > Also noticed there is a Netbeans plugin list on the Tools section of the > ANTLR.org site. > > > > https://www.antlr.org/tools.html > > > > Eric Bresie > > ebre...@gmail.com > > > >> On September 20, 2019 at 4:26:51 AM CDT, Mario Schroeder < > ma.schroe...@gmail.com> wrote: > >> Hi, > >> > >> maybe this one can help you as well: > >> https://github.com/mario-s/nb-hyperledger > >> It uses a ANTLR Grammar to generate Lexer and Parser. > >> > >> A lot of ANTLR samples can be found in this repository: > >> https://github.com/antlr/grammars-v4 > >> > >> Greetings, > >> Mario > >> > >> Am Fr., 20. Sept. 2019 um 10:29 Uhr schrieb Alessandro < > >> alex.fala...@gmail.com>: > >> > >> Hi Tim, > >> I am interested too. > >> > >> I have a plugin with an editor using a JFlex based lexer and a Parboiled > >> based parser and I would like to move to a unified solution with an > ANTLR > >> based lexer and parser. > >> > >> It would be wonderful if you could share something. > >> > >> Greets, > >> Alex > >> > >> Il giorno lun 16 set 2019 alle ore 01:48 Tim Boudreau < > niftin...@gmail.com > >>> > >> ha scritto: > >> > >>> I have some stuff under development that might be useful for that. You > >> want > >>> to format a language that has an Antlr grammar, right? > >>> > >>> -Tim > >>> > >>> On Sun, Sep 15, 2019 at 11:43 AM Peter Cheung > >>> wrote: > >>> > Hi All > Can anyone give me a help about developing antlr formatter? Where > >> i > can get an example to develop a custom formatter? > Thanks > From Peter > > >>> M > >>> -- > >>> http://timboudreau.com > >>> > > - > To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org > For additional commands, e-mail: dev-h...@netbeans.apache.org > > For further information about the NetBeans mailing lists, visit: > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists > > > >
Re: Can anyone give me a help about developing antlr formatter
The C++ module uses ANTLR for parsing and also provides formatting support. That might be useful Regards Siddhesh Rane September 23, 2019 4:08 AM, "Eric Bresie" wrote: > Also noticed there is a Netbeans plugin list on the Tools section of the > ANTLR.org site. > > https://www.antlr.org/tools.html > > Eric Bresie > ebre...@gmail.com > >> On September 20, 2019 at 4:26:51 AM CDT, Mario Schroeder >> wrote: >> Hi, >> >> maybe this one can help you as well: >> https://github.com/mario-s/nb-hyperledger >> It uses a ANTLR Grammar to generate Lexer and Parser. >> >> A lot of ANTLR samples can be found in this repository: >> https://github.com/antlr/grammars-v4 >> >> Greetings, >> Mario >> >> Am Fr., 20. Sept. 2019 um 10:29 Uhr schrieb Alessandro < >> alex.fala...@gmail.com>: >> >> Hi Tim, >> I am interested too. >> >> I have a plugin with an editor using a JFlex based lexer and a Parboiled >> based parser and I would like to move to a unified solution with an ANTLR >> based lexer and parser. >> >> It would be wonderful if you could share something. >> >> Greets, >> Alex >> >> Il giorno lun 16 set 2019 alle ore 01:48 Tim Boudreau >> >> ha scritto: >> >>> I have some stuff under development that might be useful for that. You >> want >>> to format a language that has an Antlr grammar, right? >>> >>> -Tim >>> >>> On Sun, Sep 15, 2019 at 11:43 AM Peter Cheung >>> wrote: >>> Hi All Can anyone give me a help about developing antlr formatter? Where >> i can get an example to develop a custom formatter? Thanks From Peter >>> M >>> -- >>> http://timboudreau.com >>> - To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org For additional commands, e-mail: dev-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: Re: Can anyone give me a help about developing antlr formatter
Also noticed there is a Netbeans plugin list on the Tools section of the ANTLR.org site. https://www.antlr.org/tools.html Eric Bresie ebre...@gmail.com > On September 20, 2019 at 4:26:51 AM CDT, Mario Schroeder > wrote: > Hi, > > maybe this one can help you as well: > https://github.com/mario-s/nb-hyperledger > It uses a ANTLR Grammar to generate Lexer and Parser. > > A lot of ANTLR samples can be found in this repository: > https://github.com/antlr/grammars-v4 > > Greetings, > Mario > > Am Fr., 20. Sept. 2019 um 10:29 Uhr schrieb Alessandro < > alex.fala...@gmail.com>: > > > Hi Tim, > > I am interested too. > > > > I have a plugin with an editor using a JFlex based lexer and a Parboiled > > based parser and I would like to move to a unified solution with an ANTLR > > based lexer and parser. > > > > It would be wonderful if you could share something. > > > > Greets, > > Alex > > > > > > Il giorno lun 16 set 2019 alle ore 01:48 Tim Boudreau > > > > ha scritto: > > > > > I have some stuff under development that might be useful for that. You > > want > > > to format a language that has an Antlr grammar, right? > > > > > > -Tim > > > > > > On Sun, Sep 15, 2019 at 11:43 AM Peter Cheung > > > wrote: > > > > > > > Hi All > > > > Can anyone give me a help about developing antlr formatter? Where > > i > > > > can get an example to develop a custom formatter? > > > > Thanks > > > > From Peter > > > > > > > M > > > -- > > > http://timboudreau.com > > > > >
Re: Can anyone give me a help about developing antlr formatter
Hi, maybe this one can help you as well: https://github.com/mario-s/nb-hyperledger It uses a ANTLR Grammar to generate Lexer and Parser. A lot of ANTLR samples can be found in this repository: https://github.com/antlr/grammars-v4 Greetings, Mario Am Fr., 20. Sept. 2019 um 10:29 Uhr schrieb Alessandro < alex.fala...@gmail.com>: > Hi Tim, > I am interested too. > > I have a plugin with an editor using a JFlex based lexer and a Parboiled > based parser and I would like to move to a unified solution with an ANTLR > based lexer and parser. > > It would be wonderful if you could share something. > > Greets, > Alex > > > Il giorno lun 16 set 2019 alle ore 01:48 Tim Boudreau > > ha scritto: > > > I have some stuff under development that might be useful for that. You > want > > to format a language that has an Antlr grammar, right? > > > > -Tim > > > > On Sun, Sep 15, 2019 at 11:43 AM Peter Cheung > > wrote: > > > > > Hi All > > > Can anyone give me a help about developing antlr formatter? Where > i > > > can get an example to develop a custom formatter? > > > Thanks > > > From Peter > > > > > M > > -- > > http://timboudreau.com > > >
Re: Can anyone give me a help about developing antlr formatter
Hi Tim, I am interested too. I have a plugin with an editor using a JFlex based lexer and a Parboiled based parser and I would like to move to a unified solution with an ANTLR based lexer and parser. It would be wonderful if you could share something. Greets, Alex Il giorno lun 16 set 2019 alle ore 01:48 Tim Boudreau ha scritto: > I have some stuff under development that might be useful for that. You want > to format a language that has an Antlr grammar, right? > > -Tim > > On Sun, Sep 15, 2019 at 11:43 AM Peter Cheung > wrote: > > > Hi All > > Can anyone give me a help about developing antlr formatter? Where i > > can get an example to develop a custom formatter? > > Thanks > > From Peter > > > M > -- > http://timboudreau.com >
Re: Can anyone give me a help about developing antlr formatter
Dear Tim Yes, i want to format antlr lang. Thanks >From Peter From: Tim Boudreau Sent: Monday, September 16, 2019 7:48 AM To: dev@netbeans.apache.org Subject: Re: Can anyone give me a help about developing antlr formatter I have some stuff under development that might be useful for that. You want to format a language that has an Antlr grammar, right? -Tim On Sun, Sep 15, 2019 at 11:43 AM Peter Cheung wrote: > Hi All > Can anyone give me a help about developing antlr formatter? Where i > can get an example to develop a custom formatter? > Thanks > From Peter > M -- http://timboudreau.com
Re: Can anyone give me a help about developing antlr formatter
I have some stuff under development that might be useful for that. You want to format a language that has an Antlr grammar, right? -Tim On Sun, Sep 15, 2019 at 11:43 AM Peter Cheung wrote: > Hi All > Can anyone give me a help about developing antlr formatter? Where i > can get an example to develop a custom formatter? > Thanks > From Peter > M -- http://timboudreau.com