当前位置: 首页>>代码示例>>Python>>正文


Python Block.setSyntaxOnly方法代码示例

本文整理汇总了Python中Block.Block.setSyntaxOnly方法的典型用法代码示例。如果您正苦于以下问题:Python Block.setSyntaxOnly方法的具体用法?Python Block.setSyntaxOnly怎么用?Python Block.setSyntaxOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Block.Block的用法示例。


在下文中一共展示了Block.setSyntaxOnly方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: checkPart1

# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import setSyntaxOnly [as 别名]
 def checkPart1(self, test):
     
     if (test[0] == '"' and test[len(test)-1] == '"'):
         # this is a string literal
         return self.checkStringLiteral(test)
     elif (test[0] == '{' and test[len(test)-1] == '}'):
         # this is a block
         from Block import Block
         #print test[0:len(test)]
         b = Block(test[0:len(test)],self.getParent())
         b.setSyntaxOnly(self.syntax_only)
         if (b.checkSyntax()):
             if(self.syntax_only == False):
                 self.property_list = b.property_list
             return True
         else:
             return False       
     elif (test[0] == '(' and test[len(test)-1] == ')'):
         # this is an expression
         e = Expression(test[1:len(test)-1],self.getParent())
         e.setSyntaxOnly(self.syntax_only)
         if (e.checkSyntax()):
             if(self.syntax_only == False):
                 self.property_list = e.property_list
             return True
         else:
             return False
     elif not (self.checkAsterisk(test)):
         # this is a name with none or multiple *
         print ("This is an invalid Expression: " + test)
         return False
     return True
开发者ID:e1027108,项目名称:VU_PS_UE2,代码行数:34,代码来源:Expression.py

示例2: concatenate

# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import setSyntaxOnly [as 别名]
 def concatenate(self,op1,op2,stars):
     
     from Block import Block
     
     tmp = None
    
     if (len(op2.getDict()) == 1) and (self.isBlock(op2.getDict().values()[0])):
         if (len(op1.getDict()) == 1) and (self.isBlock(op1.getDict().values()[0])):
             raise KeyError
         tmp = op2.getDict().values()[0]
         
         if isinstance(self,Block):
             newBlock = Block(tmp,self)
         else:
             newBlock = Block(tmp,self.getParent())
         
         #print str(stars) + ":"
         #print tmp
         
         newBlock.setPropertyList(op1)
         newBlock.setSyntaxOnly(self.syntax_only)
         newBlock.setNested(stars)
         newBlock.checkSyntax()
         return newBlock.getPropertyList()
     else:
         #print "op2:"
         #op2.printList()
         return self.concatenatePropertyLists(op1, op2)
开发者ID:e1027108,项目名称:VU_PS_UE2,代码行数:30,代码来源:Component.py

示例3: check

# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import setSyntaxOnly [as 别名]
def check(path,syntaxOnly):
    with open (path, "r") as myfile:
        data=myfile.read()

    data = removeComments(data)

    #TODO now check Syntax
    
    b = Block(data,None)
    b.setSyntaxOnly(syntaxOnly)
    
    return b.checkSyntax()
开发者ID:e1027108,项目名称:VU_PS_UE2,代码行数:14,代码来源:SyntaxChecker.py


注:本文中的Block.Block.setSyntaxOnly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。