• 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: "Chris Espinosa" <email@hidden>
  • Date: Fri, 18 Apr 2003 12:36:33 -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.

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.

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

This has been noted and filed. Mark's conjecture is probably correct.

Chris Espinosa
Apple
_______________________________________________
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.

  • Follow-Ups:
    • Re: BUG: AppleScript compilation problems
      • From: Steven Angier <email@hidden>
  • Prev by Date: Re: Newbie Script Error - Help?
  • Next by Date: "Lost script" bug confirmed by Apple
  • Previous by thread: Re: BUG: AppleScript compilation problems
  • Next by thread: Re: BUG: AppleScript compilation problems
  • Index(es):
    • Date
    • Thread