Search documentation of snmpkit

# SnmpKit.SnmpLib.MIB.Parser (snmpkit v1.2.0)

Pure native SNMP MIB parser using custom Elixir grammar.

This module provides complete native parsing of SNMP MIB files with 100% compatibility. All MIBs are parsed natively ensuring complete data integrity.

# Summary

## Functions

init_parser()

Initialize the parser by compiling the grammar file. This creates a proper yacc-generated parser for native MIB parsing.

mibdirs(directories)

Parse all MIB files in a list of directories using pure native parsing.

parse(mib_content)

Parse a MIB file using pure native grammar parsing. This is the production MIB parser with 100% native compatibility.

parse_tokens(tokens)

Parse pre-tokenized MIB tokens using native grammar parsing. This function takes tokens directly without tokenizing.

tokenize(mib_content)

Tokenize MIB content using the native SNMP tokenizer.

# Functions

# init_parser()

Initialize the parser by compiling the grammar file. This creates a proper yacc-generated parser for native MIB parsing.

# mibdirs(directories)

Parse all MIB files in a list of directories using pure native parsing.

Returns a map with directory paths as keys and results as values. Each result contains successful compilations and failures.

## Examples

    # Parse MIBs in multiple directories
    dirs = [
      "/path/to/mibs/working",
      "/path/to/mibs/docsis"
    ]
    results = SnmpKit.SnmpLib.MIB.Parser.mibdirs(dirs)

    # Access results by directory
    working_results = results["/path/to/mibs/working"]
    IO.puts("Success: #{length(working_results.success)}/#{working_results.total}")

    # Get all successful MIBs across directories
    all_mibs = Enum.flat_map(results, fn {_dir, result} -> result.success end)

# parse(mib_content)

Parse a MIB file using pure native grammar parsing. This is the production MIB parser with 100% native compatibility.

# parse_tokens(tokens)

Parse pre-tokenized MIB tokens using native grammar parsing. This function takes tokens directly without tokenizing.

# tokenize(mib_content)

Tokenize MIB content using the native SNMP tokenizer.

Uses the SnmpKit.SnmpLib.MIB.SnmpTokenizer module for complete MIB tokenization.