> From: Raul Miller > Sent: Thursday, 3 June 2010 14:47 > > 2010/6/2 bill lam <[email protected]>: > > Personally I don't use Note albeit it is inside stdlib, but I think > it > > will be nice to add support for it into format script. But unlike > > other explicit definitions, the pattern for matching this Note is > > rather short, will there be any possibility for bogus match? If it > > were ^Note$ then it would be more secure. > > ^Note$ would not match any useful instances of note, as it > excludes any line that contains both the verb Note and its > argument. > > Perhaps ^\s*Note\b would be appropriate?
Yes it would be nice to make it more secure, but it isn't too bad at the moment. Currently if "Note" occurs somewhere in the script other than in a string or comment there are problems with format (if it isn't supposed to be a note. That means it is or has been defined as a name, or is in an actual Note or noun. I agree that Raul's regex expression is the better fit for common use of Note, however AFAICS the script doesn't use regex. In addition the regex expressions won't guard against some edge cases. For example when Note used as a named object (noun, verb, etc..) or when the string Note occurs at the start of a line in a multiline noun or an actual Note. Also the following is a valid Note, albeit unlikely to occur in common practise. 'random J expression' Note 'test' This is a note ) I will investigate the script workings a bit more to see what options are possible. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
