How To Highlight Custom Syntax

View: New views
5 Messages — Rating Filter:   Alert me  

How To Highlight Custom Syntax

by Graden Hudson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How To Highlight Custom Syntax Hello, everyone.

I would like to know how to extend the syntax styling to highlight a proprietary syntax in my code. When I author html emails, I use the command "%link=%" to denote trackable links like so:
<a href="%link=http://www.link.com/%">Link Text Here</a>

I would like the text "%link=http://www.link.com/%" to be highlighted in blue or something obvious so that I can quickly scan my code to see which links are tracking and which ones aren't. I have tried reading through the TextMate HowTo's and Documentation to learn about extending language grammars in my custom bundle, but I can't make sense of it. Can someone tell me what I need to do to make this happen?

Here is what I was reading:
http://manual.macromates.com/en/language_grammars

Thanks, in advance.
-- 
Graden Hudson
Graphic Designer
Wellness Council of America
9802 Nicholas Street, Ste. 315 | Omaha, NE  68114
Phone: 402.827.3590 | Fax: 402.827.3594
ghudson@...  | www.welcoa.org



_______________________________________________
textmate mailing list
textmate@...
http://lists.macromates.com/listinfo/textmate

Re: How To Highlight Custom Syntax

by Allan Odgaard-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 5 Nov 2009, at 00:06, Graden Hudson wrote:

> I would like to know how to extend the syntax styling to highlight a
> proprietary syntax in my code [...]
> Here is what I was reading:
> http://manual.macromates.com/en/language_grammars

That is indeed the canonical guide explaining how grammars work.

So how much were you able to follow? Do you know regular expressions?  
Did you find the existing HTML grammar and look at that?



_______________________________________________
textmate mailing list
textmate@...
http://lists.macromates.com/listinfo/textmate

Re: How To Highlight Custom Syntax

by Graden Hudson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Re: [TxMt] Re: How To Highlight Custom Syntax Hi, Allan. Thanks for jumping in to help me.

I was able to sort of understand some things like I am obviously going to have to declare a pattern (begins with "%link=" ends with "%"), but  when I read about rule keys like "name" and "match", I am lost. I am primarily an HTML/CSS guy, and I do not delve much into other languages just yet.

Here's a line of code in the example that I simply do not understand, at all:
 7           match = '\b(if|while|for|return)\b';

I did look at the existing HTML grammar, but that did not make much sense to me, either. Should I start somewhere else in the manual? I think I'm missing some basic concepts here.

Thanks, again, for your help.
-- 
Graden Hudson
Graphic Designer
Wellness Council of America
9802 Nicholas Street, Ste. 315 | Omaha, NE  68114
Phone: 402.827.3590 | Fax: 402.827.3594
ghudson@...  | www.welcoa.org



From: Allan Odgaard <mailinglist@...>
Reply-To: TextMate users <textmate@...>
Date: Fri, 6 Nov 2009 04:47:47 +0100
To: TextMate users <textmate@...>
Subject: [TxMt] Re: How To Highlight Custom Syntax

On 5 Nov 2009, at 00:06, Graden Hudson wrote:

> I would like to know how to extend the syntax styling to highlight a
> proprietary syntax in my code [...]
> Here is what I was reading:
> http://manual.macromates.com/en/language_grammars

That is indeed the canonical guide explaining how grammars work.

So how much were you able to follow? Do you know regular expressions?  
Did you find the existing HTML grammar and look at that?



_______________________________________________
textmate mailing list
textmate@...
http://lists.macromates.com/listinfo/textmate


_______________________________________________
textmate mailing list
textmate@...
http://lists.macromates.com/listinfo/textmate

Re: How To Highlight Custom Syntax

by Rob McBroom-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Nov 6, 2009, at 10:57 AM, Graden Hudson wrote:

> Here's a line of code in the example that I simply do not  
> understand, at all:
>  7           match = '\b(if|while|for|return)\b';
>
> I did look at the existing HTML grammar, but that did not make much  
> sense to me, either. Should I start somewhere else in the manual? I  
> think I'm missing some basic concepts here.

If that makes no sense to you, you'll probably want to look at the  
section on Regular Expressions.

   http://manual.macromates.com/en/regular_expressions#regular_expressions

I won't lie to you. It gets much, much worse than the example above. :)

--
Rob McBroom
<http://www.skurfer.com/>

Don't try to tell me a thing is important to you if the whole of your  
"support" entails forcing others to spend time and money on it.


_______________________________________________
textmate mailing list
textmate@...
http://lists.macromates.com/listinfo/textmate

Re: How To Highlight Custom Syntax

by Graden Hudson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Re: [TxMt] Re: How To Highlight Custom Syntax From reading the Introduction (which I feel I understand), it looks like this is a great start. Thanks for pointing me in the right direction.
-- 
Graden Hudson
Graphic Designer
Wellness Council of America
9802 Nicholas Street, Ste. 315 | Omaha, NE  68114
Phone: 402.827.3590 | Fax: 402.827.3594
ghudson@...  | www.welcoa.org



From: Rob McBroom <mailinglist0@...>
Reply-To: TextMate users <textmate@...>
Date: Fri, 6 Nov 2009 14:38:02 -0500
To: TextMate users <textmate@...>
Subject: [TxMt] Re: How To Highlight Custom Syntax

On Nov 6, 2009, at 10:57 AM, Graden Hudson wrote:

> Here's a line of code in the example that I simply do not  
> understand, at all:
>  7           match = '\b(if|while|for|return)\b';
>
> I did look at the existing HTML grammar, but that did not make much  
> sense to me, either. Should I start somewhere else in the manual? I  
> think I'm missing some basic concepts here.

If that makes no sense to you, you'll probably want to look at the  
section on Regular Expressions.

   http://manual.macromates.com/en/regular_expressions#regular_expressions

I won't lie to you. It gets much, much worse than the example above. :)

--
Rob McBroom
<http://www.skurfer.com/>

Don't try to tell me a thing is important to you if the whole of your  
"support" entails forcing others to spend time and money on it.


_______________________________________________
textmate mailing list
textmate@...
http://lists.macromates.com/listinfo/textmate


_______________________________________________
textmate mailing list
textmate@...
http://lists.macromates.com/listinfo/textmate