WAP-193-Wmlscript Language Specification June-2000
Total Page:16
File Type:pdf, Size:1020Kb
WAP-193-WMLScript Language Specification June-2000 Wireless Application Protocol WMLScript Language Specification Version 1.2 Disclaimer: This document is subject to change without notice. WAP-193 June-2000 Page 2(133) Contents 1. Scope...........................................................................................................................................7 2. Document Status..........................................................................................................................9 2.1 Copyright Notice ....................................................................................................................9 2.2 Errata.....................................................................................................................................9 2.3 Comments .............................................................................................................................9 2.4 Document Changes ...............................................................................................................9 2.4.1 WAP-193 24-Mar-2000.................................................................................................9 2.5 Document History ..................................................................................................................9 3. References.................................................................................................................................11 3.1 Normative references...........................................................................................................11 3.2 Informative References........................................................................................................11 4. Definitions and abbreviations .....................................................................................................12 4.1 Definitions............................................................................................................................12 4.2 Abbreviations .......................................................................................................................13 5. Overview ....................................................................................................................................14 5.1 Why Scripting? ....................................................................................................................14 5.2 Benefits of using WMLScript................................................................................................14 6. WMLScript Core.........................................................................................................................15 6.1 Lexical Structure ..................................................................................................................15 6.1.1 Case Sensitivity ............................................................................................................15 6.1.2 Whitespace and Line Breaks ........................................................................................15 6.1.3 Usage of Semicolons....................................................................................................15 6.1.4 Comments ....................................................................................................................16 6.1.5 Literals..........................................................................................................................16 6.1.5.1 Integer Literals ..........................................................................................................16 6.1.5.2 Floating-Point Literals................................................................................................17 6.1.5.3 String Literals ............................................................................................................17 6.1.5.4 Boolean Literals.........................................................................................................18 6.1.5.5 Invalid Literal .............................................................................................................18 6.1.6 Identifiers......................................................................................................................19 6.1.7 Reserved Words...........................................................................................................19 6.1.8 Name Spaces ...............................................................................................................20 6.2 Variables and Data Types....................................................................................................20 6.2.1 Variable Declaration......................................................................................................20 6.2.2 Variable Scope and Lifetime .........................................................................................20 6.2.3 Variable Access ............................................................................................................21 6.2.4 Variable Type................................................................................................................21 6.2.5 L-Values .......................................................................................................................21 6.2.6 Type Equivalency..........................................................................................................22 6.2.7 Numeric Values ............................................................................................................22 6.2.7.1 Integer Size...............................................................................................................22 6.2.7.2 Floating-point Size.....................................................................................................22 6.2.8 String Values ................................................................................................................23 6.2.9 Boolean Values.............................................................................................................23 6.3 Operators and Expressions..................................................................................................23 6.3.1 Assignment Operators ..................................................................................................23 6.3.2 Arithmetic Operators.....................................................................................................24 6.3.3 Logical Operators .........................................................................................................25 6.3.4 String Operators ...........................................................................................................25 6.3.5 Comparison Operators..................................................................................................26 6.3.6 Array Operators ............................................................................................................26 © Wireless Application Protocol Forum, Ltd, 2000 All rights reserved. WAP-193 June-2000 Page 3(133) 6.3.7 Comma Operator ..........................................................................................................26 6.3.8 Conditional Operator.....................................................................................................27 6.3.9 typeof Operator.............................................................................................................27 6.3.10 isvalid Operator .........................................................................................................28 6.3.11 Expressions...............................................................................................................28 6.3.12 Expression Bindings..................................................................................................28 6.4 Functions .............................................................................................................................30 6.4.1 Declaration....................................................................................................................30 6.4.2 Function Calls ...............................................................................................................31 6.4.2.1 Local Script Functions ...............................................................................................31 6.4.2.2 External Functions.....................................................................................................32 6.4.2.3 Library Functions.......................................................................................................32 6.4.3 Default Return Value.....................................................................................................33 6.5 Statements...........................................................................................................................33 6.5.1 Empty Statement ..........................................................................................................33 6.5.2 Expression Statement...................................................................................................33 6.5.3 Block Statement............................................................................................................34 6.5.4 Variable Statement .......................................................................................................34 6.5.5 If Statement ..................................................................................................................35