EFL 1.0.1 → 1.0.2

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/lib/EFL.rb CHANGED
@@ -209,13 +209,14 @@ class Generator
209
209
  end #mixGen
210
210
 
211
211
  def replace(source_str, replace_list) #:nodoc:
212
- delta_length = 0
212
+ source_str = "#{source_str} "
213
+ delta_length = 0
213
214
  result_str = source_str.dup
214
215
  replace_list.each { |rep|
215
- text_without_the_quote_problem = @sub_hash[rep[2]].text.gsub(/"/, '\"')
216
- str1 = result_str[0, rep[0] + delta_length]
216
+ text_without_the_quote_problem = @sub_hash[rep[2]].text.gsub(/"/, '\"')
217
+ str1 = result_str[0, rep[0] + delta_length]
217
218
  str2 = result_str[rep[0] + delta_length, rep[1] - rep[0] +1]
218
- str3 = result_str[rep[1] + 1 + delta_length, result_str.length - 1]
219
+ str3 = result_str[rep[1] + 1 + delta_length, result_str.length]
219
220
  str2 =~ @sub_hash[rep[2]].reg_exp.zoom_list.last
220
221
  str = ''
221
222
  eval("str = " + '"' + text_without_the_quote_problem + '"')
@@ -226,7 +227,7 @@ class Generator
226
227
  end
227
228
 
228
229
  def mix_subs(sub_list, i_file) #:nodoc:
229
- result = []
230
+ result = []
230
231
  sub_list.each { |s|
231
232
  begin
232
233
 
@@ -37,7 +37,7 @@ class Regexp
37
37
 
38
38
  op1 = self.dup
39
39
  if op1.minus_list && (op1.minus_list !=[]) then #due '-' has major precedence than '>', this error is detected here
40
- raise "erroooor minus"
40
+ raise "error minus"
41
41
  end
42
42
  if op1.zoom_list
43
43
  op1.zoom_list = op1.zoom_list + op2.zoom_list
@@ -0,0 +1 @@
1
+ Esto es Eso es
@@ -0,0 +1,45 @@
1
+ require 'EFL'
2
+
3
+ class Uno < Generator
4
+ def initialize
5
+ super()
6
+ #~ gsub(/Estos/, 'ESTO', 's1')
7
+ #~ sub(/Eso/, 'XXX','s1')
8
+
9
+ before(/Esto/, '-ESTO-', 's1')
10
+ after(/Eso/, '-ESO-', 's2')
11
+ gbefore(/es/, '-ES-', 's3')
12
+
13
+ prod('ejemplar.txt', 'salida2.txt')
14
+ end
15
+ end
16
+
17
+ class Dos < Generator
18
+ def initialize
19
+ super
20
+ sub(/es/, 'ES', 's1')
21
+ sub(/una/, 'UNA')
22
+ prod('ejemplar.txt', 'salida.txt')
23
+ end
24
+ end
25
+
26
+ class Tres < Generator
27
+ def initialize
28
+ super
29
+ sub(/cosa/, 'COSA', 's1')
30
+ prod('ejemplar.txt', 'salida.txt')
31
+ end
32
+ end
33
+
34
+ class Cuatro < Generator
35
+ def initialize
36
+ super
37
+ sub(/COSA/, 'cosa', 's1')
38
+ # prod('ejemplar.txt', 'salida.txt')
39
+ prod('salida.txt', 'salida.txt')
40
+ end
41
+ end
42
+
43
+ (Uno.new).gen
44
+ #~ (Uno.new + Dos.new + Tres.new).gen
45
+ #~ Cuatro.new.gen
@@ -0,0 +1,2 @@
1
+ -ESTO-Esto -ES-es Eso-ESO- -ES-es
2
+
@@ -12,12 +12,13 @@ require 'EFL'
12
12
  def identicalFiles? (f1, f2)
13
13
  result = false
14
14
  File.open(f1) { |fi1|
15
- content01 = fi1.read
15
+ content1 = fi1.read
16
16
  File.open(f2) { |fi2|
17
17
  content2 = fi2.read
18
- result = content01 == content2
18
+ result = (content1.strip == content2.strip)
19
19
  }
20
20
  }
21
+ return result
21
22
  end #identicalFiles
22
23
 
23
24
  class Gen < Test::Unit::TestCase
@@ -10,12 +10,13 @@ require "EFL"
10
10
  def identicalFiles? (f1, f2)
11
11
  result = false
12
12
  File.open(f1) { |fi1|
13
- content01 = fi1.read
13
+ content1 = fi1.read
14
14
  File.open(f2) { |fi2|
15
15
  content2 = fi2.read
16
- result = content01 == content2
16
+ result = (content1.strip == content2.strip)
17
17
  }
18
18
  }
19
+ return result
19
20
  end #identicalFiles
20
21
 
21
22
 
@@ -50,7 +51,8 @@ class BeforeAfter < Test::Unit::TestCase
50
51
  (g1+g2+g3).gen
51
52
  assert( identicalFiles?('archAuxiliares/Matriz_3.java', 'archAuxiliares/MatrizOut3.java') )
52
53
  end
53
- def test_2
54
+
55
+ def test_2
54
56
  g1 = generator {
55
57
  reg_exp_str_1 = nested_symbols( '{' , '}' ).to_s
56
58
  reg_exp_str_2 = nested_symbols( '(' , ')' ).to_s
@@ -10,12 +10,13 @@ require "EFL"
10
10
  def identicalFiles? (f1, f2)
11
11
  result = false
12
12
  File.open(f1) { |fi1|
13
- content01 = fi1.read
13
+ content1 = fi1.read
14
14
  File.open(f2) { |fi2|
15
15
  content2 = fi2.read
16
- result = content01 == content2
16
+ result = (content1.strip == content2.strip)
17
17
  }
18
18
  }
19
+ return result
19
20
  end #identicalFiles
20
21
 
21
22
  class Minus < Test::Unit::TestCase
@@ -10,12 +10,13 @@ require "EFL"
10
10
  def identicalFiles? (f1, f2)
11
11
  result = false
12
12
  File.open(f1) { |fi1|
13
- content01 = fi1.read
13
+ content1 = fi1.read
14
14
  File.open(f2) { |fi2|
15
15
  content2 = fi2.read
16
- result = content01 == content2
16
+ result = (content1.strip == content2.strip)
17
17
  }
18
18
  }
19
+ return result
19
20
  end #identicalFiles
20
21
 
21
22
 
@@ -13,9 +13,10 @@ def identicalFiles? (f1, f2)
13
13
  content1 = fi1.read
14
14
  File.open(f2) { |fi2|
15
15
  content2 = fi2.read
16
- result = content1 == content2
16
+ result = (content1.strip == content2.strip)
17
17
  }
18
18
  }
19
+ return result
19
20
  end #identicalFiles
20
21
 
21
22
  class Rename < Test::Unit::TestCase
@@ -72,3 +72,4 @@ public class MatrizExterna {
72
72
  } /* multiplicarMatrices */
73
73
 
74
74
  } /* Matriz */
75
+
@@ -66,3 +66,4 @@ public class Matriz {{
66
66
  } /* for i */
67
67
  return matrizResultado;
68
68
  }} /* Matriz */
69
+
@@ -84,3 +84,4 @@ public class Matriz {{
84
84
  } /* multiplicarMatrices */
85
85
 
86
86
  } /* Matriz */
87
+
@@ -72,3 +72,4 @@ public class {
72
72
  } /* multiplicarMatrices */
73
73
 
74
74
  } /* Matriz */
75
+
@@ -72,3 +72,4 @@ public class <<sub_2>><<after_1>> {
72
72
  } /* multiplicarMatrices */
73
73
 
74
74
  } /* Matriz<<after_1>> */
75
+
@@ -72,3 +72,4 @@ public class <<after_1>> {
72
72
  } /* multiplicarMatrices */
73
73
 
74
74
  } /* Matriz<<after_1>> */
75
+
@@ -19,3 +19,4 @@ public class Matriz {
19
19
 
20
20
 
21
21
  } /* Matriz */
22
+
@@ -19,3 +19,4 @@ public class Matriz {
19
19
 
20
20
 
21
21
  } /* Matriz */
22
+
@@ -19,3 +19,4 @@ public class Matriz {
19
19
 
20
20
 
21
21
  } /* Matriz */
22
+
@@ -14,3 +14,4 @@ public class matriz {Matriz
14
14
 
15
15
 
16
16
  } /* matriz */
17
+
@@ -84,3 +84,4 @@ public class Matriz {{
84
84
  } /* multiplicarMatrices */
85
85
 
86
86
  } /* Matriz */
87
+
@@ -16,3 +16,4 @@ perro
16
16
  </b2>
17
17
  perro
18
18
  </b1>
19
+
@@ -16,3 +16,4 @@ perro
16
16
  </b2>
17
17
  aqui
18
18
  </b1>
19
+
@@ -20,3 +20,4 @@ perro
20
20
  perro
21
21
  gato
22
22
  </b1>
23
+
@@ -8,3 +8,4 @@ aquiperroaqui<b2>
8
8
  perro
9
9
  gato
10
10
  </b2>aquiperroaqui
11
+
@@ -16,3 +16,4 @@ perro
16
16
  </b2>
17
17
  perro
18
18
  </b1>
19
+
@@ -16,3 +16,4 @@ perro
16
16
  </b2>
17
17
  aqui
18
18
  </b1>
19
+
@@ -24,3 +24,4 @@
24
24
  </b2>
25
25
 
26
26
  </b1>
27
+
@@ -326,3 +326,4 @@ end #AspectGen
326
326
 
327
327
 
328
328
 
329
+
@@ -326,3 +326,4 @@ end #AspectGen
326
326
 
327
327
 
328
328
 
329
+
@@ -326,3 +326,4 @@ end #AspectGen
326
326
 
327
327
 
328
328
 
329
+
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: EFL
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.1
7
- date: 2008-02-19 00:00:00 +01:00
6
+ version: 1.0.2
7
+ date: 2009-04-15 00:00:00 +02:00
8
8
  summary: A Ruby implementation of the Exemplar Flexibilization Language
9
9
  require_paths:
10
10
  - lib
@@ -87,9 +87,12 @@ files:
87
87
  - lib/EFL_regexp_generator.rb
88
88
  - lib/EFL_substitution.rb
89
89
  - lib/EFL_syntactic_sugar.rb
90
+ - lib/ejemplar.txt
90
91
  - lib/Hash Doc.doc
91
92
  - lib/lib.zip
92
93
  - lib/Limitaciones.txt
94
+ - lib/pruebaEFL.rb
95
+ - lib/salida2.txt
93
96
  - tests/Add_Sup_1.rb
94
97
  - tests/Add_Sup_1.rb.bak
95
98
  - tests/Add_Sup_1_NI.rb