ai-content-maker/.venv/Lib/site-packages/sympy/parsing/latex/_antlr/latexparser.py

3653 lines
121 KiB
Python
Raw Permalink Normal View History

2024-05-03 04:18:51 +03:00
# *** GENERATED BY `setup.py antlr`, DO NOT EDIT BY HAND ***
#
# Generated from ../LaTeX.g4, derived from latex2sympy
# latex2sympy is licensed under the MIT license
# https://github.com/augustt198/latex2sympy/blob/master/LICENSE.txt
#
# Generated with antlr4
# antlr4 is licensed under the BSD-3-Clause License
# https://github.com/antlr/antlr4/blob/master/LICENSE.txt
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
from typing import TextIO
else:
from typing.io import TextIO
def serializedATN():
return [
4,1,91,522,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,
6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,
2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,
7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,
2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,
7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,
2,40,7,40,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,5,1,91,8,1,10,1,12,1,94,
9,1,1,2,1,2,1,2,1,2,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,5,4,108,8,4,
10,4,12,4,111,9,4,1,5,1,5,1,5,1,5,1,5,1,5,5,5,119,8,5,10,5,12,5,
122,9,5,1,6,1,6,1,6,1,6,1,6,1,6,5,6,130,8,6,10,6,12,6,133,9,6,1,
7,1,7,1,7,4,7,138,8,7,11,7,12,7,139,3,7,142,8,7,1,8,1,8,1,8,1,8,
5,8,148,8,8,10,8,12,8,151,9,8,3,8,153,8,8,1,9,1,9,5,9,157,8,9,10,
9,12,9,160,9,9,1,10,1,10,5,10,164,8,10,10,10,12,10,167,9,10,1,11,
1,11,3,11,171,8,11,1,12,1,12,1,12,1,12,1,12,1,12,3,12,179,8,12,1,
13,1,13,1,13,1,13,3,13,185,8,13,1,13,1,13,1,14,1,14,1,14,1,14,3,
14,193,8,14,1,14,1,14,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,
15,1,15,3,15,207,8,15,1,15,3,15,210,8,15,5,15,212,8,15,10,15,12,
15,215,9,15,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,3,
16,227,8,16,1,16,3,16,230,8,16,5,16,232,8,16,10,16,12,16,235,9,16,
1,17,1,17,1,17,1,17,1,17,1,17,3,17,243,8,17,1,18,1,18,1,18,1,18,
1,18,3,18,250,8,18,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,
1,19,1,19,1,19,1,19,1,19,1,19,1,19,3,19,268,8,19,1,20,1,20,1,20,
1,20,1,21,4,21,275,8,21,11,21,12,21,276,1,21,1,21,1,21,1,21,5,21,
283,8,21,10,21,12,21,286,9,21,1,21,1,21,4,21,290,8,21,11,21,12,21,
291,3,21,294,8,21,1,22,1,22,3,22,298,8,22,1,22,3,22,301,8,22,1,22,
3,22,304,8,22,1,22,3,22,307,8,22,3,22,309,8,22,1,22,1,22,1,22,1,
22,1,22,1,22,1,22,3,22,318,8,22,1,23,1,23,1,23,1,23,1,24,1,24,1,
24,1,24,1,25,1,25,1,25,1,25,1,25,1,26,5,26,334,8,26,10,26,12,26,
337,9,26,1,27,1,27,1,27,1,27,1,27,1,27,3,27,345,8,27,1,27,1,27,1,
27,1,27,1,27,3,27,352,8,27,1,28,1,28,1,28,1,28,1,28,1,28,1,28,1,
28,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,31,1,31,1,32,1,32,3,
32,374,8,32,1,32,3,32,377,8,32,1,32,3,32,380,8,32,1,32,3,32,383,
8,32,3,32,385,8,32,1,32,1,32,1,32,1,32,1,32,3,32,392,8,32,1,32,1,
32,3,32,396,8,32,1,32,3,32,399,8,32,1,32,3,32,402,8,32,1,32,3,32,
405,8,32,3,32,407,8,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,
32,1,32,1,32,3,32,420,8,32,1,32,3,32,423,8,32,1,32,1,32,1,32,3,32,
428,8,32,1,32,1,32,1,32,1,32,1,32,3,32,435,8,32,1,32,1,32,1,32,1,
32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,3,
32,453,8,32,1,32,1,32,1,32,1,32,1,32,1,32,3,32,461,8,32,1,33,1,33,
1,33,1,33,1,33,3,33,468,8,33,1,34,1,34,1,34,1,34,1,34,1,34,1,34,
1,34,1,34,1,34,1,34,3,34,481,8,34,3,34,483,8,34,1,34,1,34,1,35,1,
35,1,35,1,35,1,35,3,35,492,8,35,1,36,1,36,1,37,1,37,1,37,1,37,1,
37,1,37,3,37,502,8,37,1,38,1,38,1,38,1,38,1,38,1,38,3,38,510,8,38,
1,39,1,39,1,39,1,39,1,39,1,40,1,40,1,40,1,40,1,40,1,40,0,6,2,8,10,
12,30,32,41,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,
38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,
0,9,2,0,79,82,85,86,1,0,15,16,3,0,17,18,65,67,75,75,2,0,77,77,91,
91,1,0,27,28,2,0,27,27,29,29,1,0,69,71,1,0,37,58,1,0,35,36,563,0,
82,1,0,0,0,2,84,1,0,0,0,4,95,1,0,0,0,6,99,1,0,0,0,8,101,1,0,0,0,
10,112,1,0,0,0,12,123,1,0,0,0,14,141,1,0,0,0,16,152,1,0,0,0,18,154,
1,0,0,0,20,161,1,0,0,0,22,170,1,0,0,0,24,172,1,0,0,0,26,180,1,0,
0,0,28,188,1,0,0,0,30,196,1,0,0,0,32,216,1,0,0,0,34,242,1,0,0,0,
36,249,1,0,0,0,38,267,1,0,0,0,40,269,1,0,0,0,42,274,1,0,0,0,44,317,
1,0,0,0,46,319,1,0,0,0,48,323,1,0,0,0,50,327,1,0,0,0,52,335,1,0,
0,0,54,338,1,0,0,0,56,353,1,0,0,0,58,361,1,0,0,0,60,365,1,0,0,0,
62,369,1,0,0,0,64,460,1,0,0,0,66,467,1,0,0,0,68,469,1,0,0,0,70,491,
1,0,0,0,72,493,1,0,0,0,74,495,1,0,0,0,76,503,1,0,0,0,78,511,1,0,
0,0,80,516,1,0,0,0,82,83,3,2,1,0,83,1,1,0,0,0,84,85,6,1,-1,0,85,
86,3,6,3,0,86,92,1,0,0,0,87,88,10,2,0,0,88,89,7,0,0,0,89,91,3,2,
1,3,90,87,1,0,0,0,91,94,1,0,0,0,92,90,1,0,0,0,92,93,1,0,0,0,93,3,
1,0,0,0,94,92,1,0,0,0,95,96,3,6,3,0,96,97,5,79,0,0,97,98,3,6,3,0,
98,5,1,0,0,0,99,100,3,8,4,0,100,7,1,0,0,0,101,102,6,4,-1,0,102,103,
3,10,5,0,103,109,1,0,0,0,104,105,10,2,0,0,105,106,7,1,0,0,106,108,
3,8,4,3,107,104,1,0,0,0,108,111,1,0,0,0,109,107,1,0,0,0,109,110,
1,0,0,0,110,9,1,0,0,0,111,109,1,0,0,0,112,113,6,5,-1,0,113,114,3,
14,7,0,114,120,1,0,0,0,115,116,10,2,0,0,116,117,7,2,0,0,117,119,
3,10,5,3,118,115,1,0,0,0,119,122,1,0,0,0,120,118,1,0,0,0,120,121,
1,0,0,0,121,11,1,0,0,0,122,120,1,0,0,0,123,124,6,6,-1,0,124,125,
3,16,8,0,125,131,1,0,0,0,126,127,10,2,0,0,127,128,7,2,0,0,128,130,
3,12,6,3,129,126,1,0,0,0,130,133,1,0,0,0,131,129,1,0,0,0,131,132,
1,0,0,0,132,13,1,0,0,0,133,131,1,0,0,0,134,135,7,1,0,0,135,142,3,
14,7,0,136,138,3,18,9,0,137,136,1,0,0,0,138,139,1,0,0,0,139,137,
1,0,0,0,139,140,1,0,0,0,140,142,1,0,0,0,141,134,1,0,0,0,141,137,
1,0,0,0,142,15,1,0,0,0,143,144,7,1,0,0,144,153,3,16,8,0,145,149,
3,18,9,0,146,148,3,20,10,0,147,146,1,0,0,0,148,151,1,0,0,0,149,147,
1,0,0,0,149,150,1,0,0,0,150,153,1,0,0,0,151,149,1,0,0,0,152,143,
1,0,0,0,152,145,1,0,0,0,153,17,1,0,0,0,154,158,3,30,15,0,155,157,
3,22,11,0,156,155,1,0,0,0,157,160,1,0,0,0,158,156,1,0,0,0,158,159,
1,0,0,0,159,19,1,0,0,0,160,158,1,0,0,0,161,165,3,32,16,0,162,164,
3,22,11,0,163,162,1,0,0,0,164,167,1,0,0,0,165,163,1,0,0,0,165,166,
1,0,0,0,166,21,1,0,0,0,167,165,1,0,0,0,168,171,5,89,0,0,169,171,
3,24,12,0,170,168,1,0,0,0,170,169,1,0,0,0,171,23,1,0,0,0,172,178,
5,27,0,0,173,179,3,28,14,0,174,179,3,26,13,0,175,176,3,28,14,0,176,
177,3,26,13,0,177,179,1,0,0,0,178,173,1,0,0,0,178,174,1,0,0,0,178,
175,1,0,0,0,179,25,1,0,0,0,180,181,5,73,0,0,181,184,5,21,0,0,182,
185,3,6,3,0,183,185,3,4,2,0,184,182,1,0,0,0,184,183,1,0,0,0,185,
186,1,0,0,0,186,187,5,22,0,0,187,27,1,0,0,0,188,189,5,74,0,0,189,
192,5,21,0,0,190,193,3,6,3,0,191,193,3,4,2,0,192,190,1,0,0,0,192,
191,1,0,0,0,193,194,1,0,0,0,194,195,5,22,0,0,195,29,1,0,0,0,196,
197,6,15,-1,0,197,198,3,34,17,0,198,213,1,0,0,0,199,200,10,2,0,0,
200,206,5,74,0,0,201,207,3,44,22,0,202,203,5,21,0,0,203,204,3,6,
3,0,204,205,5,22,0,0,205,207,1,0,0,0,206,201,1,0,0,0,206,202,1,0,
0,0,207,209,1,0,0,0,208,210,3,74,37,0,209,208,1,0,0,0,209,210,1,
0,0,0,210,212,1,0,0,0,211,199,1,0,0,0,212,215,1,0,0,0,213,211,1,
0,0,0,213,214,1,0,0,0,214,31,1,0,0,0,215,213,1,0,0,0,216,217,6,16,
-1,0,217,218,3,36,18,0,218,233,1,0,0,0,219,220,10,2,0,0,220,226,
5,74,0,0,221,227,3,44,22,0,222,223,5,21,0,0,223,224,3,6,3,0,224,
225,5,22,0,0,225,227,1,0,0,0,226,221,1,0,0,0,226,222,1,0,0,0,227,
229,1,0,0,0,228,230,3,74,37,0,229,228,1,0,0,0,229,230,1,0,0,0,230,
232,1,0,0,0,231,219,1,0,0,0,232,235,1,0,0,0,233,231,1,0,0,0,233,
234,1,0,0,0,234,33,1,0,0,0,235,233,1,0,0,0,236,243,3,38,19,0,237,
243,3,40,20,0,238,243,3,64,32,0,239,243,3,44,22,0,240,243,3,58,29,
0,241,243,3,60,30,0,242,236,1,0,0,0,242,237,1,0,0,0,242,238,1,0,
0,0,242,239,1,0,0,0,242,240,1,0,0,0,242,241,1,0,0,0,243,35,1,0,0,
0,244,250,3,38,19,0,245,250,3,40,20,0,246,250,3,44,22,0,247,250,
3,58,29,0,248,250,3,60,30,0,249,244,1,0,0,0,249,245,1,0,0,0,249,
246,1,0,0,0,249,247,1,0,0,0,249,248,1,0,0,0,250,37,1,0,0,0,251,252,
5,19,0,0,252,253,3,6,3,0,253,254,5,20,0,0,254,268,1,0,0,0,255,256,
5,25,0,0,256,257,3,6,3,0,257,258,5,26,0,0,258,268,1,0,0,0,259,260,
5,21,0,0,260,261,3,6,3,0,261,262,5,22,0,0,262,268,1,0,0,0,263,264,
5,23,0,0,264,265,3,6,3,0,265,266,5,24,0,0,266,268,1,0,0,0,267,251,
1,0,0,0,267,255,1,0,0,0,267,259,1,0,0,0,267,263,1,0,0,0,268,39,1,
0,0,0,269,270,5,27,0,0,270,271,3,6,3,0,271,272,5,27,0,0,272,41,1,
0,0,0,273,275,5,78,0,0,274,273,1,0,0,0,275,276,1,0,0,0,276,274,1,
0,0,0,276,277,1,0,0,0,277,284,1,0,0,0,278,279,5,1,0,0,279,280,5,
78,0,0,280,281,5,78,0,0,281,283,5,78,0,0,282,278,1,0,0,0,283,286,
1,0,0,0,284,282,1,0,0,0,284,285,1,0,0,0,285,293,1,0,0,0,286,284,
1,0,0,0,287,289,5,2,0,0,288,290,5,78,0,0,289,288,1,0,0,0,290,291,
1,0,0,0,291,289,1,0,0,0,291,292,1,0,0,0,292,294,1,0,0,0,293,287,
1,0,0,0,293,294,1,0,0,0,294,43,1,0,0,0,295,308,7,3,0,0,296,298,3,
74,37,0,297,296,1,0,0,0,297,298,1,0,0,0,298,300,1,0,0,0,299,301,
5,90,0,0,300,299,1,0,0,0,300,301,1,0,0,0,301,309,1,0,0,0,302,304,
5,90,0,0,303,302,1,0,0,0,303,304,1,0,0,0,304,306,1,0,0,0,305,307,
3,74,37,0,306,305,1,0,0,0,306,307,1,0,0,0,307,309,1,0,0,0,308,297,
1,0,0,0,308,303,1,0,0,0,309,318,1,0,0,0,310,318,3,42,21,0,311,318,
5,76,0,0,312,318,3,50,25,0,313,318,3,54,27,0,314,318,3,56,28,0,315,
318,3,46,23,0,316,318,3,48,24,0,317,295,1,0,0,0,317,310,1,0,0,0,
317,311,1,0,0,0,317,312,1,0,0,0,317,313,1,0,0,0,317,314,1,0,0,0,
317,315,1,0,0,0,317,316,1,0,0,0,318,45,1,0,0,0,319,320,5,30,0,0,
320,321,3,6,3,0,321,322,7,4,0,0,322,47,1,0,0,0,323,324,7,5,0,0,324,
325,3,6,3,0,325,326,5,31,0,0,326,49,1,0,0,0,327,328,5,72,0,0,328,
329,5,21,0,0,329,330,3,52,26,0,330,331,5,22,0,0,331,51,1,0,0,0,332,
334,5,77,0,0,333,332,1,0,0,0,334,337,1,0,0,0,335,333,1,0,0,0,335,
336,1,0,0,0,336,53,1,0,0,0,337,335,1,0,0,0,338,344,5,68,0,0,339,
345,5,78,0,0,340,341,5,21,0,0,341,342,3,6,3,0,342,343,5,22,0,0,343,
345,1,0,0,0,344,339,1,0,0,0,344,340,1,0,0,0,345,351,1,0,0,0,346,
352,5,78,0,0,347,348,5,21,0,0,348,349,3,6,3,0,349,350,5,22,0,0,350,
352,1,0,0,0,351,346,1,0,0,0,351,347,1,0,0,0,352,55,1,0,0,0,353,354,
7,6,0,0,354,355,5,21,0,0,355,356,3,6,3,0,356,357,5,22,0,0,357,358,
5,21,0,0,358,359,3,6,3,0,359,360,5,22,0,0,360,57,1,0,0,0,361,362,
5,59,0,0,362,363,3,6,3,0,363,364,5,60,0,0,364,59,1,0,0,0,365,366,
5,61,0,0,366,367,3,6,3,0,367,368,5,62,0,0,368,61,1,0,0,0,369,370,
7,7,0,0,370,63,1,0,0,0,371,384,3,62,31,0,372,374,3,74,37,0,373,372,
1,0,0,0,373,374,1,0,0,0,374,376,1,0,0,0,375,377,3,76,38,0,376,375,
1,0,0,0,376,377,1,0,0,0,377,385,1,0,0,0,378,380,3,76,38,0,379,378,
1,0,0,0,379,380,1,0,0,0,380,382,1,0,0,0,381,383,3,74,37,0,382,381,
1,0,0,0,382,383,1,0,0,0,383,385,1,0,0,0,384,373,1,0,0,0,384,379,
1,0,0,0,385,391,1,0,0,0,386,387,5,19,0,0,387,388,3,70,35,0,388,389,
5,20,0,0,389,392,1,0,0,0,390,392,3,72,36,0,391,386,1,0,0,0,391,390,
1,0,0,0,392,461,1,0,0,0,393,406,7,3,0,0,394,396,3,74,37,0,395,394,
1,0,0,0,395,396,1,0,0,0,396,398,1,0,0,0,397,399,5,90,0,0,398,397,
1,0,0,0,398,399,1,0,0,0,399,407,1,0,0,0,400,402,5,90,0,0,401,400,
1,0,0,0,401,402,1,0,0,0,402,404,1,0,0,0,403,405,3,74,37,0,404,403,
1,0,0,0,404,405,1,0,0,0,405,407,1,0,0,0,406,395,1,0,0,0,406,401,
1,0,0,0,407,408,1,0,0,0,408,409,5,19,0,0,409,410,3,66,33,0,410,411,
5,20,0,0,411,461,1,0,0,0,412,419,5,34,0,0,413,414,3,74,37,0,414,
415,3,76,38,0,415,420,1,0,0,0,416,417,3,76,38,0,417,418,3,74,37,
0,418,420,1,0,0,0,419,413,1,0,0,0,419,416,1,0,0,0,419,420,1,0,0,
0,420,427,1,0,0,0,421,423,3,8,4,0,422,421,1,0,0,0,422,423,1,0,0,
0,423,424,1,0,0,0,424,428,5,76,0,0,425,428,3,54,27,0,426,428,3,8,
4,0,427,422,1,0,0,0,427,425,1,0,0,0,427,426,1,0,0,0,428,461,1,0,
0,0,429,434,5,63,0,0,430,431,5,25,0,0,431,432,3,6,3,0,432,433,5,
26,0,0,433,435,1,0,0,0,434,430,1,0,0,0,434,435,1,0,0,0,435,436,1,
0,0,0,436,437,5,21,0,0,437,438,3,6,3,0,438,439,5,22,0,0,439,461,
1,0,0,0,440,441,5,64,0,0,441,442,5,21,0,0,442,443,3,6,3,0,443,444,
5,22,0,0,444,461,1,0,0,0,445,452,7,8,0,0,446,447,3,78,39,0,447,448,
3,76,38,0,448,453,1,0,0,0,449,450,3,76,38,0,450,451,3,78,39,0,451,
453,1,0,0,0,452,446,1,0,0,0,452,449,1,0,0,0,453,454,1,0,0,0,454,
455,3,10,5,0,455,461,1,0,0,0,456,457,5,32,0,0,457,458,3,68,34,0,
458,459,3,10,5,0,459,461,1,0,0,0,460,371,1,0,0,0,460,393,1,0,0,0,
460,412,1,0,0,0,460,429,1,0,0,0,460,440,1,0,0,0,460,445,1,0,0,0,
460,456,1,0,0,0,461,65,1,0,0,0,462,463,3,6,3,0,463,464,5,1,0,0,464,
465,3,66,33,0,465,468,1,0,0,0,466,468,3,6,3,0,467,462,1,0,0,0,467,
466,1,0,0,0,468,67,1,0,0,0,469,470,5,73,0,0,470,471,5,21,0,0,471,
472,7,3,0,0,472,473,5,33,0,0,473,482,3,6,3,0,474,480,5,74,0,0,475,
476,5,21,0,0,476,477,7,1,0,0,477,481,5,22,0,0,478,481,5,15,0,0,479,
481,5,16,0,0,480,475,1,0,0,0,480,478,1,0,0,0,480,479,1,0,0,0,481,
483,1,0,0,0,482,474,1,0,0,0,482,483,1,0,0,0,483,484,1,0,0,0,484,
485,5,22,0,0,485,69,1,0,0,0,486,492,3,6,3,0,487,488,3,6,3,0,488,
489,5,1,0,0,489,490,3,70,35,0,490,492,1,0,0,0,491,486,1,0,0,0,491,
487,1,0,0,0,492,71,1,0,0,0,493,494,3,12,6,0,494,73,1,0,0,0,495,501,
5,73,0,0,496,502,3,44,22,0,497,498,5,21,0,0,498,499,3,6,3,0,499,
500,5,22,0,0,500,502,1,0,0,0,501,496,1,0,0,0,501,497,1,0,0,0,502,
75,1,0,0,0,503,509,5,74,0,0,504,510,3,44,22,0,505,506,5,21,0,0,506,
507,3,6,3,0,507,508,5,22,0,0,508,510,1,0,0,0,509,504,1,0,0,0,509,
505,1,0,0,0,510,77,1,0,0,0,511,512,5,73,0,0,512,513,5,21,0,0,513,
514,3,4,2,0,514,515,5,22,0,0,515,79,1,0,0,0,516,517,5,73,0,0,517,
518,5,21,0,0,518,519,3,4,2,0,519,520,5,22,0,0,520,81,1,0,0,0,59,
92,109,120,131,139,141,149,152,158,165,170,178,184,192,206,209,213,
226,229,233,242,249,267,276,284,291,293,297,300,303,306,308,317,
335,344,351,373,376,379,382,384,391,395,398,401,404,406,419,422,
427,434,452,460,467,480,482,491,501,509
]
class LaTeXParser ( Parser ):
grammarFileName = "LaTeX.g4"
atn = ATNDeserializer().deserialize(serializedATN())
decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
sharedContextCache = PredictionContextCache()
literalNames = [ "<INVALID>", "','", "'.'", "<INVALID>", "<INVALID>",
"<INVALID>", "<INVALID>", "'\\quad'", "'\\qquad'",
"<INVALID>", "'\\negmedspace'", "'\\negthickspace'",
"'\\left'", "'\\right'", "<INVALID>", "'+'", "'-'",
"'*'", "'/'", "'('", "')'", "'{'", "'}'", "'\\{'",
"'\\}'", "'['", "']'", "'|'", "'\\right|'", "'\\left|'",
"'\\langle'", "'\\rangle'", "'\\lim'", "<INVALID>",
"<INVALID>", "'\\sum'", "'\\prod'", "'\\exp'", "'\\log'",
"'\\lg'", "'\\ln'", "'\\sin'", "'\\cos'", "'\\tan'",
"'\\csc'", "'\\sec'", "'\\cot'", "'\\arcsin'", "'\\arccos'",
"'\\arctan'", "'\\arccsc'", "'\\arcsec'", "'\\arccot'",
"'\\sinh'", "'\\cosh'", "'\\tanh'", "'\\arsinh'", "'\\arcosh'",
"'\\artanh'", "'\\lfloor'", "'\\rfloor'", "'\\lceil'",
"'\\rceil'", "'\\sqrt'", "'\\overline'", "'\\times'",
"'\\cdot'", "'\\div'", "<INVALID>", "'\\binom'", "'\\dbinom'",
"'\\tbinom'", "'\\mathit'", "'_'", "'^'", "':'", "<INVALID>",
"<INVALID>", "<INVALID>", "<INVALID>", "'\\neq'", "'<'",
"<INVALID>", "'\\leqq'", "'\\leqslant'", "'>'", "<INVALID>",
"'\\geqq'", "'\\geqslant'", "'!'" ]
symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "WS", "THINSPACE",
"MEDSPACE", "THICKSPACE", "QUAD", "QQUAD", "NEGTHINSPACE",
"NEGMEDSPACE", "NEGTHICKSPACE", "CMD_LEFT", "CMD_RIGHT",
"IGNORE", "ADD", "SUB", "MUL", "DIV", "L_PAREN", "R_PAREN",
"L_BRACE", "R_BRACE", "L_BRACE_LITERAL", "R_BRACE_LITERAL",
"L_BRACKET", "R_BRACKET", "BAR", "R_BAR", "L_BAR",
"L_ANGLE", "R_ANGLE", "FUNC_LIM", "LIM_APPROACH_SYM",
"FUNC_INT", "FUNC_SUM", "FUNC_PROD", "FUNC_EXP", "FUNC_LOG",
"FUNC_LG", "FUNC_LN", "FUNC_SIN", "FUNC_COS", "FUNC_TAN",
"FUNC_CSC", "FUNC_SEC", "FUNC_COT", "FUNC_ARCSIN",
"FUNC_ARCCOS", "FUNC_ARCTAN", "FUNC_ARCCSC", "FUNC_ARCSEC",
"FUNC_ARCCOT", "FUNC_SINH", "FUNC_COSH", "FUNC_TANH",
"FUNC_ARSINH", "FUNC_ARCOSH", "FUNC_ARTANH", "L_FLOOR",
"R_FLOOR", "L_CEIL", "R_CEIL", "FUNC_SQRT", "FUNC_OVERLINE",
"CMD_TIMES", "CMD_CDOT", "CMD_DIV", "CMD_FRAC", "CMD_BINOM",
"CMD_DBINOM", "CMD_TBINOM", "CMD_MATHIT", "UNDERSCORE",
"CARET", "COLON", "DIFFERENTIAL", "LETTER", "DIGIT",
"EQUAL", "NEQ", "LT", "LTE", "LTE_Q", "LTE_S", "GT",
"GTE", "GTE_Q", "GTE_S", "BANG", "SINGLE_QUOTES",
"SYMBOL" ]
RULE_math = 0
RULE_relation = 1
RULE_equality = 2
RULE_expr = 3
RULE_additive = 4
RULE_mp = 5
RULE_mp_nofunc = 6
RULE_unary = 7
RULE_unary_nofunc = 8
RULE_postfix = 9
RULE_postfix_nofunc = 10
RULE_postfix_op = 11
RULE_eval_at = 12
RULE_eval_at_sub = 13
RULE_eval_at_sup = 14
RULE_exp = 15
RULE_exp_nofunc = 16
RULE_comp = 17
RULE_comp_nofunc = 18
RULE_group = 19
RULE_abs_group = 20
RULE_number = 21
RULE_atom = 22
RULE_bra = 23
RULE_ket = 24
RULE_mathit = 25
RULE_mathit_text = 26
RULE_frac = 27
RULE_binom = 28
RULE_floor = 29
RULE_ceil = 30
RULE_func_normal = 31
RULE_func = 32
RULE_args = 33
RULE_limit_sub = 34
RULE_func_arg = 35
RULE_func_arg_noparens = 36
RULE_subexpr = 37
RULE_supexpr = 38
RULE_subeq = 39
RULE_supeq = 40
ruleNames = [ "math", "relation", "equality", "expr", "additive", "mp",
"mp_nofunc", "unary", "unary_nofunc", "postfix", "postfix_nofunc",
"postfix_op", "eval_at", "eval_at_sub", "eval_at_sup",
"exp", "exp_nofunc", "comp", "comp_nofunc", "group",
"abs_group", "number", "atom", "bra", "ket", "mathit",
"mathit_text", "frac", "binom", "floor", "ceil", "func_normal",
"func", "args", "limit_sub", "func_arg", "func_arg_noparens",
"subexpr", "supexpr", "subeq", "supeq" ]
EOF = Token.EOF
T__0=1
T__1=2
WS=3
THINSPACE=4
MEDSPACE=5
THICKSPACE=6
QUAD=7
QQUAD=8
NEGTHINSPACE=9
NEGMEDSPACE=10
NEGTHICKSPACE=11
CMD_LEFT=12
CMD_RIGHT=13
IGNORE=14
ADD=15
SUB=16
MUL=17
DIV=18
L_PAREN=19
R_PAREN=20
L_BRACE=21
R_BRACE=22
L_BRACE_LITERAL=23
R_BRACE_LITERAL=24
L_BRACKET=25
R_BRACKET=26
BAR=27
R_BAR=28
L_BAR=29
L_ANGLE=30
R_ANGLE=31
FUNC_LIM=32
LIM_APPROACH_SYM=33
FUNC_INT=34
FUNC_SUM=35
FUNC_PROD=36
FUNC_EXP=37
FUNC_LOG=38
FUNC_LG=39
FUNC_LN=40
FUNC_SIN=41
FUNC_COS=42
FUNC_TAN=43
FUNC_CSC=44
FUNC_SEC=45
FUNC_COT=46
FUNC_ARCSIN=47
FUNC_ARCCOS=48
FUNC_ARCTAN=49
FUNC_ARCCSC=50
FUNC_ARCSEC=51
FUNC_ARCCOT=52
FUNC_SINH=53
FUNC_COSH=54
FUNC_TANH=55
FUNC_ARSINH=56
FUNC_ARCOSH=57
FUNC_ARTANH=58
L_FLOOR=59
R_FLOOR=60
L_CEIL=61
R_CEIL=62
FUNC_SQRT=63
FUNC_OVERLINE=64
CMD_TIMES=65
CMD_CDOT=66
CMD_DIV=67
CMD_FRAC=68
CMD_BINOM=69
CMD_DBINOM=70
CMD_TBINOM=71
CMD_MATHIT=72
UNDERSCORE=73
CARET=74
COLON=75
DIFFERENTIAL=76
LETTER=77
DIGIT=78
EQUAL=79
NEQ=80
LT=81
LTE=82
LTE_Q=83
LTE_S=84
GT=85
GTE=86
GTE_Q=87
GTE_S=88
BANG=89
SINGLE_QUOTES=90
SYMBOL=91
def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
super().__init__(input, output)
self.checkVersion("4.11.1")
self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
self._predicates = None
class MathContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def relation(self):
return self.getTypedRuleContext(LaTeXParser.RelationContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_math
def math(self):
localctx = LaTeXParser.MathContext(self, self._ctx, self.state)
self.enterRule(localctx, 0, self.RULE_math)
try:
self.enterOuterAlt(localctx, 1)
self.state = 82
self.relation(0)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class RelationContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def relation(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LaTeXParser.RelationContext)
else:
return self.getTypedRuleContext(LaTeXParser.RelationContext,i)
def EQUAL(self):
return self.getToken(LaTeXParser.EQUAL, 0)
def LT(self):
return self.getToken(LaTeXParser.LT, 0)
def LTE(self):
return self.getToken(LaTeXParser.LTE, 0)
def GT(self):
return self.getToken(LaTeXParser.GT, 0)
def GTE(self):
return self.getToken(LaTeXParser.GTE, 0)
def NEQ(self):
return self.getToken(LaTeXParser.NEQ, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_relation
def relation(self, _p:int=0):
_parentctx = self._ctx
_parentState = self.state
localctx = LaTeXParser.RelationContext(self, self._ctx, _parentState)
_prevctx = localctx
_startState = 2
self.enterRecursionRule(localctx, 2, self.RULE_relation, _p)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 85
self.expr()
self._ctx.stop = self._input.LT(-1)
self.state = 92
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,0,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
if self._parseListeners is not None:
self.triggerExitRuleEvent()
_prevctx = localctx
localctx = LaTeXParser.RelationContext(self, _parentctx, _parentState)
self.pushNewRecursionContext(localctx, _startState, self.RULE_relation)
self.state = 87
if not self.precpred(self._ctx, 2):
from antlr4.error.Errors import FailedPredicateException
raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
self.state = 88
_la = self._input.LA(1)
if not((((_la - 79)) & ~0x3f) == 0 and ((1 << (_la - 79)) & 207) != 0):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 89
self.relation(3)
self.state = 94
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,0,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.unrollRecursionContexts(_parentctx)
return localctx
class EqualityContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def expr(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LaTeXParser.ExprContext)
else:
return self.getTypedRuleContext(LaTeXParser.ExprContext,i)
def EQUAL(self):
return self.getToken(LaTeXParser.EQUAL, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_equality
def equality(self):
localctx = LaTeXParser.EqualityContext(self, self._ctx, self.state)
self.enterRule(localctx, 4, self.RULE_equality)
try:
self.enterOuterAlt(localctx, 1)
self.state = 95
self.expr()
self.state = 96
self.match(LaTeXParser.EQUAL)
self.state = 97
self.expr()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class ExprContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def additive(self):
return self.getTypedRuleContext(LaTeXParser.AdditiveContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_expr
def expr(self):
localctx = LaTeXParser.ExprContext(self, self._ctx, self.state)
self.enterRule(localctx, 6, self.RULE_expr)
try:
self.enterOuterAlt(localctx, 1)
self.state = 99
self.additive(0)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class AdditiveContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def mp(self):
return self.getTypedRuleContext(LaTeXParser.MpContext,0)
def additive(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LaTeXParser.AdditiveContext)
else:
return self.getTypedRuleContext(LaTeXParser.AdditiveContext,i)
def ADD(self):
return self.getToken(LaTeXParser.ADD, 0)
def SUB(self):
return self.getToken(LaTeXParser.SUB, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_additive
def additive(self, _p:int=0):
_parentctx = self._ctx
_parentState = self.state
localctx = LaTeXParser.AdditiveContext(self, self._ctx, _parentState)
_prevctx = localctx
_startState = 8
self.enterRecursionRule(localctx, 8, self.RULE_additive, _p)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 102
self.mp(0)
self._ctx.stop = self._input.LT(-1)
self.state = 109
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,1,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
if self._parseListeners is not None:
self.triggerExitRuleEvent()
_prevctx = localctx
localctx = LaTeXParser.AdditiveContext(self, _parentctx, _parentState)
self.pushNewRecursionContext(localctx, _startState, self.RULE_additive)
self.state = 104
if not self.precpred(self._ctx, 2):
from antlr4.error.Errors import FailedPredicateException
raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
self.state = 105
_la = self._input.LA(1)
if not(_la==15 or _la==16):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 106
self.additive(3)
self.state = 111
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,1,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.unrollRecursionContexts(_parentctx)
return localctx
class MpContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def unary(self):
return self.getTypedRuleContext(LaTeXParser.UnaryContext,0)
def mp(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LaTeXParser.MpContext)
else:
return self.getTypedRuleContext(LaTeXParser.MpContext,i)
def MUL(self):
return self.getToken(LaTeXParser.MUL, 0)
def CMD_TIMES(self):
return self.getToken(LaTeXParser.CMD_TIMES, 0)
def CMD_CDOT(self):
return self.getToken(LaTeXParser.CMD_CDOT, 0)
def DIV(self):
return self.getToken(LaTeXParser.DIV, 0)
def CMD_DIV(self):
return self.getToken(LaTeXParser.CMD_DIV, 0)
def COLON(self):
return self.getToken(LaTeXParser.COLON, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_mp
def mp(self, _p:int=0):
_parentctx = self._ctx
_parentState = self.state
localctx = LaTeXParser.MpContext(self, self._ctx, _parentState)
_prevctx = localctx
_startState = 10
self.enterRecursionRule(localctx, 10, self.RULE_mp, _p)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 113
self.unary()
self._ctx.stop = self._input.LT(-1)
self.state = 120
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,2,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
if self._parseListeners is not None:
self.triggerExitRuleEvent()
_prevctx = localctx
localctx = LaTeXParser.MpContext(self, _parentctx, _parentState)
self.pushNewRecursionContext(localctx, _startState, self.RULE_mp)
self.state = 115
if not self.precpred(self._ctx, 2):
from antlr4.error.Errors import FailedPredicateException
raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
self.state = 116
_la = self._input.LA(1)
if not((((_la - 17)) & ~0x3f) == 0 and ((1 << (_la - 17)) & 290200700988686339) != 0):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 117
self.mp(3)
self.state = 122
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,2,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.unrollRecursionContexts(_parentctx)
return localctx
class Mp_nofuncContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def unary_nofunc(self):
return self.getTypedRuleContext(LaTeXParser.Unary_nofuncContext,0)
def mp_nofunc(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LaTeXParser.Mp_nofuncContext)
else:
return self.getTypedRuleContext(LaTeXParser.Mp_nofuncContext,i)
def MUL(self):
return self.getToken(LaTeXParser.MUL, 0)
def CMD_TIMES(self):
return self.getToken(LaTeXParser.CMD_TIMES, 0)
def CMD_CDOT(self):
return self.getToken(LaTeXParser.CMD_CDOT, 0)
def DIV(self):
return self.getToken(LaTeXParser.DIV, 0)
def CMD_DIV(self):
return self.getToken(LaTeXParser.CMD_DIV, 0)
def COLON(self):
return self.getToken(LaTeXParser.COLON, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_mp_nofunc
def mp_nofunc(self, _p:int=0):
_parentctx = self._ctx
_parentState = self.state
localctx = LaTeXParser.Mp_nofuncContext(self, self._ctx, _parentState)
_prevctx = localctx
_startState = 12
self.enterRecursionRule(localctx, 12, self.RULE_mp_nofunc, _p)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 124
self.unary_nofunc()
self._ctx.stop = self._input.LT(-1)
self.state = 131
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,3,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
if self._parseListeners is not None:
self.triggerExitRuleEvent()
_prevctx = localctx
localctx = LaTeXParser.Mp_nofuncContext(self, _parentctx, _parentState)
self.pushNewRecursionContext(localctx, _startState, self.RULE_mp_nofunc)
self.state = 126
if not self.precpred(self._ctx, 2):
from antlr4.error.Errors import FailedPredicateException
raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
self.state = 127
_la = self._input.LA(1)
if not((((_la - 17)) & ~0x3f) == 0 and ((1 << (_la - 17)) & 290200700988686339) != 0):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 128
self.mp_nofunc(3)
self.state = 133
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,3,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.unrollRecursionContexts(_parentctx)
return localctx
class UnaryContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def unary(self):
return self.getTypedRuleContext(LaTeXParser.UnaryContext,0)
def ADD(self):
return self.getToken(LaTeXParser.ADD, 0)
def SUB(self):
return self.getToken(LaTeXParser.SUB, 0)
def postfix(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LaTeXParser.PostfixContext)
else:
return self.getTypedRuleContext(LaTeXParser.PostfixContext,i)
def getRuleIndex(self):
return LaTeXParser.RULE_unary
def unary(self):
localctx = LaTeXParser.UnaryContext(self, self._ctx, self.state)
self.enterRule(localctx, 14, self.RULE_unary)
self._la = 0 # Token type
try:
self.state = 141
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [15, 16]:
self.enterOuterAlt(localctx, 1)
self.state = 134
_la = self._input.LA(1)
if not(_la==15 or _la==16):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 135
self.unary()
pass
elif token in [19, 21, 23, 25, 27, 29, 30, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 63, 64, 68, 69, 70, 71, 72, 76, 77, 78, 91]:
self.enterOuterAlt(localctx, 2)
self.state = 137
self._errHandler.sync(self)
_alt = 1
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt == 1:
self.state = 136
self.postfix()
else:
raise NoViableAltException(self)
self.state = 139
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,4,self._ctx)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Unary_nofuncContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def unary_nofunc(self):
return self.getTypedRuleContext(LaTeXParser.Unary_nofuncContext,0)
def ADD(self):
return self.getToken(LaTeXParser.ADD, 0)
def SUB(self):
return self.getToken(LaTeXParser.SUB, 0)
def postfix(self):
return self.getTypedRuleContext(LaTeXParser.PostfixContext,0)
def postfix_nofunc(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LaTeXParser.Postfix_nofuncContext)
else:
return self.getTypedRuleContext(LaTeXParser.Postfix_nofuncContext,i)
def getRuleIndex(self):
return LaTeXParser.RULE_unary_nofunc
def unary_nofunc(self):
localctx = LaTeXParser.Unary_nofuncContext(self, self._ctx, self.state)
self.enterRule(localctx, 16, self.RULE_unary_nofunc)
self._la = 0 # Token type
try:
self.state = 152
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [15, 16]:
self.enterOuterAlt(localctx, 1)
self.state = 143
_la = self._input.LA(1)
if not(_la==15 or _la==16):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 144
self.unary_nofunc()
pass
elif token in [19, 21, 23, 25, 27, 29, 30, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 63, 64, 68, 69, 70, 71, 72, 76, 77, 78, 91]:
self.enterOuterAlt(localctx, 2)
self.state = 145
self.postfix()
self.state = 149
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,6,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 146
self.postfix_nofunc()
self.state = 151
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,6,self._ctx)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class PostfixContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def exp(self):
return self.getTypedRuleContext(LaTeXParser.ExpContext,0)
def postfix_op(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LaTeXParser.Postfix_opContext)
else:
return self.getTypedRuleContext(LaTeXParser.Postfix_opContext,i)
def getRuleIndex(self):
return LaTeXParser.RULE_postfix
def postfix(self):
localctx = LaTeXParser.PostfixContext(self, self._ctx, self.state)
self.enterRule(localctx, 18, self.RULE_postfix)
try:
self.enterOuterAlt(localctx, 1)
self.state = 154
self.exp(0)
self.state = 158
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,8,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 155
self.postfix_op()
self.state = 160
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,8,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Postfix_nofuncContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def exp_nofunc(self):
return self.getTypedRuleContext(LaTeXParser.Exp_nofuncContext,0)
def postfix_op(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LaTeXParser.Postfix_opContext)
else:
return self.getTypedRuleContext(LaTeXParser.Postfix_opContext,i)
def getRuleIndex(self):
return LaTeXParser.RULE_postfix_nofunc
def postfix_nofunc(self):
localctx = LaTeXParser.Postfix_nofuncContext(self, self._ctx, self.state)
self.enterRule(localctx, 20, self.RULE_postfix_nofunc)
try:
self.enterOuterAlt(localctx, 1)
self.state = 161
self.exp_nofunc(0)
self.state = 165
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,9,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 162
self.postfix_op()
self.state = 167
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,9,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Postfix_opContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def BANG(self):
return self.getToken(LaTeXParser.BANG, 0)
def eval_at(self):
return self.getTypedRuleContext(LaTeXParser.Eval_atContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_postfix_op
def postfix_op(self):
localctx = LaTeXParser.Postfix_opContext(self, self._ctx, self.state)
self.enterRule(localctx, 22, self.RULE_postfix_op)
try:
self.state = 170
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [89]:
self.enterOuterAlt(localctx, 1)
self.state = 168
self.match(LaTeXParser.BANG)
pass
elif token in [27]:
self.enterOuterAlt(localctx, 2)
self.state = 169
self.eval_at()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Eval_atContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def BAR(self):
return self.getToken(LaTeXParser.BAR, 0)
def eval_at_sup(self):
return self.getTypedRuleContext(LaTeXParser.Eval_at_supContext,0)
def eval_at_sub(self):
return self.getTypedRuleContext(LaTeXParser.Eval_at_subContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_eval_at
def eval_at(self):
localctx = LaTeXParser.Eval_atContext(self, self._ctx, self.state)
self.enterRule(localctx, 24, self.RULE_eval_at)
try:
self.enterOuterAlt(localctx, 1)
self.state = 172
self.match(LaTeXParser.BAR)
self.state = 178
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,11,self._ctx)
if la_ == 1:
self.state = 173
self.eval_at_sup()
pass
elif la_ == 2:
self.state = 174
self.eval_at_sub()
pass
elif la_ == 3:
self.state = 175
self.eval_at_sup()
self.state = 176
self.eval_at_sub()
pass
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Eval_at_subContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def UNDERSCORE(self):
return self.getToken(LaTeXParser.UNDERSCORE, 0)
def L_BRACE(self):
return self.getToken(LaTeXParser.L_BRACE, 0)
def R_BRACE(self):
return self.getToken(LaTeXParser.R_BRACE, 0)
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def equality(self):
return self.getTypedRuleContext(LaTeXParser.EqualityContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_eval_at_sub
def eval_at_sub(self):
localctx = LaTeXParser.Eval_at_subContext(self, self._ctx, self.state)
self.enterRule(localctx, 26, self.RULE_eval_at_sub)
try:
self.enterOuterAlt(localctx, 1)
self.state = 180
self.match(LaTeXParser.UNDERSCORE)
self.state = 181
self.match(LaTeXParser.L_BRACE)
self.state = 184
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,12,self._ctx)
if la_ == 1:
self.state = 182
self.expr()
pass
elif la_ == 2:
self.state = 183
self.equality()
pass
self.state = 186
self.match(LaTeXParser.R_BRACE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Eval_at_supContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def CARET(self):
return self.getToken(LaTeXParser.CARET, 0)
def L_BRACE(self):
return self.getToken(LaTeXParser.L_BRACE, 0)
def R_BRACE(self):
return self.getToken(LaTeXParser.R_BRACE, 0)
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def equality(self):
return self.getTypedRuleContext(LaTeXParser.EqualityContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_eval_at_sup
def eval_at_sup(self):
localctx = LaTeXParser.Eval_at_supContext(self, self._ctx, self.state)
self.enterRule(localctx, 28, self.RULE_eval_at_sup)
try:
self.enterOuterAlt(localctx, 1)
self.state = 188
self.match(LaTeXParser.CARET)
self.state = 189
self.match(LaTeXParser.L_BRACE)
self.state = 192
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,13,self._ctx)
if la_ == 1:
self.state = 190
self.expr()
pass
elif la_ == 2:
self.state = 191
self.equality()
pass
self.state = 194
self.match(LaTeXParser.R_BRACE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class ExpContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def comp(self):
return self.getTypedRuleContext(LaTeXParser.CompContext,0)
def exp(self):
return self.getTypedRuleContext(LaTeXParser.ExpContext,0)
def CARET(self):
return self.getToken(LaTeXParser.CARET, 0)
def atom(self):
return self.getTypedRuleContext(LaTeXParser.AtomContext,0)
def L_BRACE(self):
return self.getToken(LaTeXParser.L_BRACE, 0)
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def R_BRACE(self):
return self.getToken(LaTeXParser.R_BRACE, 0)
def subexpr(self):
return self.getTypedRuleContext(LaTeXParser.SubexprContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_exp
def exp(self, _p:int=0):
_parentctx = self._ctx
_parentState = self.state
localctx = LaTeXParser.ExpContext(self, self._ctx, _parentState)
_prevctx = localctx
_startState = 30
self.enterRecursionRule(localctx, 30, self.RULE_exp, _p)
try:
self.enterOuterAlt(localctx, 1)
self.state = 197
self.comp()
self._ctx.stop = self._input.LT(-1)
self.state = 213
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,16,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
if self._parseListeners is not None:
self.triggerExitRuleEvent()
_prevctx = localctx
localctx = LaTeXParser.ExpContext(self, _parentctx, _parentState)
self.pushNewRecursionContext(localctx, _startState, self.RULE_exp)
self.state = 199
if not self.precpred(self._ctx, 2):
from antlr4.error.Errors import FailedPredicateException
raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
self.state = 200
self.match(LaTeXParser.CARET)
self.state = 206
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [27, 29, 30, 68, 69, 70, 71, 72, 76, 77, 78, 91]:
self.state = 201
self.atom()
pass
elif token in [21]:
self.state = 202
self.match(LaTeXParser.L_BRACE)
self.state = 203
self.expr()
self.state = 204
self.match(LaTeXParser.R_BRACE)
pass
else:
raise NoViableAltException(self)
self.state = 209
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,15,self._ctx)
if la_ == 1:
self.state = 208
self.subexpr()
self.state = 215
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,16,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.unrollRecursionContexts(_parentctx)
return localctx
class Exp_nofuncContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def comp_nofunc(self):
return self.getTypedRuleContext(LaTeXParser.Comp_nofuncContext,0)
def exp_nofunc(self):
return self.getTypedRuleContext(LaTeXParser.Exp_nofuncContext,0)
def CARET(self):
return self.getToken(LaTeXParser.CARET, 0)
def atom(self):
return self.getTypedRuleContext(LaTeXParser.AtomContext,0)
def L_BRACE(self):
return self.getToken(LaTeXParser.L_BRACE, 0)
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def R_BRACE(self):
return self.getToken(LaTeXParser.R_BRACE, 0)
def subexpr(self):
return self.getTypedRuleContext(LaTeXParser.SubexprContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_exp_nofunc
def exp_nofunc(self, _p:int=0):
_parentctx = self._ctx
_parentState = self.state
localctx = LaTeXParser.Exp_nofuncContext(self, self._ctx, _parentState)
_prevctx = localctx
_startState = 32
self.enterRecursionRule(localctx, 32, self.RULE_exp_nofunc, _p)
try:
self.enterOuterAlt(localctx, 1)
self.state = 217
self.comp_nofunc()
self._ctx.stop = self._input.LT(-1)
self.state = 233
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,19,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
if self._parseListeners is not None:
self.triggerExitRuleEvent()
_prevctx = localctx
localctx = LaTeXParser.Exp_nofuncContext(self, _parentctx, _parentState)
self.pushNewRecursionContext(localctx, _startState, self.RULE_exp_nofunc)
self.state = 219
if not self.precpred(self._ctx, 2):
from antlr4.error.Errors import FailedPredicateException
raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
self.state = 220
self.match(LaTeXParser.CARET)
self.state = 226
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [27, 29, 30, 68, 69, 70, 71, 72, 76, 77, 78, 91]:
self.state = 221
self.atom()
pass
elif token in [21]:
self.state = 222
self.match(LaTeXParser.L_BRACE)
self.state = 223
self.expr()
self.state = 224
self.match(LaTeXParser.R_BRACE)
pass
else:
raise NoViableAltException(self)
self.state = 229
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,18,self._ctx)
if la_ == 1:
self.state = 228
self.subexpr()
self.state = 235
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,19,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.unrollRecursionContexts(_parentctx)
return localctx
class CompContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def group(self):
return self.getTypedRuleContext(LaTeXParser.GroupContext,0)
def abs_group(self):
return self.getTypedRuleContext(LaTeXParser.Abs_groupContext,0)
def func(self):
return self.getTypedRuleContext(LaTeXParser.FuncContext,0)
def atom(self):
return self.getTypedRuleContext(LaTeXParser.AtomContext,0)
def floor(self):
return self.getTypedRuleContext(LaTeXParser.FloorContext,0)
def ceil(self):
return self.getTypedRuleContext(LaTeXParser.CeilContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_comp
def comp(self):
localctx = LaTeXParser.CompContext(self, self._ctx, self.state)
self.enterRule(localctx, 34, self.RULE_comp)
try:
self.state = 242
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,20,self._ctx)
if la_ == 1:
self.enterOuterAlt(localctx, 1)
self.state = 236
self.group()
pass
elif la_ == 2:
self.enterOuterAlt(localctx, 2)
self.state = 237
self.abs_group()
pass
elif la_ == 3:
self.enterOuterAlt(localctx, 3)
self.state = 238
self.func()
pass
elif la_ == 4:
self.enterOuterAlt(localctx, 4)
self.state = 239
self.atom()
pass
elif la_ == 5:
self.enterOuterAlt(localctx, 5)
self.state = 240
self.floor()
pass
elif la_ == 6:
self.enterOuterAlt(localctx, 6)
self.state = 241
self.ceil()
pass
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Comp_nofuncContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def group(self):
return self.getTypedRuleContext(LaTeXParser.GroupContext,0)
def abs_group(self):
return self.getTypedRuleContext(LaTeXParser.Abs_groupContext,0)
def atom(self):
return self.getTypedRuleContext(LaTeXParser.AtomContext,0)
def floor(self):
return self.getTypedRuleContext(LaTeXParser.FloorContext,0)
def ceil(self):
return self.getTypedRuleContext(LaTeXParser.CeilContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_comp_nofunc
def comp_nofunc(self):
localctx = LaTeXParser.Comp_nofuncContext(self, self._ctx, self.state)
self.enterRule(localctx, 36, self.RULE_comp_nofunc)
try:
self.state = 249
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,21,self._ctx)
if la_ == 1:
self.enterOuterAlt(localctx, 1)
self.state = 244
self.group()
pass
elif la_ == 2:
self.enterOuterAlt(localctx, 2)
self.state = 245
self.abs_group()
pass
elif la_ == 3:
self.enterOuterAlt(localctx, 3)
self.state = 246
self.atom()
pass
elif la_ == 4:
self.enterOuterAlt(localctx, 4)
self.state = 247
self.floor()
pass
elif la_ == 5:
self.enterOuterAlt(localctx, 5)
self.state = 248
self.ceil()
pass
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class GroupContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def L_PAREN(self):
return self.getToken(LaTeXParser.L_PAREN, 0)
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def R_PAREN(self):
return self.getToken(LaTeXParser.R_PAREN, 0)
def L_BRACKET(self):
return self.getToken(LaTeXParser.L_BRACKET, 0)
def R_BRACKET(self):
return self.getToken(LaTeXParser.R_BRACKET, 0)
def L_BRACE(self):
return self.getToken(LaTeXParser.L_BRACE, 0)
def R_BRACE(self):
return self.getToken(LaTeXParser.R_BRACE, 0)
def L_BRACE_LITERAL(self):
return self.getToken(LaTeXParser.L_BRACE_LITERAL, 0)
def R_BRACE_LITERAL(self):
return self.getToken(LaTeXParser.R_BRACE_LITERAL, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_group
def group(self):
localctx = LaTeXParser.GroupContext(self, self._ctx, self.state)
self.enterRule(localctx, 38, self.RULE_group)
try:
self.state = 267
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [19]:
self.enterOuterAlt(localctx, 1)
self.state = 251
self.match(LaTeXParser.L_PAREN)
self.state = 252
self.expr()
self.state = 253
self.match(LaTeXParser.R_PAREN)
pass
elif token in [25]:
self.enterOuterAlt(localctx, 2)
self.state = 255
self.match(LaTeXParser.L_BRACKET)
self.state = 256
self.expr()
self.state = 257
self.match(LaTeXParser.R_BRACKET)
pass
elif token in [21]:
self.enterOuterAlt(localctx, 3)
self.state = 259
self.match(LaTeXParser.L_BRACE)
self.state = 260
self.expr()
self.state = 261
self.match(LaTeXParser.R_BRACE)
pass
elif token in [23]:
self.enterOuterAlt(localctx, 4)
self.state = 263
self.match(LaTeXParser.L_BRACE_LITERAL)
self.state = 264
self.expr()
self.state = 265
self.match(LaTeXParser.R_BRACE_LITERAL)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Abs_groupContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def BAR(self, i:int=None):
if i is None:
return self.getTokens(LaTeXParser.BAR)
else:
return self.getToken(LaTeXParser.BAR, i)
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_abs_group
def abs_group(self):
localctx = LaTeXParser.Abs_groupContext(self, self._ctx, self.state)
self.enterRule(localctx, 40, self.RULE_abs_group)
try:
self.enterOuterAlt(localctx, 1)
self.state = 269
self.match(LaTeXParser.BAR)
self.state = 270
self.expr()
self.state = 271
self.match(LaTeXParser.BAR)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class NumberContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def DIGIT(self, i:int=None):
if i is None:
return self.getTokens(LaTeXParser.DIGIT)
else:
return self.getToken(LaTeXParser.DIGIT, i)
def getRuleIndex(self):
return LaTeXParser.RULE_number
def number(self):
localctx = LaTeXParser.NumberContext(self, self._ctx, self.state)
self.enterRule(localctx, 42, self.RULE_number)
try:
self.enterOuterAlt(localctx, 1)
self.state = 274
self._errHandler.sync(self)
_alt = 1
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt == 1:
self.state = 273
self.match(LaTeXParser.DIGIT)
else:
raise NoViableAltException(self)
self.state = 276
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,23,self._ctx)
self.state = 284
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,24,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 278
self.match(LaTeXParser.T__0)
self.state = 279
self.match(LaTeXParser.DIGIT)
self.state = 280
self.match(LaTeXParser.DIGIT)
self.state = 281
self.match(LaTeXParser.DIGIT)
self.state = 286
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,24,self._ctx)
self.state = 293
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,26,self._ctx)
if la_ == 1:
self.state = 287
self.match(LaTeXParser.T__1)
self.state = 289
self._errHandler.sync(self)
_alt = 1
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt == 1:
self.state = 288
self.match(LaTeXParser.DIGIT)
else:
raise NoViableAltException(self)
self.state = 291
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,25,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class AtomContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def LETTER(self):
return self.getToken(LaTeXParser.LETTER, 0)
def SYMBOL(self):
return self.getToken(LaTeXParser.SYMBOL, 0)
def subexpr(self):
return self.getTypedRuleContext(LaTeXParser.SubexprContext,0)
def SINGLE_QUOTES(self):
return self.getToken(LaTeXParser.SINGLE_QUOTES, 0)
def number(self):
return self.getTypedRuleContext(LaTeXParser.NumberContext,0)
def DIFFERENTIAL(self):
return self.getToken(LaTeXParser.DIFFERENTIAL, 0)
def mathit(self):
return self.getTypedRuleContext(LaTeXParser.MathitContext,0)
def frac(self):
return self.getTypedRuleContext(LaTeXParser.FracContext,0)
def binom(self):
return self.getTypedRuleContext(LaTeXParser.BinomContext,0)
def bra(self):
return self.getTypedRuleContext(LaTeXParser.BraContext,0)
def ket(self):
return self.getTypedRuleContext(LaTeXParser.KetContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_atom
def atom(self):
localctx = LaTeXParser.AtomContext(self, self._ctx, self.state)
self.enterRule(localctx, 44, self.RULE_atom)
self._la = 0 # Token type
try:
self.state = 317
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [77, 91]:
self.enterOuterAlt(localctx, 1)
self.state = 295
_la = self._input.LA(1)
if not(_la==77 or _la==91):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 308
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,31,self._ctx)
if la_ == 1:
self.state = 297
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,27,self._ctx)
if la_ == 1:
self.state = 296
self.subexpr()
self.state = 300
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,28,self._ctx)
if la_ == 1:
self.state = 299
self.match(LaTeXParser.SINGLE_QUOTES)
pass
elif la_ == 2:
self.state = 303
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,29,self._ctx)
if la_ == 1:
self.state = 302
self.match(LaTeXParser.SINGLE_QUOTES)
self.state = 306
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,30,self._ctx)
if la_ == 1:
self.state = 305
self.subexpr()
pass
pass
elif token in [78]:
self.enterOuterAlt(localctx, 2)
self.state = 310
self.number()
pass
elif token in [76]:
self.enterOuterAlt(localctx, 3)
self.state = 311
self.match(LaTeXParser.DIFFERENTIAL)
pass
elif token in [72]:
self.enterOuterAlt(localctx, 4)
self.state = 312
self.mathit()
pass
elif token in [68]:
self.enterOuterAlt(localctx, 5)
self.state = 313
self.frac()
pass
elif token in [69, 70, 71]:
self.enterOuterAlt(localctx, 6)
self.state = 314
self.binom()
pass
elif token in [30]:
self.enterOuterAlt(localctx, 7)
self.state = 315
self.bra()
pass
elif token in [27, 29]:
self.enterOuterAlt(localctx, 8)
self.state = 316
self.ket()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class BraContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def L_ANGLE(self):
return self.getToken(LaTeXParser.L_ANGLE, 0)
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def R_BAR(self):
return self.getToken(LaTeXParser.R_BAR, 0)
def BAR(self):
return self.getToken(LaTeXParser.BAR, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_bra
def bra(self):
localctx = LaTeXParser.BraContext(self, self._ctx, self.state)
self.enterRule(localctx, 46, self.RULE_bra)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 319
self.match(LaTeXParser.L_ANGLE)
self.state = 320
self.expr()
self.state = 321
_la = self._input.LA(1)
if not(_la==27 or _la==28):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class KetContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def R_ANGLE(self):
return self.getToken(LaTeXParser.R_ANGLE, 0)
def L_BAR(self):
return self.getToken(LaTeXParser.L_BAR, 0)
def BAR(self):
return self.getToken(LaTeXParser.BAR, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_ket
def ket(self):
localctx = LaTeXParser.KetContext(self, self._ctx, self.state)
self.enterRule(localctx, 48, self.RULE_ket)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 323
_la = self._input.LA(1)
if not(_la==27 or _la==29):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 324
self.expr()
self.state = 325
self.match(LaTeXParser.R_ANGLE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class MathitContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def CMD_MATHIT(self):
return self.getToken(LaTeXParser.CMD_MATHIT, 0)
def L_BRACE(self):
return self.getToken(LaTeXParser.L_BRACE, 0)
def mathit_text(self):
return self.getTypedRuleContext(LaTeXParser.Mathit_textContext,0)
def R_BRACE(self):
return self.getToken(LaTeXParser.R_BRACE, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_mathit
def mathit(self):
localctx = LaTeXParser.MathitContext(self, self._ctx, self.state)
self.enterRule(localctx, 50, self.RULE_mathit)
try:
self.enterOuterAlt(localctx, 1)
self.state = 327
self.match(LaTeXParser.CMD_MATHIT)
self.state = 328
self.match(LaTeXParser.L_BRACE)
self.state = 329
self.mathit_text()
self.state = 330
self.match(LaTeXParser.R_BRACE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Mathit_textContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def LETTER(self, i:int=None):
if i is None:
return self.getTokens(LaTeXParser.LETTER)
else:
return self.getToken(LaTeXParser.LETTER, i)
def getRuleIndex(self):
return LaTeXParser.RULE_mathit_text
def mathit_text(self):
localctx = LaTeXParser.Mathit_textContext(self, self._ctx, self.state)
self.enterRule(localctx, 52, self.RULE_mathit_text)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 335
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==77:
self.state = 332
self.match(LaTeXParser.LETTER)
self.state = 337
self._errHandler.sync(self)
_la = self._input.LA(1)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class FracContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
self.upperd = None # Token
self.upper = None # ExprContext
self.lowerd = None # Token
self.lower = None # ExprContext
def CMD_FRAC(self):
return self.getToken(LaTeXParser.CMD_FRAC, 0)
def L_BRACE(self, i:int=None):
if i is None:
return self.getTokens(LaTeXParser.L_BRACE)
else:
return self.getToken(LaTeXParser.L_BRACE, i)
def R_BRACE(self, i:int=None):
if i is None:
return self.getTokens(LaTeXParser.R_BRACE)
else:
return self.getToken(LaTeXParser.R_BRACE, i)
def DIGIT(self, i:int=None):
if i is None:
return self.getTokens(LaTeXParser.DIGIT)
else:
return self.getToken(LaTeXParser.DIGIT, i)
def expr(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LaTeXParser.ExprContext)
else:
return self.getTypedRuleContext(LaTeXParser.ExprContext,i)
def getRuleIndex(self):
return LaTeXParser.RULE_frac
def frac(self):
localctx = LaTeXParser.FracContext(self, self._ctx, self.state)
self.enterRule(localctx, 54, self.RULE_frac)
try:
self.enterOuterAlt(localctx, 1)
self.state = 338
self.match(LaTeXParser.CMD_FRAC)
self.state = 344
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [78]:
self.state = 339
localctx.upperd = self.match(LaTeXParser.DIGIT)
pass
elif token in [21]:
self.state = 340
self.match(LaTeXParser.L_BRACE)
self.state = 341
localctx.upper = self.expr()
self.state = 342
self.match(LaTeXParser.R_BRACE)
pass
else:
raise NoViableAltException(self)
self.state = 351
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [78]:
self.state = 346
localctx.lowerd = self.match(LaTeXParser.DIGIT)
pass
elif token in [21]:
self.state = 347
self.match(LaTeXParser.L_BRACE)
self.state = 348
localctx.lower = self.expr()
self.state = 349
self.match(LaTeXParser.R_BRACE)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class BinomContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
self.n = None # ExprContext
self.k = None # ExprContext
def L_BRACE(self, i:int=None):
if i is None:
return self.getTokens(LaTeXParser.L_BRACE)
else:
return self.getToken(LaTeXParser.L_BRACE, i)
def R_BRACE(self, i:int=None):
if i is None:
return self.getTokens(LaTeXParser.R_BRACE)
else:
return self.getToken(LaTeXParser.R_BRACE, i)
def CMD_BINOM(self):
return self.getToken(LaTeXParser.CMD_BINOM, 0)
def CMD_DBINOM(self):
return self.getToken(LaTeXParser.CMD_DBINOM, 0)
def CMD_TBINOM(self):
return self.getToken(LaTeXParser.CMD_TBINOM, 0)
def expr(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LaTeXParser.ExprContext)
else:
return self.getTypedRuleContext(LaTeXParser.ExprContext,i)
def getRuleIndex(self):
return LaTeXParser.RULE_binom
def binom(self):
localctx = LaTeXParser.BinomContext(self, self._ctx, self.state)
self.enterRule(localctx, 56, self.RULE_binom)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 353
_la = self._input.LA(1)
if not((((_la - 69)) & ~0x3f) == 0 and ((1 << (_la - 69)) & 7) != 0):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 354
self.match(LaTeXParser.L_BRACE)
self.state = 355
localctx.n = self.expr()
self.state = 356
self.match(LaTeXParser.R_BRACE)
self.state = 357
self.match(LaTeXParser.L_BRACE)
self.state = 358
localctx.k = self.expr()
self.state = 359
self.match(LaTeXParser.R_BRACE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class FloorContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
self.val = None # ExprContext
def L_FLOOR(self):
return self.getToken(LaTeXParser.L_FLOOR, 0)
def R_FLOOR(self):
return self.getToken(LaTeXParser.R_FLOOR, 0)
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_floor
def floor(self):
localctx = LaTeXParser.FloorContext(self, self._ctx, self.state)
self.enterRule(localctx, 58, self.RULE_floor)
try:
self.enterOuterAlt(localctx, 1)
self.state = 361
self.match(LaTeXParser.L_FLOOR)
self.state = 362
localctx.val = self.expr()
self.state = 363
self.match(LaTeXParser.R_FLOOR)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class CeilContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
self.val = None # ExprContext
def L_CEIL(self):
return self.getToken(LaTeXParser.L_CEIL, 0)
def R_CEIL(self):
return self.getToken(LaTeXParser.R_CEIL, 0)
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_ceil
def ceil(self):
localctx = LaTeXParser.CeilContext(self, self._ctx, self.state)
self.enterRule(localctx, 60, self.RULE_ceil)
try:
self.enterOuterAlt(localctx, 1)
self.state = 365
self.match(LaTeXParser.L_CEIL)
self.state = 366
localctx.val = self.expr()
self.state = 367
self.match(LaTeXParser.R_CEIL)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Func_normalContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def FUNC_EXP(self):
return self.getToken(LaTeXParser.FUNC_EXP, 0)
def FUNC_LOG(self):
return self.getToken(LaTeXParser.FUNC_LOG, 0)
def FUNC_LG(self):
return self.getToken(LaTeXParser.FUNC_LG, 0)
def FUNC_LN(self):
return self.getToken(LaTeXParser.FUNC_LN, 0)
def FUNC_SIN(self):
return self.getToken(LaTeXParser.FUNC_SIN, 0)
def FUNC_COS(self):
return self.getToken(LaTeXParser.FUNC_COS, 0)
def FUNC_TAN(self):
return self.getToken(LaTeXParser.FUNC_TAN, 0)
def FUNC_CSC(self):
return self.getToken(LaTeXParser.FUNC_CSC, 0)
def FUNC_SEC(self):
return self.getToken(LaTeXParser.FUNC_SEC, 0)
def FUNC_COT(self):
return self.getToken(LaTeXParser.FUNC_COT, 0)
def FUNC_ARCSIN(self):
return self.getToken(LaTeXParser.FUNC_ARCSIN, 0)
def FUNC_ARCCOS(self):
return self.getToken(LaTeXParser.FUNC_ARCCOS, 0)
def FUNC_ARCTAN(self):
return self.getToken(LaTeXParser.FUNC_ARCTAN, 0)
def FUNC_ARCCSC(self):
return self.getToken(LaTeXParser.FUNC_ARCCSC, 0)
def FUNC_ARCSEC(self):
return self.getToken(LaTeXParser.FUNC_ARCSEC, 0)
def FUNC_ARCCOT(self):
return self.getToken(LaTeXParser.FUNC_ARCCOT, 0)
def FUNC_SINH(self):
return self.getToken(LaTeXParser.FUNC_SINH, 0)
def FUNC_COSH(self):
return self.getToken(LaTeXParser.FUNC_COSH, 0)
def FUNC_TANH(self):
return self.getToken(LaTeXParser.FUNC_TANH, 0)
def FUNC_ARSINH(self):
return self.getToken(LaTeXParser.FUNC_ARSINH, 0)
def FUNC_ARCOSH(self):
return self.getToken(LaTeXParser.FUNC_ARCOSH, 0)
def FUNC_ARTANH(self):
return self.getToken(LaTeXParser.FUNC_ARTANH, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_func_normal
def func_normal(self):
localctx = LaTeXParser.Func_normalContext(self, self._ctx, self.state)
self.enterRule(localctx, 62, self.RULE_func_normal)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 369
_la = self._input.LA(1)
if not(((_la) & ~0x3f) == 0 and ((1 << _la) & 576460614864470016) != 0):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class FuncContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
self.root = None # ExprContext
self.base = None # ExprContext
def func_normal(self):
return self.getTypedRuleContext(LaTeXParser.Func_normalContext,0)
def L_PAREN(self):
return self.getToken(LaTeXParser.L_PAREN, 0)
def func_arg(self):
return self.getTypedRuleContext(LaTeXParser.Func_argContext,0)
def R_PAREN(self):
return self.getToken(LaTeXParser.R_PAREN, 0)
def func_arg_noparens(self):
return self.getTypedRuleContext(LaTeXParser.Func_arg_noparensContext,0)
def subexpr(self):
return self.getTypedRuleContext(LaTeXParser.SubexprContext,0)
def supexpr(self):
return self.getTypedRuleContext(LaTeXParser.SupexprContext,0)
def args(self):
return self.getTypedRuleContext(LaTeXParser.ArgsContext,0)
def LETTER(self):
return self.getToken(LaTeXParser.LETTER, 0)
def SYMBOL(self):
return self.getToken(LaTeXParser.SYMBOL, 0)
def SINGLE_QUOTES(self):
return self.getToken(LaTeXParser.SINGLE_QUOTES, 0)
def FUNC_INT(self):
return self.getToken(LaTeXParser.FUNC_INT, 0)
def DIFFERENTIAL(self):
return self.getToken(LaTeXParser.DIFFERENTIAL, 0)
def frac(self):
return self.getTypedRuleContext(LaTeXParser.FracContext,0)
def additive(self):
return self.getTypedRuleContext(LaTeXParser.AdditiveContext,0)
def FUNC_SQRT(self):
return self.getToken(LaTeXParser.FUNC_SQRT, 0)
def L_BRACE(self):
return self.getToken(LaTeXParser.L_BRACE, 0)
def R_BRACE(self):
return self.getToken(LaTeXParser.R_BRACE, 0)
def expr(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LaTeXParser.ExprContext)
else:
return self.getTypedRuleContext(LaTeXParser.ExprContext,i)
def L_BRACKET(self):
return self.getToken(LaTeXParser.L_BRACKET, 0)
def R_BRACKET(self):
return self.getToken(LaTeXParser.R_BRACKET, 0)
def FUNC_OVERLINE(self):
return self.getToken(LaTeXParser.FUNC_OVERLINE, 0)
def mp(self):
return self.getTypedRuleContext(LaTeXParser.MpContext,0)
def FUNC_SUM(self):
return self.getToken(LaTeXParser.FUNC_SUM, 0)
def FUNC_PROD(self):
return self.getToken(LaTeXParser.FUNC_PROD, 0)
def subeq(self):
return self.getTypedRuleContext(LaTeXParser.SubeqContext,0)
def FUNC_LIM(self):
return self.getToken(LaTeXParser.FUNC_LIM, 0)
def limit_sub(self):
return self.getTypedRuleContext(LaTeXParser.Limit_subContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_func
def func(self):
localctx = LaTeXParser.FuncContext(self, self._ctx, self.state)
self.enterRule(localctx, 64, self.RULE_func)
self._la = 0 # Token type
try:
self.state = 460
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58]:
self.enterOuterAlt(localctx, 1)
self.state = 371
self.func_normal()
self.state = 384
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,40,self._ctx)
if la_ == 1:
self.state = 373
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==73:
self.state = 372
self.subexpr()
self.state = 376
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==74:
self.state = 375
self.supexpr()
pass
elif la_ == 2:
self.state = 379
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==74:
self.state = 378
self.supexpr()
self.state = 382
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==73:
self.state = 381
self.subexpr()
pass
self.state = 391
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,41,self._ctx)
if la_ == 1:
self.state = 386
self.match(LaTeXParser.L_PAREN)
self.state = 387
self.func_arg()
self.state = 388
self.match(LaTeXParser.R_PAREN)
pass
elif la_ == 2:
self.state = 390
self.func_arg_noparens()
pass
pass
elif token in [77, 91]:
self.enterOuterAlt(localctx, 2)
self.state = 393
_la = self._input.LA(1)
if not(_la==77 or _la==91):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 406
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,46,self._ctx)
if la_ == 1:
self.state = 395
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==73:
self.state = 394
self.subexpr()
self.state = 398
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==90:
self.state = 397
self.match(LaTeXParser.SINGLE_QUOTES)
pass
elif la_ == 2:
self.state = 401
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==90:
self.state = 400
self.match(LaTeXParser.SINGLE_QUOTES)
self.state = 404
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==73:
self.state = 403
self.subexpr()
pass
self.state = 408
self.match(LaTeXParser.L_PAREN)
self.state = 409
self.args()
self.state = 410
self.match(LaTeXParser.R_PAREN)
pass
elif token in [34]:
self.enterOuterAlt(localctx, 3)
self.state = 412
self.match(LaTeXParser.FUNC_INT)
self.state = 419
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [73]:
self.state = 413
self.subexpr()
self.state = 414
self.supexpr()
pass
elif token in [74]:
self.state = 416
self.supexpr()
self.state = 417
self.subexpr()
pass
elif token in [15, 16, 19, 21, 23, 25, 27, 29, 30, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 63, 64, 68, 69, 70, 71, 72, 76, 77, 78, 91]:
pass
else:
pass
self.state = 427
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,49,self._ctx)
if la_ == 1:
self.state = 422
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,48,self._ctx)
if la_ == 1:
self.state = 421
self.additive(0)
self.state = 424
self.match(LaTeXParser.DIFFERENTIAL)
pass
elif la_ == 2:
self.state = 425
self.frac()
pass
elif la_ == 3:
self.state = 426
self.additive(0)
pass
pass
elif token in [63]:
self.enterOuterAlt(localctx, 4)
self.state = 429
self.match(LaTeXParser.FUNC_SQRT)
self.state = 434
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==25:
self.state = 430
self.match(LaTeXParser.L_BRACKET)
self.state = 431
localctx.root = self.expr()
self.state = 432
self.match(LaTeXParser.R_BRACKET)
self.state = 436
self.match(LaTeXParser.L_BRACE)
self.state = 437
localctx.base = self.expr()
self.state = 438
self.match(LaTeXParser.R_BRACE)
pass
elif token in [64]:
self.enterOuterAlt(localctx, 5)
self.state = 440
self.match(LaTeXParser.FUNC_OVERLINE)
self.state = 441
self.match(LaTeXParser.L_BRACE)
self.state = 442
localctx.base = self.expr()
self.state = 443
self.match(LaTeXParser.R_BRACE)
pass
elif token in [35, 36]:
self.enterOuterAlt(localctx, 6)
self.state = 445
_la = self._input.LA(1)
if not(_la==35 or _la==36):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 452
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [73]:
self.state = 446
self.subeq()
self.state = 447
self.supexpr()
pass
elif token in [74]:
self.state = 449
self.supexpr()
self.state = 450
self.subeq()
pass
else:
raise NoViableAltException(self)
self.state = 454
self.mp(0)
pass
elif token in [32]:
self.enterOuterAlt(localctx, 7)
self.state = 456
self.match(LaTeXParser.FUNC_LIM)
self.state = 457
self.limit_sub()
self.state = 458
self.mp(0)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class ArgsContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def args(self):
return self.getTypedRuleContext(LaTeXParser.ArgsContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_args
def args(self):
localctx = LaTeXParser.ArgsContext(self, self._ctx, self.state)
self.enterRule(localctx, 66, self.RULE_args)
try:
self.state = 467
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,53,self._ctx)
if la_ == 1:
self.enterOuterAlt(localctx, 1)
self.state = 462
self.expr()
self.state = 463
self.match(LaTeXParser.T__0)
self.state = 464
self.args()
pass
elif la_ == 2:
self.enterOuterAlt(localctx, 2)
self.state = 466
self.expr()
pass
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Limit_subContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def UNDERSCORE(self):
return self.getToken(LaTeXParser.UNDERSCORE, 0)
def L_BRACE(self, i:int=None):
if i is None:
return self.getTokens(LaTeXParser.L_BRACE)
else:
return self.getToken(LaTeXParser.L_BRACE, i)
def LIM_APPROACH_SYM(self):
return self.getToken(LaTeXParser.LIM_APPROACH_SYM, 0)
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def R_BRACE(self, i:int=None):
if i is None:
return self.getTokens(LaTeXParser.R_BRACE)
else:
return self.getToken(LaTeXParser.R_BRACE, i)
def LETTER(self):
return self.getToken(LaTeXParser.LETTER, 0)
def SYMBOL(self):
return self.getToken(LaTeXParser.SYMBOL, 0)
def CARET(self):
return self.getToken(LaTeXParser.CARET, 0)
def ADD(self):
return self.getToken(LaTeXParser.ADD, 0)
def SUB(self):
return self.getToken(LaTeXParser.SUB, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_limit_sub
def limit_sub(self):
localctx = LaTeXParser.Limit_subContext(self, self._ctx, self.state)
self.enterRule(localctx, 68, self.RULE_limit_sub)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 469
self.match(LaTeXParser.UNDERSCORE)
self.state = 470
self.match(LaTeXParser.L_BRACE)
self.state = 471
_la = self._input.LA(1)
if not(_la==77 or _la==91):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 472
self.match(LaTeXParser.LIM_APPROACH_SYM)
self.state = 473
self.expr()
self.state = 482
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==74:
self.state = 474
self.match(LaTeXParser.CARET)
self.state = 480
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [21]:
self.state = 475
self.match(LaTeXParser.L_BRACE)
self.state = 476
_la = self._input.LA(1)
if not(_la==15 or _la==16):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 477
self.match(LaTeXParser.R_BRACE)
pass
elif token in [15]:
self.state = 478
self.match(LaTeXParser.ADD)
pass
elif token in [16]:
self.state = 479
self.match(LaTeXParser.SUB)
pass
else:
raise NoViableAltException(self)
self.state = 484
self.match(LaTeXParser.R_BRACE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Func_argContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def func_arg(self):
return self.getTypedRuleContext(LaTeXParser.Func_argContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_func_arg
def func_arg(self):
localctx = LaTeXParser.Func_argContext(self, self._ctx, self.state)
self.enterRule(localctx, 70, self.RULE_func_arg)
try:
self.state = 491
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,56,self._ctx)
if la_ == 1:
self.enterOuterAlt(localctx, 1)
self.state = 486
self.expr()
pass
elif la_ == 2:
self.enterOuterAlt(localctx, 2)
self.state = 487
self.expr()
self.state = 488
self.match(LaTeXParser.T__0)
self.state = 489
self.func_arg()
pass
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Func_arg_noparensContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def mp_nofunc(self):
return self.getTypedRuleContext(LaTeXParser.Mp_nofuncContext,0)
def getRuleIndex(self):
return LaTeXParser.RULE_func_arg_noparens
def func_arg_noparens(self):
localctx = LaTeXParser.Func_arg_noparensContext(self, self._ctx, self.state)
self.enterRule(localctx, 72, self.RULE_func_arg_noparens)
try:
self.enterOuterAlt(localctx, 1)
self.state = 493
self.mp_nofunc(0)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class SubexprContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def UNDERSCORE(self):
return self.getToken(LaTeXParser.UNDERSCORE, 0)
def atom(self):
return self.getTypedRuleContext(LaTeXParser.AtomContext,0)
def L_BRACE(self):
return self.getToken(LaTeXParser.L_BRACE, 0)
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def R_BRACE(self):
return self.getToken(LaTeXParser.R_BRACE, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_subexpr
def subexpr(self):
localctx = LaTeXParser.SubexprContext(self, self._ctx, self.state)
self.enterRule(localctx, 74, self.RULE_subexpr)
try:
self.enterOuterAlt(localctx, 1)
self.state = 495
self.match(LaTeXParser.UNDERSCORE)
self.state = 501
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [27, 29, 30, 68, 69, 70, 71, 72, 76, 77, 78, 91]:
self.state = 496
self.atom()
pass
elif token in [21]:
self.state = 497
self.match(LaTeXParser.L_BRACE)
self.state = 498
self.expr()
self.state = 499
self.match(LaTeXParser.R_BRACE)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class SupexprContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def CARET(self):
return self.getToken(LaTeXParser.CARET, 0)
def atom(self):
return self.getTypedRuleContext(LaTeXParser.AtomContext,0)
def L_BRACE(self):
return self.getToken(LaTeXParser.L_BRACE, 0)
def expr(self):
return self.getTypedRuleContext(LaTeXParser.ExprContext,0)
def R_BRACE(self):
return self.getToken(LaTeXParser.R_BRACE, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_supexpr
def supexpr(self):
localctx = LaTeXParser.SupexprContext(self, self._ctx, self.state)
self.enterRule(localctx, 76, self.RULE_supexpr)
try:
self.enterOuterAlt(localctx, 1)
self.state = 503
self.match(LaTeXParser.CARET)
self.state = 509
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [27, 29, 30, 68, 69, 70, 71, 72, 76, 77, 78, 91]:
self.state = 504
self.atom()
pass
elif token in [21]:
self.state = 505
self.match(LaTeXParser.L_BRACE)
self.state = 506
self.expr()
self.state = 507
self.match(LaTeXParser.R_BRACE)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class SubeqContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def UNDERSCORE(self):
return self.getToken(LaTeXParser.UNDERSCORE, 0)
def L_BRACE(self):
return self.getToken(LaTeXParser.L_BRACE, 0)
def equality(self):
return self.getTypedRuleContext(LaTeXParser.EqualityContext,0)
def R_BRACE(self):
return self.getToken(LaTeXParser.R_BRACE, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_subeq
def subeq(self):
localctx = LaTeXParser.SubeqContext(self, self._ctx, self.state)
self.enterRule(localctx, 78, self.RULE_subeq)
try:
self.enterOuterAlt(localctx, 1)
self.state = 511
self.match(LaTeXParser.UNDERSCORE)
self.state = 512
self.match(LaTeXParser.L_BRACE)
self.state = 513
self.equality()
self.state = 514
self.match(LaTeXParser.R_BRACE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class SupeqContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def UNDERSCORE(self):
return self.getToken(LaTeXParser.UNDERSCORE, 0)
def L_BRACE(self):
return self.getToken(LaTeXParser.L_BRACE, 0)
def equality(self):
return self.getTypedRuleContext(LaTeXParser.EqualityContext,0)
def R_BRACE(self):
return self.getToken(LaTeXParser.R_BRACE, 0)
def getRuleIndex(self):
return LaTeXParser.RULE_supeq
def supeq(self):
localctx = LaTeXParser.SupeqContext(self, self._ctx, self.state)
self.enterRule(localctx, 80, self.RULE_supeq)
try:
self.enterOuterAlt(localctx, 1)
self.state = 516
self.match(LaTeXParser.UNDERSCORE)
self.state = 517
self.match(LaTeXParser.L_BRACE)
self.state = 518
self.equality()
self.state = 519
self.match(LaTeXParser.R_BRACE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int):
if self._predicates == None:
self._predicates = dict()
self._predicates[1] = self.relation_sempred
self._predicates[4] = self.additive_sempred
self._predicates[5] = self.mp_sempred
self._predicates[6] = self.mp_nofunc_sempred
self._predicates[15] = self.exp_sempred
self._predicates[16] = self.exp_nofunc_sempred
pred = self._predicates.get(ruleIndex, None)
if pred is None:
raise Exception("No predicate with index:" + str(ruleIndex))
else:
return pred(localctx, predIndex)
def relation_sempred(self, localctx:RelationContext, predIndex:int):
if predIndex == 0:
return self.precpred(self._ctx, 2)
def additive_sempred(self, localctx:AdditiveContext, predIndex:int):
if predIndex == 1:
return self.precpred(self._ctx, 2)
def mp_sempred(self, localctx:MpContext, predIndex:int):
if predIndex == 2:
return self.precpred(self._ctx, 2)
def mp_nofunc_sempred(self, localctx:Mp_nofuncContext, predIndex:int):
if predIndex == 3:
return self.precpred(self._ctx, 2)
def exp_sempred(self, localctx:ExpContext, predIndex:int):
if predIndex == 4:
return self.precpred(self._ctx, 2)
def exp_nofunc_sempred(self, localctx:Exp_nofuncContext, predIndex:int):
if predIndex == 5:
return self.precpred(self._ctx, 2)