Class Ritex::Parser
In: lib/ritex.rb
lib/ritex/parser.rb
Parent: Racc::Parser

The parser for itex and the main entry point for Ritex. This class is partially defined here and partially generated by Racc from lib/parser.y.

Create the parser with new. Parse strings with parse. That’s all there is to it.

Methods

Constants

FORMATS = [:mathml, :raw]
Racc_arg = [ racc_action_table, racc_action_check, racc_action_default, racc_action_pointer, racc_goto_table, racc_goto_check, racc_goto_default, racc_goto_pointer, racc_nt_base, racc_reduce_table, racc_token_table, racc_shift_n, racc_reduce_n, racc_use_result_var ]
Racc_token_to_s_table = [ "$end", "error", "NUMBER", "VAR", "SYMBOL", "FUNC0", "FUNC1", "FUNC2", "FUNC3", "MACRO0", "MACRO1", "MACRO2", "MACRO3", "ENV", "DOUBLEBACK", "DEFINE", "LEFT", "RIGHT", "ARRAY", "ARRAYOPTS", "ROWOPTS", "CELLOPTS", "COLALIGN", "ROWALIGN", "ALIGN", "PADDING", "EQUALCOLS", "EQUALROWS", "ROWLINES", "COLLINES", "FRAME", "ROWSPAN", "COLSPAN", "SPACE", "OPERATOR", "\"-\"", "\"^\"", "\"_\"", "\"{\"", "\"}\"", "\".\"", "\"[\"", "\"]\"", "\"&\"", "\",\"", "\";\"", "\":\"", "\"<\"", "\">\"", "\"=\"", "\"#\"", "\"!\"", "\"+\"", "\"*\"", "\"/\"", "\"(\"", "\")\"", "\"|\"", "$start", "exp", "atom", "nontoken", "subsup", "symbol", "func", "macro", "arg", "array", "macrodef", "delim", "token", "string", "stringel", "escapeme", "rawtoken", "rawdelimtoken", "symspec", "arrayopts", "ainnards", "arrayoptsinnards", "arow", "arow1", "acell", "cellopts", "celloptsinnards" ]
Racc_debug_parser = false

Attributes

format  [R] 
merror  [RW]  If true, Ritex will output a message in the MathML if an unknown entity is encountered. If false (the default), Ritex will throw a Ritex::Error.

Public Class methods

format is the desired output format and must be in the FORMATS list. Right now that’s just :mathml.

Public Instance methods

Delete all macros

Parse a string. Returns the MathML output in string form. Note that macro definitions are cumulative and persistent across calls to parse. If you don’t want this behavior, you must explicitly call flush_macros after every parse call.

opts is a hash of options:

nowrap, if true, will omit wrapping the output in a top-level XML math tag. Only useful if you’re generating these tags yourself.

display, if true, emits display markup, as opposed to inline markup. For mathml output this only has an effect if nowrap is true.

[Validate]