comparison src/lex.l @ 5279:bd32f770c09a

[project @ 2005-04-12 21:55:31 by jwe]
author jwe
date Tue, 12 Apr 2005 21:55:31 +0000
parents 6434e63553f0
children 41273fff034d
comparison
equal deleted inserted replaced
5278:fe23ec6763b7 5279:bd32f770c09a
319 COUNT_TOK_AND_RETURN ('\n'); 319 COUNT_TOK_AND_RETURN ('\n');
320 } 320 }
321 321
322 <COMMAND_START>[\;\,] { 322 <COMMAND_START>[\;\,] {
323 if (lexer_flags.doing_rawcommand) 323 if (lexer_flags.doing_rawcommand)
324 TOK_PUSH_AND_RETURN (yytext, STRING); 324 TOK_PUSH_AND_RETURN (yytext, SQ_STRING);
325 325
326 BEGIN (INITIAL); 326 BEGIN (INITIAL);
327 327
328 if (strcmp (yytext, ",") == 0) 328 if (strcmp (yytext, ",") == 0)
329 TOK_RETURN (','); 329 TOK_RETURN (',');
336 COUNT_TOK_AND_RETURN (handle_string (yytext[0], true)); 336 COUNT_TOK_AND_RETURN (handle_string (yytext[0], true));
337 } 337 }
338 338
339 <COMMAND_START>[^#% \t\r\n\;\,\"\'][^ \t\r\n\;\,]*{S}* { 339 <COMMAND_START>[^#% \t\r\n\;\,\"\'][^ \t\r\n\;\,]*{S}* {
340 std::string tok = strip_trailing_whitespace (yytext); 340 std::string tok = strip_trailing_whitespace (yytext);
341 TOK_PUSH_AND_RETURN (tok, STRING); 341 TOK_PUSH_AND_RETURN (tok, SQ_STRING);
342 } 342 }
343 343
344 %{ 344 %{
345 // For this and the next two rules, we're looking at ']', and we 345 // For this and the next two rules, we're looking at ']', and we
346 // need to know if the next token is `=' or `=='. 346 // need to know if the next token is `=' or `=='.
1981 else 1981 else
1982 { 1982 {
1983 std::string s; 1983 std::string s;
1984 yyunput (c, yytext); 1984 yyunput (c, yytext);
1985 buf << OSSTREAM_ENDS; 1985 buf << OSSTREAM_ENDS;
1986 if (lexer_flags.doing_rawcommand) 1986 if (lexer_flags.doing_rawcommand || delim == '\'')
1987 s = OSSTREAM_STR (buf); 1987 s = OSSTREAM_STR (buf);
1988 else 1988 else
1989 s = do_string_escapes (OSSTREAM_STR(buf)); 1989 s = do_string_escapes (OSSTREAM_STR(buf));
1990 OSSTREAM_FREEZE (buf); 1990 OSSTREAM_FREEZE (buf);
1991 1991
2003 if (delim == '"') 2003 if (delim == '"')
2004 gripe_matlab_incompatible ("\" used as string delimiter"); 2004 gripe_matlab_incompatible ("\" used as string delimiter");
2005 else if (delim == '\'') 2005 else if (delim == '\'')
2006 gripe_single_quote_string (); 2006 gripe_single_quote_string ();
2007 2007
2008 return STRING; 2008 return delim == '"' ? DQ_STRING : SQ_STRING;
2009 } 2009 }
2010 } 2010 }
2011 } 2011 }
2012 else 2012 else
2013 { 2013 {