LLOOP Index | GSP Language | GSP Library | Framework Classes | Component Classes

string.gsp

This is the verbatim text of the file "string.gsp" part of the LLOOP package. The copyright remains with Michel MEHL. All rights reserved.



/**
 * Reads any sequence of printable chars (between 0x20 (' ') and 0x7E ('~')), except space chars. 
 */

token StringToken extends class universal::String()
  include <stdio.h>, <ctype.h>, "universal__String.h"
  alias "string"
  parse
  {{ 
    setEmpty();

    char c = 0;        		

    is.get(c);
    while ( isprint(c) && !isspace(c) && !iscntrl(c) && !is.fail() ) 
      {        
	append(c);
	is.get(c);
      }
	
    if (length() == 0)
      abort("");
    else 
      {
	if (is.fail()) 
	  is.clear(); // In case of EOF
	else
	  is.seekg(-1, ios::cur); // Set pos to the immediate following char 
      }
  }}
  expand
  {{
    os << toString();
  }}


This file is part of the LLOOP Reversible Object-Oriented Parser Generator. Copyright (c) 2005-2006 Michel MEHL, France. All rights reserved. LLOOP is distributed by the company ERSA SaRL.


Copyright (c) 2005-2006 Michel MEHL, Haguenau, France
LLOOP version 1.1