| LLOOP Index | GSP Language | GSP Library | Framework Classes | Component Classes |
This is the verbatim text of the file "gspc_arguments_cpp.gsp" part of the LLOOP package. The copyright remains with Michel MEHL. All rights reserved.
import file;
import string;
string PlatformName;
symbol MakeExeOption implements option(
"Executable",
"--make-exe",
"Tells whether to generate a makefile that builds an executable",
"--make-exe") ;
symbol MakeLibOption implements option(
"Library",
"--make-lib",
"Tells whether to generate a makefile that builds a library",
"--make-lib") ;
symbol PlatformOption implements option(
"Platform",
"--platform=<PLATFORM>",
"Gives the name of the platform for which the executable or library shall be build.\n\nPossible values are 'windows', 'unix' and 'all'. \n\nFor Unix, makefiles have the .mak extension. For Windows, they have the .nmak extension.\n\nThe special keyword 'all' allows to generate makefiles for all supported platforms. This is useful when the same application has to be constructed for multiple platforms. \n\nThe default value is the platform on which gspc is run.",
"--platform",
PlatformName) ;
symbol AdvancedMakefileOptionSet implements optionset(
"Advanded Makefile Option Set",
"Advanded Makefile Option Set",
gspc_arguments_make.ArgumentMAK) ;
symbol HOutputDirOption implements option(
"Output directory for C++ header files",
"--h-dir=<DIRECTORY>",
"Directory in which the C++ header files shall be generated.\n\nThe directory is created if it does not exist.\n\nWhen not specified, the current working directory is used, i.e. the directory from which the generator was invoked.",
"--h-dir",
forcedir) ;
symbol CPPOutputDirOption implements option(
"Output directory for C++ implementation files",
"--cpp-dir=<DIRECTORY>",
"Directory in which the C++ implementation files shall be generated.\n\nThe directory is created if it does not exist.\n\nWhen not specified, the current working directory is used, i.e. the directory from which the generator was invoked.",
"--cpp-dir",
forcedir) ;
symbol ObjOutputDirOption implements option(
"Output directory for C++ object files",
"--obj-dir=<DIRECTORY>",
"Directory in which the C++ intermediate compiled object files shall be stored.\n\nThe directory is created if it does not exist.\n\nWhen not specified, the current working directory is used, i.e. the directory from which the generator was invoked.\n.",
"--obj-dir",
forcedir) ;
symbol UseOldStreamOption implements option(
"Use old stream",
"--use-old-stream",
"Tells whether to use old streams.",
"--use-old-stream") ;
symbol NoNamespaceOption implements option(
"Define no namespace for grammar",
"--no-namespace",
"Tells whether not to define a namespace for the generated classes.\n\nBy default, a namespace is defined and the name of the input grammar file without extension is used as namespace.",
"--no-namespace");
symbol TemplateDirOption implements option(
"Templates directory for generated code",
"--template-dir=<DIRECTORY>",
"Generated source code templates are built into the generator. Therefore, modifying these templates requires to re-compile the generator.\n\nWhen templates are available as independent files, this option allows to shortcut the generator rebuild and to run a generation directly from the template files located under the passed directory.\n\nTemplate files are not part of the default LLOOP package and are not provided to users except in the scope of a specific agreement.",
"--template-dir",
existingdir) ;
symbol EditorOption implements option(
"Text editor",
"--editor=<FILE>",
"Name or path of the text editor to use for editing grammars or source files. \n\nInvoking the editor from the toolbar or menu opens the input grammars for edition. \n\nMultiple editors can be entered depending on their actual availability.",
"--editor",
file) ;
symbol NoNamespaceOption occurs at most once;
symbol UseOldStreamOption occurs at most once;
symbol HOutputDirOption occurs at most once;
symbol CPPOutputDirOption occurs at most once;
symbol ObjOutputDirOption occurs at most once;
symbol MakeExeOption occurs at most once;
symbol MakeLibOption occurs at most once;
symbol TemplateDirOption occurs at most once;
/* There can be several AdditionalCPPOption
*/
/* The values of the options are actually stored in member variables
* of the extended 'OptionsData' class.
*/
symbol ArgumentCPP extends class OptionsData()
include
"OptionsData.h",
"gspc_arguments_make__ArgumentMAK.h",
"gspc_arguments_cpp__PlatformName.h",
"gspc_arguments_cpp__PlatformName.h",
"gspc_arguments_cpp__ExistingFileToken.h",
"universal__File.h",
"gspc_arguments_cpp__ForceDirectoryToken.h",
"gspc_arguments_cpp__DirectoryToken.h",
"gspc_arguments_cpp__ExistingDirectoryToken.h",
"gspc_arguments_cpp__MakeLibOption.h",
"gspc_arguments_cpp__MakeExeOption.h";
/* | SGenConfigurationFileOption */
ArgumentCPP ::= (TemplateDirOption | NoNamespaceOption | UseOldStreamOption | HOutputDirOption | CPPOutputDirOption | ObjOutputDirOption | MakeExeOption| MakeLibOption | PlatformOption | EditorOption | AdvancedMakefileOptionSet)
{{
// NOTE: EditorOption not managed
OptionsData& o = dynamic_cast<OptionsData&>(root());
if ($1.getSymbolName() == "AdvancedMakefileOptionSet")
{
o.completeWith(dynamic_cast<AdvancedMakefileOptionSet&>($1).gspc_arguments_make__ArgumentMAKRef());
}
else if ($1.getSymbolName() == "MakeExeOption")
{
o.m_bMakeExe = true;
}
else if ($1.getSymbolName() == "NoNamespaceOption")
{
o.m_bExplicitProjectNameGiven = true;
o.m_sProject = "";
}
else if ($1.getSymbolName() == "PlatformOption")
{
o.m_sPlatform = dynamic_cast<PlatformOption&>($1).PlatformNameRef().str();
}
else if ($1.getSymbolName() == "MakeLibOption")
{
o.m_bMakeLib = true;
}
else if ($1.getSymbolName() == "TemplateDirOption")
{
o.m_sTemplateDir = dynamic_cast<TemplateDirOption&>($1).ExistingDirectoryTokenRef().absolutePath();
o.m_bTemplateFromFile = true;
}
else if ($1.getSymbolName() == "UseOldStreamOption")
{
o.m_bUseOldStream = true;
}
else if ($1.getSymbolName() == "HOutputDirOption")
{
universal::File& f = dynamic_cast<HOutputDirOption&>($1).ForceDirectoryTokenRef();
o.m_sHOutputDir = f.absolutePath();
o.m_sOriginalHOutputDir = f.name();
}
else if ($1.getSymbolName() == "CPPOutputDirOption")
{
universal::File& f = dynamic_cast<CPPOutputDirOption&>($1).ForceDirectoryTokenRef();
o.m_sCPPOutputDir = f.absolutePath();
o.m_sOriginalCPPOutputDir = f.name();
}
else if ($1.getSymbolName() == "ObjOutputDirOption")
{
universal::File& f = dynamic_cast<ObjOutputDirOption&>($1).ForceDirectoryTokenRef();
o.m_sObjOutputDir = f.absolutePath();
o.m_sOriginalObjOutputDir = f.name();
}
}}
PlatformName ::= ('windows' | 'unix' | 'all')
{{
/* If the keyword is followed by something that is not a space char
* the parsing must be rejected.
*/
if (! isspace($0.stream().peek()))
{
reject();
}
else
{
set(#1);
}
}}
| string
{{
error(cout, $1.getLineNo(), "invalid platform '%s' specified", $1.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 |