srcmetrics 0.1.0

Language-independent source code metrics (size, complexity, nesting, Halstead, duplication, dependencies, documentation) for C, C++, Go, Java, JavaScript, Python, Rust and TypeScript
Documentation
//! Go mapping (tree-sitter-go).

use super::Mapping;
use crate::ir::NodeKind::*;

pub static MAPPING: Mapping = Mapping {
    language: "go",
    extensions: &["go"],
    grammar: || tree_sitter_go::LANGUAGE.into(),
    grammar_crate: ("tree-sitter-go", "0.25.0"),
    kinds: &[
        ("block", Block),
        ("expression_statement", Statement),
        ("assignment_statement", Statement),
        ("inc_statement", Statement),
        ("dec_statement", Statement),
        ("send_statement", Statement),
        ("go_statement", Statement),
        ("defer_statement", Statement),
        ("short_var_declaration", Declaration),
        ("var_declaration", Declaration),
        ("const_declaration", Declaration),
        ("if_statement", Branch),
        ("for_statement", Loop),
        ("expression_case", Case),
        ("type_case", Case),
        ("communication_case", Case),
        ("return_statement", Return),
        ("break_statement", Jump),
        ("continue_statement", Jump),
        ("goto_statement", Jump),
        ("fallthrough_statement", Jump),
        ("call_expression", Call),
        ("binary_expression", Binary),
        ("unary_expression", Unary),
        ("index_expression", Expression),
        ("selector_expression", Expression),
        ("parenthesized_expression", Expression),
        ("identifier", Identifier),
        ("int_literal", Literal),
        ("float_literal", Literal),
        ("imaginary_literal", Literal),
        ("rune_literal", Literal),
        ("interpreted_string_literal", Literal),
        ("raw_string_literal", Literal),
        ("true", Literal),
        ("false", Literal),
        ("nil", Literal),
        ("iota", Literal),
        ("import_spec", Import),
        ("function_declaration", Function),
        ("method_declaration", Function),
        ("func_literal", Function),
    ],
    callee_fields: &["function"],
    logical_operators: &["&&", "||"],
    default_case_keyword: None,
    else_field: Some("alternative"),
    comments: &["comment"],
    literals: &[
        "int_literal",
        "float_literal",
        "imaginary_literal",
        "rune_literal",
        "interpreted_string_literal",
        "raw_string_literal",
        "true",
        "false",
        "nil",
        "iota",
    ],
    interpolations: &[],
    identifiers: &[
        "identifier",
        "field_identifier",
        "type_identifier",
        "package_identifier",
        "label_name",
    ],
    name_fields: &["name"],
    decorators: &[],
    docstring: None,
    parameter_fields: &["receiver", "parameters"],
    ignored_parameters: &[],
};