aboutsummaryrefslogtreecommitdiff
path: root/src/lexer-generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lexer-generic.c')
-rw-r--r--src/lexer-generic.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lexer-generic.c b/src/lexer-generic.c
new file mode 100644
index 0000000..b841886
--- /dev/null
+++ b/src/lexer-generic.c
@@ -0,0 +1,28 @@
+#include <stdbool.h>
+
+#include "common.h"
+#include "types.h"
+
+bool
+skpcmnt(const uchar **ptr, const uchar *end)
+{
+ int nst = 1;
+ const uchar *p = *ptr;
+
+ for (p++; likely(p < end); p++) {
+ if (p + 1 < end) {
+ if (p[0] == '*' && p[1] == '/') {
+ p++;
+ if (--nst == 0) {
+ *ptr = ++p;
+ return true;
+ }
+ } else if (p[0] == '/' && p[1] == '*') {
+ p++;
+ nst++;
+ }
+ }
+ }
+
+ return false;
+}