Delimit.Parsers (delimit v0.2.0)

View Source

Pre-defined CSV parsers for common delimiters.

This module defines optimized parsers for common delimiters to avoid creating new parser modules for each parsing operation.

Summary

Functions

Gets the appropriate parser for the given delimiter.

Gets a parser with custom escape character.

Functions

get_parser(delimiter, opts \\ [])

@spec get_parser(String.t(), Keyword.t()) :: module()

Gets the appropriate parser for the given delimiter.

Parameters

  • delimiter - The delimiter character (comma, tab, etc.)
  • opts - Parser options (reserved for future use)

Returns

  • A module that implements NimbleCSV parser functions

Examples

iex> Delimit.Parsers.get_parser(",")
DelimitCommaParser

iex> Delimit.Parsers.get_parser(";")
DelimitSemicolonParser

get_parser_with_escape(delimiter, escape, opts \\ [])

@spec get_parser_with_escape(String.t(), String.t(), Keyword.t()) :: module()

Gets a parser with custom escape character.

Parameters

  • delimiter - The delimiter character (comma, tab, etc.)
  • escape - The escape character (default: double-quote)
  • opts - Additional options (reserved for future use)

Returns

  • A module that implements NimbleCSV parser functions

Examples

iex> Delimit.Parsers.get_parser_with_escape(",", "'")
# Returns a dynamically generated parser module