Class: TaskJuggler::VimSyntax

Inherits:
Object
  • Object
show all
Defined in:
lib/taskjuggler/VimSyntax.rb

Overview

This class is a generator for vim (www.vim.org) TaskJuggler syntax highlighting files.

Instance Method Summary collapse

Constructor Details

#initializeVimSyntax

Create a generator object.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/taskjuggler/VimSyntax.rb', line 23

def initialize
  # Create a syntax reference for all current keywords.
  @reference = SyntaxReference.new(nil, true)

  @properties = []
  @attributes = []
  @optionBlocks = []

  @reference.keywords.each_value do |kw|
    if kw.isProperty?
      @properties << kw
    else
      @attributes << kw
    end
    if !kw.optionalAttributes.empty?
      @optionBlocks << kw
    end
  end

  @file = nil
end

Instance Method Details

#generate(file) ⇒ Object

Generate the vim syntax file into file.



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/taskjuggler/VimSyntax.rb', line 46

def generate(file)
  @file = File.open(file, 'w')

  header
  setLocal
  keywords
  matches
  regions
  highlights

  @file.close
end