tags:

views:

15

answers:

1

I need a bunch of use-rule for including several verbs in a parse rule: Connect, Use, List, Show etc.

  use-rule: [some
[copy Actor to 'Connect thru 'Connect 'to copy UseCase to end (append output rejoin ["[" Actor "]-(" "Connect to " UseCase ")"])]
|
[copy Actor to 'Use thru 'Use copy UseCase to end (append output rejoin ["[" Actor "]-(" "Use " UseCase ")"])]
|
[copy Actor to 'List thru 'List copy UseCase to end (append output rejoin ["[" Actor "]-(" "List " UseCase ")"])]
|
[copy Actor to 'Show thru 'Show copy UseCase to end (append output rejoin ["[" Actor "]-(" "Show " UseCase ")"])]
|
[copy Actor to 'Search thru 'Search copy UseCase to end (append output rejoin ["[" Actor "]-(" "Search " UseCase ")"])]
|
[copy Actor to 'Select thru 'Select copy UseCase to end (append output rejoin ["[" Actor "]-(" "Select " UseCase ")"])]
|
[copy Actor to 'Checkout thru 'Checkout copy UseCase to end (append output rejoin ["[" Actor "]-(" "Checkout" ")"])]
|
[copy Actor to 'Pay thru 'Pay copy UseCase to end (append output rejoin ["[" Actor "]-(" "Pay" ")"])]
|
[copy Actor to 'Delete thru 'Delete copy UseCase to end (append output rejoin ["[" Actor "]-(" "Delete " UseCase ")"])]
|
[copy Actor to 'Modify thru 'Modify copy UseCase to end (append output rejoin ["[" Actor "]-(" "Modify " UseCase ")"])]
|
[copy Actor to 'Add thru 'Connect 'to copy UseCase to end (append output rejoin ["[" Actor "]-(" "Add to " UseCase ")"])]
|
[copy Actor to 'Manage thru 'Manage copy UseCase to end (append output rejoin ["[" Actor "]-(" "Manage " UseCase ")"])]

  ]

How can I make it generic to accept any verb something like

[copy Actor to 'Any-Verb thru 'Any-Verb copy UseCase to end (append output rejoin ["[" Actor "]-(" "Any-Verb " UseCase ")"])]

so that I'm not obliged to add a new line to the rule each time I need a new verb ? (that rule is part of a global parse rule used here http://askuml.com/blog/e-commerce/)

A: 

Rather than do that I'd prefer to write a function that takes all the verbs as the input and to generate the parse rule for you. So, if there's a new verb, you just add it to the list of verbs rather than modify the rule. And that would avoid errors too ... is your 2nd to last parse rule an error?

Graham Chiu
that is not generic enough for me I want to make it work for any verb that I don't know in advance :)
Rebol Tutorial
is your 2nd to last parse rule an error? I don't understand what you mean ?
Rebol Tutorial
'copy Actor to 'Add thru 'Connect 'to copy UseCase to end (append output ... ' which differs from every other rule you have.
Graham Chiu
Sounds you like you want to parse by position instead then. If verb is always a single word without spaces, you can just parse by spaces instead. Of course it helps if you actually provide some sample data or describe the rules your data follows.
Graham Chiu