/// <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; }