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]); } } }
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); }
public override void Exit(sunScriptFile file) { mFiles.Pop(); }
public override void Enter(sunScriptFile file) { mFiles.Push(file); }
public abstract sunImportResult Resolve(string name, out sunScriptFile file);
public abstract void Exit(sunScriptFile file);
public abstract void Enter(sunScriptFile file);