home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-12-02 | 2.1 KB | 94 lines | [TEXT/ToyS] |
- (* Syntax Sampler *)
- -- talking to an application
- tell application "Toy Surprise"
- commandLine
- end tell -- or just plain "end"
-
- -- Conditionals
- if expr then
- commandLine
- else if expr then
- commandLine
- else
- commandLine
- end if
-
- -- Iteration
- repeat n times
- end repeat
-
- repeat with i in {v1, v2}
- end repeat
-
- repeat with i from 1 to 100 by 10
- end repeat
-
- repeat while expr
- end repeat
-
- repeat until expr
- end repeat
-
- repeat
- if expr then exit
- end repeat
-
- -- Error handling
- on error
- commandLine
- end error
-
- -- Functions/Subroutines
- on FunctionName(param, param2)
- local a, b, c
- global x, y, z
- commandLine
- return expr
- end FunctionName
-
- to userFunction of x
- return userFunction of expr
- end userFunction
-
- actor "Redfern"
- property propName : expr
- on Message()
- commandLine
- end Message
- end actor
-
- -- assignment
- copy expr to expr
- set variable to object -- links var to object
-
- -- special messages
- class count in obj
- make class at obj with data expr with properties recordOfProperties
-
- (* Expressions. Operators with the same precedence are presented in lists *)
- {before obj, after obj, in front of obj, in back of obj, behind obj}
- {expr whose testExpr, expr where testExpr}
- {beginning, front, end}
- {expr or expr}
- {exrp and expr}
- {not expr}
- {expr is equal to expr, expr = expr, expr isn't equal to expr}
- {object is PropertyTrue, object is not PropertyTrue}
- {expr comes before expr, expr comes after expr, expr < expr, expr = expr, expr ≥ expr}
- {expr starts with expr, expr begins with expr, expr ends with expr, expr contains expr, expr is contained by expr}
- {StringOrList & StringOrList} -- concatenation
- {expr of expr, item i in list} -- element access
- {class ID expr, class named expr, class expr}
- {expr + expr, expr - expr}
- {expr * expr, expr div expr, expr mod expr, expr ÷ expr}
- {expr ^ expr} -- power
- {expr as class} -- type conversion
- {my PropertyOrClass, its PropertyOrClass}
- {every class, some class, first class, last class, middle class}
-
- (* Values *)
- {item1, item2} -- lists
- {label1:value1, label2:value2} --records
- {userFunction of expr, userFunction(expr1, expr2, expr3)}
- {class index, 1st class, 2nd class, 3rd class, fourth class, fifth class, 6th class, pi, space, return, tab}
-