def stateParseParameters(cls, parserState: ParserState): currentBlock = parserState.Block if isinstance(currentBlock, GenericList.OpenBlock): parserState.NextState = cls.stateParse2 parserState.PushState = ParameterListGroup.stateParse parserState.NextGroup = ParameterListGroup(parserState.LastGroup, currentBlock) parserState.BlockMarker = currentBlock parserState.ReIssue = True return elif isinstance(currentBlock, (LinebreakBlock, IndentationBlock)): parserState.PushState = WhitespaceGroup.stateParse parserState.NextGroup = WhitespaceGroup(parserState.LastGroup, currentBlock) parserState.BlockMarker = currentBlock parserState.ReIssue = True return elif isinstance(currentBlock, CommentBlock): parserState.PushState = CommentGroup.stateParse parserState.NextGroup = CommentGroup(parserState.LastGroup, currentBlock) parserState.BlockMarker = currentBlock parserState.ReIssue = True return if isinstance(currentBlock, EndOfDocumentBlock): parserState.NextGroup = EndOfDocumentGroup(currentBlock) return raise BlockParserException("End of parameters not found.", currentBlock)
def stateParseGenerics(cls, parserState: ParserState): currentBlock = parserState.Block if isinstance(currentBlock, GenericList.OpenBlock): parserState.NextState = cls.stateParseParameters parserState.PushState = GenericListGroup.stateParse parserState.NextGroup = GenericListGroup(parserState.LastGroup, currentBlock) parserState.BlockMarker = currentBlock parserState.ReIssue = True return elif isinstance(currentBlock, ParameterList.OpenBlock): parserState.NextState = cls.stateParseDeclarations parserState.PushState = ParameterListGroup.stateParse parserState.NextGroup = ParameterListGroup(parserState.LastGroup, currentBlock) parserState.BlockMarker = currentBlock parserState.ReIssue = True return elif isinstance(currentBlock, Function.ReturnTypeBlock): if isinstance(currentBlock.EndToken, EndToken): parserState.Pop() else: parserState.NextState = cls.stateParse2 parserState.ReIssue = True return elif isinstance(currentBlock, (LinebreakBlock, IndentationBlock)): parserState.PushState = WhitespaceGroup.stateParse parserState.NextGroup = WhitespaceGroup(parserState.LastGroup, currentBlock) parserState.BlockMarker = currentBlock parserState.ReIssue = True return elif isinstance(currentBlock, CommentBlock): parserState.PushState = CommentGroup.stateParse parserState.NextGroup = CommentGroup(parserState.LastGroup, currentBlock) parserState.BlockMarker = currentBlock parserState.ReIssue = True return if isinstance(currentBlock, EndOfDocumentBlock): parserState.NextGroup = EndOfDocumentGroup(currentBlock) return raise BlockParserException("End of generic clause not found.", currentBlock)