summaryrefslogtreecommitdiff
path: root/yacc/reader.c
diff options
context:
space:
mode:
authorDemi Marie Obenour <demiobenour@gmail.com>2023-01-05 17:02:55 -0500
committerGitHub <noreply@github.com>2023-01-05 17:02:55 -0500
commit946085723f5c3634b22b9800fd0e72fb2eecd18d (patch)
tree17274b5c0d8a20c7ade7d13ad11d8512650ed619 /yacc/reader.c
parent6b6104b54dceeff607d951bb15758fb38395fadf (diff)
parent96004ee8006be453a658a819ff8c2637411e974c (diff)
downloadocaml-946085723f5c3634b22b9800fd0e72fb2eecd18d.tar.gz
Merge branch 'trunk' into cleanup-ocamlyacc
Diffstat (limited to 'yacc/reader.c')
-rw-r--r--yacc/reader.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/yacc/reader.c b/yacc/reader.c
index 7223c0b79d..9d2f1131c3 100644
--- a/yacc/reader.c
+++ b/yacc/reader.c
@@ -16,6 +16,7 @@
/* Based on public-domain code from Berkeley Yacc */
#include <string.h>
+#include <stdbool.h>
#include "defs.h"
/* The line size must be a positive integer. One hundred was chosen */
@@ -259,6 +260,9 @@ static void process_apostrophe_body(FILE *f)
}
}
+static bool is_ocaml_ident_start_char(char p) {
+ return p == '_' || (p >= 'a' && p <= 'z');
+}
static void process_open_curly_bracket(FILE *f) {
char *idcptr = cptr;
@@ -282,12 +286,12 @@ static void process_open_curly_bracket(FILE *f) {
}
}
- if (In_bitmap(caml_ident_start, *idcptr) || *idcptr == '|')
+ if (is_ocaml_ident_start_char(*idcptr) || *idcptr == '|')
{
char *newcptr = idcptr;
size_t size = 0;
char *buf;
- while(In_bitmap(caml_ident_body, *newcptr)) { newcptr++; }
+ while (is_ocaml_ident_start_char(*newcptr)) { newcptr++; }
if (*newcptr == '|')
{ /* Raw string */
int s_lineno;
@@ -316,7 +320,6 @@ static void process_open_curly_bracket(FILE *f) {
size_t i;
for (i = 0; i <= size; ++i) {
if (cptr[i] != buf[i]) {
- newcptr--;
match = 0;
break;
}