SpeechMarkdown v0.1.1 SpeechMarkdown.Grammar
This is the nimble-parsec grammar for the subset of the Speech Markdown language supported by this library. The parser is tolerant of any string inputs, but poorly-specified constructs will simply be output as string values. Results are returned as an ast containing a list of tagged tokens, like so:
iex> parse!("You say pecan [200ms], I say (pecan)[/pɪˈkɑːn/]") [
text: "You say pecan ",
break: [200, :ms],
text: ", I say ",
modifier: ["pecan", {:ipa, "pɪˈkɑːn"}]
]
Link to this section Summary
Functions
Parses the given binary
as document.
parse a speech markdown string into an ast
parse a speech markdown string into an ast
Link to this section Functions
document(binary, opts \\ [])
document(binary(), keyword()) :: {:ok, [term()], rest, context, line, byte_offset} | {:error, reason, rest, context, line, byte_offset} when line: {pos_integer(), byte_offset}, byte_offset: pos_integer(), rest: binary(), reason: String.t(), context: map()
Parses the given binary
as document.
Returns {:ok, [token], rest, context, position, byte_offset}
or
{:error, reason, rest, context, line, byte_offset}
where position
describes the location of the document (start position) as {line, column_on_line}
.
Options
:line
- the initial line, defaults to 1:byte_offset
- the initial byte offset, defaults to 0:context
- the initial context value. It will be converted to a map
parse a speech markdown string into an ast
parse a speech markdown string into an ast