Rewrote X2SitRepEffect_GrantAbilities::GetAbilitiesToGrant to actually be readable

//---------------------------------------------------------------------------------------
//  FILE:    X2SitRepEffect_GrantAbilities.uc
//  AUTHOR:  David Burchanowski  --  11/1/2016
//  PURPOSE: Allows sitreps to give abilities to units
//
//---------------------------------------------------------------------------------------
//  Copyright (c) 2016 Firaxis Games, Inc. All rights reserved.
//---------------------------------------------------------------------------------------

class X2SitRepEffect_GrantAbilities extends X2SitRepEffectTemplate;

var array<name> AbilityTemplateNames; // Abilities to grant

var array<name> CharacterTemplateNames; // Characters to grant abilities to
var array<ETeam> Teams; // Issue #445: allow mods to filter units by team
var bool GrantToSoldiers; // If true, will grant the specified abilities to all soldier classes

// If you need different/more precise control of which units get which abilities, you can override
// this function with a subclass
function GetAbilitiesToGrant(XComGameState_Unit UnitState, out array<name> AbilityTemplates)
{
	AbilityTemplates.Length = 0;

	if (GrantToSoldiers && UnitState.IsSoldier())
	{
		// Skip all checks and grant the abilities
		AbilityTemplates = AbilityTemplateNames;
		return;
	}

	if (CharacterTemplateNames.Length > 0 && CharacterTemplateNames.Find(UnitState.GetMyTemplateName()) == INDEX_NONE)
	{
		return;
	}

	if (Teams.Length > 0 && Teams.Find(UnitState.GetTeam()) == INDEX_NONE)
	{
		return;
	}

	// All checks passed
	AbilityTemplates = AbilityTemplateNames;
}

//---------------------------------------------------------------------------------------
//  FILE:    X2SitRepEffect_GrantAbilities.uc
//  AUTHOR:  David Burchanowski  --  11/1/2016
//  PURPOSE: Allows sitreps to give abilities to units
//
//---------------------------------------------------------------------------------------
//  Copyright (c) 2016 Firaxis Games, Inc. All rights reserved.
//---------------------------------------------------------------------------------------

class X2SitRepEffect_GrantAbilities extends X2SitRepEffectTemplate;

var array<name> AbilityTemplateNames; // Abilities to grant

var array<name> CharacterTemplateNames; // Characters to grant abilities to
var array<ETeam> Teams; //CHL issue #445 allow mods to decide which team(s) receive this ability
var bool GrantToSoldiers; // If true, will grant the specified abilities to all soldier classes

// If you need different/more precise control of which units get which abilities, you can override
// this function with a subclass
function GetAbilitiesToGrant(XComGameState_Unit UnitState, out array<name> AbilityTemplates)
{
	AbilityTemplates.Length = 0;

	if (CharacterTemplateNames.Find(UnitState.GetMyTemplateName()) != INDEX_NONE
	|| (CharacterTemplateNames.Length == 0 && GrantToSoldiers == false)
	|| (GrantToSoldiers && UnitState.IsSoldier())
	|| Teams.Find(UnitState.GetTeam()) != INDEX_NONE)
	{
		AbilityTemplates = AbilityTemplateNames;
	}
}


Add check for robotic units

Add check for robotic units

//---------------------------------------------------------------------------------------
//  FILE:    X2SitRepEffect_GrantAbilities.uc
//  AUTHOR:  David Burchanowski  --  11/1/2016. CHL: Reworked by Xymanek
//  PURPOSE: Allows sitreps to give abilities to units
//
//---------------------------------------------------------------------------------------
//  Copyright (c) 2016 Firaxis Games, Inc. All rights reserved.
//---------------------------------------------------------------------------------------
// Issue #445: Rework this class to be more sensible and flexible and document it better

class X2SitRepEffect_GrantAbilities extends X2SitRepEffectTemplate;

// Abilities to grant
var array<name> AbilityTemplateNames;

// If true, will grant to soldiers only. All other checks are ignored
// This is a bit weird, but that's how FXS implemeted it and we cannot change that
var bool GrantToSoldiers;

// If GrantToSoldiers is false, the unit will be subjected to following tests.
// Note that if an array is empty, the check will be skipped

var array<name> CharacterTemplateNames; // List of characters templates that are allowed
var array<ETeam> Teams; // Issue #445: List of teams that are allowed
var bool RequireRobotic; // Issue #445

// If you need different/more precise control of which units get which abilities, you can override
// this function with a subclass
function GetAbilitiesToGrant(XComGameState_Unit UnitState, out array<name> AbilityTemplates)
{
	AbilityTemplates.Length = 0;

	if (GrantToSoldiers)
	{
		// Skip all checks and grant the abilities based on soldier or not (see above)

		if (UnitState.IsSoldier())
		{
			AbilityTemplates = AbilityTemplateNames;
		}

		return;
	}

	if (RequireRobotic && !UnitState.IsRobotic())
	{
		return;
	}

	if (CharacterTemplateNames.Length > 0 && CharacterTemplateNames.Find(UnitState.GetMyTemplateName()) == INDEX_NONE)
	{
		return;
	}

	if (Teams.Length > 0 && Teams.Find(UnitState.GetTeam()) == INDEX_NONE)
	{
		return;
	}

	// All checks passed
	AbilityTemplates = AbilityTemplateNames;
}

//---------------------------------------------------------------------------------------
//  FILE:    X2SitRepEffect_GrantAbilities.uc
//  AUTHOR:  David Burchanowski  --  11/1/2016. CHL: Reworked by Xymanek
//  PURPOSE: Allows sitreps to give abilities to units
//
//---------------------------------------------------------------------------------------
//  Copyright (c) 2016 Firaxis Games, Inc. All rights reserved.
//---------------------------------------------------------------------------------------
// Issue #445: Rework this class to be more sensible and flexible and document it better

class X2SitRepEffect_GrantAbilities extends X2SitRepEffectTemplate;

// Abilities to grant
var array<name> AbilityTemplateNames;

// If true, will grant to soldiers only. All other checks are ignored
// This is a bit weird, but that's how FXS implemeted it and we cannot change that
var bool GrantToSoldiers;

// If GrantToSoldiers is false, the unit will be subjected to following tests.
// Note that if an array is empty, the check will be skipped

var array<name> CharacterTemplateNames; // List of characters templates that are allowed
var array<ETeam> Teams; // Issue #445: List of teams that are allowed

// If you need different/more precise control of which units get which abilities, you can override
// this function with a subclass
function GetAbilitiesToGrant(XComGameState_Unit UnitState, out array<name> AbilityTemplates)
{
	AbilityTemplates.Length = 0;

	if (GrantToSoldiers)
	{
		// Skip all checks and grant the abilities based on soldier or not (see above)

		if (UnitState.IsSoldier())
		{
			AbilityTemplates = AbilityTemplateNames;
		}

		return;
	}

	if (CharacterTemplateNames.Length > 0 && CharacterTemplateNames.Find(UnitState.GetMyTemplateName()) == INDEX_NONE)
	{
		return;
	}

	if (Teams.Length > 0 && Teams.Find(UnitState.GetTeam()) == INDEX_NONE)
	{
		return;
	}

	// All checks passed
	AbilityTemplates = AbilityTemplateNames;
}


Update math.uc

Update math.uc

Fixed Int, <>, Rnd, and moved #Includes to pb-to-cpp.uc

# math.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.96 on 5/6/2014 3:05:35 PM
# Comment: Converts math-related code from PowerBASIC to C++

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, InputFile, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique, FilterTally

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: True
Exclude: False
Comment: Converts math-related code from PowerBASIC to C++
Selected: False
Highlight: True
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: True
CodeBlockSensitive: True
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
FilterTally: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
InputFile:
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
Find:
Replace: {@Var: Type As String}
         {@Note: rand & srand are in <cstdlib>, the others in <cmath>}
         {@Note: ToDo: \ eqv imp bin }

Criteria: 2
Comment: ^ (power)
Pass: 1

Criteria: 3
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 4
BackColor: Gold
Precedence: 100
Find: {x} ^ {y}  {@Note: precedence property set to 100}
Replace: pow({x}, {y})

Criteria: 5
Comment: Bitwise AND and OR
Pass: 2

Criteria: 6
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 7
Comment: Bitwise AND and OR
BackColor: YellowGreen
Find: ({expr})
Replace: ({@Evaluate: Replace(Replace({expr}, "And", "&"), "Or", "|")})

Criteria: 8
Comment: Everything else
Pass: 3

Criteria: 9
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 10
Find: Mod
Replace: %

Criteria: 11
BackColor: Yellow
Find: Atn
Replace: atan

Criteria: 12
BackColor: Lime
Find: Sqr
Replace: sqrt

Criteria: 13
BackColor: Pink
Find: Cint
Replace: (__int16)

Criteria: 14
Find: Int({arg%})
Replace: (__int64)({arg})

Criteria: 15
BackColor: Red
Find: Incr {var:1}
Replace: {var}++

Criteria: 16
BackColor: RoyalBlue
Find: Decr {var:1}
Replace: {var}--

Criteria: 17
Comment: Logical (short-circuit) AND
Find: And
Replace: &&

Criteria: 18
Comment: Logical (short-circuit) OR
BackColor: Purple
Find: Or
Replace: ||

Criteria: 19
BackColor: Khaki
Find: Xor
Replace: ^

Criteria: 20
BackColor: Green
Find: Not
Replace: ~

Criteria: 21
SkipOver: True
Find: #{metastatement:1} Not
Replace: [Skip over]

Criteria: 22
Selected: True
BackColor: Silver
Find: IsTrue {x%}  [{stop-: And | Or | Then | : }]
Replace: (({x}) != 0)

Criteria: 23
BackColor: SandyBrown
Find: IsFalse {x%} [{stop-: And | Or | Then | : }]
Replace: !({x})

Criteria: 24
BackColor: Violet
Find: <>
Replace: !=

Criteria: 25
Find: Randomize {number%}
Replace: srand({number})

Criteria: 26
Find: Rnd[()]
Replace: (rand() / RAND_MAX)

Criteria: 27
Find: Rnd({a%}, {b%})
Replace: (rand() % ({b}) + ({a}))

Criteria: 28
Find: Shift Right {ivar}, {countexpr%}
Replace: {ivar} = ({ivar} >> {countexpr})

Criteria: 29
Find: Shift Left {ivar}, {countexpr%}
Replace: {ivar} = ({ivar} << {countexpr})

Criteria: 30
Find: {func: Abs|Sin|Cos|Tan|Exp|Exp2|Log|Log2|Log10|Ceil}
Replace: {@Evaluate: LCase("{func}", "{'.*'}")}

Criteria: 31
Find: {func: Exp10 | Fix | Frac | Sgn}
Replace: PB_{@Evaluate: UCase("{func}", "{'.*'}")}

Criteria: 32
PassOnce: False
Find: {func: Min | Max}[{ {int: &} | {str: $} | {dbl: } }]
      ({args})
Replace: PB_{@Evaluate:
            Type = "(double)"
            IIf("{int}" <> "", Type = "(int)")
            IIf("{str}" <> "", Type = "(string)")
            UCase("{func}", "{'.*'}")
         }{int:_INT}{str:_STR}(ARGCOUNT({@Evaluate:
         Tally({args}, ",", Skip("({nest})"))+1}), {@Evaluate:
         Type + Replace({args}, ",", ", "+Type, Skip("({nest})"))})

# End Search

# math.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.95 on 4/18/2014 5:09:17 PM
# Comment: Converts math-related code from PowerBASIC to C++

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, InputFile, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique, FilterTally

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: True
Exclude: False
Comment: Converts math-related code from PowerBASIC to C++
Selected: False
Highlight: True
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: True
CodeBlockSensitive: True
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
FilterTally: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
InputFile:
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
Find:
Replace: {@Var: Type As String}

Criteria: 2
Comment: ^ (power)
Pass: 1

Criteria: 3
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 4
BackColor: Gold
Precedence: 100
Find: {x} ^ {y}  {@Note: precedence property set to 100}
Replace: pow({x}, {y})

Criteria: 5
Comment: Bitwise AND and OR
Pass: 2

Criteria: 6
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 7
Comment: Bitwise AND and OR
BackColor: YellowGreen
Find: ({expr})
Replace: ({@Evaluate: Replace(Replace({expr}, "And", "&"), "Or", "|")})

Criteria: 8
Comment: Everything else
Pass: 3

Criteria: 9
Find: {@Start}
      {@Note: ToDo: \ eqv imp bin }
Replace: #include <cmath>
         #include <cstdlib>
         {@Note: rand & srand are in cstdlib}

Criteria: 10
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 11
Find: Mod
Replace: %

Criteria: 12
BackColor: Yellow
Find: Atn
Replace: atan

Criteria: 13
BackColor: Lime
Find: Sqr
Replace: sqrt

Criteria: 14
Selected: True
BackColor: Pink
Find: Cint
Replace: (__int16)

Criteria: 15
Find: Int({arg})
Replace: (__int64)({arg})

Criteria: 16
BackColor: Red
Find: Incr {var:1}
Replace: {var}++

Criteria: 17
BackColor: RoyalBlue
Find: Decr {var:1}
Replace: {var}--

Criteria: 18
Comment: Logical (short-circuit) AND
Find: And
Replace: &&

Criteria: 19
Comment: Logical (short-circuit) OR
BackColor: Purple
Find: Or
Replace: ||

Criteria: 20
BackColor: Khaki
Find: Xor
Replace: ^

Criteria: 21
BackColor: Green
Find: Not
Replace: ~

Criteria: 22
SkipOver: True
Find: #{metastatement:1} Not
Replace: [Skip over]

Criteria: 23
BackColor: Silver
Find: IsTrue {x%}  [{stop-: And | Or | Then | : }]
Replace: (({x}) <> 0)

Criteria: 24
BackColor: SandyBrown
Find: IsFalse {x%} [{stop-: And | Or | Then | : }]
Replace: !({x})

Criteria: 25
BackColor: Violet
Find: <>
Replace: !=

Criteria: 26
Find: Randomize {number}
Replace: srand({number})

Criteria: 27
Find: Rnd[()]
Replace: (rand() / RAND_MAX)

Criteria: 28
Find: Rnd({a}, {b})
Replace: (rand() % ({b}) + ({a}))

Criteria: 29
Find: Shift Right {ivar}, {countexpr}
Replace: {ivar} = ({ivar} >> {countexpr})

Criteria: 30
Find: Shift Left {ivar}, {countexpr}
Replace: {ivar} = ({ivar} << {countexpr})

Criteria: 31
Find: {func: Abs|Sin|Cos|Tan|Exp|Exp2|Log|Log2|Log10|Ceil}
Replace: {@Evaluate: LCase("{func}", "{'.*'}")}

Criteria: 32
Find: {func: Exp10 | Fix | Frac | Sgn}
Replace: PB_{@Evaluate: UCase("{func}", "{'.*'}")}

Criteria: 33
PassOnce: False
Find: {func: Min | Max}[{ {int: &} | {str: $} | {dbl: } }]
      ({args})
Replace: PB_{@Evaluate:
            Type = "(double)"
            IIf("{int}" <> "", Type = "(int)")
            IIf("{str}" <> "", Type = "(string)")
            UCase("{func}", "{'.*'}")
         }{int:_INT}{str:_STR}(ARGCOUNT({@Evaluate:
         Tally({args}, ",", Skip("({nest})"))+1}), {@Evaluate:
         Type + Replace({args}, ",", ", "+Type, Skip("({nest})"))})

# End Search


Update implicit-convert.uc

Update implicit-convert.uc

# implicit-convert.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.96 on 5/21/2014 5:14:40 PM
# Comment: Handles implicit data type conversions

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, InputFile, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique, FilterTally

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: False
Exclude: False
Comment: Handles implicit data type conversions
Selected: False
Highlight: True
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: False
CodeBlockSensitive: False
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
FilterTally: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
InputFile:
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
Enabled: True
Highlight: False
Find:
Replace: {@Eval:
            Dim Size As Table = {
               "Byte", 1, "Word", 2, "Integer", 2, "Long", 4, "Dword", 4,
               "Single", 4, "Double", 8, "Extended", 10
            }
         }
         {@Define:
            Var: Args As String
            SyntaxArgL: {number} = {number:"([0-9]*\.)?[0-9]+(e[-+]?[0-9]+)?"}
         }
         {@Define::
            Token: \x27.* ~~ Properties: ucWhitespace
            Token: _[^\n]*\n ~~ Properties: ucWhitespace
            LineContinue: " _"
         }

Criteria: 2
Comment: Inserts data type names in front of variabls and functions
Pass: 1

Criteria: 3
Enabled: True
Highlight: False
Find: {nl}[Declare]{ Function | Sub } {name:1} [{etc}] ([{args%}]) [ As {ftype:1}]
Replace: {@Define::  Pass: 1 ~~ Syntax: {name}({@Eval:                      _
             Args = Remove("{args}", "{ Optional | ByVal | ByRef | Ptr }"); _
             Replace(Args, "{arg:1} As {type:1}", "{"+"{arg}"+"%}")          _
           }) ::= `{ftype}({name}({@Eval:                                   _
             Args = Remove("{args}", "{ Optional | ByVal | ByRef | Ptr }"); _
             Replace(Args, "{arg:1} As {type:1}", "##{type}({arg})")        _
           }))
         }{Self}

Criteria: 4
Enabled: True
Highlight: False
Find: { Global | Local | Static | Dim | , | { ByVal | ByRef } } {var:1} As {type:1}
Replace: {Self}{@Define:: Pass: 1 ~~ Syntax: {var} ::= `{type}({var})}

Criteria: 5
Enabled: True
Highlight: False
Find: {number}
Replace: `Double({number})

Criteria: 6
Enabled: True
Highlight: False
BackColor: RoyalBlue
Find: {q}{text}{q}
Replace: `StringLit({Self})

Criteria: 7
Enabled: True
Highlight: False
BackColor: Pink
Find: {func: InStr|Len|UBound|VarPtr|StrPtr|Dir|CurDir } ({args%})
Replace: `Long({func}({args}))

Criteria: 8
Enabled: True
Highlight: False
BackColor: SlateBlue
Find: {func: Mid|Left|Right|Remove|Extract|Remain } ({args%})
Replace: `String({func}({args}))

Criteria: 9
Enabled: True
Highlight: False
BackColor: Purple
SkipOver: True
Find: {nl} { Type | Union }
         {members+}
      End {TypeOrUnion}
Replace: [Skip over]

Criteria: 10
Enabled: True
BackColor: Khaki
SkipOver: True
Find: {nl}{ % | $ | # | ! | ASM } {etc} {@Note: Skips equates, metastatements, ASM}
Replace: [Skip over]

Criteria: 11
Comment: Convert
Pass: 2

Criteria: 12
Enabled: True
BackColor: Violet
PassOnce: False
Find: ##Asciiz(string({arg}))
Replace: `Asciiz({arg}.c_str())

Criteria: 13
Enabled: True
PassOnce: False
Find: `StringLit({arg})+`StringLit({arg})
Replace: `String((string){arg}+{arg})

Criteria: 14
Enabled: True
BackColor: CornflowerBlue
PassOnce: False
Find: `WideString({arg}) + `String({arg})
Replace: `WideString({arg}) + `WideString(string({arg}))

Criteria: 15
Enabled: True
BackColor: SandyBrown
PassOnce: False
Find: Len(`String({arg}))
Replace: `Long(({arg}).length())

Criteria: 16
Enabled: True
BackColor: Gold
PassOnce: False
Find: Len(`LPCSTR({arg}))
Replace: `Long(strlen({arg}))

Criteria: 17
Enabled: True
Selected: True
PassOnce: False
Find: `{ Extended | Ext }
Replace: `Double

Criteria: 18
Comment: Highlights the inserted data type names
Pass: 3

Criteria: 19
Enabled: False
BackColor: Red
Find: ##{type:1}
Replace: {Self}

Criteria: 20
Enabled: False
Comment: This line is there to provide highlighting for clarity
Find: `{type:1}
Replace: {Self}

# End Search

# implicit-convert.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.96 on 5/19/2014 6:26:41 PM
# Comment: Handles implicit data type conversions

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, InputFile, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique, FilterTally

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: True
Exclude: False
Comment: Handles implicit data type conversions
Selected: False
Highlight: True
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: False
CodeBlockSensitive: False
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
FilterTally: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
InputFile:
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
Highlight: False
Find:
Replace: {@Define:
            Var: Args As String
            SyntaxArgL: {number} = {number:"([0-9]*\.)?[0-9]+(e[-+]?[0-9]+)?"}
         }
         {@Define::

            Token: \x27.* ~~ Properties: ucWhitespace
            Token: _[^\n]*\n ~~ Properties: ucWhitespace
            LineContinue: " _"
         }

Criteria: 2
Comment: Inserts data type names in front of variabls and functions
Pass: 1

Criteria: 3
Highlight: False
Find: {nl}[Declare]{ Function | Sub } {name:1} [{etc}] ([{args%}]) [ As {ftype:1}]
Replace: {@Define::  Pass: 1 ~~ Syntax: {name}({@Eval:                      _
             Args = Remove("{args}", "{ Optional | ByVal | ByRef | Ptr }"); _
             Replace(Args, "{arg:1} As {type:1}", "{"+"{arg}"+"%}")          _
           }) ::= `{ftype}({name}({@Eval:                                   _
             Args = Remove("{args}", "{ Optional | ByVal | ByRef | Ptr }"); _
             Replace(Args, "{arg:1} As {type:1}", "##{type}({arg})")        _
           }))
         }{Self}

Criteria: 4
Highlight: False
Find: { Global | Local | Static | Dim | , | { ByVal | ByRef } } {var:1} As {type:1}
Replace: {Self}{@Define:: Pass: 1 ~~ Syntax: {var} ::= `{type}({var})}

Criteria: 5
Highlight: False
Find: {number}
Replace: `Double({number})

Criteria: 6
Highlight: False
BackColor: RoyalBlue
Find: {q}{text}{q}
Replace: `String({Self})

Criteria: 7
Highlight: False
BackColor: Pink
Find: {func: InStr|Len|UBound|VarPtr|StrPtr|Dir|CurDir } ({args%})
Replace: `Long({func}({args}))

Criteria: 8
Highlight: False
BackColor: SlateBlue
Find: {func: Mid|Left|Right|Remove|Extract|Remain } ({args%})
Replace: `String({func}({args}))

Criteria: 9
Highlight: False
BackColor: Purple
SkipOver: True
Find: {nl} { Type | Union }
         {members+}
      End {TypeOrUnion}
Replace: [Skip over]

Criteria: 10
BackColor: Khaki
SkipOver: True
Find: {nl}{ % | $ | # | ! | ASM } {etc} {@Note: Skips equates, metastatements, ASM}
Replace: [Skip over]

Criteria: 11
Comment: Convert
Pass: 2

Criteria: 12
Selected: True
BackColor: Violet
Find: ##LPCSTR(string({arg}))
Replace: {arg}.c_str()

Criteria: 13
Comment: Highlights the inserted data type names
Pass: 3

Criteria: 14
BackColor: Red
Find: ##{type:1}
Replace: {Self}

Criteria: 15
Comment: This line is there to provide highlighting for clarity
Find: `{type:1}
Replace: {Self}

Criteria: 16
BackColor: SandyBrown
Find:
Replace:

# End Search