lex class definition for "C language" string |
Post Reply |
Author | |
popek_777
Newbie Joined: 01 June 2014 Status: Offline Points: 2 |
Post Options
Thanks(0)
Posted: 01 June 2014 at 2:25pm |
I'm trying to define lex class definition for C strings. First step was to take a class definition
from one already defined in codejock samples. It looks like below (taken from file _cpp.schclass): lexClass: name = c_String parent:dyn = c_CPP, c_CPPCodeBlock children = c_URL start:Tag = '"' skip:Tag = '\\"', '\\\r\n', '\\\n\r', '\\\n', '\\\r' end:Tag = '"', @eol txt:colorFG = 0xE00000 DisplayName = 'String (Double Quotes)' Class above does not cope well with text like one below: "c:\\fdsasdf\\" + 333.3 result: whole line is colored like text expected: only text between quotes is colored like text To fix this issue I thought that when I additionally skip '\\' it will to the job but this didn't help. Does anyone have an idea how to define C like string lex class to cope well with scenario described above? |
|
flashermail
Newbie Joined: 01 July 2014 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
you have to change the skip:tag section, so that it looks like that:
lexClass: name = c_String parent:dyn = c_CPP, c_CPPCodeBlock children = c_URL start:Tag = '"' skip:Tag = '\\\r\n', '\\\n\r', '\\\n', '\\\r' end:Tag = '"', @eol txt:colorFG = 0xE00000 DisplayName = 'String (Double Quotes)' But if you would like to get something like this: 1 "c:\\fdsasdf\\" + 333.3 2 3 "c:\\fd\n\r 4 5 sasdf\\" + 333.3 You need to change it to: lexClass: name = c_String parent:dyn = c_CPP, c_CPPCodeBlock children = c_URL start:Tag = '"' skip:Tag = '\\\r\n', '\\\n\r', '\\\n', '\\\r', '\n', '\n\r', '\r\n', '\r' end:Tag = '"', @eol txt:colorFG = 0xE00000 DisplayName = 'String (Double Quotes)' Best regards Flashermail |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |