MCPcopy Create free account
hub / github.com/SplootCode/splootcode / appendConstantToken

Function appendConstantToken

python/convert_ast.py:94–104  ·  view source on GitHub ↗
(const, tokens)

Source from the content-addressed store, hash-verified

92 tokens.append(node)
93
94def appendConstantToken(const, tokens):
95 if type(const.value) == str:
96 tokens.append(SplootNode("STRING_LITERAL", {}, {"value": const.value}))
97 elif type(const.value) == int or type(const.value) == float:
98 tokens.append(SplootNode("NUMERIC_LITERAL", {}, {"value": const.value}))
99 elif type(const.value) == bool:
100 tokens.append(SplootNode("PYTHON_BOOL", {}, {"value": const.value}))
101 elif const.value is None:
102 tokens.append(SplootNode("PYTHON_NONE", {}))
103 else:
104 raise Exception(f'Unsupported constant: {const.value}')
105
106def appendBinaryOperatorExpression(binOp, tokens):
107 generateExpression(binOp.left, tokens)

Callers 1

generateExpressionTokensFunction · 0.85

Calls 1

SplootNodeFunction · 0.70

Tested by

no test coverage detected