44 lines
No EOL
1.1 KiB
TeX
44 lines
No EOL
1.1 KiB
TeX
\chapter{Generated code from Protocol buffers}
|
|
|
|
\begin{lstlisting}[language={JavaScript},caption={TypesScript types of Type Expression AST},label={ex:typeExpressionTypes}]
|
|
export interface Identifier extends WildcardNode {
|
|
nodeType: "Identifier";
|
|
name: string;
|
|
}
|
|
|
|
export interface Wildcard {
|
|
nodeType: "Wildcard";
|
|
identifier: Identifier;
|
|
expr: TypeExpr;
|
|
star: boolean;
|
|
}
|
|
|
|
export interface WildcardNode {
|
|
nodeType: "BinaryExpr" | "UnaryExpr" | "GroupExpr" | "Identifier";
|
|
}
|
|
|
|
export type TypeExpr = BinaryExpr | UnaryExpr | PrimitiveExpr;
|
|
|
|
export type BinaryOperator = "||" | "&&";
|
|
|
|
export type UnaryOperator = "!";
|
|
|
|
export interface BinaryExpr extends WildcardNode {
|
|
nodeType: "BinaryExpr";
|
|
left: UnaryExpr | BinaryExpr | PrimitiveExpr;
|
|
op: BinaryOperator;
|
|
right: UnaryExpr | BinaryExpr | PrimitiveExpr;
|
|
}
|
|
export interface UnaryExpr extends WildcardNode {
|
|
nodeType: "UnaryExpr";
|
|
op: UnaryOperator;
|
|
expr: PrimitiveExpr;
|
|
}
|
|
|
|
export type PrimitiveExpr = GroupExpr | Identifier;
|
|
|
|
export interface GroupExpr extends WildcardNode {
|
|
nodeType: "GroupExpr";
|
|
expr: TypeExpr;
|
|
}
|
|
\end{lstlisting} |