Skip to content
This repository was archived by the owner on Nov 22, 2023. It is now read-only.

Commit 78191c4

Browse files
author
gek
committed
make push
1 parent 55ef854 commit 78191c4

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

parser.c

+7-11
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,6 @@ strll** getnext(){
9292
return &next;
9393
}
9494

95-
strll* peekn(unsigned n){
96-
strll* retval = next;;
97-
while(n){
98-
n--;
99-
if(retval == NULL) return NULL;
100-
retval = retval->right;
101-
}
102-
return retval;
103-
}
10495

10596
//print a string out.
10697
static void print_string_out(char* text){
@@ -201,7 +192,7 @@ static inline void parse_do_metaprogramming(){
201192
return;
202193
}
203194

204-
static void parse_repeatedly_try_metaprogramming(){
195+
static inline void parse_repeatedly_try_metaprogramming(){
205196
while(1){
206197
if(peek() == NULL) return;
207198
if(peek()->data != TOK_OPERATOR) return;
@@ -633,7 +624,7 @@ static void parse_gvardecl(){
633624
type t = {0};
634625
int64_t cval;
635626
double fval;
636-
uint64_t symid = 0xFFffFFffFFff;
627+
uint64_t symid = ~(uint64_t)0;
637628
set_is_codegen(0);
638629
gvar_qualifier_top:;
639630
parse_repeatedly_try_metaprogramming();
@@ -872,8 +863,10 @@ static void parse_datastmt(){
872863
uint64_t is_codegen = 0;
873864
uint64_t is_noexport = 0;
874865
uint64_t symid;
866+
/*Checked at callsite...
875867
require(peek()->data == TOK_KEYWORD, "data statement must begin with \"data\" ");
876868
require(ID_KEYW(peek()) == ID_KEYW_STRING("data"), "data statement must begin with \"data\" ");
869+
*/
877870
consume();
878871
set_is_codegen(0);
879872
data_qualifiers_top:;
@@ -1247,6 +1240,8 @@ void parse_fn(int is_method){
12471240
uint64_t k;
12481241
t.basetype = BASE_VOID; //made explicit...
12491242
set_is_codegen(0);
1243+
//these were checked at the callsite...
1244+
/*
12501245
if(!is_method){
12511246
require(peek()->data == TOK_KEYWORD, "fn statement must begin with \"fn\"");
12521247
require(ID_KEYW(peek()) == ID_KEYW_STRING("fn"), "fn statement must begin with \"fn\"");
@@ -1255,6 +1250,7 @@ void parse_fn(int is_method){
12551250
require(peek()->data == TOK_KEYWORD, "method statement must begin with \"method\"");
12561251
require(ID_KEYW(peek()) == ID_KEYW_STRING("method"), "fn statement must begin with \"fn\"");
12571252
}
1253+
*/
12581254
consume(); //Eat fn or method
12591255
fn_qualifier_top:;
12601256
parse_repeatedly_try_metaprogramming(); //Immediately after fn/method, allow a parsehook invocation...

parser.h

-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ extern char** saved_argv;
189189

190190
strll* peek();
191191
strll** getnext();
192-
/*lookahead by n*/
193-
strll* peekn(unsigned n);
194192
strll* consume();
195193
extern strll* next;
196194
static void parse_error(char* msg){

0 commit comments

Comments
 (0)