Deprecated #(...)# block comments
This commit is contained in:
parent
3f6e7c2beb
commit
a7e3e421db
@ -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.
|
||||
|
3
bp.1
3
bp.1
@ -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
|
||||
|
||||
|
@ -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: `# .. $
|
||||
|
16
utils.c
16
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user