This commit is contained in:
kudzu_cp 2012-06-16 02:22:39 +00:00
parent 209fa30b00
commit 4d69dcde01
2 changed files with 10 additions and 25 deletions

View file

@ -97,10 +97,10 @@ namespace Cosmos.Compiler.XSharp {
} }
protected void AddPatterns() { protected void AddPatterns() {
AddPattern(new TokenType[] { TokenType.LiteralAsm }, AddPattern("! Move EAX, 0",
"new LiteralAssemblerCode(\"{0}\");" "new LiteralAssemblerCode(\"{0}\");"
); );
AddPattern(new TokenType[] { TokenType.Comment }, AddPattern("# Comment",
"new Comment(\"{0}\");" "new Comment(\"{0}\");"
); );
AddPattern("Label:" , AddPattern("Label:" ,
@ -205,20 +205,11 @@ namespace Cosmos.Compiler.XSharp {
mPatterns.Add(new TokenPattern(aPattern), aCode); mPatterns.Add(new TokenPattern(aPattern), aCode);
} }
protected void AddPattern(TokenType[] aPattern, CodeFunc aCode) {
mPatterns.Add(new TokenPattern(aPattern), aCode);
}
protected void AddPattern(string aPattern, string aCode) { protected void AddPattern(string aPattern, string aCode) {
AddPattern(aPattern, delegate(TokenList aTokens, ref List<string> rCode) { AddPattern(aPattern, delegate(TokenList aTokens, ref List<string> rCode) {
rCode.Add(aCode); rCode.Add(aCode);
}); });
} }
protected void AddPattern(TokenType[] aPattern, string aCode) {
AddPattern(aPattern, delegate(TokenList aTokens, ref List<string> rCode) {
rCode.Add(aCode);
});
}
} }
} }

View file

@ -3,19 +3,13 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
namespace XSharpCompilerTester namespace XSharpCompilerTester {
{ static class Program {
static class Program [STAThread]
{ static void Main() {
/// <summary> Application.EnableVisualStyles();
/// The main entry point for the application. Application.SetCompatibleTextRenderingDefault(false);
/// </summary> Application.Run(new MainForm());
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
} }
}
} }