r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Parse] Discussion of PARSE dialect

BrianH
1-Jul-2006
[1176]
Is there a seperate syntax for defining macros?
Graham
1-Jul-2006
[1177x2]
no, it's just a text file which is read in at start up.
the scenario is this guy uses these macros as he types up his notes. 
 his software currently expands them inline as he types.
BrianH
1-Jul-2006
[1179]
So in use, a macro a: will always be a: in the text. Will it be A: 
sometimes, or "a:"?
Graham
1-Jul-2006
[1180x2]
I would have to intercept the keyboard handler to do this .. so I 
want to try and just do the replacement after he's finished typing.
macros won't be case sensitive.
Tomc
1-Jul-2006
[1182]
but groups of people doing the sane thing dont use the same nacros? 
  they should
Graham
1-Jul-2006
[1183x2]
no, they don't use the same macros.
so, it's user specific.
Tomc
1-Jul-2006
[1185]
personal shorthand
Graham
1-Jul-2006
[1186]
yes
Tomc
1-Jul-2006
[1187]
hmm I am in the bussiness of sharing biological information and I 
got to say  please strongly consider  creating  an ontology if one 
does not exist already
Graham
1-Jul-2006
[1188x5]
Oh .. sure there's ontologies ....
but people don't use them when typing.
SNOMED CT is the one being currently promulgated
and there's the proprietary MEDCIN
so, personal shorthand should expand into a controlled vocab ideally
Tomc
1-Jul-2006
[1193]
yes
Graham
1-Jul-2006
[1194]
Ii Type II Diabetes #250.00
here the macro expansion includes a code (CPT) from the AMA.
Tomc
1-Jul-2006
[1195]
and the macros should  also be part of that  ontology
Graham
1-Jul-2006
[1196x2]
Medcin contains over 100,000 clinical propositions
no one is going to remember that!
BrianH
1-Jul-2006
[1198]
Can you make sure that no whitespace sneaks into your macro names?
Graham
1-Jul-2006
[1199]
tom, I can't force the guy to change his macros!
Tomc
1-Jul-2006
[1200x2]
no that is what browaers are for
right
BrianH
1-Jul-2006
[1202]
I mean at the beginning.
Graham
1-Jul-2006
[1203x2]
there is no whitespace inside a macroname
LOINC, another controlled vocab, contains over 30,000 items.
Tomc
1-Jul-2006
[1205]
so there is a seperate extendable file with the macro=expansion
Graham
1-Jul-2006
[1206x2]
tom, yes.
actually  the file will be saved in a database and loaded when the 
program starts
BrianH
1-Jul-2006
[1208]
Make sure to trim the names before you use them. I am rewriting your 
function.
Graham
1-Jul-2006
[1209]
Tom, what exactly are you involved in ?
Tomc
1-Jul-2006
[1210x2]
zebrafish
as a model orginism
Graham
1-Jul-2006
[1212]
fish!
Tomc
1-Jul-2006
[1213]
http://zfin.org
Graham
1-Jul-2006
[1214x5]
Ok, I understand the need for an ontology here.
but medicine is full of uncontrolled words which are in common use.
and the ontologically controlled programs are very expensive due 
to licensing fees
The AMA charge to use their codes, the American College of Pathologists 
charge to use their SMOMED-CT codes .. and so it goes on.
LOINC, from the Univ. of Indiana has open sourced their codes.
Tomc
1-Jul-2006
[1219x4]
ahh  my mind is corrupted by giving everything away I forget that 
that is not what everyone does
so back to your problem  I
seems it will take n passes
where n is the # of macros.
BrianH
1-Jul-2006
[1223x3]
expand-macros: func [data [string!] macros [block!]
	/local whitespace macro-rule macro here there
] compose [
	whitespace: (charset " ^/")
    macro-rule: make block! length? macros
	foreach [macro expansion] macros [
        macro-rule: insert insert macro-rule macro '|
    ]
    macro-rule: head remove back macro-rule
    parse/all data [some [
        here: copy macro macro-rule there: [whitespace | end] (

            there: change/part here select/skip macros macro 2 there
        ) :there |
        skip
    ]]
    macro-rule: none
    data
]
Sorry, need to change the settings in my editor.
expand-macros: func [data [string!] macros [block!]
    /local whitespace macro-rule macro here there
] compose [
    whitespace: (charset " ^/")
    macro-rule: make block! length? macros
    foreach [macro expansion] macros [
        macro-rule: insert insert macro-rule macro '|
    ]
    macro-rule: head remove back macro-rule
    parse/all data [some [
        here: copy macro macro-rule there: [whitespace | end] (

            there: change/part here select/skip macros macro 2 there
        ) :there |
        skip
    ]]
    macro-rule: none
    data
]