From e95498f8e547b42233dfa2e1e756cac88ac4c5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Zrounba?= <6691770+clement-z@users.noreply.github.com> Date: Fri, 3 Nov 2023 15:04:06 +0100 Subject: improve handling of multiple files --- src/parser/parser.l | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/parser') diff --git a/src/parser/parser.l b/src/parser/parser.l index 7c33630..3edda2f 100644 --- a/src/parser/parser.l +++ b/src/parser/parser.l @@ -93,6 +93,13 @@ static T from_string(const string &str) %% /*** Rules section ***/ +^.*{EOL} { + // print the netlist as it is read + // note: doesnt handle included files + if(false) + cout << yytext; REJECT; +} + ^\.include {yy_push_state(INCLUDE, yyscanner);} {WS}* /* eat the whitespace */ [^ ;\t\n\r]+ { /* got the include file name */ @@ -383,12 +390,12 @@ static T from_string(const string &str) <> { yypop_buffer_state(yyscanner); - if ( !YY_CURRENT_BUFFER ) - { + if ( !YY_CURRENT_BUFFER ) + { yyterminate(); - } - return '\n'; } + return '\n'; +} <> { exit(yylerror(yyscanner, "Unexpected end of file.")); -- cgit v1.2.3