Syntax highlighter

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ivelink
Posts: 7
Joined: Thu Nov 27, 2014 1:12 pm

Syntax highlighter

Post by ivelink » Mon Mar 09, 2015 3:18 pm

Hello
I am trying to make a python code editor that highlights keywords, operators and strings.
The problem of course is with the quotes as Python supports single, double and triple quotes for strings.
Ex:
x = 'some text'
x = "some text"
x = '''some text'''

Also i can't find a way to go back and modify my "script" in the field.
I tried with pass keyDown but it doesn't work well
How would you approach the problem ?


Thanks
Attachments
highlight.rar
(1.39 KiB) Downloaded 196 times

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Syntax highlighter

Post by dunbarx » Mon Mar 09, 2015 4:40 pm

Hi.

Triple quotes? Is that a single char, or a single and a double quote stuck together? The itemDelimiter can be set to any char, and in v.7 (I believe) the itemDel can be a string of any length.

Does this help? If the itemDel can be of any length, I suppose it can be set to a string consisting of a single and a double quote. Now you should be able to parse your data.

Craig Newman

Post Reply