本文整理匯總了Python中quex.engine.misc.interval_handling.NumberSet.is_empty方法的典型用法代碼示例。如果您正苦於以下問題:Python NumberSet.is_empty方法的具體用法?Python NumberSet.is_empty怎麽用?Python NumberSet.is_empty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類quex.engine.misc.interval_handling.NumberSet
的用法示例。
在下文中一共展示了NumberSet.is_empty方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_ALL_BUT_NEWLINE_state_machine
# 需要導入模塊: from quex.engine.misc.interval_handling import NumberSet [as 別名]
# 或者: from quex.engine.misc.interval_handling.NumberSet import is_empty [as 別名]
def create_ALL_BUT_NEWLINE_state_machine(stream):
global Setup
result = StateMachine()
# NOTE: Buffer control characters are supposed to be filtered out by the code
# generator.
trigger_set = NumberSet(Interval(ord("\n"))).get_complement(Setup.buffer_codec.source_set)
if trigger_set.is_empty():
error.log("The set of admissible characters contains only newline.\n"
"The '.' for 'all but newline' is an empty set.",
SourceRef.from_FileHandle(stream))
result.add_transition(result.init_state_index, trigger_set, AcceptanceF=True)
return result
示例2: __whitespace_default
# 需要導入模塊: from quex.engine.misc.interval_handling import NumberSet [as 別名]
# 或者: from quex.engine.misc.interval_handling.NumberSet import is_empty [as 別名]
def __whitespace_default(self):
"""Try to define default whitespace ' ' or '\t' if their positions
are not yet occupied in the count_command_map.
"""
cs0 = NumberSet(ord(" "))
cs1 = NumberSet(ord("\t"))
result = NumberSet()
if not self.specifier_count_op_map.find_occupier(cs0, set()):
result.unite_with(cs0)
if not self.specifier_count_op_map.find_occupier(cs1, set()):
result.unite_with(cs1)
if result.is_empty():
error.log("Trying to implement default whitespace ' ' or '\\t' failed.\n"
"Characters are occupied by other elements.", self.sr)
return result