Wmlscript Reference Version 1.1
Total Page:16
File Type:pdf, Size:1020Kb
WMLScript Reference Version 1.1 http://www.forum.nokia.com Product number: SDK-01-000-003 September 1999 WMLScript Reference Version 1.1 Product number: SDK-01-000-003 Copyright © Nokia Corporation 1999. All rights reserved. We welcome and consider all comments and suggestions. Please send them to: Nokia Group Finland P.O. Box 226, FIN-00045 NOKIA GROUP Tel. +358 9 180 71 Fax. +358 9 656 388 Internet mail address: [email protected] http://www.forum.nokia.com This document is part of the Nokia Wireless Application Protocol Toolkit. The contents of this guide are based on the Wireless Application Protocol WMLScript Specification Version 1.1 (WMLScript Specification Version 16-June-1999) and on the Wireless Application Protocol WMLScript Standard Libraries Specification Version 1.1 (WMLScript Standard Libraries Specification Version 16-June- 1999). Reproduction, distribution or transmission of part or all of this documentation in any form without the prior written permission of Nokia is prohibited. The content of this documentation may be changed without prior notice. “Nokia,” the arrows symbol and Nokia’s product names are trademarks of Nokia. Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Portions of the Nokia WAP Toolkit contain technology used under licence from the World Wide Web Consortium and are copyrighted by the World Wide Web Consortium (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). © 1999. Nokia Corporation. Nokia is registered trademark of Nokia Corporation. Contents Introduction ................................................................................. 1 Benefits of using WMLScript .................................................................................. 1 WMLScript bytecode interpreter............................................................................ 2 Interpreter Architecture ..................................................................................... 2 Access control ..................................................................................................... 3 Character Set ....................................................................................................... 3 Typographical conventions...................................................................................... 4 Related documents.................................................................................................... 4 Documents included in the Nokia WAP Toolkit ............................................ 4 Other references.................................................................................................. 4 WMLScript core........................................................................... 7 WMLScript and URLs............................................................................................. 7 Fragment anchors................................................................................................ 7 URL calls and parameter passing....................................................................... 8 Character escaping .............................................................................................. 8 Relative URLs ..................................................................................................... 8 Lexical structure ....................................................................................................... 9 Content types...................................................................................................... 9 Case sensitivity.................................................................................................... 9 White space and line breaks ............................................................................... 9 Use of semicolons ............................................................................................. 10 Comments ......................................................................................................... 10 Literals ............................................................................................................... 10 Identifiers........................................................................................................... 14 Reserved words ................................................................................................. 15 Name spaces ...................................................................................................... 16 Variables and data types......................................................................................... 16 Variable declaration .......................................................................................... 16 Variable scope and lifetime............................................................................... 16 Variable access................................................................................................... 17 Variable type...................................................................................................... 17 L-values.............................................................................................................. 17 Type equivalency .............................................................................................. 18 Numeric values.................................................................................................. 18 String values....................................................................................................... 19 Boolean values................................................................................................... 19 Operators and expressions..................................................................................... 19 Assignment operators....................................................................................... 19 Arithmetical operators...................................................................................... 20 Logical operators............................................................................................... 22 i WMLScript Reference String operators................................................................................................. 22 Comparison operators...................................................................................... 23 Array operators................................................................................................. 23 Comma operator............................................................................................... 24 Conditional operator ........................................................................................ 24 typeof operator.................................................................................................. 24 isvalid operator.................................................................................................. 25 Expressions........................................................................................................ 25 Expression bindings.......................................................................................... 25 Functions................................................................................................................. 27 Declaration ........................................................................................................ 27 Function calls .................................................................................................... 28 Default return value.......................................................................................... 31 Statements ............................................................................................................... 31 Empty statement ............................................................................................... 31 Expression statement ........................................................................................ 31 Block statement................................................................................................. 32 Variable statement............................................................................................. 32 If statement........................................................................................................ 34 While statement................................................................................................. 34 For statement..................................................................................................... 35 Break statement................................................................................................. 36 Continue statement........................................................................................... 36 Return statement............................................................................................... 37 Libraries................................................................................................................... 37 Standard libraries............................................................................................... 37 Pragmas ................................................................................................................... 38 External compilation units ............................................................................... 38 Access control ..................................................................................................