rtext 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/Rakefile +1 -1
- data/lib/rtext/serializer.rb +1 -1
- data/test/instantiator_test.rb +3 -2
- data/test/serializer_test.rb +4 -2
- metadata +10 -5
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
data/lib/rtext/serializer.rb
CHANGED
@@ -132,7 +132,7 @@ class Serializer
|
|
132
132
|
result << v.to_s
|
133
133
|
end
|
134
134
|
elsif feature.eType.is_a?(RGen::ECore::EEnum)
|
135
|
-
if v.to_s =~
|
135
|
+
if v.to_s =~ /^\d|\W/
|
136
136
|
result << "\"#{v.to_s.gsub("\\","\\\\\\\\").gsub("\"","\\\"").gsub("\n","\\n").
|
137
137
|
gsub("\r","\\r").gsub("\t","\\t").gsub("\f","\\f").gsub("\b","\\b")}\""
|
138
138
|
else
|
data/test/instantiator_test.rb
CHANGED
@@ -12,7 +12,7 @@ class RTextInstantiatorTest < Test::Unit::TestCase
|
|
12
12
|
module TestMM
|
13
13
|
extend RGen::MetamodelBuilder::ModuleExtension
|
14
14
|
class TestNode < RGen::MetamodelBuilder::MMBase
|
15
|
-
SomeEnum = RGen::MetamodelBuilder::DataTypes::Enum.new([:A, :B, :'non-word*chars'])
|
15
|
+
SomeEnum = RGen::MetamodelBuilder::DataTypes::Enum.new([:A, :B, :'non-word*chars', :'2you'])
|
16
16
|
has_attr 'text', String
|
17
17
|
has_attr 'integer', Integer
|
18
18
|
has_attr 'boolean', Boolean
|
@@ -859,10 +859,11 @@ class RTextInstantiatorTest < Test::Unit::TestCase
|
|
859
859
|
TestNode enum: A
|
860
860
|
TestNode enum: B
|
861
861
|
TestNode enum: "non-word*chars"
|
862
|
+
TestNode enum: "2you"
|
862
863
|
}
|
863
864
|
), TestMM)
|
864
865
|
assert_no_problems(problems)
|
865
|
-
assert_equal [:A, :B, :'non-word*chars'], env.find(:text => "root").first.childs.collect{|c| c.enum}
|
866
|
+
assert_equal [:A, :B, :'non-word*chars', :'2you'], env.find(:text => "root").first.childs.collect{|c| c.enum}
|
866
867
|
end
|
867
868
|
|
868
869
|
#
|
data/test/serializer_test.rb
CHANGED
@@ -15,7 +15,7 @@ class RTextSerializerTest < Test::Unit::TestCase
|
|
15
15
|
module TestMM
|
16
16
|
extend RGen::MetamodelBuilder::ModuleExtension
|
17
17
|
SomeEnum = RGen::MetamodelBuilder::DataTypes::Enum.new(
|
18
|
-
:name => "SomeEnum", :literals => [:A, :B, :'non-word*chars'])
|
18
|
+
:name => "SomeEnum", :literals => [:A, :B, :'non-word*chars', :'2you'])
|
19
19
|
class TestNode < RGen::MetamodelBuilder::MMBase
|
20
20
|
has_attr 'text', String
|
21
21
|
has_attr 'integer', Integer
|
@@ -352,7 +352,8 @@ TestNode {
|
|
352
352
|
testModel = [
|
353
353
|
TestMM::TestNode.new(:enum => :A),
|
354
354
|
TestMM::TestNode.new(:enum => :B),
|
355
|
-
TestMM::TestNode.new(:enum => :'non-word*chars')
|
355
|
+
TestMM::TestNode.new(:enum => :'non-word*chars'),
|
356
|
+
TestMM::TestNode.new(:enum => :'2you')
|
356
357
|
]
|
357
358
|
output = StringWriter.new
|
358
359
|
serialize(testModel, TestMM, output)
|
@@ -360,6 +361,7 @@ TestNode {
|
|
360
361
|
TestNode enum: A
|
361
362
|
TestNode enum: B
|
362
363
|
TestNode enum: "non-word*chars"
|
364
|
+
TestNode enum: "2you"
|
363
365
|
), output
|
364
366
|
end
|
365
367
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rtext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rgen
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,12 @@ dependencies:
|
|
21
21
|
version: 0.6.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.6.0
|
25
30
|
description: RText can be used to derive textual languages from an RGen metamodel
|
26
31
|
with very little effort.
|
27
32
|
email: martin dot thiede at gmx de
|
@@ -77,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
82
|
version: '0'
|
78
83
|
requirements: []
|
79
84
|
rubyforge_project:
|
80
|
-
rubygems_version: 1.
|
85
|
+
rubygems_version: 1.8.23
|
81
86
|
signing_key:
|
82
87
|
specification_version: 3
|
83
88
|
summary: Ruby Textual Modelling
|