RosettaCodeData/Task/Abbreviations-simple/EasyLang/abbreviations-simple.easy
2026-02-01 16:33:20 -08:00

43 lines
1.4 KiB
Text

a$ = "add 1 alter 3 backup 2 bottom 1 Cappend 2 change 1 Schange Cinsert 2 Clast 3"
a$ &= " compress 4 copy 2 count 3 Coverlay 3 cursor 3 delete 3 Cdelete 2 down 1 duplicate"
a$ &= " 3 xEdit 1 expand 3 extract 3 find 1 Nfind 2 Nfindup 6 NfUP 3 Cfind 2 findUP 3 fUP 2"
a$ &= " forward 2 get help 1 hexType 4 input 1 powerInput 3 join 1 split 2 spltJOIN load"
a$ &= " locate 1 Clocate 2 lowerCase 3 upperCase 3 Lprefix 2 macro merge 2 modify 3 move 2"
a$ &= " msg next 1 overlay 1 parse preserve 4 purge 3 put putD query 1 quit read recover 3"
a$ &= " refresh renum 3 repeat 3 replace 1 Creplace 2 reset 3 restore 4 rgtLEFT right 2 left"
a$ &= " 2 save set shift 2 si sort sos stack 3 status 4 top transfer 3 type 1 up 1"
toks$[] = strtok a$ " "
#
func$ toupper s$ .
for c$ in strchars s$
c = strcode c$
if c >= 97 : c -= 32
r$ &= strchar c
.
return r$
.
for tok$ in toks$[]
n = number tok$
if error = 0
cnt[$] = n
else
cmd$[] &= toupper tok$
cnt[] &= 999
.
.
func$ getabbr in$ .
in$ = toupper in$
for i to len cmd$[]
if cmd$[i] = in$ or len in$ >= cnt[i] and strpos cmd$[i] in$ = 1
return cmd$[i]
.
.
return "*error*"
.
in$[] = strtok input " "
for s$ in in$[]
write getabbr s$ & " "
.
#
input_data
riG rePEAT copies put mo rest types fup. 6 poweRin