# Generated from Modelica.g4 by ANTLR 4.13.1
# encoding: utf-8
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,92,962,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,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,
        7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,
        2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,59,
        7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,2,64,7,64,2,65,7,65,
        2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2,70,7,70,2,71,7,71,2,72,
        7,72,2,73,7,73,2,74,7,74,2,75,7,75,1,0,1,0,3,0,155,8,0,1,0,3,0,158,
        8,0,1,0,5,0,161,8,0,10,0,12,0,164,9,0,1,1,3,1,167,8,1,1,1,1,1,1,
        1,1,2,3,2,173,8,2,1,2,1,2,1,2,1,3,3,3,179,8,3,1,3,1,3,1,4,1,4,1,
        4,3,4,186,8,4,1,4,1,4,1,4,3,4,191,8,4,1,4,1,4,1,4,1,4,3,4,197,8,
        4,1,4,3,4,200,8,4,1,4,1,4,3,4,204,8,4,1,5,1,5,1,5,1,5,1,5,1,5,1,
        5,1,5,1,5,1,5,1,5,3,5,217,8,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,226,
        8,5,1,5,3,5,229,8,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,
        5,5,242,8,5,10,5,12,5,245,9,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,253,8,
        5,1,5,1,5,1,5,1,5,1,5,3,5,260,8,5,1,6,1,6,1,7,1,7,1,7,5,7,267,8,
        7,10,7,12,7,270,9,7,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,5,9,
        282,8,9,10,9,12,9,285,9,9,1,9,1,9,3,9,289,8,9,1,9,3,9,292,8,9,1,
        9,3,9,295,8,9,1,9,3,9,298,8,9,1,9,1,9,1,9,3,9,303,8,9,1,10,1,10,
        1,11,1,11,1,11,3,11,310,8,11,1,11,1,11,1,11,3,11,315,8,11,1,11,1,
        11,1,12,1,12,1,12,5,12,322,8,12,10,12,12,12,325,9,12,1,13,1,13,1,
        13,1,13,3,13,331,8,13,1,14,3,14,334,8,14,1,14,3,14,337,8,14,1,14,
        3,14,340,8,14,1,14,3,14,343,8,14,1,14,1,14,3,14,347,8,14,1,15,3,
        15,350,8,15,1,15,3,15,353,8,15,1,15,3,15,356,8,15,1,15,3,15,359,
        8,15,1,15,1,15,1,15,3,15,364,8,15,1,15,1,15,1,15,3,15,369,8,15,1,
        16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,3,16,382,8,
        16,3,16,384,8,16,3,16,386,8,16,1,16,1,16,1,17,1,17,1,17,5,17,393,
        8,17,10,17,12,17,396,9,17,1,18,1,18,1,18,3,18,401,8,18,1,18,3,18,
        404,8,18,1,19,1,19,1,19,3,19,409,8,19,1,20,1,20,1,20,3,20,414,8,
        20,1,20,1,20,1,21,3,21,419,8,21,1,21,3,21,422,8,21,1,21,3,21,425,
        8,21,1,22,1,22,1,23,1,23,1,23,5,23,432,8,23,10,23,12,23,435,9,23,
        1,24,1,24,1,24,5,24,440,8,24,10,24,12,24,443,9,24,1,25,1,25,3,25,
        447,8,25,1,25,1,25,1,26,1,26,1,26,1,27,1,27,3,27,456,8,27,1,27,3,
        27,459,8,27,1,28,1,28,1,28,3,28,464,8,28,1,28,1,28,1,28,1,28,3,28,
        470,8,28,1,29,1,29,3,29,474,8,29,1,29,1,29,1,30,1,30,1,30,5,30,481,
        8,30,10,30,12,30,484,9,30,1,31,1,31,3,31,488,8,31,1,32,3,32,491,
        8,32,1,32,3,32,494,8,32,1,32,1,32,3,32,498,8,32,1,33,1,33,3,33,502,
        8,33,1,33,1,33,1,34,1,34,3,34,508,8,34,1,34,3,34,511,8,34,1,34,1,
        34,3,34,515,8,34,1,34,3,34,518,8,34,1,35,1,35,1,35,3,35,523,8,35,
        1,35,3,35,526,8,35,1,36,1,36,1,36,1,36,1,37,1,37,1,37,1,38,1,38,
        1,38,1,38,1,38,1,38,3,38,541,8,38,1,38,3,38,544,8,38,1,38,1,38,1,
        38,1,38,1,38,3,38,551,8,38,1,38,3,38,554,8,38,1,38,1,38,3,38,558,
        8,38,1,39,1,39,1,39,5,39,563,8,39,10,39,12,39,566,9,39,1,40,3,40,
        569,8,40,1,40,1,40,1,40,1,41,1,41,1,41,5,41,577,8,41,10,41,12,41,
        580,9,41,1,42,3,42,583,8,42,1,42,1,42,1,42,1,43,1,43,1,43,1,43,1,
        43,1,43,1,43,1,43,1,43,1,43,1,43,3,43,599,8,43,1,44,1,44,1,44,1,
        45,1,45,1,45,1,45,3,45,608,8,45,1,45,1,45,1,45,1,45,5,45,614,8,45,
        10,45,12,45,617,9,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,
        1,45,1,45,3,45,630,8,45,1,46,1,46,1,46,1,47,1,47,1,47,1,47,1,47,
        1,47,1,47,1,47,1,47,5,47,644,8,47,10,47,12,47,647,9,47,1,47,1,47,
        3,47,651,8,47,1,47,1,47,1,47,1,48,1,48,1,48,1,48,1,48,1,48,1,48,
        1,48,1,48,5,48,665,8,48,10,48,12,48,668,9,48,1,48,1,48,3,48,672,
        8,48,1,48,1,48,1,48,1,49,1,49,1,49,1,49,1,49,1,49,1,49,1,50,1,50,
        1,50,1,50,1,50,1,50,1,50,1,51,1,51,1,51,5,51,694,8,51,10,51,12,51,
        697,9,51,1,52,1,52,1,52,3,52,702,8,52,1,53,1,53,1,53,1,53,1,53,1,
        53,1,53,1,54,1,54,1,54,1,54,1,54,1,54,1,54,1,54,1,54,5,54,720,8,
        54,10,54,12,54,723,9,54,1,54,1,54,1,54,1,55,1,55,1,55,1,55,1,55,
        1,55,1,55,1,55,1,55,5,55,737,8,55,10,55,12,55,740,9,55,1,55,1,55,
        1,55,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,57,1,57,1,57,1,57,1,57,
        1,57,1,57,1,57,1,57,1,57,5,57,762,8,57,10,57,12,57,765,9,57,1,57,
        1,57,1,57,3,57,770,8,57,1,58,1,58,1,58,1,58,1,58,3,58,777,8,58,3,
        58,779,8,58,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,3,
        59,791,8,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,
        59,1,59,1,59,1,59,1,59,5,59,808,8,59,10,59,12,59,811,9,59,1,60,1,
        60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,
        60,1,60,1,60,1,60,1,60,1,60,5,60,833,8,60,10,60,12,60,836,9,60,1,
        60,1,60,1,60,1,60,1,60,1,60,1,60,3,60,845,8,60,1,61,3,61,848,8,61,
        1,61,1,61,1,61,5,61,853,8,61,10,61,12,61,856,9,61,1,62,1,62,3,62,
        860,8,62,1,63,1,63,1,63,5,63,865,8,63,10,63,12,63,868,9,63,1,64,
        1,64,3,64,872,8,64,1,64,1,64,1,65,1,65,1,65,1,65,1,65,5,65,881,8,
        65,10,65,12,65,884,9,65,1,65,3,65,887,8,65,1,66,1,66,1,66,5,66,892,
        8,66,10,66,12,66,895,9,66,1,67,1,67,1,67,1,67,1,68,1,68,1,68,1,68,
        3,68,905,8,68,1,68,1,68,1,68,3,68,910,8,68,1,69,3,69,913,8,69,1,
        69,1,69,5,69,917,8,69,10,69,12,69,920,9,69,1,70,1,70,1,70,5,70,925,
        8,70,10,70,12,70,928,9,70,1,71,1,71,1,71,1,71,5,71,934,8,71,10,71,
        12,71,937,9,71,1,71,1,71,1,72,1,72,3,72,943,8,72,1,73,1,73,3,73,
        947,8,73,1,74,1,74,1,74,5,74,952,8,74,10,74,12,74,955,9,74,3,74,
        957,8,74,1,75,1,75,1,75,1,75,0,1,118,76,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,82,84,86,88,90,92,94,96,98,100,102,104,
        106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,
        138,140,142,144,146,148,150,0,8,1,0,11,12,1,0,33,34,1,0,35,37,1,
        0,38,39,1,0,57,58,2,0,29,29,59,61,2,0,56,56,62,64,1,0,65,70,1045,
        0,157,1,0,0,0,2,166,1,0,0,0,4,172,1,0,0,0,6,178,1,0,0,0,8,203,1,
        0,0,0,10,259,1,0,0,0,12,261,1,0,0,0,14,263,1,0,0,0,16,271,1,0,0,
        0,18,274,1,0,0,0,20,304,1,0,0,0,22,309,1,0,0,0,24,323,1,0,0,0,26,
        330,1,0,0,0,28,333,1,0,0,0,30,349,1,0,0,0,32,370,1,0,0,0,34,389,
        1,0,0,0,36,397,1,0,0,0,38,405,1,0,0,0,40,410,1,0,0,0,42,418,1,0,
        0,0,44,426,1,0,0,0,46,428,1,0,0,0,48,436,1,0,0,0,50,444,1,0,0,0,
        52,450,1,0,0,0,54,453,1,0,0,0,56,469,1,0,0,0,58,471,1,0,0,0,60,477,
        1,0,0,0,62,487,1,0,0,0,64,490,1,0,0,0,66,499,1,0,0,0,68,505,1,0,
        0,0,70,519,1,0,0,0,72,527,1,0,0,0,74,531,1,0,0,0,76,534,1,0,0,0,
        78,564,1,0,0,0,80,568,1,0,0,0,82,578,1,0,0,0,84,582,1,0,0,0,86,598,
        1,0,0,0,88,600,1,0,0,0,90,629,1,0,0,0,92,631,1,0,0,0,94,634,1,0,
        0,0,96,655,1,0,0,0,98,676,1,0,0,0,100,683,1,0,0,0,102,690,1,0,0,
        0,104,698,1,0,0,0,106,703,1,0,0,0,108,710,1,0,0,0,110,727,1,0,0,
        0,112,744,1,0,0,0,114,769,1,0,0,0,116,771,1,0,0,0,118,790,1,0,0,
        0,120,844,1,0,0,0,122,847,1,0,0,0,124,857,1,0,0,0,126,861,1,0,0,
        0,128,869,1,0,0,0,130,886,1,0,0,0,132,888,1,0,0,0,134,896,1,0,0,
        0,136,909,1,0,0,0,138,912,1,0,0,0,140,921,1,0,0,0,142,929,1,0,0,
        0,144,942,1,0,0,0,146,944,1,0,0,0,148,956,1,0,0,0,150,958,1,0,0,
        0,152,154,5,82,0,0,153,155,3,126,63,0,154,153,1,0,0,0,154,155,1,
        0,0,0,155,156,1,0,0,0,156,158,5,1,0,0,157,152,1,0,0,0,157,158,1,
        0,0,0,158,162,1,0,0,0,159,161,3,2,1,0,160,159,1,0,0,0,161,164,1,
        0,0,0,162,160,1,0,0,0,162,163,1,0,0,0,163,1,1,0,0,0,164,162,1,0,
        0,0,165,167,5,81,0,0,166,165,1,0,0,0,166,167,1,0,0,0,167,168,1,0,
        0,0,168,169,3,4,2,0,169,170,5,1,0,0,170,3,1,0,0,0,171,173,5,83,0,
        0,172,171,1,0,0,0,172,173,1,0,0,0,173,174,1,0,0,0,174,175,3,6,3,
        0,175,176,3,10,5,0,176,5,1,0,0,0,177,179,5,80,0,0,178,177,1,0,0,
        0,178,179,1,0,0,0,179,180,1,0,0,0,180,181,3,8,4,0,181,7,1,0,0,0,
        182,204,5,2,0,0,183,204,5,3,0,0,184,186,5,4,0,0,185,184,1,0,0,0,
        185,186,1,0,0,0,186,187,1,0,0,0,187,204,5,5,0,0,188,204,5,6,0,0,
        189,191,5,7,0,0,190,189,1,0,0,0,190,191,1,0,0,0,191,192,1,0,0,0,
        192,204,5,8,0,0,193,204,5,9,0,0,194,204,5,10,0,0,195,197,7,0,0,0,
        196,195,1,0,0,0,196,197,1,0,0,0,197,199,1,0,0,0,198,200,5,4,0,0,
        199,198,1,0,0,0,199,200,1,0,0,0,200,201,1,0,0,0,201,204,5,13,0,0,
        202,204,5,4,0,0,203,182,1,0,0,0,203,183,1,0,0,0,203,185,1,0,0,0,
        203,188,1,0,0,0,203,190,1,0,0,0,203,193,1,0,0,0,203,194,1,0,0,0,
        203,196,1,0,0,0,203,202,1,0,0,0,204,9,1,0,0,0,205,206,5,88,0,0,206,
        207,3,148,74,0,207,208,3,18,9,0,208,209,5,14,0,0,209,210,5,88,0,
        0,210,260,1,0,0,0,211,212,5,88,0,0,212,213,5,15,0,0,213,214,3,12,
        6,0,214,216,3,126,63,0,215,217,3,58,29,0,216,215,1,0,0,0,216,217,
        1,0,0,0,217,218,1,0,0,0,218,219,3,146,73,0,219,260,1,0,0,0,220,221,
        5,88,0,0,221,222,5,15,0,0,222,223,5,16,0,0,223,228,5,17,0,0,224,
        226,3,14,7,0,225,224,1,0,0,0,225,226,1,0,0,0,226,229,1,0,0,0,227,
        229,5,18,0,0,228,225,1,0,0,0,228,227,1,0,0,0,229,230,1,0,0,0,230,
        231,5,19,0,0,231,260,3,146,73,0,232,233,5,88,0,0,233,234,5,15,0,
        0,234,235,5,20,0,0,235,236,5,17,0,0,236,237,3,122,61,0,237,238,5,
        21,0,0,238,243,5,88,0,0,239,240,5,21,0,0,240,242,5,88,0,0,241,239,
        1,0,0,0,242,245,1,0,0,0,243,241,1,0,0,0,243,244,1,0,0,0,244,246,
        1,0,0,0,245,243,1,0,0,0,246,247,5,19,0,0,247,248,3,146,73,0,248,
        260,1,0,0,0,249,250,5,22,0,0,250,252,5,88,0,0,251,253,3,58,29,0,
        252,251,1,0,0,0,252,253,1,0,0,0,253,254,1,0,0,0,254,255,3,148,74,
        0,255,256,3,18,9,0,256,257,5,14,0,0,257,258,5,88,0,0,258,260,1,0,
        0,0,259,205,1,0,0,0,259,211,1,0,0,0,259,220,1,0,0,0,259,232,1,0,
        0,0,259,249,1,0,0,0,260,11,1,0,0,0,261,262,3,42,21,0,262,13,1,0,
        0,0,263,268,3,16,8,0,264,265,5,21,0,0,265,267,3,16,8,0,266,264,1,
        0,0,0,267,270,1,0,0,0,268,266,1,0,0,0,268,269,1,0,0,0,269,15,1,0,
        0,0,270,268,1,0,0,0,271,272,5,88,0,0,272,273,3,146,73,0,273,17,1,
        0,0,0,274,283,3,24,12,0,275,276,5,23,0,0,276,282,3,24,12,0,277,278,
        5,24,0,0,278,282,3,24,12,0,279,282,3,80,40,0,280,282,3,84,42,0,281,
        275,1,0,0,0,281,277,1,0,0,0,281,279,1,0,0,0,281,280,1,0,0,0,282,
        285,1,0,0,0,283,281,1,0,0,0,283,284,1,0,0,0,284,297,1,0,0,0,285,
        283,1,0,0,0,286,288,5,25,0,0,287,289,3,20,10,0,288,287,1,0,0,0,288,
        289,1,0,0,0,289,291,1,0,0,0,290,292,3,22,11,0,291,290,1,0,0,0,291,
        292,1,0,0,0,292,294,1,0,0,0,293,295,3,150,75,0,294,293,1,0,0,0,294,
        295,1,0,0,0,295,296,1,0,0,0,296,298,5,1,0,0,297,286,1,0,0,0,297,
        298,1,0,0,0,298,302,1,0,0,0,299,300,3,150,75,0,300,301,5,1,0,0,301,
        303,1,0,0,0,302,299,1,0,0,0,302,303,1,0,0,0,303,19,1,0,0,0,304,305,
        5,89,0,0,305,21,1,0,0,0,306,307,3,126,63,0,307,308,5,15,0,0,308,
        310,1,0,0,0,309,306,1,0,0,0,309,310,1,0,0,0,310,311,1,0,0,0,311,
        312,5,88,0,0,312,314,5,17,0,0,313,315,3,140,70,0,314,313,1,0,0,0,
        314,315,1,0,0,0,315,316,1,0,0,0,316,317,5,19,0,0,317,23,1,0,0,0,
        318,319,3,26,13,0,319,320,5,1,0,0,320,322,1,0,0,0,321,318,1,0,0,
        0,322,325,1,0,0,0,323,321,1,0,0,0,323,324,1,0,0,0,324,25,1,0,0,0,
        325,323,1,0,0,0,326,331,3,32,16,0,327,331,3,36,18,0,328,331,3,28,
        14,0,329,331,3,30,15,0,330,326,1,0,0,0,330,327,1,0,0,0,330,328,1,
        0,0,0,330,329,1,0,0,0,331,27,1,0,0,0,332,334,5,84,0,0,333,332,1,
        0,0,0,333,334,1,0,0,0,334,336,1,0,0,0,335,337,5,81,0,0,336,335,1,
        0,0,0,336,337,1,0,0,0,337,339,1,0,0,0,338,340,5,85,0,0,339,338,1,
        0,0,0,339,340,1,0,0,0,340,342,1,0,0,0,341,343,5,86,0,0,342,341,1,
        0,0,0,342,343,1,0,0,0,343,346,1,0,0,0,344,347,3,4,2,0,345,347,3,
        40,20,0,346,344,1,0,0,0,346,345,1,0,0,0,347,29,1,0,0,0,348,350,5,
        84,0,0,349,348,1,0,0,0,349,350,1,0,0,0,350,352,1,0,0,0,351,353,5,
        81,0,0,352,351,1,0,0,0,352,353,1,0,0,0,353,355,1,0,0,0,354,356,5,
        85,0,0,355,354,1,0,0,0,355,356,1,0,0,0,356,358,1,0,0,0,357,359,5,
        86,0,0,358,357,1,0,0,0,358,359,1,0,0,0,359,360,1,0,0,0,360,363,5,
        26,0,0,361,364,3,4,2,0,362,364,3,40,20,0,363,361,1,0,0,0,363,362,
        1,0,0,0,364,368,1,0,0,0,365,366,3,38,19,0,366,367,3,146,73,0,367,
        369,1,0,0,0,368,365,1,0,0,0,368,369,1,0,0,0,369,31,1,0,0,0,370,385,
        5,27,0,0,371,372,5,88,0,0,372,373,5,15,0,0,373,386,3,126,63,0,374,
        383,3,126,63,0,375,381,5,28,0,0,376,382,5,29,0,0,377,378,5,30,0,
        0,378,379,3,34,17,0,379,380,5,31,0,0,380,382,1,0,0,0,381,376,1,0,
        0,0,381,377,1,0,0,0,382,384,1,0,0,0,383,375,1,0,0,0,383,384,1,0,
        0,0,384,386,1,0,0,0,385,371,1,0,0,0,385,374,1,0,0,0,386,387,1,0,
        0,0,387,388,3,146,73,0,388,33,1,0,0,0,389,394,5,88,0,0,390,391,5,
        21,0,0,391,393,3,34,17,0,392,390,1,0,0,0,393,396,1,0,0,0,394,392,
        1,0,0,0,394,395,1,0,0,0,395,35,1,0,0,0,396,394,1,0,0,0,397,398,5,
        22,0,0,398,400,3,126,63,0,399,401,3,58,29,0,400,399,1,0,0,0,400,
        401,1,0,0,0,401,403,1,0,0,0,402,404,3,150,75,0,403,402,1,0,0,0,403,
        404,1,0,0,0,404,37,1,0,0,0,405,406,5,32,0,0,406,408,3,122,61,0,407,
        409,3,58,29,0,408,407,1,0,0,0,408,409,1,0,0,0,409,39,1,0,0,0,410,
        411,3,42,21,0,411,413,3,46,23,0,412,414,3,142,71,0,413,412,1,0,0,
        0,413,414,1,0,0,0,414,415,1,0,0,0,415,416,3,48,24,0,416,41,1,0,0,
        0,417,419,7,1,0,0,418,417,1,0,0,0,418,419,1,0,0,0,419,421,1,0,0,
        0,420,422,7,2,0,0,421,420,1,0,0,0,421,422,1,0,0,0,422,424,1,0,0,
        0,423,425,7,3,0,0,424,423,1,0,0,0,424,425,1,0,0,0,425,43,1,0,0,0,
        426,427,5,88,0,0,427,45,1,0,0,0,428,433,3,44,22,0,429,430,5,28,0,
        0,430,432,3,44,22,0,431,429,1,0,0,0,432,435,1,0,0,0,433,431,1,0,
        0,0,433,434,1,0,0,0,434,47,1,0,0,0,435,433,1,0,0,0,436,441,3,50,
        25,0,437,438,5,21,0,0,438,440,3,50,25,0,439,437,1,0,0,0,440,443,
        1,0,0,0,441,439,1,0,0,0,441,442,1,0,0,0,442,49,1,0,0,0,443,441,1,
        0,0,0,444,446,3,54,27,0,445,447,3,52,26,0,446,445,1,0,0,0,446,447,
        1,0,0,0,447,448,1,0,0,0,448,449,3,146,73,0,449,51,1,0,0,0,450,451,
        5,40,0,0,451,452,3,114,57,0,452,53,1,0,0,0,453,455,5,88,0,0,454,
        456,3,142,71,0,455,454,1,0,0,0,455,456,1,0,0,0,456,458,1,0,0,0,457,
        459,3,56,28,0,458,457,1,0,0,0,458,459,1,0,0,0,459,55,1,0,0,0,460,
        463,3,58,29,0,461,462,5,15,0,0,462,464,3,114,57,0,463,461,1,0,0,
        0,463,464,1,0,0,0,464,470,1,0,0,0,465,466,5,15,0,0,466,470,3,114,
        57,0,467,468,5,41,0,0,468,470,3,114,57,0,469,460,1,0,0,0,469,465,
        1,0,0,0,469,467,1,0,0,0,470,57,1,0,0,0,471,473,5,17,0,0,472,474,
        3,60,30,0,473,472,1,0,0,0,473,474,1,0,0,0,474,475,1,0,0,0,475,476,
        5,19,0,0,476,59,1,0,0,0,477,482,3,62,31,0,478,479,5,21,0,0,479,481,
        3,62,31,0,480,478,1,0,0,0,481,484,1,0,0,0,482,480,1,0,0,0,482,483,
        1,0,0,0,483,61,1,0,0,0,484,482,1,0,0,0,485,488,3,64,32,0,486,488,
        3,68,34,0,487,485,1,0,0,0,487,486,1,0,0,0,488,63,1,0,0,0,489,491,
        5,79,0,0,490,489,1,0,0,0,490,491,1,0,0,0,491,493,1,0,0,0,492,494,
        5,81,0,0,493,492,1,0,0,0,493,494,1,0,0,0,494,497,1,0,0,0,495,498,
        3,66,33,0,496,498,3,70,35,0,497,495,1,0,0,0,497,496,1,0,0,0,498,
        65,1,0,0,0,499,501,3,126,63,0,500,502,3,56,28,0,501,500,1,0,0,0,
        501,502,1,0,0,0,502,503,1,0,0,0,503,504,3,148,74,0,504,67,1,0,0,
        0,505,507,5,84,0,0,506,508,5,79,0,0,507,506,1,0,0,0,507,508,1,0,
        0,0,508,510,1,0,0,0,509,511,5,81,0,0,510,509,1,0,0,0,510,511,1,0,
        0,0,511,517,1,0,0,0,512,515,3,76,38,0,513,515,3,72,36,0,514,512,
        1,0,0,0,514,513,1,0,0,0,515,518,1,0,0,0,516,518,3,70,35,0,517,514,
        1,0,0,0,517,516,1,0,0,0,518,69,1,0,0,0,519,522,5,26,0,0,520,523,
        3,76,38,0,521,523,3,72,36,0,522,520,1,0,0,0,522,521,1,0,0,0,523,
        525,1,0,0,0,524,526,3,38,19,0,525,524,1,0,0,0,525,526,1,0,0,0,526,
        71,1,0,0,0,527,528,3,42,21,0,528,529,3,46,23,0,529,530,3,74,37,0,
        530,73,1,0,0,0,531,532,3,54,27,0,532,533,3,146,73,0,533,75,1,0,0,
        0,534,535,3,6,3,0,535,536,5,88,0,0,536,557,5,15,0,0,537,538,3,12,
        6,0,538,540,3,126,63,0,539,541,3,142,71,0,540,539,1,0,0,0,540,541,
        1,0,0,0,541,543,1,0,0,0,542,544,3,58,29,0,543,542,1,0,0,0,543,544,
        1,0,0,0,544,545,1,0,0,0,545,546,3,146,73,0,546,558,1,0,0,0,547,548,
        5,16,0,0,548,553,5,17,0,0,549,551,3,14,7,0,550,549,1,0,0,0,550,551,
        1,0,0,0,551,554,1,0,0,0,552,554,5,18,0,0,553,550,1,0,0,0,553,552,
        1,0,0,0,554,555,1,0,0,0,555,556,5,19,0,0,556,558,3,146,73,0,557,
        537,1,0,0,0,557,547,1,0,0,0,558,77,1,0,0,0,559,560,3,88,44,0,560,
        561,5,1,0,0,561,563,1,0,0,0,562,559,1,0,0,0,563,566,1,0,0,0,564,
        562,1,0,0,0,564,565,1,0,0,0,565,79,1,0,0,0,566,564,1,0,0,0,567,569,
        5,87,0,0,568,567,1,0,0,0,568,569,1,0,0,0,569,570,1,0,0,0,570,571,
        5,42,0,0,571,572,3,78,39,0,572,81,1,0,0,0,573,574,3,92,46,0,574,
        575,5,1,0,0,575,577,1,0,0,0,576,573,1,0,0,0,577,580,1,0,0,0,578,
        576,1,0,0,0,578,579,1,0,0,0,579,83,1,0,0,0,580,578,1,0,0,0,581,583,
        5,87,0,0,582,581,1,0,0,0,582,583,1,0,0,0,583,584,1,0,0,0,584,585,
        5,43,0,0,585,586,3,82,41,0,586,85,1,0,0,0,587,588,3,116,58,0,588,
        589,5,15,0,0,589,590,3,114,57,0,590,599,1,0,0,0,591,599,3,94,47,
        0,592,599,3,98,49,0,593,599,3,112,56,0,594,599,3,108,54,0,595,596,
        3,122,61,0,596,597,3,128,64,0,597,599,1,0,0,0,598,587,1,0,0,0,598,
        591,1,0,0,0,598,592,1,0,0,0,598,593,1,0,0,0,598,594,1,0,0,0,598,
        595,1,0,0,0,599,87,1,0,0,0,600,601,3,86,43,0,601,602,3,146,73,0,
        602,89,1,0,0,0,603,607,3,126,63,0,604,605,5,41,0,0,605,608,3,114,
        57,0,606,608,3,128,64,0,607,604,1,0,0,0,607,606,1,0,0,0,608,630,
        1,0,0,0,609,610,5,17,0,0,610,615,3,126,63,0,611,612,5,21,0,0,612,
        614,3,126,63,0,613,611,1,0,0,0,614,617,1,0,0,0,615,613,1,0,0,0,615,
        616,1,0,0,0,616,618,1,0,0,0,617,615,1,0,0,0,618,619,5,19,0,0,619,
        620,5,41,0,0,620,621,3,126,63,0,621,622,3,128,64,0,622,630,1,0,0,
        0,623,630,5,44,0,0,624,630,5,45,0,0,625,630,3,96,48,0,626,630,3,
        100,50,0,627,630,3,106,53,0,628,630,3,110,55,0,629,603,1,0,0,0,629,
        609,1,0,0,0,629,623,1,0,0,0,629,624,1,0,0,0,629,625,1,0,0,0,629,
        626,1,0,0,0,629,627,1,0,0,0,629,628,1,0,0,0,630,91,1,0,0,0,631,632,
        3,90,45,0,632,633,3,146,73,0,633,93,1,0,0,0,634,635,5,40,0,0,635,
        636,3,114,57,0,636,637,5,46,0,0,637,645,3,78,39,0,638,639,5,47,0,
        0,639,640,3,114,57,0,640,641,5,46,0,0,641,642,3,78,39,0,642,644,
        1,0,0,0,643,638,1,0,0,0,644,647,1,0,0,0,645,643,1,0,0,0,645,646,
        1,0,0,0,646,650,1,0,0,0,647,645,1,0,0,0,648,649,5,48,0,0,649,651,
        3,78,39,0,650,648,1,0,0,0,650,651,1,0,0,0,651,652,1,0,0,0,652,653,
        5,14,0,0,653,654,5,40,0,0,654,95,1,0,0,0,655,656,5,40,0,0,656,657,
        3,114,57,0,657,658,5,46,0,0,658,666,3,82,41,0,659,660,5,47,0,0,660,
        661,3,114,57,0,661,662,5,46,0,0,662,663,3,82,41,0,663,665,1,0,0,
        0,664,659,1,0,0,0,665,668,1,0,0,0,666,664,1,0,0,0,666,667,1,0,0,
        0,667,671,1,0,0,0,668,666,1,0,0,0,669,670,5,48,0,0,670,672,3,82,
        41,0,671,669,1,0,0,0,671,672,1,0,0,0,672,673,1,0,0,0,673,674,5,14,
        0,0,674,675,5,40,0,0,675,97,1,0,0,0,676,677,5,49,0,0,677,678,3,102,
        51,0,678,679,5,50,0,0,679,680,3,78,39,0,680,681,5,14,0,0,681,682,
        5,49,0,0,682,99,1,0,0,0,683,684,5,49,0,0,684,685,3,102,51,0,685,
        686,5,50,0,0,686,687,3,82,41,0,687,688,5,14,0,0,688,689,5,49,0,0,
        689,101,1,0,0,0,690,695,3,104,52,0,691,692,5,21,0,0,692,694,3,104,
        52,0,693,691,1,0,0,0,694,697,1,0,0,0,695,693,1,0,0,0,695,696,1,0,
        0,0,696,103,1,0,0,0,697,695,1,0,0,0,698,701,5,88,0,0,699,700,5,51,
        0,0,700,702,3,114,57,0,701,699,1,0,0,0,701,702,1,0,0,0,702,105,1,
        0,0,0,703,704,5,52,0,0,704,705,3,114,57,0,705,706,5,50,0,0,706,707,
        3,82,41,0,707,708,5,14,0,0,708,709,5,52,0,0,709,107,1,0,0,0,710,
        711,5,53,0,0,711,712,3,114,57,0,712,713,5,46,0,0,713,721,3,78,39,
        0,714,715,5,54,0,0,715,716,3,114,57,0,716,717,5,46,0,0,717,718,3,
        78,39,0,718,720,1,0,0,0,719,714,1,0,0,0,720,723,1,0,0,0,721,719,
        1,0,0,0,721,722,1,0,0,0,722,724,1,0,0,0,723,721,1,0,0,0,724,725,
        5,14,0,0,725,726,5,53,0,0,726,109,1,0,0,0,727,728,5,53,0,0,728,729,
        3,114,57,0,729,730,5,46,0,0,730,738,3,82,41,0,731,732,5,54,0,0,732,
        733,3,114,57,0,733,734,5,46,0,0,734,735,3,82,41,0,735,737,1,0,0,
        0,736,731,1,0,0,0,737,740,1,0,0,0,738,736,1,0,0,0,738,739,1,0,0,
        0,739,741,1,0,0,0,740,738,1,0,0,0,741,742,5,14,0,0,742,743,5,53,
        0,0,743,111,1,0,0,0,744,745,5,55,0,0,745,746,5,17,0,0,746,747,3,
        126,63,0,747,748,5,21,0,0,748,749,3,126,63,0,749,750,5,19,0,0,750,
        113,1,0,0,0,751,770,3,116,58,0,752,753,5,40,0,0,753,754,3,114,57,
        0,754,755,5,46,0,0,755,763,3,114,57,0,756,757,5,47,0,0,757,758,3,
        114,57,0,758,759,5,46,0,0,759,760,3,114,57,0,760,762,1,0,0,0,761,
        756,1,0,0,0,762,765,1,0,0,0,763,761,1,0,0,0,763,764,1,0,0,0,764,
        766,1,0,0,0,765,763,1,0,0,0,766,767,5,48,0,0,767,768,3,114,57,0,
        768,770,1,0,0,0,769,751,1,0,0,0,769,752,1,0,0,0,770,115,1,0,0,0,
        771,778,3,118,59,0,772,773,5,18,0,0,773,776,3,118,59,0,774,775,5,
        18,0,0,775,777,3,118,59,0,776,774,1,0,0,0,776,777,1,0,0,0,777,779,
        1,0,0,0,778,772,1,0,0,0,778,779,1,0,0,0,779,117,1,0,0,0,780,781,
        6,59,-1,0,781,782,5,56,0,0,782,791,3,118,59,9,783,784,3,120,60,0,
        784,785,7,4,0,0,785,786,3,120,60,0,786,791,1,0,0,0,787,788,5,71,
        0,0,788,791,3,118,59,4,789,791,3,120,60,0,790,780,1,0,0,0,790,783,
        1,0,0,0,790,787,1,0,0,0,790,789,1,0,0,0,791,809,1,0,0,0,792,793,
        10,7,0,0,793,794,7,5,0,0,794,808,3,118,59,8,795,796,10,6,0,0,796,
        797,7,6,0,0,797,808,3,118,59,7,798,799,10,5,0,0,799,800,7,7,0,0,
        800,808,3,118,59,6,801,802,10,3,0,0,802,803,5,72,0,0,803,808,3,118,
        59,4,804,805,10,2,0,0,805,806,5,73,0,0,806,808,3,118,59,3,807,792,
        1,0,0,0,807,795,1,0,0,0,807,798,1,0,0,0,807,801,1,0,0,0,807,804,
        1,0,0,0,808,811,1,0,0,0,809,807,1,0,0,0,809,810,1,0,0,0,810,119,
        1,0,0,0,811,809,1,0,0,0,812,845,5,90,0,0,813,845,5,89,0,0,814,845,
        5,74,0,0,815,845,5,75,0,0,816,817,3,126,63,0,817,818,3,128,64,0,
        818,845,1,0,0,0,819,820,5,20,0,0,820,845,3,128,64,0,821,822,5,87,
        0,0,822,845,3,128,64,0,823,845,3,126,63,0,824,825,5,17,0,0,825,826,
        3,138,69,0,826,827,5,19,0,0,827,845,1,0,0,0,828,829,5,76,0,0,829,
        834,3,140,70,0,830,831,5,1,0,0,831,833,3,140,70,0,832,830,1,0,0,
        0,833,836,1,0,0,0,834,832,1,0,0,0,834,835,1,0,0,0,835,837,1,0,0,
        0,836,834,1,0,0,0,837,838,5,77,0,0,838,845,1,0,0,0,839,840,5,30,
        0,0,840,841,3,130,65,0,841,842,5,31,0,0,842,845,1,0,0,0,843,845,
        5,14,0,0,844,812,1,0,0,0,844,813,1,0,0,0,844,814,1,0,0,0,844,815,
        1,0,0,0,844,816,1,0,0,0,844,819,1,0,0,0,844,821,1,0,0,0,844,823,
        1,0,0,0,844,824,1,0,0,0,844,828,1,0,0,0,844,839,1,0,0,0,844,843,
        1,0,0,0,845,121,1,0,0,0,846,848,5,28,0,0,847,846,1,0,0,0,847,848,
        1,0,0,0,848,849,1,0,0,0,849,854,5,88,0,0,850,851,5,28,0,0,851,853,
        5,88,0,0,852,850,1,0,0,0,853,856,1,0,0,0,854,852,1,0,0,0,854,855,
        1,0,0,0,855,123,1,0,0,0,856,854,1,0,0,0,857,859,5,88,0,0,858,860,
        3,142,71,0,859,858,1,0,0,0,859,860,1,0,0,0,860,125,1,0,0,0,861,866,
        3,124,62,0,862,863,5,28,0,0,863,865,3,124,62,0,864,862,1,0,0,0,865,
        868,1,0,0,0,866,864,1,0,0,0,866,867,1,0,0,0,867,127,1,0,0,0,868,
        866,1,0,0,0,869,871,5,17,0,0,870,872,3,130,65,0,871,870,1,0,0,0,
        871,872,1,0,0,0,872,873,1,0,0,0,873,874,5,19,0,0,874,129,1,0,0,0,
        875,882,3,136,68,0,876,877,5,21,0,0,877,881,3,136,68,0,878,879,5,
        49,0,0,879,881,3,102,51,0,880,876,1,0,0,0,880,878,1,0,0,0,881,884,
        1,0,0,0,882,880,1,0,0,0,882,883,1,0,0,0,883,887,1,0,0,0,884,882,
        1,0,0,0,885,887,3,132,66,0,886,875,1,0,0,0,886,885,1,0,0,0,887,131,
        1,0,0,0,888,893,3,134,67,0,889,890,5,21,0,0,890,892,3,134,67,0,891,
        889,1,0,0,0,892,895,1,0,0,0,893,891,1,0,0,0,893,894,1,0,0,0,894,
        133,1,0,0,0,895,893,1,0,0,0,896,897,5,88,0,0,897,898,5,15,0,0,898,
        899,3,136,68,0,899,135,1,0,0,0,900,901,5,13,0,0,901,902,3,122,61,
        0,902,904,5,17,0,0,903,905,3,132,66,0,904,903,1,0,0,0,904,905,1,
        0,0,0,905,906,1,0,0,0,906,907,5,19,0,0,907,910,1,0,0,0,908,910,3,
        114,57,0,909,900,1,0,0,0,909,908,1,0,0,0,910,137,1,0,0,0,911,913,
        3,114,57,0,912,911,1,0,0,0,912,913,1,0,0,0,913,918,1,0,0,0,914,915,
        5,21,0,0,915,917,3,114,57,0,916,914,1,0,0,0,917,920,1,0,0,0,918,
        916,1,0,0,0,918,919,1,0,0,0,919,139,1,0,0,0,920,918,1,0,0,0,921,
        926,3,114,57,0,922,923,5,21,0,0,923,925,3,114,57,0,924,922,1,0,0,
        0,925,928,1,0,0,0,926,924,1,0,0,0,926,927,1,0,0,0,927,141,1,0,0,
        0,928,926,1,0,0,0,929,930,5,76,0,0,930,935,3,144,72,0,931,932,5,
        21,0,0,932,934,3,144,72,0,933,931,1,0,0,0,934,937,1,0,0,0,935,933,
        1,0,0,0,935,936,1,0,0,0,936,938,1,0,0,0,937,935,1,0,0,0,938,939,
        5,77,0,0,939,143,1,0,0,0,940,943,5,18,0,0,941,943,3,114,57,0,942,
        940,1,0,0,0,942,941,1,0,0,0,943,145,1,0,0,0,944,946,3,148,74,0,945,
        947,3,150,75,0,946,945,1,0,0,0,946,947,1,0,0,0,947,147,1,0,0,0,948,
        953,5,89,0,0,949,950,5,62,0,0,950,952,5,89,0,0,951,949,1,0,0,0,952,
        955,1,0,0,0,953,951,1,0,0,0,953,954,1,0,0,0,954,957,1,0,0,0,955,
        953,1,0,0,0,956,948,1,0,0,0,956,957,1,0,0,0,957,149,1,0,0,0,958,
        959,5,78,0,0,959,960,3,58,29,0,960,151,1,0,0,0,120,154,157,162,166,
        172,178,185,190,196,199,203,216,225,228,243,252,259,268,281,283,
        288,291,294,297,302,309,314,323,330,333,336,339,342,346,349,352,
        355,358,363,368,381,383,385,394,400,403,408,413,418,421,424,433,
        441,446,455,458,463,469,473,482,487,490,493,497,501,507,510,514,
        517,522,525,540,543,550,553,557,564,568,578,582,598,607,615,629,
        645,650,666,671,695,701,721,738,763,769,776,778,790,807,809,834,
        844,847,854,859,866,871,880,882,886,893,904,909,912,918,926,935,
        942,946,953,956
    ]

class ModelicaParser ( Parser ):

    grammarFileName = "Modelica.g4"

    atn = ATNDeserializer().deserialize(serializedATN())

    decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "';'", "'class'", "'model'", "'operator'", 
                     "'record'", "'block'", "'expandable'", "'connector'", 
                     "'type'", "'package'", "'pure'", "'impure'", "'function'", 
                     "'end'", "'='", "'enumeration'", "'('", "':'", "')'", 
                     "'der'", "','", "'extends'", "'public'", "'protected'", 
                     "'external'", "'replaceable'", "'import'", "'.'", "'*'", 
                     "'{'", "'}'", "'constrainedby'", "'flow'", "'stream'", 
                     "'discrete'", "'parameter'", "'constant'", "'input'", 
                     "'output'", "'if'", "':='", "'equation'", "'algorithm'", 
                     "'break'", "'return'", "'then'", "'elseif'", "'else'", 
                     "'for'", "'loop'", "'in'", "'while'", "'when'", "'elsewhen'", 
                     "'connect'", "'-'", "'^'", "'.^'", "'/'", "'.*'", "'./'", 
                     "'+'", "'.+'", "'.-'", "'<'", "'<='", "'>'", "'>='", 
                     "'=='", "'<>'", "'not'", "'and'", "'or'", "'false'", 
                     "'true'", "'['", "']'", "'annotation'", "'each'", "'partial'", 
                     "'final'", "'within'", "'encapsulated'", "'redeclare'", 
                     "'inner'", "'outer'", "'initial'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "EACH", "PARTIAL", 
                      "FINAL", "WITHIN", "ENCAPSULATED", "REDECLARE", "INNER", 
                      "OUTER", "INITIAL", "IDENT", "STRING", "UNSIGNED_NUMBER", 
                      "COMMENT", "WS" ]

    RULE_stored_definition = 0
    RULE_stored_definition_class = 1
    RULE_class_definition = 2
    RULE_class_prefixes = 3
    RULE_class_type = 4
    RULE_class_specifier = 5
    RULE_base_prefix = 6
    RULE_enum_list = 7
    RULE_enumeration_literal = 8
    RULE_composition = 9
    RULE_language_specification = 10
    RULE_external_function_call = 11
    RULE_element_list = 12
    RULE_element = 13
    RULE_regular_element = 14
    RULE_replaceable_element = 15
    RULE_import_clause = 16
    RULE_import_list = 17
    RULE_extends_clause = 18
    RULE_constraining_clause = 19
    RULE_component_clause = 20
    RULE_type_prefix = 21
    RULE_type_specifier_element = 22
    RULE_type_specifier = 23
    RULE_component_list = 24
    RULE_component_declaration = 25
    RULE_condition_attribute = 26
    RULE_declaration = 27
    RULE_modification = 28
    RULE_class_modification = 29
    RULE_argument_list = 30
    RULE_argument = 31
    RULE_element_modification_or_replaceable = 32
    RULE_element_modification = 33
    RULE_element_redeclaration = 34
    RULE_element_replaceable = 35
    RULE_component_clause1 = 36
    RULE_component_declaration1 = 37
    RULE_short_class_definition = 38
    RULE_equation_block = 39
    RULE_equation_section = 40
    RULE_statement_block = 41
    RULE_algorithm_section = 42
    RULE_equation_options = 43
    RULE_equation = 44
    RULE_statement_options = 45
    RULE_statement = 46
    RULE_if_equation = 47
    RULE_if_statement = 48
    RULE_for_equation = 49
    RULE_for_statement = 50
    RULE_for_indices = 51
    RULE_for_index = 52
    RULE_while_statement = 53
    RULE_when_equation = 54
    RULE_when_statement = 55
    RULE_connect_clause = 56
    RULE_expression = 57
    RULE_simple_expression = 58
    RULE_expr = 59
    RULE_primary = 60
    RULE_name = 61
    RULE_component_reference_element = 62
    RULE_component_reference = 63
    RULE_function_call_args = 64
    RULE_function_arguments = 65
    RULE_named_arguments = 66
    RULE_named_argument = 67
    RULE_function_argument = 68
    RULE_output_expression_list = 69
    RULE_expression_list = 70
    RULE_array_subscripts = 71
    RULE_subscript = 72
    RULE_comment = 73
    RULE_string_comment = 74
    RULE_annotation = 75

    ruleNames =  [ "stored_definition", "stored_definition_class", "class_definition", 
                   "class_prefixes", "class_type", "class_specifier", "base_prefix", 
                   "enum_list", "enumeration_literal", "composition", "language_specification", 
                   "external_function_call", "element_list", "element", 
                   "regular_element", "replaceable_element", "import_clause", 
                   "import_list", "extends_clause", "constraining_clause", 
                   "component_clause", "type_prefix", "type_specifier_element", 
                   "type_specifier", "component_list", "component_declaration", 
                   "condition_attribute", "declaration", "modification", 
                   "class_modification", "argument_list", "argument", "element_modification_or_replaceable", 
                   "element_modification", "element_redeclaration", "element_replaceable", 
                   "component_clause1", "component_declaration1", "short_class_definition", 
                   "equation_block", "equation_section", "statement_block", 
                   "algorithm_section", "equation_options", "equation", 
                   "statement_options", "statement", "if_equation", "if_statement", 
                   "for_equation", "for_statement", "for_indices", "for_index", 
                   "while_statement", "when_equation", "when_statement", 
                   "connect_clause", "expression", "simple_expression", 
                   "expr", "primary", "name", "component_reference_element", 
                   "component_reference", "function_call_args", "function_arguments", 
                   "named_arguments", "named_argument", "function_argument", 
                   "output_expression_list", "expression_list", "array_subscripts", 
                   "subscript", "comment", "string_comment", "annotation" ]

    EOF = Token.EOF
    T__0=1
    T__1=2
    T__2=3
    T__3=4
    T__4=5
    T__5=6
    T__6=7
    T__7=8
    T__8=9
    T__9=10
    T__10=11
    T__11=12
    T__12=13
    T__13=14
    T__14=15
    T__15=16
    T__16=17
    T__17=18
    T__18=19
    T__19=20
    T__20=21
    T__21=22
    T__22=23
    T__23=24
    T__24=25
    T__25=26
    T__26=27
    T__27=28
    T__28=29
    T__29=30
    T__30=31
    T__31=32
    T__32=33
    T__33=34
    T__34=35
    T__35=36
    T__36=37
    T__37=38
    T__38=39
    T__39=40
    T__40=41
    T__41=42
    T__42=43
    T__43=44
    T__44=45
    T__45=46
    T__46=47
    T__47=48
    T__48=49
    T__49=50
    T__50=51
    T__51=52
    T__52=53
    T__53=54
    T__54=55
    T__55=56
    T__56=57
    T__57=58
    T__58=59
    T__59=60
    T__60=61
    T__61=62
    T__62=63
    T__63=64
    T__64=65
    T__65=66
    T__66=67
    T__67=68
    T__68=69
    T__69=70
    T__70=71
    T__71=72
    T__72=73
    T__73=74
    T__74=75
    T__75=76
    T__76=77
    T__77=78
    EACH=79
    PARTIAL=80
    FINAL=81
    WITHIN=82
    ENCAPSULATED=83
    REDECLARE=84
    INNER=85
    OUTER=86
    INITIAL=87
    IDENT=88
    STRING=89
    UNSIGNED_NUMBER=90
    COMMENT=91
    WS=92

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.13.1")
        self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
        self._predicates = None




    class Stored_definitionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def WITHIN(self):
            return self.getToken(ModelicaParser.WITHIN, 0)

        def stored_definition_class(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Stored_definition_classContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Stored_definition_classContext,i)


        def component_reference(self):
            return self.getTypedRuleContext(ModelicaParser.Component_referenceContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_stored_definition

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStored_definition" ):
                listener.enterStored_definition(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStored_definition" ):
                listener.exitStored_definition(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStored_definition" ):
                return visitor.visitStored_definition(self)
            else:
                return visitor.visitChildren(self)




    def stored_definition(self):

        localctx = ModelicaParser.Stored_definitionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_stored_definition)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 157
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==82:
                self.state = 152
                self.match(ModelicaParser.WITHIN)
                self.state = 154
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==88:
                    self.state = 153
                    self.component_reference()


                self.state = 156
                self.match(ModelicaParser.T__0)


            self.state = 162
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & 16380) != 0) or ((((_la - 80)) & ~0x3f) == 0 and ((1 << (_la - 80)) & 11) != 0):
                self.state = 159
                self.stored_definition_class()
                self.state = 164
                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 Stored_definition_classContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def class_definition(self):
            return self.getTypedRuleContext(ModelicaParser.Class_definitionContext,0)


        def FINAL(self):
            return self.getToken(ModelicaParser.FINAL, 0)

        def getRuleIndex(self):
            return ModelicaParser.RULE_stored_definition_class

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStored_definition_class" ):
                listener.enterStored_definition_class(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStored_definition_class" ):
                listener.exitStored_definition_class(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStored_definition_class" ):
                return visitor.visitStored_definition_class(self)
            else:
                return visitor.visitChildren(self)




    def stored_definition_class(self):

        localctx = ModelicaParser.Stored_definition_classContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_stored_definition_class)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 166
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==81:
                self.state = 165
                self.match(ModelicaParser.FINAL)


            self.state = 168
            self.class_definition()
            self.state = 169
            self.match(ModelicaParser.T__0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Class_definitionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def class_prefixes(self):
            return self.getTypedRuleContext(ModelicaParser.Class_prefixesContext,0)


        def class_specifier(self):
            return self.getTypedRuleContext(ModelicaParser.Class_specifierContext,0)


        def ENCAPSULATED(self):
            return self.getToken(ModelicaParser.ENCAPSULATED, 0)

        def getRuleIndex(self):
            return ModelicaParser.RULE_class_definition

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterClass_definition" ):
                listener.enterClass_definition(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitClass_definition" ):
                listener.exitClass_definition(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitClass_definition" ):
                return visitor.visitClass_definition(self)
            else:
                return visitor.visitChildren(self)




    def class_definition(self):

        localctx = ModelicaParser.Class_definitionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_class_definition)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 172
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==83:
                self.state = 171
                self.match(ModelicaParser.ENCAPSULATED)


            self.state = 174
            self.class_prefixes()
            self.state = 175
            self.class_specifier()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Class_prefixesContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def class_type(self):
            return self.getTypedRuleContext(ModelicaParser.Class_typeContext,0)


        def PARTIAL(self):
            return self.getToken(ModelicaParser.PARTIAL, 0)

        def getRuleIndex(self):
            return ModelicaParser.RULE_class_prefixes

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterClass_prefixes" ):
                listener.enterClass_prefixes(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitClass_prefixes" ):
                listener.exitClass_prefixes(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitClass_prefixes" ):
                return visitor.visitClass_prefixes(self)
            else:
                return visitor.visitChildren(self)




    def class_prefixes(self):

        localctx = ModelicaParser.Class_prefixesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_class_prefixes)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 178
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==80:
                self.state = 177
                self.match(ModelicaParser.PARTIAL)


            self.state = 180
            self.class_type()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Class_typeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return ModelicaParser.RULE_class_type

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterClass_type" ):
                listener.enterClass_type(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitClass_type" ):
                listener.exitClass_type(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitClass_type" ):
                return visitor.visitClass_type(self)
            else:
                return visitor.visitChildren(self)




    def class_type(self):

        localctx = ModelicaParser.Class_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_class_type)
        self._la = 0 # Token type
        try:
            self.state = 203
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,10,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 182
                self.match(ModelicaParser.T__1)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 183
                self.match(ModelicaParser.T__2)
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 185
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==4:
                    self.state = 184
                    self.match(ModelicaParser.T__3)


                self.state = 187
                self.match(ModelicaParser.T__4)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 188
                self.match(ModelicaParser.T__5)
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 190
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==7:
                    self.state = 189
                    self.match(ModelicaParser.T__6)


                self.state = 192
                self.match(ModelicaParser.T__7)
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 193
                self.match(ModelicaParser.T__8)
                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 194
                self.match(ModelicaParser.T__9)
                pass

            elif la_ == 8:
                self.enterOuterAlt(localctx, 8)
                self.state = 196
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==11 or _la==12:
                    self.state = 195
                    _la = self._input.LA(1)
                    if not(_la==11 or _la==12):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()


                self.state = 199
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==4:
                    self.state = 198
                    self.match(ModelicaParser.T__3)


                self.state = 201
                self.match(ModelicaParser.T__12)
                pass

            elif la_ == 9:
                self.enterOuterAlt(localctx, 9)
                self.state = 202
                self.match(ModelicaParser.T__3)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Class_specifierContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return ModelicaParser.RULE_class_specifier

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class Class_spec_derContext(Class_specifierContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Class_specifierContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def IDENT(self, i:int=None):
            if i is None:
                return self.getTokens(ModelicaParser.IDENT)
            else:
                return self.getToken(ModelicaParser.IDENT, i)
        def name(self):
            return self.getTypedRuleContext(ModelicaParser.NameContext,0)

        def comment(self):
            return self.getTypedRuleContext(ModelicaParser.CommentContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterClass_spec_der" ):
                listener.enterClass_spec_der(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitClass_spec_der" ):
                listener.exitClass_spec_der(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitClass_spec_der" ):
                return visitor.visitClass_spec_der(self)
            else:
                return visitor.visitChildren(self)


    class Class_spec_enumContext(Class_specifierContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Class_specifierContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def IDENT(self):
            return self.getToken(ModelicaParser.IDENT, 0)
        def comment(self):
            return self.getTypedRuleContext(ModelicaParser.CommentContext,0)

        def enum_list(self):
            return self.getTypedRuleContext(ModelicaParser.Enum_listContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterClass_spec_enum" ):
                listener.enterClass_spec_enum(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitClass_spec_enum" ):
                listener.exitClass_spec_enum(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitClass_spec_enum" ):
                return visitor.visitClass_spec_enum(self)
            else:
                return visitor.visitChildren(self)


    class Class_spec_baseContext(Class_specifierContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Class_specifierContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def IDENT(self):
            return self.getToken(ModelicaParser.IDENT, 0)
        def base_prefix(self):
            return self.getTypedRuleContext(ModelicaParser.Base_prefixContext,0)

        def component_reference(self):
            return self.getTypedRuleContext(ModelicaParser.Component_referenceContext,0)

        def comment(self):
            return self.getTypedRuleContext(ModelicaParser.CommentContext,0)

        def class_modification(self):
            return self.getTypedRuleContext(ModelicaParser.Class_modificationContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterClass_spec_base" ):
                listener.enterClass_spec_base(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitClass_spec_base" ):
                listener.exitClass_spec_base(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitClass_spec_base" ):
                return visitor.visitClass_spec_base(self)
            else:
                return visitor.visitChildren(self)


    class Class_spec_compContext(Class_specifierContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Class_specifierContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def IDENT(self, i:int=None):
            if i is None:
                return self.getTokens(ModelicaParser.IDENT)
            else:
                return self.getToken(ModelicaParser.IDENT, i)
        def string_comment(self):
            return self.getTypedRuleContext(ModelicaParser.String_commentContext,0)

        def composition(self):
            return self.getTypedRuleContext(ModelicaParser.CompositionContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterClass_spec_comp" ):
                listener.enterClass_spec_comp(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitClass_spec_comp" ):
                listener.exitClass_spec_comp(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitClass_spec_comp" ):
                return visitor.visitClass_spec_comp(self)
            else:
                return visitor.visitChildren(self)


    class Class_spec_extendsContext(Class_specifierContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Class_specifierContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def IDENT(self, i:int=None):
            if i is None:
                return self.getTokens(ModelicaParser.IDENT)
            else:
                return self.getToken(ModelicaParser.IDENT, i)
        def string_comment(self):
            return self.getTypedRuleContext(ModelicaParser.String_commentContext,0)

        def composition(self):
            return self.getTypedRuleContext(ModelicaParser.CompositionContext,0)

        def class_modification(self):
            return self.getTypedRuleContext(ModelicaParser.Class_modificationContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterClass_spec_extends" ):
                listener.enterClass_spec_extends(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitClass_spec_extends" ):
                listener.exitClass_spec_extends(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitClass_spec_extends" ):
                return visitor.visitClass_spec_extends(self)
            else:
                return visitor.visitChildren(self)



    def class_specifier(self):

        localctx = ModelicaParser.Class_specifierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_class_specifier)
        self._la = 0 # Token type
        try:
            self.state = 259
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,16,self._ctx)
            if la_ == 1:
                localctx = ModelicaParser.Class_spec_compContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 205
                self.match(ModelicaParser.IDENT)
                self.state = 206
                self.string_comment()
                self.state = 207
                self.composition()
                self.state = 208
                self.match(ModelicaParser.T__13)
                self.state = 209
                self.match(ModelicaParser.IDENT)
                pass

            elif la_ == 2:
                localctx = ModelicaParser.Class_spec_baseContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 211
                self.match(ModelicaParser.IDENT)
                self.state = 212
                self.match(ModelicaParser.T__14)
                self.state = 213
                self.base_prefix()
                self.state = 214
                self.component_reference()
                self.state = 216
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==17:
                    self.state = 215
                    self.class_modification()


                self.state = 218
                self.comment()
                pass

            elif la_ == 3:
                localctx = ModelicaParser.Class_spec_enumContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 220
                self.match(ModelicaParser.IDENT)
                self.state = 221
                self.match(ModelicaParser.T__14)
                self.state = 222
                self.match(ModelicaParser.T__15)
                self.state = 223
                self.match(ModelicaParser.T__16)
                self.state = 228
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [19, 88]:
                    self.state = 225
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==88:
                        self.state = 224
                        self.enum_list()


                    pass
                elif token in [18]:
                    self.state = 227
                    self.match(ModelicaParser.T__17)
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 230
                self.match(ModelicaParser.T__18)
                self.state = 231
                self.comment()
                pass

            elif la_ == 4:
                localctx = ModelicaParser.Class_spec_derContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 232
                self.match(ModelicaParser.IDENT)
                self.state = 233
                self.match(ModelicaParser.T__14)
                self.state = 234
                self.match(ModelicaParser.T__19)
                self.state = 235
                self.match(ModelicaParser.T__16)
                self.state = 236
                self.name()
                self.state = 237
                self.match(ModelicaParser.T__20)
                self.state = 238
                self.match(ModelicaParser.IDENT)
                self.state = 243
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==21:
                    self.state = 239
                    self.match(ModelicaParser.T__20)
                    self.state = 240
                    self.match(ModelicaParser.IDENT)
                    self.state = 245
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 246
                self.match(ModelicaParser.T__18)
                self.state = 247
                self.comment()
                pass

            elif la_ == 5:
                localctx = ModelicaParser.Class_spec_extendsContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 249
                self.match(ModelicaParser.T__21)
                self.state = 250
                self.match(ModelicaParser.IDENT)
                self.state = 252
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==17:
                    self.state = 251
                    self.class_modification()


                self.state = 254
                self.string_comment()
                self.state = 255
                self.composition()
                self.state = 256
                self.match(ModelicaParser.T__13)
                self.state = 257
                self.match(ModelicaParser.IDENT)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Base_prefixContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def type_prefix(self):
            return self.getTypedRuleContext(ModelicaParser.Type_prefixContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_base_prefix

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBase_prefix" ):
                listener.enterBase_prefix(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBase_prefix" ):
                listener.exitBase_prefix(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBase_prefix" ):
                return visitor.visitBase_prefix(self)
            else:
                return visitor.visitChildren(self)




    def base_prefix(self):

        localctx = ModelicaParser.Base_prefixContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_base_prefix)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 261
            self.type_prefix()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Enum_listContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def enumeration_literal(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Enumeration_literalContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Enumeration_literalContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_enum_list

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEnum_list" ):
                listener.enterEnum_list(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEnum_list" ):
                listener.exitEnum_list(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEnum_list" ):
                return visitor.visitEnum_list(self)
            else:
                return visitor.visitChildren(self)




    def enum_list(self):

        localctx = ModelicaParser.Enum_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_enum_list)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 263
            self.enumeration_literal()
            self.state = 268
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==21:
                self.state = 264
                self.match(ModelicaParser.T__20)
                self.state = 265
                self.enumeration_literal()
                self.state = 270
                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 Enumeration_literalContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENT(self):
            return self.getToken(ModelicaParser.IDENT, 0)

        def comment(self):
            return self.getTypedRuleContext(ModelicaParser.CommentContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_enumeration_literal

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEnumeration_literal" ):
                listener.enterEnumeration_literal(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEnumeration_literal" ):
                listener.exitEnumeration_literal(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEnumeration_literal" ):
                return visitor.visitEnumeration_literal(self)
            else:
                return visitor.visitChildren(self)




    def enumeration_literal(self):

        localctx = ModelicaParser.Enumeration_literalContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_enumeration_literal)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 271
            self.match(ModelicaParser.IDENT)
            self.state = 272
            self.comment()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CompositionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.epriv = None # Element_listContext
            self.epub = None # Element_listContext
            self.epro = None # Element_listContext
            self.ext_annotation = None # AnnotationContext
            self.comp_annotation = None # AnnotationContext

        def element_list(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Element_listContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Element_listContext,i)


        def equation_section(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Equation_sectionContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Equation_sectionContext,i)


        def algorithm_section(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Algorithm_sectionContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Algorithm_sectionContext,i)


        def annotation(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.AnnotationContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.AnnotationContext,i)


        def language_specification(self):
            return self.getTypedRuleContext(ModelicaParser.Language_specificationContext,0)


        def external_function_call(self):
            return self.getTypedRuleContext(ModelicaParser.External_function_callContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_composition

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterComposition" ):
                listener.enterComposition(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitComposition" ):
                listener.exitComposition(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitComposition" ):
                return visitor.visitComposition(self)
            else:
                return visitor.visitChildren(self)




    def composition(self):

        localctx = ModelicaParser.CompositionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_composition)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 274
            localctx.epriv = self.element_list()
            self.state = 283
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & 13194164699136) != 0) or _la==87:
                self.state = 281
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,18,self._ctx)
                if la_ == 1:
                    self.state = 275
                    self.match(ModelicaParser.T__22)
                    self.state = 276
                    localctx.epub = self.element_list()
                    pass

                elif la_ == 2:
                    self.state = 277
                    self.match(ModelicaParser.T__23)
                    self.state = 278
                    localctx.epro = self.element_list()
                    pass

                elif la_ == 3:
                    self.state = 279
                    self.equation_section()
                    pass

                elif la_ == 4:
                    self.state = 280
                    self.algorithm_section()
                    pass


                self.state = 285
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 297
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==25:
                self.state = 286
                self.match(ModelicaParser.T__24)
                self.state = 288
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==89:
                    self.state = 287
                    self.language_specification()


                self.state = 291
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==88:
                    self.state = 290
                    self.external_function_call()


                self.state = 294
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==78:
                    self.state = 293
                    localctx.ext_annotation = self.annotation()


                self.state = 296
                self.match(ModelicaParser.T__0)


            self.state = 302
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==78:
                self.state = 299
                localctx.comp_annotation = self.annotation()
                self.state = 300
                self.match(ModelicaParser.T__0)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Language_specificationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def STRING(self):
            return self.getToken(ModelicaParser.STRING, 0)

        def getRuleIndex(self):
            return ModelicaParser.RULE_language_specification

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLanguage_specification" ):
                listener.enterLanguage_specification(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLanguage_specification" ):
                listener.exitLanguage_specification(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLanguage_specification" ):
                return visitor.visitLanguage_specification(self)
            else:
                return visitor.visitChildren(self)




    def language_specification(self):

        localctx = ModelicaParser.Language_specificationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_language_specification)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 304
            self.match(ModelicaParser.STRING)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class External_function_callContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENT(self):
            return self.getToken(ModelicaParser.IDENT, 0)

        def component_reference(self):
            return self.getTypedRuleContext(ModelicaParser.Component_referenceContext,0)


        def expression_list(self):
            return self.getTypedRuleContext(ModelicaParser.Expression_listContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_external_function_call

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExternal_function_call" ):
                listener.enterExternal_function_call(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExternal_function_call" ):
                listener.exitExternal_function_call(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExternal_function_call" ):
                return visitor.visitExternal_function_call(self)
            else:
                return visitor.visitChildren(self)




    def external_function_call(self):

        localctx = ModelicaParser.External_function_callContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_external_function_call)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 309
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,25,self._ctx)
            if la_ == 1:
                self.state = 306
                self.component_reference()
                self.state = 307
                self.match(ModelicaParser.T__14)


            self.state = 311
            self.match(ModelicaParser.IDENT)
            self.state = 312
            self.match(ModelicaParser.T__16)
            self.state = 314
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & 72058694624493568) != 0) or ((((_la - 71)) & ~0x3f) == 0 and ((1 << (_la - 71)) & 983097) != 0):
                self.state = 313
                self.expression_list()


            self.state = 316
            self.match(ModelicaParser.T__18)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Element_listContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def element(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.ElementContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ElementContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_element_list

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterElement_list" ):
                listener.enterElement_list(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitElement_list" ):
                listener.exitElement_list(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitElement_list" ):
                return visitor.visitElement_list(self)
            else:
                return visitor.visitChildren(self)




    def element_list(self):

        localctx = ModelicaParser.Element_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_element_list)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 323
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & 1091127230460) != 0) or ((((_la - 80)) & ~0x3f) == 0 and ((1 << (_la - 80)) & 379) != 0):
                self.state = 318
                self.element()
                self.state = 319
                self.match(ModelicaParser.T__0)
                self.state = 325
                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 ElementContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def import_clause(self):
            return self.getTypedRuleContext(ModelicaParser.Import_clauseContext,0)


        def extends_clause(self):
            return self.getTypedRuleContext(ModelicaParser.Extends_clauseContext,0)


        def regular_element(self):
            return self.getTypedRuleContext(ModelicaParser.Regular_elementContext,0)


        def replaceable_element(self):
            return self.getTypedRuleContext(ModelicaParser.Replaceable_elementContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_element

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterElement" ):
                listener.enterElement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitElement" ):
                listener.exitElement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitElement" ):
                return visitor.visitElement(self)
            else:
                return visitor.visitChildren(self)




    def element(self):

        localctx = ModelicaParser.ElementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_element)
        try:
            self.state = 330
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,28,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 326
                self.import_clause()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 327
                self.extends_clause()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 328
                self.regular_element()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 329
                self.replaceable_element()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Regular_elementContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.class_elem = None # Class_definitionContext
            self.comp_elem = None # Component_clauseContext

        def REDECLARE(self):
            return self.getToken(ModelicaParser.REDECLARE, 0)

        def FINAL(self):
            return self.getToken(ModelicaParser.FINAL, 0)

        def INNER(self):
            return self.getToken(ModelicaParser.INNER, 0)

        def OUTER(self):
            return self.getToken(ModelicaParser.OUTER, 0)

        def class_definition(self):
            return self.getTypedRuleContext(ModelicaParser.Class_definitionContext,0)


        def component_clause(self):
            return self.getTypedRuleContext(ModelicaParser.Component_clauseContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_regular_element

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterRegular_element" ):
                listener.enterRegular_element(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitRegular_element" ):
                listener.exitRegular_element(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitRegular_element" ):
                return visitor.visitRegular_element(self)
            else:
                return visitor.visitChildren(self)




    def regular_element(self):

        localctx = ModelicaParser.Regular_elementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_regular_element)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 333
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==84:
                self.state = 332
                self.match(ModelicaParser.REDECLARE)


            self.state = 336
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==81:
                self.state = 335
                self.match(ModelicaParser.FINAL)


            self.state = 339
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==85:
                self.state = 338
                self.match(ModelicaParser.INNER)


            self.state = 342
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==86:
                self.state = 341
                self.match(ModelicaParser.OUTER)


            self.state = 346
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 80, 83]:
                self.state = 344
                localctx.class_elem = self.class_definition()
                pass
            elif token in [33, 34, 35, 36, 37, 38, 39, 88]:
                self.state = 345
                localctx.comp_elem = self.component_clause()
                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 Replaceable_elementContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.class_elem = None # Class_definitionContext
            self.comp_elem = None # Component_clauseContext

        def REDECLARE(self):
            return self.getToken(ModelicaParser.REDECLARE, 0)

        def FINAL(self):
            return self.getToken(ModelicaParser.FINAL, 0)

        def INNER(self):
            return self.getToken(ModelicaParser.INNER, 0)

        def OUTER(self):
            return self.getToken(ModelicaParser.OUTER, 0)

        def class_definition(self):
            return self.getTypedRuleContext(ModelicaParser.Class_definitionContext,0)


        def component_clause(self):
            return self.getTypedRuleContext(ModelicaParser.Component_clauseContext,0)


        def constraining_clause(self):
            return self.getTypedRuleContext(ModelicaParser.Constraining_clauseContext,0)


        def comment(self):
            return self.getTypedRuleContext(ModelicaParser.CommentContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_replaceable_element

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterReplaceable_element" ):
                listener.enterReplaceable_element(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitReplaceable_element" ):
                listener.exitReplaceable_element(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitReplaceable_element" ):
                return visitor.visitReplaceable_element(self)
            else:
                return visitor.visitChildren(self)




    def replaceable_element(self):

        localctx = ModelicaParser.Replaceable_elementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_replaceable_element)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 349
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==84:
                self.state = 348
                self.match(ModelicaParser.REDECLARE)


            self.state = 352
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==81:
                self.state = 351
                self.match(ModelicaParser.FINAL)


            self.state = 355
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==85:
                self.state = 354
                self.match(ModelicaParser.INNER)


            self.state = 358
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==86:
                self.state = 357
                self.match(ModelicaParser.OUTER)


            self.state = 360
            self.match(ModelicaParser.T__25)
            self.state = 363
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 80, 83]:
                self.state = 361
                localctx.class_elem = self.class_definition()
                pass
            elif token in [33, 34, 35, 36, 37, 38, 39, 88]:
                self.state = 362
                localctx.comp_elem = self.component_clause()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 368
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==32:
                self.state = 365
                self.constraining_clause()
                self.state = 366
                self.comment()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Import_clauseContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def comment(self):
            return self.getTypedRuleContext(ModelicaParser.CommentContext,0)


        def IDENT(self):
            return self.getToken(ModelicaParser.IDENT, 0)

        def component_reference(self):
            return self.getTypedRuleContext(ModelicaParser.Component_referenceContext,0)


        def import_list(self):
            return self.getTypedRuleContext(ModelicaParser.Import_listContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_import_clause

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterImport_clause" ):
                listener.enterImport_clause(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitImport_clause" ):
                listener.exitImport_clause(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitImport_clause" ):
                return visitor.visitImport_clause(self)
            else:
                return visitor.visitChildren(self)




    def import_clause(self):

        localctx = ModelicaParser.Import_clauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_import_clause)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 370
            self.match(ModelicaParser.T__26)
            self.state = 385
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,42,self._ctx)
            if la_ == 1:
                self.state = 371
                self.match(ModelicaParser.IDENT)
                self.state = 372
                self.match(ModelicaParser.T__14)
                self.state = 373
                self.component_reference()
                pass

            elif la_ == 2:
                self.state = 374
                self.component_reference()
                self.state = 383
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==28:
                    self.state = 375
                    self.match(ModelicaParser.T__27)
                    self.state = 381
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [29]:
                        self.state = 376
                        self.match(ModelicaParser.T__28)
                        pass
                    elif token in [30]:
                        self.state = 377
                        self.match(ModelicaParser.T__29)
                        self.state = 378
                        self.import_list()
                        self.state = 379
                        self.match(ModelicaParser.T__30)
                        pass
                    else:
                        raise NoViableAltException(self)



                pass


            self.state = 387
            self.comment()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Import_listContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENT(self):
            return self.getToken(ModelicaParser.IDENT, 0)

        def import_list(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Import_listContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Import_listContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_import_list

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterImport_list" ):
                listener.enterImport_list(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitImport_list" ):
                listener.exitImport_list(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitImport_list" ):
                return visitor.visitImport_list(self)
            else:
                return visitor.visitChildren(self)




    def import_list(self):

        localctx = ModelicaParser.Import_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_import_list)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 389
            self.match(ModelicaParser.IDENT)
            self.state = 394
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,43,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 390
                    self.match(ModelicaParser.T__20)
                    self.state = 391
                    self.import_list() 
                self.state = 396
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,43,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 Extends_clauseContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def component_reference(self):
            return self.getTypedRuleContext(ModelicaParser.Component_referenceContext,0)


        def class_modification(self):
            return self.getTypedRuleContext(ModelicaParser.Class_modificationContext,0)


        def annotation(self):
            return self.getTypedRuleContext(ModelicaParser.AnnotationContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_extends_clause

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExtends_clause" ):
                listener.enterExtends_clause(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExtends_clause" ):
                listener.exitExtends_clause(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExtends_clause" ):
                return visitor.visitExtends_clause(self)
            else:
                return visitor.visitChildren(self)




    def extends_clause(self):

        localctx = ModelicaParser.Extends_clauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_extends_clause)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 397
            self.match(ModelicaParser.T__21)
            self.state = 398
            self.component_reference()
            self.state = 400
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==17:
                self.state = 399
                self.class_modification()


            self.state = 403
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==78:
                self.state = 402
                self.annotation()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Constraining_clauseContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def name(self):
            return self.getTypedRuleContext(ModelicaParser.NameContext,0)


        def class_modification(self):
            return self.getTypedRuleContext(ModelicaParser.Class_modificationContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_constraining_clause

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterConstraining_clause" ):
                listener.enterConstraining_clause(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitConstraining_clause" ):
                listener.exitConstraining_clause(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitConstraining_clause" ):
                return visitor.visitConstraining_clause(self)
            else:
                return visitor.visitChildren(self)




    def constraining_clause(self):

        localctx = ModelicaParser.Constraining_clauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_constraining_clause)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 405
            self.match(ModelicaParser.T__31)
            self.state = 406
            self.name()
            self.state = 408
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==17:
                self.state = 407
                self.class_modification()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Component_clauseContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def type_prefix(self):
            return self.getTypedRuleContext(ModelicaParser.Type_prefixContext,0)


        def type_specifier(self):
            return self.getTypedRuleContext(ModelicaParser.Type_specifierContext,0)


        def component_list(self):
            return self.getTypedRuleContext(ModelicaParser.Component_listContext,0)


        def array_subscripts(self):
            return self.getTypedRuleContext(ModelicaParser.Array_subscriptsContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_component_clause

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterComponent_clause" ):
                listener.enterComponent_clause(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitComponent_clause" ):
                listener.exitComponent_clause(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitComponent_clause" ):
                return visitor.visitComponent_clause(self)
            else:
                return visitor.visitChildren(self)




    def component_clause(self):

        localctx = ModelicaParser.Component_clauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_component_clause)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 410
            self.type_prefix()
            self.state = 411
            self.type_specifier()
            self.state = 413
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==76:
                self.state = 412
                self.array_subscripts()


            self.state = 415
            self.component_list()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Type_prefixContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return ModelicaParser.RULE_type_prefix

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterType_prefix" ):
                listener.enterType_prefix(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitType_prefix" ):
                listener.exitType_prefix(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_prefix" ):
                return visitor.visitType_prefix(self)
            else:
                return visitor.visitChildren(self)




    def type_prefix(self):

        localctx = ModelicaParser.Type_prefixContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_type_prefix)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 418
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==33 or _la==34:
                self.state = 417
                _la = self._input.LA(1)
                if not(_la==33 or _la==34):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()


            self.state = 421
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & 240518168576) != 0):
                self.state = 420
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 240518168576) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()


            self.state = 424
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==38 or _la==39:
                self.state = 423
                _la = self._input.LA(1)
                if not(_la==38 or _la==39):
                    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 Type_specifier_elementContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENT(self):
            return self.getToken(ModelicaParser.IDENT, 0)

        def getRuleIndex(self):
            return ModelicaParser.RULE_type_specifier_element

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterType_specifier_element" ):
                listener.enterType_specifier_element(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitType_specifier_element" ):
                listener.exitType_specifier_element(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_specifier_element" ):
                return visitor.visitType_specifier_element(self)
            else:
                return visitor.visitChildren(self)




    def type_specifier_element(self):

        localctx = ModelicaParser.Type_specifier_elementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_type_specifier_element)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 426
            self.match(ModelicaParser.IDENT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Type_specifierContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def type_specifier_element(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Type_specifier_elementContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Type_specifier_elementContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_type_specifier

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterType_specifier" ):
                listener.enterType_specifier(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitType_specifier" ):
                listener.exitType_specifier(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_specifier" ):
                return visitor.visitType_specifier(self)
            else:
                return visitor.visitChildren(self)




    def type_specifier(self):

        localctx = ModelicaParser.Type_specifierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_type_specifier)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 428
            self.type_specifier_element()
            self.state = 433
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==28:
                self.state = 429
                self.match(ModelicaParser.T__27)
                self.state = 430
                self.type_specifier_element()
                self.state = 435
                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 Component_listContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def component_declaration(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Component_declarationContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Component_declarationContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_component_list

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterComponent_list" ):
                listener.enterComponent_list(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitComponent_list" ):
                listener.exitComponent_list(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitComponent_list" ):
                return visitor.visitComponent_list(self)
            else:
                return visitor.visitChildren(self)




    def component_list(self):

        localctx = ModelicaParser.Component_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_component_list)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 436
            self.component_declaration()
            self.state = 441
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==21:
                self.state = 437
                self.match(ModelicaParser.T__20)
                self.state = 438
                self.component_declaration()
                self.state = 443
                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 Component_declarationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def declaration(self):
            return self.getTypedRuleContext(ModelicaParser.DeclarationContext,0)


        def comment(self):
            return self.getTypedRuleContext(ModelicaParser.CommentContext,0)


        def condition_attribute(self):
            return self.getTypedRuleContext(ModelicaParser.Condition_attributeContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_component_declaration

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterComponent_declaration" ):
                listener.enterComponent_declaration(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitComponent_declaration" ):
                listener.exitComponent_declaration(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitComponent_declaration" ):
                return visitor.visitComponent_declaration(self)
            else:
                return visitor.visitChildren(self)




    def component_declaration(self):

        localctx = ModelicaParser.Component_declarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_component_declaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 444
            self.declaration()
            self.state = 446
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==40:
                self.state = 445
                self.condition_attribute()


            self.state = 448
            self.comment()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Condition_attributeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def expression(self):
            return self.getTypedRuleContext(ModelicaParser.ExpressionContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_condition_attribute

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCondition_attribute" ):
                listener.enterCondition_attribute(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitCondition_attribute" ):
                listener.exitCondition_attribute(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitCondition_attribute" ):
                return visitor.visitCondition_attribute(self)
            else:
                return visitor.visitChildren(self)




    def condition_attribute(self):

        localctx = ModelicaParser.Condition_attributeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_condition_attribute)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 450
            self.match(ModelicaParser.T__39)
            self.state = 451
            self.expression()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENT(self):
            return self.getToken(ModelicaParser.IDENT, 0)

        def array_subscripts(self):
            return self.getTypedRuleContext(ModelicaParser.Array_subscriptsContext,0)


        def modification(self):
            return self.getTypedRuleContext(ModelicaParser.ModificationContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_declaration

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDeclaration" ):
                listener.enterDeclaration(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDeclaration" ):
                listener.exitDeclaration(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDeclaration" ):
                return visitor.visitDeclaration(self)
            else:
                return visitor.visitChildren(self)




    def declaration(self):

        localctx = ModelicaParser.DeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_declaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 453
            self.match(ModelicaParser.IDENT)
            self.state = 455
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==76:
                self.state = 454
                self.array_subscripts()


            self.state = 458
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & 2199023419392) != 0):
                self.state = 457
                self.modification()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ModificationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return ModelicaParser.RULE_modification

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class Modification_classContext(ModificationContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.ModificationContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def class_modification(self):
            return self.getTypedRuleContext(ModelicaParser.Class_modificationContext,0)

        def expression(self):
            return self.getTypedRuleContext(ModelicaParser.ExpressionContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterModification_class" ):
                listener.enterModification_class(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitModification_class" ):
                listener.exitModification_class(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitModification_class" ):
                return visitor.visitModification_class(self)
            else:
                return visitor.visitChildren(self)


    class Modification_assignment2Context(ModificationContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.ModificationContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self):
            return self.getTypedRuleContext(ModelicaParser.ExpressionContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterModification_assignment2" ):
                listener.enterModification_assignment2(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitModification_assignment2" ):
                listener.exitModification_assignment2(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitModification_assignment2" ):
                return visitor.visitModification_assignment2(self)
            else:
                return visitor.visitChildren(self)


    class Modification_assignmentContext(ModificationContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.ModificationContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self):
            return self.getTypedRuleContext(ModelicaParser.ExpressionContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterModification_assignment" ):
                listener.enterModification_assignment(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitModification_assignment" ):
                listener.exitModification_assignment(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitModification_assignment" ):
                return visitor.visitModification_assignment(self)
            else:
                return visitor.visitChildren(self)



    def modification(self):

        localctx = ModelicaParser.ModificationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_modification)
        self._la = 0 # Token type
        try:
            self.state = 469
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [17]:
                localctx = ModelicaParser.Modification_classContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 460
                self.class_modification()
                self.state = 463
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==15:
                    self.state = 461
                    self.match(ModelicaParser.T__14)
                    self.state = 462
                    self.expression()


                pass
            elif token in [15]:
                localctx = ModelicaParser.Modification_assignmentContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 465
                self.match(ModelicaParser.T__14)
                self.state = 466
                self.expression()
                pass
            elif token in [41]:
                localctx = ModelicaParser.Modification_assignment2Context(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 467
                self.match(ModelicaParser.T__40)
                self.state = 468
                self.expression()
                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 Class_modificationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def argument_list(self):
            return self.getTypedRuleContext(ModelicaParser.Argument_listContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_class_modification

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterClass_modification" ):
                listener.enterClass_modification(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitClass_modification" ):
                listener.exitClass_modification(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitClass_modification" ):
                return visitor.visitClass_modification(self)
            else:
                return visitor.visitChildren(self)




    def class_modification(self):

        localctx = ModelicaParser.Class_modificationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_class_modification)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 471
            self.match(ModelicaParser.T__16)
            self.state = 473
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if ((((_la - 26)) & ~0x3f) == 0 and ((1 << (_la - 26)) & 4944952390852804609) != 0):
                self.state = 472
                self.argument_list()


            self.state = 475
            self.match(ModelicaParser.T__18)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Argument_listContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def argument(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.ArgumentContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ArgumentContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_argument_list

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArgument_list" ):
                listener.enterArgument_list(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArgument_list" ):
                listener.exitArgument_list(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArgument_list" ):
                return visitor.visitArgument_list(self)
            else:
                return visitor.visitChildren(self)




    def argument_list(self):

        localctx = ModelicaParser.Argument_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_argument_list)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 477
            self.argument()
            self.state = 482
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==21:
                self.state = 478
                self.match(ModelicaParser.T__20)
                self.state = 479
                self.argument()
                self.state = 484
                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 ArgumentContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def element_modification_or_replaceable(self):
            return self.getTypedRuleContext(ModelicaParser.Element_modification_or_replaceableContext,0)


        def element_redeclaration(self):
            return self.getTypedRuleContext(ModelicaParser.Element_redeclarationContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_argument

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArgument" ):
                listener.enterArgument(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArgument" ):
                listener.exitArgument(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArgument" ):
                return visitor.visitArgument(self)
            else:
                return visitor.visitChildren(self)




    def argument(self):

        localctx = ModelicaParser.ArgumentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_argument)
        try:
            self.state = 487
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [26, 79, 81, 88]:
                self.enterOuterAlt(localctx, 1)
                self.state = 485
                self.element_modification_or_replaceable()
                pass
            elif token in [84]:
                self.enterOuterAlt(localctx, 2)
                self.state = 486
                self.element_redeclaration()
                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 Element_modification_or_replaceableContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def element_modification(self):
            return self.getTypedRuleContext(ModelicaParser.Element_modificationContext,0)


        def element_replaceable(self):
            return self.getTypedRuleContext(ModelicaParser.Element_replaceableContext,0)


        def EACH(self):
            return self.getToken(ModelicaParser.EACH, 0)

        def FINAL(self):
            return self.getToken(ModelicaParser.FINAL, 0)

        def getRuleIndex(self):
            return ModelicaParser.RULE_element_modification_or_replaceable

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterElement_modification_or_replaceable" ):
                listener.enterElement_modification_or_replaceable(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitElement_modification_or_replaceable" ):
                listener.exitElement_modification_or_replaceable(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitElement_modification_or_replaceable" ):
                return visitor.visitElement_modification_or_replaceable(self)
            else:
                return visitor.visitChildren(self)




    def element_modification_or_replaceable(self):

        localctx = ModelicaParser.Element_modification_or_replaceableContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_element_modification_or_replaceable)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 490
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==79:
                self.state = 489
                self.match(ModelicaParser.EACH)


            self.state = 493
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==81:
                self.state = 492
                self.match(ModelicaParser.FINAL)


            self.state = 497
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [88]:
                self.state = 495
                self.element_modification()
                pass
            elif token in [26]:
                self.state = 496
                self.element_replaceable()
                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 Element_modificationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def component_reference(self):
            return self.getTypedRuleContext(ModelicaParser.Component_referenceContext,0)


        def string_comment(self):
            return self.getTypedRuleContext(ModelicaParser.String_commentContext,0)


        def modification(self):
            return self.getTypedRuleContext(ModelicaParser.ModificationContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_element_modification

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterElement_modification" ):
                listener.enterElement_modification(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitElement_modification" ):
                listener.exitElement_modification(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitElement_modification" ):
                return visitor.visitElement_modification(self)
            else:
                return visitor.visitChildren(self)




    def element_modification(self):

        localctx = ModelicaParser.Element_modificationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 66, self.RULE_element_modification)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 499
            self.component_reference()
            self.state = 501
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & 2199023419392) != 0):
                self.state = 500
                self.modification()


            self.state = 503
            self.string_comment()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Element_redeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def REDECLARE(self):
            return self.getToken(ModelicaParser.REDECLARE, 0)

        def element_replaceable(self):
            return self.getTypedRuleContext(ModelicaParser.Element_replaceableContext,0)


        def EACH(self):
            return self.getToken(ModelicaParser.EACH, 0)

        def FINAL(self):
            return self.getToken(ModelicaParser.FINAL, 0)

        def short_class_definition(self):
            return self.getTypedRuleContext(ModelicaParser.Short_class_definitionContext,0)


        def component_clause1(self):
            return self.getTypedRuleContext(ModelicaParser.Component_clause1Context,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_element_redeclaration

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterElement_redeclaration" ):
                listener.enterElement_redeclaration(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitElement_redeclaration" ):
                listener.exitElement_redeclaration(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitElement_redeclaration" ):
                return visitor.visitElement_redeclaration(self)
            else:
                return visitor.visitChildren(self)




    def element_redeclaration(self):

        localctx = ModelicaParser.Element_redeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 68, self.RULE_element_redeclaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 505
            self.match(ModelicaParser.REDECLARE)
            self.state = 507
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==79:
                self.state = 506
                self.match(ModelicaParser.EACH)


            self.state = 510
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==81:
                self.state = 509
                self.match(ModelicaParser.FINAL)


            self.state = 517
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 33, 34, 35, 36, 37, 38, 39, 80, 88]:
                self.state = 514
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 80]:
                    self.state = 512
                    self.short_class_definition()
                    pass
                elif token in [33, 34, 35, 36, 37, 38, 39, 88]:
                    self.state = 513
                    self.component_clause1()
                    pass
                else:
                    raise NoViableAltException(self)

                pass
            elif token in [26]:
                self.state = 516
                self.element_replaceable()
                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 Element_replaceableContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def short_class_definition(self):
            return self.getTypedRuleContext(ModelicaParser.Short_class_definitionContext,0)


        def component_clause1(self):
            return self.getTypedRuleContext(ModelicaParser.Component_clause1Context,0)


        def constraining_clause(self):
            return self.getTypedRuleContext(ModelicaParser.Constraining_clauseContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_element_replaceable

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterElement_replaceable" ):
                listener.enterElement_replaceable(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitElement_replaceable" ):
                listener.exitElement_replaceable(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitElement_replaceable" ):
                return visitor.visitElement_replaceable(self)
            else:
                return visitor.visitChildren(self)




    def element_replaceable(self):

        localctx = ModelicaParser.Element_replaceableContext(self, self._ctx, self.state)
        self.enterRule(localctx, 70, self.RULE_element_replaceable)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 519
            self.match(ModelicaParser.T__25)
            self.state = 522
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 80]:
                self.state = 520
                self.short_class_definition()
                pass
            elif token in [33, 34, 35, 36, 37, 38, 39, 88]:
                self.state = 521
                self.component_clause1()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 525
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==32:
                self.state = 524
                self.constraining_clause()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Component_clause1Context(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def type_prefix(self):
            return self.getTypedRuleContext(ModelicaParser.Type_prefixContext,0)


        def type_specifier(self):
            return self.getTypedRuleContext(ModelicaParser.Type_specifierContext,0)


        def component_declaration1(self):
            return self.getTypedRuleContext(ModelicaParser.Component_declaration1Context,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_component_clause1

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterComponent_clause1" ):
                listener.enterComponent_clause1(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitComponent_clause1" ):
                listener.exitComponent_clause1(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitComponent_clause1" ):
                return visitor.visitComponent_clause1(self)
            else:
                return visitor.visitChildren(self)




    def component_clause1(self):

        localctx = ModelicaParser.Component_clause1Context(self, self._ctx, self.state)
        self.enterRule(localctx, 72, self.RULE_component_clause1)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 527
            self.type_prefix()
            self.state = 528
            self.type_specifier()
            self.state = 529
            self.component_declaration1()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Component_declaration1Context(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def declaration(self):
            return self.getTypedRuleContext(ModelicaParser.DeclarationContext,0)


        def comment(self):
            return self.getTypedRuleContext(ModelicaParser.CommentContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_component_declaration1

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterComponent_declaration1" ):
                listener.enterComponent_declaration1(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitComponent_declaration1" ):
                listener.exitComponent_declaration1(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitComponent_declaration1" ):
                return visitor.visitComponent_declaration1(self)
            else:
                return visitor.visitChildren(self)




    def component_declaration1(self):

        localctx = ModelicaParser.Component_declaration1Context(self, self._ctx, self.state)
        self.enterRule(localctx, 74, self.RULE_component_declaration1)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 531
            self.declaration()
            self.state = 532
            self.comment()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Short_class_definitionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def class_prefixes(self):
            return self.getTypedRuleContext(ModelicaParser.Class_prefixesContext,0)


        def IDENT(self):
            return self.getToken(ModelicaParser.IDENT, 0)

        def base_prefix(self):
            return self.getTypedRuleContext(ModelicaParser.Base_prefixContext,0)


        def component_reference(self):
            return self.getTypedRuleContext(ModelicaParser.Component_referenceContext,0)


        def comment(self):
            return self.getTypedRuleContext(ModelicaParser.CommentContext,0)


        def array_subscripts(self):
            return self.getTypedRuleContext(ModelicaParser.Array_subscriptsContext,0)


        def class_modification(self):
            return self.getTypedRuleContext(ModelicaParser.Class_modificationContext,0)


        def enum_list(self):
            return self.getTypedRuleContext(ModelicaParser.Enum_listContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_short_class_definition

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterShort_class_definition" ):
                listener.enterShort_class_definition(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitShort_class_definition" ):
                listener.exitShort_class_definition(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitShort_class_definition" ):
                return visitor.visitShort_class_definition(self)
            else:
                return visitor.visitChildren(self)




    def short_class_definition(self):

        localctx = ModelicaParser.Short_class_definitionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 76, self.RULE_short_class_definition)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 534
            self.class_prefixes()
            self.state = 535
            self.match(ModelicaParser.IDENT)
            self.state = 536
            self.match(ModelicaParser.T__14)
            self.state = 557
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [33, 34, 35, 36, 37, 38, 39, 88]:
                self.state = 537
                self.base_prefix()
                self.state = 538
                self.component_reference()
                self.state = 540
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==76:
                    self.state = 539
                    self.array_subscripts()


                self.state = 543
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==17:
                    self.state = 542
                    self.class_modification()


                self.state = 545
                self.comment()
                pass
            elif token in [16]:
                self.state = 547
                self.match(ModelicaParser.T__15)
                self.state = 548
                self.match(ModelicaParser.T__16)
                self.state = 553
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [19, 88]:
                    self.state = 550
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==88:
                        self.state = 549
                        self.enum_list()


                    pass
                elif token in [18]:
                    self.state = 552
                    self.match(ModelicaParser.T__17)
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 555
                self.match(ModelicaParser.T__18)
                self.state = 556
                self.comment()
                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 Equation_blockContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def equation(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.EquationContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.EquationContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_equation_block

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEquation_block" ):
                listener.enterEquation_block(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEquation_block" ):
                listener.exitEquation_block(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEquation_block" ):
                return visitor.visitEquation_block(self)
            else:
                return visitor.visitChildren(self)




    def equation_block(self):

        localctx = ModelicaParser.Equation_blockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 78, self.RULE_equation_block)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 564
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,76,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 559
                    self.equation()
                    self.state = 560
                    self.match(ModelicaParser.T__0) 
                self.state = 566
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,76,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 Equation_sectionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def equation_block(self):
            return self.getTypedRuleContext(ModelicaParser.Equation_blockContext,0)


        def INITIAL(self):
            return self.getToken(ModelicaParser.INITIAL, 0)

        def getRuleIndex(self):
            return ModelicaParser.RULE_equation_section

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEquation_section" ):
                listener.enterEquation_section(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEquation_section" ):
                listener.exitEquation_section(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEquation_section" ):
                return visitor.visitEquation_section(self)
            else:
                return visitor.visitChildren(self)




    def equation_section(self):

        localctx = ModelicaParser.Equation_sectionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 80, self.RULE_equation_section)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 568
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==87:
                self.state = 567
                self.match(ModelicaParser.INITIAL)


            self.state = 570
            self.match(ModelicaParser.T__41)
            self.state = 571
            self.equation_block()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Statement_blockContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def statement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.StatementContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.StatementContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_statement_block

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStatement_block" ):
                listener.enterStatement_block(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStatement_block" ):
                listener.exitStatement_block(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStatement_block" ):
                return visitor.visitStatement_block(self)
            else:
                return visitor.visitChildren(self)




    def statement_block(self):

        localctx = ModelicaParser.Statement_blockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 82, self.RULE_statement_block)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 578
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & 14127624905424896) != 0) or _la==88:
                self.state = 573
                self.statement()
                self.state = 574
                self.match(ModelicaParser.T__0)
                self.state = 580
                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 Algorithm_sectionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def statement_block(self):
            return self.getTypedRuleContext(ModelicaParser.Statement_blockContext,0)


        def INITIAL(self):
            return self.getToken(ModelicaParser.INITIAL, 0)

        def getRuleIndex(self):
            return ModelicaParser.RULE_algorithm_section

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAlgorithm_section" ):
                listener.enterAlgorithm_section(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAlgorithm_section" ):
                listener.exitAlgorithm_section(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAlgorithm_section" ):
                return visitor.visitAlgorithm_section(self)
            else:
                return visitor.visitChildren(self)




    def algorithm_section(self):

        localctx = ModelicaParser.Algorithm_sectionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 84, self.RULE_algorithm_section)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 582
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==87:
                self.state = 581
                self.match(ModelicaParser.INITIAL)


            self.state = 584
            self.match(ModelicaParser.T__42)
            self.state = 585
            self.statement_block()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Equation_optionsContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return ModelicaParser.RULE_equation_options

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class Equation_whenContext(Equation_optionsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Equation_optionsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def when_equation(self):
            return self.getTypedRuleContext(ModelicaParser.When_equationContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEquation_when" ):
                listener.enterEquation_when(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEquation_when" ):
                listener.exitEquation_when(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEquation_when" ):
                return visitor.visitEquation_when(self)
            else:
                return visitor.visitChildren(self)


    class Equation_connect_clauseContext(Equation_optionsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Equation_optionsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def connect_clause(self):
            return self.getTypedRuleContext(ModelicaParser.Connect_clauseContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEquation_connect_clause" ):
                listener.enterEquation_connect_clause(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEquation_connect_clause" ):
                listener.exitEquation_connect_clause(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEquation_connect_clause" ):
                return visitor.visitEquation_connect_clause(self)
            else:
                return visitor.visitChildren(self)


    class Equation_forContext(Equation_optionsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Equation_optionsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def for_equation(self):
            return self.getTypedRuleContext(ModelicaParser.For_equationContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEquation_for" ):
                listener.enterEquation_for(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEquation_for" ):
                listener.exitEquation_for(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEquation_for" ):
                return visitor.visitEquation_for(self)
            else:
                return visitor.visitChildren(self)


    class Equation_functionContext(Equation_optionsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Equation_optionsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def name(self):
            return self.getTypedRuleContext(ModelicaParser.NameContext,0)

        def function_call_args(self):
            return self.getTypedRuleContext(ModelicaParser.Function_call_argsContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEquation_function" ):
                listener.enterEquation_function(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEquation_function" ):
                listener.exitEquation_function(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEquation_function" ):
                return visitor.visitEquation_function(self)
            else:
                return visitor.visitChildren(self)


    class Equation_simpleContext(Equation_optionsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Equation_optionsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def simple_expression(self):
            return self.getTypedRuleContext(ModelicaParser.Simple_expressionContext,0)

        def expression(self):
            return self.getTypedRuleContext(ModelicaParser.ExpressionContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEquation_simple" ):
                listener.enterEquation_simple(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEquation_simple" ):
                listener.exitEquation_simple(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEquation_simple" ):
                return visitor.visitEquation_simple(self)
            else:
                return visitor.visitChildren(self)


    class Equation_ifContext(Equation_optionsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Equation_optionsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def if_equation(self):
            return self.getTypedRuleContext(ModelicaParser.If_equationContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEquation_if" ):
                listener.enterEquation_if(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEquation_if" ):
                listener.exitEquation_if(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEquation_if" ):
                return visitor.visitEquation_if(self)
            else:
                return visitor.visitChildren(self)



    def equation_options(self):

        localctx = ModelicaParser.Equation_optionsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 86, self.RULE_equation_options)
        try:
            self.state = 598
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,80,self._ctx)
            if la_ == 1:
                localctx = ModelicaParser.Equation_simpleContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 587
                self.simple_expression()
                self.state = 588
                self.match(ModelicaParser.T__14)
                self.state = 589
                self.expression()
                pass

            elif la_ == 2:
                localctx = ModelicaParser.Equation_ifContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 591
                self.if_equation()
                pass

            elif la_ == 3:
                localctx = ModelicaParser.Equation_forContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 592
                self.for_equation()
                pass

            elif la_ == 4:
                localctx = ModelicaParser.Equation_connect_clauseContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 593
                self.connect_clause()
                pass

            elif la_ == 5:
                localctx = ModelicaParser.Equation_whenContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 594
                self.when_equation()
                pass

            elif la_ == 6:
                localctx = ModelicaParser.Equation_functionContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 595
                self.name()
                self.state = 596
                self.function_call_args()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class EquationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def equation_options(self):
            return self.getTypedRuleContext(ModelicaParser.Equation_optionsContext,0)


        def comment(self):
            return self.getTypedRuleContext(ModelicaParser.CommentContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_equation

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEquation" ):
                listener.enterEquation(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEquation" ):
                listener.exitEquation(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEquation" ):
                return visitor.visitEquation(self)
            else:
                return visitor.visitChildren(self)




    def equation(self):

        localctx = ModelicaParser.EquationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 88, self.RULE_equation)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 600
            self.equation_options()
            self.state = 601
            self.comment()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Statement_optionsContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return ModelicaParser.RULE_statement_options

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class Statement_breakContext(Statement_optionsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Statement_optionsContext
            super().__init__(parser)
            self.copyFrom(ctx)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStatement_break" ):
                listener.enterStatement_break(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStatement_break" ):
                listener.exitStatement_break(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStatement_break" ):
                return visitor.visitStatement_break(self)
            else:
                return visitor.visitChildren(self)


    class Statement_whileContext(Statement_optionsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Statement_optionsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def while_statement(self):
            return self.getTypedRuleContext(ModelicaParser.While_statementContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStatement_while" ):
                listener.enterStatement_while(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStatement_while" ):
                listener.exitStatement_while(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStatement_while" ):
                return visitor.visitStatement_while(self)
            else:
                return visitor.visitChildren(self)


    class Statement_component_functionContext(Statement_optionsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Statement_optionsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def component_reference(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Component_referenceContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Component_referenceContext,i)

        def function_call_args(self):
            return self.getTypedRuleContext(ModelicaParser.Function_call_argsContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStatement_component_function" ):
                listener.enterStatement_component_function(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStatement_component_function" ):
                listener.exitStatement_component_function(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStatement_component_function" ):
                return visitor.visitStatement_component_function(self)
            else:
                return visitor.visitChildren(self)


    class Statement_returnContext(Statement_optionsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Statement_optionsContext
            super().__init__(parser)
            self.copyFrom(ctx)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStatement_return" ):
                listener.enterStatement_return(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStatement_return" ):
                listener.exitStatement_return(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStatement_return" ):
                return visitor.visitStatement_return(self)
            else:
                return visitor.visitChildren(self)


    class Statement_forContext(Statement_optionsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Statement_optionsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def for_statement(self):
            return self.getTypedRuleContext(ModelicaParser.For_statementContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStatement_for" ):
                listener.enterStatement_for(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStatement_for" ):
                listener.exitStatement_for(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStatement_for" ):
                return visitor.visitStatement_for(self)
            else:
                return visitor.visitChildren(self)


    class Statement_whenContext(Statement_optionsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Statement_optionsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def when_statement(self):
            return self.getTypedRuleContext(ModelicaParser.When_statementContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStatement_when" ):
                listener.enterStatement_when(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStatement_when" ):
                listener.exitStatement_when(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStatement_when" ):
                return visitor.visitStatement_when(self)
            else:
                return visitor.visitChildren(self)


    class Statement_ifContext(Statement_optionsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Statement_optionsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def if_statement(self):
            return self.getTypedRuleContext(ModelicaParser.If_statementContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStatement_if" ):
                listener.enterStatement_if(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStatement_if" ):
                listener.exitStatement_if(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStatement_if" ):
                return visitor.visitStatement_if(self)
            else:
                return visitor.visitChildren(self)


    class Statement_component_referenceContext(Statement_optionsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Statement_optionsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def component_reference(self):
            return self.getTypedRuleContext(ModelicaParser.Component_referenceContext,0)

        def expression(self):
            return self.getTypedRuleContext(ModelicaParser.ExpressionContext,0)

        def function_call_args(self):
            return self.getTypedRuleContext(ModelicaParser.Function_call_argsContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStatement_component_reference" ):
                listener.enterStatement_component_reference(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStatement_component_reference" ):
                listener.exitStatement_component_reference(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStatement_component_reference" ):
                return visitor.visitStatement_component_reference(self)
            else:
                return visitor.visitChildren(self)



    def statement_options(self):

        localctx = ModelicaParser.Statement_optionsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 90, self.RULE_statement_options)
        self._la = 0 # Token type
        try:
            self.state = 629
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [88]:
                localctx = ModelicaParser.Statement_component_referenceContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 603
                self.component_reference()
                self.state = 607
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [41]:
                    self.state = 604
                    self.match(ModelicaParser.T__40)
                    self.state = 605
                    self.expression()
                    pass
                elif token in [17]:
                    self.state = 606
                    self.function_call_args()
                    pass
                else:
                    raise NoViableAltException(self)

                pass
            elif token in [17]:
                localctx = ModelicaParser.Statement_component_functionContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 609
                self.match(ModelicaParser.T__16)
                self.state = 610
                self.component_reference()
                self.state = 615
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==21:
                    self.state = 611
                    self.match(ModelicaParser.T__20)
                    self.state = 612
                    self.component_reference()
                    self.state = 617
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 618
                self.match(ModelicaParser.T__18)
                self.state = 619
                self.match(ModelicaParser.T__40)
                self.state = 620
                self.component_reference()
                self.state = 621
                self.function_call_args()
                pass
            elif token in [44]:
                localctx = ModelicaParser.Statement_breakContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 623
                self.match(ModelicaParser.T__43)
                pass
            elif token in [45]:
                localctx = ModelicaParser.Statement_returnContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 624
                self.match(ModelicaParser.T__44)
                pass
            elif token in [40]:
                localctx = ModelicaParser.Statement_ifContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 625
                self.if_statement()
                pass
            elif token in [49]:
                localctx = ModelicaParser.Statement_forContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 626
                self.for_statement()
                pass
            elif token in [52]:
                localctx = ModelicaParser.Statement_whileContext(self, localctx)
                self.enterOuterAlt(localctx, 7)
                self.state = 627
                self.while_statement()
                pass
            elif token in [53]:
                localctx = ModelicaParser.Statement_whenContext(self, localctx)
                self.enterOuterAlt(localctx, 8)
                self.state = 628
                self.when_statement()
                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 StatementContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def statement_options(self):
            return self.getTypedRuleContext(ModelicaParser.Statement_optionsContext,0)


        def comment(self):
            return self.getTypedRuleContext(ModelicaParser.CommentContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_statement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStatement" ):
                listener.enterStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStatement" ):
                listener.exitStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStatement" ):
                return visitor.visitStatement(self)
            else:
                return visitor.visitChildren(self)




    def statement(self):

        localctx = ModelicaParser.StatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 92, self.RULE_statement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 631
            self.statement_options()
            self.state = 632
            self.comment()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class If_equationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self._expression = None # ExpressionContext
            self.conditions = list() # of ExpressionContexts
            self._equation_block = None # Equation_blockContext
            self.blocks = list() # of Equation_blockContexts

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ExpressionContext,i)


        def equation_block(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Equation_blockContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Equation_blockContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_if_equation

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterIf_equation" ):
                listener.enterIf_equation(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitIf_equation" ):
                listener.exitIf_equation(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIf_equation" ):
                return visitor.visitIf_equation(self)
            else:
                return visitor.visitChildren(self)




    def if_equation(self):

        localctx = ModelicaParser.If_equationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 94, self.RULE_if_equation)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 634
            self.match(ModelicaParser.T__39)
            self.state = 635
            localctx._expression = self.expression()
            localctx.conditions.append(localctx._expression)
            self.state = 636
            self.match(ModelicaParser.T__45)
            self.state = 637
            localctx._equation_block = self.equation_block()
            localctx.blocks.append(localctx._equation_block)
            self.state = 645
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==47:
                self.state = 638
                self.match(ModelicaParser.T__46)
                self.state = 639
                localctx._expression = self.expression()
                localctx.conditions.append(localctx._expression)
                self.state = 640
                self.match(ModelicaParser.T__45)
                self.state = 641
                localctx._equation_block = self.equation_block()
                localctx.blocks.append(localctx._equation_block)
                self.state = 647
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 650
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==48:
                self.state = 648
                self.match(ModelicaParser.T__47)
                self.state = 649
                localctx._equation_block = self.equation_block()
                localctx.blocks.append(localctx._equation_block)


            self.state = 652
            self.match(ModelicaParser.T__13)
            self.state = 653
            self.match(ModelicaParser.T__39)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class If_statementContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self._expression = None # ExpressionContext
            self.conditions = list() # of ExpressionContexts
            self._statement_block = None # Statement_blockContext
            self.blocks = list() # of Statement_blockContexts

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ExpressionContext,i)


        def statement_block(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Statement_blockContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Statement_blockContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_if_statement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterIf_statement" ):
                listener.enterIf_statement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitIf_statement" ):
                listener.exitIf_statement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIf_statement" ):
                return visitor.visitIf_statement(self)
            else:
                return visitor.visitChildren(self)




    def if_statement(self):

        localctx = ModelicaParser.If_statementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 96, self.RULE_if_statement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 655
            self.match(ModelicaParser.T__39)
            self.state = 656
            localctx._expression = self.expression()
            localctx.conditions.append(localctx._expression)
            self.state = 657
            self.match(ModelicaParser.T__45)
            self.state = 658
            localctx._statement_block = self.statement_block()
            localctx.blocks.append(localctx._statement_block)
            self.state = 666
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==47:
                self.state = 659
                self.match(ModelicaParser.T__46)
                self.state = 660
                localctx._expression = self.expression()
                localctx.conditions.append(localctx._expression)
                self.state = 661
                self.match(ModelicaParser.T__45)
                self.state = 662
                localctx._statement_block = self.statement_block()
                localctx.blocks.append(localctx._statement_block)
                self.state = 668
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 671
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==48:
                self.state = 669
                self.match(ModelicaParser.T__47)
                self.state = 670
                localctx._statement_block = self.statement_block()
                localctx.blocks.append(localctx._statement_block)


            self.state = 673
            self.match(ModelicaParser.T__13)
            self.state = 674
            self.match(ModelicaParser.T__39)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class For_equationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.indices = None # For_indicesContext
            self.block = None # Equation_blockContext

        def for_indices(self):
            return self.getTypedRuleContext(ModelicaParser.For_indicesContext,0)


        def equation_block(self):
            return self.getTypedRuleContext(ModelicaParser.Equation_blockContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_for_equation

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFor_equation" ):
                listener.enterFor_equation(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFor_equation" ):
                listener.exitFor_equation(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFor_equation" ):
                return visitor.visitFor_equation(self)
            else:
                return visitor.visitChildren(self)




    def for_equation(self):

        localctx = ModelicaParser.For_equationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 98, self.RULE_for_equation)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 676
            self.match(ModelicaParser.T__48)
            self.state = 677
            localctx.indices = self.for_indices()
            self.state = 678
            self.match(ModelicaParser.T__49)
            self.state = 679
            localctx.block = self.equation_block()
            self.state = 680
            self.match(ModelicaParser.T__13)
            self.state = 681
            self.match(ModelicaParser.T__48)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class For_statementContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.indices = None # For_indicesContext
            self.block = None # Statement_blockContext

        def for_indices(self):
            return self.getTypedRuleContext(ModelicaParser.For_indicesContext,0)


        def statement_block(self):
            return self.getTypedRuleContext(ModelicaParser.Statement_blockContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_for_statement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFor_statement" ):
                listener.enterFor_statement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFor_statement" ):
                listener.exitFor_statement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFor_statement" ):
                return visitor.visitFor_statement(self)
            else:
                return visitor.visitChildren(self)




    def for_statement(self):

        localctx = ModelicaParser.For_statementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 100, self.RULE_for_statement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 683
            self.match(ModelicaParser.T__48)
            self.state = 684
            localctx.indices = self.for_indices()
            self.state = 685
            self.match(ModelicaParser.T__49)
            self.state = 686
            localctx.block = self.statement_block()
            self.state = 687
            self.match(ModelicaParser.T__13)
            self.state = 688
            self.match(ModelicaParser.T__48)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class For_indicesContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def for_index(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.For_indexContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.For_indexContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_for_indices

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFor_indices" ):
                listener.enterFor_indices(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFor_indices" ):
                listener.exitFor_indices(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFor_indices" ):
                return visitor.visitFor_indices(self)
            else:
                return visitor.visitChildren(self)




    def for_indices(self):

        localctx = ModelicaParser.For_indicesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 102, self.RULE_for_indices)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 690
            self.for_index()
            self.state = 695
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,88,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 691
                    self.match(ModelicaParser.T__20)
                    self.state = 692
                    self.for_index() 
                self.state = 697
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,88,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 For_indexContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENT(self):
            return self.getToken(ModelicaParser.IDENT, 0)

        def expression(self):
            return self.getTypedRuleContext(ModelicaParser.ExpressionContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_for_index

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFor_index" ):
                listener.enterFor_index(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFor_index" ):
                listener.exitFor_index(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFor_index" ):
                return visitor.visitFor_index(self)
            else:
                return visitor.visitChildren(self)




    def for_index(self):

        localctx = ModelicaParser.For_indexContext(self, self._ctx, self.state)
        self.enterRule(localctx, 104, self.RULE_for_index)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 698
            self.match(ModelicaParser.IDENT)
            self.state = 701
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==51:
                self.state = 699
                self.match(ModelicaParser.T__50)
                self.state = 700
                self.expression()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class While_statementContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.condition = None # ExpressionContext
            self.block = None # Statement_blockContext

        def expression(self):
            return self.getTypedRuleContext(ModelicaParser.ExpressionContext,0)


        def statement_block(self):
            return self.getTypedRuleContext(ModelicaParser.Statement_blockContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_while_statement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterWhile_statement" ):
                listener.enterWhile_statement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitWhile_statement" ):
                listener.exitWhile_statement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitWhile_statement" ):
                return visitor.visitWhile_statement(self)
            else:
                return visitor.visitChildren(self)




    def while_statement(self):

        localctx = ModelicaParser.While_statementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 106, self.RULE_while_statement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 703
            self.match(ModelicaParser.T__51)
            self.state = 704
            localctx.condition = self.expression()
            self.state = 705
            self.match(ModelicaParser.T__49)
            self.state = 706
            localctx.block = self.statement_block()
            self.state = 707
            self.match(ModelicaParser.T__13)
            self.state = 708
            self.match(ModelicaParser.T__51)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class When_equationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self._expression = None # ExpressionContext
            self.conditions = list() # of ExpressionContexts
            self._equation_block = None # Equation_blockContext
            self.blocks = list() # of Equation_blockContexts

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ExpressionContext,i)


        def equation_block(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Equation_blockContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Equation_blockContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_when_equation

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterWhen_equation" ):
                listener.enterWhen_equation(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitWhen_equation" ):
                listener.exitWhen_equation(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitWhen_equation" ):
                return visitor.visitWhen_equation(self)
            else:
                return visitor.visitChildren(self)




    def when_equation(self):

        localctx = ModelicaParser.When_equationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 108, self.RULE_when_equation)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 710
            self.match(ModelicaParser.T__52)
            self.state = 711
            localctx._expression = self.expression()
            localctx.conditions.append(localctx._expression)
            self.state = 712
            self.match(ModelicaParser.T__45)
            self.state = 713
            localctx._equation_block = self.equation_block()
            localctx.blocks.append(localctx._equation_block)
            self.state = 721
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==54:
                self.state = 714
                self.match(ModelicaParser.T__53)
                self.state = 715
                localctx._expression = self.expression()
                localctx.conditions.append(localctx._expression)
                self.state = 716
                self.match(ModelicaParser.T__45)
                self.state = 717
                localctx._equation_block = self.equation_block()
                localctx.blocks.append(localctx._equation_block)
                self.state = 723
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 724
            self.match(ModelicaParser.T__13)
            self.state = 725
            self.match(ModelicaParser.T__52)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class When_statementContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self._expression = None # ExpressionContext
            self.conditions = list() # of ExpressionContexts
            self._statement_block = None # Statement_blockContext
            self.blocks = list() # of Statement_blockContexts

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ExpressionContext,i)


        def statement_block(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Statement_blockContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Statement_blockContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_when_statement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterWhen_statement" ):
                listener.enterWhen_statement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitWhen_statement" ):
                listener.exitWhen_statement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitWhen_statement" ):
                return visitor.visitWhen_statement(self)
            else:
                return visitor.visitChildren(self)




    def when_statement(self):

        localctx = ModelicaParser.When_statementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 110, self.RULE_when_statement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 727
            self.match(ModelicaParser.T__52)
            self.state = 728
            localctx._expression = self.expression()
            localctx.conditions.append(localctx._expression)
            self.state = 729
            self.match(ModelicaParser.T__45)
            self.state = 730
            localctx._statement_block = self.statement_block()
            localctx.blocks.append(localctx._statement_block)
            self.state = 738
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==54:
                self.state = 731
                self.match(ModelicaParser.T__53)
                self.state = 732
                localctx._expression = self.expression()
                localctx.conditions.append(localctx._expression)
                self.state = 733
                self.match(ModelicaParser.T__45)
                self.state = 734
                localctx._statement_block = self.statement_block()
                localctx.blocks.append(localctx._statement_block)
                self.state = 740
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 741
            self.match(ModelicaParser.T__13)
            self.state = 742
            self.match(ModelicaParser.T__52)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Connect_clauseContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def component_reference(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Component_referenceContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Component_referenceContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_connect_clause

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterConnect_clause" ):
                listener.enterConnect_clause(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitConnect_clause" ):
                listener.exitConnect_clause(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitConnect_clause" ):
                return visitor.visitConnect_clause(self)
            else:
                return visitor.visitChildren(self)




    def connect_clause(self):

        localctx = ModelicaParser.Connect_clauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 112, self.RULE_connect_clause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 744
            self.match(ModelicaParser.T__54)
            self.state = 745
            self.match(ModelicaParser.T__16)
            self.state = 746
            self.component_reference()
            self.state = 747
            self.match(ModelicaParser.T__20)
            self.state = 748
            self.component_reference()
            self.state = 749
            self.match(ModelicaParser.T__18)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return ModelicaParser.RULE_expression

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class Expression_ifContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.ExpressionContext
            super().__init__(parser)
            self._expression = None # ExpressionContext
            self.conditions = list() # of ExpressionContexts
            self.blocks = list() # of ExpressionContexts
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ExpressionContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpression_if" ):
                listener.enterExpression_if(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpression_if" ):
                listener.exitExpression_if(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpression_if" ):
                return visitor.visitExpression_if(self)
            else:
                return visitor.visitChildren(self)


    class Expression_simpleContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def simple_expression(self):
            return self.getTypedRuleContext(ModelicaParser.Simple_expressionContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpression_simple" ):
                listener.enterExpression_simple(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpression_simple" ):
                listener.exitExpression_simple(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpression_simple" ):
                return visitor.visitExpression_simple(self)
            else:
                return visitor.visitChildren(self)



    def expression(self):

        localctx = ModelicaParser.ExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 114, self.RULE_expression)
        self._la = 0 # Token type
        try:
            self.state = 769
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [14, 17, 20, 30, 56, 71, 74, 75, 76, 87, 88, 89, 90]:
                localctx = ModelicaParser.Expression_simpleContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 751
                self.simple_expression()
                pass
            elif token in [40]:
                localctx = ModelicaParser.Expression_ifContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 752
                self.match(ModelicaParser.T__39)
                self.state = 753
                localctx._expression = self.expression()
                localctx.conditions.append(localctx._expression)
                self.state = 754
                self.match(ModelicaParser.T__45)
                self.state = 755
                localctx._expression = self.expression()
                localctx.blocks.append(localctx._expression)
                self.state = 763
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==47:
                    self.state = 756
                    self.match(ModelicaParser.T__46)
                    self.state = 757
                    localctx._expression = self.expression()
                    localctx.conditions.append(localctx._expression)
                    self.state = 758
                    self.match(ModelicaParser.T__45)
                    self.state = 759
                    localctx._expression = self.expression()
                    localctx.blocks.append(localctx._expression)
                    self.state = 765
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 766
                self.match(ModelicaParser.T__47)
                self.state = 767
                localctx._expression = self.expression()
                localctx.blocks.append(localctx._expression)
                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 Simple_expressionContext(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(ModelicaParser.ExprContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ExprContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_simple_expression

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSimple_expression" ):
                listener.enterSimple_expression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitSimple_expression" ):
                listener.exitSimple_expression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitSimple_expression" ):
                return visitor.visitSimple_expression(self)
            else:
                return visitor.visitChildren(self)




    def simple_expression(self):

        localctx = ModelicaParser.Simple_expressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 116, self.RULE_simple_expression)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 771
            self.expr(0)
            self.state = 778
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==18:
                self.state = 772
                self.match(ModelicaParser.T__17)
                self.state = 773
                self.expr(0)
                self.state = 776
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==18:
                    self.state = 774
                    self.match(ModelicaParser.T__17)
                    self.state = 775
                    self.expr(0)




        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 getRuleIndex(self):
            return ModelicaParser.RULE_expr

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)


    class Expr_negContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.ExprContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expr(self):
            return self.getTypedRuleContext(ModelicaParser.ExprContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpr_neg" ):
                listener.enterExpr_neg(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpr_neg" ):
                listener.exitExpr_neg(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpr_neg" ):
                return visitor.visitExpr_neg(self)
            else:
                return visitor.visitChildren(self)


    class Expr_addContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.ExprContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.ExprContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ExprContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpr_add" ):
                listener.enterExpr_add(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpr_add" ):
                listener.exitExpr_add(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpr_add" ):
                return visitor.visitExpr_add(self)
            else:
                return visitor.visitChildren(self)


    class Expr_expContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.ExprContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def primary(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.PrimaryContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.PrimaryContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpr_exp" ):
                listener.enterExpr_exp(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpr_exp" ):
                listener.exitExpr_exp(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpr_exp" ):
                return visitor.visitExpr_exp(self)
            else:
                return visitor.visitChildren(self)


    class Expr_orContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.ExprContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ExprContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpr_or" ):
                listener.enterExpr_or(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpr_or" ):
                listener.exitExpr_or(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpr_or" ):
                return visitor.visitExpr_or(self)
            else:
                return visitor.visitChildren(self)


    class Expr_primaryContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def primary(self):
            return self.getTypedRuleContext(ModelicaParser.PrimaryContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpr_primary" ):
                listener.enterExpr_primary(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpr_primary" ):
                listener.exitExpr_primary(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpr_primary" ):
                return visitor.visitExpr_primary(self)
            else:
                return visitor.visitChildren(self)


    class Expr_andContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.ExprContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ExprContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpr_and" ):
                listener.enterExpr_and(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpr_and" ):
                listener.exitExpr_and(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpr_and" ):
                return visitor.visitExpr_and(self)
            else:
                return visitor.visitChildren(self)


    class Expr_relContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.ExprContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.ExprContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ExprContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpr_rel" ):
                listener.enterExpr_rel(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpr_rel" ):
                listener.exitExpr_rel(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpr_rel" ):
                return visitor.visitExpr_rel(self)
            else:
                return visitor.visitChildren(self)


    class Expr_notContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expr(self):
            return self.getTypedRuleContext(ModelicaParser.ExprContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpr_not" ):
                listener.enterExpr_not(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpr_not" ):
                listener.exitExpr_not(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpr_not" ):
                return visitor.visitExpr_not(self)
            else:
                return visitor.visitChildren(self)


    class Expr_mulContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.ExprContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.ExprContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ExprContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpr_mul" ):
                listener.enterExpr_mul(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpr_mul" ):
                listener.exitExpr_mul(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpr_mul" ):
                return visitor.visitExpr_mul(self)
            else:
                return visitor.visitChildren(self)



    def expr(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = ModelicaParser.ExprContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 118
        self.enterRecursionRule(localctx, 118, self.RULE_expr, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 790
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,96,self._ctx)
            if la_ == 1:
                localctx = ModelicaParser.Expr_negContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 781
                localctx.op = self.match(ModelicaParser.T__55)
                self.state = 782
                self.expr(9)
                pass

            elif la_ == 2:
                localctx = ModelicaParser.Expr_expContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 783
                self.primary()
                self.state = 784
                localctx.op = self._input.LT(1)
                _la = self._input.LA(1)
                if not(_la==57 or _la==58):
                    localctx.op = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 785
                self.primary()
                pass

            elif la_ == 3:
                localctx = ModelicaParser.Expr_notContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 787
                self.match(ModelicaParser.T__70)
                self.state = 788
                self.expr(4)
                pass

            elif la_ == 4:
                localctx = ModelicaParser.Expr_primaryContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 789
                self.primary()
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 809
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,98,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 807
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,97,self._ctx)
                    if la_ == 1:
                        localctx = ModelicaParser.Expr_mulContext(self, ModelicaParser.ExprContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 792
                        if not self.precpred(self._ctx, 7):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 7)")
                        self.state = 793
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 4035225266660835328) != 0)):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 794
                        self.expr(8)
                        pass

                    elif la_ == 2:
                        localctx = ModelicaParser.Expr_addContext(self, ModelicaParser.ExprContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 795
                        if not self.precpred(self._ctx, 6):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 6)")
                        self.state = 796
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not(((((_la - 56)) & ~0x3f) == 0 and ((1 << (_la - 56)) & 449) != 0)):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 797
                        self.expr(7)
                        pass

                    elif la_ == 3:
                        localctx = ModelicaParser.Expr_relContext(self, ModelicaParser.ExprContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 798
                        if not self.precpred(self._ctx, 5):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 5)")
                        self.state = 799
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not(((((_la - 65)) & ~0x3f) == 0 and ((1 << (_la - 65)) & 63) != 0)):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 800
                        self.expr(6)
                        pass

                    elif la_ == 4:
                        localctx = ModelicaParser.Expr_andContext(self, ModelicaParser.ExprContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 801
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 802
                        self.match(ModelicaParser.T__71)
                        self.state = 803
                        self.expr(4)
                        pass

                    elif la_ == 5:
                        localctx = ModelicaParser.Expr_orContext(self, ModelicaParser.ExprContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 804
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 805
                        self.match(ModelicaParser.T__72)
                        self.state = 806
                        self.expr(3)
                        pass

             
                self.state = 811
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,98,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 PrimaryContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return ModelicaParser.RULE_primary

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class Primary_stringContext(PrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.PrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def STRING(self):
            return self.getToken(ModelicaParser.STRING, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimary_string" ):
                listener.enterPrimary_string(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimary_string" ):
                listener.exitPrimary_string(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPrimary_string" ):
                return visitor.visitPrimary_string(self)
            else:
                return visitor.visitChildren(self)


    class Primary_endContext(PrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.PrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimary_end" ):
                listener.enterPrimary_end(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimary_end" ):
                listener.exitPrimary_end(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPrimary_end" ):
                return visitor.visitPrimary_end(self)
            else:
                return visitor.visitChildren(self)


    class Primary_output_expression_listContext(PrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.PrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def output_expression_list(self):
            return self.getTypedRuleContext(ModelicaParser.Output_expression_listContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimary_output_expression_list" ):
                listener.enterPrimary_output_expression_list(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimary_output_expression_list" ):
                listener.exitPrimary_output_expression_list(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPrimary_output_expression_list" ):
                return visitor.visitPrimary_output_expression_list(self)
            else:
                return visitor.visitChildren(self)


    class Primary_unsigned_numberContext(PrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.PrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def UNSIGNED_NUMBER(self):
            return self.getToken(ModelicaParser.UNSIGNED_NUMBER, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimary_unsigned_number" ):
                listener.enterPrimary_unsigned_number(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimary_unsigned_number" ):
                listener.exitPrimary_unsigned_number(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPrimary_unsigned_number" ):
                return visitor.visitPrimary_unsigned_number(self)
            else:
                return visitor.visitChildren(self)


    class Primary_function_argumentsContext(PrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.PrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def function_arguments(self):
            return self.getTypedRuleContext(ModelicaParser.Function_argumentsContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimary_function_arguments" ):
                listener.enterPrimary_function_arguments(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimary_function_arguments" ):
                listener.exitPrimary_function_arguments(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPrimary_function_arguments" ):
                return visitor.visitPrimary_function_arguments(self)
            else:
                return visitor.visitChildren(self)


    class Primary_falseContext(PrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.PrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimary_false" ):
                listener.enterPrimary_false(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimary_false" ):
                listener.exitPrimary_false(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPrimary_false" ):
                return visitor.visitPrimary_false(self)
            else:
                return visitor.visitChildren(self)


    class Primary_derivativeContext(PrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.PrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def function_call_args(self):
            return self.getTypedRuleContext(ModelicaParser.Function_call_argsContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimary_derivative" ):
                listener.enterPrimary_derivative(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimary_derivative" ):
                listener.exitPrimary_derivative(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPrimary_derivative" ):
                return visitor.visitPrimary_derivative(self)
            else:
                return visitor.visitChildren(self)


    class Primary_component_referenceContext(PrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.PrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def component_reference(self):
            return self.getTypedRuleContext(ModelicaParser.Component_referenceContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimary_component_reference" ):
                listener.enterPrimary_component_reference(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimary_component_reference" ):
                listener.exitPrimary_component_reference(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPrimary_component_reference" ):
                return visitor.visitPrimary_component_reference(self)
            else:
                return visitor.visitChildren(self)


    class Primary_expression_listContext(PrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.PrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression_list(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Expression_listContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Expression_listContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimary_expression_list" ):
                listener.enterPrimary_expression_list(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimary_expression_list" ):
                listener.exitPrimary_expression_list(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPrimary_expression_list" ):
                return visitor.visitPrimary_expression_list(self)
            else:
                return visitor.visitChildren(self)


    class Primary_trueContext(PrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.PrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimary_true" ):
                listener.enterPrimary_true(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimary_true" ):
                listener.exitPrimary_true(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPrimary_true" ):
                return visitor.visitPrimary_true(self)
            else:
                return visitor.visitChildren(self)


    class Primary_functionContext(PrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.PrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def component_reference(self):
            return self.getTypedRuleContext(ModelicaParser.Component_referenceContext,0)

        def function_call_args(self):
            return self.getTypedRuleContext(ModelicaParser.Function_call_argsContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimary_function" ):
                listener.enterPrimary_function(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimary_function" ):
                listener.exitPrimary_function(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPrimary_function" ):
                return visitor.visitPrimary_function(self)
            else:
                return visitor.visitChildren(self)


    class Primary_initialContext(PrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.PrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def INITIAL(self):
            return self.getToken(ModelicaParser.INITIAL, 0)
        def function_call_args(self):
            return self.getTypedRuleContext(ModelicaParser.Function_call_argsContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimary_initial" ):
                listener.enterPrimary_initial(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimary_initial" ):
                listener.exitPrimary_initial(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPrimary_initial" ):
                return visitor.visitPrimary_initial(self)
            else:
                return visitor.visitChildren(self)



    def primary(self):

        localctx = ModelicaParser.PrimaryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 120, self.RULE_primary)
        self._la = 0 # Token type
        try:
            self.state = 844
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,100,self._ctx)
            if la_ == 1:
                localctx = ModelicaParser.Primary_unsigned_numberContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 812
                self.match(ModelicaParser.UNSIGNED_NUMBER)
                pass

            elif la_ == 2:
                localctx = ModelicaParser.Primary_stringContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 813
                self.match(ModelicaParser.STRING)
                pass

            elif la_ == 3:
                localctx = ModelicaParser.Primary_falseContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 814
                self.match(ModelicaParser.T__73)
                pass

            elif la_ == 4:
                localctx = ModelicaParser.Primary_trueContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 815
                self.match(ModelicaParser.T__74)
                pass

            elif la_ == 5:
                localctx = ModelicaParser.Primary_functionContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 816
                self.component_reference()
                self.state = 817
                self.function_call_args()
                pass

            elif la_ == 6:
                localctx = ModelicaParser.Primary_derivativeContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 819
                self.match(ModelicaParser.T__19)
                self.state = 820
                self.function_call_args()
                pass

            elif la_ == 7:
                localctx = ModelicaParser.Primary_initialContext(self, localctx)
                self.enterOuterAlt(localctx, 7)
                self.state = 821
                self.match(ModelicaParser.INITIAL)
                self.state = 822
                self.function_call_args()
                pass

            elif la_ == 8:
                localctx = ModelicaParser.Primary_component_referenceContext(self, localctx)
                self.enterOuterAlt(localctx, 8)
                self.state = 823
                self.component_reference()
                pass

            elif la_ == 9:
                localctx = ModelicaParser.Primary_output_expression_listContext(self, localctx)
                self.enterOuterAlt(localctx, 9)
                self.state = 824
                self.match(ModelicaParser.T__16)
                self.state = 825
                self.output_expression_list()
                self.state = 826
                self.match(ModelicaParser.T__18)
                pass

            elif la_ == 10:
                localctx = ModelicaParser.Primary_expression_listContext(self, localctx)
                self.enterOuterAlt(localctx, 10)
                self.state = 828
                self.match(ModelicaParser.T__75)
                self.state = 829
                self.expression_list()
                self.state = 834
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==1:
                    self.state = 830
                    self.match(ModelicaParser.T__0)
                    self.state = 831
                    self.expression_list()
                    self.state = 836
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 837
                self.match(ModelicaParser.T__76)
                pass

            elif la_ == 11:
                localctx = ModelicaParser.Primary_function_argumentsContext(self, localctx)
                self.enterOuterAlt(localctx, 11)
                self.state = 839
                self.match(ModelicaParser.T__29)
                self.state = 840
                self.function_arguments()
                self.state = 841
                self.match(ModelicaParser.T__30)
                pass

            elif la_ == 12:
                localctx = ModelicaParser.Primary_endContext(self, localctx)
                self.enterOuterAlt(localctx, 12)
                self.state = 843
                self.match(ModelicaParser.T__13)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class NameContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENT(self, i:int=None):
            if i is None:
                return self.getTokens(ModelicaParser.IDENT)
            else:
                return self.getToken(ModelicaParser.IDENT, i)

        def getRuleIndex(self):
            return ModelicaParser.RULE_name

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterName" ):
                listener.enterName(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitName" ):
                listener.exitName(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitName" ):
                return visitor.visitName(self)
            else:
                return visitor.visitChildren(self)




    def name(self):

        localctx = ModelicaParser.NameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 122, self.RULE_name)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 847
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==28:
                self.state = 846
                self.match(ModelicaParser.T__27)


            self.state = 849
            self.match(ModelicaParser.IDENT)
            self.state = 854
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==28:
                self.state = 850
                self.match(ModelicaParser.T__27)
                self.state = 851
                self.match(ModelicaParser.IDENT)
                self.state = 856
                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 Component_reference_elementContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENT(self):
            return self.getToken(ModelicaParser.IDENT, 0)

        def array_subscripts(self):
            return self.getTypedRuleContext(ModelicaParser.Array_subscriptsContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_component_reference_element

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterComponent_reference_element" ):
                listener.enterComponent_reference_element(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitComponent_reference_element" ):
                listener.exitComponent_reference_element(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitComponent_reference_element" ):
                return visitor.visitComponent_reference_element(self)
            else:
                return visitor.visitChildren(self)




    def component_reference_element(self):

        localctx = ModelicaParser.Component_reference_elementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 124, self.RULE_component_reference_element)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 857
            self.match(ModelicaParser.IDENT)
            self.state = 859
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,103,self._ctx)
            if la_ == 1:
                self.state = 858
                self.array_subscripts()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Component_referenceContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def component_reference_element(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Component_reference_elementContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Component_reference_elementContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_component_reference

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterComponent_reference" ):
                listener.enterComponent_reference(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitComponent_reference" ):
                listener.exitComponent_reference(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitComponent_reference" ):
                return visitor.visitComponent_reference(self)
            else:
                return visitor.visitChildren(self)




    def component_reference(self):

        localctx = ModelicaParser.Component_referenceContext(self, self._ctx, self.state)
        self.enterRule(localctx, 126, self.RULE_component_reference)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 861
            self.component_reference_element()
            self.state = 866
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,104,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 862
                    self.match(ModelicaParser.T__27)
                    self.state = 863
                    self.component_reference_element() 
                self.state = 868
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,104,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 Function_call_argsContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def function_arguments(self):
            return self.getTypedRuleContext(ModelicaParser.Function_argumentsContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_function_call_args

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFunction_call_args" ):
                listener.enterFunction_call_args(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFunction_call_args" ):
                listener.exitFunction_call_args(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFunction_call_args" ):
                return visitor.visitFunction_call_args(self)
            else:
                return visitor.visitChildren(self)




    def function_call_args(self):

        localctx = ModelicaParser.Function_call_argsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 128, self.RULE_function_call_args)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 869
            self.match(ModelicaParser.T__16)
            self.state = 871
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & 72058694624501760) != 0) or ((((_la - 71)) & ~0x3f) == 0 and ((1 << (_la - 71)) & 983097) != 0):
                self.state = 870
                self.function_arguments()


            self.state = 873
            self.match(ModelicaParser.T__18)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Function_argumentsContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def function_argument(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Function_argumentContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Function_argumentContext,i)


        def for_indices(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.For_indicesContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.For_indicesContext,i)


        def named_arguments(self):
            return self.getTypedRuleContext(ModelicaParser.Named_argumentsContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_function_arguments

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFunction_arguments" ):
                listener.enterFunction_arguments(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFunction_arguments" ):
                listener.exitFunction_arguments(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFunction_arguments" ):
                return visitor.visitFunction_arguments(self)
            else:
                return visitor.visitChildren(self)




    def function_arguments(self):

        localctx = ModelicaParser.Function_argumentsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 130, self.RULE_function_arguments)
        self._la = 0 # Token type
        try:
            self.state = 886
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,108,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 875
                self.function_argument()
                self.state = 882
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==21 or _la==49:
                    self.state = 880
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [21]:
                        self.state = 876
                        self.match(ModelicaParser.T__20)
                        self.state = 877
                        self.function_argument()
                        pass
                    elif token in [49]:
                        self.state = 878
                        self.match(ModelicaParser.T__48)
                        self.state = 879
                        self.for_indices()
                        pass
                    else:
                        raise NoViableAltException(self)

                    self.state = 884
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 885
                self.named_arguments()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Named_argumentsContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def named_argument(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.Named_argumentContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.Named_argumentContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_named_arguments

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterNamed_arguments" ):
                listener.enterNamed_arguments(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitNamed_arguments" ):
                listener.exitNamed_arguments(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitNamed_arguments" ):
                return visitor.visitNamed_arguments(self)
            else:
                return visitor.visitChildren(self)




    def named_arguments(self):

        localctx = ModelicaParser.Named_argumentsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 132, self.RULE_named_arguments)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 888
            self.named_argument()
            self.state = 893
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==21:
                self.state = 889
                self.match(ModelicaParser.T__20)
                self.state = 890
                self.named_argument()
                self.state = 895
                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 Named_argumentContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENT(self):
            return self.getToken(ModelicaParser.IDENT, 0)

        def function_argument(self):
            return self.getTypedRuleContext(ModelicaParser.Function_argumentContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_named_argument

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterNamed_argument" ):
                listener.enterNamed_argument(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitNamed_argument" ):
                listener.exitNamed_argument(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitNamed_argument" ):
                return visitor.visitNamed_argument(self)
            else:
                return visitor.visitChildren(self)




    def named_argument(self):

        localctx = ModelicaParser.Named_argumentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 134, self.RULE_named_argument)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 896
            self.match(ModelicaParser.IDENT)
            self.state = 897
            self.match(ModelicaParser.T__14)
            self.state = 898
            self.function_argument()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Function_argumentContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return ModelicaParser.RULE_function_argument

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class Argument_expressionContext(Function_argumentContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Function_argumentContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self):
            return self.getTypedRuleContext(ModelicaParser.ExpressionContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArgument_expression" ):
                listener.enterArgument_expression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArgument_expression" ):
                listener.exitArgument_expression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArgument_expression" ):
                return visitor.visitArgument_expression(self)
            else:
                return visitor.visitChildren(self)


    class Argument_functionContext(Function_argumentContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a ModelicaParser.Function_argumentContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def name(self):
            return self.getTypedRuleContext(ModelicaParser.NameContext,0)

        def named_arguments(self):
            return self.getTypedRuleContext(ModelicaParser.Named_argumentsContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArgument_function" ):
                listener.enterArgument_function(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArgument_function" ):
                listener.exitArgument_function(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArgument_function" ):
                return visitor.visitArgument_function(self)
            else:
                return visitor.visitChildren(self)



    def function_argument(self):

        localctx = ModelicaParser.Function_argumentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 136, self.RULE_function_argument)
        self._la = 0 # Token type
        try:
            self.state = 909
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [13]:
                localctx = ModelicaParser.Argument_functionContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 900
                self.match(ModelicaParser.T__12)
                self.state = 901
                self.name()
                self.state = 902
                self.match(ModelicaParser.T__16)
                self.state = 904
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==88:
                    self.state = 903
                    self.named_arguments()


                self.state = 906
                self.match(ModelicaParser.T__18)
                pass
            elif token in [14, 17, 20, 30, 40, 56, 71, 74, 75, 76, 87, 88, 89, 90]:
                localctx = ModelicaParser.Argument_expressionContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 908
                self.expression()
                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 Output_expression_listContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ExpressionContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_output_expression_list

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterOutput_expression_list" ):
                listener.enterOutput_expression_list(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitOutput_expression_list" ):
                listener.exitOutput_expression_list(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOutput_expression_list" ):
                return visitor.visitOutput_expression_list(self)
            else:
                return visitor.visitChildren(self)




    def output_expression_list(self):

        localctx = ModelicaParser.Output_expression_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 138, self.RULE_output_expression_list)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 912
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & 72058694624493568) != 0) or ((((_la - 71)) & ~0x3f) == 0 and ((1 << (_la - 71)) & 983097) != 0):
                self.state = 911
                self.expression()


            self.state = 918
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==21:
                self.state = 914
                self.match(ModelicaParser.T__20)
                self.state = 915
                self.expression()
                self.state = 920
                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 Expression_listContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.ExpressionContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_expression_list

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpression_list" ):
                listener.enterExpression_list(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpression_list" ):
                listener.exitExpression_list(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpression_list" ):
                return visitor.visitExpression_list(self)
            else:
                return visitor.visitChildren(self)




    def expression_list(self):

        localctx = ModelicaParser.Expression_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 140, self.RULE_expression_list)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 921
            self.expression()
            self.state = 926
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==21:
                self.state = 922
                self.match(ModelicaParser.T__20)
                self.state = 923
                self.expression()
                self.state = 928
                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 Array_subscriptsContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def subscript(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ModelicaParser.SubscriptContext)
            else:
                return self.getTypedRuleContext(ModelicaParser.SubscriptContext,i)


        def getRuleIndex(self):
            return ModelicaParser.RULE_array_subscripts

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArray_subscripts" ):
                listener.enterArray_subscripts(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArray_subscripts" ):
                listener.exitArray_subscripts(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArray_subscripts" ):
                return visitor.visitArray_subscripts(self)
            else:
                return visitor.visitChildren(self)




    def array_subscripts(self):

        localctx = ModelicaParser.Array_subscriptsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 142, self.RULE_array_subscripts)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 929
            self.match(ModelicaParser.T__75)
            self.state = 930
            self.subscript()
            self.state = 935
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==21:
                self.state = 931
                self.match(ModelicaParser.T__20)
                self.state = 932
                self.subscript()
                self.state = 937
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 938
            self.match(ModelicaParser.T__76)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SubscriptContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def expression(self):
            return self.getTypedRuleContext(ModelicaParser.ExpressionContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_subscript

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSubscript" ):
                listener.enterSubscript(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitSubscript" ):
                listener.exitSubscript(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitSubscript" ):
                return visitor.visitSubscript(self)
            else:
                return visitor.visitChildren(self)




    def subscript(self):

        localctx = ModelicaParser.SubscriptContext(self, self._ctx, self.state)
        self.enterRule(localctx, 144, self.RULE_subscript)
        try:
            self.state = 942
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [18]:
                self.enterOuterAlt(localctx, 1)
                self.state = 940
                self.match(ModelicaParser.T__17)
                pass
            elif token in [14, 17, 20, 30, 40, 56, 71, 74, 75, 76, 87, 88, 89, 90]:
                self.enterOuterAlt(localctx, 2)
                self.state = 941
                self.expression()
                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 CommentContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def string_comment(self):
            return self.getTypedRuleContext(ModelicaParser.String_commentContext,0)


        def annotation(self):
            return self.getTypedRuleContext(ModelicaParser.AnnotationContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_comment

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterComment" ):
                listener.enterComment(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitComment" ):
                listener.exitComment(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitComment" ):
                return visitor.visitComment(self)
            else:
                return visitor.visitChildren(self)




    def comment(self):

        localctx = ModelicaParser.CommentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 146, self.RULE_comment)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 944
            self.string_comment()
            self.state = 946
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==78:
                self.state = 945
                self.annotation()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class String_commentContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def STRING(self, i:int=None):
            if i is None:
                return self.getTokens(ModelicaParser.STRING)
            else:
                return self.getToken(ModelicaParser.STRING, i)

        def getRuleIndex(self):
            return ModelicaParser.RULE_string_comment

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterString_comment" ):
                listener.enterString_comment(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitString_comment" ):
                listener.exitString_comment(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitString_comment" ):
                return visitor.visitString_comment(self)
            else:
                return visitor.visitChildren(self)




    def string_comment(self):

        localctx = ModelicaParser.String_commentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 148, self.RULE_string_comment)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 956
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==89:
                self.state = 948
                self.match(ModelicaParser.STRING)
                self.state = 953
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==62:
                    self.state = 949
                    self.match(ModelicaParser.T__61)
                    self.state = 950
                    self.match(ModelicaParser.STRING)
                    self.state = 955
                    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 AnnotationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def class_modification(self):
            return self.getTypedRuleContext(ModelicaParser.Class_modificationContext,0)


        def getRuleIndex(self):
            return ModelicaParser.RULE_annotation

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAnnotation" ):
                listener.enterAnnotation(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAnnotation" ):
                listener.exitAnnotation(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAnnotation" ):
                return visitor.visitAnnotation(self)
            else:
                return visitor.visitChildren(self)




    def annotation(self):

        localctx = ModelicaParser.AnnotationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 150, self.RULE_annotation)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 958
            self.match(ModelicaParser.T__77)
            self.state = 959
            self.class_modification()
        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[59] = self.expr_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 expr_sempred(self, localctx:ExprContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 7)
         

            if predIndex == 1:
                return self.precpred(self._ctx, 6)
         

            if predIndex == 2:
                return self.precpred(self._ctx, 5)
         

            if predIndex == 3:
                return self.precpred(self._ctx, 3)
         

            if predIndex == 4:
                return self.precpred(self._ctx, 2)
         




