Ticket #1760: opsc_version_fix.patch

File opsc_version_fix.patch, 1.6 KB (added by cotto, 4 years ago)
  • compilers/opsc/ops2c.nqp

     
    7575 -h --help                print this usage information 
    7676 -n --no-lines            do not print #line directives in generated C code (line numbers are not currently supported) 
    7777 
    78 #debugging options: 
     78debugging options: 
    7979 -g --debug               perform all processing but do not write to any files 
    8080"); 
    8181    pir::exit(0); 
  • compilers/opsc/src/Ops/File.pm

     
    311311            'VERSION'; 
    312312    } 
    313313 
    314     my $version := pir::chopn__ssi(slurp($version_filename), 1); 
     314    grammar VERSION { 
     315        rule TOP { <version> } 
     316        rule version { $<major>=(\d+) '.' $<minor>=(\d+) '.' $<patch>=(\d+) } 
     317    } 
     318 
     319    my $version       := slurp($version_filename); 
     320    my $version_match := VERSION.parse($version); 
    315321    #say("# $version"); 
    316     my @bits := split('.', $version); 
    317     self<version_major> := @bits[0]; 
    318     self<version_minor> := @bits[1]; 
    319     self<version_patch> := @bits[2]; 
    320     self<version>       := @bits; 
     322    self<version_major> := +$version_match<version><major>; 
     323    self<version_minor> := +$version_match<version><minor>; 
     324    self<version_patch> := +$version_match<version><patch>; 
     325    self<version>       := [ 
     326        +self<version_major>, 
     327        +self<version_minor>, 
     328        +self<version_match>, 
     329    ]; 
    321330} 
    322331 
    323332# Local Variables: