Debugging Funtion Lists



  • I’m trying to add MooTools support to Function Lists. MooTools is a JQuery-like OOP Javascript framework. I’ve edited functionList.xml to replace the Javascript definition for langID=“58”. I can’t get it to work. The regexps I defined work with Find. Is there any way to determine what Function List is failing on?

    Here are the particulars.
    functionList.xml

    <association id=      "mootools_syntax"   langID="58"                          />
    
    		<!-- ========================================================= [ MooTools ] -->
    
    		<parser
    			displayName="MooTools"
    			id         ="mootools_syntax"
    			commentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)"
    		>
    			<classRange
    				mainExpr    ="^var[\t\x20]+\w+\s*\=\s*\{"
    				openSymbole ="\{"
    				closeSymbole="\}"
    			>
    				<className>
    					<nameExpr expr="[\t\x20]+\w+" />
    					<nameExpr expr="\w+" />
    				</className>
    				<function
    					mainExpr="^[\t\x20]+\w+[\t\x20]*\:[\t\x20]*function[\t\x20]*\(.*\)[\t\x20]*\{"
    				>
    					<functionName>
    						<funcNameExpr expr="[\t\x20]+\w+" />
    						<funcNameExpr expr="\w+" />
    					</functionName>
    				</function>
    			</classRange>
    			<function
    				mainExpr="^[\t\x20]*function[\t\x20]+\w*[\t\x20]*\(.*\)[\t\x20]*\{"
    			>
    				<functionName>
    					<nameExpr expr="[\t\x20]+\w+" />
    					<nameExpr expr="\w+" />
    				</functionName>
    				<className>
    					<nameExpr expr="\w+(?=\s*::)" />
    				</className>
    			</function>
    		</parser>
    

    tst.js:
    var Class1 = {
    method1:function() {
    }
    }

    function func1 () {
    }



  • Try language ID 19 instead.



  • That works. Thanks for the input.



  • Next problem. With the following source code, Function List only shows method1 but not method2:

    var Class1 = {
    method1:function() {
    },
    method2:function() {
    }
    }



  • Hello Robert,

    Follow the instructions here.
    Both functions are displayed.

    Best regards.



  • Thanks for the help. Here is a simple parser for MooTools. I’ll expand it as I become more familiar with PCRE.

    		<association id=      "mootools_syntax"   langID="19"                          />
    
    		<parser
    			displayName="MooTools"
    			id         ="mootools_syntax"
    			commentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)"
    		>
    			<classRange
    				mainExpr    ="(^var[\t\x20]+[A-Za-z_]\w*\s*\=\s*\{|(\bvar)?[\t\x20]+[A-Za-z_]\w*\s*\=\s*new\s+[A-Za-z_]\w*\s*\(\s*\{)"
    				openSymbole ="\{"
    				closeSymbole="\}"
    			>
    				<className>
    					<nameExpr expr="[\t\x20]+[A-Za-z_]\w*" />
    					<nameExpr expr="[A-Za-z_]\w*" />
    				</className>
    				<function
    					mainExpr="^[\t\x20]+\w+[\t\x20]*\:[\t\x20]*function"
    				>
    					<functionName>
    						<funcNameExpr expr="[\t\x20]+\w+" />
    						<funcNameExpr expr="\w+" />
    					</functionName>
    				</function>
    			</classRange>
    			<function
    				mainExpr="((^|\s+|[;\}\.])([A-Za-z_]\w*\.)*[A-Za-z_]\w*\s*[=:]|^|[\s;\}]+)\s*function(\s+[A-Za-z_]?\w*\s*\([^\)\(]*\)|\([^\)\(]*\))[\n\s]*\{"
    			>
    				<functionName>
    					<nameExpr expr="[A-Za-z_]\w*\s*[=:]|[A-Za-z_]?\w*\s*\(" />
    					<nameExpr expr="[A-Za-z_]?\w*" />
    				</functionName>
    				<className>
    					<nameExpr expr="([A-Za-z_]\w*\.)*[A-Za-z_]\w*\." />
    					<nameExpr expr="([A-Za-z_]\w*\.)*[A-Za-z_]\w*" />
    				</className>
    			</function>
    		</parser>

Log in to reply