Colorer — syntax highlighting and text parsing

Here you can discuss about your favorite plug-in.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Re: Colorer — syntax highlighting and text parsing

Post by pepak »

Latest post of the previous page:

Never mind, seems that I got it now: Apparently I need to provide the prototype in one file and the rest of the definition in another file. Now I don't quite understand why, but at least it works.
pp
Posts: 36
Joined: Wed 24 Jan, 2007 11:39
Location: Česká republika
Has thanked: 8 times
Contact:

Re: Colorer — syntax highlighting and text parsing

Post by pp »

pepak
It is useful to have all prototypes in one file base/hrc/proto.hrc when you want to check for conflicting "rules".
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Re: Colorer — syntax highlighting and text parsing

Post by pepak »

Can I somehow detect which .hrc file is responsible for a particular instance of syntax coloring? I have a XML file which is regularly shown as invalid by FarColorer from FAR3 build 1800, but I just can't find any possible cause in common.jar:xml\xml.hrc, or indeed any file in the xml directory. For some reason I can't figure out, FarColorer dislikes XMl tag <project>. Example file which will show the error:

Code: Select all

<a>
	<project/>
</a>
Everything from <project/> to the end of the file is marked as error. But if I change the tag to projecta and reload the file, FarColorer is happy again.
User avatar
John Doe
Бюрократ
Posts: 13851
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 73 times
Been thanked: 428 times
Contact:

Re: Colorer — syntax highlighting and text parsing

Post by John Doe »

F11\FarColorer\List types

As I can see this file detected as "Ant's build.xml"
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Re: Colorer — syntax highlighting and text parsing

Post by pepak »

Thanks. Will try to remove Ant's build and live happily ever after :-)
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Re: Colorer — syntax highlighting and text parsing

Post by pepak »

More help needed: I can disable ant by editing the proto.hrc file. Is there a way to override/disable the syntax scheme from an external file? I added my own .hrc file to catalog.xml (via <location>) where I put pepak-specific changes. I would much prefer to disable ant in my file than in the distributed files. Can I do it?

On a related note, can I add pepak.hrc and pepak.hrd to Colorer without editing catalog.xml (for .hrc) or catalog-console.xml (for .hrd)?
User avatar
John Doe
Бюрократ
Posts: 13851
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 73 times
Been thanked: 428 times
Contact:

Re: Colorer — syntax highlighting and text parsing

Post by John Doe »

pepak wrote:More help needed: I can disable ant by editing the proto.hrc file. Is there a way to override/disable the syntax scheme from an external file?
Try to define empty scheme (or just it's prototype) with same name.
Make your own proto_pepak.hrc and include it in catalog.xml before proto.hrc
pepak wrote:On a related note, can I add pepak.hrc and pepak.hrd to Colorer without editing catalog.xml (for .hrc) or catalog-console.xml (for .hrd)?
Use folder "auto", or use own catalog.xml (enter path in plugin's settings)
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Re: Colorer — syntax highlighting and text parsing

Post by pepak »

John Doe wrote:
pepak wrote:More help needed: I can disable ant by editing the proto.hrc file. Is there a way to override/disable the syntax scheme from an external file?
Try to define empty scheme (or just it's prototype) with same name.
Make your own proto_pepak.hrc and include it in catalog.xml before proto.hrc
Maybe that was why my override didn't work - I included it after the default one.
pepak wrote:On a related note, can I add pepak.hrc and pepak.hrd to Colorer without editing catalog.xml (for .hrc) or catalog-console.xml (for .hrd)?
Use folder "auto", or use own catalog.xml (enter path in plugin's settings)
Sounds good to me. Thanks!
User avatar
John Doe
Бюрократ
Posts: 13851
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 73 times
Been thanked: 428 times
Contact:

Re: Colorer — syntax highlighting and text parsing

Post by John Doe »

pepak wrote:
Use folder "auto", or use own catalog.xml (enter path in plugin's settings)
Sounds good to me. Thanks!
Please note that you can add schemes via 'auto' folder, but it's impossible to override existing in this way.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Re: Colorer — syntax highlighting and text parsing

Post by pepak »

In fact, the override really needs to be used after the definition. And it only needs to override <location>:

Code: Select all

  <prototype name="ant" group="scripts" description="Ant's build.xml (disabled)" targetNamespace="http://jakarta.apache.org/ant/">
    <location link="jar:common.jar!xml/xml.hrc"/>
  </prototype>
User avatar
John Doe
Бюрократ
Posts: 13851
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 73 times
Been thanked: 428 times
Contact:

Re: Colorer — syntax highlighting and text parsing

Post by John Doe »

pepak wrote:In fact, the override really needs to be used after the definition.
Interesting...
What if you do it in 'auto'?
pepak wrote:And it only needs to override <location>:
Alternatively you can try to change 'weight' attribute of <filename> or <firstline>
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Colorer — syntax highlighting and text parsing

Post by pepak »

John Doe wrote:
pepak wrote:In fact, the override really needs to be used after the definition.
Interesting...
What if you do it in 'auto'?
I don't know. An external catalog.xml is more suitable for my needs, so I went that way.
John Doe wrote:
pepak wrote:And it only needs to override <location>:
Alternatively you can try to change 'weight' attribute of <filename> or <firstline>
That's what I tried the first time, but without success.
User avatar
John Doe
Бюрократ
Posts: 13851
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 73 times
Been thanked: 428 times
Contact:

Re: Colorer — syntax highlighting and text parsing

Post by John Doe »

pepak wrote:In fact, the override really needs to be used after the definition.
Just tried by myself.
You are right, probably this behavior was changed at some point.
So now you are able use 'auto' folder for redefinition too.
pepak wrote:And it only needs to override <location>
No, it is not necessary, better left it as is (to be able to choose the scheme from the list when needed).
You can keep most of old definition, but change 'condition' (I am not sure if this term is correct).
In your example 'condition' is <firstline weight='5'>, so you may change '5' to '3', or just comment whole line.
LigH
Posts: 61
Joined: Fri 19 Mar, 2010 14:12
Has thanked: 2 times
Been thanked: 1 time

Colorer — syntax highlighting and text parsing

Post by LigH »

I would like to add the extension ".vpy" to add VapourSynth scripts (basically Python, just a specific object hierarchy for video processing) to the group of files being highlighted with Python syntax. Is there any recommended way to achieve that in the Far plugin dialogs, or would I have to patch the Colorer files manually?
LigH
Posts: 61
Joined: Fri 19 Mar, 2010 14:12
Has thanked: 2 times
Been thanked: 1 time

Colorer — syntax highlighting and text parsing

Post by LigH »

Got a reply in the Google group for the take5 Colorer:

One has to change Plugins\FarColorer\base\hrc\proto.hrc and edit the "filename" RegEx in

Code: Select all

  <prototype name="python" group="main" description="Python"> 
    <location link="jar:common.jar!base/python.hrc"/> 
    <filename>/\.(py|pyw|pys)$/i</filename> 
    <firstline weight='2'>/^\#!\S*.+python/</firstline> 
  </prototype>
to <filename>/\.(py|pyw|pys|vpy)$/i</filename>
d3x0r
Posts: 6
Joined: Fri 01 Apr, 2011 21:27

ES6 Template Literal syntax highlighting

Post by d3x0r »

ES6 Template Literal syntax highlighting
In the editor, Javascript template literals quoted with ` ` do not group the text as text; and instead open/close parens/braces in the string affect highlighting next entries.

https://developer.mozilla.org/en-US/doc ... e_literals

Would be nice if support was added for strings quoted with `...`.
Last edited by Guest on Wed 14 Jun, 2017 13:32, edited 1 time in total.
Reason: Copied the ex-topic subject into the message
Post Reply

Return to “General Plug-In Discussions”