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
|
using System;
using System.IO;
using System.Text.RegularExpressions;
// cMenuTrackSelectorDelete.setText( _( "Delete" ) + "(&D)" );
// ̂悤ȍsA
// cMenuTrackSelectorDelete.setText( _( "Delete" ) );
// cMenuTrackSelectorDelete.setMnemonic( KeyEvent.VK_D );
// ݂ɕc[
// eLXgf[^͕W͂ǂݍ
//
// AutoMnemonic<in.txt>out.txt
// ̂悤Ɏgp
class AutoMnemonic {
public static void Main( string[] args ) {
TextReader input = Console.In;
string line = "";
Regex r = new Regex( @"(?<header>.*)[.]setText\(\s(?<text>.*)\s\+\s""\(\&(?<code>.)\)"".*" );
while ( (line = input.ReadLine()) != null ) {
Match m = r.Match( line );
if ( m.Success ) {
string header = m.Groups["header"].Value;
string text = m.Groups["text"].Value;
string code = m.Groups["code"].Value;
Console.WriteLine( header + ".setText( " + text + " );" );
Console.WriteLine( header + ".setMnemonic( KeyEvent.VK_" + code + " );" );
}else{
Console.WriteLine( line );
}
}
}
}
|