simonsteele / pn

Programmer's Notepad
373 stars 115 forks source link

ctags pre-defineds as reference #157

Closed JoseQuintas closed 7 years ago

JoseQuintas commented 7 years ago

PN already have some pre-defineds ctags for VB, as example. Is possible include them as samples? I think they can be a good reference. Until now, I do not understand what regular expression to use. examples of what Harbour have: function test( a, b, c ) procedure test create class testclass inherit anotherclass method test( a, b ) class testclass local a, b, c private a, b, c public a, b, c I think can be found on VB, C., but pre-configuration for ctags is not available to use as reference.

simonsteele commented 7 years ago

I'm guessing you mean pre-defined textclips? You can find them all in the clips directory where you installed PN. The file format is fairly simple, or you can make them with PN itself.

JoseQuintas commented 7 years ago

No, it is about configure ctags, to show on ctag window for a new language. Try some configurations but do not works. I would like to see what configuration was used to vb.

JoseQuintas commented 7 years ago

I try some configurations found on google

--langdef=harbour
--langmap=harbour:.prg.ch

--regex-harbour=/^FUNCTION [\t]*([a-zA-Z0-9_]+)/\1/f,function/
--regex-harbour=/^[Ff]unction [\t]*([a-zA-Z0-9_]+)/\1/f,function/

--regex-harbour=/^FUNC [\t]*([a-zA-Z0-9_]+)/\1/f,function/
--regex-harbour=/^[Ff]unc [\t]*([a-zA-Z0-9_]+)/\1/f,function/

--regex-harbour=/^PROCEDURE [\t]*([a-zA-Z0-9_]+)/\1/p,procedure/
--regex-harbour=/^[Pp]rocedure [\t]*([a-zA-Z0-9_]+)/\1/p,procedure/

--regex-harbour=/^PROC [\t]*([a-zA-Z0-9_]+)/\1/p,procedure/
--regex-harbour=/^[Pp]roc [\t]*([a-zA-Z0-9_]+)/\1/p,procedure/

--regex-harbour=/^#DEFINE [\t]*([a-zA-Z0-9_]+)/\1/d,define/
--regex-harbour=/^#[Dd]efine [\t]*([a-zA-Z0-9_]+)/\1/d,define/

--regex-harbour=/CLASS [\t]*([a-zA-Z0-9_]+)/\1/c,class/
--regex-harbour=/[Cc]lass [\t]*([a-zA-Z0-9_]+)/\1/c,class/

--regex-harbour=/DATA [\t]*([a-zA-Z0-9_]+)/\1/m,data/
--regex-harbour=/[Dd]ata [\t]*([a-zA-Z0-9_]+)/\1/m,data/
--regex-harbour=/VAR [\t]*([a-zA-Z0-9_]+)/\1/m,data/
--regex-harbour=/[Vv]ar [\t]*([a-zA-Z0-9_]+)/\1/m,data/

--regex-harbour=/METHOD [\t]*([a-zA-Z0-9_]+)/\1/m,method/
--regex-harbour=/[Mm]ethod [\t]*([a-zA-Z0-9_]+)/\1/m,method/

--regex-harbour=/MESSAGE [\t]*([a-zA-Z0-9_]+)/\1/m,method/
--regex-harbour=/[Mm]essage [\t]*([a-zA-Z0-9_]+)/\1/m,method/
simonsteele commented 7 years ago

Have you seen these docs?

http://www.pnotepad.org/docs/howto/tag_custom_languages/

Support for many languages is built into ctags, so that's why you can't find files for these.

JoseQuintas commented 7 years ago

Read too many times, but only now I found my mistake. on additionalSupportedSchemes.ini Associate letters is only part of configuration, need to have a section for each of that names. I was using "properties" for all. Thanks to makes me try once again.

simonsteele commented 7 years ago

No worries, glad it's working!

JoseQuintas commented 7 years ago

A occurence that I can't solve:

--langdef=harbour
--langmap=harbour:.prg.ch

--regex-harbour=/^METHOD [\t]*([a-zA-Z0-9_]+)/\1/m,harbour/
--regex-harbour=/^[Mm]ethod [\t]*([a-zA-Z0-9_]+)/\1/m,harbour/

--regex-harbour=/^PROCEDURE [\t]*([a-zA-Z0-9_]+)/\1/p,harbour/
--regex-harbour=/^[Pp]rocedure [\t]*([a-zA-Z0-9_]+)/\1/p,harbour/

--regex-harbour=/^\#define [\t]*([a-zA-Z0-9_]+)/\1/d,harbour/
[harbour]
f = 1
p = 2
v = 13
c = 3
v = 18
d = 20
m = 15

Search list ok, but: p shows as "procedure" ok m shows as "method" ok d shows as "unknown" wrong

0  Unknown
1  Function
2  Procedure
3  Class
4  Macro
5  Enum
6  Filename
7  EnumName
8  Member
9  Prototype
10 Structure
11 Typedef
12 Union
13 Variable
14 Namespace
15 Method
16 Event
17 Interface
18 Property
19 Program
20 Constant
21 Label
22 Singleton
23 Mixin
24 Module
25 Net
26 Port
27 Register
28 Task
29 Cursor
30 Record
31 SubType
32 Trigger
33 Set
34 Field
35 Table
JoseQuintas commented 7 years ago

More confuse now. change to letter X

--regex-harbour=/^\#define [\t]*([a-zA-Z0-9_]+)/\1/x,harbour/
x = 20

Now, appears on list as "macro".

JoseQuintas commented 7 years ago

Seems work now. No section name.

--langdef=harbour
--langmap=harbour:.prg.ch
--regex-harbour=/^PROCEDURE [\t]*([a-zA-Z0-9_]+)/\1/a/
--regex-harbour=/^FUNCTION [\t]*([a-zA-Z0-9_]+)/\1/b/
--regex-harbour=/^CREATE CLASS [\t]*([a-zA-Z0-9_]+)/\1/c/
--regex-harbour=/^METHOD [\t]*([a-zA-Z0-9_]+)/\1/d/
--regex-harbour=/^VAR [\t]*([a-zA-Z0-9_]+)/\1/e/
--regex-harbour=/^MEMVAR [\t]*([a-zA-Z0-9_]+)/\1/f/
--regex-harbour=/^PUBLIC [\t]*([a-zA-Z0-9_]+)/\1/g/
--regex-harbour=/^PRIVATE [\t]*([a-zA-Z0-9_]+)/\1/h/
--regex-harbour=/^LOCAL [\t]*([a-zA-Z0-9_]+)/\1/i/
--regex-harbour=/^\#define [\t]*([a-zA-Z0-9_]+)/\1/j/
[harbour]
a=2
b=1
c=3
d=15
e=18
f=13
g=13
h=13
i=0
j=20

Now I have:

I do not understand section name use, then limit will be 26 rules, letters a-z .