Colorer — syntax highlighting and text parsing

Here you can discuss about your favorite plug-in.
pepak
Posts: 312
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 1 time
Been thanked: 9 times

Re: Colorer — syntax highlighting and text parsing

Post by pepak » Fri 14 Mar, 2014 15:33

Latest post of the previous page:

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: 11075
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 11 times
Been thanked: 64 times

Re: Colorer — syntax highlighting and text parsing

Post by John Doe » Fri 14 Mar, 2014 16:13

F11\FarColorer\List types

As I can see this file detected as "Ant's build.xml"

pepak
Posts: 312
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 1 time
Been thanked: 9 times

Re: Colorer — syntax highlighting and text parsing

Post by pepak » Tue 18 Mar, 2014 07:48

Thanks. Will try to remove Ant's build and live happily ever after :-)

pepak
Posts: 312
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 1 time
Been thanked: 9 times

Re: Colorer — syntax highlighting and text parsing

Post by pepak » Thu 20 Mar, 2014 09:44

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: 11075
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 11 times
Been thanked: 64 times

Re: Colorer — syntax highlighting and text parsing

Post by John Doe » Thu 20 Mar, 2014 10:09

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: 312
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 1 time
Been thanked: 9 times

Re: Colorer — syntax highlighting and text parsing

Post by pepak » Thu 20 Mar, 2014 10:14

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: 11075
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 11 times
Been thanked: 64 times

Re: Colorer — syntax highlighting and text parsing

Post by John Doe » Thu 20 Mar, 2014 10:20

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: 312
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 1 time
Been thanked: 9 times

Re: Colorer — syntax highlighting and text parsing

Post by pepak » Thu 20 Mar, 2014 10:31

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: 11075
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 11 times
Been thanked: 64 times

Re: Colorer — syntax highlighting and text parsing

Post by John Doe » Thu 20 Mar, 2014 10:54

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: 312
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 1 time
Been thanked: 9 times

Colorer — syntax highlighting and text parsing

Post by pepak » Thu 20 Mar, 2014 10:59

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: 11075
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 11 times
Been thanked: 64 times

Re: Colorer — syntax highlighting and text parsing

Post by John Doe » Fri 21 Mar, 2014 14:00

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: 51
Joined: Fri 19 Mar, 2010 14:12
Has thanked: 1 time

Colorer — syntax highlighting and text parsing

Post by LigH » Tue 29 Dec, 2015 16:39

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: 51
Joined: Fri 19 Mar, 2010 14:12
Has thanked: 1 time

Colorer — syntax highlighting and text parsing

Post by LigH » Sat 23 Jan, 2016 09:27

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[bgcolor=yellow][color=#0000FF][b]|vpy[/b][/color][/bgcolor])$/i</filename>

d3x0r
Posts: 6
Joined: Fri 01 Apr, 2011 21:27

ES6 Template Literal syntax highlighting

Post by d3x0r » Wed 14 Jun, 2017 06:11

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 HaRT 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”

Who is online

Users browsing this forum: No registered users and 2 guests