.NamedType string (None)
Optional [ NamedType string (None) ]
Dict [ NamedType string (None), NamedType int (None) ]
Module arith {
  Use asdl examples demo_lib {
    value
  }

  Type op_id {
    Sum {
      Constructor Plus
      Constructor Minus
      Constructor Star
    }
  }

  Type op_array {
    Product {
      Field 'ops' List [ NamedType op_id (None) ]
    }
  }

  Type assign {
    Product {
      Field 'name' NamedType string (None)
      Field 'flags' List [ NamedType string (None) ]
    }
  }

  Type cflow {
    Sum {
      Constructor Break
      Constructor Continue
      Constructor Return {
        Field 'status' NamedType int (None)
      }
    }
  }

  Type source_location {
    Product {
      Field 'path' NamedType string (None)
      Field 'line' NamedType int (None)
      Field 'col' NamedType int (None)
      Field 'length' NamedType int (None)
    }
  }

  Type word {
    Product {
      Field 'value' NamedType string (None)
    }
  }

  Type bool_expr {
    Sum {
      Constructor Binary {
        Field 'left' NamedType word (None)
        Field 'right' NamedType word (None)
      }
      Constructor Unary {
        Field 'child' NamedType word (None)
      }
      Constructor LogicalNot {
        Field 'b' NamedType bool_expr (None)
      }
      Constructor LogicalBinary {
        Field 'op' NamedType op_id (None)
        Field 'left' NamedType bool_expr (None)
        Field 'right' NamedType bool_expr (None)
      }
    }
  }

  Type Token {
    Product {
      Field 's' NamedType string (None)
      Field 'b' NamedType bool (None)
    }
  }

  Type cflow2 {
    Sum {
      Constructor Break
      Constructor Continue
      Constructor Return {
        Field 'status' NamedType int (None)
      }
    }
  }

  Type Dicts {
    Product {
      Field 'ss' Dict [ NamedType string (None), NamedType string (None) ]
      Field 'ib' Dict [ NamedType int (None), NamedType bool (None) ]
      Field 'tokens' Dict [ NamedType string (None), NamedType Token (None) ]
    }
  }

  Type flag_type {
    Sum {
      Constructor Bool
      Constructor Int
      Constructor Float
      Constructor Str
      Constructor Enum {
        Field 'alts' List [ NamedType string (None) ]
      }
    }
  }

  Type SetToArg_ {
    Product {
      Field 'name' NamedType string (None)
      Field 'flag_type' NamedType flag_type (None)
      Field 'quit_parsing_flags' NamedType bool (None)
    }
  }

  Type Strings {
    Product {
      Field 'required' NamedType string (None)
      Field 'optional' Optional [ NamedType string (None) ]
    }
  }

  Type Maybes {
    Product {
      Field 'op' Optional [ NamedType Token (None) ]
      Field 'arg' Optional [ NamedType word (None) ]
    }
  }

  Type OptionalList {
    Product {
      Field 'words' Optional [ List [ NamedType word (None) ] ]
    }
  }

}
Module arith {
  Use asdl examples demo_lib {
    value
  }

  Type op_id {
    Sum {
      Constructor Plus
      Constructor Minus
      Constructor Star
    }
  }

  Type op_array {
    Product {
      Field 'ops' List [ NamedType op_id (<asdl.ast.SimpleSum object at 0x7fabd55d02d0>) ]
    }
  }

  Type assign {
    Product {
      Field 'name' NamedType string (None)
      Field 'flags' List [ NamedType string (None) ]
    }
  }

  Type cflow {
    Sum {
      Constructor Break
      Constructor Continue
      Constructor Return {
        Field 'status' NamedType int (None)
      }
    }
  }

  Type source_location {
    Product {
      Field 'path' NamedType string (None)
      Field 'line' NamedType int (None)
      Field 'col' NamedType int (None)
      Field 'length' NamedType int (None)
    }
  }

  Type word {
    Product {
      Field 'value' NamedType string (None)
    }
  }

  Type bool_expr {
    Sum {
      Constructor Binary {
        Field 'left' NamedType word (<asdl.ast.Product object at 0x7fabd55d0ad0>)
        Field 'right' NamedType word (<asdl.ast.Product object at 0x7fabd55d0ad0>)
      }
      Constructor Unary {
        Field 'child' NamedType word (<asdl.ast.Product object at 0x7fabd55d0ad0>)
      }
...      Constructor LogicalNot {
        Field 'b' NamedType bool_expr (<asdl.ast.Sum object at 0x7fabd55d0fd0>)
      }
      Constructor LogicalBinary {
        Field 'op' NamedType op_id (<asdl.ast.SimpleSum object at 0x7fabd55d02d0>)
        Field 'left' NamedType bool_expr (<asdl.ast.Sum object at 0x7fabd55d0fd0>)
        Field 'right' NamedType bool_expr (<asdl.ast.Sum object at 0x7fabd55d0fd0>)
      }
    }
  }

  Type Token {
    Product {
      Field 's' NamedType string (None)
      Field 'b' NamedType bool (None)
    }
  }

  Type cflow2 {
    Sum {
      Constructor Break
      Constructor Continue
      Constructor Return {
        Field 'status' NamedType int (None)
      }
    }
  }

  Type Dicts {
    Product {
      Field 'ss' Dict [ NamedType string (None), NamedType string (None) ]
      Field 'ib' Dict [ NamedType int (None), NamedType bool (None) ]
      Field 'tokens' Dict [ NamedType string (None), NamedType Token (<asdl.ast.Product object at 0x7fabd55db150>) ]
    }
  }

  Type flag_type {
    Sum {
      Constructor Bool
      Constructor Int
      Constructor Float
      Constructor Str
      Constructor Enum {
        Field 'alts' List [ NamedType string (None) ]
      }
    }
  }

  Type SetToArg_ {
    Product {
      Field 'name' NamedType string (None)
      Field 'flag_type' NamedType flag_type (<asdl.ast.Sum object at 0x7fabd55db910>)
      Field 'quit_parsing_flags' NamedType bool (None)
    }
  }

  Type Strings {
    Product {
      Field 'required' NamedType string (None)
      Field 'optional' Optional [ NamedType string (None) ]
    }
  }

  Type Maybes {
    Product {
      Field 'op' Optional [ NamedType Token (<asdl.ast.Product object at 0x7fabd55db150>) ]
      Field 'arg' Optional [ NamedType word (<asdl.ast.Product object at 0x7fabd55d0ad0>) ]
    }
  }

  Type OptionalList {
    Product {
      Field 'words' Optional [ List [ NamedType word (<asdl.ast.Product object at 0x7fabd55d0ad0>) ] ]
    }
  }

}

Module foo {
  Type point {
    Product {
      Field 'x' Optional [ NamedType int (None) ]
      Field 'y' List [ NamedType int (None) ]
    }
  }

  Type action {
    Sum {
      Constructor Foo
      Constructor Bar {
        Field 'z' NamedType point (None)
      }
    }
  }

  Type foo {
    Product {
      Field 'span_ids' List [ NamedType int (None) ]
    }
  }

  Type bar {
    Product {
      Field 'options' Dict [ NamedType string (None), NamedType int (None) ]
    }
  }

  Type does_not_resolve {
    Product {
      Field 'zz' NamedType typo (None)
    }
  }

  Type color {
    Sum {
      Constructor Red
      Constructor Green
    }
  }

  Type color2 {
    Sum {
      Constructor Red
      Constructor Green
    }
  }

  Type color3 {
    Sum {
      Constructor Red
      Constructor Green
      generate ['integers']
    }
  }

  Type color4 {
    Sum {
      Constructor Blue
      Constructor Purple
      generate ['uint16']
    }
  }

  Type spam {
    Product {
      Field 'pipe_status' Optional [ List [ NamedType int (None) ] ]
    }
  }

  Type spam2 {
    Product {
      Field 'pipe_status' Optional [ List [ NamedType int (None) ] ]
    }
  }

}

Syntax error on line 1: Expected token Name, got )
Syntax error on line 1: Expected 1 type param to List
Syntax error on line 1: Expected zero type params to string
Syntax error on line 1: Expected token Name, got ]
Syntax error on line 1: Expected 2 type params to Dict
Syntax error on line 1: Expected token Name, got ]
Syntax error on line 1: Expected token RBrace, got (
Syntax error on line 1: Invalid operator :
Syntax error on line 1: Expected token LBracket, got }
Syntax error on line 1: Expected token RBracket, got ,
Syntax error on line 1: Invalid code gen option 'invalid'
<class 'asdl.ast.Module'>
Module foo {
  Type point {
    Product {
      Field 'x' NamedType int (None)
      Field 'y' NamedType int (None)
    }
  }

  Type place {
    Sum {
      Constructor None
      Constructor Two {
        Field 'a' NamedType point (<asdl.ast.Product object at 0x7fabd55d01d0>)
        Field 'b' NamedType point (<asd....
----------------------------------------------------------------------
Ran 8 tests in 0.005s

OK
l.ast.Product object at 0x7fabd55d01d0>)
      }
    }
  }

  Type options {
    Product {
      Field 'names' Dict [ NamedType string (None), NamedType int (None) ]
    }
  }

}

Syntax error on line <unknown>: Couldn't find type 'typo'
Syntax error on line <unknown>: Optional primitive type int not allowed
Syntax error on line <unknown>: Optional simple sum type color not allowed
Module shared_variant {
  Type prod {
    Product {
      Field 'a' NamedType string (None)
      Field 'b' NamedType string (None)
    }
  }

  Type DoubleQuoted {
    Product {
      Field 'left' NamedType int (None)
      Field 'tokens' List [ NamedType string (None) ]
    }
  }

  Type expr {
    Sum {
      Constructor Binary {
        Field 'left' NamedType expr (<asdl.ast.Sum object at 0x7fabd55d0450>)
        Field 'right' NamedType expr (<asdl.ast.Sum object at 0x7fabd55d0450>)
      }
      Constructor DoubleQuoted %DoubleQuoted
    }
  }

  Type Token {
    Product {
      Field 'id' NamedType int (None)
      Field 'val' NamedType string (None)
    }
  }

  Type tok {
    Sum {
      Constructor Eof
      Constructor Token %Token
    }
  }

  Type tok_struct {
    Product {
      Field 'token' NamedType tok (<asdl.ast.Sum object at 0x7fabd55d0150>)
      Field 'x' NamedType int (None)
    }
  }

  Type tok_array {
    Product {
      Field 'tokens' List [ NamedType tok (<asdl.ast.Sum object at 0x7fabd55d0150>) ]
    }
  }

  Type word_part {
    Sum {
      Constructor Literal {
        Field 's' NamedType string (None)
      }
      Constructor DoubleQuoted %DoubleQuoted
    }
  }

  Type cflow {
    Sum {
      Constructor Break
      Constructor Continue
      Constructor Return {
        Field 'val' NamedType int (None)
      }
    }
  }

}

<class '_devbuild.gen.shared_variant_asdl.DoubleQuoted'>
<class '_devbuild.gen.shared_variant_asdl.expr'>
<class '_devbuild.gen.shared_variant_asdl.expr_e'>
<class '_devbuild.gen.shared_variant_asdl.word_part'>
<class '_devbuild.gen.shared_variant_asdl.word_part_e'>
(DoubleQuoted left:5 tokens:[foo bar])
(expr.Binary left:(DoubleQuoted left:5 tokens:[foo bar]) right:...0x7fabd564afa0)