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