• 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: Grammar Police in OS X 10.11
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Grammar Police in OS X 10.11


  • Subject: Re: Grammar Police in OS X 10.11
  • From: Phil Stokes <email@hidden>
  • Date: Sun, 17 Jan 2016 23:10:24 +0700

On 17 Jan 2016, at 22:19, Chris Page <email@hidden> wrote:


On Jan 17, 2016, at 3:12 AM, Phil Stokes <email@hidden> wrote:

The particular case mentioned is easily solved as the compiler (or pre-compiler in my app’s case) can be taught to recognise that after a “tell application" there must be a closed, quoted string before a new line (application names don’t have new line characters in them). 

that an heuristic could help provide better error messages for certain cases;

That’s precisely my point.

however, your assumption is not currently true, and an heuristic wouldn't apply generally. Application names can contain any valid filename, which includes line breaks (and fun things like the “delete” character).

It should have been clear by what I went on to say that edge cases can be accounted for by having more than one heuristic. Indeed...

And I thought we were discussing detecting mismatched quotes generally,

…in the code I wrote for my pre-compiler, I had a number of rules for detecting mismatched quotes, including a simple count-check (taking into account any preceded by a comment character or escape characters, like “ \” ") as well as a number of checks for certain grammatical constructions following keywords. 

To give another example, if you have “tell” and a “set” and and odd number of (non-escaped, non-commented) quote marks between them and no other AS keyword intervening, then you know there’s an error there. That rule would also catch both the code samples I gave earlier.  My rule about comment characters on the same line would catch the second code example I gave you (of course, you also have to scan for an opening ‘(*’ and delay judgement until or unless you find a closing ‘*)’). 

I'm not sure an heuristic that only handles ‘tell application "…’ is going to be useful enough.

Of course it wouldn’t. I’d have thought it clear from the context of the discussion that that heuristic was just an example solution to an example problem. I’m not even necessarily arguing that the particular rules I’ve given here are the best way to do it; I’m simply refuting your “AI” comment with rules that I’ve actually implemented myself.  

Are there edge cases that you can come up with that I haven’t accounted for? Sure, we can play whack-a-mole for a few more posts if you like, but my point is that it doesn’t need “AI”; it doesn’t even need rocket science. Just a bit of additional parsing on the code before it gets compiled would do it. 

It’d be a massive boon to the “casual users” that AS is supposedly aimed at to have more helpful help on syntactic errors. Seems like a very valid use of the AS team’s time from where I’m standing (well, sitting actually, somewhat uncomfortably).



Best



Phil 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Re: Grammar Police in OS X 10.11 (From: Nigel Garvey <email@hidden>)
 >Re: Grammar Police in OS X 10.11 (From: Phil Stokes <email@hidden>)
 >Re: Grammar Police in OS X 10.11 (From: Chris Page <email@hidden>)
 >Re: Grammar Police in OS X 10.11 (From: Phil Stokes <email@hidden>)
 >Re: Grammar Police in OS X 10.11 (From: Chris Page <email@hidden>)
 >Re: Grammar Police in OS X 10.11 (From: Phil Stokes <email@hidden>)
 >Re: Grammar Police in OS X 10.11 (From: Chris Page <email@hidden>)

  • Prev by Date: Re: Handlers in a variable
  • Next by Date: Re: Handlers in a variable
  • Previous by thread: Re: Grammar Police in OS X 10.11
  • Next by thread: Re: Grammar Police in OS X 10.11
  • Index(es):
    • Date
    • Thread