|REBOL 3 Docs||Guide||Concepts||Functions||Datatypes||Errors|
|TOC < Back Next >||Updated: 3-Aug-2010 Edit History|
Parses a common form of dialects. Returns updated input block.
dialect [object!] - Describes the words and datatypes of the dialect
input [block!] - Input stream to parse
output [block!] - Resulting values, ordered as defined
/in - Search for var words in specific objects (contexts)
where [block!] - Block of objects to search (non objects ignored)
/all - Parse entire block, not just one command at a time
DELECT stands for DEcode diaLECT. It is used to implement REBOL's internal dialects such as DRAW, EFFECT, RICH TEXT, SECURE, and VID, but its function is available to all users.
This is used for parsing unordered dialects. In unordered dialects, the order of arguments is less important than their type.
Here's a simple example. First the dialect is specified as a context:
dialect: context [ default: [tuple!] single: [string!] double: [integer! string!] ]
Then an input and output block is specified. The input block contains the data to parse. The output block stores the result:
inp: [1.2.3 single "test" double "test" 123] out: make block! 4 ; (any initial size works)
Now the input is processed using delect, one step at a time:
while [inp: delect dialect inp out] [ ?? out ?? inp ]
|TOC < Back Next >||REBOL.com - WIP Wiki||Feedback Admin|