Let yy_text determine progress of PV parsing
[xboard.git] / parser.l
index 8e3d397..348bd15 100644 (file)
--- a/parser.l
+++ b/parser.l
@@ -1085,10 +1085,10 @@ int yywrap()
 \r
 /* Parse a move from the given string s */\r
 /* ^ at start of pattern WON'T work here unless using flex */\r
-ChessMove yylexstr(boardIndex, s)\r
-     int boardIndex;\r
-     char *s;\r
-{\r
+ChessMove yylexstr(boardIndex, s, text, len)\r
+     int boardIndex, len;\r
+     char *s, *text;\r
+{
     ChessMove ret;\r
     char *oldStringToLex;\r
 #ifdef FLEX_SCANNER\r
@@ -1104,7 +1104,9 @@ ChessMove yylexstr(boardIndex, s)
     yy_switch_to_buffer(buffer);\r
 #endif /*FLEX_SCANNER*/\r
 \r
-    ret = (ChessMove) yylex();\r
+    ret = (ChessMove) yylex();
+     strncpy(text, yy_text, len-1); // [HGM] vari: yy_text is not available to caller after buffer switch ?!?
+     text[len-1] = NULLCHAR;\r
 \r
 #ifdef FLEX_SCANNER\r
     if (oldBuffer != NULL) \r