• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
2   Use of this source code is governed by a BSD-style license that can be
3  found in the LICENSE file. */
4
5/* Test Exception productions
6
7Run with --test to generate an AST and verify that all comments accurately
8reflect the state of the Nodes.
9
10BUILD Type(Name)
11This comment signals that a node of type <Type> is created with the
12name <Name>.
13
14ERROR Error String
15This comment signals that a error of <Error String> is generated.  The error
16is not assigned to a node, but are expected in order.
17
18PROP Key=Value
19This comment signals that a property has been set on the Node such that
20<Key> = <Value>.
21
22TREE
23Type(Name)
24  Type(Name)
25  Type(Name)
26    Type(Name)
27    ...
28This comment signals that a tree of nodes matching the BUILD comment
29symatics should exist.  This is an exact match.
30*/
31
32
33/* TREE
34 *Exception(MyExc)
35 */
36exception MyExc { };
37
38/* TREE
39 *Exception(MyExcInherit)
40 *  Inherit(Foo)
41 */
42exception MyExcInherit : Foo {};
43
44/* ERROR Unexpected keyword "exception" after keyword "partial". */
45partial exception MyExcPartial { };
46
47/* TREE
48 *Exception(MyExcBig)
49 *  ExceptionField(MyString)
50 *    Type()
51 *      PrimitiveType(DOMString)
52 *  Error(Unexpected "=" after identifier "ErrorSetLong".)
53 *  ExceptionField(MyLong)
54 *    Type()
55 *      PrimitiveType(long)
56 */
57exception MyExcBig {
58  DOMString MyString;
59  unsigned long long ErrorSetLong = 123;
60  long MyLong;
61};
62
63
64/* ERROR Unexpected "{" after keyword "exception". */
65exception {
66  DOMString? setString = null;
67};
68
69
70/* ERROR Unexpected identifier "NoColon" after identifier "ForParent". */
71exception ForParent NoColon {
72  DOMString? setString = null;
73};
74
75/* TREE
76 *Exception(MyExcConst)
77 *  Const(setString)
78 *    PrimitiveType(DOMString)
79 *    Value(NULL)
80 */
81exception MyExcConst {
82  const DOMString? setString = null;
83};
84
85
86
87
88