inidol 1.1.0 → 1.1.1
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.
- checksums.yaml +4 -4
- data/lib/inidol.rb +12 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a210656292325922a490e94132fc8f0af77d842
|
4
|
+
data.tar.gz: 137a76d65bf0ba946625a6de3bd82ae1052c2d7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6fadb6fa6505390d2449c733d4b1340e92e01da449475bac8de64302f5ba39b20c60409f650ecb3866a6b7f3b9e44f0d025e8b93e5b836ae448435dba57e281
|
7
|
+
data.tar.gz: 12c03c2a758d591addd37bb7c8b1d8dcff8e42347347289d2ec7fd3bdcc17368b51c1eb92d81b97ee2693d1c2c975f1ba0e90d08b7b97e9d1cea25fdd9db4b92
|
data/lib/inidol.rb
CHANGED
@@ -55,7 +55,7 @@ class INIHash < BabelBridge::Parser
|
|
55
55
|
end
|
56
56
|
|
57
57
|
rule :values, any(:array, :types)
|
58
|
-
rule :types, any(:
|
58
|
+
rule :types, any(:int, :bool, :string, :content)
|
59
59
|
|
60
60
|
rule :int,/[-]?[0-9]+/ do
|
61
61
|
def evaluate
|
@@ -75,7 +75,7 @@ class INIHash < BabelBridge::Parser
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
rule :content, /[^\n\=\[\];#,]+/ do
|
78
|
+
rule :content, /[^\n\=\[\]";#,]+/ do
|
79
79
|
def evaluate
|
80
80
|
to_s.chomp
|
81
81
|
end
|
@@ -109,7 +109,15 @@ end
|
|
109
109
|
class String
|
110
110
|
def from_ini
|
111
111
|
parser = INIHash.new
|
112
|
-
parser.parse(self)
|
113
|
-
parser.
|
112
|
+
result = parser.parse(self)
|
113
|
+
line, column = BabelBridge::Tools.line_column(self, parser.failure_index)
|
114
|
+
|
115
|
+
if result
|
116
|
+
result.evaluate
|
117
|
+
parser.result
|
118
|
+
else
|
119
|
+
error_line = self.split(/\n+/)[line - 1]
|
120
|
+
puts "(\e[31m\e[1mSyntax\e[21m Failure\e[39m) on line #{line - 1} and column #{column}..."
|
121
|
+
end
|
114
122
|
end
|
115
123
|
end
|