Menu

RegEx syntax highlighting

Greg
2009-03-21
2012-11-13
  • Greg

    Greg - 2009-03-21

    In Open Discussion https://sourceforge.net/forum/message.php?msg_id=6886816, Wazar asked how he could create syntax highlighting for regular expressions.

    This is something I've tried to do but the current user defined language feature cannot address a language where the keywords are not terminated by spaces.

    In https://sourceforge.net/forum/message.php?msg_id=6890391, AirDrik has called for a better function for user defined languages and has suggested using regular expressions to define language elements.

    For those of us that can't, we can only make polite suggestions and hope that those of us that can take them up.

     
    • Thell Fowler

      Thell Fowler - 2009-04-03

      "For those of us that can't, we can only make polite suggestions and hope that those of us that can take them up. "

      How about giving it a try, report what was tried and the results?  Or how about what specs would constitute a successful implementation, and perhaps other projects that already have the desired capabilities?

      I'd really like to see such an animal and would be willing to [b]join[/b] forces with others to make it a reality.

      almostautomated

       
    • Igor Stepanov

      Igor Stepanov - 2009-04-03

      Good day. I think, that it is a good idea, the implementation of user-defined languages using regular expressions.
      Make it make sense for example: the user writes in a separate list of rules for the language file
      for example, in the style css.

      . RegExp (
         rule: /\/\.\//
         color: #cc00cc;
         size: 12;
         weight: normal;
         font: Arial;
         style: normal;
         closable: yes;
      )

      . RegExp.MetaSymbol (
         rule: / \ \ [\d\w]/
         color: #ff00cc;
         size: 12;
         weight: bold;
         font: Arial;
         style: normal;
         closable: no;
      )

      Closable parameter sets - can turn an object, if it is stretched for a few lines.

       
      • Bill Wire

        Bill Wire - 2009-04-03

        Should something like that be atttempted, for Gods sake wrap the regex in a gui builder of some kind.  A great many otherwise competent people regard regex as dark magic.  I myself love the power they give, but don't count myself an expert by any stretch.

        Such a feature would also allow you to "define" an IF-ELSE-ENDIF set as "one" fold-able block of code.

        It'd also be nice if it could be used to define alternative [{( characters to be BEGIN ... END so you could use the find/highlight matching to show code blocks in languages that use other than single characters.

         
MongoDB Logo MongoDB