diff --git a/ruby.jsf b/ruby.jsf index 5e167be..085612d 100644 --- a/ruby.jsf +++ b/ruby.jsf @@ -16,6 +16,11 @@ =Bad bold red =Var yellow +=CommentTODO bold green +=Symbol red +=ProcArg #yellow +=ClassMember #fg_310 # brown + # Detect pod :idle Idle @@ -40,6 +45,11 @@ "%" pstring "a-zA-Z_" ident buffer + # added + ":" maybe_symbol noeat + "|" proc_arg + "@" class_member recolor=-1 + # / / regex not allowed after terms :after_term Idle @@ -149,10 +159,33 @@ done * line_comment "\n" rest +# pimped by a line matching on possible upper-case "todo" labels (like TODO, FIXME, etc.) +# and buffering all following chars in :line_comment_todo_guess :line_comment_i Comment * line_comment_i + "TFBX" line_comment_todo_guess noeat buffer "\n" idle +# if the current char _is_ in [A-Z] put it to the buffer +# if it's not (e.g. a space) then it is an unknown char so we should exit +# but before we'll check if the buffer matches one of our keywords (like TODO) +# and color it so - else we are wrong with the guess that it's a todo-keyword +# so it's a normal 'Comment' +:line_comment_todo_guess Comment + * line_comment_todo_unknown noeat strings + "TODO" line_comment_todo + "FIXME" line_comment_todo + "BUG" line_comment_todo + "XXX" line_comment_todo +done + "A-Z" line_comment_todo_guess + +:line_comment_todo_unknown Idle + * line_comment_i noeat + +:line_comment_todo CommentTODO + * line_comment_i noeat + :end_of_file_comment Comment * end_of_file_comment @@ -358,6 +391,14 @@ done "when" kw "while" kw "yield" kw + # quasi-keywords (Module or Kernel methods) + "require" kw + "include" kw + "puts" kw + "exit" kw + "attr_accessor" kw + "attr_reader" kw + "attr_writer" kw done "a-zA-Z0-9_" ident @@ -421,3 +462,36 @@ done :repl_quote Escape * repl + +:maybe_symbol Idle + * rest noeat + ":" maybe_symbol2 + +:maybe_symbol2 Idle + * rest noeat + # prevent wrong Module::Member detection + ":" rest + # first char mustn't be 0-9 + "a-zA-Z_" symbol +# # might be a :"symbol" +# "\"" + +:symbol Symbol + * rest noeat + "a-zA-Z0-9_" symbol recolor=-3 + +:proc_arg ProcArg + * rest noeat + "," proc_arg_sep noeat + "a-zA-Z_" proc_arg + +:proc_arg_sep Idle + * proc_arg + +:class_member1 ClassMember + * rest noeat + "a-zA-Z_" class_member + +:class_member ClassMember + * rest noeat + "a-zA-Z0-9_" class_member