projects
/
jmdict-cli.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6488a2c
)
Erase \1 after a, i, u, e, o.
author
Philipp Reh
<sefi@s-e-f-i.de>
Sat, 1 Aug 2009 18:21:43 +0000
(20:21 +0200)
committer
Philipp Reh
<sefi@s-e-f-i.de>
Sat, 1 Aug 2009 18:21:43 +0000
(20:21 +0200)
kana2romaji.cpp
patch
|
blob
|
history
diff --git
a/kana2romaji.cpp
b/kana2romaji.cpp
index 7024f3fe20f8f5091df04d64d20a1c2d05c1109e..ac239f8c30a6b8084e477bdd7a4b0211089c8601 100644
(file)
--- a/
kana2romaji.cpp
+++ b/
kana2romaji.cpp
@@
-408,6
+408,7
@@
void kana2romaji(const string& kana, string& rom) {
? 3
: 2);
pos -= 2;
? 3
: 2);
pos -= 2;
+ continue;
}
else if(
pred == "fu" ||
}
else if(
pred == "fu" ||
@@
-417,6
+418,7
@@
void kana2romaji(const string& kana, string& rom) {
{
remove_quote_1(pos, rom);
pos -= 2;
{
remove_quote_1(pos, rom);
pos -= 2;
+ continue;
}
else if(
pred == "su" ||
}
else if(
pred == "su" ||
@@
-430,6
+432,8
@@
void kana2romaji(const string& kana, string& rom) {
{
rom[pos - 1] = 'w';
rom.erase(pos);
{
rom[pos - 1] = 'w';
rom.erase(pos);
+ --pos;
+ continue;
}
else if(
pred == "to" ||
}
else if(
pred == "to" ||
@@
-438,11
+442,27
@@
void kana2romaji(const string& kana, string& rom) {
{
rom[pos - 1] = 'h';
rom.erase(pos);
{
rom[pos - 1] = 'h';
rom.erase(pos);
+ --pos;
+ continue;
}
}
- else
- {
- cout << "Encountered a special character in " << kana << " but don't know what to do with it.\n";
- }
+ }
+
+ if (pos > 0) {
+ char const pred = rom[pos - 1];
+
+ switch(pred)
+ {
+ case 'a':
+ case 'i':
+ case 'u':
+ case 'e':
+ case 'o':
+ rom.erase(pos);
+ --pos;
+ continue;
+ default:
+ cout << "Encountered a special character in " << kana << " but don't know what to do with it.\n";
+ }
}
else
{
}
else
{