karottenreibe-vim-syntax 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/HISTORY.markdown CHANGED
@@ -1,3 +1,11 @@
1
+ 0.1.0
2
+ =====
3
+
4
+ * fixed some flawes with some tokens
5
+ * removed special function token
6
+ * fixed a bug with full line comments
7
+ * renamed __param__ token to __word__
8
+
1
9
  0.0.3
2
10
  =====
3
11
 
data/README.markdown CHANGED
@@ -19,3 +19,15 @@ Then:
19
19
  convertor = Syntax::Convertors::HTML.for_syntax "vim"
20
20
  puts convertor.convert( "let mapleader=','" )
21
21
 
22
+ What are the classes of the html elements it produces?
23
+ ======================================================
24
+
25
+ * comment
26
+ * string
27
+ * key
28
+ * number
29
+ * punct
30
+ * command
31
+ * word
32
+ * whitespace
33
+
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'jeweler'
3
3
  task :release do
4
4
  sh "vim HISTORY.markdown"
5
5
  sh "vim README.markdown"
6
- sh "git commit -a -m 'prerelease adjustments' || 1"
6
+ sh "git commit -a -m 'prerelease adjustments'; true"
7
7
  end
8
8
 
9
9
  Jeweler::Tasks.new do |gem|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.1.0
data/lib/vim-syntax.rb CHANGED
@@ -1,29 +1,36 @@
1
1
 
2
2
  require 'syntax'
3
3
 
4
+ #
5
+ # Syntax highlighting for vim script code.
6
+ #
7
+ # Produces the following tokens:
8
+ # - comment
9
+ # - string
10
+ # - number
11
+ # - key
12
+ # - punct
13
+ # - whitespace
14
+ # - command
15
+ # - word
16
+ #
4
17
  class VimTokenizer < Syntax::Tokenizer
5
18
 
6
19
  def step
7
20
  @got_command ||= false
8
21
 
9
22
  if comment = scan(%r{\n".*?$}) # full line comment
10
- start_group(:whitespace, "\n")
11
23
  start_group(:comment, comment)
12
24
  elsif comment = scan(%r{"[^"]*?$}) # end of line comment
13
25
  start_group(:comment, comment)
14
26
  elsif string = scan(%r{"[^"]*?"|'[^']*?'})
15
27
  start_group(:string, string)
16
- elsif scan(%r{(function!?) (\w+)\(\)(.*?)endfunction}m)
17
- start_group(:command, subgroup(1))
18
- start_group(:functionname, subgroup(2))
19
- start_group(:functionbody, subgroup(3))
20
- start_group(:command, 'endfunction')
21
28
  elsif number = scan(%r{\d+})
22
29
  start_group(:number, number)
23
30
  elsif key = scan(%r{<[^<]+>})
24
31
  start_group(:key, key)
25
32
 
26
- elsif punct = scan(%r{[^\w\s]})
33
+ elsif punct = scan(%r{[^\w\süöäß]})
27
34
  start_group(:punct, punct)
28
35
  elsif space = scan(%r{\s})
29
36
  @got_command = false if space == "\n"
@@ -32,8 +39,10 @@ class VimTokenizer < Syntax::Tokenizer
32
39
  elsif not @got_command and command = scan(%r{\w+})
33
40
  @got_command = true
34
41
  start_group(:command, command)
42
+ elsif @got_command and word = scan(%r{\w+})
43
+ start_group(:word, word)
35
44
  else
36
- start_group(:param, scan(%r{.}))
45
+ start_group(:word, scan(%r{.}))
37
46
  end
38
47
  end
39
48
 
data/vim-syntax.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vim-syntax}
8
- s.version = "0.0.3"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Fabian Streitel"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karottenreibe-vim-syntax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabian Streitel