I m trying learn ragel with go, but i am not able to find a proper way to scan a Quoted-string
This is what i have defined
dquote = '"';
quoted_string = dquote (any*?) dquote ;
main := |*
quoted_string =>
{
current_token = QUOTED_STRING;
yylval.stringValue = string(lex.m_unScannedData[lex.m_ts:lex.m_te]);
fmt.Println("quoted string : ", yylval.stringValue)
fbreak;
};
The following expression with single quoted string works fine
if abc == "xyz.123" {
pp
}
If i scan the above condition then i get this printf
quoted string : "xyz.123"
But if i have 2 quoted string as shown below, it fails
if abc == "0003" {
if xyz == "5003" {
pp
}
}
it scans both the quoted string
quoted string : "0003" { if xyz == "5003"
Can someone please help me with this ? If there is a better alternative
I am using below version
# ragel -v
Ragel State Machine Compiler version 6.10 March 2017
Copyright (c) 2001-2009 by Adrian Thurston
This did the trick
quoted_string = dquote (any - newline)* dquote ;