Ejemplo n.º 1
0
Archivo: Test.cs Proyecto: 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));
        }
Ejemplo n.º 2
0
        // Constructor
        public SymbolAllocator(Compiler c)
        {
            m_Compiler = c;

            // Create the global scope
            m_ScopeStack.Add(new Scope());
            CurrentScope.NextSymbol = "a";
        }
Ejemplo n.º 3
0
        // 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();
        }
Ejemplo n.º 4
0
 public CommandLine(Compiler c)
 {
     m_compiler = c;
     m_warnings = true;
 }
Ejemplo n.º 5
0
 // Constructor
 public RenderContext(Compiler c, SymbolAllocator SymbolAllocator, SymbolAllocator MemberAllocator)
 {
     m_Compiler = c;
     m_SymbolAllocator = SymbolAllocator;
     m_MemberAllocator = MemberAllocator;
 }
Ejemplo n.º 6
0
		// Constructor
		public SymbolScope(Compiler Compiler, ast.Node node, Accessibility defaultAccessibility)
		{
			m_Compiler = Compiler;
			Node = node;
			DefaultAccessibility = defaultAccessibility;
		}
Ejemplo n.º 7
0
 // Constructor
 public SymbolScope(Compiler Compiler, ast.Node node, Accessibility defaultAccessibility)
 {
     m_Compiler = Compiler;
     Node = node;
     DefaultAccessibility = defaultAccessibility;
 }