Jack - 2014-01-15

Okay, I have just got around to learning perl and have fixed the bug in my own copy. As I can't upload changesets, I shall post the changes I made below. As a check, I have also found this bug appearing in your examples, http://www.vortech.nl/examples/fordoku_example/calcmoves_source.html#586

In htmling.pm -> do_source(...)

:::perl
- while ($code =~ /\b($variablenames)\b/i) {
+ while ($code =~ /\b($variablenames)\b(?:(?!\s*(?:$variablenames|$localnames|[0-9])))/i) {

This change should make sure that statements don't get misidentified as variables, like "DO 400" or "GO TO LBA" where DO, GO and/or TO also happen to refer to variables. Here I use the assumption that all variables should precede either an operator (+,-,.AND.,...) or a newline, and in the absence of such a list, that the reverse must also apply.

:::perl
- $code =~ s/([^%#<>]?)\b($stmtnames)\b/$1<font color='#aa2200'>$2<\/font>/ig
+ $code =~ s/(?<![%#<>])\b($stmtnames)\b/<font color='#aa2200'>$1<\/font>/ig

I think the original line has a mistake as the first match block doesn't seem to do anything. The change here prevents the html tag from getting placed inside another tag after the bookmark '#' bit.

In add_info_to_stmt.pm -> lines_used(...)

:::perl
- if ($code[$iline] =~ /..*\b$name\b/) {
+ if ($code[$iline] =~ /..*\b$name\b(?:(?!\s*(?:[0-9])))/) {
...
- if ($code[$iline] =~ /\b$name\b/) {
+ if ($code[$iline] =~ /\b$name\b(?:(?!\s*(?:[0-9])))/) {

Just as in the first code block, only here just a partial fix for the line numbers appearing next to variable names for incorrectly catalogued statements in the tabs of header, variables,.... A partial fix as I haven't added in the variablenames, localnames as above. For the full fix, adding in a list of allowed operators might work better. Also I think the syntax might work differently for types, so that may want to get split into a different method, or as an option to the function call.

Finally, a separate, but small issue, but I have added "GO" to the list of @builtin_statements in stmts.pm, it seems to have been missed of the list :S.