Home Download Buy Blog Forum Support

Job: $20 for creating a really simple difinition syntax.

Job: $20 for creating a really simple difinition syntax.

Postby kjemmo on Wed Apr 04, 2012 5:27 pm

If you have the routine this will take you half an hour.

I need a really simple syntax with just six really simple regex patterns.

You need to match simple tags like #k# and #j# really simple.

There are also two levels of folding.

PM me if you are interested.
kjemmo
 
Posts: 10
Joined: Sun Apr 01, 2012 9:36 am

Re: Job: $20 for creating a really simple difinition syntax.

Postby nick. on Wed Apr 04, 2012 5:47 pm

Most people here are pretty generous with their time. If you post things in a bit more detail I'd be willing to help you out for free.

Syntax definitions do not let you specify code folding levels at the moment (the key is there, but it is ignored).

Edit: From what you've mentioned so far...
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>name</key>
   <string>kjemmo</string>

   <key>scopeName</key>
   <string>source.kjemmo</string>

   <key>patterns</key>
   <array>
      <dict>
         <key>name</key>
         <string>keyword.k.kjemmo</string>
         <key>match</key>
         <string>#k#</string>
      </dict>

      <dict>
         <key>name</key>
         <string>keyword.j.kjemmo</string>
         <key>match</key>
         <string>#j#</string>
      </dict>
   </array>

</dict>
</plist>
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

Re: Job: $20 for creating a really simple difinition syntax.

Postby kjemmo on Wed Apr 04, 2012 6:09 pm

Thanks for the positive reply Nick.

Im am glad to be in friendly place :D

Here are the tags highlighted, That I would like to stand out from ordinary text (like plain english).

#S#
#SB#
#P#
#BP#
#EP#


The regex could be a simple as e.g.
Code: Select all
(\#S\#)

Regarding code folding. Are there another way to define that?

Thanks again.
kjemmo
 
Posts: 10
Joined: Sun Apr 01, 2012 9:36 am

Re: Job: $20 for creating a really simple difinition syntax.

Postby kjemmo on Wed Apr 04, 2012 6:14 pm

Sorry did not see your code example.

Will try to do it and post the result.
kjemmo
 
Posts: 10
Joined: Sun Apr 01, 2012 9:36 am

Re: Job: $20 for creating a really simple difinition syntax.

Postby nick. on Wed Apr 04, 2012 6:23 pm

Should be pretty straightforward, as you've said. Remember that syntax coloring is a separate process handled by a .tmTheme file.

I recall a thread on here about creating code folds via a plugin, but I can't find it. This thread popped up today though, seems relevant.
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

Re: Job: $20 for creating a really simple difinition syntax.

Postby kjemmo on Wed Apr 04, 2012 10:28 pm

Thanks.

I made it work. All the talk about converting from json and new file extension like .tmLanguage confused me.

It turn out that this is dead simple XML like Nick described. No need for any conversion simple enough to write in XML.

Still had to figure out how to make a new package/folder - that only acts as a folder when accessed from sublime text.

The different colors comes with the:

<string>keyword.S.kjemmo</string>

Is there a list of the words that can be used somewhere?

And is it possible to edit an existing color theme?

I will look into 'RegReplace' it seems very usefull for a lot of things.
kjemmo
 
Posts: 10
Joined: Sun Apr 01, 2012 9:36 am

Re: Job: $20 for creating a really simple difinition syntax.

Postby nick. on Wed Apr 04, 2012 11:53 pm

The colors come from the scope, which is defined by the "name" tag. So if you have
Code: Select all
<key>name</key>
<string>this.is.my.scope.name</string>


You could give that a specific color/style in the color scheme (.tmTheme) file. Moreover, you can use CSS-like syntax to be as generic or specific as you want. So you could give this a color, and this.is another color, and this.is.my.scope another, and so on. The most specific scope gets the color. This is all better described here and here. The latter describes the accepted scope hierarchy, but you can create a scope with any name. You'll just have to manually add support in the .tmTheme if you leave the standard naming conventions.

You can edit the color scheme as you would any other file. The built in schemes are located in /Packages/Color Scheme - Default/ . Take a look there; you can also check out my sublime-settings repo for the custom syntax scheme I use.
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

Re: Job: $20 for creating a really simple difinition syntax.

Postby kjemmo on Thu Apr 05, 2012 9:02 am

Thanks again Nick.

Starting to see the opportunities here - I think Sublime text 2 just became my preferred editor!
kjemmo
 
Posts: 10
Joined: Sun Apr 01, 2012 9:36 am

Re: Job: $20 for creating a really simple difinition syntax.

Postby quodlibet on Fri Apr 06, 2012 6:29 am

kjemmo wrote:I made it work. All the talk about converting from json and new file extension like .tmLanguage confused me.

It turn out that this is dead simple XML like Nick described. No need for any conversion simple enough to write in XML.



tmLanguages are in PLIST, which, yes, is XML. The reason to switch back and forth between PLIST and JSON is that the latter is a lot less cumbersome to write out.

The PlistJsonConverter plugin allows converting between the two as does (I think) AAAPackageDev.
quodlibet
 
Posts: 511
Joined: Sat Jun 18, 2011 5:53 pm

Re: Job: $20 for creating a really simple difinition syntax.

Postby nick. on Fri Apr 06, 2012 1:23 pm

JSON is certainly easier to write out from the key/value standpoint, and I think it's more readable as well, but since a language file is mostly regex, and in JSON you have to do tons of extra regex escaping, I find it easier to just work staight in PLIST/XML. If you turn on Sublime's autocompletion and make use of Alt + . , it's not bad at all to write all those open/close tags.
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

Next

Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 18 guests