• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: BUG: AppleScript compilation problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BUG: AppleScript compilation problems


  • Subject: Re: BUG: AppleScript compilation problems
  • From: Steven Angier <email@hidden>
  • Date: Mon, 21 Apr 2003 10:01:23 +1000

On 19/4/03 5:36 AM, "Chris Espinosa" <email@hidden> wrote:

>>> Here are a couple of bugs involving the compiling of comments in
>>> AppleScript:
>>>
>>>
>>> 1. A block comment can't contain an odd number of double-quote characters:
>>>
>>> (*
>>> "
>>> *)
>>>
>>> --> compilation error
>>
>> This is deliberate. Because AS allows you to nest block comments, it does
>> some parsing of the comment's contents. By introducing the beginning of a
>> string, its going to keep going until it sees the end quote.
>>
>> This is explained in the AppleScript language guide (page 26 in my original
>> hardcopy version).
>>
>>> I can understand how this could happen because, when parsing source code,
>>> something has to take precedence. In the previous case, a literal string
>>> takes precedence over a block comment, though in the next case a single-line
>>> comment takes precedence over a literal string:
>>>
>>> --"
>>>
>>> --> compiles OK
>>
>> Right, because a line comment simply consumes everything after it on the
>> line and does no parsing of the comment contents.
>
> This was introduced in AppleScript 1.1 (first reported 10/22/93) and , as
> Mark says, it's a regrettable side-effect of the ability of block comments
> to comment out code. You're both correct in that end-of-line comments
> ignore superficial syntax but block comments obey it.

Thanks Chris (and Mark) for your replies. Having just written code that
parses AppleScript source code for literal strings and comments, I can
understand how this happened.

However, having solved these problems myself, I can also say that it is a
pretty simple task to track whether a given character (e.g. a double quote)
is within a block comment or not, and treat it accordingly.

It may be a regrettable side-effect, but it was certainly easily avoidable.


Steven Angier
Macscript.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: BUG: AppleScript compilation problems (From: "Chris Espinosa" <email@hidden>)

  • Prev by Date: Re: AppleScript Syntax File?
  • Next by Date: Re: alternate script syntax
  • Previous by thread: Re: BUG: AppleScript compilation problems
  • Next by thread: Re: Stay Popup script doesn't work on this Mac
  • Index(es):
    • Date
    • Thread