MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / parse

Method parse

site-packages/matplotlib/mathtext.py:2498–2517  ·  view source on GitHub ↗

Parse expression *s* using the given *fonts_object* for output, at the given *fontsize* and *dpi*. Returns the parse tree of :class:`Node` instances.

(self, s, fonts_object, fontsize, dpi)

Source from the content-addressed store, hash-verified

2496 self._math_expression = p.math
2497
2498 def parse(self, s, fonts_object, fontsize, dpi):
2499 """
2500 Parse expression *s* using the given *fonts_object* for
2501 output, at the given *fontsize* and *dpi*.
2502
2503 Returns the parse tree of :class:`Node` instances.
2504 """
2505 self._state_stack = [self.State(fonts_object, 'default', 'rm', fontsize, dpi)]
2506 self._em_width_cache = {}
2507 try:
2508 result = self._expression.parseString(s)
2509 except ParseBaseException as err:
2510 raise ValueError("\n".join(["",
2511 err.line,
2512 " " * (err.column - 1) + "^",
2513 str(err)]))
2514 self._state_stack = None
2515 self._em_width_cache = {}
2516 self._expression.resetCache()
2517 return result[0]
2518
2519 # The state of the parser is maintained in a stack. Upon
2520 # entering and leaving a group { } or math/non-math, the stack

Callers 15

fromstrMethod · 0.45
fromstrMethod · 0.45
datestr2numFunction · 0.45
get_glyphs_mathtextMethod · 0.45
parseMethod · 0.45
get_label_widthMethod · 0.45
_draw_mathtextMethod · 0.45
draw_mathtextMethod · 0.45

Calls 3

parseStringMethod · 0.45
joinMethod · 0.45
resetCacheMethod · 0.45

Tested by 2

test_stem_datesFunction · 0.36