# JOE syntax highlight file for Python =Idle =Comment green =Docstring green =DocstringLabel bold green =DocEscape bold cyan =Constant cyan =Escape bold cyan =Keyword bold =Bad bold red =Brace magenta =PrivateMember yellow #fg_310 # brown =Decorator red =Declaration bold blue :idle Idle * idle "#" comment recolor=-1 "0-9" first_digit recolor=-1 "'\"" string_quot_1 recolor=-1 save_c "a-zA-Z_" ident noeat "{}" brace recolor=-1 "@" decorator recolor=-1 :brace Brace * idle noeat # annotations :decorator Decorator * decorator " (\t\r\n" idle noeat :comment Comment comment * comment # might be TODO label "BFHNTX" comment noeat call=comment_todo.comment_todo() "\n" idle :first_digit Constant * idle noeat "xX" hex "." float "eE" epart "0-9" first_number :hex Constant * idle noeat "0-9A-Fa-f" hex :first_number Constant * idle noeat "0-9" first_number "." float :maybe_float Constant * idle recolor=-2 noeat "0-9" float recolor=-2 :float Constant * idle noeat "eE" epart "0-9" float :epart Constant * idle noeat "0-9+\-" enum :enum Constant * idle noeat "0-9" enum :ident Idle * ident1 noeat buffer "_" priv_member recolor=-1 :ident1 Idle * idle noeat strings "and" kw "as" kw "assert" kw "break" kw "class" declkw "continue" kw "def" declkw "del" kw "elif" kw "else" kw "except" kw "exec" kw "finally" kw "for" kw "from" kw "global" kw "if" kw "import" kw "in" kw "is" kw "lambda" kw "not" kw "or" kw "pass" kw "print" kw "raise" kw "return" kw "try" kw "while" kw "with" kw "yield" kw # quasi-keywords "False" lit "None" lit "True" lit done "'\"" idle noeat istrings "u" string_pre "b" string_pre "r" string_raw_pre "br" string_raw_pre "rb" string_raw_pre done "a-zA-Z0-9_" ident1 :kw Keyword * idle noeat :lit Keyword * idle noeat :declkw Keyword * idle noeat recolor=-1 "a-zA-Z" declkw " \t" declname_1 :declname_1 Declaration * declname "_" priv_member recolor=-1 :declname Declaration * idle noeat recolor=-1 "a-zA-Z0-9_" declname :priv_member PrivateMember * idle noeat "a-zA-Z0-9_" priv_member # Handle string prefixes up to the string itself. :string_pre Constant * idle noeat "'\"" string_quot_1 save_c :string_raw_pre Constant * idle noeat "'\"" string_quot_raw_1 save_c # Differentiate between docstrings and regular strings, carrying with it raw state :string_quot_1 Constant * idle call=.string() noeat & string_quot_2 :string_quot_2 Constant * idle noeat & idle call=.string(docstring) recolor=-3 :string_quot_raw_1 Constant * idle call=.string(raw) & string_quot_raw_2 :string_quot_raw_2 Constant * idle noeat & idle call=.string(docstring raw) recolor=-3 .subr string .ifdef docstring # Long strings :string Docstring string * string "BFHNTX" string noeat call=.comment_todo_docstr() .ifdef raw .else "\\" string_esc mark .endif & doc_end_1 :doc_end_1 Docstring * string noeat & doc_end_2 :doc_end_2 Docstring * string noeat & string return .else # Short strings :string Constant string * string "\n" string return .ifdef raw .else "\\" string_esc mark .endif & string return .endif :string_esc Constant * string_esc_done "x" string_hex2 "u" string_hex4 "U" string_hex8 "0-7" string_octal2 "\n" string_esc_done # Recolor whole escape sequence based on whether this is a docstring. :string_esc_done Constant * string_esc_really_done noeat markend recolormark .ifdef docstring :string_esc_really_done DocEscape * string noeat .else :string_esc_really_done Escape * string noeat .endif :string_hex1 Escape * string_esc_done noeat "0-9a-fA-F" string_esc_done :string_hex2 Escape * string_esc_done noeat "0-9a-fA-F" string_hex1 :string_hex3 Escape * string_esc_done noeat "0-9a-fA-F" string_hex2 :string_hex4 Escape * string_esc_done noeat "0-9a-fA-F" string_hex3 :string_hex5 Escape * string_esc_done noeat "0-9a-fA-F" string_hex4 :string_hex6 Escape * string_esc_done noeat "0-9a-fA-F" string_hex5 :string_hex7 Escape * string_esc_done noeat "0-9a-fA-F" string_hex6 :string_hex8 Escape * string_esc_done noeat "0-9a-fA-F" string_hex7 :string_octal1 Escape * string_esc_done noeat "0-7" string_esc_done :string_octal2 Escape * string_esc_done noeat "0-7" string_octal1 .end .subr comment_todo_docstr # initial state :comment_todo_init Docstring * comment_todo_guess buffer # highlight common TODO labels :comment_todo_guess Docstring * comment_todo_unknown noeat strings "BUG" comment_todo "FIXME" comment_todo "HACK" comment_todo "NOTE" comment_todo "TODO" comment_todo "XXX" comment_todo done "A-Z" comment_todo_guess :comment_todo_unknown Docstring * NULL noeat return :comment_todo DocstringLabel * NULL noeat return .end