Add parsing functions.

This commit is contained in:
David Anderson
2014-06-26 21:05:19 -07:00
parent 99f4cdb3e4
commit b8bd7c517e
5 changed files with 301 additions and 89 deletions
+24
View File
@@ -1151,6 +1151,10 @@ static int command(void)
cell val;
preproc_expr(&val,NULL);
sc_needsemicolon=(int)val;
} else if (strcmp(str, "require_newdecls")==0) {
cell val;
preproc_expr(&val,NULL);
sc_require_newdecls = (int)val;
} else if (strcmp(str,"tabsize")==0) {
cell val;
preproc_expr(&val,NULL);
@@ -2264,6 +2268,16 @@ SC_FUNC void lexclr(int clreol)
} /* if */
}
// Return true if the symbol is ahead, false otherwise.
SC_FUNC int lexpeek(int id)
{
if (matchtoken(id)) {
lexpush();
return TRUE;
}
return FALSE;
}
/* matchtoken
*
* This routine is useful if only a simple check is needed. If the token
@@ -3119,6 +3133,16 @@ SC_FUNC int expecttoken(int id, token_t *tok)
return FALSE;
}
SC_FUNC int matchtoken2(int id, token_t *tok)
{
if (matchtoken(id)) {
tok->id = tokeninfo(&tok->val, &tok->str);
return TRUE;
}
return FALSE;
}
SC_FUNC int matchsymbol(token_ident_t *ident)
{
if (lextok(&ident->tok) != tSYMBOL) {