Notepad ++ SQL功能列表 [英] Notepad++ Function list for SQL
问题描述
快速问题..我正试图在记事本++中获取功能列表选项...
quick question .. I'm trying to get the function list option in Notepad++ going ...
现在,我发现了这个线程: PL/SQL的Notepad ++功能列表
Now, I found this thread: Notepad++ Function List for PL/SQL
这帮助我起步,但是,我仍然在为某些事情而苦苦挣扎,而且似乎无法将猴子的脑袋缠起来.
which helped get me started, however, I'm still struggling with something, and I can't seem to wrap my monkey-brain around it.
这是我需要重点关注的部分:
It'll be this section I need to focus:
<function
mainExpr="^[\t ]*(FUNCTION|PROCEDURE)[\s]*[\w]*[\s]*(\(|IS|AS)*"
displayMode="$functionName">
<functionName>
<nameExpr expr="[\w]+[\s]*(\(|IS|AS)"/>
</functionName>
</function>
到目前为止,效果很好. 但是,我也想在其中看到PACKAGE标头和PACKAGE BODY名称,..只是为了帮助收拾东西.
That works perfectly fine .. so far. However, I would like to also see PACKAGE header and PACKAGE BODY names in there as well .. just to help tidy things up.
我认为调整RegExp很容易,但是,我尝试过的任何方法都不起作用
I figured it'd be easy to tweak the RegExp, however, nothing I've tried is working
所以我正在尝试选择以下几种情况:
So I'm trying to pick out these kinds of scenarios:
CREATE PACKAGE aaa
CREATE OR REPLACE PACKAGE bbb
CREATE PACKAGE BODY ccc
CREATE OR REPLACE PACKAGE BODY ddd
所有4个:aaa,bbb,ccc和ddd. 我什至无法拉回一个..:(
all 4: aaa, bbb, ccc, and ddd. I can't even get it to pull back one yet.. :(
希望我能得到一些帮助/提示/某物..
Hoping I could get some help/hints/something ..
我知道这是主要的逻辑":
I know this is the main "logic":
mainExpr="^[\t ]*(FUNCTION|PROCEDURE)[\s]*[\w]*[\s]*(\(|IS|AS)*"
找到行..
并尝试将逻辑与查找到的逻辑(例如,功能)以及我想要的包装进行匹配...我尝试了此操作:
And trying to matchup the logic with what it finds for .. say, FUNCTIONs, and what I want for PACKAGE ... I tried this:
mainExpr="^[\t ]*(FUNCTION|PROCEDURE|CREATE OR REPLACE PACKAGE)[\s]*[\w]*[\s]*(\(|IS|AS)*"
但是即使那样也不能挑出标题!哦
but even that doesn't pick out the header! O.o
我确定我需要对零件做些事情..但是,我并没有真正了解它的工作原理?
I'm sure there's something I need to do with the part .. but again, not really understanding how it works ??
我已经读过: https://notepad-plus-plus.org/features/function-list. html
但是显然我对此不完全了解..
but there's obviously something about the syntax/usage of this thing I'm not fully understanding ..
希望有人可以帮助我吗?
hoping somebody can help me out?
推荐答案
我认为您的问题来自正则表达式,而不是您做错的任何事情.我根据在这里找到的解析器做了一个新的解析器: http://www.hermanmol. nl/?p = 240
I think your problem is coming from the Regex rather than anything you're doing incorrectly. I've made a new parser based on the one I found here: http://www.hermanmol.nl/?p=240
<parser id="plsql_func" displayName="PL/SQL" commentExpr="((/\*.*?\*)/|(--.*?$))">
<function
mainExpr="^[\w\s]{0,}(PACKAGE BODY|PACKAGE|FUNCTION|PROCEDURE)[\s]{1,}[\w_]{1,}">
<functionName>
<nameExpr expr="^[\w\s]{0,}(PACKAGE BODY|PACKAGE|FUNCTION|PROCEDURE)[\s]{1,}\K[\w_]{1,}"/>
</functionName>
</function>
</parser>
对我来说,这似乎正确地提取了包,过程和函数.
For me this seems to correctly pull out the Package, Procedures and Functions.
不过要注意的一件事是,我无法使用文件扩展名关联来使其正常工作,而是使用以下内容对文本文件进行测试:<association langID= "0" id="plsql_func" />
One thing to note however, I could not get this to work using a file extension assocation, and used the following instead to test on a text file: <association langID= "0" id="plsql_func" />
我还将更新的functionList.xml文件放置在Program Files (x86)\Notepad++
和Users\xxxxx\AppData\Roaming\Notepad++
目录中.
I also placed the updated functionList.xml file in both the Program Files (x86)\Notepad++
and the Users\xxxxx\AppData\Roaming\Notepad++
directories.
编辑-对正则表达式的简短说明,我对正则表达式并不满意,但在评论中要求提供它
Edit - a short explanation of the Regex, I'm not great at Regex but it was requested in the comments
^[\w\s]{0,}
-从该行的开头开始,找到0个或多个字母或空格字符
^[\w\s]{0,}
- From the beginning of the line, find 0 or more letters or white space characters
(PACKAGE BODY|PACKAGE|FUNCTION|PROCEDURE)
-随后是任意
[\s]{1,}[\w_]{1,}
-后跟一个或多个空格,后跟一个或多个单词
[\s]{1,}[\w_]{1,}
- followed by one or more spaces, followed by one or more words
这篇关于Notepad ++ SQL功能列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!