public Pascal_Scanner(BaseParser parser)
     : base(parser)
 {
     base.SingleCharacter = 'f';
     base.DoubleCharacter = 'r';
     base.DecimalCharacter = 'd';
     base.Upcase = true;
 }
Beispiel #2
0
 public BaseScanner(BaseParser parser)
 {
     this.token = new Token(this);
     this.history = new IntegerStack();
     this.def_stack = new IntegerStack();
     this.parser = parser;
     NumberFormatInfo currentInfo = NumberFormatInfo.CurrentInfo;
     this.DecimalSeparator = currentInfo.NumberDecimalSeparator;
 }
 public CSharp_Scanner(BaseParser parser)
     : base(parser)
 {
 }
Beispiel #4
0
 private void CompileModule( Module m, BaseParser p)
 {
     m.BeforeCompile();
     if (m.IsSourceCodeModule)
     {
         try
         {
             m.LoadFromStream();
             if (File.Exists(m.FileName))
             {
                 this.AddCodeFromFile(m.Name, m.FileName);
             }
         }
         catch (Exception exception)
         {
             this.CreateErrorObject(exception.Message);
             this.CreateErrorObjectEx("CSLite0003. Cannot load compiled module '{0}' from '{1}'", new object[] { m.Name, m.FileName });
         }
     }
     else if (p == null)
     {
         this.CreateErrorObjectEx("CSLite0002. Unknown language '{0}'.", new object[] { m.LanguageName });
     }
     else
     {
         try
         {
             p.Init(this, m);
             p.Gen(this.code.OP_BEGIN_MODULE, m.NameIndex, (int) m.Language, 0);
             p.Gen(this.code.OP_SEPARATOR, m.NameIndex, 0, 0);
             p.Gen(this.code.OP_BEGIN_USING, p.RootNamespaceId, 0, 0);
             p.Gen(this.code.OP_BEGIN_USING, p.SystemNamespaceId, 0, 0);
             p.Gen(this.code.OP_CHECKED, this.symbol_table.TRUE_id, 0, 0);
             if (m.Language == CSLite_Language.VB)
             {
                 p.Gen(this.code.OP_UPCASE_ON, 0, 0, 0);
             }
             else
             {
                 p.Gen(this.code.OP_UPCASE_OFF, 0, 0, 0);
             }
             p.Gen(this.code.OP_EXPLICIT_ON, 0, 0, 0);
             p.Call_SCANNER();
             p.Parse_Program();
             p.Gen(this.code.OP_RESTORE_CHECKED_STATE, 0, 0, 0);
             p.Gen(this.code.OP_END_USING, p.RootNamespaceId, 0, 0);
             p.Gen(this.code.OP_END_USING, p.SystemNamespaceId, 0, 0);
             p.Gen(this.code.OP_HALT, 0, 0, 0);
             p.Gen(this.code.OP_END_MODULE, m.NameIndex, 0, 0);
             if (!p.ConditionalDirectivesAreCompleted())
             {
                 p.RaiseError(true, "CS1027. #endif directive expected.");
             }
         }
         catch (Errors.CSLiteScriptException)
         {
         }
         catch (Exception exception2)
         {
             this.Error_List.Add(new ScriptError(this, exception2.Message));
             this.LastError.E = exception2;
         }
     }
     m.AfterCompile();
 }
Beispiel #5
0
 internal void RegisterParser(BaseParser p)
 {
     this.parser_list.Add(p);
 }