本文整理匯總了Python中quex.engine.state_machine.core.StateMachine.from_character_set方法的典型用法代碼示例。如果您正苦於以下問題:Python StateMachine.from_character_set方法的具體用法?Python StateMachine.from_character_set怎麽用?Python StateMachine.from_character_set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類quex.engine.state_machine.core.StateMachine
的用法示例。
在下文中一共展示了StateMachine.from_character_set方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __sm_newline_default
# 需要導入模塊: from quex.engine.state_machine.core import StateMachine [as 別名]
# 或者: from quex.engine.state_machine.core.StateMachine import from_character_set [as 別名]
def __sm_newline_default(self):
"""Default newline: '(\n)|(\r\n)'
"""
global cc_type_name_db
newline_set = NumberSet(ord('\n'))
retour_set = NumberSet(ord('\r'))
before = self.specifier_count_op_map.find_occupier(newline_set, set())
if before is not None:
error.warning("Trying to implement default newline: '\\n' or '\\r\\n'.\n"
"The '\\n' option is not possible, since it has been occupied by '%s'.\n" \
"No newline can be defined by default."
% cc_type_name_db[before.cc_type], before.sr,
SuppressCode=NotificationDB.warning_default_newline_0A_impossible)
# In this case, no newline can be defined!
return
sm = StateMachine.from_character_set(newline_set)
if Setup.dos_carriage_return_newline_f:
before = self.specifier_count_op_map.find_occupier(retour_set, set())
if before is not None:
error.warning("Trying to implement default newline: '\\n' or '\\r\\n'.\n"
"The '\\r\\n' option is not possible, since '\\r' has been occupied by '%s'." \
% cc_type_name_db[before.cc_type],
before.sr,
SuppressCode=NotificationDB.warning_default_newline_0D_impossible)
else:
sm.add_transition_sequence(sm.init_state_index, [retour_set, newline_set])
return sm
示例2: from_character_set
# 需要導入模塊: from quex.engine.state_machine.core import StateMachine [as 別名]
# 或者: from quex.engine.state_machine.core.StateMachine import from_character_set [as 別名]
def from_character_set(CharacterSet):
return Pattern(StateMachine.from_character_set(CharacterSet),
PatternString="<character set>")