@@ -2070,18 +2070,18 @@ def push_state(self):
2070
2070
"""Push a new `State` onto the stack, copying the current state."""
2071
2071
self ._state_stack .append (self .get_state ().copy ())
2072
2072
2073
- def main (self , s , loc , toks ):
2073
+ def main (self , toks ):
2074
2074
return [Hlist (toks )]
2075
2075
2076
- def math_string (self , s , loc , toks ):
2076
+ def math_string (self , toks ):
2077
2077
return self ._math_expression .parseString (toks [0 ][1 :- 1 ], parseAll = True )
2078
2078
2079
- def math (self , s , loc , toks ):
2079
+ def math (self , toks ):
2080
2080
hlist = Hlist (toks )
2081
2081
self .pop_state ()
2082
2082
return [hlist ]
2083
2083
2084
- def non_math (self , s , loc , toks ):
2084
+ def non_math (self , toks ):
2085
2085
s = toks [0 ].replace (r'\$' , '$' )
2086
2086
symbols = [Char (c , self .get_state ()) for c in s ]
2087
2087
hlist = Hlist (symbols )
@@ -2092,7 +2092,7 @@ def non_math(self, s, loc, toks):
2092
2092
2093
2093
float_literal = staticmethod (pyparsing_common .convertToFloat )
2094
2094
2095
- def text (self , s , loc , toks ):
2095
+ def text (self , toks ):
2096
2096
self .push_state ()
2097
2097
state = self .get_state ()
2098
2098
state .font = 'rm'
@@ -2132,12 +2132,12 @@ def _make_space(self, percentage):
2132
2132
r'\!' : - 0.16667 , # -3/18 em = -3 mu
2133
2133
}
2134
2134
2135
- def space (self , s , loc , toks ):
2135
+ def space (self , toks ):
2136
2136
num = self ._space_widths [toks ["space" ]]
2137
2137
box = self ._make_space (num )
2138
2138
return [box ]
2139
2139
2140
- def customspace (self , s , loc , toks ):
2140
+ def customspace (self , toks ):
2141
2141
return [self ._make_space (toks ["space" ])]
2142
2142
2143
2143
def symbol (self , s , loc , toks ):
@@ -2215,7 +2215,7 @@ def unknown_symbol(self, s, loc, toks):
2215
2215
2216
2216
_wide_accents = set (r"widehat widetilde widebar" .split ())
2217
2217
2218
- def accent (self , s , loc , toks ):
2218
+ def accent (self , toks ):
2219
2219
state = self .get_state ()
2220
2220
thickness = state .get_current_underline_thickness ()
2221
2221
accent = toks ["accent" ]
@@ -2276,30 +2276,30 @@ def operatorname(self, s, loc, toks):
2276
2276
2277
2277
return Hlist (hlist_list )
2278
2278
2279
- def start_group (self , s , loc , toks ):
2279
+ def start_group (self , toks ):
2280
2280
self .push_state ()
2281
2281
# Deal with LaTeX-style font tokens
2282
2282
if toks .get ("font" ):
2283
2283
self .get_state ().font = toks .get ("font" )
2284
2284
return []
2285
2285
2286
- def group (self , s , loc , toks ):
2286
+ def group (self , toks ):
2287
2287
grp = Hlist (toks .get ("group" , []))
2288
2288
return [grp ]
2289
2289
2290
- def required_group (self , s , loc , toks ):
2290
+ def required_group (self , toks ):
2291
2291
return Hlist (toks .get ("group" , []))
2292
2292
2293
2293
optional_group = required_group
2294
2294
2295
- def end_group (self , s , loc , toks ):
2295
+ def end_group (self ):
2296
2296
self .pop_state ()
2297
2297
return []
2298
2298
2299
2299
def unclosed_group (self , s , loc , toks ):
2300
2300
raise ParseFatalException (s , len (s ), "Expected '}'" )
2301
2301
2302
- def font (self , s , loc , toks ):
2302
+ def font (self , toks ):
2303
2303
self .get_state ().font = toks ["font" ]
2304
2304
return []
2305
2305
@@ -2320,9 +2320,6 @@ def is_slanted(self, nucleus):
2320
2320
return nucleus .is_slanted ()
2321
2321
return False
2322
2322
2323
- def is_between_brackets (self , s , loc ):
2324
- return False
2325
-
2326
2323
def subsuper (self , s , loc , toks ):
2327
2324
nucleus = toks .get ("nucleus" , Hbox (0 ))
2328
2325
subsuper = toks .get ("subsuper" , [])
@@ -2523,26 +2520,26 @@ def _genfrac(self, ldelim, rdelim, rule, style, num, den):
2523
2520
return self ._auto_sized_delimiter (ldelim , result , rdelim )
2524
2521
return result
2525
2522
2526
- def style_literal (self , s , loc , toks ):
2523
+ def style_literal (self , toks ):
2527
2524
return self ._MathStyle (int (toks ["style_literal" ]))
2528
2525
2529
- def genfrac (self , s , loc , toks ):
2526
+ def genfrac (self , toks ):
2530
2527
return self ._genfrac (
2531
2528
toks .get ("ldelim" , "" ), toks .get ("rdelim" , "" ),
2532
2529
toks ["rulesize" ], toks .get ("style" , self ._MathStyle .TEXTSTYLE ),
2533
2530
toks ["num" ], toks ["den" ])
2534
2531
2535
- def frac (self , s , loc , toks ):
2532
+ def frac (self , toks ):
2536
2533
return self ._genfrac (
2537
2534
"" , "" , self .get_state ().get_current_underline_thickness (),
2538
2535
self ._MathStyle .TEXTSTYLE , toks ["num" ], toks ["den" ])
2539
2536
2540
- def dfrac (self , s , loc , toks ):
2537
+ def dfrac (self , toks ):
2541
2538
return self ._genfrac (
2542
2539
"" , "" , self .get_state ().get_current_underline_thickness (),
2543
2540
self ._MathStyle .DISPLAYSTYLE , toks ["num" ], toks ["den" ])
2544
2541
2545
- def binom (self , s , loc , toks ):
2542
+ def binom (self , toks ):
2546
2543
return self ._genfrac (
2547
2544
"(" , ")" , 0 ,
2548
2545
self ._MathStyle .TEXTSTYLE , toks ["num" ], toks ["den" ])
@@ -2579,7 +2576,7 @@ def _genset(self, s, loc, toks):
2579
2576
2580
2577
overset = underset = _genset
2581
2578
2582
- def sqrt (self , s , loc , toks ):
2579
+ def sqrt (self , toks ):
2583
2580
root = toks .get ("root" )
2584
2581
body = toks ["value" ]
2585
2582
state = self .get_state ()
@@ -2619,7 +2616,7 @@ def sqrt(self, s, loc, toks):
2619
2616
rightside ]) # Body
2620
2617
return [hlist ]
2621
2618
2622
- def overline (self , s , loc , toks ):
2619
+ def overline (self , toks ):
2623
2620
body = toks ["body" ]
2624
2621
2625
2622
state = self .get_state ()
@@ -2670,14 +2667,14 @@ def _auto_sized_delimiter(self, front, middle, back):
2670
2667
hlist = Hlist (parts )
2671
2668
return hlist
2672
2669
2673
- def auto_delim (self , s , loc , toks ):
2670
+ def auto_delim (self , toks ):
2674
2671
return self ._auto_sized_delimiter (
2675
2672
toks ["left" ],
2676
2673
# if "mid" in toks ... can be removed when requiring pyparsing 3.
2677
2674
toks ["mid" ].asList () if "mid" in toks else [],
2678
2675
toks ["right" ])
2679
2676
2680
- def boldsymbol (self , s , loc , toks ):
2677
+ def boldsymbol (self , toks ):
2681
2678
self .push_state ()
2682
2679
state = self .get_state ()
2683
2680
hlist = []
@@ -2703,7 +2700,7 @@ def boldsymbol(self, s, loc, toks):
2703
2700
2704
2701
return Hlist (hlist )
2705
2702
2706
- def substack (self , s , loc , toks ):
2703
+ def substack (self , toks ):
2707
2704
parts = toks ["parts" ]
2708
2705
state = self .get_state ()
2709
2706
thickness = state .get_current_underline_thickness ()
0 commit comments