Navigation: TextEd > Syntax files >

Block

 

 

 

 

BlockName

Syntax

BlockName=<string>

Description

A block is everything between a block start and a block end. Every block must have a unique name. If you start the block name with a # you tell the editor to treat the start and stop values as regular expressions.

 

 

Open block


If you only enter a block start, and not a block end, you get an open block. A space or symbol will then end the block. This is used in the syntax definition file for the Perl language to highlight variables. E.g. @var were @ act as a block start and with no given block end the space act as the block end.

Example

E.g. The blocks we want to create are:

 

[ ... ]

{ ... }

 

So we enter:

 

BlockName

Example block 1

BlockOnLine

Yes

BlockAsString

Yes

BlockStart

[

BlockEnd

]

 

BlockName

#Example block 2

BlockOnLine

Yes

BlockAsString

Yes

BlockStart

$

BlockEnd

[a..z]\.$

 

A block can be used as an advanced string. It can act exactly like a string, coloring everything in the block with the same color. Or it can just color everything it does not recognize using a block color. This can be extremely helpful when writing syntax files. Keywords, strings, numbers and so on keep there specific color but the rest get the block color. Here are some very simple example of how it can be used.

 

E.g.

An ini file looking like this:

 

[Colors]

Text=255

Bk=0


will with these options:

 

BlockName

Key block

BlockOnLine

Yes

BlockAsString

Yes

BlockStart

[

BlockEnd

]

 

look like this, if the "Key block" color is set to "Teal":

 

[Colors]

Text=255

Bk=0

 

E.g.

A line in a CSS file might look like this:

 

P {FONT-FAMILY: Arial, Helvetica, sans-serif}


 

Now, the editor does not have to recognize every font type to color the names. If P is colored as normal text (e.g.purple) and FONT-FAMILY as a keyword (e.g.blue). And we enter these options:

 

BlockName

CSS block

BlockOnLine

No

BlockAsString

No

BlockStart

{

BlockEnd

}

 

With the "CSS block" color red, we get:

 

P {FONT-FAMILY: Arial, Helvetica, sans-serif}

 

(Note! For this to work you must enter the colon (:) as a symbol but not (-). If you enter (-) as a symbol FONT-FAMILY will not be recognized as a keyword because FONT and FAMILY will be handled separately.)

 

 

BlockOnLine

Syntax

BlockOnLine=<Yes|No>

Description

Tell the editor if the block can span over several lines, or just one line.

 


BlockAsString

Syntax

BlockAsString=<Yes|No>

Description

Set this option to change the behavior of the block.

 

"Yes"

The block will act like a string. Everything inside the block, including the block characters, will have the same color.

The options "HighlightKeywords, ..." will have no effect when this option is set to YES.

 

"No"

Keywords, strings, symbols ... will be highlighted using its own color. Everything else will be highlighted using the block color.

Use the options "HighlightKeywords, ..." to decide what should be highlighted using its own color inside the block.

 

E.g. (behave like a normal string but other blocks (like variables), symbols and numbers are highlighted in the string)

 

BlockName=Advanced String

BlockOnLine=Yes

BlockStart="

BlockEnd="

BlockAsString=No

BlockEsc=\

HighlightBlock=Yes

HighlightKeyword=No

HighlightSymbols=Yes

HighlightNumbers=Yes

HighlightStrings=No

HighlightChars=No

 


BlockStart

Syntax

BlockStart=<string>

Description

A string to start a block.

 


BlockEnd

Syntax

BlockEnd=<string>

Description

A string to end a block. If this option is empty, an open block is created. The block is then ended by a space or a symbol.

 


BlockEsc

Syntax

BlockEsc=<string>

Description

In e.g. LaTeX the sign ( $ ) is treated as a block. To write the actual ( $ ) sign you can type ( \$ ). For the editor to handle blocks and the sign ( $ ) correctly, set the block escape to ( \ ). Now the ( \$ ) sequence isn't highlighted as a block.

 


FirstOnLine

Syntax

FirstOnLine=<Yes|No>

Description

Tell the editor that the block has to be first on the line. This is used e.g. with the Ini syntax file and sections.

 


OnlyAfter

Syntax

OnlyAfter=<string>

Description

The editor will only highlight the block if the block start is preceded by a character in the "OnlyAfter" string. This option is ignored if the string is empty.


 

HighlightKeywords

HighlightBlocks

HighlightSymbols

HighlightNumbers

HighlightStrings

HighlightChars

Syntax

HighlightKeywords=<Yes|No>

Description

Tell the editor how to handle highlighting inside the block when the option BlockAsString=No.

 

E.g. (behave like a normal string but keywords and numbers are highlighted in the string)

 

BlockName=My String

BlockOnLine=Yes

BlockStart="

BlockEnd="

BlockAsString=No

BlockEsc=\

HighlightBlock=No

HighlightKeyword=Yes

HighlightSymbols=No

HighlightNumbers=Yes

HighlightStrings=No

HighlightChars=No

 

 

 

 

 

 

 

 

 

Copyright © 2024 Rickard Johansson