flex/bison 프로그램을 실행할 때 "디버그 어설 션이 실패했습니다. 식 스트림! = NULL"오류가 발생합니다. 여기에 관련 코드는 렉스 파일의 상단에 있습니다 :"포함"기능을 프로그래밍하려고 할 때 flex/bison 프로그램에서 어설 션 오류가 발생했습니다.
%x include_state
%{
#define MAX_INCLUDE_DEPTH 10
YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
int include_stack_ptr = 0;
%}
... 나중에 렉스 파일 :
include[ \t]*\" { BEGIN(include_state); }
<include_state>[a-zA-Z0-9 ]+ {
if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
{
fprintf(stderr, "Includes nested too deeply");
exit(1);
}
include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
yyin = fopen(yytext, "r");
if (!yyin)
sprintf(err_str, "Error opening include file: %s", yytext);
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner),
yyscanner);
}
<include_state>\"; { BEGIN(INITIAL); }
... 이렇게 되었하려고하는 텍스트는 다음과 같습니다
include "hello.txt";
내 프로그램에 "포함"기능을 추가하려고합니다. 나는 flex flex와 win bison을 사용하고 있습니다. (A면 문제 : 어떻게 내가 렉스 파일의 코드 라인을 분할합니까?)
답변을 수락하지 않으셨습니까? 당신에게 충분한 대답이 아니십니까? –
나는 지금 어떤 것을 가지고있다. – tyebillion
'lex' 파일 내용을 포맷 할 수 있습니까? –