New UserDefinedLanguage module

Loreia2
2011-07-30
2015-04-30
<< < 1 .. 22 23 24 25 26 27 > >> (Page 24 of 27)
  • Loreia2

    Loreia2 - 2013-03-31

    Hi Defiant Plumber,

    ~~~~~~~~~~~~~~~~~~~~
    First thing: thank you very much for this incredible work :)
    I love it.

    Thanks.
    

    My problem is that I cannot figure how to make comments colorized in all above cases and not in multiplication.
    ~~~~~~~~~~~~~~~~~~~~~~~

    I was able to achieve it, it works for this simple code snippet, but it may be hard to define entire language in this way.

    1) you define line comments normally, that covers first four cases
    (note that these four cases are also covered by Delimiter3 below)

    2) define operators and delimiters like this:

    Breakdown:
    Delimiter1: starts with = and extends until end of line
    Delimiter2: starts with ; and extends until end of line
    Delimiter3: starts with * and extends until end of line

    Delimiter1 allows nesting of Delimiter2
    Delimiter2 allows nesting of Delimiter3

    In this way you allow Delimiter3 only outside Delimiter1 and inside Delimiter2.
    But this is relatively complex, and it won't work with Official Notepad++ release (I just compiled a brand new beta to achieve this). New beta version will be available in few days if you want to play with it, but I recommend a simpler solution:

    1) Define line comments as starting with double asterisk (**), and set "Allow anywhere"
    2) Define multiplication as one asterisk (*)

    Adjust you code like this:

    ~~~~~~~~~~~~~~~~~~~~~~~~
    This is comment
    This is comment too
    This is also comment (with preceding whitespace)

    Multiplication below:
    VAR1 = VAR2 * VAR3 ; comments can start after semicolon
    VAR4 = VAR5 * VAR6 ;
    comments after semicolon and space
    VAR7 = VAR8 * VAR9 ; ** another comment
    ~~~~~~~~~~~~~~~~~~~~~~
    And it should work right away.
    This is still within you syntax rules (good), but it requires changing current code base (bad).

    That is what I can do for you right now. New major update to UDL should bring better support for this kind of problem (strings with multiple meaning, depending on position and context)

    BR,
    Loreia

     
  • Foolish Mortal

    Foolish Mortal - 2013-07-11

    I'm very interested in having having a wildcard for whitespace, like ((SPC)) suggested above.

    The problem I want to solve is this:
    delimiter

    I want it ';['..';]' to collapse like the top-right snapshot, but with ';' instead of ';,' for comments.

    I really appreciate what you've created here! Thanks!

     
  • Loreia2

    Loreia2 - 2013-07-13

    Hi Foolish Mortal (LOL at nickname):

    you can already achieve what you want in UDL2.
    Just define ';' as line comment, and then set "Folding in comment" to:
    open: '['
    close: ']
    '

    BR,
    Loreia

     
  • Foolish Mortal

    Foolish Mortal - 2013-07-25

    Thank you Loreia! That does exactly what I want.

     
  • ILLICO

    ILLICO - 2013-09-20

    Hi all,

    See below a logging text example I would like to highlight:

    ...
    2013-09-20 09:41:40,665 DEBUG [DBLogDAOImpl] Checking if script 'script-0.6.2.sql' has been run
    2013-09-20 09:41:40,665 DEBUG [DBLogDAOImpl] Checking if script 'script-1.0.sql' has been run
    2013-09-20 09:41:40,665 DEBUG [DBLogDAOImpl] Checking if script 'script-1.1.sql' has been run
    2013-09-20 09:41:40,665 DEBUG [DBLogDAOImpl] Checking if script 'script-1.2.sql' has been run
    2013-09-20 09:41:40,665 DEBUG [DBLogDAOImpl] Checking if script 'script-1.2.1.sql' has been run
    2013-09-20 09:41:40,681 DEBUG [DBLogDAOImpl] Checking if script 'script-1.3.sql' has been run
    ...
    2013-09-19 19:09:31,543 INFO [EventDispatcher] Leaving EventDispatcher
    2013-09-19 19:09:31,643 WARN [MultiCastUtils] Could not find NIC with name 'eth6-0'
    2013-09-19 19:09:31,643 WARN [LocalAddressResolverStrategy] Haven't found IP address for NIC eth6-0, will try again 9 times
    2013-09-19 19:09:31,687 WARN [MultiCastUtils] Could not find NIC with name 'eth6-0'
    2013-09-19 19:09:31,687 WARN [LocalAddressResolverStrategy] Haven't found IP address for NIC eth6-0, will try again 8 times

    In fact I use Delimiter Style with:
    Open= '
    Close= '

    so 'script-0.6.2.sql', 'eth6-0' has been matched : OK

    but I have problem with - Haven't - text that I don't want to matched.

    Is it possible to have something like this, so space is taking into account ?
    Open= ((SPC))'
    Close= '((SPC))

     
  • Loreia2

    Loreia2 - 2013-09-20

    Hi ILLICO,

    Is it possible to have something like this, so space is taking into account ?
    Open= ((SPC))'
    Close= '((SPC))

    I am experimenting with something similar for UDL3. If it works out fine, you will be able to distinguish between 'string' and haven't in your log.
    For the time being, either do a replace in your log ("haven't" for "havent"), or define delimiter open sequence as:
    OPEN: (('script 'eth))
    CLOSE: '

    BR,
    Loreia

     
    • ILLICO

      ILLICO - 2013-09-20

      Thanks,

      I will wait for UDL3.

       
  • Nikolai Neff

    Nikolai Neff - 2013-10-08

    Hi!
    First of all many thanks for the great UDL support in Notepad++!

    I am however having some problems to get the folding to work properly. (See attachment)
    Sometimes the folding Markers Appear, sometimes they don't, and sometimes they are at seemingly random positions. Even if they are at their intended location, they sometimes make the document jump around, but at least they fold the indicated parts.

    I suppose I'm setting thins up in a wrong way, but I'm pretty much stuck here now.

    Also, but mostly unrelated: is there a way to use the already existing NP++ languages as a base for UDL? This could be really useful if you just wand to add a few keywords or separate them into groups and so on without changing the original language definition.

    Let me know if you need any more information and again thanks!

     
  • Loreia2

    Loreia2 - 2013-10-09

    Hi ILLICO,

    I know it is late, but I just re-read you post and I realized you can solve your problem by defining haven't as Operator1 type. In this way apostrophe in the middle of the word can never trigger Delimiter start.

    BR,
    Loreia

     
    • ILLICO

      ILLICO - 2013-10-17

      Thanks, that solve the problem with n't, but I also have lost of french sentences with c'est, L', etc. So this is not 100% solution.

       
      • Loreia2

        Loreia2 - 2013-10-17

        Hi ILLICO,

        this just a quick patch, real solution will be available in UDL3. For now, just build a list of words that you use and that contain apostrophe sign. Its not prefect, but that's the best UDL2 can do.

        BR,
        Loreia

         
  • Loreia2

    Loreia2 - 2013-10-09

    Hi Nikolai,

    this is a bug that I resolved few weeks ago, but never found time to send patch to Don. However you can use beta version that has a patch build in. Download it from here:

    http://goo.gl/Bo3emS

    BR,
    Loreia

     
    • Nikolai Neff

      Nikolai Neff - 2013-10-09

      Thank you for your quick reply, I'll give it a go.

       
  • Mordachai

    Mordachai - 2013-10-23

    Improvements:

    expression separators (e.g. ;)
    multiple separate folding lists
    ((SOL)) start of line
    ((SPC)) whitespace
    suffix keyword (in addition to prefix keyword)
    somehow, resolve ' being both an apostrophe, and a possible delimiter...
    The ability to put more than one possible ending in close, such as ((EOL)) ' might help?
    But this last one - confusion / inability to distinguish a symbol that is both used as a delimiter pair () [] '' but can also occur in other contexts is IMO the biggest limitation.

    Overall, great stuff. :)

     
    Last edit: Mordachai 2013-10-23
  • Mordachai

    Mordachai - 2013-10-23

    Bug: why would 1.0 be formatted with the 1 colorized as a number, but the .0 be uncolorized (default color)?

    .5 works, 300 works, but nnn.mmm fails (I've set zero prefixes or extras or suffixes etc., in number style)

    Changing decimal separator has no apparent effect (N++ 6.5)

     
    Last edit: Mordachai 2013-10-23
  • Cyrillev

    Cyrillev - 2013-11-16

    hi,

    Thank you for this UserDefinedLanguage module.

    I use a language with comments are defined:
    Start with: C flag (only on 1st columm)
    End with: $ (not necessary on the same line)

    4 examples:
    C commentary example $

    C multiline
    commentary example $

    C080000 GO TO, STEP 100000 $

    C100000 CALCULATE,
    'pi' = 3.14 $

    Please help me for setup UserDefinedLanguage module for this comment.

    (Sorry for my English)
    Cyrillev

     
  • Loreia2

    Loreia2 - 2013-11-18

    Hi Cyrillev,

    UDL 2.0 can't help here. Sorry about that. Only LINE COMMENTS (not multi-line comments) support positional limitation.

    New UDL 3.0 lifts this restriction, and allows all types to define position.
    Subscribe to this thread to get notification when UDL3.0 matures enough for beta testing phase.

    BR,
    Loreia

     
  • jxtor

    jxtor - 2013-12-06

    Hi Loreia, I have the following issue with numbers and UDL. In my language, $ can be used for two purposes: to reference a global variable, in the form $foo, and also as a number shortcut meaning the size of the currently-referenced array, in these forms: array[$], array[2..$]. For clarification, .. is used to indicate a range.

    In order to fulfill the first purpose, I have set $ as a prefix-style keyword. I have also set .. as a range character. However, there is no way I have found to allow me to tell UDL to treat $ as a number. I can use ..$ as a suffix2 in order to make [2..$] work, but only if I remove .. as my range character, which is no good. I could also set $ as a non-prefix keyword to achieve highlighting for array[$], but then array[2..$] will no longer be recognized as a range.

    Is there any way for me to get this working in UDL?

     
  • jxtor

    jxtor - 2013-12-06

    Another thing, although much more minor: . is an operator of sorts (actually references a property of objects) in my language when used on variables, and numbered objects starting with #, like #123456.name. However, it has the usual meaning of a decimal place when used in a constant number, like 50.5. It'd be nice if there were some way to tell UDL not to treat it as an operator when used in the middle of a number with no # prefix.

     
    Last edit: jxtor 2013-12-07
  • Loreia2

    Loreia2 - 2013-12-10

    Hi jxtor,

    UDL does not support extending range number characters. Only digits 0123456789 represent numbers. If you need to go beyond that, you need to define prefix that is followed by a number character (one of 0123456789). Prefix on its own does not represent a number in UDL.

    I guess in your case I should add Prefix3 option where Prefix3 type would represent number on its own. This would be an interesting option for UDL3.X phase.

    It'd be nice if there were some way to tell UDL not to treat it as an operator when used in the middle of a number with no # prefix.

    This is indeed a bug. Not because I made some mistake in the code, but simply because I never thought of such a combination :-)
    I will fix it in UDL3.0.

    BR,
    Loreia

     
  • jxtor

    jxtor - 2013-12-13

    Thank you for your reply, Loreia. I will look forward to UDL 3!

    One other thing I have discovered that would be very useful would be the following. I have used the keywords feature to highlight the built-in functions of my languages. However, these keywords are then always highlighted, whether or not they are actually being used as a function.

    For example, I was just looking at a piece of code that contained the statement:

    class = x:class();

    In this case, "class" by itself is merely a variable, whereas x:class() is calling the built-in class function on object x. My UDL setup, however, will highlight both instances of 'class' the same way. I would suggest that there be a method to select whether a group of keywords should only be highlighted if preceded or succeeded by certain operators or, especially, by delimiters.

    In this way, all languages that use functions like foo(args) would be able to highlight 'foo' only when it is a function, as denoted by the () afterwards.

    Please forgive me if such a feature already exists, but I have not been able to find it.

    Cheers!

     
    Last edit: jxtor 2013-12-13
  • amb

    amb - 2013-12-21

    Code folding works fine if file has Windows EOL format, but is misaligned when file has Unix EOL format. I am using v6.5.2. Is there a patch available to fix this problem. Thanks.

     
  • xsxs

    xsxs - 2013-12-30

    Hi, may be this thread would have been better than the help section for my question in help.

    So here I formulate it as suggestion.

    Unfortunately only blank ' ' and ',' are stopping prefix mode from the keyword-tab to continue eating up the next characters so that for example the bracket-highlighting can't recognize their corresponding opening or closing bracket.

    a) Wouldn't it make sense if the brackets () and {} and [] as well stop the prefix mode and/or
    b) the user has the option to define in the style-section of the keywords characters that stops it?

    I am working with a userdefined-Language.

    Second suggestion would it be possible to add automatically all the keywords to the spell-check?

    Thanks in advance xsxs

     
  • Loreia2

    Loreia2 - 2013-12-30

    Hi xsxs,

    prefix mode ends when any forward-matching type starts (Operator1, Folder in code 1, Delimiters, Comments). In your case, just define () and {} and [] as Operator1 type and you will get desired effect.

    BR,
    Loreia

     
  • mzvarik

    mzvarik - 2014-01-28

    There's one major problem with this plugin:
    It doesn't allow to add a parsing to existing one, like HTML.

    Someone made a Smarty template (*.tpl) available, but it's useless since you lose all the HTML code styling.


    I tryed to edit the Notepad++ XML files, just to add simple {{ syntax }} to be recognized as comment, but files stylers.xml, langs.xml... don't react :-(

     
    Last edit: mzvarik 2014-01-28
<< < 1 .. 22 23 24 25 26 27 > >> (Page 24 of 27)

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks