Home | History | Annotate | Download | only in test_parser
      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 Interface productions
      6 
      7 Run with --test to generate an AST and verify that all comments accurately
      8 reflect the state of the Nodes.
      9 
     10 BUILD Type(Name)
     11 This comment signals that a node of type <Type> is created with the
     12 name <Name>.
     13 
     14 ERROR Error String
     15 This comment signals that a error of <Error String> is generated.  The error
     16 is not assigned to a node, but are expected in order.
     17 
     18 PROP Key=Value
     19 This comment signals that a property has been set on the Node such that
     20 <Key> = <Value>.
     21 
     22 TREE
     23 Type(Name)
     24   Type(Name)
     25   Type(Name)
     26     Type(Name)
     27     ...
     28 This comment signals that a tree of nodes matching the BUILD comment
     29 symatics should exist.  This is an exact match.
     30 */
     31 
     32 
     33 /* TREE
     34  *Interface(MyIFace)
     35  */
     36 interface MyIFace { };
     37 
     38 /* TREE
     39  *Interface(MyIFaceInherit)
     40  *  Inherit(Foo)
     41  */
     42 interface MyIFaceInherit : Foo {};
     43 
     44 /* TREE
     45  *Interface(MyIFacePartial)
     46  */
     47 partial interface MyIFacePartial { };
     48 
     49 /* ERROR Unexpected ":" after identifier "MyIFaceInherit". */
     50 partial interface MyIFaceInherit : Foo {};
     51 
     52 /* TREE
     53  *Interface(MyIFaceBig)
     54  *  Const(setString)
     55  *    PrimitiveType(DOMString)
     56  *    Value(NULL)
     57  */
     58 interface MyIFaceBig {
     59   const DOMString? setString = null;
     60 };
     61 
     62 /* TREE
     63  *Interface(MyIFaceBig2)
     64  *  Const(nullValue)
     65  *    PrimitiveType(DOMString)
     66  *    Value(NULL)
     67  *  Const(longValue)
     68  *    PrimitiveType(long)
     69  *    Value(123)
     70  *  Const(longValue2)
     71  *    PrimitiveType(long long)
     72  *    Value(123)
     73  *  Attribute(myString)
     74  *    Type()
     75  *      PrimitiveType(DOMString)
     76  *  Attribute(readOnlyString)
     77  *    Type()
     78  *      PrimitiveType(DOMString)
     79  *  Operation(myFunction)
     80  *    Type()
     81  *      PrimitiveType(void)
     82  *    Arguments()
     83  *      Argument(myLong)
     84  *        Type()
     85  *          PrimitiveType(long long)
     86  */
     87 interface MyIFaceBig2 {
     88   const DOMString? nullValue = null;
     89   const long longValue = 123;
     90   const long long longValue2 = 123;
     91   attribute DOMString myString;
     92   readonly attribute DOMString readOnlyString;
     93   void myFunction(long long myLong);
     94 };
     95 
     96 
     97 /* TREE
     98  *Interface(MyIFaceSpecials)
     99  *  Operation(set)
    100  *    Type()
    101  *      PrimitiveType(void)
    102  *    Arguments()
    103  *      Argument(property)
    104  *        Type()
    105  *          PrimitiveType(DOMString)
    106  *  Operation(_unnamed_)
    107  *    Type()
    108  *      PrimitiveType(double)
    109  *    Arguments()
    110  *      Argument(property)
    111  *        Type()
    112  *          PrimitiveType(DOMString)
    113  *  Operation(GetFiveSix)
    114  *    Type()
    115  *      PrimitiveType(long long)
    116  *      Array(5)
    117  *        Array(6)
    118  *    Arguments()
    119  *      Argument(arg)
    120  *        Type()
    121  *          Typeref(SomeType)
    122  */
    123 interface MyIFaceSpecials {
    124   setter creator void set(DOMString property);
    125   getter double (DOMString property);
    126   long long [5][6] GetFiveSix(SomeType arg);
    127 };
    128