2024-02-15 01:23:33 +00:00
|
|
|
================================================================================
|
|
|
|
Simple Enum
|
|
|
|
================================================================================
|
|
|
|
|
|
|
|
enum Foobar {
|
|
|
|
Foo,
|
|
|
|
Bar,
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
2024-02-16 15:55:15 +00:00
|
|
|
(statement_kind
|
|
|
|
(type_definition
|
|
|
|
(enum_definition
|
|
|
|
(identifier)
|
|
|
|
(identifier)
|
|
|
|
(identifier))))))
|
2024-02-15 01:23:33 +00:00
|
|
|
|
|
|
|
================================================================================
|
2024-02-18 20:07:53 +00:00
|
|
|
Enum with Arguments
|
2024-02-15 01:23:33 +00:00
|
|
|
================================================================================
|
|
|
|
|
2024-02-18 20:07:53 +00:00
|
|
|
enum Foobar<T, U> {
|
|
|
|
Foo<T>,
|
|
|
|
Bar<U>,
|
2024-02-15 01:23:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
2024-02-16 15:55:15 +00:00
|
|
|
(statement_kind
|
|
|
|
(type_definition
|
|
|
|
(enum_definition
|
|
|
|
(identifier)
|
2024-02-18 20:07:53 +00:00
|
|
|
(type_arguments
|
|
|
|
(type
|
|
|
|
(identifier))
|
|
|
|
(type
|
|
|
|
(identifier)))
|
2024-02-16 15:55:15 +00:00
|
|
|
(identifier)
|
2024-02-18 20:07:53 +00:00
|
|
|
(type_arguments
|
|
|
|
(type
|
|
|
|
(identifier)))
|
2024-02-16 15:55:15 +00:00
|
|
|
(identifier)
|
2024-02-18 20:07:53 +00:00
|
|
|
(type_arguments
|
|
|
|
(type
|
2024-02-16 15:55:15 +00:00
|
|
|
(identifier))))))))
|
2024-02-15 01:23:33 +00:00
|
|
|
|
2024-02-18 20:07:53 +00:00
|
|
|
================================================================================
|
|
|
|
Complex Enum
|
|
|
|
================================================================================
|
|
|
|
|
|
|
|
enum Foobar<T> {
|
|
|
|
Foo<Foo>,
|
|
|
|
Bar<int, float>,
|
2024-02-18 20:44:57 +00:00
|
|
|
Baz<Option<T>>,
|
2024-02-18 20:07:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
|
|
|
(statement_kind
|
|
|
|
(type_definition
|
|
|
|
(enum_definition
|
|
|
|
(identifier)
|
|
|
|
(type_arguments
|
|
|
|
(type
|
|
|
|
(identifier)))
|
|
|
|
(identifier)
|
|
|
|
(type_arguments
|
|
|
|
(type
|
|
|
|
(identifier)))
|
|
|
|
(identifier)
|
|
|
|
(type_arguments
|
|
|
|
(type)
|
|
|
|
(type))
|
|
|
|
(identifier)
|
|
|
|
(type_arguments
|
|
|
|
(type
|
|
|
|
(identifier)
|
2024-02-18 20:09:53 +00:00
|
|
|
(type_arguments
|
|
|
|
(type
|
|
|
|
(identifier))))))))))
|
2024-02-18 20:07:53 +00:00
|
|
|
|
2024-02-15 01:23:33 +00:00
|
|
|
================================================================================
|
|
|
|
Simple Enum Instance
|
|
|
|
================================================================================
|
|
|
|
|
2024-02-18 20:09:53 +00:00
|
|
|
FooBar::Foo
|
2024-02-15 01:23:33 +00:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
2024-02-16 15:55:15 +00:00
|
|
|
(statement_kind
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(enum_instance
|
|
|
|
(identifier)
|
|
|
|
(identifier)))))))
|
2024-02-15 01:23:33 +00:00
|
|
|
|
|
|
|
================================================================================
|
|
|
|
Nested Enum Instance
|
|
|
|
================================================================================
|
|
|
|
|
2024-02-15 07:22:04 +00:00
|
|
|
FooBar::Bar(BazBuf::Baz(123))
|
2024-02-15 01:23:33 +00:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
2024-02-16 15:55:15 +00:00
|
|
|
(statement_kind
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(enum_instance
|
|
|
|
(identifier)
|
|
|
|
(identifier)
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(enum_instance
|
|
|
|
(identifier)
|
|
|
|
(identifier)
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer))))))))))))
|