Problem with custom language

Help
Arkshine
2011-02-28
2013-06-12
  • Arkshine
    Arkshine
    2011-02-28

    Hi,

    I'm trying to play with this nice plugin to add support for a custom language :  Pawn
    This language has a C-like syntax, so adding the extension .sma to C/C++ work enough.

    Though, I would like to customize.

    So, here what I have tried :


    When I do "Try", nothing happens. Regex seems ok, I've checked in a software.
    I've searched a lot before, the doc doesn't help me. Played with all the available options.
    I'm not sure about "output". I've tried also with a simple regex without success.

    Really, no idea what's wrong..

    Thanks for your help !

     
  • UFO
    UFO
    2011-02-28

    hi,

    I guess you did some copy&paste directly in the XML file, else I can't explain that your "PAWN" language has no "*" at the end. "*" means custom language. Anyway.. here's my quick try:
    http://img835.imageshack.us/img835/8595/sshot1p.png
    Some things look different, but that's not important. It's an upcoming version.

     
  • Arkshine
    Arkshine
    2011-02-28

    Yes, you are right ! I've altered manually the file, since I thought at the start it would need to do that and also to try to understand/configure, because at first try, I was a bit little lost. Before I was playing with FunctionList, it was really boring (recompiling to add the new language, understanding how it works, for some reasons all regex doesn't work, kind of slow, and such..). I'm quite happy it exists another plugin which seems more stable and fast. I did not test it thoroughly though. Thanks for that .

    Anyway, just tried, and now it seems to work fine.

    Thanks !

     
  • Arkshine
    Arkshine
    2011-03-01

    It's actually quite hard to make custom one without parsing like does ctag. :p

    Like, tried to match for example only :

    myFunction()
    {

    }

    (public[]+)?([_]+)\(.*\)[]*\{

    For some reason, your plugin does not like "[]*\{".
    Even without that, it catches too many things. More features to help to build custom ones would be welcomed because I don't feel like to create a new language in ctag. :P

     
  • UFO
    UFO
    2011-03-01

    ..and I don't feel like create one. Looking at your reg expression you seem to know more about it than I do. Sry, but I'm far from being a regex expert!

     
  • Arkshine
    Arkshine
    2011-03-01

    Hehe no problem I was not asking you for that anymay :p. I'm not expert at all, but I was asking more why this part of regex doesn't work, because in my software (RegexBuddy) it works fine, and maybe there is some limitation in your plugin ? There is nothing special in []*\{, where it's supposed to match any spaces + '{' and I don't understand why your plugin when I add that it found nothing.

     
  • UFO
    UFO
    2011-03-01

    For some reason, your plugin does not like "[]*\{".

    1) You need to add a "*" behind your "\{" in order to match your "myFunction()" example!
    2) It's not MY plugin not liking any reg expressions, it's ctags/gnuregex not liking it if at all!
    Don't forget that SourceCookifier is only a front-end for ctags..

     
  • Arkshine
    Arkshine
    2011-03-01

    1) If you look carefully "*" is already here. Or I don't understand what you mean. But I still don't understand why it works fine in RegexBuddy. There is severals regex flavor (java, perl, etc.), It's on GNU ERE. Look :
    It works fine and it's on GNU. So I don't get, more when I don't use something specific to a regex flavor. I'm lost. :(

    2) Ok, what I want to know. So, if it doesn't display, something wrong or not supported with the current regex flavor, but here it's weird. Without []*\{ it finds well. In my example, after '()' you have only spaces before the '{', so []*\{ should be okay.

    Sorry to bother you with regex, but it should work as it is.

    Thanks for your help.

     
  • UFO
    UFO
    2011-03-01

    1) Your RegexBuddy supports multiple lines, while ctags does NOT(!) support parsing multiple lines.
    Do you see that your expression matches 2 lines at once? That it matches the "{" in the 2nd line only?
    You can't do that with ctags(!).. this is not a SourceCookifier problem, but a ctags one.

    2) I said "*" BEHIND(!) your "\{". So it would only work if you'd use "[]*\{*".
    Notice the "*" at the end. But the "\{*" wouldn't make sense then anyway.

    But there we go.. the misunderstanding was, that you expected that you can
    match multiple lines of code with one reg expression. But ctags doesn't support
    such things. For more complex code parsing ctags doesn't use regex - it
    programmatically parses code..

     
  • Arkshine
    Arkshine
    2011-03-01

    Ok, it's clear now. :P

    But I give up. Will use the C with the extension .sma. If I remember FunctionList is more flexible to handle such problem. (:P)

    Really that's not practical at all to create custom language with your plugin. I hope this part will be improved a day.

    Thanks for your help, greatly appreciated.