1 package acl2s.lib.parse.no_obj;
2
3 import acl2s.lib.parse.IParseContext;
4 import acl2s.lib.parse.ParseException;
5 import acl2s.lib.parse.Parser;
6
7 public class Str extends Atom {
8 public final String value;
9
10 public Str(String s) { this.value = s; }
11
12 String computeString(IParseContext pc) {
13 StringBuilder b = new StringBuilder();
14 b.append('"');
15 for (int i = 0; i < value.length(); i++) {
16 char c = value.charAt(i);
17 if (c == '\"' || c == '\\') {
18 b.append('\\');
19 }
20 b.append(c);
21 }
22 b.append('"');
23 return b.toString();
24 }
25
26 public static void parse(Parser p) throws ParseException {
|
At conditional (1): (acl2s.lib.parse.Parser.pop(...) != 34): Taking false branch.
|
27 if (p.pop() != '"') {
28 throw new ParseException("String must begin with \".");
29 }
30 char c;
31 for (;;) {
32 c = p.pop();
|
At conditional (2): (c == 65535): Taking false branch.
|
|
At conditional (5): (c == 65535): Taking false branch.
|
|
At conditional (8): (c == 65535): Taking false branch.
|
33 if (c == Parser.EOF) throw new ParseException("EOF before closing \".");
|
At conditional (3): (c == 34): Taking false branch.
|
|
At conditional (6): (c == 34): Taking false branch.
|
|
At conditional (9): (c == 34): Taking true branch.
|
34 if (c == '"') break;
|
At conditional (4): (c == 92): Taking false branch.
|
|
At conditional (7): (c == 92): Taking true branch.
|
35 if (c == '\\') {
|
Event check_return: |
The return value of "acl2s.lib.parse.Parser.pop()" should be checked. [checked 33 out of 39 times] |
| Also see events: |
[example][example][example][example][example] |
36 c = p.pop();
37 }
38 }
39 return;
40 }
41 }