Welcome GuestLogin

Page History: Parser configuration

Compare Page Revisions



« Older Revision - Back to Page History - Newer Revision »


Page Revision: Wednesday, 23 December 2009 08:11


The parser configuration is stored in a single XML file. This file defines all tokens and the corresponding token handlers. It defines all regular expressions in use by the parser and their corresponding match handlers. It also defines the expression modes and the order of regular expression matching within each parse mode. Finally, it defines the format strings in use for generating syntax synopsis fragments.

Token configuration

The token configuration section declares each supported token, and their corresponding token handler.

Token element

Each token element defines a single token.


<token name="@return" handler="SetReturns" match="{?(?'type'[\w\.\$]+)}?(?:\s+(?'description'[\s\S]*))?"/>

name attribute

Specifies the name of the token.

name="@return"

handler attribute

Specifies the name of the delegate method that handles this token.

handler="SetReturns"

match attribute

Specifies the regular expression for matching the data of the token; the token content. Token handlers will receive the parsed token contents as a name/value collection of sub-expression matches where names are the names as defined in the regular expression ('type' and 'description' in the example below) and values are the actual values of these sub-expression matches.

match="{?(?'type'\w\.\$+)}?(?:\s+(?'description'\s\S*))?



Expression configuration

All regular expressions in use by ECMADoc are defined in this configuration file. Each expression defines its name, the name of the delegate method that handles it, a simple description of what it does and the regular expression associated with it.

expression element

Required. This is the root node that contains all other content.


<expression name="Function" handler="FunctionHandler" description="matches any type of function expression">
    <rxp><![CDATA[
       (?:\&91;comment(?'Comment'\d+)\]\s*)?(?:(?'VarDecl'var)\s*)?#
       (?:(?'FunctDeclLeft'\w\$\.+)\s*=\s*)?(?'NewKeyword'new\s+)?\(*\s*function\s*?(?'FunctDeclRight'\w.$+)?#
       \s*\((?'FunctArgs'\w.$\s,*?)\)\&91;function(?'FunctIndex'\d+)\]\s*\)*
    ]]></rxp>
</expression>

name attribute

Specifies the name of the expression. This name must be unique.

name="Function"

handler attribute

Specifies the name of the delegate method that handles the expression.

handler="FunctionHandler"

description attribute

Specifies the description of the expression.

description="Matches any type of function expression"

rxp element

Specifies the regular expression associated with the expression. The regular expression will be compiled with IgnorePatternWhitespace option on, so newlines and spaces can be used to improve readability.


<![CDATA[
   (?:\&91;comment(?'Comment'\d+)\]\s*)?(?:(?'VarDecl'var)\s*)?#
   (?:(?'FunctDeclLeft'\w\$\.+)\s*=\s*)?(?'NewKeyword'new\s+)?\(*\s*function\s*?(?'FunctDeclRight'\w.$+)?#
   \s*\((?'FunctArgs'\w.$\s,*?)\)\&91;function(?'FunctIndex'\d+)\]\s*\)*
]]>





Parse mode configuration

...

Format configuration



...

ScrewTurn Wiki version 3.0.4.560. Some of the icons created by FamFamFam.