📄 smc.java
字号:
"-c", "C", SmcCGenerator.class, SmcHeaderCGenerator.class); _languages[C_PLUS_PLUS] = new Language( C_PLUS_PLUS, "-c++", "C++", SmcCppGenerator.class, SmcHeaderGenerator.class); _languages[C_SHARP] = new Language( C_SHARP, "-csharp", "C#", SmcCSharpGenerator.class, null); _languages[JAVA] = new Language( JAVA, "-java", "Java", SmcJavaGenerator.class, null); _languages[GRAPH] = new Language( GRAPH, "-graph", "-graph", SmcGraphGenerator.class, null); _languages[GROOVY] = new Language( GROOVY, "-groovy", "Groovy", SmcGroovyGenerator.class, null); _languages[LUA] = new Language( LUA, "-lua", "Lua", SmcLuaGenerator.class, null); _languages[OBJECTIVE_C] = new Language( OBJECTIVE_C, "-objc", "Objective-C", SmcObjCGenerator.class, SmcHeaderObjCGenerator.class); _languages[PERL] = new Language( PERL, "-perl", "Perl", SmcPerlGenerator.class, null); _languages[PHP] = new Language( PERL, "-php", "PHP", SmcPhpGenerator.class, null); _languages[PYTHON] = new Language( PYTHON, "-python", "Python", SmcPythonGenerator.class, null); _languages[RUBY] = new Language( RUBY, "-ruby", "Ruby", SmcRubyGenerator.class, null); _languages[SCALA] = new Language( SCALA, "-scala", "Scala", SmcScalaGenerator.class, null); _languages[TABLE] = new Language( TABLE, "-table", "-table", SmcTableGenerator.class, null); _languages[TCL] = new Language( TCL, "-tcl", "[incr Tcl]", SmcTclGenerator.class, null); _languages[VB] = new Language( VB, "-vb", "VB.net", SmcVBGenerator.class, null); List<Language> languages = new ArrayList<Language>(); int target; _optionMap = new HashMap<String, List<Language>>(); // Languages supporting each option: // + -cast: C++ // + -d: all // + -g: all // + -glevel: graph // + -header: C, C++, Objective C // + -help: all // + -nocatch: all // + -noex: C++ // + -nostreams: C++ // + -reflect: C#, Java, TCL, VB, Lua, Perl, PHP, // Python, Ruby, Groovy, Scala // + -return: all // + -serial: C#, C++, Java, Tcl, VB, Groovy, Scala // + -suffix: all // + -sync: C#, Java, VB, Groovy, Scala // + -verbose: all // + -version: all // + -vverbose: all // Set the options supporting all languages first. for (target = (LANG_NOT_SET + 1); target < LANGUAGE_COUNT; ++target) { languages.add(_languages[target]); } _optionMap.put(DIRECTORY_FLAG, languages); _optionMap.put(DEBUG_FLAG, languages); _optionMap.put(HELP_FLAG, languages); _optionMap.put(NO_CATCH_FLAG, languages); _optionMap.put(RETURN_FLAG, languages); _optionMap.put(SUFFIX_FLAG, languages); _optionMap.put(VERBOSE_FLAG, languages); _optionMap.put(VERSION_FLAG, languages); _optionMap.put(VVERBOSE_FLAG, languages); // Set the options supported by less than all langugages. languages = new ArrayList<Language>(); languages.add(_languages[C_PLUS_PLUS]); _optionMap.put(CAST_FLAG, languages); _optionMap.put(NO_EXCEPTIONS_FLAG, languages); _optionMap.put(NO_STREAMS_FLAG, languages); // Languages using a header file. languages = new ArrayList<Language>(); languages.add(_languages[C_PLUS_PLUS]); languages.add(_languages[C]); languages.add(_languages[OBJECTIVE_C]); _optionMap.put(HEADER_FLAG, languages); // Languages supporting thread synchronization. languages = new ArrayList<Language>(); languages.add(_languages[C_SHARP]); languages.add(_languages[JAVA]); languages.add(_languages[VB]); languages.add(_languages[GROOVY]); languages.add(_languages[SCALA]); _optionMap.put(SYNC_FLAG, languages); // Languages supporting reflection. languages = new ArrayList<Language>(); languages.add(_languages[C_SHARP]); languages.add(_languages[JAVA]); languages.add(_languages[VB]); languages.add(_languages[TCL]); languages.add(_languages[LUA]); languages.add(_languages[PERL]); languages.add(_languages[PHP]); languages.add(_languages[PYTHON]); languages.add(_languages[RUBY]); languages.add(_languages[GROOVY]); languages.add(_languages[SCALA]); _optionMap.put(REFLECT_FLAG, languages); // Languages supporting serialization. languages = new ArrayList<Language>(); languages.add(_languages[C_SHARP]); languages.add(_languages[JAVA]); languages.add(_languages[VB]); languages.add(_languages[TCL]); languages.add(_languages[C_PLUS_PLUS]); languages.add(_languages[GROOVY]); languages.add(_languages[SCALA]); _optionMap.put(SERIAL_FLAG, languages); // The -glevel option. languages = new ArrayList<Language>(); languages.add(_languages[GRAPH]); _optionMap.put(GLEVEL_FLAG, languages); }}//// CHANGE LOG// $Log: Smc.java,v $// Revision 1.28 2008/04/22 16:05:24 fperrad// - add PHP language (patch from Toni Arnold)//// Revision 1.27 2008/03/21 14:03:16 fperrad// refactor : move from the main file Smc.java to each language generator the following data :// - the default file name suffix,// - the file name format for the generated SMC files//// Revision 1.26 2008/02/04 10:32:49 fperrad// + Added Scala language generation.//// Revision 1.25 2008/01/14 19:59:23 cwrapp// Release 5.0.2 check-in.//// Revision 1.24 2008/01/04 20:40:40 cwrapp// Corrected minor misspellings and incorrect information.//// Revision 1.23 2007/08/05 13:53:09 cwrapp// Version 5.0.1 check-in. See net/sf/smc/CODE_README.txt for more information.//// Revision 1.22 2007/07/16 06:28:06 fperrad// + Added Groovy generator.//// Revision 1.21 2007/02/21 13:53:38 cwrapp// Moved Java code to release 1.5.0//// Revision 1.20 2007/02/13 18:43:19 cwrapp// Reflect options fix.//// Revision 1.19 2007/01/15 00:23:50 cwrapp// Release 4.4.0 initial commit.//// Revision 1.18 2007/01/03 15:37:38 fperrad// + Added Lua generator.// + Added -reflect option for Lua, Perl, Python and Ruby code generation//// Revision 1.17 2006/09/23 14:28:18 cwrapp// Final SMC, v. 4.3.3 check-in.//// Revision 1.16 2006/09/16 15:04:28 cwrapp// Initial v. 4.3.3 check-in.//// Revision 1.15 2006/07/11 18:20:00 cwrapp// Added -headerd option. Improved command line processing.//// Revision 1.14 2006/04/22 12:45:26 cwrapp// Version 4.3.1//// Revision 1.13 2005/11/07 19:34:54 cwrapp// Changes in release 4.3.0:// New features://// + Added -reflect option for Java, C#, VB.Net and Tcl code// generation. When used, allows applications to query a state// about its supported transitions. Returns a list of transition// names. This feature is useful to GUI developers who want to// enable/disable features based on the current state. See// Programmer's Manual section 11: On Reflection for more// information.//// + Updated LICENSE.txt with a missing final paragraph which allows// MPL 1.1 covered code to work with the GNU GPL.//// + Added a Maven plug-in and an ant task to a new tools directory.// Added Eiten Suez's SMC tutorial (in PDF) to a new docs// directory.//// Fixed the following bugs://// + (GraphViz) DOT file generation did not properly escape// double quotes appearing in transition guards. This has been// corrected.//// + A note: the SMC FAQ incorrectly stated that C/C++ generated// code is thread safe. This is wrong. C/C++ generated is// certainly *not* thread safe. Multi-threaded C/C++ applications// are required to synchronize access to the FSM to allow for// correct performance.//// + (Java) The generated getState() method is now public.//// Revision 1.12 2005/09/19 15:20:03 cwrapp// Changes in release 4.2.2:// New features://// None.//// Fixed the following bugs://// + (C#) -csharp not generating finally block closing brace.//// Revision 1.11 2005/09/14 01:51:33 cwrapp// Changes in release 4.2.0:// New features://// None.//// Fixed the following bugs://// + (Java) -java broken due to an untested minor change.//// Revision 1.10 2005/08/26 15:21:34 cwrapp// Final commit for release 4.2.0. See README.txt for more information.//// Revision 1.9 2005/07/07 12:08:44 fperrad// Added C, Perl & Ruby generators.//// Revision 1.8 2005/06/30 10:44:23 cwrapp// Added %access keyword which allows developers to set the generate Context// class' accessibility level in Java and C#.//// Revision 1.7 2005/06/18 18:28:42 cwrapp// SMC v. 4.0.1//// New Features://// (No new features.)//// Bug Fixes://// + (C++) When the .sm is in a subdirectory the forward- or// backslashes in the file name are kept in the "#ifndef" in the// generated header file. This is syntactically wrong. SMC now// replaces the slashes with underscores.//// + (Java) If %package is specified in the .sm file, then the// generated *Context.java class will have package-level access.//// + The Programmer's Manual had incorrect HTML which prevented the// pages from rendering correctly on Internet Explorer.//// + Rewrote the Programmer's Manual section 1 to make it more// useful.//// Revision 1.6 2005/05/28 19:28:42 cwrapp// Moved to visitor pattern.//// Revision 1.8 2005/02/21 15:34:25 charlesr// Added Francois Perrad to Contributors section for Python work.//// Revision 1.7 2005/02/21 15:09:07 charlesr// Added -python and -return command line options. Also added an// undocuments option -vverbose which causes the SmcParser and// SmcLexer FSMs to enter verbose mode.//// Revision 1.6 2005/02/03 16:26:44 charlesr// SMC now implements the Visitor pattern. The parser returns// an SmcFSM object which is an SmcElement subclass. SMC then// creates the appropriate visitor object based on the target// language and passes the visitor to SmcElement.accept().// This starts the code generation process.//// One minor point: the lexer and parser objects no longer// write warning and error messages directly to System.err.// Instead, these messages are collected as SmcMessage objects.// It is then up to the application calling the parser to// decide how to display this information. Now the SMC// application writes these messages to System.err as before.// This change allows the parser to be used in different// applications.//// Revision 1.5 2004/10/30 16:02:24 charlesr// Added Graphviz DOT file generation.// Changed version to 3.2.0.//// Revision 1.4 2004/10/08 18:56:07 charlesr// Update version to 3.1.2.//// Revision 1.3 2004/10/02 19:50:24 charlesr// Updated version string.//// Revision 1.2 2004/09/06 16:39:16 charlesr// Added -verbose and -d options. Added C# support.//// Revision 1.1 2004/05/31 13:52:56 charlesr// Added support for VB.net code generation.//// Revision 1.0 2003/12/14 21:02:45 charlesr// Initial revision//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -