Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _parse_stream(stream, system: System = None, document=None, profile=EProfile.FULL):
logger.debug('parse stream')
system = system or System()
lexer = TLexer(stream)
stream = CommonTokenStream(lexer)
parser = TParser(stream)
parser.addErrorListener(ReportingErrorListener(document))
tree = parser.documentSymbol()
walker = ParseTreeWalker()
walker.walk(DomainListener(system, profile), tree)
return system
def getRuleIndex(self):
return TParser.RULE_signalSymbol
def getRuleIndex(self):
return TParser.RULE_headerSymbol
def structSymbol(self):
localctx = TParser.StructSymbolContext(self, self._ctx, self.state)
self.enterRule(localctx, 42, self.RULE_structSymbol)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 245
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==TParser.DOCCOMMENT:
self.state = 244
localctx.comment = self.match(TParser.DOCCOMMENT)
self.state = 250
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==TParser.TAGLINE:
self.state = 247
self.tagSymbol()
self.state = 252
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 253
self.match(TParser.T__25)
def getRuleIndex(self):
return TParser.RULE_primitiveTypeSymbol
def getRuleIndex(self):
return TParser.RULE_typeSymbol
def getRuleIndex(self):
return TParser.RULE_enumSymbol
def getRuleIndex(self):
return TParser.RULE_structFieldSymbol
def enumSymbol(self):
localctx = TParser.EnumSymbolContext(self, self._ctx, self.state)
self.enterRule(localctx, 46, self.RULE_enumSymbol)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 281
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==TParser.DOCCOMMENT:
self.state = 280
localctx.comment = self.match(TParser.DOCCOMMENT)
self.state = 286
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==TParser.TAGLINE:
def primitiveTypeSymbol(self):
localctx = TParser.PrimitiveTypeSymbolContext(self, self._ctx, self.state)
self.enterRule(localctx, 34, self.RULE_primitiveTypeSymbol)
try:
self.state = 227
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [TParser.T__15]:
self.enterOuterAlt(localctx, 1)
self.state = 222
localctx.name = self.match(TParser.T__15)
pass
elif token in [TParser.T__16]:
self.enterOuterAlt(localctx, 2)
self.state = 223
localctx.name = self.match(TParser.T__16)
pass
elif token in [TParser.T__17]: