Extended ruby.jsf

New features are:
- TODO (and FIXME, BUG, XXX) highlight in oneline comments (bold green)
- :symbols support (red)
- proc block argument highlight for e.g. |arg,val| (yellow, disabled)
- class member highlight for e.g. @field (brown, disabled)
- additional quasi-keywords

Disabled features may be enabled by setting a color in the header.
This commit is contained in:
Christian Nicolai 2011-07-31 16:50:38 +02:00
parent e6384eab3f
commit 56f2134055
1 changed files with 74 additions and 0 deletions

View File

@ -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