Hi Michael,

Shell support must be in the cnd.script package. If you only want syntax 
colouring, you could search for a bash TextMate grammar file and add it to the 
newer versions of the IDE

Siddhesh

Get Outlook for Android<https://aka.ms/ghei36>

________________________________
From: Michael Bien <[email protected]>
Sent: Sunday, April 18, 2021 3:02:35 PM
To: [email protected] <[email protected]>
Subject: Re: [DISCUSS] CND Next Steps

Hello,

if i remember correctly, basic support for .sh files (keyword and
comment highlighting, no auto completion) was somewhere hidden in the
cnd cluster too. (I tried to find it but no success).  I am wondering if
this could be moved out of the cnd cluster to the base IDE - assuming
that it still exists, before the major problems are solved.

best regards,
michael


On 18.04.21 20:13, antonio wrote:
> Hi Siddhesh,
>
> Thanks for these insights! :-)
>
> Some more to add to the list:
>
> - The module libs.antlr.cnd is the donated version of cnd.antlr in
> NetBeans 8.2, which was a fork of antlr2. antlr2 is a problem from a
> licensing point of view, as Terence Parr (antlr's main author) states
> at [1], and we should be using antlr 3.4 and onwards. The fork
> contained some interesting hacks, gone with the wind now.
>
> - cnd.apt has a _lexer_ for C/C++/Fortran, and a _grammar_ for the C
> preprocessor. This makes it possible for CND to understand #defines
> and #ifdef #ifndef. These are the *.g files at [2], written in antlr2.
> I'm currently trying to migrate them to antlr3. Looks promising.
>
> - cnd.apt compiles these grammar files and then generates an
> APTTokenTypes.txt file [3] and its Java counterpart.
>
> - cnd.modelimpl uses this file (at compile time) as the _lexer_ for
> the CXXParser.g3 grammar [4].
>
> - clang seems indeed the way to go, but may need some research. It
> seems clang has a stable C API that we could use, called "libclang".
> Some people say libclang falls short in AST, and have created some
> Apache licenses libraries for enhancing the AST. These are now being
> used in the Embarcadero IDE for C/C++ [5]
>
>
> For the time being I think I'll continue porting antlr2 to antlr3
> grammars for cnd.apt (possibly recovering cnd.antlr with antlr3), and
> then try to use them elsewhere. Will report in a few days.
>
> All research about clang alternatives is indeed welcome.
>
> Thanks Siddhesh!
>
> Kind regards,
> Antonio
>
>
>
> [1]
> "Because the v2 license was unclean, projects such eclipse could not
> include ANTLR v3. This version, 3.4, is completely BSD clean and all
> additions were subject to the click wrap license or the ANTLR
> contributor's certificate of origin."
>
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftheantlrguy.atlassian.net%2Fwiki%2Fspaces%2FANTLR3%2Fpages%2F2687376%2FANTLR%2B3.4%2BRelease%2BNotes&amp;data=04%7C01%7Crane.si%40northeastern.edu%7Cd36c8d0f6cb040697c9708d9029d2d83%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C637543696362258747%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=1RUiL5xDIsWmg8h2m4qsKlDsZSCQNLspAnPLUFocKyc%3D&amp;reserved=0
>
>
> [2]
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fnetbeans%2Ftree%2Fcnd%2Fcnd%2Fcnd.apt%2Fsrc%2Forg%2Fnetbeans%2Fmodules%2Fcnd%2Fapt%2Fimpl%2Fsupport&amp;data=04%7C01%7Crane.si%40northeastern.edu%7Cd36c8d0f6cb040697c9708d9029d2d83%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C637543696362258747%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=8242nXcPNczYNHsjV7XDIZDWSE%2Fx9GeZZZSUs49lID8%3D&amp;reserved=0
>
>
> [3]
> cnd.apt generating APTTokenTypes.txt at build time.
>
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fnetbeans%2Fblob%2Ff9b7c264647c39127e82b756dcdbb9752323d2ad%2Fcnd%2Fcnd.apt%2Fbuild.xml%23L71&amp;data=04%7C01%7Crane.si%40northeastern.edu%7Cd36c8d0f6cb040697c9708d9029d2d83%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C637543696362258747%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=ppaWxpCvhdpyYcqAF49Nl4dTOJ7mwJRVZtAcXjFDZsg%3D&amp;reserved=0
>
>
>
> [4]
> cnd.modelimpl's CXXParser.g using cnd.apt's APTTokenTypes at build time.
>
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fnetbeans%2Fblob%2Ff9b7c264647c39127e82b756dcdbb9752323d2ad%2Fcnd%2Fcnd.modelimpl%2Fsrc%2Forg%2Fnetbeans%2Fmodules%2Fcnd%2Fmodelimpl%2Fparser%2FCXXParser.g%23L28&amp;data=04%7C01%7Crane.si%40northeastern.edu%7Cd36c8d0f6cb040697c9708d9029d2d83%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C637543696362258747%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=YzAyXFRkI6V8y%2F1asfkNM9VOToBxpmTfKGauS%2FyAbR4%3D&amp;reserved=0
>
>
> [5]
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Ffoonathan.net%2F2017%2F04%2Fcppast%2F&amp;data=04%7C01%7Crane.si%40northeastern.edu%7Cd36c8d0f6cb040697c9708d9029d2d83%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C637543696362258747%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=H9yZts4q%2B32mL3QLrpWpIgR29%2BZbrA7NRzkmUpjPWLE%3D&amp;reserved=0
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffoonathan%2Fcppast&amp;data=04%7C01%7Crane.si%40northeastern.edu%7Cd36c8d0f6cb040697c9708d9029d2d83%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C637543696362268738%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=xoV2PJ56ZCsP3gKfTHvZ15a5Y6JYaX7D4IM%2B0imesA8%3D&amp;reserved=0
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.embarcadero.com%2Fde%2Fproducts%2Fcbuilder%2Fstarter&amp;data=04%7C01%7Crane.si%40northeastern.edu%7Cd36c8d0f6cb040697c9708d9029d2d83%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C637543696362268738%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=9kIMUU94npw%2FHr8dR7q8%2B%2FGy3E4%2B9GxinA1ugfpy5%2Fc%3D&amp;reserved=0
>
> On 18/04/2021 2:03, Siddhesh Rane wrote:
>> I did some dependecy analysis on the cnd modules and here is what I
>> found.
>>
>> * The current Antlr based parsers and their generated ASTs are not
>> directly used by any module in cnd (such as Code Completion,
>> Navigator etc). Instead all modules depend on an AST-like code model
>> specified in C/C++ Code Model API (cnd.api.model)
>>
>> * The Code Model API has an implementation in cnd.modelimpl which
>> contains the parsers and antlr grammar files. Internally, this module
>> converts the parser's generated AST into the Code Model API.
>>
>> * There is clean code seperation between code model impl and api;
>> Only API module is used in rest of the cnd modules without knowledge
>> of the implementation details (cnd.modelimpl is only used for test
>> cases; cnd.modelui had dependency but it appears in some package
>> related to tracing so I assume its debug).
>>
>> * The other module containing an Antlr file, Abstract Preprocessor
>> Tree (cnd.apt) is only a dependency for cnd.modelimpl.
>> cnd.completion has it listed as a dependency but no java file imports
>> anything from that module. cnd.modelui again uses it only in a trace
>> package. So cnd.apt is related only to model implementation.
>>
>> * There are some modules with name "clank" in them. These can be
>> completely removed because by default they are disabled using system
>> flags. It seems to be an experimental clang integration that was
>> never used.
>>
>> Based on these observations, I think we can safely get rid of all
>> Antlr files by targeting the Code Model Implementation module.
>> My suggested plan of action would be:
>>
>> 1. Introduce a clang based parser alongside the existing parsers.
>> Look at class
>> org.netbeans.modules.cnd.modelimpl.parser.ParserProviderImpl. This
>> currently contains two C++ parsers: Antlr2CppParser and
>> Antlr3CXXParser, with the antlr 2 being used by default. The parsers
>> have a parse method which does parsing into custom AST and a render
>> method where custom AST is used to create Code Model API objects. The
>> render method is where we will need mapping between clang AST to code
>> model api. ( I am trying to find good tutorials about clang AST)
>>
>> 2. Once we test the clang parser, we can focus on cnd.apt. This
>> package does have some clang translation support with stuff such as
>> compilation db, so eventually it can be completely removed if
>> successfully transitioned.
>>
>> 3. Finally a lot of code can be simplified. Particularly, the
>> indexing is happening at the same time as parsing. This needs to be
>> moved over to the Indexing API like it is done for java.
>>
>> I hope that with this approach we can keep up with latest C++
>> language releases while not having to sacrifice any of the
>> functionality in the cnd module.
>>
>> Siddhesh
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>> For further information about the NetBeans mailing lists, visit:
>> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcwiki.apache.org%2Fconfluence%2Fdisplay%2FNETBEANS%2FMailing%2Blists&amp;data=04%7C01%7Crane.si%40northeastern.edu%7Cd36c8d0f6cb040697c9708d9029d2d83%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C637543696362268738%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=rfCOrEG%2BT54XnV9na1Meib3KFfNvcGJ7W5LSHqLjhwQ%3D&amp;reserved=0
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
> For further information about the NetBeans mailing lists, visit:
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcwiki.apache.org%2Fconfluence%2Fdisplay%2FNETBEANS%2FMailing%2Blists&amp;data=04%7C01%7Crane.si%40northeastern.edu%7Cd36c8d0f6cb040697c9708d9029d2d83%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C637543696362268738%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=rfCOrEG%2BT54XnV9na1Meib3KFfNvcGJ7W5LSHqLjhwQ%3D&amp;reserved=0
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcwiki.apache.org%2Fconfluence%2Fdisplay%2FNETBEANS%2FMailing%2Blists&amp;data=04%7C01%7Crane.si%40northeastern.edu%7Cd36c8d0f6cb040697c9708d9029d2d83%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C637543696362268738%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=rfCOrEG%2BT54XnV9na1Meib3KFfNvcGJ7W5LSHqLjhwQ%3D&amp;reserved=0



Reply via email to