{"id":200,"date":"2012-09-01T00:10:45","date_gmt":"2012-08-31T22:10:45","guid":{"rendered":"http:\/\/ksquared.de\/blog\/?p=200"},"modified":"2015-07-10T22:51:35","modified_gmt":"2015-07-10T20:51:35","slug":"objectivec-regexhighlightview","status":"publish","type":"post","link":"https:\/\/kra.lc\/blog\/2012\/09\/objectivec-regexhighlightview\/","title":{"rendered":"Objective-C &#8211; (Syntax) Highlighting with Regex &#038; CoreText"},"content":{"rendered":"<p>Long time no see. It took me nearly nine month to figure this one out! No&#8230;, just kidding. This one took me in fact one day, but I was very busy writing by bachelor thesis and finishing my final exams in university. Sorry for the long period of starving and be curious about what is going to happen in future.<\/p>\n<p>Without further ado, let me tell you what I have been working on today. This time it is an Objective-C component. Very similar to my <a href=\"http:\/\/ksquared.de\/wfe\/\">Wordfile Editor Plugin<\/a> for <a href=\"http:\/\/www.eclipse.org\/\">Eclipse<\/a>, it can be used to dynamically highlight and display any kind of text based programming language or other structured data. The goal was to create a simple, but yet powerfull component to make nice syntax editing possible on Cocoa and iOS.<\/p>\n<p><!--more--> <\/p>\n<p>Unlike my Eclipse plugin, the component is not based on a fullblown parser to make syntax highlighting possible, instead I decided to use a set of regular expressions, to get the highlighting to work. Using regular expressions is sufficient for most structured programming language and should be enough to provide at least a basic highlighting.<\/p>\n<p>I have included eight predefined color schemes (themes) into the component. So the developer can freely pick one of these or define his own color scheme. For even simpler usage I have provided regular expression sets for these programming languages:<\/p>\n<p>\n<code>actionscript, actionscript3, active4d, ada, ampl, apache,<br \/>\napplescript, asm-mips, asm-x86, asp-js, asp-vb, aspdotnet-cs,<br \/>\naspdotnet-vb, awk, batch, c, cobol, coldfusion, cpp, csharp,<br \/>\ncsound, css, d, dylan, eiffel, erl, eztpl, fortran, freefem,<br \/>\ngedcom, gnuassembler, haskell, header, html, idl, java, javafx,<br \/>\njavascript, jsp, latex, lilypond, lisp, logtalk, lsl, lua,<br \/>\nmatlab, mel, metapost, metaslang, mysql, nemerle, none, nrnhoc,<br \/>\nobjectivec, objectivecaml, ox, pascal, pdf, perl, php, plist,<br \/>\npostscript, prolog, python, r, rhtml, ruby, scala, sgml, shell,<br \/>\nsml, sql, standard, stata, supercollider, tcltk, torquescript,<br \/>\nudo, vb, verilog, vhdl, xml<\/code><\/p>\n<p>Further information on how to use the component and the source code of the project can be found on <b>GitHub<\/b>. I have created a public repository for the project, please check it out here:<\/p>\n<p><b><a href=\"https:\/\/github.com\/kristian\/RegexHighlightView\">https:\/\/github.com\/KayK\/RegexHighlightView<\/a><\/b><\/p>\n<p>Hope you enjoy the component, feel free to leave suggestions in the comments below!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Long time no see. It took me nearly nine month to figure this one out! No&#8230;, just kidding. This one took me in fact one day, but I was very busy writing by bachelor thesis and finishing my final exams in university. Sorry for the long period of starving and be curious about what is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[124,135,123,45,129,131,130,125,127,126,120,122,121,19,132,136,134,133,128],"class_list":["post-200","post","type-post","status-publish","format-standard","hentry","category-release","tag-cocoa","tag-color","tag-coretext","tag-highlighting","tag-ios","tag-ipad","tag-iphone","tag-objc","tag-objective-c","tag-objectivec","tag-regex","tag-regexp","tag-regular-expression","tag-syntax","tag-syntax-highlighting","tag-text","tag-textview","tag-uitextview","tag-wfe"],"_links":{"self":[{"href":"https:\/\/kra.lc\/blog\/wp-json\/wp\/v2\/posts\/200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kra.lc\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kra.lc\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kra.lc\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kra.lc\/blog\/wp-json\/wp\/v2\/comments?post=200"}],"version-history":[{"count":16,"href":"https:\/\/kra.lc\/blog\/wp-json\/wp\/v2\/posts\/200\/revisions"}],"predecessor-version":[{"id":394,"href":"https:\/\/kra.lc\/blog\/wp-json\/wp\/v2\/posts\/200\/revisions\/394"}],"wp:attachment":[{"href":"https:\/\/kra.lc\/blog\/wp-json\/wp\/v2\/media?parent=200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kra.lc\/blog\/wp-json\/wp\/v2\/categories?post=200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kra.lc\/blog\/wp-json\/wp\/v2\/tags?post=200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}