Exception rules for identifiers within strings




Instructions for use of lists–entries:

Ctrl + Enter insertion of a new line
Strg + A selection of all entries
Ctrl + Tab activates or deactivates a single list item

[On/Off] enables/disables all currently selected list entries

Deactivated entries are shown indented
and will be ignored in subsequent program flow.


Exception rules concern words WITHIN character strings.
They allow to PROTECT these words before a possible camouflage
if they by chance have the same name like an identifier.

CrunchCode he must first of all for words that occur isolated within strings and
are same–named to an identifier, assume, that they are a reference to the identifier.
Such words will be replaced later by the respective code name of the identifier.

But often occurs in strings also words, that have no relation to an identifier.
They are only by chance same–named and may not be camouflaged.

For this reason CrunchCode will during the program–execution display a list of all codelines,
which contain an identifier–name within a string.
The user must then decide in each single case whether it is a true reference to an identifier, or not.

To limit the number of these references, you can set up rules
that define whether a word is certainly NOT A REFERENCE to an identifier.

Tip: You can get a complete listing of all positions found
by running CrunchCode with the processing level "Analysis".

Exclusion rules can be defined more easily while running CrunchCode
(when it lists all relevant source lines).

A exception–rule consists of a text pattern (see below) that defines an EXCLUSION criterion.

If CrunchCode finds a code–line with such a pattern WITHIN A STRING,
it is NOT considered as a reference to an identifier and
it will not be camouflaged.


Notes: 1. A rule always applies to a WHOLE code–line (including those
    with the continuation operator "_" on several textlines)

2. The rules only apply to words WITHIN strings.
    They must contain at least two quotation marks,
    with the wildcard for the identifier name within them.

3. Rules are case insensitive.

4. Rules make no distinction between different data types.
    If there are identifiers with the same name but different data types,
    (e.g. procedure XXX, variable XXX, module XXX etc.)
    the rule will be applied to ALL identifiers.

5. The lines which are not grasped by a rule, but which contain
    character strings in which the name of an identifier appears,
    will be listed by CrunchCode during processing.
    The user can then decide whether it refers
    to an identifier or not.


The following special characters are available for the text patterns:

$ Wildcard for the identifier name
* no or any number text characters
? a single text character
# a single digit
[...] group of characters that could be applicable

To use one of these characters by itself,
use the following notation:

$ = \$
* = \*
? = \?
# = \#
\ = \\ z.B. "C:\XYZ" ––> "C:\\XYZ"
[ = [[]
] = \] z.B. "[A1]" ––> "[[]A1\]"

Remark: Before and after each rule CrunchCode sets the character "*",
to ensure that the entire command line is enclosed.
Special rules for the beginning or end of a code–line can therefore not be created.


Examples:

For the following examples it is assumed that there is a variable named "Price",
that is to be camouflaged. The same word must not be camouflaged where it occurs in some strings.

Exception–rules shall now be defined for these strings
and their effectiveness examined:

On the meaning of "camouflage prevented?"

Yes: The text pattern of the line fits the exception rule.
CrunchCode ignores the occurrence of the identifier within the string.
The text remains unchanged.

No: The text pattern of the line does not apply to the exception rule.
CrunchCode therefore assumes that the word within the string
could be a reference to the same identifier.
This line will be listed during processing
and the user must decide about each.


Exception rule camouflage prevented?
-------------------- --------------------------------

1. MsgBox("$")
   Yes    No
a) X = MsgBox("Price")      x
b) X = MsgBox("Price", 123)     x   further argument after "Price"
c) MsgBox "Price"     x   no brackets "(...)"
d) MsgBox "Price", 123     x   see a) and b)
e) X = MsgBox("Price total")     x   additional text exist
f) X = MsgBox("Fullprice")     x   "price" not separated


2. MsgBox[(]"$"* = whitespace!
   Yes    No
a) X = MsgBox("Preis")      x
b) X = MsgBox("Preis", 123)      x
c) MsgBox "Preis"      x
d) MsgBox "Preis", 123      x
e) X = MsgBox("Preis gesamt")      x   additional text exist
f) X = MsgBox("Gesamtpreis")      x   "price" not separated


3. MsgBox("*$*")
   Yes    No
a) X = MsgBox("Price")      x
b) X = MsgBox("Price", 123)     x   further argument after "Price"
c) MsgBox "Price"     x   no brackets "(...)"
d) MsgBox "Price", 123     x   see a) and b)
e) X = MsgBox("Price total")      x
f) X = MsgBox("Fullprice")      x


4. MsgBox("*$*"*)
   Yes    No
a) X = MsgBox("Price")      x
b) X = MsgBox("Price", 123)      x
c) MsgBox "Price"     x   no brackets "(...)"
d) MsgBox "Price", 123     x   further argument after "Price"
e) X = MsgBox("Price total")      x
f) X = MsgBox("Fullprice")      x


5. MsgBox "*$*"
   Yes    No
a) X = MsgBox("Price")     x   brackets exists
b) X = MsgBox("Price", 123)     x   brackets exists
c) MsgBox "Price"      x
d) MsgBox "Price", 123      x
e) X = MsgBox("Price total")     x   brackets exists
f) X = MsgBox "Fullprice"      x


6. * = "[$]\$"
   Yes    No
a) strTxt = "[price]$"      x
b) strTxt = "[price]"     x   "$" missing
c) strTxt = "Sum: [Price]$"     x   additional text exist


7. * = "*[$]\$*"
   Yes    No
a) strTxt = "[price]$"      x
b) strTxt = "[price]"     x   "$" missing
c) strTxt = "Sum: [Price]$"      x



as standard

Selecting "OK" will save the current settings as your default for future projects.
Then they can be also reactivated with "Preset" –> "user–defined".

Preset

Optimisation of the settings or reset to defaults.
(inter alia to those values which were saved "as standard").