Closed tbmreza closed 2 years ago
For example:
; x.rkt #lang racket (require brag/support) (require "./parser.rkt") (define tkns (list "?")) (syntax->datum (parse tkns)) ; parser.rkt #lang brag <order-matters> : "?" <literal> : '"' <TEXT> '"' | "'" <TEXT> "'"
gives:
'(<order-matters> "?")
If I reorder the rule to last, it cries.
; parser.rkt #lang brag <literal> : '"' <TEXT> '"' | "'" <TEXT> "'" <order-matters> : "?"
Encountered parsing error near "?" (token '?) while parsing 'unknown [line=#f, column=#f, offset=#f] location...: unknown context...: /path/to/Library/Racket/8.4/pkgs/brag-lib/brag/private/internal-support.rkt:16:3 /path/to/Library/Racket/8.4/pkgs/brag-lib/brag/codegen/expander.rkt:82:23: rule-parser /path/to/x.rkt:7:0 body of "/path/to/x.rkt"
Is this expected?
Yes, this is the documented behavior of parse: "Parses a series of tokens according to the rules in the grammar, using the first rule of the grammar for the initial production".
parse
For example:
gives:
If I reorder the rule to last, it cries.
Is this expected?