Home Download Buy Blog Forum Support

syntax color

syntax color

Postby sroux on Sat Oct 13, 2012 7:06 am

Hi,

I'm writing a new language syntax and having issue on changing colors. How do I manage changing colors according to the language functions I'll using? Indeed every command have the same color may it be control flow, conditional or functional...
Is there a scopename keywords list? (source, keyword, keywords, support, string, punctuation...). I'm a bit lost here.

I had a look at this but still cloudy

Here a sample of my work :

{ "name": "Essbase calc script",
"scopeName": "source.esscalcscript",
"fileTypes": ["csc"],
"patterns": [

{ "match": "(?i:(fix|endfix|exclude|endexclude|loop|endloop))",
"name": "keyword.commands.controlflow.csc",
"comment": "control flow commands"
},

{ "match": "(?i:(if|endif|else|elseif))"
"name": "keyword.commands.conditional.csc",
"comment": "conditional commands"
},

{ "match": "(?i:(agg|calc all|calc average|calc dim|calc first|calc last|calc twopass|cconv|clearblock|clearcctrack|cleardata|datacopy|dataexport|dataexportcond|dataimportbin|set dataexportoptions|set dataimportignoretimestamp|set aggmissg|set cache|set cctrackcalc|set clearupdatestatus|set frmlbottomup|set frmlrtdynamic|set lockblock|set msg|set notice|set remotecalc|set updatecalc|set uptolocal))",
"name": "keyword.commands.functional.csc",
"comment": "functional commands"
}
],
"uuid": "e87a28e6-94e5-49f2-8acd-caab0198e602"
}


Many thanks for your help!
sroux
 
Posts: 4
Joined: Fri Oct 12, 2012 9:59 am

Re: syntax color

Postby quodlibet on Sat Oct 13, 2012 9:24 am

sroux wrote:Hi,
How do I manage changing colors according to the language functions I'll using? Indeed every command have the same color may it be control flow, conditional or functional...
Is there a scopename keywords list? (source, keyword, keywords, support, string, punctuation...).


Have a look at: http://manual.macromates.com/en/language_grammars

The relevant part is:

you should “spread out” your naming i.e. instead of putting everything below keyword (as your formal language definition may insist) you should think “would I want these two elements styled differently?” and if so, they should probably be put into different root groups.


That said, you can use whatever naming convention you like in your syntax file and create or edit a colour scheme to style said syntax as you like.

Hope this helps,
Alex
quodlibet
 
Posts: 548
Joined: Sat Jun 18, 2011 5:53 pm

Re: syntax color

Postby agibsonsw on Sun Oct 14, 2012 3:45 am

I don't know if ST-regex recognises (?i: for case-insensitivity - it might be worth checking. But you are not alternating case-sensitivity so you might just use the modifier /i instead.

"match": "(?i:(fix|endfix|exclude|endexclude|loop|endloop))",
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: syntax color

Postby nick. on Wed Oct 31, 2012 1:03 pm

ahiliya fernandes wrote:A JPEG image consists of a sequence of segments, each beginning with a marker, each of which begins with a 0xFF byte followed by a byte indicating what kind of marker it is. Some markers consist of just those two bytes; others are followed by two bytes indicating the length of marker-specific payload data that follows. (The length includes the two bytes for the length, but not the two bytes for the marker.) Some markers are followed by entropy-coded data; the length of such a marker does not include the entropy-coded data. Note that consecutive 0xFF bytes are used as fill bytes for padding purposes, although this fill byte padding should only ever take place for markers immediately following entropy-coded scan data (see JPEG specification section B.1.1.2 and E.1.2 for details; specifically "In all cases where markers are appended after the compressed data, optional 0xFF fill bytes may precede the marker").


What does this have to do with anything?
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

Re: syntax color

Postby bizoo on Wed Oct 31, 2012 1:43 pm

nick. wrote:
ahiliya fernandes wrote:A JPEG image consists of a sequence of segments, each beginning with a marker, each of which begins with a 0xFF byte followed by a byte indicating what kind of marker it is. Some markers consist of just those two bytes; others are followed by two bytes indicating the length of marker-specific payload data that follows. (The length includes the two bytes for the length, but not the two bytes for the marker.) Some markers are followed by entropy-coded data; the length of such a marker does not include the entropy-coded data. Note that consecutive 0xFF bytes are used as fill bytes for padding purposes, although this fill byte padding should only ever take place for markers immediately following entropy-coded scan data (see JPEG specification section B.1.1.2 and E.1.2 for details; specifically "In all cases where markers are appended after the compressed data, optional 0xFF fill bytes may precede the marker").


What does this have to do with anything?

spam
bizoo
 
Posts: 886
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland


Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot] and 17 guests