Kay C Lan
lan.kc.macmail at gmail.com
Mon Aug 31 02:46:31 CEST 2015
On Mon, Aug 31, 2015 at 6:31 AM, Peter Haworth <pete at lcsql.com> wrote:
> I decided to give this another try since I really like using Textmate.
> Thank you.
> However it seems that not all errors are detected. So far the missing
> errors are those associated with Strict Compile mode, e.g. missing local
> variable definitions, missing quotes around certain language elements.
In the 7.1 rc 1 Dictionary it says this under the 'script' property entry:
LiveCode compiles the script immediately after it is set.
For the 'scriptParsingError' message entry:
Sent to an object when its script cannot be compiled.
Followed by this VERY important Note:
The scriptParsingError message is no longer sent. Instead, any parse error
is now put into the result immediately after setting the script of an
New Main Stack
Added a button and named it 'one'
Added a button and named it 'two'
In btn one added a script:
if (the script of btn "two" = empty) then
set the script of btn "two" to "on mouseUp" & cr & \
"repeat with x = 1 to 10" & cr & \
"put " & quote & "A" & quote & "x into y" & cr & \
"end repeat" & cr & \
"put y into msg" & cr & \
set the script of btn "two" to empty
put the result into msg
Clicked on btn 'one' and I get this:
I was expecting an error, because the line:
put "A"x into y
is wrong, but the msg if I were to Apply that script in the Script Editor
button "two": compilation error at line 3 (Expression: bad factor), char 8
So I can figure out the relationship between the 3 and the 8, but the fist
number on each line is pretty cryptic.
With Strict Compilation turned On, if I amend the offending line to:
"put " & quote & "A" & quote & " & x into y" & cr & \
And click btn 'one' I get no errors. But if I open the script to btn 'two'
when it contains the script:
repeat with x = 1 to 10
put "A" & x into y
put y into msg
and Apply it I get the Error msg:
button "two": compilation error at line 3 (Chunk: can't create a variable
with that name (explicitVariables?)) near "y", char 13
So this wouldn't appear to be anything to do with sts but how LC handles
'set the script of' and apparently a different level of syntax checking
when compared to using the SE's Apply btn.
Nice find Peter!
There would seem to be two issues, firstly the different level of
Compilation checking, and secondly, the Dictionary entry for
'scriptParseError' implies that the error message we are going to get is
human readable. What currently is presented in the result is of little use
unless there is documentation to decipher the numbers; although the SE
style error message is really what we want.
More information about the use-livecode