From a7e3e421dbc78ac988862a459c4077877a4ecba7 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 16 Jan 2021 10:39:09 -0800 Subject: [PATCH] Deprecated #(...)# block comments --- README.md | 1 - bp.1 | 3 --- grammars/bpeg.bp | 6 +----- utils.c | 16 +--------------- 4 files changed, 2 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 3317209..ec01682 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/bp.1 b/bp.1 index 68f452e..14303bb 100644 --- a/bp.1 +++ b/bp.1 @@ -191,9 +191,6 @@ exact same length. Pronounced \fI\fB-assuming-it-doesn't-equal-\fI\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\fR )# -A block comment (can be nested) - .B # \fI\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: `# .. $ diff --git a/utils.c b/utils.c index 616255f..3c38e4e 100644 --- a/utils.c +++ b/utils.c @@ -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; } }