Closed Lehonti closed 1 year ago
Sealed the private parser classes. Also, since most of them don't hold any internal state (and if the maintainer agrees) they can be turned into singletons in a future pull request.
Feel free to do it in a separate PR.
TexPredefinedFormulaParser
) itselfIDictionary<,>
never change (are only read, not written to) after the object is constructed, so I made them of typeIReadOnlyDictionary<,>
. All entry additions happen inside the constructor/s (I'm including the static constructor, as we will see in the next point).typeMappings
andargValueParsers
are always the same, in all instances, so I made themstatic
and moved their construction to the static constructor. This can help us save on heap allocations.private
parser classes. Also, since most of them don't hold any internal state (and if the maintainer agrees) they can be turned into singletons in a future pull request.Parse()
method through inversion ofif
blocks.