File: convsurveyor.pl

package info (click to toggle)
josm 0.0.svn14760%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 187,192 kB
  • sloc: java: 317,260; xml: 197,001; perl: 10,125; jsp: 250; sh: 112; makefile: 94; python: 29
file content (40 lines) | stat: -rw-r--r-- 782 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /usr/bin/perl -w

# Written by Dirk Stöcker <openstreetmap@dstoecker.de>
# Public domain, no rights reserved.

use strict;

my $item;
my $comment = 0;

# This is a simple conversion and in no way a complete XML parser
# but it works with a default Perl installation

# Print a header to write valid Java code.  No line break,
# so that the input and output line numbers will match.
print "class trans_surveyor { void tr(String s){} void f() {";

while(my $line = <>)
{
  chomp($line);
  print "tr(\"---DUMMY-MARKER---\"); ";
  if($line =~ /^#(.*)$/)
  {
    print "/* $1 */\n";
  }
  elsif($line =~ /^$/)
  {
    print "\n";
  }
  elsif($line =~ /<button label=\"(.*?)\"/)
  {
    print "/* $line*/ tr(\"$1\");\n";
  }
  else
  {
    print "/* $line */\n";
  }
}

print "}}\n";