| LLOOP Index | GSP Language | GSP Library | Framework Classes | Component Classes |
This is the verbatim text of the file "image.gsp" part of the LLOOP package. The copyright remains with Michel MEHL. All rights reserved.
/**
* Reads the name or the path of an existing image.
*
* It also checks whether the file has a valid image file extension, ie. png, jpg, jpeg, gif, ppm, bmp, xpm, xbm, pbm, pcx, pgm, eps.
*
* Raises an error when the file does not exist or when the image extension is
* not recognised.
*/
import file;
symbol ImageFileToken
extends symbol ExistingFileToken()
alias "image", "imagefile", "existingimage"
test
{{
"." : pass "."
".." : pass ".."
"..." : fail "..."
}}
;
ImageFileToken ::= ExistingFileToken
{{
setName($1.name());
const universal::String& c_sExt = extension().toLowerCase();
if (c_sExt != "png" &&
c_sExt != "jpg" &&
c_sExt != "jpeg" &&
c_sExt != "gif" &&
c_sExt != "ppm" &&
c_sExt != "bmp" &&
c_sExt != "xpm" &&
c_sExt != "xbm" &&
c_sExt != "pbm" &&
c_sExt != "pcx" &&
c_sExt != "pgm" &&
c_sExt != "eps"
)
{
error (cerr, $1.getLineNo(), "unrecognized image extension '%s' for image file '%s' ", c_sExt.str(), $1.name().str());
}
}}
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 |