/// <summary> /// Parse Directory /// </summary> /// <returns>Parsed Directory</returns> public Directory ParseDirectory() { Directory directory = new Directory(); //Parse path elements while (TokenStream.HasNext()) { if(TokenStream.Peek(2).GetValue().ToString() == ".") { //End of directory, filename starts here break; } PathElement element = new PathElement(); NextToken("directory", "directory/filename.ext", TokenType.IDENTIFIER); element.SetPathElement(CurrentToken.GetValue().ToString()); directory.AddDirectoryElement(element); //Skip / or \ NextToken("/ or \\", "directory/FileName.ext", TokenType.SYMBOL); } return directory; }
/// <summary> /// Set name of file /// </summary> /// <param name="name">Name to set</param> public void SetName(PathElement name) { Name = name; }
/// <summary> /// Add directory element /// </summary> /// <param name="element">Pathelement to add</param> public void AddDirectoryElement(PathElement element) { DirectoryList.Add(element); }
public virtual void Visit(PathElement pathElement) { VisitSubNodes(pathElement); }