Closed Robert-M-Muench closed 11 years ago
string <- doublequote [^doublequote\r\n]* doublequote
Rule names get turned into templates with the same name, so they can't be valid D keywords. Try changing string
to String
and see if that compiles (I usually use rule names starting with upper-case for this reason).
I'm using Pegged with the 2.063.2 and the following grammer:
mixin(grammar(" Rebol3: start <- values ws <- [ \n\r\t] delim <- ws / doublequote / '[' / ']' / !. values <- ws* (value ws) value <- integer / string / lit_word / get_word / set_word / word / block integer <- [0-9]+ &delim string <- doublequote [^doublequote\r\n]* doublequote lit_word <- quote word &delim get_word <- ':' word &delim set_word <- word ':' & delim word <- [a-z]+ block <- '[' values ']' " ));
Which fails with this: src/interpreter.d(10): Error: index is not a type or an expression src/interpreter.d(11): Error: index is not a type or an expression src/interpreter.d(12): Error: index is not a type or an expression src/interpreter.d(31): Error: function interpreter.GenericRebol3!(ParseTree).GenericRebol3.Rebol3.string is used as a type src/interpreter.d(58): Error: function interpreter.GenericRebol3!(ParseTree).GenericRebol3.Rebol3.string is used as a type src/interpreter.d(58): Error: function interpreter.GenericRebol3!(ParseTree).GenericRebol3.Rebol3.string is used as a type src/interpreter.d(68): Error: function interpreter.GenericRebol3!(ParseTree).GenericRebol3.Rebol3.string is used as a type src/interpreter.d(68): Error: function interpreter.GenericRebol3!(ParseTree).GenericRebol3.Rebol3.string is used as a type src/interpreter.d(80): Error: function interpreter.GenericRebol3!(ParseTree).GenericRebol3.Rebol3.string is used as a type /Users/robby/dmd2/src/phobos/std/typecons.d(299): Error: not a property string /Users/robby/dmd2/src/phobos/std/typecons.d(298): Error: static assert "Attempted to instantiate Tuple with an invalid argument: " ~ (__error) /Users/robby/dmd2/src/phobos/std/typecons.d(309): instantiated from here: parseSpecs!(string, ulong) src/interpreter.d(85): instantiated from here: Tuple!(string, ulong) src/interpreter.d(565): instantiated from here: GenericRebol3!(ParseTree)
Line 10 is the line with value <- integer / ...
The line numbers 31, 58, 68, 80 don't make any sense. Either not code at that line or the line doesn't exist in the file at all. Any idea what that the problem is?