Advertisement
LBPHacker

Lua function parser for Notepad++

Jun 17th, 2014
771
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 10.78 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!--
  3. For learning making your language parser, please check the following link:
  4. http://notepad-plus-plus.org/features/function-list.html
  5. -->
  6. <NotepadPlus>
  7.     <functionList>
  8.         <associationMap>
  9.         <!-- langID:
  10.             L_TEXT: 0     L_PHP: 1        L_C: 2        L_CPP: 3       L_CS: 4         L_OBJC: 5
  11.             L_JAVA: 6     L_RC: 7         L_HTML: 8     L_XML: 9       L_MAKEFILE: 10  L_PASCAL: 11
  12.             L_BATCH:12    L_INI: 13       L_ASCII: 14   L_USER: 15     L_ASP: 16       L_SQL: 17
  13.             L_VB: 18      L_JS: 19        L_CSS: 20     L_PERL: 21     L_PYTHON: 22    L_LUA: 23
  14.             L_TEX: 24     L_FORTRAN: 25   L_BASH: 26    L_FLASH: 27    L_NSIS: 28      L_TCL: 29
  15.             L_LISP: 30    L_SCHEME: 31    L_ASM: 32     L_DIFF: 33     L_PROPS: 34     L_PS: 35
  16.             L_RUBY: 36    L_SMALLTALK:37  L_VHDL: 38    L_KIX: 39      L_AU3: 40       L_CAML: 41
  17.             L_ADA: 42     L_VERILOG: 43   L_MATLAB: 44  L_HASKELL: 45  L_INNO: 46      L_SEARCHRESULT: 47
  18.             L_CMAKE: 48   L_YAML: 49      L_COBOL 50    L_GUI4CLI: 51  L_D: 52         L_POWERSHELL: 53
  19.             L_R: 54       L_JSP: 55
  20.         -->
  21.             <association langID="1" id="php_function"/>
  22.             <association langID="2" id="c_function"/>
  23.             <association langID="3" id="c_cpp_function"/>
  24.             <association langID="6" id="java"/>
  25.             <association langID="9" id="xml_node"/>
  26.             <association langID="12" id="batch_label"/>
  27.             <association langID="13" id="ini_section"/>
  28.             <association langID="19" id="js_function"/>
  29.             <association langID="21" id="perl_function"/>
  30.             <association langID="23" id="lua_function"/>
  31.             <association langID="28" id="nsis_syntax"/>
  32.         <!--
  33.             if langID cannot be found above, you can still set the file extensions
  34.             <association ext=".my_passer_ext1" id="my_passer_id"/>
  35.             <association ext=".my_passer_ext2" id="my_passer_id"/>
  36.            
  37.             for User Defined Languages:
  38.             <association userDefinedLangName="my user defined language" id="my_udl_passer_id"/>
  39.             <association userDefinedLangName="Autocad" id="my_autocad_passer_id"/>
  40.         -->
  41.  
  42.         </associationMap>
  43.         <parsers>
  44.  
  45.             <parser id="xml_node" displayName="XML Node" commentExpr="&lt;!--([^-]|-(?!-&gt;))*--&gt;">
  46.                 <!-- Only match nodes with at least one attribute -->
  47.                 <function
  48.                     mainExpr="&lt;[\w\?]+[\t ]+\w+[\t ]*=[\t ]*&quot;[^&quot;]+&quot;"
  49.                     displayMode="$functionName">
  50.                     <functionName>
  51.                         <nameExpr expr="[^&lt;]*"/>
  52.                     </functionName>
  53.                 </function>
  54.             </parser>
  55.  
  56.             <parser id="batch_label" displayName="BAT Label" commentExpr="((::.*?$)|(REM.*?$))">
  57.                 <function
  58.                     mainExpr="^[\t ]*:\w+"
  59.                     displayMode="$functionName">
  60.                     <functionName>
  61.                         <nameExpr expr="[^\t :]*"/>
  62.                     </functionName>
  63.                 </function>
  64.             </parser>
  65.  
  66.             <parser id="ini_section" displayName="INI Section" commentExpr="((#.*?$)|(;.*?$))">
  67.                 <function
  68.                     mainExpr="^[\t ]*[\[&quot;][\w_.; \(\)-]+[\]&quot;]"
  69.                     displayMode="$functionName">
  70.                     <functionName>
  71.                         <nameExpr expr="[^\[\]&quot;]*"/>
  72.                     </functionName>
  73.                 </function>
  74.             </parser>
  75.  
  76.             <parser id="java" displayName="Java" commentExpr="((/\*.*?\*)/|(//.**$))">
  77.                 <classRange mainExpr="^[\t ]*((public|protected|private|static|final|abstract|synchronized|@(\w)+)\s+)*(class|enum|interface|@interface)\s+\w+(<\s*\w+(,\s*\w+)*\s*>)?(\s+extends\s+\w+)?(\s+implements\s+\w+(,\s*\w+)*)?\s*\{" openSymbole="\{" closeSymbole="\}">
  78.                     <className>
  79.                         <nameExpr expr="(class|enum|interface|@interface)\s+\w+(<\s*\w+(,\s*\w+)*\s*>)?"></nameExpr>
  80.                         <nameExpr expr="\s+\w+(<\s*\w+(,\s*\w+)*\s*>)?"></nameExpr>
  81.                         <nameExpr expr="\w+(<\s*\w+(,\s*\w+)*\s*>)?"></nameExpr>
  82.                     </className>
  83.                     <function mainExpr="^[\t ]*((public|protected|private|static|final|abstract|synchronized|@(\w)+)\s+)*(\w*(\[\s*])*\s+)?(?!(if|while|for|switch|catch|synchronized)\b)\w+(\[\s*])*(<\s*\w+(,\s*\w+)*\s*>)?\s*\([^\)\(]*\)(\s+throws\s+\w+)?\s*\{">
  84.                         <functionName>
  85.                             <funcNameExpr expr="(?!(if|while|for|switch|catch|synchronized)\b)\w+(\[\s*])*(<\s*\w+(,\s*\w+)*\s*>)?\s*\("></funcNameExpr>
  86.                             <funcNameExpr expr="(?!(if|while|for|switch|catch|synchronized)\b)\w+(\[\s*])*(<\s*\w+(,\s*\w+)*\s*>)?"></funcNameExpr>
  87.                         </functionName>
  88.                     </function>
  89.                 </classRange>
  90.             </parser>
  91.  
  92.             <parser id="c_function" displayName="C source" commentExpr="((/\*.*?\*)/|(//.*?$))">
  93.                 <function
  94.                     mainExpr="^[\t ]*((static|const|virtual)[\s]+)?[\w:]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+)([\w_]+[\s]*::)?(?!(if|while|for))[\w_]+[\s]*\([^\)\(]*\)([\s]*const[\s]*)?[\n\s]*\{"
  95.                     displayMode="$functionName">
  96.                     <functionName>
  97.                         <nameExpr expr="(?!(if|while|for))[\w_~]+[\s]*\("/>
  98.                         <nameExpr expr="(?!(if|while|for))[\w_~]+"/>
  99.                     </functionName>
  100.                 </function>
  101.             </parser>
  102.            
  103.            
  104.             <parser id="js_function" displayName="Javascript" commentExpr="((/\*.*?\*)/|(//.*?$))">
  105.                 <function
  106.                     mainExpr="((^|[\s]+|[;\}\.])([_A-Za-z][\w_]*\.)*[_A-Za-z][\w_]*[\s]*[=:]|^|[\s;\}]+)[\s]*function([\s]+[_A-Za-z]?[\w_]*\([^\)\(]*\)|\([^\)\(]*\))[\n\s]*\{"
  107.                     displayMode="$className->$functionName">
  108.                     <functionName>
  109.                         <nameExpr expr="[_A-Za-z][\w_]*[\s]*[=:]|[_A-Za-z]?[\w_]*[\s]*\("/>
  110.                         <nameExpr expr="[_A-Za-z]?[\w_]*"/>
  111.                     </functionName>
  112.                     <className>
  113.                         <nameExpr expr="([_A-Za-z][\w_]*\.)*[_A-Za-z][\w_]*\."/>
  114.                         <nameExpr expr="([_A-Za-z][\w_]*\.)*[_A-Za-z][\w_]*"/>
  115.                     </className>
  116.                 </function>
  117.             </parser>
  118.            
  119.             <parser id="lua_function" displayName="Lua" commentExpr="((--\[=*\[.*?)\]=*\]|(--.*?$))">
  120.                 <function
  121.                     mainExpr="function\(\s*(([_A-Za-z][\w_]*|\.\.\.)\s*,?\s*)*\)|function\s+([_A-Za-z][\w_]*\.\s*)*([_A-Za-z][\w_]*[\.:]\s*)?[_A-Za-z][\w_]*\s*\("
  122.                     displayMode="$className->$functionName">
  123.                     <functionName>
  124.                         <nameExpr expr="function\(\s*(([_A-Za-z][\w_]*|\.\.\.)\s*,?\s*)*\)|\s([_A-Za-z][\w_]*\.\s*)*([_A-Za-z][\w_]*[\.:]\s*)?[_A-Za-z][\w_]*\s*\("/>
  125.                         <nameExpr expr="function\(\s*(([_A-Za-z][\w_]*|\.\.\.)\s*,?\s*)*\)|[_A-Za-z][\w_]*\s*\("/>
  126.                         <nameExpr expr="function\(\s*(([_A-Za-z][\w_]*|\.\.\.)\s*,?\s*)*\)|[_A-Za-z][\w_]*"/>
  127.                     </functionName>
  128.                     <className>
  129.                         <nameExpr expr="function\(\s*(([_A-Za-z][\w_]*|\.\.\.)\s*,?\s*)*\)|\s([_A-Za-z][\w_]*\.\s*)*([_A-Za-z][\w_]*[\.:]\s*)?[_A-Za-z][\w_]*\s*\("/>
  130.                         <nameExpr expr="function\(\s*(([_A-Za-z][\w_]*|\.\.\.)\s*,?\s*)*\)|\s([_A-Za-z][\w_]*\.\s*)*([_A-Za-z][\w_]*[\.:]\s*)?"/>
  131.                         <nameExpr expr="function\(\s*(([_A-Za-z][\w_]*|\.\.\.)\s*,?\s*)*\)|([_A-Za-z][\w_]*\.\s*)*([_A-Za-z][\w_]*[\.:]\s*)?"/>
  132.                         <nameExpr expr="function\(\s*(([_A-Za-z][\w_]*|\.\.\.)\s*,?\s*)*\)|([_A-Za-z][\w_]*\.\s*)*[_A-Za-z][\w_]*\s*[\.:]"/>
  133.                         <nameExpr expr="function|([_A-Za-z][\w_]*\.\s*)*[_A-Za-z][\w_]*\s*"/>
  134.                     </className>
  135.                 </function>
  136.             </parser>
  137.  
  138.             <parser id="c_cpp_function" displayName="C++ Class" commentExpr="((/\*.*?\*)/|(//.*?$))">
  139.                 <classRange
  140.                     mainExpr="^[\t ]*(class|struct)[\t ]+[\w]+[\s]*(:[\s]*(public|protected|private)[\s]+[\w]+[\s]*)?\{"
  141.                     openSymbole = "\{"
  142.                     closeSymbole = "\}"
  143.                     displayMode="node">
  144.                     <className>
  145.                         <nameExpr expr="(class|struct)[\t ]+[\w]+"/>
  146.                         <nameExpr expr="[\t ]+[\w]+"/>
  147.                         <nameExpr expr="[\w]+"/>
  148.                     </className>
  149.                     <function
  150.                         mainExpr="^[\t ]*((static|const|virtual)[\s]+)?([\w]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+))?([\w_]+[\s]*::)?(?!(if|while|for|switch))[\w_~]+[\s]*\([^\)\(]*\)([\s]*const[\s]*)?[\n\s]*\{">
  151.                         <functionName>
  152.                             <funcNameExpr expr="(?!(if|while|for|switch))[\w_~]+[\s]*\("/>
  153.                             <funcNameExpr expr="(?!(if|while|for|switch))[\w_~]+"/>
  154.                         </functionName>
  155.                     </function>
  156.                 </classRange>
  157.                 <function
  158.                     mainExpr="^[\t ]*((static|const|virtual)[\s]+)?[\w]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+)([\w_]+[\s]*::)?(?!(if|while|for))[\w_]+[\s]*\([^\)\(]*\)([\s]*const[\s]*)?[\n\s]*\{"
  159.                     displayMode="$className->$functionName">
  160.                     <functionName>
  161.                         <nameExpr expr="(?!(if|while|for))[\w_]+[\s]*\("/>
  162.                         <nameExpr expr="(?!(if|while|for))[\w_]+"/>
  163.                     </functionName>
  164.                     <className>
  165.                         <nameExpr expr="[\w_]+(?=[\s]*::)"/>
  166.                     </className>
  167.                 </function>
  168.             </parser>
  169.            
  170.             <parser id="nsis_syntax" displayName="NSIS Syntax" commentExpr="((/\*.*?\*)/|(#.*?$)|(;.*?$))">
  171.                 <function
  172.                     mainExpr="^[\t ]*(!macro|Function|Section|SectionGroup)[\t ]+[^\r\n]*$"
  173.                     displayMode="$functionName">
  174.                     <functionName>
  175.                         <nameExpr expr="(?(?=[\t ]*!macro)[\t ]*!macro[\t ]+[^\s]+|[^\r\n]*)"/>
  176.                     </functionName>
  177.                 </function>
  178.             </parser>
  179.            
  180.             <parser id="perl_function" displayName="Perl">
  181.                 <function mainExpr="^[\s]*(?<!#)[\s]*sub[\s]+[\w]+[\s]*\(?[^\)\(]*\)?[\n\s]*\{" displayMode="$className->$functionName">
  182.                     <functionName>
  183.                         <nameExpr expr="(sub[\s]+)?\K[\w]+"/>
  184.                     </functionName>
  185.                     <className>
  186.                         <nameExpr expr="[\w]+(?=[\s]*::)"/>
  187.                     </className>
  188.                 </function>
  189.             </parser>
  190.            
  191.             <parser id="php_function" displayName="PHP" commentExpr="((/\*.*?\*)/|(//.*?$))">
  192.                 <classRange
  193.                    mainExpr="^[\s]*(class|abstract[\s]+class|final[\s]+class)[\t ]+[\w]+([\s]*|[\s]*(extends|implements)[\s]+[\w]+[\s]*)?\{"
  194.                    openSymbole = "\{"
  195.                    closeSymbole = "\}"
  196.                    displayMode="node">
  197.                     <className>
  198.                         <nameExpr expr="(class|abstract[\s]+class|final[\s]+class)[\s]+[\w]+"/>
  199.                         <nameExpr expr="[\s]+[\w]+\Z"/>
  200.                         <nameExpr expr="[\w]+\Z"/>
  201.                     </className>
  202.                     <function
  203.                        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]*\([^\{]*\{">
  204.                         <functionName>
  205.                             <funcNameExpr expr="(?!(if|while|for|switch))[\w_]+[\s]*\([^\{]*"/>
  206.                             <!-- comment below node if want display method with parmas -->
  207.                             <funcNameExpr expr="(?!(if|while|for|switch))[\w_]+"/>
  208.                         </functionName>
  209.                     </function>
  210.                 </classRange>
  211.                 <function
  212.                    mainExpr="^[\s]*function[\s]+\w+\("
  213.  
  214.                    displayMode="$className->$functionName">
  215.                     <functionName>
  216.                         <nameExpr expr="(?!(if|while|for))[\w_]+[\s]*\("/>
  217.                         <nameExpr expr="(?!(if|while|for))[\w_]+"/>
  218.                     </functionName>
  219.                     <className>
  220.                         <nameExpr expr="[\w_]+(?=[\s]*::)"/>
  221.                     </className>
  222.                 </function>
  223.             </parser>
  224.            
  225.         </parsers>
  226.     </functionList>
  227. </NotepadPlus>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement