Exemple #1
0
        /// <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;
        }
Exemple #2
0
 /// <summary>
 /// Set name of file
 /// </summary>
 /// <param name="name">Name to set</param>
 public void SetName(PathElement name)
 {
     Name = name;
 }
Exemple #3
0
 /// <summary>
 /// Add directory element
 /// </summary>
 /// <param name="element">Pathelement to add</param>
 public void AddDirectoryElement(PathElement element)
 {
     DirectoryList.Add(element);
 }
Exemple #4
0
 /// <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);
 }
Exemple #6
0
 /// <summary>
 /// Set name of file
 /// </summary>
 /// <param name="name">Name to set</param>
 public void SetName(PathElement name)
 {
     Name = name;
 }