Skip to content

"Change All Occurrences" doesn't work well #61

Description

@ojwb

Cut and paste this into owlet:

F.F=F TOF S.F:READF$:F%=F*LENF$:P.F$,F%:N.
D.F

Then right click on one of the F variables in the code and select "Change All Occurrences", then type X. The program now looks like this:

X.X=X TOF S.X:READF$:X%=X*LENF$:P.X$,X%:N.
D.X

I'd expect it only to change uses of the variable F, but it's also changed:

  • F. is FOR abbreviated
  • F$ and F% are also matched when not preceded by a keyword
  • F in D.F is really a string constant not the variable F in this program (though if it were read into a numeric variable it would be a the variable F so this one more forgivable)

It's also failed to match variable F when preceded by a keyword (TOF). I guess it assumes C-like tokenisation rules.

I can see this feature would be handy for golfing code if it actually worked, but if it can't be persuaded to understand BBC BASIC tokenisation rules then perhaps it would be better turned off in owlet. When I first tried it on a real example it looked like it had worked, but actually it had missed a use of the variable, and so broke the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions