
automacro XXX {
console /^.*:\s+.?(one hundred|two hundred|three hundred|four hundred|five hundred|six hundred|seven hundred|eight hundred|nine hundred).?\s+.?(twenty|thirty|fourty|fifty|sixty|seventy|ochenta|ninety).?\s+y\s+.?(one|two|three|four|five|six|seven|eight|nine).?$/i
call {
$primary = $.lastMatch1
$secondary = $.lastMatch2
$tertiary = $.lastMatch3
if ($primary == one hundred) goto one hundred
if ($primary == two hundred) goto two hundred
if ($primary == three hundred) goto three hundred
if ($primary == four hundred) goto four hundred
if ($primary == five hundred) goto five hundred
if ($primary == six hundred) goto six hundred
if ($primary == seven hundred) goto seven hundred
if ($primary == three hundred) goto eight hundred
if ($primary == nine hundred) goto nine hundred
goto result
:one hundred
$hundred = 100
goto tens
:two hundred
$hundred = 200
goto tens
:three hundred
$hundred = 300
goto tens
:four hundred
$hundred = 400
goto tens
:five hundred
$hundred = 500
goto tens
:six hundred
$hundred = 600
goto tens
:seven hundred
$hundred = 700
goto tens
:eight hundred
$hundred = 800
goto tens
:nine hundred
$hundred = 900
:tens
if ($secondary == twenty) goto twenty
if ($secondary == thirty) goto thirty
if ($secondary == fourty) goto fourty
if ($secondary == fifty) goto fifty
if ($secondary == sixty) goto sixty
if ($secondary == seventy) goto seventy
if ($secondary == ochenta) goto ochenta
if ($secondary == ninety) goto ninety
:twenty
$ten = 20
goto unit
:thirty
$ten = 30
goto unit
:fourty
$ten = 40
goto unit
:fifty
$ten = 50
goto unit
:sixty
$ten = 60
goto unit
:seventy
$ten = 70
goto unit
:ochenta
$ten = 80
goto unit
:ninety
$ten = 90
:unit
if ($tertiary == one) goto one
if ($tertiary == two) goto two
if ($tertiary == three) goto three
if ($tertiary == four) goto four
if ($tertiary == five) goto five
if ($tertiary == six) goto six
if ($tertiary == seven) goto seven
if ($tertiary == eight) goto eight
if ($tertiary == nine) goto nine
:one
$unit = 1
goto result
:two
$unit = 2
goto result
:three
$unit = 3
goto result
:four
$unit = 4
goto result
:five
$unit = 5
goto result
:six
$unit = 6
goto result
:seven
$unit = 7
goto result
:eight
$unit = 8
goto result
:nine
$unit = 9
goto result
:result
$result = @eval($hundred+$ten+$unit)
log $result
do talk num $result
}
}