mirror of
				https://github.com/DanilaFe/abacus
				synced 2025-11-04 02:43:41 -08:00 
			
		
		
		
	Add comments to the two parsing interfaces.
This commit is contained in:
		
							parent
							
								
									65e8b7d15e
								
							
						
					
					
						commit
						dcbda5b255
					
				@ -4,7 +4,17 @@ import org.nwapw.abacus.tree.TreeNode;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * An itnerface that provides the ability to convert a list of tokens
 | 
				
			||||||
 | 
					 * into a parse tree.
 | 
				
			||||||
 | 
					 * @param <T> the type of tokens accepted by this parser.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public interface Parser<T> {
 | 
					public interface Parser<T> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Constructs a tree out of the given tokens.
 | 
				
			||||||
 | 
					     * @param tokens the tokens to construct a tree from.
 | 
				
			||||||
 | 
					     * @return the constructed tree, or null on error.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public TreeNode constructTree(List<T> tokens);
 | 
					    public TreeNode constructTree(List<T> tokens);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -2,8 +2,17 @@ package org.nwapw.abacus.parsing;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Interface that provides the ability to convert a string into a list of tokens.
 | 
				
			||||||
 | 
					 * @param <T> the type of the tokens produced.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public interface Tokenizer<T> {
 | 
					public interface Tokenizer<T> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Converts a string into tokens.
 | 
				
			||||||
 | 
					     * @param string the string to convert.
 | 
				
			||||||
 | 
					     * @return the list of tokens, or null on error.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public List<T> tokenizeString(String string);
 | 
					    public List<T> tokenizeString(String string);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user