Example #1
0
 public sunNode Parse(sunScriptFile file)
 {
     mFile = file;
     using (var input = mFile.CreateReader()) {
         try {
             mParser = new __sunParser(input);
             var node = mParser.Parse();
             return(CreateAst(node));
         }
         catch (ParserLogException ex) {
             throw new sunParserException(file.Name, mFile.Id, ex[0]);
         }
     }
 }
Example #2
0
            public override sunImportResult Resolve(string name, out sunScriptFile file)
            {
                file = null;
                name = name.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
                var path = "";

                if (Path.IsPathRooted(name))
                {
                    path = name;
                    if (!File.Exists(path))
                    {
                        return(sunImportResult.Missing);
                    }
                }
                else
                {
                    path = Path.Combine(CurrentDirectory, name);
                    if (!File.Exists(path))
                    {
                        path = Path.Combine(mRootDirectory, name);
                        if (!File.Exists(path))
                        {
                            return(sunImportResult.Missing);
                        }
                    }
                }
                if (mImports.Any(i => i.Name == path))
                {
                    return(sunImportResult.Skipped);
                }
                try {
                    file = new sunScriptFile(path, File.OpenRead(path), mFileId++);
                }
                catch {
                    return(sunImportResult.FailedToLoad);
                }
                mImports.Add(file);
                return(sunImportResult.Loaded);
            }
Example #3
0
 public override void Exit(sunScriptFile file)
 {
     mFiles.Pop();
 }
Example #4
0
 public override void Enter(sunScriptFile file)
 {
     mFiles.Push(file);
 }
Example #5
0
 public abstract sunImportResult Resolve(string name, out sunScriptFile file);
Example #6
0
 public abstract void Exit(sunScriptFile file);
Example #7
0
 public abstract void Enter(sunScriptFile file);