[DGD] 1.2.31

Felix A. Croes felix at dworkin.nl
Wed Sep 26 20:39:58 CEST 2001


diff -c dgd/src/Changelog:1.269 dgd/src/Changelog:1.270
*** dgd/src/Changelog:1.269     Sat Sep  8 19:04:15 2001
--- dgd/src/Changelog   Wed Sep 26 20:11:11 2001
***************
*** 1482,1484 ****
--- 1482,1489 ----
     increased or reduced.
   - Added an optional second argument to compile_object(), a string to compile
     the object from.
+  - The error message for using a negative delay in a callout was wrong.
+  - Whitespace in a grammar is now given precedence based on its position in
+    that grammar.  Previously, it always behaved as if it was the first token
+    rule defined.
+  - Grammars may now contain a "nomatch" token rule.

ftp://ftp.dworkin.nl/pub/dgd/experimental/1.2.30-1.2.31.gz


This patch is a response to some questions raised about parse_string()
on the mailing list a while ago.  For compatibility's sake, you should
move any whitespace token rules in grammars to the top -- the position
of the whitespace rule in the grammar now matters, where previously it
was tacitly assumed to be the first token rule.  This only matters for
grammars in which the regular expressions for whitespace overlap with
regular expressions for other tokens.

A word of caution about the nomatch token rule: this is a fallback rule
for the case when nothing else matches.  A possible match of all other
tokens will have been attempted at every position in a nomatch string,
so this can get very inefficient.  For example, consider the following
pathological example:

    grammar:

        token = /a+b/
        nontoken = nomatch
        rule: token
        rule: nontoken

    string:

	"aaaaaaaaaaaaaaaaaaaa"

Here, a match of `token' will be attempted starting at the beginning,
and, after failing at the end, again at the next character, and the
next, etc.

The nomatch rule is useful to avoid a rule like "nontoken = /./" at the
end of your grammar, which would result in an array of strings of one
character in the parse_string() return value.  With a nomatch rule, it
will be a single string containing these characters, instead.

Regards,
Dworkin
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list