• 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: Mark Alldritt <email@hidden>
  • Date: Fri, 18 Apr 2003 10:30:23 -0700

> 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.

> 2. A single-line comment containing a literal line-feed character (ASCII
> number 10) will not compile:
>
> a. Compile the following line:
>
> "\n"
>
> b. then comment the line out ("--") and recompile.
>
> --> compilation error

Agreed, its a bug. I suspect that AS's parsing is not expecting a non-Mac
OS line ending here. Similarly, if you compile a block-comment containing
Unix line endings, AppleScript does not convert them to Mac OS line endings
as I believe it should (it converts line endings to Mac line endings in all
other cases).

Cheers
-Mark

---------------------------------------------------------------------
Mark Alldritt Late Night Software Ltd.
Phone: 250-380-1725 333 Moss Street
FAX: 250-383-3204 Victoria, B.C.
WEB: http://www.latenightsw.com/ CANADA V8V-4M9
_______________________________________________
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.

  • Prev by Date: Re: Newbie Script Error - Help?
  • Next by Date: Re: Newbie Script Error - Help?
  • Previous by thread: BUG: AppleScript compilation problems
  • Next by thread: Re: BUG: AppleScript compilation problems
  • Index(es):
    • Date
    • Thread