mirror of
https://github.com/ParkerTenBroeck/coroutines.git
synced 2026-06-07 05:08:51 -04:00
merged
This commit is contained in:
parent
c3cb7cb884
commit
09f0ebbe53
3 changed files with 12 additions and 7 deletions
|
|
@ -1,8 +1,6 @@
|
||||||
import generator.Gen;
|
import generator.Gen;
|
||||||
|
|
||||||
public class Lexer {
|
public class Lexer {
|
||||||
|
|
||||||
|
|
||||||
public sealed interface Token{}
|
public sealed interface Token{}
|
||||||
public enum Punc implements Token {
|
public enum Punc implements Token {
|
||||||
LPar,
|
LPar,
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ public class Main implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
await();
|
// await();
|
||||||
// lexer();
|
lexer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void await(){
|
void await(){
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,17 @@ package generator.runtime;
|
||||||
import generator.Gen;
|
import generator.Gen;
|
||||||
|
|
||||||
import java.lang.classfile.*;
|
import java.lang.classfile.*;
|
||||||
|
import java.lang.classfile.attribute.StackMapFrameInfo;
|
||||||
|
import java.lang.classfile.instruction.*;
|
||||||
import java.lang.constant.ClassDesc;
|
import java.lang.constant.ClassDesc;
|
||||||
import java.lang.constant.ConstantDescs;
|
import java.lang.constant.ConstantDescs;
|
||||||
import java.lang.constant.MethodTypeDesc;
|
import java.lang.constant.MethodTypeDesc;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static java.lang.classfile.attribute.StackMapFrameInfo.SimpleVerificationTypeInfo.TOP;
|
||||||
|
|
||||||
public class GeneratorBuilder {
|
public class GeneratorBuilder {
|
||||||
public final static String PARAM_PREFIX = "param_";
|
public final static String PARAM_PREFIX = "param_";
|
||||||
|
|
@ -21,7 +28,7 @@ public class GeneratorBuilder {
|
||||||
public final static MethodTypeDesc MTD_Res = MethodTypeDesc.of(CD_Res);
|
public final static MethodTypeDesc MTD_Res = MethodTypeDesc.of(CD_Res);
|
||||||
public final static MethodTypeDesc MTD_Gen_Obj = MethodTypeDesc.of(CD_Gen, ConstantDescs.CD_Object);
|
public final static MethodTypeDesc MTD_Gen_Obj = MethodTypeDesc.of(CD_Gen, ConstantDescs.CD_Object);
|
||||||
public final static MethodTypeDesc MTD_Gen = MethodTypeDesc.of(CD_Gen);
|
public final static MethodTypeDesc MTD_Gen = MethodTypeDesc.of(CD_Gen);
|
||||||
public static MethodTypeDesc MTD_Obj = MethodTypeDesc.of(ConstantDescs.CD_Object);
|
public final static MethodTypeDesc MTD_Obj = MethodTypeDesc.of(ConstantDescs.CD_Object);
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
public final ClassDesc CD_this_gen;
|
public final ClassDesc CD_this_gen;
|
||||||
|
|
@ -58,7 +65,7 @@ public class GeneratorBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] buildGenerator(CodeModel com){
|
public byte[] buildGenerator(CodeModel com){
|
||||||
return ClassFile.of(ClassFile.StackMapsOption.STACK_MAPS_WHEN_REQUIRED, ClassFile.DebugElementsOption.PASS_DEBUG, ClassFile.LineNumbersOption.PASS_LINE_NUMBERS, ClassFile.AttributesProcessingOption.PASS_ALL_ATTRIBUTES).build(CD_this_gen, clb -> {
|
return ClassFile.of(ClassFile.StackMapsOption.STACK_MAPS_WHEN_REQUIRED).build(CD_this_gen, clb -> {
|
||||||
clb.withInterfaces(List.of(clb.constantPool().classEntry(CD_Gen)));
|
clb.withInterfaces(List.of(clb.constantPool().classEntry(CD_Gen)));
|
||||||
// parameter fields
|
// parameter fields
|
||||||
params(0, (param, _, type) -> {
|
params(0, (param, _, type) -> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue