當前位置: 首頁>>代碼示例>>Python>>正文


Python Node.value方法代碼示例

本文整理匯總了Python中jasy.js.parse.Node.Node.value方法的典型用法代碼示例。如果您正苦於以下問題:Python Node.value方法的具體用法?Python Node.value怎麽用?Python Node.value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在jasy.js.parse.Node.Node的用法示例。


在下文中一共展示了Node.value方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: PRIMARY_build

# 需要導入模塊: from jasy.js.parse.Node import Node [as 別名]
# 或者: from jasy.js.parse.Node.Node import value [as 別名]
 def PRIMARY_build(self, tokenizer, tokenType):
     # NB: tokenizer.token.type must be "null", "this", "true", "false", "identifier", "number", "string", or "regexp".
     node = Node(tokenizer, tokenType)
     if tokenType in ("identifier", "string", "regexp", "number"):
         node.value = tokenizer.token.value
         
     return node
開發者ID:zhangming0305,項目名稱:jasy,代碼行數:9,代碼來源:VanillaBuilder.py

示例2: __createSimpleAssignment

# 需要導入模塊: from jasy.js.parse.Node import Node [as 別名]
# 或者: from jasy.js.parse.Node.Node import value [as 別名]
def __createSimpleAssignment(identifier, valueNode):
    assignNode = Node(None, "assign")
    identNode = Node(None, "identifier")
    identNode.value = identifier
    assignNode.append(identNode)
    assignNode.append(valueNode)

    return assignNode
開發者ID:csakatoku,項目名稱:jasy,代碼行數:10,代碼來源:CombineDeclarations.py

示例3: __rebuildAsSplitted

# 需要導入模塊: from jasy.js.parse.Node import Node [as 別名]
# 或者: from jasy.js.parse.Node.Node import value [as 別名]
    def __rebuildAsSplitted(self, value, mapper):
        """ The real splitter engine. Creates plus Node instances and cascade them automatically """
        
        result = []
        splits = self.__replacer.split(value)
        if len(splits) == 1:
            return None
        
        pair = Node(None, "plus")

        for entry in splits:
            if entry == "":
                continue
                
            if len(pair) == 2:
                newPair = Node(None, "plus")
                newPair.append(pair)
                pair = newPair

            if self.__replacer.match(entry):
                pos = int(entry[1]) - 1
                
                # Items might be added multiple times. Copy to protect original.
                try:
                    repl = mapper[pos]
                except KeyError:
                    raise TranslationError("Invalid positional value: %s in %s" % (entry, value))
                
                copied = copy.deepcopy(mapper[pos])
                if copied.type not in ("identifier", "call"):
                    copied.parenthesized = True
                pair.append(copied)
                
            else:
                child = Node(None, "string")
                child.value = entry
                pair.append(child)
                
        return pair
開發者ID:Val9,項目名稱:jasy,代碼行數:41,代碼來源:Translation.py

示例4: __createIdentifier

# 需要導入模塊: from jasy.js.parse.Node import Node [as 別名]
# 或者: from jasy.js.parse.Node.Node import value [as 別名]
def __createIdentifier(value):
    identifier = Node(None, "identifier")
    identifier.value = value
    return identifier    
開發者ID:csakatoku,項目名稱:jasy,代碼行數:6,代碼來源:CombineDeclarations.py

示例5: __recurser

# 需要導入模塊: from jasy.js.parse.Node import Node [as 別名]
# 或者: from jasy.js.parse.Node.Node import value [as 別名]
    def __recurser(self, node):

        # Process children
        for child in list(node):
            if child != None:
                self.__recurser(child)
                        
        
        if node.type == "call":
            funcName = None
            
            if node[0].type == "identifier":
                funcName = node[0].value
            elif node[0].type == "dot" and node[0][1].type == "identifier":
                funcName = node[0][1].value
            
            if funcName in ("tr", "trc", "trn", "marktr"):
                params = node[1]
                table = self.__table
                
                # Remove marktr() calls
                if funcName == "marktr":
                    node.parent.remove(node)

                # Verify param types
                elif params[0].type is not "string":
                    # maybe something marktr() relevant being used, in this case we need to keep the call and inline the data
                    pass
                    
                # Error handling
                elif (funcName == "trn" or funcName == "trc") and params[1].type != "string":
                    warn("Expecting translation string to be type string: %s at line %s" % (params[1].type, params[1].line))

                # Signature tr(msg, arg1, arg2, ...)
                elif funcName == "tr":
                    key = params[0].value
                    if key in table:
                        params[0].value = table[key]
                        
                    if len(params) == 1:
                        node.parent.replace(node, params[0])
                    else:
                        self.__splitTemplate(node, params[0], params[1:])
                        
                        
                # Signature trc(hint, msg, arg1, arg2, ...)
                elif funcName == "trc":
                    key = params[0].value
                    if key in table:
                        params[1].value = table[key]

                    if len(params) == 2:
                        node.parent.replace(node, params[1])
                    else:
                        self.__splitTemplate(node, params[1], params[2:])
                        
                        
                # Signature trn(msg, msg2, [...], int, arg1, arg2, ...)
                elif funcName == "trn":
                    keySingular = params[0].value
                    if keySingular in table:
                        params[0].value = table[keySingular]

                    keyPlural = params[1].value
                    if keyPlural in table:
                        params[1].value = table[keyPlural]
                        
                    # TODO: Multi plural support
                    
                    # Patch strings with dynamic values
                    if len(params) >= 3:
                        self.__splitTemplate(params[0], params[0], params[3:])
                        self.__splitTemplate(params[1], params[1], params[3:])
                    
                    
                    # Replace the whole call with: int < 2 ? singularMessage : pluralMessage
                    hook = Node(None, "hook")
                    hook.parenthesized = True
                    condition = Node(None, "le")
                    condition.append(params[2])
                    number = Node(None, "number")
                    number.value = 1
                    condition.append(number)
                    
                    hook.append(condition, "condition")
                    hook.append(params[1], "elsePart")
                    hook.append(params[0], "thenPart")
                    
                    node.parent.replace(node, hook)
開發者ID:Val9,項目名稱:jasy,代碼行數:91,代碼來源:Translation.py

示例6: MEMBER_build

# 需要導入模塊: from jasy.js.parse.Node import Node [as 別名]
# 或者: from jasy.js.parse.Node.Node import value [as 別名]
 def MEMBER_build(self, tokenizer, tokenType=None):
     node = Node(tokenizer, tokenType)
     if node.type == "identifier":
         node.value = tokenizer.token.value
     return node
開發者ID:zhangming0305,項目名稱:jasy,代碼行數:7,代碼來源:VanillaBuilder.py

示例7: FUNCTION_wrapParam

# 需要導入模塊: from jasy.js.parse.Node import Node [as 別名]
# 或者: from jasy.js.parse.Node.Node import value [as 別名]
 def FUNCTION_wrapParam(self, tokenizer):
     param = Node(tokenizer)
     param.value = tokenizer.token.value
     return param
開發者ID:zhangming0305,項目名稱:jasy,代碼行數:6,代碼來源:VanillaBuilder.py

示例8: CATCH_wrapException

# 需要導入模塊: from jasy.js.parse.Node import Node [as 別名]
# 或者: from jasy.js.parse.Node.Node import value [as 別名]
 def CATCH_wrapException(self, tokenizer):
     node = Node(tokenizer, "exception")
     node.value = tokenizer.token.value
     return node
開發者ID:zhangming0305,項目名稱:jasy,代碼行數:6,代碼來源:VanillaBuilder.py


注:本文中的jasy.js.parse.Node.Node.value方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。