EFL_syntactic_sugar.rb

Path: EFL_syntactic_sugar.rb
Last Update: Fri Nov 16 17:24:29 +0100 2007

Copyright © 2007 by Ruben Heradio Gil, Jose Antonio Cerrada Somolinos, Jose Ramon Coz Fernandez and Jose Carlos Lopez Ruiz. This file is part of EFL-A Ruby implementation of the Exemplar Flexibilization Language. EFL is distributed under the terms of the GNU Lesser General Public License (LGPL). 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. 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. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <www.gnu.org/licenses/>. 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.

Syntactic sugar for writing generators and regular expressions

Methods

generator   o  

Public Instance methods

Syntactic sugar for writing generators. For simple generators, instead of writing:

class SimpleGen < Generator

      def initialize
              substitutions
              productions
      end
      auxiliar_methods

end

SimpleGen.new

you can write:

simple_gen = generator {

      substitutions
      productions
      auxiliar_methods

}

Syntactic sugar for the regular expressions complement operator Regexp#o. Instead of writing: regular_expression.o you can write: o(regular_expression)

[Validate]