本文整理汇总了Python中Dictionary.Dictionary.isFound方法的典型用法代码示例。如果您正苦于以下问题:Python Dictionary.isFound方法的具体用法?Python Dictionary.isFound怎么用?Python Dictionary.isFound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dictionary.Dictionary
的用法示例。
在下文中一共展示了Dictionary.isFound方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: action27
# 需要导入模块: from Dictionary import Dictionary [as 别名]
# 或者: from Dictionary.Dictionary import isFound [as 别名]
def action27(self, lineNumber, symbol):
dictionary = Dictionary()
ss1 = SS1()
if not dictionary.isFound(symbol):
E.E(lineNumber, 0).unknownIdentifier(symbol)
else:
ss1.push(symbol)
示例2: action20000
# 需要导入模块: from Dictionary import Dictionary [as 别名]
# 或者: from Dictionary.Dictionary import isFound [as 别名]
def action20000(self, lineNumber, symbol):
# symbol = symbol['name']
dictionary = Dictionary()
if not dictionary.isFound(symbol):
E.E(lineNumber, 0).typeUnknown(symbol)
type = dictionary.get(symbol)
ss1 = SS1()
ss1.push(type)
示例3: action18
# 需要导入模块: from Dictionary import Dictionary [as 别名]
# 或者: from Dictionary.Dictionary import isFound [as 别名]
def action18(self, lineNumber, symbol):
# symbol = symbol['name']
dictionary = Dictionary()
ss1 = SS1()
if dictionary.isFound(symbol):
E.E(lineNumber, 0).doubleDefinition(symbol, 'procedure or function')
ss1.push(symbol)
ss1.push('proc_params')
示例4: action8000
# 需要导入模块: from Dictionary import Dictionary [as 别名]
# 或者: from Dictionary.Dictionary import isFound [as 别名]
def action8000(self, lineNumber, symbol):
# symbol = symbol['name']
dictionary = Dictionary()
if dictionary.isFound(symbol):
E.E(lineNumber, 0).typeDoubleDefinition(symbol)
_attrUserType = AtrClasses.AttrUserType(symbol)
ss1 = SS1()
ss1.push(_attrUserType)
示例5: action17000
# 需要导入模块: from Dictionary import Dictionary [as 别名]
# 或者: from Dictionary.Dictionary import isFound [as 别名]
def action17000(self, lineNumber, symbol):
# symbol = symbol['name']
dictionary = Dictionary()
if not dictionary.isFound(symbol):
E.E(lineNumber, 0).typeUnknown(symbol)
ss1 = SS1()
_attrArray = ss1.pop()
_attrArray['object'].setName(symbol)
ss1.push( _attrArray )
示例6: action5000
# 需要导入模块: from Dictionary import Dictionary [as 别名]
# 或者: from Dictionary.Dictionary import isFound [as 别名]
def action5000(self, lineNumber, symbol):
# symbol = symbol['name']
dictionary = Dictionary()
if dictionary.isFound(symbol):
E.E(lineNumber, 0).varDoubleDefinition(symbol)
else:
_attrVar = AtrClasses.AttrVar(symbol)
ss1 = SS1()
ss1.push(_attrVar)
示例7: action55000
# 需要导入模块: from Dictionary import Dictionary [as 别名]
# 或者: from Dictionary.Dictionary import isFound [as 别名]
def action55000(self, lineNumber, symbol):
# symbol = symbol['name']
dictionary = Dictionary()
# @todo problem Fields in record cannot have name equal to usual variables
if dictionary.isFound(symbol):
E.E(lineNumber, 0).varDoubleDefinition(symbol)
else:
_attrVar = AtrClasses.AttrVar(symbol)
ss1 = SS1()
ss1.push(None)
ss1.push(_attrVar)
示例8: class
# 需要导入模块: from Dictionary import Dictionary [as 别名]
# 或者: from Dictionary.Dictionary import isFound [as 别名]
#.........这里部分代码省略.........
i = 0
First = []
while i < len(Rule):
if (Rule[i] == "[["):
First.append(Rule[i+1])
i = self.findElement(Rule, "]]", i+1)
elif (Rule[i] == "{"):
First.append(Rule[i+1])
i = self.findElement(Rule, "}", i+1)
else:
First.append(Rule[i])
return First
i += 1
return First
def nextLevel(self, List):
"""
Returns list with next level - non-terminals
"""
out = []
for symbol in List:
if (self.isTerminal(symbol)):
out.append(symbol)
else:
for _R in Rules[symbol]:
for symbol2 in self.PossiblePrefixes(_R):
out.append(symbol2)
return out
def findFirstSymbols(self, Rule):
"""
Effects: Return list of first symbol
"""
List = self.PossiblePrefixes(Rule)
while (self.hasnonTerminals(List)):
List = self.nextLevel(List)
return List
def hasnonTerminals(self, List):
"""
Effects: Return True if list contains at least one non-terminal
"""
for symbol in List:
if not self.isTerminal(symbol):
return True
return False
def isDerivedFrom(self, ruleSymbol):
if (self.isTerminal(ruleSymbol)):
return ruleSymbol == self.inputSymbol
else:
if ruleSymbol == self.inputSymbol:
return True
else:
return (not self.chooseAppropriateRule(ruleSymbol) == None)
def isSemanticAction(self, ruleSymbol):
"""
Effects: Returns True if semantic action occurs and needs to be done
"""
return ruleSymbol[0] == '#'
def extractSemanticAction(self, ruleSymbol):
"""
Effects: Return number of semantic action
Requires: ruleSymbol must be in format "#\d+"
"""
return ruleSymbol[1:]
def addToDictionary(self):
if (not self.lexema.isFound(self.word)):
# @todo extract in comfortable place
self.lexema.addSymbol( {"name" : self.word, 'class' : self.inputSymbol} )
if self.inputSymbol == 'intConst':
self.lexema.setObject( self.word, AtrClasses.AttrIntConst(self.word) )
if self.inputSymbol == 'floatConst':
self.lexema.setObject( self.word, AtrClasses.AttrFloatConst(self.word) )
if self.inputSymbol == 'StringConst':
self.lexema.setObject( self.word, AtrClasses.AttrStringConst(self.word) )
def doSemanticAction(self, RuleItem, i):
currentRuleSymbol = None
if i+1 < len(RuleItem): currentRuleSymbol = RuleItem[i+1]
if currentRuleSymbol is None: return False
if self.isSemanticAction(currentRuleSymbol):
semanticActionNumber = self.extractSemanticAction(currentRuleSymbol)
if (semanticActionNumber.find(',') == -1):
SemanticActions().switchAction(self.inputstream.lineNumber, semanticActionNumber, self.word)
else:
(semanticActionNumber1, semanticActionNumber2) = semanticActionNumber.split(',')
SemanticActions().switchAction(self.inputstream.lineNumber, semanticActionNumber1, self.word)
SemanticActions().switchAction(self.inputstream.lineNumber, semanticActionNumber2, self.word)
def getRuleSymbol(self, RuleItem, i):
if (i < len(RuleItem)):
return RuleItem[i]
else:
return None
示例9: action30
# 需要导入模块: from Dictionary import Dictionary [as 别名]
# 或者: from Dictionary.Dictionary import isFound [as 别名]
def action30(self, lineNumber, symbol):
ss1 = SS1()
dictionary = Dictionary()
if not dictionary.isFound(symbol):
E.E(lineNumber, 0).unknownIdentifier(symbol)
ss1.push(AttrDigit(symbol))
示例10: action0000
# 需要导入模块: from Dictionary import Dictionary [as 别名]
# 或者: from Dictionary.Dictionary import isFound [as 别名]
def action0000(self, lineNumber, symbol):
# symbol = symbol['name']
dictionary = Dictionary()
if dictionary.isFound(symbol):
E.E(lineNumber, 0).semantic(lineNumber)