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

char.gsp

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



/**
 * Reads a char. Preceding whitespaces are eaten as usual.
 */

token CharToken extends class universal::String() 
alias "Char", "char"
parse
{{
  char c = 0;        		
  setEmpty();
  is.get(c);
  if (!is.fail()) 
    append(c);
  else
    abort("");
}}

expand
{{
  os << toString();
}}

test
{{
  "x": pass {x}
  "1": pass {1}
  "a": pass {a}
  "\\n": fail "\n"
  "bb": fail {bb}
}}

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