有没有人有记事本的解析规则++ Ruby 和 Rake 的函数列表插件

发布于 2024-08-10 22:27:15 字数 430 浏览 2 评论 0原文

我使用 Notepad++ 编辑 rake 文件,并且希望能够使用函数列表插件。

我无法在线找到任何解析规则,并且“语言解析规则”对话框没有非常清晰的记录。

我正在将方法解析到以下列表中,但还想显示任务。

Function Begin:  [ \t]*def[ \t]+
Function List Name: [a-zA-Z0-9_\.]*

这不是很干净,并且不会捕获以 ? 结尾的函数。或!,但这是一个开始。

我的任务规则不起作用是:

Function Begin: [ \t]*task[ \t]+
Function List Name: :[a-zA-Z0-9_\.]*
Function End: [ \t]+do

欢迎任何建议。

谢谢

I'me using Notepad++ for editing rake files and I'd like to be able to use the function list plugin.

I've been unable to find any parsing rules on line, and the "Language Parsing Rules" dialog is not very clearly documented.

I'm parsing methods into the list with the following, but would like to also display tasks.

Function Begin:  [ \t]*def[ \t]+
Function List Name: [a-zA-Z0-9_\.]*

This isn't very clean, and won't capture functions that end with ? or !, but it is a start.

My task rule, which isn't working is:

Function Begin: [ \t]*task[ \t]+
Function List Name: :[a-zA-Z0-9_\.]*
Function End: [ \t]+do

Any suggestions most welcome.

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

涙—继续流 2024-08-17 22:27:15

这是我的规则。还不够完美。不知道如何配置子组。

<Language name="Ruby" imagelistpath="">
    <CommList param1="#" param2="" />
    <CommList param1="//" param2="" />
    <CommList param1="/\*" param2="\*/" />
    <Group name="MODULE" subgroup="" icon="0" child="0" autoexp="0" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
        <Rules regexbeg="^[\s\t]*module\s+" regexfunc="[\w]+" regexend="" bodybegin="" bodyend="" sep="" />
    </Group>
    <Group name="CLASS" subgroup="" icon="0" child="0" autoexp="0" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
        <Rules regexbeg="^[\s\t]*class\s+" regexfunc="[\w]+" regexend="" bodybegin="" bodyend="" sep="" />
    </Group>
    <Group name="FUNCTION" subgroup="" icon="0" child="0" autoexp="0" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
        <Rules regexbeg="^[\s\t]*def\s+" regexfunc="[\w\?!\.=]+" regexend="" bodybegin="" bodyend="" sep="" />
    </Group>
</Language>

Here is my rules. Still not perfect yet. Don't know how to config subgroups.

<Language name="Ruby" imagelistpath="">
    <CommList param1="#" param2="" />
    <CommList param1="//" param2="" />
    <CommList param1="/\*" param2="\*/" />
    <Group name="MODULE" subgroup="" icon="0" child="0" autoexp="0" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
        <Rules regexbeg="^[\s\t]*module\s+" regexfunc="[\w]+" regexend="" bodybegin="" bodyend="" sep="" />
    </Group>
    <Group name="CLASS" subgroup="" icon="0" child="0" autoexp="0" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
        <Rules regexbeg="^[\s\t]*class\s+" regexfunc="[\w]+" regexend="" bodybegin="" bodyend="" sep="" />
    </Group>
    <Group name="FUNCTION" subgroup="" icon="0" child="0" autoexp="0" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
        <Rules regexbeg="^[\s\t]*def\s+" regexfunc="[\w\?!\.=]+" regexend="" bodybegin="" bodyend="" sep="" />
    </Group>
</Language>
一片旧的回忆 2024-08-17 22:27:15

也许您可以使用以下设置,将其添加到 FunctionListRules.xml 文件中:

<Language name="Ruby" imagelistpath="C:\Documents and Settings\king_cao\Application Data\Notepad++\plugins\config\C++.flb">
        <Group name="CLASS" subgroup="FUNCTION" icon="1" child="11" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="^class\s+" regexfunc="[\w_]+" regexend="" bodybegin="" bodyend="^end$" sep="" />
        </Group>
        <Group name="FUNCTION" subgroup="" icon="9" child="17" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="^[\s\t]+def\s+" regexfunc="[\w_]+" regexend="" bodybegin="" bodyend="^[\s\t]+end$" sep="" />
        </Group>
        <Group name="GlobalFunction" subgroup="" icon="9" child="17" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="^def\s+" regexfunc="[\w_]+" regexend="" bodybegin="" bodyend="^end$" sep="" />
        </Group>
        <Group name="MODULE" subgroup="FUNCTION" icon="8" child="11" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="^module\s+" regexfunc="[\w_]+" regexend="" bodybegin="" bodyend="^end$" sep="" />
        </Group>
</Language>

Maybe you can use the below settings which you can add in yourFunctionListRules.xml file:

<Language name="Ruby" imagelistpath="C:\Documents and Settings\king_cao\Application Data\Notepad++\plugins\config\C++.flb">
        <Group name="CLASS" subgroup="FUNCTION" icon="1" child="11" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="^class\s+" regexfunc="[\w_]+" regexend="" bodybegin="" bodyend="^end$" sep="" />
        </Group>
        <Group name="FUNCTION" subgroup="" icon="9" child="17" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="^[\s\t]+def\s+" regexfunc="[\w_]+" regexend="" bodybegin="" bodyend="^[\s\t]+end$" sep="" />
        </Group>
        <Group name="GlobalFunction" subgroup="" icon="9" child="17" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="^def\s+" regexfunc="[\w_]+" regexend="" bodybegin="" bodyend="^end$" sep="" />
        </Group>
        <Group name="MODULE" subgroup="FUNCTION" icon="8" child="11" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="^module\s+" regexfunc="[\w_]+" regexend="" bodybegin="" bodyend="^end$" sep="" />
        </Group>
</Language>
内心荒芜 2024-08-17 22:27:15

从 6.4 版本开始,不再需要插件了!查看新的功能列表功能:
http://notepad-plus-plus.org/features/function-list.html

语言支持即将推出,也许在这里询问会有所帮助:
https://sourceforge.net/p/notepad-plus/discussion/ 331753/线程/b9d2fe00/

Since version 6.4 there is no need for a plugin! Check out the new function list feature:
http://notepad-plus-plus.org/features/function-list.html

Language support is coming, perhaps asking here would help:
https://sourceforge.net/p/notepad-plus/discussion/331753/thread/b9d2fe00/

歌入人心 2024-08-17 22:27:15

我正在为新的 functionList.xml 使用以下解析器。它可以识别大多数类模块和方法定义,除非多个定义位于同一行。例如,

module A; module B; class C end; end; end;

在上面的情况下,它只会识别“模块 A”,

所有内容都只是作为函数呈现,包括“class”、“module”或“def”关键字。它不使用 classrange 提供的层次结构。

  <parser id="rb_function" displayName="Ruby" >
    <function
        mainExpr="^[\s]*(def|class|module)[\s]+(self\.)?[\S]+;?"
        displayMode="$className->$functionName" >
      <functionName>
        <nameExpr expr="(def|class|module)[^\(;]*" />
      </functionName>
    </function>
  </parser>

I'm using the following parser for the new functionList.xml. It recognizes most of classes modules and method definitions exept if multiple definitions are on the same line. E.g.

module A; module B; class C end; end; end;

In the above case it will just recognize "module A"

Everything is just presented as function including "class" "module" or "def" keyword. It is does not use the hierarchy provided by classrange.

  <parser id="rb_function" displayName="Ruby" >
    <function
        mainExpr="^[\s]*(def|class|module)[\s]+(self\.)?[\S]+;?"
        displayMode="$className->$functionName" >
      <functionName>
        <nameExpr expr="(def|class|module)[^\(;]*" />
      </functionName>
    </function>
  </parser>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文