Changeset 20100

Show
Ignore:
Timestamp:
09/28/08 11:36:08 (6 years ago)
Author:
drry
Message:
  • fixed regexes.
  • removed subversion properties.
  • et cetera.
Location:
platform/unbabel/trunk
Files:
12 modified

Legend:

Unmodified
Added
Removed
  • platform/unbabel/trunk/perl/lib/unbabel.pm

    r18558 r20100  
    66## called when this module is use'd 
    77#sub import { 
    8 #  print @_;  
     8#  print @_; 
    99#} 
    1010 
     
    2020  my ($self, $script, $comment) = @_; 
    2121  die "error: need a script" unless defined($script); 
    22   $script =~ ($comment . "\\s*(\\S+)\\s*::\\s*((?:\\S+\\s*->\\s*)+)(\\S+)\\s*");  
     22  $script =~ ($comment . "\\s*(\\S+)\\s*::\\s*((?:\\S+\\s*->\\s*)+)(\\S+)\\s*"); 
    2323  my ($funcname, $argtypes, $rettype) = ($1, $2, $3); 
    2424  die "error: signature not found: " . $script unless defined($1); 
     
    8484  } 
    8585  elsif ($type eq "String") { 
    86     $arg =~ s/\\/\\\\/g; 
    87     $arg =~ s/\n/\\n/g; 
    88     $arg =~ s/\t/\\t/g; 
     86    $arg =~ s/(?=[\\\r\n\t])/\\/g; 
    8987    return '"' . $arg . '"'; 
    9088  } 
     
    130128#  elsif (($arg ^ $arg) eq "") { # string 
    131129#    die "stringstring"; 
    132 #    $arg =~ s/\\/\\\\/g; 
    133 #    $arg =~ s/\n/\\n/g; 
    134 #    $arg =~ s/\t/\\t/g; 
     130#    $arg =~ s/(?=[\\\r\n\t])/\\/g; 
    135131#    return '"' . $arg . '"'; 
    136132#  } 
  • platform/unbabel/trunk/presen/biwascheme/extra_lib.js

    • Property svn:executable deleted
  • platform/unbabel/trunk/presen/biwascheme/prototype.160.js

    • Property svn:executable deleted
  • platform/unbabel/trunk/ruby/README.txt

    r18558 r20100  
    1 this is ruby implementation of Unbabel. 
     1this is Ruby implementation of Unbabel. 
    22 
    33= requirements 
  • platform/unbabel/trunk/ruby/lib/unbabel.rb

    r18558 r20100  
    1616  class String 
    1717    def lines 
    18       self.split(/\r?\n/).map{|line| line+"\n"} 
     18      self.split(/\r?\n|\r/).map{|line| line+"\n"} 
    1919    end 
    2020  end 
    2121end 
    22      
     22 
    2323 
    2424module Unbabel 
     
    9999      # run it 
    100100      if langdef.name == "Java" 
    101         temp_java  = File.expand_path("Unbabel.java", File.dirname(tempfile.path)) 
     101        temp_java   = File.expand_path("Unbabel.java", File.dirname(tempfile.path)) 
    102102        temp_jclass = File.expand_path("Unbabel.class", File.dirname(tempfile.path)) 
    103103        system "cp #{tempfile.path} #{temp_java}" 
     
    127127      when "[String]" 
    128128        result =~ /\((.*)\)/ 
    129         $1.split(/ /).map{|x|  
     129        $1.split(/ /).map{|x| 
    130130          x =~ /"(.*)"/ 
    131131          $1 
     
    153153      src = File.read(path) 
    154154      src.lines.each do |line| 
    155         if in_stub  
     155        if in_stub 
    156156          stub << line 
    157157        else 
     
    193193      case x 
    194194      when Array 
    195         list_prefix + "(" +  
     195        list_prefix + "(" + 
    196196          x.map{|item| format_object(item, delimiter, "")}.join(delimiter) + ")" 
    197197      when String 
     
    221221 
    222222  # TODO: configurable template path 
    223   dir = File.expand_path("../../templates/", File.dirname(__FILE__))  
     223  dir = File.expand_path("../../templates/", File.dirname(__FILE__)) 
    224224  Dir.glob("#{dir}/*.unb").each do |path| 
    225225    langdef = Unbabel::LangDef.load(path) 
  • platform/unbabel/trunk/ruby/spec/spec_java.rb

    r18558 r20100  
    22require 'unbabel' 
    33 
    4 describe "Unbabel" do  
     4describe "Unbabel" do 
    55 
    66  it "should call Java function" do 
     
    99      public static int fib (int x) { 
    1010        switch(x){ 
    11           case 0: return 0;  
     11          case 0: return 0; 
    1212          case 1: return 1; 
    13           default:  
     13          default: 
    1414            return fib(x-2) + fib(x-1); 
    1515        } 
  • platform/unbabel/trunk/ruby/spec/spec_perl.rb

    r18558 r20100  
    22require 'unbabel' 
    33 
    4 describe "Unbabel21" do  
     4describe "Unbabel21" do 
    55 
    66  it "should call Perl function" do 
  • platform/unbabel/trunk/ruby/spec/spec_python.rb

    r18558 r20100  
    22require 'unbabel' 
    33 
    4 describe "Unbabel21" do  
     4describe "Unbabel21" do 
    55 
    66  it "should call Python function" do 
  • platform/unbabel/trunk/ruby/spec/spec_ruby.rb

    r18558 r20100  
    22require 'unbabel' 
    33 
    4 describe "Unbabel21" do  
     4describe "Unbabel21" do 
    55 
    66  it "should call Ruby function :-)" do 
  • platform/unbabel/trunk/ruby/spec/spec_ruby19.rb

    r18558 r20100  
    22require 'unbabel' 
    33 
    4 describe "Unbabel21" do  
     4describe "Unbabel21" do 
    55 
    66  it "should call Ruby 1.9 function ;-)" do 
  • platform/unbabel/trunk/ruby/spec/spec_scheme.rb

    r18558 r20100  
    22require 'unbabel' 
    33 
    4 describe "Unbabel21" do  
     4describe "Unbabel21" do 
    55 
    66  it "should call Scheme function" do 
  • platform/unbabel/trunk/ruby/spec/spec_unbabel.rb

    r18558 r20100  
    166166### Runner 
    167167 
    168 describe "Unbabel::Runner" do  
     168describe "Unbabel::Runner" do 
    169169  before :all do 
    170170    @SRC = SRC_SCHEME_FIB 
     
    215215### Integraton test 
    216216 
    217 describe "Unbabel21" do  
     217describe "Unbabel21" do 
    218218 
    219219  it "should call Scheme fibonacchi" do