Module: Latexmath::Model

Defined in:
lib/latexmath/model.rb,
lib/latexmath/model.rb,
lib/latexmath/model/nodes.rb

Overview

The typed LaTeX language model, declared with LutaML Model.

Latexmath.parse returns a Model::Document. Its classes (lib/latexmath/model/nodes.rb) are generated by scripts/generate_model.rb from the capture shapes of the normalized grammar: every capture holds one kind, so each class has one attribute per capture key and lutaml-model builds the whole tree from the declared attribute types (Document.new on the grammar's model binding). No code here walks the parse tree. See docs/model-contract.adoc.

Defined Under Namespace

Classes: Args, Base, Binary, BinaryFunctions, Dividend, Divisor, Document, Ending, Environment, Expression, FirstValue, IntermediateExp, ItemsItem, LatexTree, LeftParen, LeftRight, Limits, MathSymbol, Options, Over, Power, PowerBase, RightParen, SecondValue, Sequence, Subscript, Supscript, SymbolNode, TableData, TernaryClass, ThirdValue, UnaryFunctions, UnderOver

Class Method Summary collapse

Class Method Details

.catalog_field?(klass, name) ⇒ Boolean

Stage-computed fields stay distinct from grammar-bound captures even though their portable LML declarations are ordinary typed strings.

Returns:

  • (Boolean)


18
19
20
# File 'lib/latexmath/model.rb', line 18

def self.catalog_field?(klass, name)
  klass.is_a?(Class) && klass <= MathSymbol && %w[value kind].include?(name.to_s)
end