difftastic/vendor/tree-sitter-ocaml/ocaml/corpus/attributes.txt

174 lines
3.9 KiB
Plaintext

===========================
Floating attributes
===========================
[@@@id]
[@@@I.D]
[@@@id let x = x]
[@@@id:]
[@@@id : t]
[@@@id : type t type t]
[@@@id ? A x]
---
(compilation_unit
(floating_attribute (attribute_id))
(floating_attribute (attribute_id))
(floating_attribute
(attribute_id)
(attribute_payload
(value_definition
(let_binding
(value_name)
(value_path (value_name))))))
(floating_attribute (attribute_id) (attribute_payload))
(floating_attribute
(attribute_id)
(attribute_payload
(type_constructor_path (type_constructor))))
(floating_attribute
(attribute_id)
(attribute_payload
(type_definition (type_binding (type_constructor)))
(type_definition (type_binding (type_constructor)))))
(floating_attribute
(attribute_id)
(attribute_payload
(constructor_pattern
(constructor_path (constructor_name))
(value_pattern)))))
===========================
Item attributes
===========================
x [@@id] [@@id]
let x = x [@@id] and x = x [@@id]
module M = M [@@id]
---
(compilation_unit
(expression_item (value_path (value_name))
(item_attribute (attribute_id))
(item_attribute (attribute_id)))
(value_definition
(let_binding
(value_name)
(value_path (value_name))
(item_attribute (attribute_id)))
(let_binding
(value_name)
(value_path (value_name))
(item_attribute (attribute_id))))
(module_definition
(module_binding
(module_name)
(module_path (module_name))
(item_attribute (attribute_id)))))
===========================
Attributes
===========================
let%id x = x and [@id] x = x [@id]
type t = A [@id] [@id]
type t = { x : t [@id]; [@id] }
module M = struct [@id] end [@id];;
x ;%id x
---
(compilation_unit
(value_definition
(attribute_id)
(let_binding
(value_name)
(value_path (value_name)))
(attribute (attribute_id))
(let_binding
(value_name)
(value_path (value_name))))
(attribute (attribute_id))
(type_definition
(type_binding
(type_constructor)
(variant_declaration
(constructor_declaration
(constructor_name)))))
(attribute (attribute_id))
(attribute (attribute_id))
(type_definition
(type_binding
(type_constructor)
(record_declaration
(field_declaration
(field_name)
(type_constructor_path (type_constructor)))
(attribute (attribute_id))
(attribute (attribute_id)))))
(module_definition
(module_binding
(module_name)
(structure (attribute (attribute_id)))))
(attribute (attribute_id))
(expression_item
(sequence_expression
(value_path (value_name))
(attribute_id)
(value_path (value_name)))))
===========================
Item extension
===========================
[%%id];;
{%%M.id|payload|};;
{%%id ab|payload|ab};;
---
(compilation_unit
(item_extension (attribute_id))
(quoted_item_extension (attribute_id) (quoted_string_content))
(quoted_item_extension (attribute_id) (quoted_string_content)))
===========================
Extension
===========================
module type T = [%id]
module M = [%id]
type t = [%id]
let x = [%id]
let x = {%id|payload|}
let x = {%id ab|payload|ab};;
---
(compilation_unit
(module_type_definition
(module_type_name)
(extension (attribute_id)))
(module_definition
(module_binding
(module_name)
(extension (attribute_id))))
(type_definition
(type_binding
(type_constructor)
(extension (attribute_id))))
(value_definition
(let_binding
(value_name)
(extension (attribute_id))))
(value_definition
(let_binding
(value_name)
(quoted_extension (attribute_id) (quoted_string_content))))
(value_definition
(let_binding
(value_name)
(quoted_extension (attribute_id) (quoted_string_content)))))