Skip to content

Commit

Permalink
Updated functionList.xml to support Ruby
Browse files Browse the repository at this point in the history
Supports def & class
Fix indentation with tabulations
closes #1742
  • Loading branch information
Jishin42 authored and milipili committed Jul 20, 2016
1 parent 2fb505b commit 7f1fb46
Showing 1 changed file with 58 additions and 33 deletions.
91 changes: 58 additions & 33 deletions PowerEditor/src/functionList.xml
Expand Up @@ -31,6 +31,7 @@ http://notepad-plus-plus.org/features/function-list.html
<association langID="22" id="python_function"/>
<association langID="26" id="bash_function"/>
<association langID="28" id="nsis_syntax"/>
<association langID="36" id="ruby_function"/>
<!--
if langID cannot be found above, you can still set the file extensions
<association ext=".my_passer_ext1" id="my_passer_id"/>
Expand Down Expand Up @@ -172,39 +173,39 @@ http://notepad-plus-plus.org/features/function-list.html
</function>
</parser>

<parser id="php_function" displayName="PHP" commentExpr="((/\*.*?\*)/|(//.*?$))">
<classRange
mainExpr="^[\s]*(class|abstract[\s]+class|final[\s]+class)[\t ]+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*([\s]*|[\s]*(extends|implements|(extends[\s]+(\\|[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+[\s]+implements))[\s]+(\,[\s]*|(\\|[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))+[\s]*)?\{"
openSymbole = "\{"
closeSymbole = "\}"
displayMode="node">
<className>
<nameExpr expr="(class|abstract[\s]+class|final[\s]+class)[\s]+[\w]+"/>
<nameExpr expr="[\s]+[\w]+\Z"/>
<nameExpr expr="[\w]+\Z"/>
</className>
<function
mainExpr="^[\s]*((static|public|protected|private|final)*(\s+(static|public|protected|private|final))+[\s]+)?(function[\s]+)+([\w]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+))?([\w_]+[\s]*::)?(?!(if|while|for|switch))[\w_~]+[\s]*\([^\{]*\{">
<functionName>
<funcNameExpr expr="(?!(if|while|for|switch))[\w_]+[\s]*\([^\{]*"/>
<!-- comment below node if want display method with parmas -->
<funcNameExpr expr="(?!(if|while|for|switch))[\w_]+"/>
</functionName>
</function>
</classRange>
<function
mainExpr="^[\s]*function[\s]+\w+\("

displayMode="$className->$functionName">
<functionName>
<nameExpr expr="(?!(if|while|for))[\w_]+[\s]*\("/>
<nameExpr expr="(?!(if|while|for))[\w_]+"/>
</functionName>
<className>
<nameExpr expr="[\w_]+(?=[\s]*::)"/>
</className>
</function>
</parser>
<parser id="php_function" displayName="PHP" commentExpr="((/\*.*?\*)/|(//.*?$))">
<classRange
mainExpr="^[\s]*(class|abstract[\s]+class|final[\s]+class)[\t ]+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*([\s]*|[\s]*(extends|implements|(extends[\s]+(\\|[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+[\s]+implements))[\s]+(\,[\s]*|(\\|[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))+[\s]*)?\{"
openSymbole = "\{"
closeSymbole = "\}"
displayMode="node">
<className>
<nameExpr expr="(class|abstract[\s]+class|final[\s]+class)[\s]+[\w]+"/>
<nameExpr expr="[\s]+[\w]+\Z"/>
<nameExpr expr="[\w]+\Z"/>
</className>
<function
mainExpr="^[\s]*((static|public|protected|private|final)*(\s+(static|public|protected|private|final))+[\s]+)?(function[\s]+)+([\w]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+))?([\w_]+[\s]*::)?(?!(if|while|for|switch))[\w_~]+[\s]*\([^\{]*\{">
<functionName>
<funcNameExpr expr="(?!(if|while|for|switch))[\w_]+[\s]*\([^\{]*"/>
<!-- comment below node if want display method with parmas -->
<funcNameExpr expr="(?!(if|while|for|switch))[\w_]+"/>
</functionName>
</function>
</classRange>
<function
mainExpr="^[\s]*function[\s]+\w+\("
displayMode="$className->$functionName">
<functionName>
<nameExpr expr="(?!(if|while|for))[\w_]+[\s]*\("/>
<nameExpr expr="(?!(if|while|for))[\w_]+"/>
</functionName>
<className>
<nameExpr expr="[\w_]+(?=[\s]*::)"/>
</className>
</function>
</parser>
<parser id="bash_function" displayName="Shell" commentExpr="(#.*?$)">
<function
mainExpr="^[\t ]*(function[\t\r\n ]*)?([a-zA-Z0-9_])+[\t\r\n ]*(\([^\)]*\))?[\t\r\n ]*(\{)[^(\})\r\n\t ]*"
Expand All @@ -214,6 +215,7 @@ http://notepad-plus-plus.org/features/function-list.html
</functionName>
</function>
</parser>

<parser id="python_function" displayName="Python class" commentExpr="(#.*?$|'''.*?('''|\Z))">
<classRange mainExpr="(?&lt;=^class ).*?(?=\n\S|\Z)">
<className>
Expand All @@ -232,6 +234,29 @@ http://notepad-plus-plus.org/features/function-list.html
</function>
</parser>

<parser id="ruby_function" displayName="Ruby">
<!-- within a class-->
<classRange
mainExpr="(?&lt;=^class ).*?(?=\n\S|\Z)"
displayMode="node" >
<className>
<nameExpr expr="\w+"/>
</className>
<function mainExpr="^\s*def\s+\w+" displayMode="$className->$functionName" >
<functionName>
<funcNameExpr expr="(?&lt;=def\s)\w+"/>
</functionName>
</function>
</classRange>

<!-- without class-->
<function mainExpr="^\s*def\s+\w+" displayMode="$functionName" >
<functionName>
<nameExpr expr="(?&lt;=def\s)\w+"/>
</functionName>
</function>
</parser>

<parser id="cs_function" displayName="C# Class" commentExpr="((/\*.*?\*)/|(//.*?$))">
<classRange
mainExpr="^[\t ]*((public|protected|private|internal)[\s]+)?([\w]+[\s]*)?(class|struct|interface)[\t ]+[^\{]+\{"
Expand Down

0 comments on commit 7f1fb46

Please sign in to comment.