Commit Graph

128 Commits (master)
 

Author SHA1 Message Date
Matthew Butterick 30cbf95e6a doc fix: ? is used for quantification 2 years ago
Matthew Flatt f52c2a80c9
update pkg dependencies to list syntax-color-lib (#33) 3 years ago
Matthew Butterick 81f4fd25e7
lex double-quoted strings with Racket lexer (#32)
Follow up on an idea in #31: use the Racket lexer to lex double-quoted strings in a grammar, thereby giving them all the semantics of Racket strings, and preventing any corner cases. This solution can’t be extended to single-quoted strings, however, because even with readtable tomfoolery to recognize a single quote as an opening delimiter for a string, the string still needs to be closed with a double quote. (I don’t know why this should be so, but it is the documented behavior.) Therefore single-quoted strings still are subject to the homegrown lexing solution and the flaws therein. Still, I don’t see that single-quoted strings have ever been a documented feature of brag (or its predecessor ragg). Perhaps they could be dropped altogether. For now, this solution is satisfying, because double-quoted strings are the dominant notation, and this PR will make them as good as they can be.
3 years ago
Matthew Butterick 168c027031 enlarge test matrix with Racket 8 3 years ago
Matthew Butterick ba5c6c7ab5
support for codepoint escape sequences in strings (closes #29) (#31)
This improves the lexing of escape sequences within strings that appear in a grammar. It relies on Racket’s `read` to interpret these escape sequences rather than a hard-coded hash table. This gives strings in a grammar pretty much the same semantics as standard Racket strings, including support for octal and hex escape sequences for Unicode codepoints.

Though this passes all current tests, there are still some oddball corner cases that can be discovered by sticking together certain combinations of escape sequences (backslashes, double quotes, and codepoints). The better solution would be to peek into the input port for a double quote, and if it’s there, use the standard Racket lexer to pull out the string (this lexer already handles the weirdo cases). We can’t do this, however, because brag also supports single-quoted strings, which need to have the same semantics, and the Racket lexer won’t work with those. So I think we’re stuck with the homegrown solution (for consistency with both kinds of quotes) even at the expense of a few unresolved corner cases. Let’s leave that question for another day, as these cases haven’t surfaced in practical use thus far.
3 years ago
D. Ben Knoble 92b7dcc067
scribble: fix indentation in file examples (#27)
I copied in the actual file contents. It would perhaps be safest to do
some sort of "read the file and splice the contents in," but I'm not
sure how to do that at the moment.
3 years ago
Markus Pfeiffer 6983208426
Fix make-rule-parser (#28)
When using `make-rule-parser` for any rule that is not the start
rule, and applying the resulting parser while giving it a source-path
it would just use the entire grammar from the start rule.
3 years ago
Matthew Butterick d3405dd0ab
Update README.md 4 years ago
Matthew Butterick 243f32a7bb refine docs for `from/stop-before`
Only works with literal tokens, not arbitrary patterns, due to underlying limitations on `complement` pattern matcher
4 years ago
Matthew Butterick 6c161ae31d switch Travis for GH actions 4 years ago
Matthew Butterick 8814be702b force trusty for testing 5 years ago
Matthew Butterick 36f2aa56e5
Update SUBLICENSE.md 5 years ago
Matthew Butterick a7714affa6
Update README.md 5 years ago
Matthew Butterick 7880af4d6f switch to MIT license 5 years ago
Matthew Butterick c792b12d71 Revert "subparsers"
This reverts commit 11539991ec.
5 years ago
Matthew Butterick 6e7e8e4147 omit some setup 5 years ago
Matthew Butterick 11539991ec subparsers 5 years ago
Matthew Butterick 4732784dee note on source-path arg 6 years ago
Jesse Alama 1ca370478c Add 7.2 6 years ago
Matthew Butterick 460a5480fc exactness 6 years ago
Jesse Alama 2e8f5e42be Use nonnegative-integer? in favor of natural-number?
The natural-number? predicate seems to be
unavailable (though there is a remnant of it in the form of
natural-number/c, which is just a contract alias of
exact-nonnegative-integer?). In any case, it surely means
nonnegative integer.

(One might push the envelope here slightly and add
exactness, but this commit does not go that far.)
6 years ago
Matthew Butterick 84f2fc2b97 add base dep 6 years ago
Matthew Butterick c8e6e189b8 remove self ref 6 years ago
Matthew Butterick 4f4c674a18 removal 6 years ago
Matthew Butterick ab5f7b65d7
Update info.rkt 6 years ago
Matthew Butterick 103edc8f84
test brag-lib directly 6 years ago
Matthew Butterick 11954935ed
Update .travis.yml 6 years ago
Matthew Butterick 149176e37b fix info 6 years ago
Matthew Butterick 095b4c2409 move 6 years ago
Matthew Butterick 69e38c9b4f separate 6 years ago
Matthew Butterick 588c376467 less is more 6 years ago
Matthew Butterick 7c93fffed5 differences from ragg (closes #15) 6 years ago
Matthew Butterick 0901778f65 Revert "simplify flattening"
This reverts commit 17b01b3718.
6 years ago
Matthew Butterick 17b01b3718 simplify flattening 6 years ago
Matthew Butterick d1ebde511a adjust flattening of zero-or-more rule (fixes #18) 6 years ago
Matthew Butterick 2612c3356b use 'unknown not #f 6 years ago
Matthew Butterick b2a9d1ac53 vestigial 6 years ago
Rodrigo Bernardo 536016551d Fix typo 6 years ago
Matthew Butterick b91f3e8f2a
Update .travis.yml 6 years ago
Gregory Toprak e301210ffb Fix link in docs
The broken link showed up as an undefined tag warning for `(tech "comment")` when installing this package.

This seemed like the most straightforward fix, but it's a bit wordy.
6 years ago
Matthew Butterick 1b69e27c44 activate srclocs in tester 6 years ago
Matthew Butterick 359da840b9 better error msg when token type is whitespace (fixes #9) 6 years ago
Matthew Butterick e6b8f99316 suppress source info in errors when it doesn't exist 6 years ago
Matthew Butterick 6cf947b8af add multiline comments; ignore commas 6 years ago
Matthew Butterick dd37900690 docs nit 6 years ago
Matthew Butterick f8687db35a improve cutting of top-level rule name 6 years ago
Matthew Butterick 8fd0aa4092 doc edit about top-level rule 6 years ago
Matthew Butterick bfacb563df permit cuts on top-level rule name 6 years ago
Matthew Butterick 6dff5018c6 add `apply-port-proc` 6 years ago
Matthew Butterick 9cbb3e7a5c another 6 years ago