From b868d64717ea955679e4dc601dd7c84a2b9d83b9 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Mon, 22 Oct 2018 09:43:05 +0200 Subject: [PATCH] recognise split strings as one --- alib2cli/src/lexer/Lexer.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/alib2cli/src/lexer/Lexer.cpp b/alib2cli/src/lexer/Lexer.cpp index fedc98735b..7cb42321e0 100644 --- a/alib2cli/src/lexer/Lexer.cpp +++ b/alib2cli/src/lexer/Lexer.cpp @@ -102,6 +102,7 @@ q0: if ( m_index >= m_line.size ( ) ) { } if ( m_line [ m_index ] == '"' ) { + res.m_type = TokenType::STRING; m_index ++; goto q4; } @@ -183,9 +184,8 @@ q4: if ( m_index >= m_line.size ( ) ) { return res; } if ( m_line [ m_index ] == '"' ) { - res.m_type = TokenType::STRING; m_index++; - return res; + goto q6; } if ( m_line [ m_index ] == '\\' ) { m_index++; @@ -213,6 +213,20 @@ q5: if ( m_index >= m_line.size ( ) ) { m_index++; goto q4; + +q6: if ( m_index >= m_line.size ( ) ) { + return res; + } + if ( isspace ( m_line [ m_index ] ) ) { + m_index ++; + goto q6; + } + if ( m_line [ m_index ] == '"' ) { + m_index ++; + goto q4; + } else { + return res; + } } } /* namespace cli */ -- GitLab