【问题标题】:Does anyone have parsing rules for the Notepad++ Function List plugin for Ruby and Rake有没有人有 Ruby 和 Rake 的 Notepad++ 函数列表插件的解析规则
【发布时间】:2009-11-10 18:44:51
【问题描述】:

我正在使用 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

欢迎提出任何建议。

谢谢

【问题讨论】:

  • 其实任务规则也可以。所有的任务都在列表的底部。可悲的是,他们似乎没有很好地更新功能列表,我需要点击插件上的排序按钮才能让他们更新。

标签: ruby plugins rake notepad++


【解决方案1】:

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

<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>

【讨论】:

    【解决方案2】:

    也许您可以使用以下设置,您可以将这些设置添加到您的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>
    

    【讨论】:

    • 谢谢。我会试试看。对 C++.flb 文件的引用是什么?显然它是你本地路径中的东西。
    【解决方案3】:

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

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

    【讨论】:

      【解决方案4】:

      我正在为新的 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>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-06-18
        • 2011-02-02
        • 2022-12-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多