Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Syntax Edit
  New Posts New Posts RSS Feed - coloring and code folding
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

coloring and code folding

 Post Reply Post Reply
Author
Message Reverse Sort Order
flashermail View Drop Down
Newbie
Newbie


Joined: 01 July 2014
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote flashermail Quote  Post ReplyReply Direct Link To This Post Topic: coloring and code folding
    Posted: 29 July 2014 at 4:10am
Here an other example how it should look like:

-switch ( i )
|  case 1
|    b='1';
|  case 2
|  case 3
|    b='2';
|  otherwise
|    b='3';
∟end

-for i=1:10
|  a(i)=i+0.1;
if i == 7
|    break;
else
|    continue;
∟  end
∟end

I got it to work, but there are still some small issues.

The coloring only works partial, it depends on the size of the screen. Any ideas ? It would be really great if someone could reply.

So if the screen has just the size to see that

-switch ( i )
|  case 1
|    b='1';
|  case 2
|  case 3
|    b='2';

it looks like this:

-switch ( i )
|  case 1
|    b='1';
|  case 2
|  case 3
|    b='2';
|  otherwise
|    b='3';
end

-for i=1:10
|  a(i)=i+0.1;
if i == 7
|    break;
|  else
|    continue;
∟  end
end

and sometimes like that:

-switch ( i )
|  case 1
|    b='1';
|  case 2
|  case 3
|    b='2';
|  otherwise
|    b='3';
end

-for i=1:10
|  a(i)=i+0.1;
-  if i == 7
|    break;
|  else
|    continue;
∟  end
end

Here the schclass code:

lexClass:
  name          = c_M 
  parent:file   = <*.m> 
  caseSensitive = 1
  DisplayName   = 'Normal Text'

  global:FirstParseInSeparateThread           = 1    // {0,1} default=1
  global:EditReparceInSeparateThread          = 0    // {0,1} default=1
  global:ConfigChangedReparceInSeparateThread = 0    // {0,1} default=1
  global:EditReparceTimeout_ms                = 500  // default= 500 ms; time out for start reparse after last key was pressed.
  global:MaxBackParseOffset                   = 100  // default= 100 chars; maximum back buffer size. Some times parser look back for the text from current position.
  global:OnScreenSchCacheLifeTime_sec         = 180  // default= 180 sec; -1 and 0 means infinite; time out for on screen parsed pices of text. for memory using optimization.
  global:ParserThreadIdleLifeTime_sec         = 60

 
lexClass:
  name                   = c_MControlStatementsStartKeywords
  ParseOnScreen           = 1
  parent:dyn             = c_M
  DisplayName             = 'Start Keywords for Control Statements'
  token:tag              = 'else', 'for', 'if', 'while', 'switch', 'elseif'
  token:start:separators = ' ', '\t', '\r', '\r\n', '\n\r', '\n', ';'
  token:end:separators   = ' ', '\t', '\r', '\r\n', '\n\r', '\n', '('
  txt:colorFG             = 0x0000FF
  txt:bold               = 0

 
lexClass:
  name                   = c_MControlStatementsEndKeywords
  ParseOnScreen           = 1
  parent:dyn             = c_M
  DisplayName             = 'End Keywords for Control Statements'
  token:tag              = 'end'
  token:start:separators = ' ', '\t', '\r', '\r\n', '\n\r', '\n', ';'
  token:end:separators   = ' ', '\t', '\r', '\r\n', '\n\r','\n'
  txt:colorFG             = 0x0000FF
  txt:bold               = 0

 
lexClass:  
  name           = c_MControlStatements
  parent:dyn     = c_M, c_MControlStatements
  children       = c_String_char, c_MKeywords, c_MControlStatements
  start:Tag      = 'for', 'if', 'while', 'switch'
  previous:tag   = ' ', '\t', '\r', '\r\n', '\n\r','\n', ';'
  skip:Tag       = 'elseif'
  end:tag        = ' end', '\tend', '\rend', '\r\nend', '\n\rend','\nend'
  end:separators = ' ', '\t', @eol
  Collapsable     = 1
  caseSensitive   = 1
  CollapsedText   = '<!-- hidden control statements //-->'
  DisplayName     = 'Control Statements'
 
 
lexClass:  
  name            = c_String_char 
  parent:dyn      = c_M, c_MControlStatements
  children        = 0
  start:Tag       = '\''
  end:Tag         = '\'', @eol
  txt:colorFG     = 0x990099
  DisplayName     = 'Character'

 
lexClass: 
  name            = c_MKeywords
  parent:dyn      = c_M, c_MControlStatements
  children        = 0
  DisplayName     = 'Keyword'
  token:tag  = '+'
  token:tag  = '='
  token:tag  = '=='
  token:tag  = '('
  token:tag  = ')'
  token:start:separators = ' ', '\t', '\r', '\r\n', '\n\r','\n', @alpha, @digit, ')', '(', '\''
  token:end:separators   = ' ', '\t', '\r', '\r\n', '\n\r','\n', @alpha, @digit, ';', @eol, ')' , '~' , '(', '\''
  txt:colorFG            = 0x0000FF
 

Many Thanks
 Flashermail
Back to Top
flashermail View Drop Down
Newbie
Newbie


Joined: 01 July 2014
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote flashermail Quote  Post ReplyReply Direct Link To This Post Posted: 01 July 2014 at 11:00am
Hi All,

Would like to know how to go about coloring the start and end keywords and do as well code folding. The below is a prime example:

+if NOT isnull( maxi )
+    if ( iLen > 0 )
+        for i = 1:length( Comp )
+            while i < 6
                iStart = i;
-           end
-        end
-    end
 elseif
    iStart = 0;
 else
    iStart = 3;
-end


Start keywords should be: if, while, for, switch
End keyword should be: end

for all of them I would like to get code folding (marked with + and - in the code above).

I played a lot with the syntax, but not able to get it to work. It looks like that only coloring is possible or code folding :(

Many thanks
 Flashermail
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.