Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Big parse rules

From: nitsch-lists:netcologne at: 19-Jul-2003 10:39

Am Samstag, 19. Juli 2003 10:15 schrieb A J Martin:
> Anyone know how to turn a parse rule into a function? > > Here's my situation. I've got a pile of 'parse rules in my eText function > (I'm rewriting it to make it smaller, faster, and more versatile), and I > find I need some sort of function-like ability, to keep the rules for a > section together, apart from the rest, and able to be reused or nested. > > Table_Printable^: exclude Printable charset #"|" > Table_Cell^: [copy Text any Table_Printable^ (insert tail Table_Row > compose [td (Text)])] > Table_Row^: [ > (Table_Row: copy []) > #"|" some [Table_Cell^ #"|"] opt #"|" LWS? Line_End ( > insert tail Table compose [tr [(Table_Row)]] > Table_Row: none > ) > ] > Table^: [ > (Table: copy []) > some Table_Row^ ( > Accrete [table [tbody [(Table)]]] > ) > ] > > As can be seen, I'd really like to make "Table_" into a sort of object or > function, rather than "fake" it with the arrangement of names. > > Any ideas? >
would like pathes in parserules. without it, you could put everything in a context and export only 'Table^ with 'set. or do table^: ctx-table/table^ parse string [..] context[ Table_Printable^: exclude Printable charset #"|" =2E. set 'Table^[ .. ] ]