/// <summary> /// コンパイルマネージャ。 /// </summary> /// <param name="args">コマンドライン引数。</param> public CompileManager(string[] args) { Namespace = Properties.Settings.Default.NameSpace; string newLine = Properties.Settings.Default.LineTerminator.ToLower(); if ((newLine == "\\r") || (newLine == "cr")) { LineTerminator = "\r"; } else if ((newLine == "\\n") || (newLine == "lf")) { LineTerminator = "\n"; } else { LineTerminator = "\r\n"; } string encoding = Properties.Settings.Default.Encoding; if (encoding.ToLower() == "utf-8n") { Encoding = new UTF8Encoding(false); } else { Encoding enc = Encoding; try { enc = Encoding.GetEncoding(encoding); } catch (Exception) { } Encoding = enc; } // コンパイルオプションのチェック CheckCompileOptions(args); // コンフィグファイルの読み込み if (ConfigFilePath != "") { _RTCOPConfigFile = LoadConfigFile(ConfigFilePath); } // プリプロセッサ・コンパイラの生成 _RTCOPPreprocessor = new RTCOPPreprocessor(Macros, IncludePaths, Encoding); _RTCOPCompiler = new RTCOPCompiler(_RTCOPConfigFile); _RTCOPCodeGenerator = new RTCOPCodeGenerator(Namespace, LineTerminator, Target, Environment, IncludePaths); }
public static void Test() { string src = @" baselayer { // ベースクラス base class Sample { public: Sample(); virtual ~Sample(); }; } "; var text = RTCOPParser.BaseLayerDefinition.TokenWithSkipComment().Many().Parse(src); //var text = PreprocessParser.DirectiveOrLine.TokenWithSkipCommentForPreprocessParser().Many().Parse(src2); //var text = RTCOPParser.BaseLayerDefinition.TokenWithSkipComment().Many().Parse(src); //var text = TokenParser.Token.TokenWithSkipComment().Many().Parse(src); //var text = PreprocessParser.Directive.TokenWithSkipCommentForPreprocessParser().Many().Parse(src); //foreach (var t in text) Console.WriteLine(t); //Console.WriteLine(text); RTCOPSourceFile f = new RTCOPSourceFile("a.lcpp", src); RTCOPPreprocessor p = new RTCOPPreprocessor(new string[0], new List <string>(), Encoding.UTF8); var f2 = p.Run(f); Console.WriteLine(f2.Text); RTCOPCompiler c = new RTCOPCompiler(null); var of = c.Compile(f2); LayerStructureFile.SaveFile(@"C:\Users\Ikuta\Desktop\aaa.lobj", of); var of2 = LayerStructureFile.LoadFile(@"C:\Users\Ikuta\Desktop\aaa.lobj"); }