rubber-generate 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +4 -1
- data/lib/rubber/scanner.rb +20 -2
- metadata +3 -3
data/README.textile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
h1. Rubber Generate
|
2
2
|
|
3
|
-
h2. v0.0.
|
3
|
+
h2. v0.0.8
|
4
4
|
|
5
5
|
Template language for generating Ruby bindings for C libraries
|
6
6
|
by Geoff Youngs <g@intersect-uk.co.uk>
|
@@ -20,6 +20,9 @@ functions and some rudimentary understanding of C code.
|
|
20
20
|
|
21
21
|
h3. Changes
|
22
22
|
|
23
|
+
* 0.0.8 - 10th May 2010
|
24
|
+
- Add support for %min-version <MAJOR>.<MINOR>.<MICRO>
|
25
|
+
|
23
26
|
* 0.0.7 - 7th May 2010
|
24
27
|
- Add support for array constants (including autmatic type detection) - e.g array <ConstantName> = [ "Text", NULL, 3 ]
|
25
28
|
- Add syntax_error function to parser which reports slightly more helpful syntax error messages for a .cr file
|
data/lib/rubber/scanner.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rubber/struct'
|
2
2
|
module Rubber
|
3
|
+
VERSION = [0,0,8]
|
3
4
|
class ScanState
|
4
5
|
define_members(:in_code, :in_class, :in_func, :braces)
|
5
6
|
end
|
@@ -73,7 +74,7 @@ def scan(fp)
|
|
73
74
|
break if off > @str.pos
|
74
75
|
ind += 1
|
75
76
|
end
|
76
|
-
p @state, @str, ind
|
77
|
+
#p @state, @str, ind
|
77
78
|
raise
|
78
79
|
end
|
79
80
|
def _scan(fp)
|
@@ -114,6 +115,14 @@ def _scan(fp)
|
|
114
115
|
func.text += " " if state.in_func
|
115
116
|
elsif @str.skip(/%name */) # Extension name
|
116
117
|
@ext = @str.scan(/[a-zA-Z0-9]+/)
|
118
|
+
elsif @str.skip(/%min-version */)
|
119
|
+
@version = @str.scan(/([0-9]+)\.([0-9]+)\.([0-9])/)
|
120
|
+
version = [1,2,3].map{|i|@str[i].to_i}
|
121
|
+
Rubber::VERSION.each_with_index do |ver,idx|
|
122
|
+
if ver < version[idx]
|
123
|
+
misc_error "This version of rubber-generate (#{Rubber::VERSION}) is too old: #{@file} requires version #{version.map{|i|i.to_s}.join('.')}"
|
124
|
+
end
|
125
|
+
end
|
117
126
|
elsif @str.skip(/%pkg-config\s*([-a-z.0-9+]+)/) # pkg-config library
|
118
127
|
@pkgs ||= []
|
119
128
|
@pkgs << @str[1]
|
@@ -363,7 +372,7 @@ def _scan(fp)
|
|
363
372
|
@str.skip(/\s+/)
|
364
373
|
if @str.scan(/([a-zA-Z_* ]+):/)
|
365
374
|
returntype = @str[1]
|
366
|
-
elsif @str.skip(/(GS?List){([^}]+)}:/)
|
375
|
+
elsif @str.skip(/(GS?List)[{]([^}]+)[}]:/)
|
367
376
|
container = @str[1]
|
368
377
|
ct = @str[2]
|
369
378
|
cn = ct.gsub(/\s+/,'').gsub(/[*]/,'__p')
|
@@ -486,6 +495,15 @@ end
|
|
486
495
|
end
|
487
496
|
exit 1
|
488
497
|
end
|
498
|
+
def misc_error(message)
|
499
|
+
STDERR.puts "Error: #{message} at line #{current_line}\n"
|
500
|
+
if @str.rest.size > 255
|
501
|
+
STDERR.puts @str.rest[0..255]+"..."
|
502
|
+
else
|
503
|
+
STDERR.puts @str.rest
|
504
|
+
end
|
505
|
+
exit 1
|
506
|
+
end
|
489
507
|
|
490
508
|
end
|
491
509
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 8
|
9
|
+
version: 0.0.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Geoff Youngs
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-10 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|