EFL 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +36 -0
- data/lib/EFL.rb +494 -0
- data/lib/EFL_array.rb +20 -0
- data/lib/EFL_errors.rb +48 -0
- data/lib/EFL_hash.rb +18 -0
- data/lib/EFL_production.rb +49 -0
- data/lib/EFL_regexp.rb +112 -0
- data/lib/EFL_regexp_generator.rb +70 -0
- data/lib/EFL_substitution.rb +221 -0
- data/lib/EFL_syntactic_sugar.rb +67 -0
- data/lib/Hash Doc.doc +0 -0
- data/lib/Limitaciones.txt +3 -0
- data/lib/doc/classes/Generator.html +634 -0
- data/lib/doc/classes/Generator.src/M000008.html +18 -0
- data/lib/doc/classes/Generator.src/M000009.html +18 -0
- data/lib/doc/classes/Generator.src/M000010.html +18 -0
- data/lib/doc/classes/Generator.src/M000011.html +18 -0
- data/lib/doc/classes/Generator.src/M000012.html +18 -0
- data/lib/doc/classes/Generator.src/M000013.html +18 -0
- data/lib/doc/classes/Generator.src/M000014.html +18 -0
- data/lib/doc/classes/Generator.src/M000015.html +18 -0
- data/lib/doc/classes/Generator.src/M000016.html +28 -0
- data/lib/doc/classes/Generator.src/M000017.html +24 -0
- data/lib/doc/classes/Generator.src/M000018.html +157 -0
- data/lib/doc/classes/Generator.src/M000019.html +25 -0
- data/lib/doc/classes/Generator.src/M000020.html +30 -0
- data/lib/doc/classes/Generator.src/M000021.html +32 -0
- data/lib/doc/classes/Generator.src/M000022.html +22 -0
- data/lib/doc/classes/Generator.src/M000023.html +18 -0
- data/lib/doc/classes/Generator.src/M000024.html +27 -0
- data/lib/doc/classes/Generator.src/M000025.html +22 -0
- data/lib/doc/classes/Generator.src/M000026.html +18 -0
- data/lib/doc/classes/Generator.src/M000027.html +27 -0
- data/lib/doc/classes/Regexp.html +271 -0
- data/lib/doc/classes/Regexp.src/M000028.html +37 -0
- data/lib/doc/classes/Regexp.src/M000029.html +29 -0
- data/lib/doc/classes/Regexp.src/M000030.html +32 -0
- data/lib/doc/created.rid +1 -0
- data/lib/doc/files/EFL_rb.html +147 -0
- data/lib/doc/files/EFL_regexp_generator_rb.html +242 -0
- data/lib/doc/files/EFL_regexp_generator_rb.src/M000003.html +27 -0
- data/lib/doc/files/EFL_regexp_generator_rb.src/M000004.html +27 -0
- data/lib/doc/files/EFL_regexp_generator_rb.src/M000005.html +19 -0
- data/lib/doc/files/EFL_regexp_generator_rb.src/M000006.html +20 -0
- data/lib/doc/files/EFL_regexp_generator_rb.src/M000007.html +19 -0
- data/lib/doc/files/EFL_regexp_rb.html +139 -0
- data/lib/doc/files/EFL_syntactic_sugar_rb.html +208 -0
- data/lib/doc/files/EFL_syntactic_sugar_rb.src/M000001.html +29 -0
- data/lib/doc/files/EFL_syntactic_sugar_rb.src/M000002.html +19 -0
- data/lib/doc/fr_class_index.html +28 -0
- data/lib/doc/fr_file_index.html +30 -0
- data/lib/doc/fr_method_index.html +56 -0
- data/lib/doc/index.html +24 -0
- data/tests/Add_Sup_1.rb +223 -0
- data/tests/Add_Sup_1.rb.bak +223 -0
- data/tests/Add_Sup_1_NI.rb +25 -0
- data/tests/Add_Sup_2.rb +142 -0
- data/tests/Add_Sup_2.rb.bak +140 -0
- data/tests/All.rb +2 -0
- data/tests/All_1.rb +7 -0
- data/tests/All_2.rb +7 -0
- data/tests/All_2.rb.bak +5 -0
- data/tests/BeforeAfter.rb +83 -0
- data/tests/Bloques.rb +34 -0
- data/tests/Bloques.rb.bak +34 -0
- data/tests/Complementary.rb +144 -0
- data/tests/ComplementaryZoom.rb +78 -0
- data/tests/Del.rb +126 -0
- data/tests/Dup.rb +55 -0
- data/tests/Dup.rb.bak +54 -0
- data/tests/Error.rb +11 -0
- data/tests/ErrorArgClass.rb +169 -0
- data/tests/ErrorArgClass.rb.bak +158 -0
- data/tests/ErrorCollision.rb +218 -0
- data/tests/ErrorCollision.rb.bak +219 -0
- data/tests/ErrorWithoutDeclaration.rb +60 -0
- data/tests/ErrorWithoutDeclaration.rb.bak +60 -0
- data/tests/Extract.rb +56 -0
- data/tests/ExtractDollar.rb +17 -0
- data/tests/HashTest.rb +54 -0
- data/tests/HashTest.rb.bak +54 -0
- data/tests/Lista Czarnecki/AntiguaInterfaz/List.cpp +75 -0
- data/tests/Lista Czarnecki/AntiguaInterfaz/ListTransformer.rb +69 -0
- data/tests/Lista Czarnecki/AntiguaInterfaz/ListTransformer.rb.bak +100 -0
- data/tests/Lista Czarnecki/AntiguaInterfaz/ejecutame.bat +1 -0
- data/tests/Lista Czarnecki/AntiguaInterfaz/outDir/MyClassList.cpp +75 -0
- data/tests/Lista Czarnecki/AntiguaInterfaz/runme.bat +1 -0
- data/tests/Lista Czarnecki/AntiguaInterfaz/specification1.txt +5 -0
- data/tests/Lista Czarnecki/AntiguaInterfaz/specification2.txt +3 -0
- data/tests/Lista Czarnecki/AntiguaInterfaz/specification3.txt +5 -0
- data/tests/Lista Czarnecki/NuevaInterfaz/List.cpp +75 -0
- data/tests/Lista Czarnecki/NuevaInterfaz/ListTransformer.rb +58 -0
- data/tests/Lista Czarnecki/NuevaInterfaz/ListTransformer.rb.bak +57 -0
- data/tests/Lista Czarnecki/NuevaInterfaz/ejecutame.bat +1 -0
- data/tests/Lista Czarnecki/NuevaInterfaz/outDir/MyClassList.cpp +75 -0
- data/tests/Lista Czarnecki/NuevaInterfaz/outDir/NewClassList.cpp +75 -0
- data/tests/Lista Czarnecki/NuevaInterfaz/specification1.txt +5 -0
- data/tests/Lista Czarnecki/NuevaInterfaz/specification1.txt.bak +5 -0
- data/tests/Lista Czarnecki/NuevaInterfaz/specification2.txt +3 -0
- data/tests/Lista Czarnecki/NuevaInterfaz/specification3.txt +5 -0
- data/tests/Minus.rb +89 -0
- data/tests/Plus.rb.bak +48 -0
- data/tests/REVit.rb +84 -0
- data/tests/RenameTest.rb +46 -0
- data/tests/RenameTest.rb.bak +46 -0
- data/tests/SubCrash.rb +26 -0
- data/tests/SubList.rb.bak +43 -0
- data/tests/archAuxiliares/1.txt +328 -0
- data/tests/archAuxiliares/2.txt +328 -0
- data/tests/archAuxiliares/Bloques/s1.txt +328 -0
- data/tests/archAuxiliares/Copia de Matriz.java +19 -0
- data/tests/archAuxiliares/Gen/Tesis_156_1.lgi +10 -0
- data/tests/archAuxiliares/Gen/Tesis_156_2.lgi +10 -0
- data/tests/archAuxiliares/Gen/t01.txt +328 -0
- data/tests/archAuxiliares/Gen/t01.txt.bak +328 -0
- data/tests/archAuxiliares/Gen/t02.txt +328 -0
- data/tests/archAuxiliares/Gen/t02.txt.bak +328 -0
- data/tests/archAuxiliares/Gen/t03.txt +328 -0
- data/tests/archAuxiliares/Gen/t03.txt.bak +328 -0
- data/tests/archAuxiliares/Gen/t04.txt +328 -0
- data/tests/archAuxiliares/Gen/t04.txt.bak +328 -0
- data/tests/archAuxiliares/Gen/t1.txt +328 -0
- data/tests/archAuxiliares/Gen/t1.txt.bak +328 -0
- data/tests/archAuxiliares/Gen/t2.txt +328 -0
- data/tests/archAuxiliares/Gen/t2.txt.bak +328 -0
- data/tests/archAuxiliares/Gen/t5.txt +328 -0
- data/tests/archAuxiliares/Gen/t9.txt +328 -0
- data/tests/archAuxiliares/Gen/t9.txt.bak +328 -0
- data/tests/archAuxiliares/GenTesis_156_1.lgi +10 -0
- data/tests/archAuxiliares/Matriz.java +74 -0
- data/tests/archAuxiliares/MatrizOut.java +74 -0
- data/tests/archAuxiliares/MatrizOut10.java +68 -0
- data/tests/archAuxiliares/MatrizOut11.java +86 -0
- data/tests/archAuxiliares/MatrizOut2.java +74 -0
- data/tests/archAuxiliares/MatrizOut3.java +74 -0
- data/tests/archAuxiliares/MatrizOut4.java +74 -0
- data/tests/archAuxiliares/MatrizOut5.java +21 -0
- data/tests/archAuxiliares/MatrizOut6.java +21 -0
- data/tests/archAuxiliares/MatrizOut7.java +21 -0
- data/tests/archAuxiliares/MatrizOut8.java +16 -0
- data/tests/archAuxiliares/MatrizOut9.java +86 -0
- data/tests/archAuxiliares/MatrizOut_9.java +86 -0
- data/tests/archAuxiliares/Matriz_1.java +74 -0
- data/tests/archAuxiliares/Matriz_10.java +68 -0
- data/tests/archAuxiliares/Matriz_11.java +86 -0
- data/tests/archAuxiliares/Matriz_2.java +74 -0
- data/tests/archAuxiliares/Matriz_3.java +74 -0
- data/tests/archAuxiliares/Matriz_4.java +74 -0
- data/tests/archAuxiliares/Matriz_5.java +21 -0
- data/tests/archAuxiliares/Matriz_6.java +21 -0
- data/tests/archAuxiliares/Matriz_7.java +21 -0
- data/tests/archAuxiliares/Matriz_8.java +16 -0
- data/tests/archAuxiliares/Matriz_9.java +86 -0
- data/tests/archAuxiliares/Matriz_N_1.java +21 -0
- data/tests/archAuxiliares/Matriz_N_2.java +91 -0
- data/tests/archAuxiliares/N1.txt +18 -0
- data/tests/archAuxiliares/N1_EXPECTED.txt +18 -0
- data/tests/archAuxiliares/N1_OUT.txt +18 -0
- data/tests/archAuxiliares/N2_EXPECTED.txt +18 -0
- data/tests/archAuxiliares/N2_OUT.txt +18 -0
- data/tests/archAuxiliares/N3.txt +23 -0
- data/tests/archAuxiliares/N3_EXPECTED.txt +22 -0
- data/tests/archAuxiliares/N3_OUT.txt +22 -0
- data/tests/archAuxiliares/N4_EXPECTED.txt +10 -0
- data/tests/archAuxiliares/N4_OUT.txt +10 -0
- data/tests/archAuxiliares/N5_OUT.txt +18 -0
- data/tests/archAuxiliares/N6_OUT.txt +18 -0
- data/tests/archAuxiliares/PedidorTerceroWS.jsp +142 -0
- data/tests/archAuxiliares/Tesis_156.lgi +7 -0
- data/tests/archAuxiliares/aspectgen.rb +328 -0
- data/tests/archAuxiliares/aspectgenCopy.rb +328 -0
- data/tests/archAuxiliares/extract_dollar.txt +1 -0
- data/tests/archAuxiliares/minus.txt +26 -0
- data/tests/archAuxiliares/minus_expected_1.txt +26 -0
- data/tests/archAuxiliares/minus_expected_2.txt +26 -0
- data/tests/archAuxiliares/minus_out_1.txt +26 -0
- data/tests/archAuxiliares/minus_out_2.txt +26 -0
- data/tests/archAuxiliares/p1.txt +328 -0
- data/tests/archAuxiliares/p2.txt +328 -0
- data/tests/archAuxiliares/s1.txt +328 -0
- data/tests/archAuxiliares/s2.txt +328 -0
- data/tests/archAuxiliares/s3.txt +328 -0
- data/tests/archAuxiliares/s4.txt +328 -0
- data/tests/archAuxiliares/s5.txt +328 -0
- data/tests/archAuxiliares/s7.txt +328 -0
- data/tests/archAuxiliares/s8.txt +328 -0
- data/tests/archAuxiliares/s9.txt +328 -0
- data/tests/archAuxiliares/text.txt +1 -0
- data/tests/delay.rb +33 -0
- data/tests/delay.rb.bak +33 -0
- data/tests/satisfy.rb +44 -0
- data/tests/satisfy.rb.bak +34 -0
- metadata +252 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
# <em>Copyright � 2007 by Ruben Heradio Gil, Jose Antonio Cerrada Somolinos, Jose Ramon Coz Fernandez and Jose Carlos Lopez Ruiz.</em>
|
2
|
+
# <em>This file is part of <b>EFL-A Ruby implementation of the Exemplar Flexibilization Language.</b></em>
|
3
|
+
# <em>EFL is distributed under the terms of the GNU Lesser General Public License (LGPL).</em>
|
4
|
+
# <em>EFL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</em>
|
5
|
+
# <em>EFL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</em>
|
6
|
+
# <em>You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.</em>
|
7
|
+
# <em>Contact Information: Ruben Heradio Gil (rheradio@issi.uned.es). Phone number: 00 34 91 398 8242, Postal address: Dpto. de Ingenier�a de SW y Sistemas Inform�ticos. E.T.S.I. Inform�tica, UNED. C/ Juan del Rosal, 16. 28040 Madrid.</em>
|
8
|
+
#
|
9
|
+
# = Syntactic sugar for writing generators and regular expressions
|
10
|
+
|
11
|
+
# Syntactic sugar for writing generators.
|
12
|
+
# For simple generators, instead of writing:
|
13
|
+
#
|
14
|
+
# <tt>class SimpleGen < Generator</tt>
|
15
|
+
# def initialize
|
16
|
+
# substitutions
|
17
|
+
# productions
|
18
|
+
# end
|
19
|
+
# auxiliar_methods
|
20
|
+
# <tt>end</tt>
|
21
|
+
#
|
22
|
+
# <tt>SimpleGen.new</tt>
|
23
|
+
#
|
24
|
+
# you can write:
|
25
|
+
#
|
26
|
+
# <tt>simple_gen = generator {</tt>
|
27
|
+
# substitutions
|
28
|
+
# productions
|
29
|
+
# auxiliar_methods
|
30
|
+
# <tt>}</tt>
|
31
|
+
|
32
|
+
def generator(args=nil, &block)
|
33
|
+
g = Generator.new
|
34
|
+
if args
|
35
|
+
args_code = ''
|
36
|
+
args.each { |key, value|
|
37
|
+
value = "'#{value}'" if value.kind_of? String
|
38
|
+
code = <<END_OF_CODE
|
39
|
+
def g.#{key}
|
40
|
+
@#{key}
|
41
|
+
end
|
42
|
+
|
43
|
+
def g.#{key}=(val)
|
44
|
+
@#{key} = val
|
45
|
+
end
|
46
|
+
|
47
|
+
g.#{key} = #{value}
|
48
|
+
END_OF_CODE
|
49
|
+
args_code += code
|
50
|
+
}
|
51
|
+
eval(args_code)
|
52
|
+
end
|
53
|
+
g.instance_eval(&block) if block
|
54
|
+
return g
|
55
|
+
end # Syntactic sugar for writing generators
|
56
|
+
|
57
|
+
|
58
|
+
# Syntactic sugar for the regular expressions complement operator Regexp#o.
|
59
|
+
# Instead of writing:
|
60
|
+
# <tt>regular_expression.o</tt>
|
61
|
+
# you can write:
|
62
|
+
# <tt>o(regular_expression)</tt>
|
63
|
+
|
64
|
+
def o(regular_expression)
|
65
|
+
result = regular_expression.dup
|
66
|
+
return result.o
|
67
|
+
end # Syntactic sugar for the regular expressions complement
|
data/lib/Hash Doc.doc
ADDED
Binary file
|
@@ -0,0 +1,634 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Generator</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Generator</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/EFL_rb.html">
|
59
|
+
EFL.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<ul>
|
83
|
+
<li>Generators are specified using substititions (with the <em><a
|
84
|
+
href="Generator.html#M000008">sub</a></em> and <em><a
|
85
|
+
href="Generator.html#M000012">gsub</a></em> methods), productions (with the
|
86
|
+
<em><a href="Generator.html#M000016">prod</a></em> method) and generations
|
87
|
+
(with the <em><a href="Generator.html#M000018">gen</a></em> method).
|
88
|
+
|
89
|
+
</li>
|
90
|
+
<li>Generators can be combined in a sequential orden or mixed using the <a
|
91
|
+
href="Generator.html#M000023">add</a> (with the + and <em><a
|
92
|
+
href="Generator.html#M000023">add</a></em> methods) and the superposition
|
93
|
+
(with the << and <em><a href="Generator.html#M000026">sup!</a></em>
|
94
|
+
methods).
|
95
|
+
|
96
|
+
</li>
|
97
|
+
</ul>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<div id="method-list">
|
105
|
+
<h3 class="section-bar">Methods</h3>
|
106
|
+
|
107
|
+
<div class="name-list">
|
108
|
+
<a href="#M000022">+</a>
|
109
|
+
<a href="#M000025"><<</a>
|
110
|
+
<a href="#M000023">add</a>
|
111
|
+
<a href="#M000024">add?</a>
|
112
|
+
<a href="#M000011">after</a>
|
113
|
+
<a href="#M000010">before</a>
|
114
|
+
<a href="#M000009">del</a>
|
115
|
+
<a href="#M000020">extract</a>
|
116
|
+
<a href="#M000021">extract_dollar</a>
|
117
|
+
<a href="#M000015">gafter</a>
|
118
|
+
<a href="#M000014">gbefore</a>
|
119
|
+
<a href="#M000013">gdel</a>
|
120
|
+
<a href="#M000018">gen</a>
|
121
|
+
<a href="#M000019">gen?</a>
|
122
|
+
<a href="#M000012">gsub</a>
|
123
|
+
<a href="#M000016">prod</a>
|
124
|
+
<a href="#M000017">prod?</a>
|
125
|
+
<a href="#M000008">sub</a>
|
126
|
+
<a href="#M000026">sup!</a>
|
127
|
+
<a href="#M000027">sup?</a>
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
|
131
|
+
</div>
|
132
|
+
|
133
|
+
|
134
|
+
<!-- if includes -->
|
135
|
+
|
136
|
+
<div id="section">
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<!-- if method_list -->
|
146
|
+
<div id="methods">
|
147
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
148
|
+
|
149
|
+
<div id="method-M000022" class="method-detail">
|
150
|
+
<a name="M000022"></a>
|
151
|
+
|
152
|
+
<div class="method-heading">
|
153
|
+
<a href="Generator.src/M000022.html" target="Code" class="method-signature"
|
154
|
+
onclick="popupCode('Generator.src/M000022.html');return false;">
|
155
|
+
<span class="method-name">+</span><span class="method-args">(generator)</span>
|
156
|
+
</a>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
<div class="method-description">
|
160
|
+
<p>
|
161
|
+
Adds <tt>self</tt> and <tt>generator</tt>. Returns a new <a
|
162
|
+
href="Generator.html">Generator</a> which substitutions and productions are
|
163
|
+
the union of the substitutions and the productions of <tt>self</tt> and
|
164
|
+
<tt>generator</tt>. Collisions between the substitutions of <tt>self</tt>
|
165
|
+
and <tt>generator</tt> will be detected automatically calling the method
|
166
|
+
<tt><a href="Generator.html#M000024">add?</a></tt> (internally, + calls
|
167
|
+
<tt><a href="Generator.html#M000024">add?</a></tt>)
|
168
|
+
</p>
|
169
|
+
</div>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<div id="method-M000025" class="method-detail">
|
173
|
+
<a name="M000025"></a>
|
174
|
+
|
175
|
+
<div class="method-heading">
|
176
|
+
<a href="Generator.src/M000025.html" target="Code" class="method-signature"
|
177
|
+
onclick="popupCode('Generator.src/M000025.html');return false;">
|
178
|
+
<span class="method-name"><<</span><span class="method-args">(generator)</span>
|
179
|
+
</a>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
<div class="method-description">
|
183
|
+
<p>
|
184
|
+
Superpose <tt>generator</tt> to <tt>self</tt>. << actualizes the
|
185
|
+
substitutions and productions of <tt>self</tt> with the substitutions and
|
186
|
+
productions of <tt>generator</tt>. The substitutions and productions of
|
187
|
+
<tt>generator</tt> with a common name in <tt>self</tt> are overwritten in
|
188
|
+
<tt>self</tt>. The others are added to <tt>self</tt>. Collisions between
|
189
|
+
the substitutions of <tt>self</tt> and <tt>generator</tt> will be detected
|
190
|
+
automatically calling the method <tt>sup</tt> (internally, << calls
|
191
|
+
<tt><a href="Generator.html#M000027">sup?</a></tt>)
|
192
|
+
</p>
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
<div id="method-M000023" class="method-detail">
|
197
|
+
<a name="M000023"></a>
|
198
|
+
|
199
|
+
<div class="method-heading">
|
200
|
+
<a href="Generator.src/M000023.html" target="Code" class="method-signature"
|
201
|
+
onclick="popupCode('Generator.src/M000023.html');return false;">
|
202
|
+
<span class="method-name">add</span><span class="method-args">(generator)</span>
|
203
|
+
</a>
|
204
|
+
</div>
|
205
|
+
|
206
|
+
<div class="method-description">
|
207
|
+
<p>
|
208
|
+
Prefix notation for +
|
209
|
+
</p>
|
210
|
+
</div>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
<div id="method-M000024" class="method-detail">
|
214
|
+
<a name="M000024"></a>
|
215
|
+
|
216
|
+
<div class="method-heading">
|
217
|
+
<a href="Generator.src/M000024.html" target="Code" class="method-signature"
|
218
|
+
onclick="popupCode('Generator.src/M000024.html');return false;">
|
219
|
+
<span class="method-name">add?</span><span class="method-args">(generator)</span>
|
220
|
+
</a>
|
221
|
+
</div>
|
222
|
+
|
223
|
+
<div class="method-description">
|
224
|
+
<p>
|
225
|
+
Returns if it is possible to <a href="Generator.html#M000023">add</a>
|
226
|
+
<tt>self</tt> and <tt>generator</tt> (see + and <tt><a
|
227
|
+
href="Generator.html#M000023">add</a></tt>)
|
228
|
+
</p>
|
229
|
+
</div>
|
230
|
+
</div>
|
231
|
+
|
232
|
+
<div id="method-M000011" class="method-detail">
|
233
|
+
<a name="M000011"></a>
|
234
|
+
|
235
|
+
<div class="method-heading">
|
236
|
+
<a href="Generator.src/M000011.html" target="Code" class="method-signature"
|
237
|
+
onclick="popupCode('Generator.src/M000011.html');return false;">
|
238
|
+
<span class="method-name">after</span><span class="method-args">(reg_exp, text, name = nil)</span>
|
239
|
+
</a>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
<div class="method-description">
|
243
|
+
<p>
|
244
|
+
Specifies a kind of substitution that inserts the <tt>text</tt> string <a
|
245
|
+
href="Generator.html#M000011">after</a> the first occurrence of the pattern
|
246
|
+
expressed by the <tt>reg_exp</tt> regular expression. Optionally, this
|
247
|
+
substitution can be named using the <tt>name</tt> string. To express
|
248
|
+
complex ‘<a href="Generator.html#M000011">after</a> inserts’,
|
249
|
+
the regular expressions can be combined using the zoom operator (<a
|
250
|
+
href="Regexp.html">Regexp</a>#>).
|
251
|
+
</p>
|
252
|
+
</div>
|
253
|
+
</div>
|
254
|
+
|
255
|
+
<div id="method-M000010" class="method-detail">
|
256
|
+
<a name="M000010"></a>
|
257
|
+
|
258
|
+
<div class="method-heading">
|
259
|
+
<a href="Generator.src/M000010.html" target="Code" class="method-signature"
|
260
|
+
onclick="popupCode('Generator.src/M000010.html');return false;">
|
261
|
+
<span class="method-name">before</span><span class="method-args">(reg_exp, text, name = nil)</span>
|
262
|
+
</a>
|
263
|
+
</div>
|
264
|
+
|
265
|
+
<div class="method-description">
|
266
|
+
<p>
|
267
|
+
Specifies a kind of substitution that inserts the <tt>text</tt> string <a
|
268
|
+
href="Generator.html#M000010">before</a> the first occurrence of the
|
269
|
+
pattern expressed by the <tt>reg_exp</tt> regular expression. Optionally,
|
270
|
+
this substitution can be named using the <tt>name</tt> string. To express
|
271
|
+
complex ‘<a href="Generator.html#M000010">before</a> inserts’,
|
272
|
+
the regular expressions can be combined using the zoom operator (<a
|
273
|
+
href="Regexp.html">Regexp</a>#>).
|
274
|
+
</p>
|
275
|
+
</div>
|
276
|
+
</div>
|
277
|
+
|
278
|
+
<div id="method-M000009" class="method-detail">
|
279
|
+
<a name="M000009"></a>
|
280
|
+
|
281
|
+
<div class="method-heading">
|
282
|
+
<a href="Generator.src/M000009.html" target="Code" class="method-signature"
|
283
|
+
onclick="popupCode('Generator.src/M000009.html');return false;">
|
284
|
+
<span class="method-name">del</span><span class="method-args">(reg_exp, name = nil)</span>
|
285
|
+
</a>
|
286
|
+
</div>
|
287
|
+
|
288
|
+
<div class="method-description">
|
289
|
+
<p>
|
290
|
+
Specifies a kind of substitution that deletes the first occurrence of the
|
291
|
+
pattern expressed by the <tt>reg_exp</tt> regular expression. Optionally,
|
292
|
+
this substitution can be named using the <tt>name</tt> string. To express
|
293
|
+
complex deletes, the regular expressions can be combined using the zoom
|
294
|
+
operator (<a href="Regexp.html">Regexp</a>#>).
|
295
|
+
</p>
|
296
|
+
</div>
|
297
|
+
</div>
|
298
|
+
|
299
|
+
<div id="method-M000020" class="method-detail">
|
300
|
+
<a name="M000020"></a>
|
301
|
+
|
302
|
+
<div class="method-heading">
|
303
|
+
<a href="Generator.src/M000020.html" target="Code" class="method-signature"
|
304
|
+
onclick="popupCode('Generator.src/M000020.html');return false;">
|
305
|
+
<span class="method-name">extract</span><span class="method-args">(file, reg_exp)</span>
|
306
|
+
</a>
|
307
|
+
</div>
|
308
|
+
|
309
|
+
<div class="method-description">
|
310
|
+
<p>
|
311
|
+
Returns an array of the strings resulted on matching the <tt>reg_exp</tt>
|
312
|
+
regular expression on the input file <tt>file</tt>
|
313
|
+
</p>
|
314
|
+
</div>
|
315
|
+
</div>
|
316
|
+
|
317
|
+
<div id="method-M000021" class="method-detail">
|
318
|
+
<a name="M000021"></a>
|
319
|
+
|
320
|
+
<div class="method-heading">
|
321
|
+
<a href="Generator.src/M000021.html" target="Code" class="method-signature"
|
322
|
+
onclick="popupCode('Generator.src/M000021.html');return false;">
|
323
|
+
<span class="method-name">extract_dollar</span><span class="method-args">(file, reg_exp, number)</span>
|
324
|
+
</a>
|
325
|
+
</div>
|
326
|
+
|
327
|
+
<div class="method-description">
|
328
|
+
<p>
|
329
|
+
Returns an array of the strings grouped by the parenthesis <tt>number</tt>
|
330
|
+
when the <tt>reg_exp</tt> regular expression is matched on the input
|
331
|
+
<tt>file</tt>.
|
332
|
+
</p>
|
333
|
+
<p>
|
334
|
+
For example. if the content of <tt>myfile.txt</tt> is:
|
335
|
+
</p>
|
336
|
+
<p>
|
337
|
+
<tt>This is my code</tt>
|
338
|
+
</p>
|
339
|
+
<p>
|
340
|
+
The result of execute:
|
341
|
+
</p>
|
342
|
+
<p>
|
343
|
+
<tt>g = generator</tt>
|
344
|
+
</p>
|
345
|
+
<p>
|
346
|
+
<tt>puts "$1 = " + g.extract_dollar(‘myfile.txt’,
|
347
|
+
/(This).*?(code).*?/, 1).to_s</tt>
|
348
|
+
</p>
|
349
|
+
<p>
|
350
|
+
<tt>puts "$2 = " + g.extract_dollar(‘myfile.txt’,
|
351
|
+
/(This).*?(code).*?/, 2).to_s</tt>
|
352
|
+
</p>
|
353
|
+
<p>
|
354
|
+
would be
|
355
|
+
</p>
|
356
|
+
<p>
|
357
|
+
<tt>$1 = This</tt>
|
358
|
+
</p>
|
359
|
+
<p>
|
360
|
+
<tt>$2 = code</tt>
|
361
|
+
</p>
|
362
|
+
</div>
|
363
|
+
</div>
|
364
|
+
|
365
|
+
<div id="method-M000015" class="method-detail">
|
366
|
+
<a name="M000015"></a>
|
367
|
+
|
368
|
+
<div class="method-heading">
|
369
|
+
<a href="Generator.src/M000015.html" target="Code" class="method-signature"
|
370
|
+
onclick="popupCode('Generator.src/M000015.html');return false;">
|
371
|
+
<span class="method-name">gafter</span><span class="method-args">(reg_exp, text, name = nil)</span>
|
372
|
+
</a>
|
373
|
+
</div>
|
374
|
+
|
375
|
+
<div class="method-description">
|
376
|
+
<p>
|
377
|
+
Specifies a kind of substitution that inserts the <tt>text</tt> string <a
|
378
|
+
href="Generator.html#M000011">after</a> all the occurrences of the pattern
|
379
|
+
expressed by the <tt>reg_exp</tt> regular expression. Optionally, this
|
380
|
+
substitution can be named using the <tt>name</tt> string. To express
|
381
|
+
complex ‘global <a href="Generator.html#M000011">after</a>
|
382
|
+
inserts’, the regular expressions can be combined using the zoom
|
383
|
+
operator (<a href="Regexp.html">Regexp</a>#>).def <a
|
384
|
+
href="Generator.html#M000014">gbefore</a>(reg_exp, text, name = nil)
|
385
|
+
</p>
|
386
|
+
</div>
|
387
|
+
</div>
|
388
|
+
|
389
|
+
<div id="method-M000014" class="method-detail">
|
390
|
+
<a name="M000014"></a>
|
391
|
+
|
392
|
+
<div class="method-heading">
|
393
|
+
<a href="Generator.src/M000014.html" target="Code" class="method-signature"
|
394
|
+
onclick="popupCode('Generator.src/M000014.html');return false;">
|
395
|
+
<span class="method-name">gbefore</span><span class="method-args">(reg_exp, text, name = nil)</span>
|
396
|
+
</a>
|
397
|
+
</div>
|
398
|
+
|
399
|
+
<div class="method-description">
|
400
|
+
<p>
|
401
|
+
Specifies a kind of substitution that inserts the <tt>text</tt> string <a
|
402
|
+
href="Generator.html#M000010">before</a> all the occurrences of the pattern
|
403
|
+
expressed by the <tt>reg_exp</tt> regular expression. Optionally, this
|
404
|
+
substitution can be named using the <tt>name</tt> string. To express
|
405
|
+
complex ‘global <a href="Generator.html#M000010">before</a>
|
406
|
+
inserts’, the regular expressions can be combined using the zoom
|
407
|
+
operator (<a href="Regexp.html">Regexp</a>#>).def <a
|
408
|
+
href="Generator.html#M000014">gbefore</a>(reg_exp, text, name = nil)
|
409
|
+
</p>
|
410
|
+
</div>
|
411
|
+
</div>
|
412
|
+
|
413
|
+
<div id="method-M000013" class="method-detail">
|
414
|
+
<a name="M000013"></a>
|
415
|
+
|
416
|
+
<div class="method-heading">
|
417
|
+
<a href="Generator.src/M000013.html" target="Code" class="method-signature"
|
418
|
+
onclick="popupCode('Generator.src/M000013.html');return false;">
|
419
|
+
<span class="method-name">gdel</span><span class="method-args">(reg_exp, name = nil)</span>
|
420
|
+
</a>
|
421
|
+
</div>
|
422
|
+
|
423
|
+
<div class="method-description">
|
424
|
+
<p>
|
425
|
+
Specifies a kind of substitution that deletes all the occurrence of the
|
426
|
+
pattern expressed by the <tt>reg_exp</tt> regular expression. Optionally,
|
427
|
+
this substitution can be named using the <tt>name</tt> string. To express
|
428
|
+
complex deletes, the regular expressions can be combined using the zoom
|
429
|
+
operator (<a href="Regexp.html">Regexp</a>#>).
|
430
|
+
</p>
|
431
|
+
</div>
|
432
|
+
</div>
|
433
|
+
|
434
|
+
<div id="method-M000018" class="method-detail">
|
435
|
+
<a name="M000018"></a>
|
436
|
+
|
437
|
+
<div class="method-heading">
|
438
|
+
<a href="Generator.src/M000018.html" target="Code" class="method-signature"
|
439
|
+
onclick="popupCode('Generator.src/M000018.html');return false;">
|
440
|
+
<span class="method-name">gen</span><span class="method-args">(prod_list = nil)</span>
|
441
|
+
</a>
|
442
|
+
</div>
|
443
|
+
|
444
|
+
<div class="method-description">
|
445
|
+
<p>
|
446
|
+
Specifies the execution of the set of productions <tt>prod_list</tt>.
|
447
|
+
</p>
|
448
|
+
<ul>
|
449
|
+
<li>If <tt>prod_list</tt> is not specified, it will contain implicitly all the
|
450
|
+
productions defined <a href="Generator.html#M000010">before</a> the current
|
451
|
+
generation.
|
452
|
+
|
453
|
+
</li>
|
454
|
+
<li>The order of the productions in <tt>prod_list</tt> is irrelevant.
|
455
|
+
|
456
|
+
</li>
|
457
|
+
<li>It is posible that several substitutions included in the productions of
|
458
|
+
<tt>sub_list</tt> try to make different changes over the same area of the
|
459
|
+
exemplar. This kind of collisions will be detected automatically calling
|
460
|
+
the method <tt><a href="Generator.html#M000019">gen?</a></tt> (internally,
|
461
|
+
<tt><a href="Generator.html#M000018">gen</a></tt> calls <tt><a
|
462
|
+
href="Generator.html#M000019">gen?</a></tt>).
|
463
|
+
|
464
|
+
</li>
|
465
|
+
</ul>
|
466
|
+
</div>
|
467
|
+
</div>
|
468
|
+
|
469
|
+
<div id="method-M000019" class="method-detail">
|
470
|
+
<a name="M000019"></a>
|
471
|
+
|
472
|
+
<div class="method-heading">
|
473
|
+
<a href="Generator.src/M000019.html" target="Code" class="method-signature"
|
474
|
+
onclick="popupCode('Generator.src/M000019.html');return false;">
|
475
|
+
<span class="method-name">gen?</span><span class="method-args">(prod_list = nil)</span>
|
476
|
+
</a>
|
477
|
+
</div>
|
478
|
+
|
479
|
+
<div class="method-description">
|
480
|
+
<p>
|
481
|
+
Returns if it is possible to execute a generation (see <tt><a
|
482
|
+
href="Generator.html#M000018">gen</a></tt>)
|
483
|
+
</p>
|
484
|
+
</div>
|
485
|
+
</div>
|
486
|
+
|
487
|
+
<div id="method-M000012" class="method-detail">
|
488
|
+
<a name="M000012"></a>
|
489
|
+
|
490
|
+
<div class="method-heading">
|
491
|
+
<a href="Generator.src/M000012.html" target="Code" class="method-signature"
|
492
|
+
onclick="popupCode('Generator.src/M000012.html');return false;">
|
493
|
+
<span class="method-name">gsub</span><span class="method-args">(reg_exp, text, name = nil)</span>
|
494
|
+
</a>
|
495
|
+
</div>
|
496
|
+
|
497
|
+
<div class="method-description">
|
498
|
+
<p>
|
499
|
+
Specifies the change of all the occurrences of the pattern expressed by the
|
500
|
+
<tt>reg_exp</tt> regular expression to the <tt>text</tt> string.
|
501
|
+
Optionally, a substitution can be named using the <tt>name</tt> string. To
|
502
|
+
build complex substitution patterns, the regular expressions can be
|
503
|
+
combined using the zoom operator (<a href="Regexp.html">Regexp</a>#>).
|
504
|
+
</p>
|
505
|
+
</div>
|
506
|
+
</div>
|
507
|
+
|
508
|
+
<div id="method-M000016" class="method-detail">
|
509
|
+
<a name="M000016"></a>
|
510
|
+
|
511
|
+
<div class="method-heading">
|
512
|
+
<a href="Generator.src/M000016.html" target="Code" class="method-signature"
|
513
|
+
onclick="popupCode('Generator.src/M000016.html');return false;">
|
514
|
+
<span class="method-name">prod</span><span class="method-args">(i_file, o_file, sub_list = nil, name = nil)</span>
|
515
|
+
</a>
|
516
|
+
</div>
|
517
|
+
|
518
|
+
<div class="method-description">
|
519
|
+
<p>
|
520
|
+
Specifies the application of a set of substitutions (<tt>sub_list</tt>) on
|
521
|
+
an input file (<tt>i_file</tt>) to produce an output file
|
522
|
+
(<tt>o_file</tt>).
|
523
|
+
</p>
|
524
|
+
<ul>
|
525
|
+
<li>Optionally, a production can be named using the <tt>name</tt> string.
|
526
|
+
|
527
|
+
</li>
|
528
|
+
<li>If <tt>sub_list</tt> is not specified, it will contain implicitly all the
|
529
|
+
substitutions defined <a href="Generator.html#M000010">before</a> the
|
530
|
+
current production.
|
531
|
+
|
532
|
+
</li>
|
533
|
+
<li>The order of the substitutions in <tt>sub_list</tt> is irrelevant.
|
534
|
+
|
535
|
+
</li>
|
536
|
+
<li>It is posible that several substitutions of <tt>sub_list</tt> try to make
|
537
|
+
different changes over the same area of the exemplar. This kind of
|
538
|
+
collisions will be detected automatically calling the method <tt><a
|
539
|
+
href="Generator.html#M000017">prod?</a></tt> (internally, <tt><a
|
540
|
+
href="Generator.html#M000016">prod</a></tt> calls <tt><a
|
541
|
+
href="Generator.html#M000017">prod?</a></tt>).
|
542
|
+
|
543
|
+
</li>
|
544
|
+
</ul>
|
545
|
+
</div>
|
546
|
+
</div>
|
547
|
+
|
548
|
+
<div id="method-M000017" class="method-detail">
|
549
|
+
<a name="M000017"></a>
|
550
|
+
|
551
|
+
<div class="method-heading">
|
552
|
+
<a href="Generator.src/M000017.html" target="Code" class="method-signature"
|
553
|
+
onclick="popupCode('Generator.src/M000017.html');return false;">
|
554
|
+
<span class="method-name">prod?</span><span class="method-args">(i_file, o_file, sub_list = nil)</span>
|
555
|
+
</a>
|
556
|
+
</div>
|
557
|
+
|
558
|
+
<div class="method-description">
|
559
|
+
<p>
|
560
|
+
Returns if it is possible to execute a production (see <tt><a
|
561
|
+
href="Generator.html#M000016">prod</a></tt>)
|
562
|
+
</p>
|
563
|
+
</div>
|
564
|
+
</div>
|
565
|
+
|
566
|
+
<div id="method-M000008" class="method-detail">
|
567
|
+
<a name="M000008"></a>
|
568
|
+
|
569
|
+
<div class="method-heading">
|
570
|
+
<a href="Generator.src/M000008.html" target="Code" class="method-signature"
|
571
|
+
onclick="popupCode('Generator.src/M000008.html');return false;">
|
572
|
+
<span class="method-name">sub</span><span class="method-args">(reg_exp, text, name = nil)</span>
|
573
|
+
</a>
|
574
|
+
</div>
|
575
|
+
|
576
|
+
<div class="method-description">
|
577
|
+
<p>
|
578
|
+
Specifies the change of the first occurrence of the pattern expressed by
|
579
|
+
the <tt>reg_exp</tt> regular expression to the <tt>text</tt> string.
|
580
|
+
Optionally, a substitution can be named using the <tt>name</tt> string. To
|
581
|
+
build complex substitution patterns, the regular expressions can be
|
582
|
+
combined using the zoom operator (<a href="Regexp.html">Regexp</a>#>).
|
583
|
+
</p>
|
584
|
+
</div>
|
585
|
+
</div>
|
586
|
+
|
587
|
+
<div id="method-M000026" class="method-detail">
|
588
|
+
<a name="M000026"></a>
|
589
|
+
|
590
|
+
<div class="method-heading">
|
591
|
+
<a href="Generator.src/M000026.html" target="Code" class="method-signature"
|
592
|
+
onclick="popupCode('Generator.src/M000026.html');return false;">
|
593
|
+
<span class="method-name">sup!</span><span class="method-args">(generator)</span>
|
594
|
+
</a>
|
595
|
+
</div>
|
596
|
+
|
597
|
+
<div class="method-description">
|
598
|
+
<p>
|
599
|
+
Prefix notation for <<
|
600
|
+
</p>
|
601
|
+
</div>
|
602
|
+
</div>
|
603
|
+
|
604
|
+
<div id="method-M000027" class="method-detail">
|
605
|
+
<a name="M000027"></a>
|
606
|
+
|
607
|
+
<div class="method-heading">
|
608
|
+
<a href="Generator.src/M000027.html" target="Code" class="method-signature"
|
609
|
+
onclick="popupCode('Generator.src/M000027.html');return false;">
|
610
|
+
<span class="method-name">sup?</span><span class="method-args">(generator)</span>
|
611
|
+
</a>
|
612
|
+
</div>
|
613
|
+
|
614
|
+
<div class="method-description">
|
615
|
+
<p>
|
616
|
+
Returns if it is possible to superpose <tt>self</tt> to <tt>generator</tt>
|
617
|
+
(see << and <tt><a href="Generator.html#M000026">sup!</a></tt>)
|
618
|
+
</p>
|
619
|
+
</div>
|
620
|
+
</div>
|
621
|
+
|
622
|
+
|
623
|
+
</div>
|
624
|
+
|
625
|
+
|
626
|
+
</div>
|
627
|
+
|
628
|
+
|
629
|
+
<div id="validator-badges">
|
630
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
631
|
+
</div>
|
632
|
+
|
633
|
+
</body>
|
634
|
+
</html>
|