-
Notifications
You must be signed in to change notification settings - Fork 0
/
HlslGrammar.java
59 lines (51 loc) · 1.28 KB
/
HlslGrammar.java
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.destranix.glslang;
public class HlslGrammar extends HlslTokenStream {
private final HlslScanContext scanner;
private final HlslParseContext parseContext;
private final int constructorIndex;
public HlslGrammar(HlslScanContext scanner, HlslParseContext parseContext) {
super(PoisonClass.singleton);
this.scanner = scanner;
this.parseContext = parseContext;
this.constructorIndex = 0;
load();
}
protected HlslGrammar(byte[] ptr) {
super(ptr);
this.scanner = null;
this.parseContext = null;
this.constructorIndex = -1;
}
@Override
protected void load_intern() {
if (ptr == null) {
switch (constructorIndex) {
case -1:
throw new IllegalStateException(EXCEPTION_MSG_NOT_LOADABLE);
case 0:
ptr = Main.HlslGrammar(scanner.getPtr(), parseContext.getPtr());
break;
default:
throw new AssertionError("Reached unreachable state!");
}
}
}
@Override
protected void free_intern() {
if (ptr != null) {
switch (constructorIndex) {
case -1:
throw new IllegalStateException(EXCEPTION_MSG_NOT_FREEABLE);
case 0:
Main.delete(ptr);
ptr = null;
break;
default:
throw new AssertionError("Reached unreachable state!");
}
}
}
public boolean parse() {
return Main.HlslGrammar_parse(ptr);
}
}