lex_state4.py
字号:
# lex_state2.py## Bad state declarationimport syssys.path.insert(0,"..")import ply.lex as lextokens = [ "PLUS", "MINUS", "NUMBER", ]comment = 1states = (('comment', 'exclsive'),)t_PLUS = r'\+'t_MINUS = r'-'t_NUMBER = r'\d+'# Commentsdef t_comment(t): r'/\*' t.lexer.begin('comment') print "Entering comment state"def t_comment_body_part(t): r'(.|\n)*\*/' print "comment body", t t.lexer.begin('INITIAL')def t_error(t): passimport syslex.lex()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -