Skip to content

Commit

Permalink
evening progress, still doesn't build
Browse files Browse the repository at this point in the history
  • Loading branch information
oboroc committed Feb 7, 2020
1 parent 68a882f commit cd46cda
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
28 changes: 19 additions & 9 deletions src/crass.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 21,31 @@ void scan_str(char *str)
/* use reentrant scanner */
yyscan_t scanner;
YY_BUFFER_STATE buf;
crasslex_init(&scanner);
buf = crass_scan_string(str, scanner);
crasslex(scanner);
crass_delete_buffer(buf, scanner);
crasslex_destroy(scanner);
//crasslex_init(&scanner);
yylex_init(&scanner);
// buf = crass_scan_string(str, scanner);
buf = yy_scan_string(str, scanner);
//crasslex(scanner);
yylex(scanner);

//crass_delete_buffer(buf, scanner);
yy_delete_buffer(buf, scanner);
//crasslex_destroy(scanner);
yylex_destroy(scanner);
}

void scan_file(FILE* f)
{
/* use reentrant scanner */
yyscan_t scanner;
crasslex_init(&scanner);
crassset_in(f, scanner);
crasslex(scanner);
crasslex_destroy(scanner);
//crasslex_init(&scanner);
yylex_init(&scanner);
//crassset_in(f, scanner);
yyset_in(f, scanner);
//crasslex(scanner);
yylex(scanner);
//crasslex_destroy(scanner);
yylex_destroy(scanner);
}

int main(int argc, char** argv)
Expand Down
7 changes: 5 additions & 2 deletions src/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 3,16 @@
%{
#include <math.h>
#include <stdio.h>
int yylex(void);
void yyerror(char const *);
#include "scanner.flex.h"
//int yylex(void);
//void yyerror(char const *);
%}


/* Bison declarations. */
�fine parse.error verbose
�fine api.value.type {double}
//�fine api.prefix {crass}
%token NUM
%left '-' ' '
%left '*' '/'
Expand Down
2 changes: 1 addition & 1 deletion src/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 22,7 @@ TODO: use https://westes.github.io/flex/manual/Common-Patterns.html for basic pa
%option warn backup verbose
%option nodefault
%option outfile="scanner.flex.c" header-file="scanner.flex.h"
%option prefix="crass"
/* %option prefix="crass" */

%x incl str

Expand Down

0 comments on commit cd46cda

Please sign in to comment.