aboutsummaryrefslogtreecommitdiff
path: root/compiler.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-01-12 21:04:43 -0800
committerBruce Hill <bruce@bruce-hill.com>2021-01-12 21:04:43 -0800
commitb27b71608b3ba4715d629c597efd17c124a8cc22 (patch)
tree2fa57476196f91a9fe54780ef0b014cee6e967d7 /compiler.c
parent88219f49965c61b116da9f022bd04546d414fe17 (diff)
Standardizing to line-comments instead of block comments
Diffstat (limited to 'compiler.c')
-rw-r--r--compiler.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/compiler.c b/compiler.c
index daa6c88..74044a8 100644
--- a/compiler.c
+++ b/compiler.c
@@ -1,6 +1,6 @@
-/*
- * compiler.c - Compile strings into BP virtual machine code.
- */
+//
+// compiler.c - Compile strings into BP virtual machine code.
+//
#include <ctype.h>
#include <stdlib.h>
@@ -17,9 +17,9 @@ __attribute__((nonnull)) static vm_op_t *expand_choices(file_t *f, vm_op_t *firs
static vm_op_t *chain_together(vm_op_t *first, vm_op_t *second);
__attribute__((nonnull(1,4))) static void set_range(vm_op_t *op, ssize_t min, ssize_t max, vm_op_t *pat, vm_op_t *sep);
-/*
- * Helper function to initialize a range object.
- */
+//
+// Helper function to initialize a range object.
+//
static void set_range(vm_op_t *op, ssize_t min, ssize_t max, vm_op_t *pat, vm_op_t *sep)
{
op->type = VM_REPEAT;
@@ -39,10 +39,10 @@ static void set_range(vm_op_t *op, ssize_t min, ssize_t max, vm_op_t *pat, vm_op
}
}
-/*
- * Take an opcode and expand it into a chain of patterns if it's followed by
- * any patterns (e.g. "`x `y"), otherwise return the original input.
- */
+//
+// Take an opcode and expand it into a chain of patterns if it's followed by
+// any patterns (e.g. "`x `y"), otherwise return the original input.
+//
static vm_op_t *expand_chain(file_t *f, vm_op_t *first)
{
vm_op_t *second = bp_simplepattern(f, first->end);
@@ -54,11 +54,11 @@ static vm_op_t *expand_chain(file_t *f, vm_op_t *first)
return chain_together(first, second);
}
-/*
- * Take an opcode and parse any "=>" replacements and then expand it into a
- * chain of choices if it's followed by any "/"-separated patterns (e.g.
- * "`x/`y"), otherwise return the original input.
- */
+//
+// Take an opcode and parse any "=>" replacements and then expand it into a
+// chain of choices if it's followed by any "/"-separated patterns (e.g.
+// "`x/`y"), otherwise return the original input.
+//
static vm_op_t *expand_choices(file_t *f, vm_op_t *first)
{
first = expand_chain(f, first);
@@ -130,9 +130,9 @@ static vm_op_t *chain_together(vm_op_t *first, vm_op_t *second)
return chain;
}
-/*
- * Compile a string of BP code into virtual machine opcodes
- */
+//
+// Compile a string of BP code into virtual machine opcodes
+//
vm_op_t *bp_simplepattern(file_t *f, const char *str)
{
str = after_spaces(str);
@@ -487,9 +487,9 @@ vm_op_t *bp_simplepattern(file_t *f, const char *str)
return op;
}
-/*
- * Similar to bp_simplepattern, except that the pattern begins with an implicit, unclosable quote.
- */
+//
+// Similar to bp_simplepattern, except that the pattern begins with an implicit, unclosable quote.
+//
vm_op_t *bp_stringpattern(file_t *f, const char *str)
{
vm_op_t *ret = NULL;
@@ -553,10 +553,10 @@ vm_op_t *bp_stringpattern(file_t *f, const char *str)
return ret;
}
-/*
- * Given a pattern and a replacement string, compile the two into a replacement
- * VM opcode.
- */
+//
+// Given a pattern and a replacement string, compile the two into a replacement
+// VM opcode.
+//
vm_op_t *bp_replacement(file_t *f, vm_op_t *pat, const char *replacement)
{
vm_op_t *op = new(vm_op_t);