Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions PowerEditor/src/functionList.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<association id= "java_syntax" langID= "6" />
<association id= "xml_node" langID= "9" />
<!-- <association id="functionlist_syntax" langID= "9" /> -->
<association id= "pascal_syntax" langID="11" />
<association id= "batch_label" langID="12" />
<association id= "ini_section" langID="13" />
<association id= "perl_function" langID="21" />
Expand Down Expand Up @@ -658,6 +659,153 @@
</function>
</parser>

<!-- ========================================================= [ PAS ] -->
<parser
id ="pascal_syntax"
displayName="Pascal"
commentExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
(?s:\x7B.*?\x7D) # Multi Line Comment 1st variant
| (?s:\x28\x2A.*?\x2A\x29) # Multi Line Comment 2nd variant
| (?m-s:\x2F{2}.*$) # Single Line Comment
| (?s:\x27(?:[^\x27\x5C]|\x5C.)*\x27) # String Literal
"
>
<classRange
mainExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
(?im-s) # multi-line mode on, single-line mode off
^\h* # optional leading whitespace
(?:
CLASS\s*
)?
(?:
(?'CONSTRUCTOR_HEADER' # constructor
CONSTRUCTOR
)
| # or
(?'DESTRUCTOR_HEADER' # destructor
DESTRUCTOR
)
| # or
(?'PROCEDURE_HEADER' # procedure
PROCEDURE
)
| # or
(?'FUNCTION_HEADER' # function
FUNCTION
)
| # or
(?'OPERATOR_HEADER' # operator
OPERATOR
)
)\s+
(?'CLASS_NAME' # class/interface name
(?:[A-Z_]\w*\s*\.\s*)+
)
(?'METHOD_NAME' # method name
[A-Z_]\w*
)
(?'PARAM_LIST' # optional parameter list
\s*\( # start-of-parameter-list indicator
[^()]* # parameter list
\) # end-of-parameter-list indicator
)?
(?('CONSTRUCTOR_HEADER') # constructors don't have a return type
\s*
; # end-of-statement indicator
)
(?('DESTRUCTOR_HEADER') # destructors don't have a return type
\s*
; # end-of-statement indicator
)
(?('PROCEDURE_HEADER') # procedures don't have a return type
\s*
; # end-of-statement indicator
)
(?('FUNCTION_HEADER') # functions have a return type
\s*: # type indicator
\s*[^;]+ # type identifier
; # end-of-statement indicator
)
(?('OPERATOR_HEADER') # operators have a return type
\s*: # type indicator
\s*[^;]+ # type identifier
; # end-of-statement indicator
)
"
>
<className>
<nameExpr expr="(?i)(?:(CONSTRUCTOR|DESTRUCTOR|PROCEDURE|FUNCTION|OPERATOR)\s+)\K(?:(?:[A-Z_]\w*\s*\.\s*)+)(?:[A-Z_]\w*)" />
<nameExpr expr="(?i)(?:(?:[A-Z_]\w*\s*\.\s*)+)(?=[A-Z_])" />
<nameExpr expr="(?i)(?:(?:\s*\.\s*)?[A-Z_]\w*)+(?!\Z)" />
</className>
<function
mainExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
(?im-s) # multi-line mode on, single-line mode off
\s+
(?'CLASS_NAME' # class/interface name
(?:[A-Z_]\w*\s*\.\s*)+
)
(?'METHOD_NAME' # method name
[A-Z_]\w*
)
(?'PARAM_LIST' # optional parameter list
\s*\( # start-of-parameter-list indicator
[^()]* # parameter list
\) # end-of-parameter-list indicator
)?
"
>
<functionName>
<funcNameExpr expr="(?i)(?:(?:[A-Z_]\w*\s*\.\s*)+)\K(?:[A-Z_]\w*)(?:\s*\([^()]*\))*" />
<!-- comment out the following node to display the method with its parameters -->
<funcNameExpr expr="(?i)(?:[A-Z_]\w*)(?=\s|\(|\Z)" />
</functionName>
</function>
</classRange>
<function
mainExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
(?im-s) # multi-line mode on, single-line mode off
^\h* # optional leading whitespace
(?:
(?'FUNCTION_HEADER' # function
FUNCTION
)
| # or
(?'PROCEDURE_HEADER' # procedure
PROCEDURE
)
)\s+
(?'ROUTINE_NAME' # function/procedure name
[A-Z_]\w*
)
(?'PARAM_LIST' # optional parameter list
\s*\( # start-of-parameter-list indicator
[^()]* # parameter list
\) # end-of-parameter-list indicator
)?
(?('FUNCTION_HEADER') # functions have a return type
\s*: # type indicator
\s*[^;]+ # type identifier
; # end-of-statement indicator
)
(?('PROCEDURE_HEADER') # procedures don't have a return type
\s*
; # end-of-statement indicator
)
(?:\s*OVERLOAD\s*;)?
(?:\s*(?:REGISTER|PASCAL|CDECL|STDCALL|SAFECALL)\s*;)?
(?!\s*(?:FORWARD)\s*;) # prevent matching forward declarations
(?=\s*(?:(?R)|CONST|TYPE|VAR|LABEL|BEGIN)\s*) # only match function/procedure definitions
"
>
<functionName>
<nameExpr expr="(?i)(?:(FUNCTION|PROCEDURE)\s+)\K(?:[A-Z_]\w*)(?:\s*\([^()]*\))*" />
<!-- comment out the following node to display the routine with its parameters -->
<nameExpr expr="(?i)(?:[A-Z_]\w*)(?=\s|\(|\Z)" />
</functionName>
</function>
</parser>

<!-- ================================ [ Batch / Command Shell Script ] -->

<parser
Expand Down