Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. //Authors: Benjamin Prescott, Mark Mahan, Dillon Flohr
  2. //CSC 333 Assignment #2
  3.  
  4. // Fill in the enum with variants that represent the following
  5. // symbols: '+', '-', '*', '/', '(', ')', ';', ',', '='
  6.  
  7. #[derive(Debug)]
  8. enum Token {
  9.  
  10. }
  11.  
  12. // Add two fields to the following struct. One for holding
  13. // a vector of characters, and another that is an index (usize)
  14. // into the vector.
  15.  
  16. #[derive(Debug)]
  17. struct Scanner {
  18.  
  19. }
  20.  
  21. // Implement the following methods for the Scanner struct:
  22. // (1) A "new" method that creates a scanner from a String
  23. // (2) A "get_next_token" method that returns an Option<Token>
  24. // representing the next symbol in the vector (or None
  25. // when appropriate).
  26.  
  27. impl Scanner {
  28.  
  29. }
  30.  
  31. // The main function should do the following:
  32. // (1) Ask the user for an input file.
  33. // (2) Read the contents of a file into a String.
  34. // (3) Create a scanner object with the String.
  35. // (4) Use a "while let" loop to print all Tokens found in the
  36. // String.
  37.  
  38. fn main() {
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement