EControl Syntax Editor SDK
Syntax Lexer

This dialog is intended for customizing lexer. 

To show this dialog you must: 

at design time: double click on TSyntAnalyzer component icon or select "Lexer properties..." command in popup menu. 

at run time: call TSyntAnalyzer.CustomizeLexer 

in "Syntax Lexer Library" dialog: double click on the selected lexer or select "Lexer properties" command on the toolbar. 

 

It includes:

  • Lexer common properties...
  • Text styles
  • Token rules
  • Block rules
  • Sub lexer rules
  • Grammar rules
  • Code templates
  • Notes
  • Sample text.

 

Button commands.

Export 
Opens save dialog to save lexer configuration to the file (*.LCF) 
Import 
Opens open dialog to load lexer configuration from file (*.LCF) 
Apply 
Applies changes 
OK 
Save changes 
Cancel 
Cancel changes 

 

Preview text

At the bottom of the "Syntax Lexer" dialog editor with the sample code is placed. Any change of lexer configuration effects on the sample code. This preview text also is used in the "Syntax Highlighting" dialog that is intended to change only styles. 

 

Common page 

Lexer name - name of the lexer. Usually it is a name of file format (language). 

File extensions are used by GetFilesFilter, AnalyzerForFile methods of the TSyntaxManager component. 

 

Token type names are associated with the integer value (line number). They are used to simplify token type assignment to the token rules and selecting a set of token types for conditions of block rules. Token type is integer value in th range [0..31]. 

 

Default Style - default style which first is applied to the editor canvas. For default style you may specify font and background color. If default style is not specified editor Font and Color properties are used. 

 

Selection mark style is a style of selected block in the syntax memo. If no style is selected default editor style TCustomSyntaxMemo.DefaultStyles.SelectioMark is used. 

 

Search mark style is a style to mark out search results in the syntax memo. If no style is selected default editor style TCustomSyntaxMemo.DefaultStyles.SearchMark is used. 

 

Current Line Style - style that is used to draw current line (line with the caret). If no style is selected default editor style TCustomSyntaxMemo.DefaultStyles.CurrentLine is used. If you don't want highlight current line select style type "Only Background" and color of background "None". 

 

Collapse Mark Style - style that is used to draw collapse text icon (which is shown when text range is collapsed). If no style is selected default editor style TCustomSyntaxMemo.DefaultStyles.CollapseMark is used. 

 

Skip spaces while parsing check box specifies how to process space characters (space, HT/TAB, CR, NL, FF). If it is checked all space characters will be skipped before token rules checking, otherwise they will not be skipped. 

 

Do not skip end of line - specifies whether line breaks should be parsed. 

 

Restart analysis from line start - if it is ON parser results are cleared starting from start of line where text was changed, otherwise they are cleared after position of text changing. 

 

Always synchronized block analysis - specifies whether block analysis should be always performed with text parsing, otherwise analyzer tries to perform block analysis after whole text was parsed. 

 

Disable full refresh if text size is greater - specifies threshold after which full refresh (when text is changed) of syntactical objects will not be performed. If this value is 0 (by default), full refreshing is disabled. Full refreshing takes more time, but sometimes it may be useful for some parser's rules(for example, parser expression " ".*" " will not work correctly without full refresh). 

 

Code templates page 

At this page you can create, delete or change code templates (TCodeTemplate). 

If check box at the left side of the template in the list view is checked, template supports advanced syntax like in CodeRush, otherwise it supports simple syntax like in Borland's IDE. 

In advanced templates you may use: <caret> - specifies caret position (must be single), <paste> - inserts clipboard text, <marker> - drops stack-based marker. 

In simple templates you may specify only caret position using "|" character. 

Available code templates are listed by name with a short description. While working in the Syntax Memo, press Ctrl+J to display the code templates defined. Click a template name to display the code that will be entered in your file when that template is selected. Code displayed in the code window can be edited. Double-click on a template to insert it into your code. 

 

Rules and style are described in the next topics: 

Common for styles and rules

Styles ("Styles" page). 

Token rules ("Parser" page). 

Block rules ("Rules" page). 

Nested lexers ("Sub lexers" page).

Copyright (c) 2004-2011. All rights reserved.
What do you think about this topic? Send feedback!