示例#1
0
文件: Test.cs 项目: blyry/MiniME
        private void RunTest(string resourceName)
        {
            var t = new TestFile();
            t.LoadFromString(LoadTextResource(resourceName));

            // Compile the input script
            var c = new Compiler();
            c.Formatted = t.Input.IndexOf("[Formatted]") >= 0;
            c.NoObfuscate = t.Input.IndexOf("[NoObfuscate]") >= 0;
            c.SymbolInfo = t.Input.IndexOf("[SymbolInfo]") >= 0;
            c.MinifyKind = t.Input.IndexOf("[CSS]") >= 0 ? MinifyKind.CSS : MinifyKind.JS;
            c.NoCredit = true;
            c.MaxLineLength = 0;
            c.AddScript(resourceName, t.Input, false);

            // Render it
            string strActual = c.CompileToString().Trim();

              //string sep = new string('-', 15);
              //Console.WriteLine(sep + " input " + sep + "\n" + t.Input);
              //Console.WriteLine(sep + " actual " + sep + "\n" + strActual);
              //Console.WriteLine(sep + " expected" + sep + "\n" + t.Output);

            Assert.That(strActual, Is.EqualTo(t.Output));
        }
示例#2
0
        // Constructor
        public SymbolAllocator(Compiler c)
        {
            m_Compiler = c;

            // Create the global scope
            m_ScopeStack.Add(new Scope());
            CurrentScope.NextSymbol = "a";
        }
示例#3
0
文件: Tokenizer.cs 项目: blyry/MiniME
        // Constructor
        public Tokenizer(Compiler Compiler, string str, string strFileName, bool bWarnings)
        {
            this.Compiler=Compiler;

            // Prep the string scanner
            p = new StringScanner();
            p.Reset(str);
            p.FileName = strFileName;

            m_bWarnings = bWarnings;

            // Used to detect line breaks between tokens for automatic
            // semicolon insertion
            m_bPreceededByLineBreak = true;

            // Queue up the first token
            m_prevToken = Token.eof;
            Next();
        }
示例#4
0
 public CommandLine(Compiler c)
 {
     m_compiler = c;
     m_warnings = true;
 }
示例#5
0
 // Constructor
 public RenderContext(Compiler c, SymbolAllocator SymbolAllocator, SymbolAllocator MemberAllocator)
 {
     m_Compiler = c;
     m_SymbolAllocator = SymbolAllocator;
     m_MemberAllocator = MemberAllocator;
 }
示例#6
0
		// Constructor
		public SymbolScope(Compiler Compiler, ast.Node node, Accessibility defaultAccessibility)
		{
			m_Compiler = Compiler;
			Node = node;
			DefaultAccessibility = defaultAccessibility;
		}
示例#7
0
 // Constructor
 public SymbolScope(Compiler Compiler, ast.Node node, Accessibility defaultAccessibility)
 {
     m_Compiler = Compiler;
     Node = node;
     DefaultAccessibility = defaultAccessibility;
 }