golden 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/crucible.rb +20 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 524640835b961a32010fba91423217a5ac41ee583957d4d4f68c168ac26cdcd9
|
4
|
+
data.tar.gz: 0cb6f6ea7ea45587cd894b8e5c2434112516a882854b20e8b72bd90fd0391db6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdcbb51f3b6609fb3b4709e4970c276c7137f165acbfa49fd32704aef2d5d51e9fbccd53888929c7c3bedbfaa57fe5e50736fe18179ba2ce6d6483849f9490ce
|
7
|
+
data.tar.gz: 96b1bc46cc582c4f2d008ca7f46eb65838daf31f86e8f6c99399a9da575faad0228bd8a913000909e6806f2f95fcdd779ed3b163ca3344ddb8e14a1d783990d6
|
data/lib/crucible.rb
CHANGED
@@ -67,17 +67,32 @@ module Golden
|
|
67
67
|
golden_data[libName] = {}
|
68
68
|
exports.each do |e|
|
69
69
|
function_name = e.chomp.lstrip
|
70
|
-
declaration_regex = Regexp.new("func #{function_name}\s?\((?<args>.*)\) (?<returns>.*) {")
|
70
|
+
declaration_regex = Regexp.new('\s*'+"func #{function_name}\s?\((?<args>.*)\) (?<returns>.*) {")
|
71
71
|
export_data = {}
|
72
72
|
export_data[:args] = {}
|
73
|
-
|
73
|
+
declaration = source_code.scan(declaration_regex).flatten
|
74
|
+
args = declaration[0]
|
74
75
|
args = args[1,args.length-2]
|
75
76
|
args = args.split(',')
|
76
|
-
|
77
|
+
|
78
|
+
args.each_with_index do |arg, i|
|
77
79
|
name, type = arg.split(" ")
|
78
|
-
|
80
|
+
if(!!type && type != "")
|
81
|
+
export_data[:args][name] = type
|
82
|
+
else
|
83
|
+
type = nil
|
84
|
+
next_args = args.slice(i+1, args.length)
|
85
|
+
next_args.each do |next_arg|
|
86
|
+
potential_type = next_arg.split(" ")[1]
|
87
|
+
if(!!potential_type && !type && potential_type != "")
|
88
|
+
type = potential_type
|
89
|
+
end
|
90
|
+
end
|
91
|
+
export_data[:args][name] = type
|
92
|
+
end
|
79
93
|
end
|
80
|
-
|
94
|
+
|
95
|
+
export_data[:returns] = declaration[1]
|
81
96
|
# require "pry"
|
82
97
|
# binding.pry
|
83
98
|
golden_data[libName][function_name] = export_data
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: golden
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Mikeska
|
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
|
-
rubygems_version: 3.
|
113
|
+
rubygems_version: 3.2.3
|
114
114
|
signing_key:
|
115
115
|
specification_version: 4
|
116
116
|
summary: Golden is a development tool that makes it easier to wrap Go libraries for
|