本文整理汇总了Python中Analyzer.Analyzer.processId方法的典型用法代码示例。如果您正苦于以下问题:Python Analyzer.processId方法的具体用法?Python Analyzer.processId怎么用?Python Analyzer.processId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Analyzer.Analyzer
的用法示例。
在下文中一共展示了Analyzer.processId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Parser
# 需要导入模块: from Analyzer import Analyzer [as 别名]
# 或者: from Analyzer.Analyzer import processId [as 别名]
#.........这里部分代码省略.........
def emptyStatement(self):
if self.lookahead in ['MP_SCOLON', 'MP_END', # 40 EmptyStatement -> lambda
'MP_ELSE', 'MP_UNTIL']:
return
else:
self.error(";, end, else, until")
def readStatement(self):
if self.lookahead is 'MP_READ': # 41 ReadStatement -> "read" "(" ReadParameter ReadParameterTail ")"
self.match('MP_READ')
self.match('MP_LPAREN')
self.readParameter()
self.readParameterTail()
self.match('MP_RPAREN')
else:
self.error("read")
def readParameterTail(self):
if self.lookahead is 'MP_COMMA': # 42 ReadParameterTail -> "," ReadParameter ReadParameterTail
self.match('MP_COMMA')
self.readParameter()
self.readParameterTail()
elif self.lookahead is 'MP_RPAREN': # 43 ReadParameterTail -> lambda
return
else:
self.error("comma, )")
def readParameter(self):
if self.lookahead is 'MP_IDENTIFIER': # 44 ReadParameter -> VariableIdentifier
id = self.variableIdentifier()
identRec = self.analyzer.processId(id)
self.analyzer.genRead(identRec)
else:
self.error("identifier")
def writeStatement(self):
if self.lookahead is 'MP_WRITE': # 45 WriteStatement -> "write" "(" WriteParameter WriteParameterTail ")"
self.match('MP_WRITE')
self.match('MP_LPAREN')
self.writeParameter(None)
self.writeParameterTail()
self.match('MP_RPAREN')
elif self.lookahead is 'MP_WRITELN': # 111 WriteStatement -> writeln "(" WriteParameter WriteParameterTail ")"
self.match('MP_WRITELN')
self.match('MP_LPAREN')
self.writeParameter('writeln')
self.writeParameterTail('writeln')
self.match('MP_RPAREN')
else:
self.error("write, writeln")
def writeParameterTail(self, kind):
if self.lookahead is 'MP_COMMA': # 46 WriteParameterTail -> "," WriteParameter
self.match('MP_COMMA')
self.writeParameter(kind)
self.writeParameterTail(kind)
elif self.lookahead is 'MP_RPAREN': # 47 WriteParameterTail -> lambda
return
else:
self.error("comma, )")