Ignoring multiline assembler blocks [message #645047] |
Wed, 15 December 2010 11:22 |
A Hoyle Messages: 22 Registered: November 2010 |
Junior Member |
|
|
Hi All
I would like to be able to use multi-line in-line assembler blocks of code without the parser highlighting lots of syntax errors.
I have successfully extended org.eclipse.cdt.core.language extensions point with a new lanugage class. I have written a class that extends GNUScannerExtensionConfiguration which adds some keywords and macros which successfully prevent syntax error for most of my additional keywords.
The problem I am having is with multi-line in-line assembler blocks. My compiler accepts __asm and __endasm as start and stop marks for in-line assembler blocks. I have tried defining them at GNU in-line assemble commands, but that only works for single line blocks.
addMacro("__asm", " asm( ");
addMacro("__endasm", ")");
I have tried to comment them out using;
addMacro("__asm", " /* ");
addMacro("__endasm", " */ ");
but that didn't work.
I have tried to mark it as inactive code by
addMacro("__asm", "/n#if 0 ");
addMacro("__endasm", "/n#endif ");
and
addKeyword("__asm".toCharArray(), IToken.tINACTIVE_CODE_START);
addKeyword("__endasm".toCharArray(), IToken.tINACTIVE_CODE_START);
but this cause the follow exception apparently when it gets to the "__endasm" token.
Has anyone successfully modified CDT to ignore multi-line block?
Any suggestions welcome.
java.lang.ClassCastException: org.eclipse.cdt.internal.core.parser.scanner.TokenWithImage cannot be cast to org.eclipse.cdt.core.parser.IInactiveCodeToken
at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCo deParser.acceptInactiveCodeBoundary(AbstractGNUSourceCodePar ser.java:357)
at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCo deParser.declarationList(AbstractGNUSourceCodeParser.java:12 95)
at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCo deParser.parseTranslationUnit(AbstractGNUSourceCodeParser.ja va:1265)
at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCo deParser.translationUnit(AbstractGNUSourceCodeParser.java:12 60)
at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCo deParser.parse(AbstractGNUSourceCodeParser.java:645)
at org.eclipse.cdt.core.dom.parser.AbstractCLikeLanguage.getAST TranslationUnit(AbstractCLikeLanguage.java:143)
at org.eclipse.cdt.internal.core.model.TranslationUnit.getAST(T ranslationUnit.java:801)
at org.eclipse.cdt.internal.core.model.TranslationUnit.getAST(T ranslationUnit.java:765)
at org.eclipse.cdt.internal.core.model.ASTCache$1.run(ASTCache. java:293)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.cdt.internal.core.model.ASTCache.createAST(ASTCa che.java:287)
at org.eclipse.cdt.internal.core.model.ASTCache.getAST(ASTCache .java:168)
at org.eclipse.cdt.internal.core.model.ASTCache.runOnAST(ASTCac he.java:215)
at org.eclipse.cdt.internal.ui.editor.ASTProvider.runOnAST(ASTP rovider.java:344)
at org.eclipse.cdt.internal.ui.viewsupport.SelectionListenerWit hASTManager$PartListenerGroup.calculateASTandInform(Selectio nListenerWithASTManager.java:168)
at org.eclipse.cdt.internal.ui.viewsupport.SelectionListenerWit hASTManager$PartListenerGroup$3.run(SelectionListenerWithAST Manager.java:142)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
|
|
|
|
|
|
|
|
|
Re: Ignoring multiline assembler blocks [message #1833008 is a reply to message #1832992] |
Wed, 30 September 2020 14:00 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
You don't really need it to address this thread's topic.
You can use __CDT_PARSER__ in preprocessor ifdef and ifndef statements to show and hide code during parsing.
You can also define troublesome function calls as empty macros using User Settings in
Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. --> Entries tab
|
|
|
Powered by
FUDForum. Page generated in 0.03951 seconds