Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] changes in grammar

Thanks a lot, Mike. I was under such a strong (and wrong) impression that syntax highlighting also needs the parser that thought that I'm not explaining myself properly :-).
 
Can I ask another question: what is the best way to build only the org.eclipse.cdt.core.parser.upc.jar? I'm not sure that I'm in the right direction.
 
I took the results\plugins\org.eclipse.cdt.core.parser.upc  build.xml that was generated by the overall CDT build (where results is the build directory created during the CDT build process) and run the @dot target and got:
 
@dot:
   [delete] Deleting directory c:\cdt-ws\org.eclipse.cdt\all\org.eclipse.cdt.releng\results\plugins\org.eclipse.cdt.core.parser.upc\@dot
    [mkdir] Created dir: c:\cdt-ws\org.eclipse.cdt\all\org.eclipse.cdt.releng\results\plugins\org.eclipse.cdt.core.parser.upc\@dot
    [javac] Compiling 43 source files to c:\cdt-ws\org.eclipse.cdt\all\org.eclipse.cdt.releng\results\plugins\org.eclipse.cdt.core.parser.upc\@dot
    [javac] c:\cdt-ws\org.eclipse.cdt\all\org.eclipse.cdt.releng\results\plugins\org.eclipse.cdt.core.parser.upc\src\org\eclipse\cdt\core\dom\upc\ast\IUPCASTSimpleDeclSpecifier.java:15: types org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier and org.eclipse.cdt.core.dom.upc.ast.IUPCASTDeclSpecifier are incompatible; both define copy(), but with unrelated return types
    [javac] public interface IUPCASTSimpleDeclSpecifier extends IUPCASTDeclSpecifier,
    [javac]        ^
 
thanks in advance,
David
 
 
 

 
On Tue, Jul 14, 2009 at 10:41 PM, Mike Kucera <mkucera@xxxxxxxxxx> wrote:

I guess you don't believe me but I'm telling the truth :) changing the editor keyword highlighting is done via ICLanguageKeywords.

The editor syntax highlighting is based on regular expressions and does not depend on the parser. So adding or removing the keywords from the parser is not going to affect the editor highlighting. The CDT editor calls getAdapter() on the ILanguage to get an instance of ICLanguageKeywords, it then calls getKeywords() to get a list of keywords to highlight. If you don't want certain keywords to be highlighted you must change the implementation of the getKeywords() method in the CLangaugeKeywords class, or provide your own implementation of ICLanguageKeywords.



Mike Kucera
Software Developer
IBM Eclipse CDT Team
mkucera@xxxxxxxxxx

Inactive hide details for David Sariel ---07/14/2009 04:18:03 AM---
David Sariel ---07/14/2009 04:18:03 AM---


From:

David Sariel <datosar@xxxxxxxxx>

To:

"CDT General developers list." <cdt-dev@xxxxxxxxxxx>

Date:

07/14/2009 04:18 AM

Subject:

Re: [cdt-dev] changes in grammar




 
 
Thanks Mike,
Seems that I have lousily defined my question.
Following is all I have done:
      1)      Removed keywords to the c99 grammar in org.eclipse.cdt\lrparser\org.eclipse.cdt.core.lrparser\grammar\c99\C99Grammar.g
      2)      Generated parser (org.eclipse.cdt\lrparser\org.eclipse.cdt.core.lrparser\src\org\eclipse\cdt\internal\core\dom\lrparser\c99\*.java)
      3)      Commented the cases corresponding to removed keywords in org.eclipse.cdt\lrparser\org.eclipse.cdt.core.lrparser\src\org\eclipse\cdt\core\dom\lrparser\c99\DOMToC99TokenMap.java
      4)      Also changed the org.eclipse.cdt\lrparser\org.eclipse.cdt.core.lrparser\src\org\eclipse\cdt\core\dom\lrparser\action\c99\C99BuildASTParserAction.java
      5)      Rebuilt the CDT.
 
Since during the build process (org.eclipse.cdt\all\org.eclipse.cdt.releng\build.sh) CDT sources are checked out from the CVS and copied to org.eclipse.cdt\all\org.eclipse.cdt.releng\results\plugin for compilation, jarUpping, etc, I have done the following in order to be sure to compile the new grammar :
      1)      Checked out the sources once
      2)      Commented the fetch target in org.eclipse.cdt\all\org.eclipse.cdt.releng\tools\org.eclipse.releng.basebuilder\plugins\org.eclipse.pde.build_3.5.0.v20090521-1730\scripts\build.xml .
      3)      Copied the newly generated parser to the org.eclipse.cdt\all\org.eclipse.cdt.releng\results\plugins\org.eclipse.cdt.core.lrparser\src\org\eclipse\cdt\internal\core\dom\lrparser\c99
      4)      Copied updated DOMToC99TokenMap.java to  org.eclipse.cdt\all\org.eclipse.cdt.releng\results\plugins\org.eclipse.cdt.core.lrparser\src\org\eclipse\cdt\core\dom\lrparser\c99\DOMToC99TokenMap.java
      5)      Also copied the updated C99BuildASTParserAction.java to the org.eclipse.cdt\all\org.eclipse.cdt.releng\results\plugins\org.eclipse.cdt.core.lrparser\src\org\eclipse\cdt\core\dom\lrparser\action\c99
      6)      and rebuild once again.
 
In comile.log I have seen that the updated files were indeed compiled.
 
Since I have only changed the c99 grammar in lrparser, I think have no need to provide a new implementation of ICLanguageKeywords or to override the getKeywords() method (neither to extend BaseExtensibleLanguage or override the getAdapter() method).
 
After these changes I thought that old keywords will not be highlighted anymore. But despite all above they are still highlighted. What's wrong in what I'm doing?
 
 
I know that this is no a correct way of doing thing, but first I wanted to change the grammar to "prove the concept" of the new grammar in the fastest way possible. Of course that in the next stage I will make something in the manner that done with upc.
 
And the second question is: is there an easy way to build only the lrparser feature (getting only org.eclipse.cdt.core.lrparser_ver.timestamp.jar at the end) without the rebuild of the whole CDT?
 
Thanks,
David

 
On Wed, Jul 8, 2009 at 6:41 PM, Mike Kucera<mkucera@xxxxxxxxxx> wrote:
> You still need to inform the editor syntax highlighting of which identifiers
> to treat as keywords, this is separate from how the parser recognizes
> keywords.
>
> To make this work you need to provide an implementation of
> ICLanguageKeywords. The easiest way to do this is to extend the
> CLanguageKeywords class and override the getKeywords() method. You will also
> need to extend BaseExtensibleLanguage and override the getAdapter() method
> to return your implementation of ICLanguageKeywords.
>
>
> Mike Kucera
> Software Developer
> IBM Eclipse CDT Team
> mkucera@xxxxxxxxxx
>
> David Sariel ---07/08/2009 11:27:03 AM---Hello,
>
>
> From:
> David Sariel <datosar@xxxxxxxxx>
> To:
> cdt-dev@xxxxxxxxxxx
> Date:
> 07/08/2009 11:27 AM
> Subject:
> [cdt-dev] changes in grammar
>
> ________________________________
>
>
> Hello,
> I have checked out the org.eclipse.cdt from CVS and:
> 1) Added several keyword  and added several new ones to the C99
> grammar (in
> I:\cdt-org.eclipse.cdt\lrparser\org.eclipse.cdt.core.lrparser\grammar)
> 2) Generated new parser
> 3) Rebuilt the CDT with the new parser
>
> While rebuilding I found that the build process compiles the files
> that are located in
> org.eclipse.cdt\all\org.eclipse.cdt.releng\Copy of results\plugins and
> I made sure that
> newly generated parser files were compiled (according to the compile.log) .
> But, while running the rebuilt IDE, the keyword that were supposed to
> be gone are still
> Highlighted by the IDE and newly added keywords are not highlighted at all.
>
> Any thoughts will be appreciated,
> David
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>
>
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>
>
 
 _______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


GIF image

GIF image


Back to the top