public void Setup(MainWindow mainWindow, EmueraConsole console) { var builder = new StringBuilder(); console.GetDisplayStrings(builder); textBox1.Text = builder.ToString(); }
public static LogicalLine ParseLine(string str, EmueraConsole console) { var position = new ScriptPosition(str); var stream = new StringStream(str); return(ParseLine(stream, position, console)); }
public ProcessState(EmueraConsole console) { if (Program.DebugMode) //DebugModeでなければ知らなくて良い { this.console = console; } }
public MainWindow() { InitializeComponent(); if (Program.DebugMode) { デバッグToolStripMenuItem.Visible = true; } mainPicBox.SetStyle(); initControlSizeAndLocation(); TextBox.ForeColor = Config.ForeColor; TextBox.BackColor = Config.BackColor; mainPicBox.BackColor = Config.BackColor; //これは実際には使用されないはず BackColor = Config.BackColor; TextBox.Font = Config.Font; TextBox.LanguageOption = RichTextBoxLanguageOptions.UIFonts; folderSelectDialog.SelectedPath = Program.ErbDir; folderSelectDialog.ShowNewFolderButton = false; openFileDialog.InitialDirectory = Program.ErbDir; openFileDialog.Filter = "ERBファイル (*.erb)|*.erb"; openFileDialog.FileName = ""; openFileDialog.Multiselect = true; openFileDialog.RestoreDirectory = true; var Emuera_verInfo = "Emuera Ver. " + emueraVer.FileVersion.Remove(5); if (emueraVer.FileBuildPart > 0) { Emuera_verInfo += "+v" + emueraVer.FileBuildPart + (emueraVer.FilePrivatePart > 0 ? "." + emueraVer.FilePrivatePart : ""); } EmuVerToolStripTextBox.Text = Emuera_verInfo; timer.Enabled = true; console = new EmueraConsole(this); macroMenuItems[0] = マクロ01ToolStripMenuItem; macroMenuItems[1] = マクロ02ToolStripMenuItem; macroMenuItems[2] = マクロ03ToolStripMenuItem; macroMenuItems[3] = マクロ04ToolStripMenuItem; macroMenuItems[4] = マクロ05ToolStripMenuItem; macroMenuItems[5] = マクロ06ToolStripMenuItem; macroMenuItems[6] = マクロ07ToolStripMenuItem; macroMenuItems[7] = マクロ08ToolStripMenuItem; macroMenuItems[8] = マクロ09ToolStripMenuItem; macroMenuItems[9] = マクロ10ToolStripMenuItem; macroMenuItems[10] = マクロ11ToolStripMenuItem; macroMenuItems[11] = マクロ12ToolStripMenuItem; foreach (var item in macroMenuItems) { item.Click += マクロToolStripMenuItem_Click; } TextBox.MouseWheel += richTextBox1_MouseWheel; mainPicBox.MouseWheel += richTextBox1_MouseWheel; ScrollBar.MouseWheel += richTextBox1_MouseWheel; }
public MainWindow() { InitializeComponent(); if (Program.DebugMode) { デバッグToolStripMenuItem.Visible = true; } ((EraPictureBox)mainPicBox).SetStyle(); initControlSizeAndLocation(); richTextBox1.ForeColor = Config.ForeColor; richTextBox1.BackColor = Config.BackColor; ///mainPicBox.BackColor = Config.BackColor;//これは実際には使用されないはず ///this.BackColor = Config.BackColor; richTextBox1.Font = Config.Font; ///richTextBox1.LanguageOption = RichTextBoxLanguageOptions.UIFonts; folderSelectDialog.SelectedPath = Program.ErbDir; folderSelectDialog.ShowNewFolderButton = false; openFileDialog.InitialDirectory = Program.ErbDir; openFileDialog.Filter = "ERBファイル (*.erb)|*.erb"; openFileDialog.FileName = ""; openFileDialog.Multiselect = true; openFileDialog.RestoreDirectory = true; string Emuera_verInfo = "Emuera Ver. " + emueraVer.FileVersion.Remove(5); if (emueraVer.FileBuildPart > 0) { Emuera_verInfo += "+v" + emueraVer.FileBuildPart.ToString() + ((emueraVer.FilePrivatePart > 0) ? "." + emueraVer.FilePrivatePart.ToString() : ""); } EmuVerToolStripTextBox.Text = Emuera_verInfo; timer.Enabled = true; console = new EmueraConsole(this); //macroMenuItems[0] = マクロ01ToolStripMenuItem; //macroMenuItems[1] = マクロ02ToolStripMenuItem; //macroMenuItems[2] = マクロ03ToolStripMenuItem; //macroMenuItems[3] = マクロ04ToolStripMenuItem; //macroMenuItems[4] = マクロ05ToolStripMenuItem; //macroMenuItems[5] = マクロ06ToolStripMenuItem; //macroMenuItems[6] = マクロ07ToolStripMenuItem; //macroMenuItems[7] = マクロ08ToolStripMenuItem; //macroMenuItems[8] = マクロ09ToolStripMenuItem; //macroMenuItems[9] = マクロ10ToolStripMenuItem; //macroMenuItems[10] = マクロ11ToolStripMenuItem; //macroMenuItems[11] = マクロ12ToolStripMenuItem; //foreach(ToolStripMenuItem item in macroMenuItems) // item.Click += new EventHandler(マクロToolStripMenuItem_Click); this.richTextBox1.MouseWheel += new Forms.MouseEventHandler(this.richTextBox1_MouseWheel); //this.mainPicBox.MouseWheel += new Forms.MouseEventHandler(this.richTextBox1_MouseWheel); this.vScrollBar.MouseWheel += new Forms.MouseEventHandler(this.richTextBox1_MouseWheel); }
public void Init() { if (created_) { return; } created_ = true; console_ = new EmueraConsole(this); console_.Initialize(); }
public static void Reset() { Process = null; ConstantData = null; GameBaseData = null; EMediator = null; VEvaluator = null; VariableData = null; Console = null; MainWindow = null; LabelDictionary = null; IdentifierDictionary = null; tempDic.Clear(); }
private void MainWindow_FormClosing(object sender, FormClosingEventArgs e) { if (Config.UseKeyMacro) { KeyMacro.SaveMacro(); } if (console != null) { //ほっとしても勝手に閉じるが、その場合はDebugDialogのClosingイベントが発生しない if ((Program.DebugMode) && (console.DebugDialog != null) && (console.DebugDialog.Created)) { console.DebugDialog.Close(); } console.Dispose(); console = null; } }
public static LogicalLine ParseLine(StringStream stream, ScriptPosition position, EmueraConsole console) { var lineNo = position.LineNo; var errMes = ""; LexicalAnalyzer.SkipWhiteSpace(stream); //先頭のホワイトスペースを読み飛ばす if (stream.EOS) { return(null); } //コメント行かどうかはここに来る前に判定しておく try { #region 前置インクリメント、デクリメント行 if (stream.Current == '+' || stream.Current == '-') { var op = stream.Current; var wc = LexicalAnalyzer.Analyse(stream, LexEndWith.EoL, LexAnalyzeFlag.None); var opWT = wc.Current as OperatorWord; if (opWT == null || opWT.Code != OperatorCode.Increment && opWT.Code != OperatorCode.Decrement) { if (op == '+') { errMes = "行が\'+\'から始まっていますが、インクリメントではありません"; } else { errMes = "行が\'-\'から始まっていますが、デクリメントではありません"; } goto err; } wc.ShiftNext(); //token = EpressionParser.単語一個分取得(wc) //token非変数 //token文字列形 //token変更不可能 //if (wc != EOS) // return(new InstructionLine(position, FunctionIdentifier.SETFunction, opWT.Code, wc, null)); } #endregion var idWT = LexicalAnalyzer.ReadFirstIdentifierWord(stream); if (idWT != null) { var func = GlobalStatic.IdentifierDictionary.GetFunctionIdentifier(idWT.Code); //命令文 if (func != null) //関数文 { if (stream.EOS) //引数の無い関数 { return(new InstructionLine(position, func, stream)); } if (stream.Current != ';' && stream.Current != ' ' && stream.Current != '\t' && (!Config.SystemAllowFullSpace || stream.Current != ' ')) { if (stream.Current == ' ') { errMes = "命令で行が始まっていますが、命令の直後に半角スペース・タブ以外の文字が来ています(この警告はシステムオプション「" + Config.GetConfigName(ConfigCode.SystemAllowFullSpace) + "」により無視できます)"; } else { errMes = "命令で行が始まっていますが、命令の直後に半角スペース・タブ以外の文字が来ています"; } goto err; } stream.ShiftNext(); return(new InstructionLine(position, func, stream)); } } LexicalAnalyzer.SkipWhiteSpace(stream); if (stream.EOS) { errMes = "解釈できない行です"; goto err; } //命令行ではない→代入行のはず stream.Seek(0, SeekOrigin.Begin); var assignOP = OperatorCode.NULL; var wc1 = LexicalAnalyzer.Analyse(stream, LexEndWith.Operator, LexAnalyzeFlag.None); //if (idWT != null) // wc1.Collection.Insert(0, idWT); try { assignOP = LexicalAnalyzer.ReadAssignmentOperator(stream); } catch (CodeEE) { errMes = "解釈できない行です"; goto err; } //eramaker互換警告 //stream.Jump(-1); //if ((stream.Current != ' ') && (stream.Current != '\t')) //{ // errMes = "変数で行が始まっていますが、演算子の直前に半角スペースまたはタブがありません"; // goto err; //} //stream.ShiftNext(); if (assignOP == OperatorCode.Equal) { if (console != null) { ParserMediator.Warn("代入演算子に\"==\"が使われています", position, 0); } //"=="を代入文に使うのは本当はおかしいが結構使われているので仕様にする assignOP = OperatorCode.Assignment; } return(new InstructionLine(position, FunctionIdentifier.SETFunction, assignOP, wc1, stream)); err: return(new InvalidLine(position, errMes)); } catch (CodeEE e) { SystemSounds.Hand.Play(); return(new InvalidLine(position, e.Message)); } }
public static LogicalLine ParseLabelLine(StringStream stream, ScriptPosition position, EmueraConsole console) { var isFunction = stream.Current == '@'; var lineNo = position.LineNo; var labelName = ""; var errMes = ""; try { var warnLevel = -1; stream.ShiftNext(); //@か$を除去 var wc = LexicalAnalyzer.Analyse(stream, LexEndWith.EoL, LexAnalyzeFlag.AllowAssignment); if (wc.EOL || !(wc.Current is IdentifierWord)) { errMes = "関数名が不正であるか存在しません"; goto err; } labelName = ((IdentifierWord)wc.Current).Code; wc.ShiftNext(); if (Config.ICVariable) { labelName = labelName.ToUpper(); } GlobalStatic.IdentifierDictionary.CheckUserLabelName(ref errMes, ref warnLevel, isFunction, labelName); if (warnLevel >= 0) { if (warnLevel >= 2) { goto err; } ParserMediator.Warn(errMes, position, warnLevel); } if (!isFunction) //$ならこの時点で終了 { if (!wc.EOL) { ParserMediator.Warn("$で始まるラベルに引数が設定されています", position, 1); } return(new GotoLabelLine(position, labelName)); } //labelName = LexicalAnalyzer.ReadString(stream, StrEndWith.LeftParenthesis_Bracket_Comma_Semicolon); //labelName = labelName.Trim(); //if (Config.ICVariable) // labelName = labelName.ToUpper(); //GlobalStatic.IdentifierDictionary.CheckUserLabelName(ref errMes, ref warnLevel, isFunction, labelName); //if(warnLevel >= 0) //{ // if (warnLevel >= 2) // goto err; // ParserMediator.Warn(errMes, position, warnLevel); //} //if (!isFunction)//$ならこの時点で終了 //{ // LexicalAnalyzer.SkipWhiteSpace(stream); // if (!stream.EOS) // ParserMediator.Warn("$で始まるラベルに引数が設定されています", position, 1); // return new GotoLabelLine(position, labelName); //} ////関数名部分に_renameを使えないように変更 //if (ParserMediator.RenameDic != null && ((stream.ToString().IndexOf("[[") >= 0) && (stream.ToString().IndexOf("]]") >= 0))) //{ // string line = stream.ToString(); // foreach (KeyValuePair<string, string> pair in ParserMediator.RenameDic) // line = line.Replace(pair.Key, pair.Value); // stream = new StringStream(line); //} //WordCollection wc = null; //wc = LexicalAnalyzer.Analyse(stream, LexEndWith.EoL, LexAnalyzeFlag.AllowAssignment); if (Program.AnalysisMode) { console.PrintC("@" + labelName, false); } var funclabelLine = new FunctionLabelLine(position, labelName, wc); if (IdentifierDictionary.IsEventLabelName(labelName)) { funclabelLine.IsEvent = true; funclabelLine.IsSystem = true; funclabelLine.Depth = 0; } else if (IdentifierDictionary.IsSystemLabelName(labelName)) { funclabelLine.IsSystem = true; funclabelLine.Depth = 0; } return(funclabelLine); } catch (CodeEE e) { errMes = e.Message; } err: SystemSounds.Hand.Play(); if (isFunction) { if (labelName.Length == 0) { labelName = "<Error>"; } return(new InvalidLabelLine(position, labelName, errMes)); } return(new InvalidLine(position, errMes)); }
public static void Initialize(EmueraConsole console) { ParserMediator.console = console; }
public HeaderFileLoader(EmueraConsole main, IdentifierDictionary idDic, Process proc) { output = main; parentProcess = proc; this.idDic = idDic; }
internal void SetParent(EmueraConsole console, Process process) { emuera = process; mainConsole = console; }
internal void SetParent(EmueraConsole emueraConsole, Process emuera) { throw new NotImplementedException(); }
public Process(EmueraConsole view) { console = view; }
public ExpressionMediator(Process proc, VariableEvaluator vev, EmueraConsole console) { VEvaluator = vev; Process = proc; Console = console; }
/// <summary> /// /// </summary> /// <param name="main"></param> /// <param name="exm"></param> /// <param name="proc"></param> public ErbArchiveLoader(EmueraConsole main, ExpressionMediator exm, Process proc) { parentProcess = proc; mediator = exm; output = main; }