Author Topic: Go lang: some functions not matched  (Read 1339 times)

Offline ccpaging

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Go lang: some functions not matched
« on: February 23, 2016, 06:07:18 am »
Code: [Select]
<Label group="Function" match="func\s+(\w+)([^\{]*)\{" name="\1" descr="\1 \2" scope="1" image="18"/>

can match

Code: [Select]
func NewEncoding(encoder string) *Encoding {

but not match

Code: [Select]
func (enc *Encoding) EncodeToString(src []byte) string {

As c++, "(enc *Encoding)" is "class", EncodeToString is "method".

Offline ccpaging

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Go lang: some functions not matched
« Reply #1 on: February 23, 2016, 03:12:28 pm »
Code: [Select]
<Label group="Function" match="func\s+([^\{]*)\{" name="\1" descr="\1 \2" scope="1" image="18"/>
This may better.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Go lang: some functions not matched
« Reply #2 on: February 23, 2016, 11:51:19 pm »
Hi,

thanks for feedback and suggestion!. Honestly I have written schema, but now one has validated it before. So it may happen that it is not optimal and probably does not have some newest syntax schema features (fex Scope Exits)..

You mostly correct, except of fact that than 2 capture is gone. But I think it is OK.
This version may be even better ;)
Code: XML
  1. <Label group="Function" match="func\s+([^\{]+?)\s+?\{" name="\1" descr="\1" scope="1" image="18"/>

I have version in Online repository also. So you can update your schema manually or with Update Manager (Help->Check for updates...).

Best regards,
Alex.
P.S: If you will have some more comments/suggestions for Go schema, I will be happy to update it.

Offline ccpaging

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Go lang: some functions not matched
« Reply #3 on: February 24, 2016, 05:04:35 am »
That is fine.

[ Specified attachment is not available ]
« Last Edit: February 24, 2016, 05:06:42 am by ccpaging »

Offline ccpaging

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Go lang: some functions not matched
« Reply #4 on: July 11, 2017, 03:48:52 pm »
Code: [Select]
func Logf(lvl Level, format string, args ...interface{}) {
Global.intLogf(lvl, format, args...)
}

This is not in function list.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Go lang: some functions not matched
« Reply #5 on: July 11, 2017, 11:37:54 pm »
To get that working one need more complex regexp :) And who knows how long it will survive (at least until one would use () inside of the parameters section).
The Label definition from below shall work better:
Code: XML
  1. <Label group="Function" match="func\s+(?:(\([^\)]+?\))\s+)?(\w+)\s*(\([^\)]+?\))\s*(?:([^\{]+?)\s*)?\{" name="\1 \2 \3 \4" descr="\1" scope="1" image="18"/>

Offline ccpaging

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Go lang: some functions not matched
« Reply #6 on: July 18, 2017, 01:45:40 pm »
It is working.   ;)

But others is missing.

The attach file is a sample.

Thanks very much.
« Last Edit: July 18, 2017, 01:51:11 pm by ccpaging »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Go lang: some functions not matched
« Reply #7 on: July 20, 2017, 03:09:10 pm »
To be precise: "some other missing" :)
Please validate this one:
Code: XML
  1. <Label group="Function" match="func\s+(?:(\([^\)]+?\))\s+)?(\w+)\s*(\([^\)]*?\))\s*(?:([^\{]+?)\s*)?\{" name="\1 \2 \3 \4" descr="\1" scope="1" image="18" style="function" highlight="\2"/>

You can try it with a syntax schema file attached - there are some other features added.

Offline ccpaging

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Go lang: some functions not matched
« Reply #8 on: July 25, 2017, 04:28:39 pm »
 :) :) :) The last one is fine, everything.