- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSyntaxAnalyzer.java
More file actions
Latest commit
28 lines (22 loc) · 772 Bytes
/
Copy pathSyntaxAnalyzer.java
File metadata and controls
28 lines (22 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
packageLab3;
importjava.io.IOException;
importjava.nio.file.FileSystems;
importjava.nio.file.Files;
importjava.nio.file.Path;
publicclassSyntaxAnalyzer {
publicstaticvoidmain(String[] args) {
if(args.length > 0) {
Stringinput;
try {
Pathpath = FileSystems.getDefault().getPath(args[0]);
// Java 11+ convenience method
input = Files.readString(path);
Parserparser = newParser(input);
parser.start();
} catch (IOExceptione) {
System.out.println("FILE ERROR: File not found \"" + e.getMessage() + "\".");
}
} else
System.out.println("FILE ERROR: No filename provided.");
}
}