Update 4: Ruby Plugin for IDEA

I just added initial support for specifying syntax rules with small Ruby snippets. A lot of cleanup is required now to make the source code presentable again.. :)

Anyway, from now on you can specify something like this next to each other:

ruby  SPECIAL_QUOTED_STRING         => tags/SPECIAL_QUOTED_STRING.rb
regex SINGLE_QUOTED_STRING          => \'(?:[^\']|\\')*\'

The ruby rule takes a filename as ‘value’. In this filename you simply ‘def’ a ‘find_in’ function like this:

def find_in( input, start_offset, end_offset )
    start_index = input.index /%[qQ]./, start_offset
    return nil unless start_index

    delimiter = get_delimiter( input[ start_index + 2, 1 ] )
    return start_index, start_index + 4 if input[ start_index + 3, 1 ] == delimiter

    pattern = Regexp.new "[^\\\\]#{delimiter}"
    end_index = input.index pattern, start_index + 3
    return nil unless end_index

    return start_index, end_index + 2
end

I’m still waiting for SourceForge to approve this project. I’ll put everything online then asap..

tfdj

No comments yet. Be the first.

Leave a reply