diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-01-16 10:39:09 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-01-16 10:39:09 -0800 |
| commit | a7e3e421dbc78ac988862a459c4077877a4ecba7 (patch) | |
| tree | 4d8c8070ef38c3e3a6e754efd4244fb4aebca8fb | |
| parent | 3f6e7c2beb512d6c3db51bfc94279f0d11e47057 (diff) | |
Deprecated #(...)# block comments
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | bp.1 | 3 | ||||
| -rw-r--r-- | grammars/bpeg.bp | 6 | ||||
| -rw-r--r-- | utils.c | 16 |
4 files changed, 2 insertions, 24 deletions
@@ -63,7 +63,6 @@ Pattern | Meaning `pat1==pat2` | `pat1`, assuming `pat2` also matches with the same length `pat1!=pat2` | `pat1`, unless `pat2` also matches with the same length `name:pat2` | `name` is defined to mean `pat` -`#( block comment )#` | A block comment `# line comment` | A line comment See `man ./bp.1` for more details. @@ -191,9 +191,6 @@ exact same length. Pronounced \fI<pat1>\fB-assuming-it-doesn't-equal-\fI<pat2>\f This pattern matches the indentation at the beginning of a line that has the same indentation as the line before (or zero indentation on the first line). -.B #( \fI<comment>\fR )# -A block comment (can be nested) - .B # \fI<comment>\fR A line comment diff --git a/grammars/bpeg.bp b/grammars/bpeg.bp index e8d7259..6cc118b 100644 --- a/grammars/bpeg.bp +++ b/grammars/bpeg.bp @@ -74,8 +74,4 @@ $: !. id: "^^" / "^" / "__" / "_" / "$$" / "$" / "|" / `a-z,A-Z *`a-z,A-Z,0-9,- -line-comment: `# .. $ -block-comment: "#("..")#" % block-comment - -# Note: comments are undefined by default in regular BP -comment: block-comment / line-comment +comment: `# .. $ @@ -14,7 +14,6 @@ // const char *after_spaces(const char *str) { - int block_comment_depth = 0; // Skip whitespace and comments: skip_whitespace: switch (*str) { @@ -23,20 +22,7 @@ const char *after_spaces(const char *str) goto skip_whitespace; } case '#': { - if (str[1] == '(') { - ++block_comment_depth; - for (str += 2; *str && block_comment_depth > 0; ++str) { - if (str[0] == '#' && str[1] == '(') { - ++block_comment_depth; - ++str; - } else if (str[0] == ')' && str[1] == '#') { - --block_comment_depth; - ++str; - } - } - } else { - while (*str && *str != '\n') ++str; - } + while (*str && *str != '\n') ++str; goto skip_whitespace; } } |
