Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] add new keyword recognize by the dom parser



>Are you using different ILanguages for the header and source files?  
yes, by implementing the ICLanguageKeywords
-.ph (popc header files) are based on the class PopCPP it extends
GPPLanguage, 
- source file are the normal .cc form CDT so based on GPPLanguage

Plugin.xml :
 <!-- Pop-C++ language declaration -->
 <extension
       point="org.eclipse.cdt.core.language">
    <language
        id="language.PopCPP"
        name="%language.name"
        class="ch.eif.popc.language.PopCPP">
        <!-- associate a content type to the language -->
        <contentType id="ch.eif.popc.popcHeader"/>
    </language>
 </extension>

PopCPP  file :
public class PopCPP extends GPPLanguage {

        //used to add the parclass{
	protected static final POPCscannerExtensionConfiguration
POPC_SCANNER_EXTENSION = new POPCscannerExtensionConfiguration(); 

        public String[] getKeywords() to add new keywords

	@Override
	protected IScannerExtensionConfiguration getScannerExtensionConfiguration()
{
		return POPC_SCANNER_EXTENSION;
	}

}

POPCscannerExtensionConfiguration file :
public class POPCscannerExtensionConfiguration extends
GPPScannerExtensionConfiguration {

	public static final String PARCLASS = "parclass";
	public static final char[] popcPARCLASS = "parclass".toCharArray();
//$NON-NLS-1$


	public CharArrayIntMap getAdditionalKeywords() {
		[...]
		additionalCPPKeywords.put( POPCscannerExtensionConfiguration.popcPARCLASS,
IToken.t_class);
return additionalCPPKeywords;
}



>How different is POPC++ from regular C++? 
parclass as no extra syntax and use the same format as class, it is intend
for parallel use and so is a real class with some restriction (for example :
There are no methods that return memory address references)

parclass contains a special format for some method : 
for example : sync mutex void getResult(int i, Matrix2Dlc &r, float &t); 
The outline view propaged getResult correctly. 
So this is not actualy an issue.

the special keyword who made us some problems is the following, function can
have some parameters for distributed application :
Bird(float P) @{ od.power(P);
                 od.memory(100,60);
                 od.protocol("socket http"); };
The @ keywords is identified as  a Bad character sequence encountered : @
from the AST
The coloration for this part was implemented using : public final class
FastPopCPartitionScanner implements IPartitionTokenScanner, ICPartitions {


So I hope this give you enough information about the configuration.
I know that I will  probably not have enough time to implement all that
part. But it would be important to us to know if this is a good solution for
the future. If C99 would help us.

Thank you for your help,

Christian

-- 
View this message in context: http://www.nabble.com/add-new-keyword-recognize-by-the-dom-parser-tp17621864p17805334.html
Sent from the Eclipse CDT - Development mailing list archive at Nabble.com.



Back to the top