Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] how to extend scanner - CPreProcessor

I have the same question as Swapna. In my case, the compiler I'm writing a language extension for specifies inline assembly as follows:

#pragma asm
// Assembly goes here
#pragma endasm

Or alternately:

#asm
// Assembly goes here
#endasm

Both cases require not only new keywords in the preprocessor but modifications to the state machine as well (correct me if I'm mistaken).

Thanks,

Peter



From:        Swapna Pawar <Swapna.Pawar@xxxxxxxx>
To:        "cdt-dev@xxxxxxxxxxx" <cdt-dev@xxxxxxxxxxx>,
Date:        01/02/2014 03:54 AM
Subject:        [cdt-dev] how to extend scanner - CPreProcessor
Sent by:        cdt-dev-bounces@xxxxxxxxxxx




Hi,
 
I need to add the customized token. For example,
 
#pragma custom_token
static int func(int a, int b){
ADD R2,R1 ; Assembly-language description
}
 
Similar bug is logged:
 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=275335
 
However, my requirement is to support above syntax. No syntax error should be displayed for the above snippet.
 
This can be achieved by over-riding the executeDirective() method from org.eclipse.cdt.internal.core.parser.scanner > CPreprocessor.
However, ‘CPreprocessor’ is not extendible and the required methods are invisible.
 
Please suggest on how we can extend ‘CPreprocessor’ for supporting the required syntax.
 
Any help is greatly appreciated.
 
Regards,
Swapna
 

This message contains information that may be privileged or confidential and is the property of the KPIT Technologies Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Technologies Ltd. does not accept any liability for virus infected mails. _______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top