Anjuta Developers Reference Manual: Anjuta token

## Anjuta token Anjuta token — Anjuta token |

## Stability Level

Unstable, unless otherwise indicated

## Functions

void | (*AnjutaTokenForeachFunc) ()
AnjutaToken * | anjuta_token_new_string ()
AnjutaToken * | anjuta_token_new_string_len ()
AnjutaToken * | anjuta_token_new_static ()
AnjutaToken * | anjuta_token_new_static_len ()
AnjutaToken * | anjuta_token_free_children ()
AnjutaToken * | anjuta_token_free ()
void | anjuta_token_set_type ()
void | anjuta_token_set_flags ()
void | anjuta_token_clear_flags ()
gint | anjuta_token_get_flags ()
void | anjuta_token_set_string ()
const gchar * | anjuta_token_get_string ()
void | anjuta_token_set_length ()
gsize | anjuta_token_get_length ()
AnjutaToken * | anjuta_token_next ()
AnjutaToken * | anjuta_token_previous ()
AnjutaToken * | anjuta_token_last ()
AnjutaToken * | anjuta_token_parent ()
AnjutaToken * | anjuta_token_list ()
AnjutaToken * | anjuta_token_next_after_children ()
void | anjuta_token_foreach_content ()
void | anjuta_token_foreach_token ()
AnjutaToken * | anjuta_token_foreach_post_order ()
AnjutaToken * | anjuta_token_first_item ()
AnjutaToken * | anjuta_token_next_item ()
AnjutaToken * | anjuta_token_previous_item ()
AnjutaToken * | anjuta_token_last_item ()
AnjutaToken * | anjuta_token_append_child ()
AnjutaToken * | anjuta_token_prepend_child ()
AnjutaToken * | anjuta_token_prepend_items ()
AnjutaToken * | anjuta_token_insert_after ()
AnjutaToken * | anjuta_token_insert_before ()
AnjutaToken * | anjuta_token_delete_parent ()
void | anjuta_token_remove_item ()
AnjutaToken * | anjuta_token_merge ()
AnjutaToken * | anjuta_token_merge_own_children ()
AnjutaToken * | anjuta_token_merge_children ()
AnjutaToken * | anjuta_token_merge_previous ()
AnjutaToken * | anjuta_token_split ()
AnjutaToken * | anjuta_token_cut ()
AnjutaToken * | anjuta_token_concat ()
gchar * | anjuta_token_evaluate ()
gchar * | anjuta_token_evaluate_name ()
gboolean | anjuta_token_is_empty ()
void | anjuta_token_dump ()
gboolean | anjuta_token_check ()
void | anjuta_token_dump_link ()
gboolean | anjuta_token_compare ()

## Types and Values

enum | AnjutaTokenType

## Includes

    #include <libanjuta/anjuta-token.h>

## Description

A AnjutaToken represents a token. It is a sequence of characters associated with a type representing its meaning. By example, a token can represent a keyword, a comment, a variable...

The token can own the string or has only a pointer on some data allocated somewhere else with a length.

A token is linked with other tokens using three double linked lists.

The first list using next and prev fields is used to keep the token in the order where there are in the file. The first character of the first token is the first character in the file.

A second list is used to represent included files. Such file is represented by a special token in the first list which has a pointer, named children to a token list. Each token in this secondary list has a pointer to its parent, it means the token representing the file where is the token. It looks like a tree. In fact, every file is represented by a special token, so the root node is normally a file token and has as children all the token representing the file content. This parent/child list is used for expanded variable too.

A third list is used to group several tokens. A token can have a pointer to another last token. It means that this token is a group starting from this token to the one indicated by the last field. In addition each token in this group has a pointer on the first token of the group. This grouping is independent of the parent/child list. So a group can start in one file and end in another included file. The grouping can be nested too. Typically we can have a group representing a command, a sub group representing the arguments and then one sub group for each argument.

## Functions

### AnjutaTokenForeachFunc ()

    void
    (*AnjutaTokenForeachFunc) (AnjutaToken *token,
                               gpointer data);

### anjuta_token_new_string ()

    AnjutaToken *
    anjuta_token_new_string (AnjutaTokenType type,
                             const gchar *value);

#### Returns

### anjuta_token_new_string_len ()

    AnjutaToken *
    anjuta_token_new_string_len (AnjutaTokenType type,
                                 gchar *value,
                                 gsize length);

#### Returns

### anjuta_token_new_static ()

    AnjutaToken *
    anjuta_token_new_static (AnjutaTokenType type,
                             const gchar *value);

#### Returns

### anjuta_token_new_static_len ()

    AnjutaToken *
    anjuta_token_new_static_len (gint type,
                                 const gchar *pos,
                                 gsize length);

#### Returns

### anjuta_token_free_children ()

    AnjutaToken *
    anjuta_token_free_children (AnjutaToken *token);

#### Returns

### anjuta_token_free ()

    AnjutaToken *
    anjuta_token_free (AnjutaToken *token);

#### Returns

### anjuta_token_set_type ()

    void
    anjuta_token_set_type (AnjutaToken *token,
                           gint type);

### anjuta_token_set_flags ()

    void
    anjuta_token_set_flags (AnjutaToken *token,
                            gint flags);

### anjuta_token_clear_flags ()

    void
    anjuta_token_clear_flags (AnjutaToken *token,
                              gint flags);

### anjuta_token_get_flags ()

    gint
    anjuta_token_get_flags (AnjutaToken *token);

#### Returns

### anjuta_token_set_string ()

    void
    anjuta_token_set_string (AnjutaToken *token,
                             const char *value,
                             gsize length);

### anjuta_token_get_string ()

    const gchar *
    anjuta_token_get_string (AnjutaToken *token);

#### Returns

### anjuta_token_set_length ()

    void
    anjuta_token_set_length (AnjutaToken *token,
                             gsize length);

### anjuta_token_get_length ()

    gsize
    anjuta_token_get_length (AnjutaToken *token);

#### Returns

### anjuta_token_next ()

    AnjutaToken *
    anjuta_token_next (AnjutaToken *token);

#### Returns

### anjuta_token_previous ()

    AnjutaToken *
    anjuta_token_previous (AnjutaToken *token);

#### Returns

### anjuta_token_last ()

    AnjutaToken *
    anjuta_token_last (AnjutaToken *token);

#### Returns

### anjuta_token_parent ()

    AnjutaToken *
    anjuta_token_parent (AnjutaToken *token);

#### Returns

### anjuta_token_list ()

    AnjutaToken *
    anjuta_token_list (AnjutaToken *token);

#### Returns

### anjuta_token_next_after_children ()

    AnjutaToken *
    anjuta_token_next_after_children (AnjutaToken *token);

#### Returns

### anjuta_token_foreach_content ()

    void
    anjuta_token_foreach_content (AnjutaToken *token,
                                  AnjutaTokenForeachFunc func,
                                  gpointer user_data);

### anjuta_token_foreach_token ()

    void
    anjuta_token_foreach_token (AnjutaToken *token,
                                AnjutaTokenForeachFunc func,
                                gpointer user_data);

### anjuta_token_foreach_post_order ()

    AnjutaToken *
    anjuta_token_foreach_post_order (AnjutaToken *token,
                                     AnjutaTokenForeachFunc func,
                                     gpointer user_data);

#### Returns

### anjuta_token_first_item ()

    AnjutaToken *
    anjuta_token_first_item (AnjutaToken *list);

#### Returns

### anjuta_token_next_item ()

    AnjutaToken *
    anjuta_token_next_item (AnjutaToken *item);

#### Returns

### anjuta_token_previous_item ()

    AnjutaToken *
    anjuta_token_previous_item (AnjutaToken *item);

#### Returns

### anjuta_token_last_item ()

    AnjutaToken *
    anjuta_token_last_item (AnjutaToken *list);

#### Returns

### anjuta_token_append_child ()

    AnjutaToken *
    anjuta_token_append_child (AnjutaToken *parent,
                               AnjutaToken *children);

Insert all tokens in children as the last children of the given parent.

#### Parameters

parent | a AnjutaToken object used as parent. |
children | a AnjutaToken object. |

#### Returns

The first token append.

### anjuta_token_prepend_child ()

    AnjutaToken *
    anjuta_token_prepend_child (AnjutaToken *parent,
                                AnjutaToken *children);

Insert all tokens in children as the first children of the given parent.

#### Parameters

parent | a AnjutaToken object used as parent. |
children | a AnjutaToken object. |

#### Returns

The first token append.

### anjuta_token_prepend_items ()

    AnjutaToken *
    anjuta_token_prepend_items (AnjutaToken *list,
                                AnjutaToken *item);

Insert all tokens in item as item of the given list.

#### Parameters

list | a AnjutaToken object used as list. |
item | a AnjutaToken object. |

#### Returns

The first token append.

### anjuta_token_insert_after ()

    AnjutaToken *
    anjuta_token_insert_after (AnjutaToken *sibling,
                               AnjutaToken *list);

Insert all tokens after sibling.

#### Parameters

sibling | a AnjutaToken object. |
list | a AnjutaToken object. |

#### Returns

The first token inserted.

### anjuta_token_insert_before ()

    AnjutaToken *
    anjuta_token_insert_before (AnjutaToken *sibling,
                                AnjutaToken *list);

Insert all tokens before sibling.

#### Parameters

sibling | a AnjutaToken object. |
list | a AnjutaToken object. |

#### Returns

The first token inserted.

### anjuta_token_delete_parent ()

    AnjutaToken *
    anjuta_token_delete_parent (AnjutaToken *parent);

Delete only the parent token.

#### Parameters

parent | a AnjutaToken object used as parent. |

#### Returns

the first children

### anjuta_token_remove_item ()

    void
    anjuta_token_remove_item (AnjutaToken *item);

### anjuta_token_merge ()

    AnjutaToken *
    anjuta_token_merge (AnjutaToken *first,
                        AnjutaToken *end);

#### Returns

### anjuta_token_merge_own_children ()

    AnjutaToken *
    anjuta_token_merge_own_children (AnjutaToken *first);

#### Returns

### anjuta_token_merge_children ()

    AnjutaToken *
    anjuta_token_merge_children (AnjutaToken *first,
                                 AnjutaToken *end);

#### Returns

### anjuta_token_merge_previous ()

    AnjutaToken *
    anjuta_token_merge_previous (AnjutaToken *list,
                                 AnjutaToken *first);

If the list token is not already linked with first, it is inserted just before first. If the list token is already linked, it must be in the same list after first token. It it possible to have several tokens beweent list and first.

#### Parameters

list | a AnjutaToken object representing a list |
first | a AnjutaToken object for the new beginning of the list |

#### Returns

the new list

### anjuta_token_split ()

    AnjutaToken *
    anjuta_token_split (AnjutaToken *token,
                        guint size);

#### Returns

### anjuta_token_cut ()

    AnjutaToken *
    anjuta_token_cut (AnjutaToken *token,
                      guint pos,
                      guint size);

#### Returns

### anjuta_token_concat ()

    AnjutaToken *
    anjuta_token_concat (AnjutaToken *token);

#### Returns

### anjuta_token_evaluate ()

    gchar *
    anjuta_token_evaluate (AnjutaToken *token);

#### Returns

### anjuta_token_evaluate_name ()

    gchar *
    anjuta_token_evaluate_name (AnjutaToken *token);

#### Returns

### anjuta_token_is_empty ()

    gboolean
    anjuta_token_is_empty (AnjutaToken *token);

#### Returns

### anjuta_token_dump ()

    void
    anjuta_token_dump (AnjutaToken *token);

### anjuta_token_check ()

    gboolean
    anjuta_token_check (AnjutaToken *token);

#### Returns

### anjuta_token_dump_link ()

    void
    anjuta_token_dump_link (AnjutaToken *token);

### anjuta_token_compare ()

    gboolean
    anjuta_token_compare (AnjutaToken *tokena,
                          AnjutaToken *tokenb);

#### Returns

## Types and Values

### enum AnjutaTokenType

#### Members

ANJUTA_TOKEN_NONE |  |
ANJUTA_TOKEN_EOL |  |
ANJUTA_TOKEN_COMMA |  |
ANJUTA_TOKEN_TYPE |  |
ANJUTA_TOKEN_FIRST |  |
ANJUTA_TOKEN_FILE |  |
ANJUTA_TOKEN_MACRO |  |
ANJUTA_TOKEN_CONTENT |  |
ANJUTA_TOKEN_ARGUMENT |  |
ANJUTA_TOKEN_VALUE |  |
ANJUTA_TOKEN_EOV |  |
ANJUTA_TOKEN_PARSED |  |
ANJUTA_TOKEN_KEYWORD |  |
ANJUTA_TOKEN_OPERATOR |  |
ANJUTA_TOKEN_NAME |  |
ANJUTA_TOKEN_VARIABLE |  |
ANJUTA_TOKEN_DEFINITION |  |
ANJUTA_TOKEN_STATEMENT |  |
ANJUTA_TOKEN_NUMBER |  |
ANJUTA_TOKEN_JUNK |  |
ANJUTA_TOKEN_COMMENT |  |
ANJUTA_TOKEN_OPEN_QUOTE |  |
ANJUTA_TOKEN_CLOSE_QUOTE |  |
ANJUTA_TOKEN_ESCAPE |  |
ANJUTA_TOKEN_FUNCTION |  |
ANJUTA_TOKEN_SPACE |  |
ANJUTA_TOKEN_START |  |
ANJUTA_TOKEN_NEXT |  |
ANJUTA_TOKEN_LAST |  |
ANJUTA_TOKEN_ITEM |  |
ANJUTA_TOKEN_STRING |  |
ANJUTA_TOKEN_ERROR |  |
ANJUTA_TOKEN_WORD |  |
ANJUTA_TOKEN_LIST |  |
ANJUTA_TOKEN_ANY |  |
ANJUTA_TOKEN_USER |  |
ANJUTA_TOKEN_FLAGS |  |
ANJUTA_TOKEN_PUBLIC_FLAGS |  |
ANJUTA_TOKEN_IRRELEVANT |  |
ANJUTA_TOKEN_OPEN |  |
ANJUTA_TOKEN_CLOSE |  |
ANJUTA_TOKEN_SIGNIFICANT |  |
ANJUTA_TOKEN_PRIVATE_FLAGS |  |
ANJUTA_TOKEN_CASE_INSENSITIVE |  |
ANJUTA_TOKEN_STATIC |  |
ANJUTA_TOKEN_REMOVED |  |
ANJUTA_TOKEN_ADDED |  |