Help needed for creating a new parser in functionList.xml



  • Hi

    I am trying to write a parser in functionList.xml for a CORBA idf file.

    The test file is (test.idl) contains:

    module Test {
    interface EntityRoot { 
    };
    /* comment 1  interface Test1 { */
    interface Entity1 : EntityRoot {	
    	void setName1 ( 
    		in string value // comment 2 setName3 (
    	) raises(ServerError);       
    	void changePosition1 (
    		in long value
    	) raises(ServerError);
    };
    interface Entity2 : EntityRoot {	
    	void setName2 ( 
    		in string value // comment 2
    	) raises(ServerError);       
    	void changePosition2 (
    		in long value
    	) raises(ServerError);
    }; };
    

    I added this line within <associationMap>:
    <association id=“corba_syntax” userDefinedLangName=“CORBA” />

    The following parser is working, giving me a list of interface, struct and enum:

    <parser 
    displayName="CORBA" 
    id="corba_syntax" 
    commentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)">
    <function
    	mainExpr="(interface|struct|enum)\s+\w+\s*(:\s+\w+\s*)?\{"
    >
    	<functionName>
    		<nameExpr expr="(interface|struct|enum)\s+\w+" />
    	</functionName>
    </function>
    </parser>
    

    But this on is giving nothing but the name of the file:

    <parser 
    displayName="CORBA" 
    id="corba_syntax" 
    commentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)" >
    <classRange
    	mainExpr="(interface|struct|enum)\s+\w+\s*(:\s+\w+\s*)?\{"
    	openSymbole ="\{"
    	closeSymbole="\}"
    >
    	<className>
    		<nameExpr expr="(interface|struct|enum)\s+\w+" />
    	</className>
    	<function mainExpr="\s+\w+\s*\(" >
    		<functionName>
    			<funcNameExpr expr="\w+" />
    		</functionName>
    	</function>
    </classRange>
    </parser>
    

    What am I doing wrong?
    Thanks
    Andre



  • I found a solution.

    <parser 
    displayName="CORBA" 
    id="corba_syntax" 
    commentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)" >
    <classRange
    	mainExpr="interface\s+\w+\s*(:\s+\w+\s*)?\{"
    	openSymbole ="\{"
    	closeSymbole="\}"
    >
    	<className>
    		<nameExpr expr="interface\s+\w+" />
    	</className>
    	<function mainExpr="\w+\s+\w+\s*\(" >
    		<functionName>
    			<funcNameExpr expr="\w+\s*\(" />
    			<funcNameExpr expr="\w+" />
    		</functionName>
    	</function>
    </classRange>
    <function
    	mainExpr="(struct|enum)\s+\w+\s*(:\s+\w+\s*)?\{"
    >
    	<functionName>
    		<nameExpr expr="(struct|enum)\s+\w+" />
    	</functionName>
    </function>>
    </parser>

Log in to reply