XTP(ToolkitPro)-Syntax Edit Lex Schema Help

来源:互联网 发布:中国信保 知乎 编辑:程序博客网 时间:2024/05/21 13:18
***Lex class description***                                      lexClass object is a block of text with defined begin and end sequence;for which can be specified some font and colors attributes. One lex class can contain others inside itself;also it can have some relations to other classes.lex schema is defined as a set of lexClasses. It contains a root class with parent type 'file' (which defines a files extensions to apply this schema to, and some global schema attributes).--- Lex schemes                                                              Lex schemes are defined in *.schclass files. Lex class properties (attributes) can be compound, like:parent:dyn, previous:tag:separators.--- Multiple values                                                                      For multiple value properties the following syntax is allowed:propertyX = value1, value2, value3, ....propertyX = valueA1, valueA2, ...propertyX = valueN1propertyX = valueN2....--- String values                                                     String(character) values are defined in single quotation marks:'stringValue'There are a few special chars (as in C++):  '\\', '\'', '\t', '\r', '\n'And predefined constants:@alpha= a-z, A-Z@digit= 0-9@HexDdigit= 0-9, a-f, A-F@specs= "~`!@#$%^&*()_-+=\\|{}[];:'\",.<>/?"@EOL= End Of LineNOT operation supported for constants comparisons, example:   @alpha:not---Comments  //Two slashes are used to define a single line comment in Lex schema files.(same as in C++)---Section                                                          lexClass:This keyword begins a lex class section.---  name     -- Property (required)nameDefine a lexClass name. Must be unique withing same lex schema (*.schclass file).EXAMPLE:name = c_CPPString---parent   -- Property (required)                                             parentDefines a direct parent of lex class. (parent class name)parent:dynDefines a dynamic parent of lex class. (parent class name)Dynamic means that parent class can be not only direct parent, but parent of its parent [of parent ...] until the top class/block.parent:fileDefines a top schema class. (as file extensions list <*.ext1|*.ext2>)Only one of mentioned above 'parent' properties can be used for each class.EXAMPLE:parent:file = <*.c|*.cpp|*.h|*.inl|*.tli|*.tlh|*.rc|*.rc2>parent= c_CPPparent:dyn= c_CPP---children -- Property (optional)                                             childrenDefines an allowed direct children for lex class. (as comma separated class names or zero to restrict any child)Parent-child relation is defined by 'parent' property.  This property helps to restrict create parent-child relation for classes other than specified or define that class has no children.EXAMPLE:children = 0 // has no childrenchildren = class1, class2, ...---RecurrenceDepth-- Property  (optional)                                             RecurrenceDepthDefines maximum depth of nested classes (blocks). (as a number, default value 1).Class A can be parent for class B. And Class B can be parent for class A. Possible situation when A=B. (for example '{}' block in C++)This property defines maximum depth of A->B->A->B->... nested construction.EXAMPLE:RecurrenceDepth = 32---previous -- Property (optional)                                             'previous' property used to set condition to start lex class as previous tag or class. The difference from 'start' property that objects specified in this property is not included in class(block).Can be used alone or together with 'start' property.previous:classThis class is started only if previous determined class name in collection specified in this property.(as one or more class names)previous:tagThis class is started only if start condition is true and previous tag is in collection specified in this property.(as one or more tags)previous:tag:separatorsseparators set for previous:tag values.Previous 'tag' and 'class' conditions can be specified separately or together.EXAMPLE:previous:class= c_HTMLelement_SCRIPT_lang_VB, c_HTMLelement_SCRIPT_lang_JSprevious:tag= '='previous:tag:separators= ' ', '\t', @eol---start    -- Property  (optional)                                             'start' property used to set condition to start lex class as tag or class. The difference from 'previous' property that objects specified in this property is included in class(block).Can be used alone or together with 'previous' property.start:classThis class is started only if previous determined class name in collection specified in this property.(as one or more class names)start:TagThis class is started if current tag is in collection specified in this property.(as one or more tags)Start 'tag' and 'class' conditions can be specified separately or together.---end      -- Property  (optional)                                             'end' property used to set end lex class condition as tag or class. end:classThis class is ended if previous determined class name in collection specified in this property.(as one or more class names)end:TagThis class is ended if current tag is in collection specified in this property.(as one or more tags)end:separatorsThis class is ended if tag after current position is in collection specified in this property. Difference from end:Tag is that end:Tag specify tags before  current position and end:Tag included in this block but end:separators not included..(as one or more tags)End 'class', 'tag' and 'separators' conditions can be specified separately or together.---skip     -- Property  (optional)                                             skip:TagUsed to skip some tags from parsing. Useful to support special tags part of which can be a begin of end tag.(as one or more tags)EXAMPLES (for start, end, skip):start:Tag='/*'end:Tag='*/'  //-------------------------------------------start:Tag= '"'skip:Tag= '\\"', '\\\r\n', '\\\n\r', '\\\n', '\\\r'end:Tag= '"', @eol  //-------------------------------------------start:tag= @alphaskip:tag= @digitend:separators = @alpha:not  //-------------------------------------------start:CLASS= c_CPPAfxInsertBlock_Startend:CLASS= c_CPPAfxInsertBlock_End---token    -- Property  (optional)                                             'token' property is used to set lex class as some token(s). It could be useful to define keywords.Can be used alone or together with 'previous' property.It must not be used together with 'start'-'end' condition.token:tagThis class is a word from this collection.(as one or more tags)Token:start:separatorsStart separators set for token:tag values.Token:end:separatorsEnd separators set for token:tag values.Token 'tag' is main condition. Token 'separators' additional conditions.'separators' without 'tag' have no sense.EXAMPLE:token:start:separators= ' ', '\t', '<%=', '<%', @specs, @eol token:end:separators= ' ', '\t', '%>', @specs, @eol token:tag = 'if', 'for', 'while', 'do'token:tag = 'break'    token:tag = 'case'    token:tag = 'catch'--- TEXT Attributes txt:XXX defines a few text properties for lex class (block of text).All of them are optional and if some text attribute is not specified - it is inherited from parent class or set to default value for a top (file) lex class. txt:colorFGFore color value in hex format (like 0xffc0c0).default: blacktxt:colorBKBackground color value in hex format (like 0xffFFff).default: whitetxt:colorSelFGSelected text fore color value in hex format (like 0xffFFff).default: whitetxt:colorSelBK= 0xffc0c0 // color value in hex format. default: Selected text background color value in hex format (like 0xab0077).default: blacktxt:BoldBold font attribute. Values {1, 0} default: 0txt:ItalicItalic font attribute. Values {1, 0} default: 0txt:UnderlineUnderline font attribute. Values {1, 0} default: 0EXAMPLE:txt:colorFG= 0x0fc0c0 txt:colorBK= 0xffffff txt:colorSelFG= 0xffffff txt:colorSelBK= 0x0fc0c0 txt:Bold= 1 txt:Italic= 0 txt:Underline = 1 ---caseSensitive -- Property  (optional)                                             caseSensitiveDefine compare method for this lex class tags: case sensitive or insensitive.Inheritable from parent class.Values {1, 0} default: 0---Collapsable   -- Property  (optional)                                             CollapsableDefine is this block Collapsable or not. Inheritable from parent class.Values {1, 0} default: 0---CollapsedText -- Property  (optional)                                             CollapsedTextCollapsed block string.(as quoted string value) default: '[..]'---   ParseOnScreenParseOnScreenValues {1, 0} default: 0If set to 1 - lex class will be parsed only before drawing on the screen in the main thread. Useful for keywords and other single line text blocks, whichare parsed very fast.*** Global attributes ***'global' attributes let to adjust some common parser parameters for each lex schema separately. They can be used only in top layer lex class (parent type file).global:FirstParseInSeparateThreadValues {1, 0} default: 1Define is first parse (when file opening) will run in the main or additional thread.global:EditReparceInSeparateThreadValues {1, 0} default: 1Define is reparse after text edited will run in the main or additional thread.global:ConfigChangedReparceInSeparateThread= 1 // {0,1} default=1Values {1, 0} default: 1Define is reparse text after schema file (*.schclass) will run in the main or additional thread.global:EditReparceTimeout_msas time in milliseconds;default: 500 Time out to start reparse after last key was pressed.global:MaxBackParseOffsetas number (chars);default: 100Some times parser look back for the text from current position.This parameter define maximum back buffer size. global:OnScreenSchCacheLifeTime_sec = 180as time in seconds; -1 and 0 means infinite; default= 180When piece of text is displayed, edit control run parser to parselexClasses with 'ParseOnScreen' attribute set and cache this information to do not run parser every time for this lines. For eachentry in this cache last access time is stored. This parameter define time period from last access time after which cached entries will be removed (for memory using optimization).global:ParserThreadIdleLifeTime_sec as time in seconds; -1 and 0 means infinite; default: 60Idle time out for parser thread. If no parse requests (no editing operations)additional parser thread will be exited. It will be recreated again when necessary (to system resources optimization).
原创粉丝点击