// // Python 2.2 キーワード色分け定義 // Copyright (C) Satoshi Imai, 2003 // Id: "Python" // 言語識別名 Title: "Python 2.2" // タイトル名 Extensions: "py pys pyw" // デフォルトの拡張子 TabStop: 4 // デフォルトのタブ間隔 LineComment: "#" // 行コメントの開始文字 IdCharacters: "_" // 英数字以外に単語の一部と見なす文字 HeadingPattern: /^\s*(class|def)\s+.*:/ // 見出しパターン Context 1: { // Python keywords /#.*/, FgComment "and", FgKeyword "assert", FgKeyword "break", FgKeyword "class", FgKeyword "continue", FgKeyword "def", FgKeyword "del", FgKeyword "elif", FgKeyword "else", FgKeyword "except", FgKeyword "exec", FgKeyword "finally", FgKeyword "for", FgKeyword "from", FgKeyword "global", FgKeyword "if", FgKeyword "import", FgKeyword "in", FgKeyword "is", FgKeyword "lambda", FgKeyword "not", FgKeyword "or", FgKeyword "pass", FgKeyword "print", FgKeyword "raise", FgKeyword "return", FgKeyword "try", FgKeyword "while", FgKeyword "yield", FgKeyword // Tkinter keywords "BitmapImage", FgBuiltinFunction "Button", FgBuiltinFunction "Canvas", FgBuiltinFunction "Checkbutton", FgBuiltinFunction "Entry", FgBuiltinFunction "Frame", FgBuiltinFunction "Label", FgBuiltinFunction "Listbox", FgBuiltinFunction "Menu", FgBuiltinFunction "Menubutton", FgBuiltinFunction "Message", FgBuiltinFunction "OptionMenu", FgBuiltinFunction "PhotoImage", FgBuiltinFunction "Radiobutton", FgBuiltinFunction "Scale", FgBuiltinFunction "Scrollbar", FgBuiltinFunction "Text", FgBuiltinFunction "Toplevel", FgBuiltinFunction // 数値と文字列 /(\bL)?"/, FgString, GoTo +1 // 文字列 \ によるエスケープあり /(\bL)?'/, FgString, GoTo +2 // 文字列 \ によるエスケープあり /0x[\dA-F]+[lL]{0,1}/i, FgNumber // 16進数 /(\d+\.?\d*|\.\d+)(E[-+]?\d+)?[lL]{0,1}/i, FgNumber // 整数または浮動小数点数 // 変数名などの識別子 /\i/, FgIdentifier } Context 2: { // ダブルクォートの途中 /[^"\\]*(\\.[^"\\]*)*/, FgString /\\$/, FgString, GoTo +2 /"/, FgString, PostGoTo -1 /$/, GoTo -1 } Context 3: { // シングルクォートの途中 /[^'\\]*(\\.[^'\\]*)*/, FgString /\\$/, FgString, GoTo +2 /'/, FgString, PostGoTo -2 /$/, GoTo -2 } Context 4, 5: { // 次の行へ続くシングル・ダブルクォート /$/, GoTo -2 }