here's my php syntax check script. reports errors in a bbedit result
window. works under php 9.5-- note edit the path to your php in the
first line

best,

Isao

---

property phpref : "/opt/local/bin/php -l "

on phpErrLine(php_msg, bbfref)
        set errIndicator to " in " & (POSIX path of bbfref) & " on line "
        set off to (offset of errIndicator in php_msg) + (length of
errIndicator)
        get text off thru -1 of php_msg
        return first paragraph of result as integer
end phpErrLine

on phpErrMsg for bbfref out of php_msg
        set errIndicator to " in " & (POSIX path of bbfref) & " on line "
        return text 2 thru (offset of errIndicator in php_msg) of php_msg
end phpErrMsg

tell application "BBEdit"
        tell first text document
                if modified then save
        end tell
        get file of first text document
        set bbfref to result
end tell

try
        do shell script phpref & POSIX path of bbfref
        display dialog "Ok: " & result buttons {"finished checking"} default
button 1
on error php_msg
        set err_line to phpErrLine(php_msg, bbfref)
        set show_err to phpErrMsg out of php_msg for bbfref
        tell application "BBEdit"
                tell text window 1
                        set off to (characterOffset of line err_line)
                        set len to (length of line err_line)
                end tell
                {result_kind:error_kind, result_file:bbfref, start_offset:off,
end_offset:(off + len), result_line:err_line, message:show_err}
                make new results browser with data {result} with properties
{name:"bb php lint"}
                return
        end tell
end try



On Jun 24, 9:44 am, Rod Buchanan <[email protected]> wrote:
> On Jun 24, 2010, at 10:52 AM, Peter Weil wrote:
>
> > Are others able to successfully run the Gruber PHP Syntax Check AppleScript 
> > under v9.5?
>
> > Mine keeps saying:
>
> > Can't make "message" into type integer.
>
> I don't think I've seen that message, but I see this one from time to time:
>
>         "Can't make missing value into type alias"
>
> Seems to only happen when I check files opened from a remote server and have 
> saved them.  If I get the error if I hit space/delete to set the "dirty flag" 
> (for lack of a better phrase) the check runs w/o error.
>
> After thinking a bit I may have just fixed my issue.  I'll know more after 
> further testing.  (Maybe one of the AppleScript gurus out there can tell me.)
>
> Since my errors were happening on clean files from remote servers I made 
> these changes.  I added this line
>
>         set on_disk to on disk of (document of w)
>
> after the line that starts "set is_dirty to modified ..." and changed this 
> line
>
>         if (is_dirty) or (linebreaks is not equal to Unix) then
>
> to this
>
>         if (is_dirty) or (on_disk) or (linebreaks is not equal to Unix) then
>
> It has passed a couple of tests so far.
>
> --
> Rod Buchanan

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.

Reply via email to