=================
Basic string meta
=================

rule rule_id1 {
    meta:
        key = "abc"
    condition:
        true
}

---

(yara_file
    (rule 
        head: (rule_head
            id: (identifier)
        )
        body: (rule_body
            metas: (meta_list
                (meta
                    id: (identifier)
                    value: (string_literal
                        str: (string_literal_str)
                    )
                )
            )
            
            condition: (bool_literal)
        )
    )
)


=====================
Multiple string metas
=====================

rule rule_id1 {
    meta:
        key = "abc"
        key2 = "def"
        key3 = "ghi"
    condition:
        true
}

---

(yara_file
    (rule 
        head: (rule_head
            id: (identifier)
        )
        body: (rule_body
            metas: (meta_list
                (meta
                    id: (identifier)
                    value: (string_literal
                        str: (string_literal_str)
                    )
                )
                (meta
                    id: (identifier)
                    value: (string_literal
                        str: (string_literal_str)
                    )
                )
                (meta
                    id: (identifier)
                    value: (string_literal
                        str: (string_literal_str)
                    )
                )
            )
            
            condition: (bool_literal)
        )
    )
)


==============================
Basic string meta w escape seq
==============================

rule rule_id1 {
    meta:
        key = "abc\n\"\r\t\\\xFD\x00"
    condition:
        true
}

---

(yara_file
    (rule 
        head: (rule_head
            id: (identifier)
        )
        body: (rule_body
            metas: (meta_list
                (meta
                    id: (identifier)
                    value: (string_literal
                        str: (string_literal_str
                            (string_esc_seq)
                            (string_esc_seq)
                            (string_esc_seq)
                            (string_esc_seq)
                            (string_esc_seq)
                            (string_esc_seq)
                            (string_esc_seq)
                        )
                    )
                )
            )
            
            condition: (bool_literal)
        )
    )
)


================================
Basic string meta w empty string
================================

rule rule_id1 {
    meta:
        key = ""
    condition:
        true
}

---

(yara_file
    (rule 
        head: (rule_head
            id: (identifier)
        )
        body: (rule_body
            metas: (meta_list
                (meta
                    id: (identifier)
                    value: (string_literal)
                )
            )
            
            condition: (bool_literal)
        )
    )
)


====================
Multiple types metas
====================

rule rule_id1 {
    meta:
        key1 = "abc"
        key2 = true
        key3 = 42
        key4 = -42
    condition:
        true
}

---

(yara_file
    (rule 
        head: (rule_head
            id: (identifier)
        )
        body: (rule_body
            metas: (meta_list
                (meta
                    id: (identifier)
                    value: (string_literal
                        str: (string_literal_str)
                    )
                )
                (meta
                    id: (identifier)
                    value: (bool_literal)
                )
                (meta
                    id: (identifier)
                    value: (int_literal
                        (dec_uint_literal_value)
                    )
                )
                (meta
                    id: (identifier)
                    value: (int_literal
                        (dec_uint_literal_value)
                    )
                )
            )
            
            condition: (bool_literal)
        )
    )
)


=========================================
Basic string meta w unknown escape seq #1
=========================================

rule rule_id1 {
    meta:
        key = "abc\n\odef"
    condition:
        true
}

---

(yara_file
    (rule 
        head: (rule_head
            id: (identifier)
        )
        body: (rule_body
            metas: (meta_list
                (meta
                    id: (identifier)
                    value: (string_literal
                        str: (string_literal_str
                            (string_esc_seq)
                            (string_esc_seq)
                        )
                    )
                )
            )
            
            condition: (bool_literal)
        )
    )
)


=========================================
Basic string meta w unknown escape seq #2
=========================================

rule rule_id1 {
    meta:
        key = "abc\n\x4Gdef"
    condition:
        true
}

---

(yara_file
    (rule 
        head: (rule_head
            id: (identifier)
        )
        body: (rule_body
            metas: (meta_list
                (meta
                    id: (identifier)
                    value: (string_literal
                        str: (string_literal_str
                            (string_esc_seq)
                        )
                        (ERROR
                            (identifier)
                        )
                    )
                )
            )
            
            condition: (bool_literal)
        )
    )
)


==============
Empty meta body
===============

rule rule_id1 {
    meta:

    condition:
        true
}

---

(yara_file
    (ERROR 
        (rule_head
            (identifier)
        )
        (identifier)
        (bool_literal)
    )
)
