@vlocode/apex
Version:
Salesforce APEX Parser and Grammar
126 lines • 3.97 kB
TypeScript
import { Token } from "antlr4ng";
export type ApexAccessModifier = 'global' | 'public' | 'protected' | 'private';
export type ApexClassModifier = 'virtual' | 'abstract';
export type ApexSharingModifier = 'without' | 'with' | 'inherited';
export type ApexMethodModifier = 'static' | 'final' | 'webservice' | 'override' | 'testmethod';
export type ApexFieldModifier = 'transient' | 'final' | 'static';
export type ApexPropertyModifier = 'transient' | 'static';
export type ApexModifier = ApexAccessModifier | ApexClassModifier | ApexSharingModifier | ApexMethodModifier | ApexFieldModifier;
export interface ApexSourceLocation {
line: number;
column: number;
}
export interface ApexSourceRange {
start: ApexSourceLocation;
stop: ApexSourceLocation;
}
export interface SourceFragment {
sourceRange: ApexSourceRange;
}
export declare namespace ApexSourceRange {
const empty: {
start: {
line: number;
column: number;
};
stop: {
line: number;
column: number;
};
};
/**
* Get the Range of the tokens to which the specified context refers.
* @param context Context to get the range for
* @returns The range of the tokens to which the specified context refers
*/
function fromToken(context: {
start: Token | null;
stop: Token | null;
}): ApexSourceRange;
}
export interface ApexInterface extends SourceFragment {
name: string;
methods: ApexMethod[];
properties: ApexProperty[];
fields: ApexField[];
}
export interface ApexClass extends SourceFragment {
name: string;
isTest?: boolean;
isAbstract?: boolean;
isVirtual?: boolean;
methods: ApexMethod[];
properties: ApexProperty[];
fields: ApexField[];
implements: ApexTypeRef[];
access?: ApexAccessModifier;
type?: ApexClassModifier;
sharing?: ApexSharingModifier;
extends?: ApexTypeRef;
nested: ApexClass[];
refs: ApexTypeRef[];
}
export interface ApexMethod extends ApexBlock {
name: string;
isTest?: boolean;
isAbstract?: boolean;
isVirtual?: boolean;
returnType: ApexTypeRef;
parameters: ApexMethodParameter[];
access?: ApexAccessModifier;
modifiers: ApexMethodModifier[];
decorators: string[];
localVariables: ApexLocalVariable[];
refs: ApexTypeRef[];
}
export interface ApexLocalVariable extends SourceFragment {
name: string;
type: ApexTypeRef;
}
export interface ApexBlock extends SourceFragment {
localVariables?: ApexLocalVariable[];
refs?: ApexTypeRef[];
blocks?: ApexBlock[];
}
export interface ApexProperty extends SourceFragment {
name: string;
type: ApexTypeRef;
getter?: ApexBlock;
setter?: ApexBlock;
isStatic?: boolean;
isTransient?: boolean;
access?: ApexAccessModifier;
modifiers?: ApexFieldModifier[];
}
export interface ApexField extends SourceFragment {
name: string | string[];
type: ApexTypeRef;
isStatic?: boolean;
isFinal?: boolean;
isTransient?: boolean;
access?: ApexAccessModifier;
modifiers?: ApexFieldModifier[];
}
export type ApexTypeRefSource = 'new' | 'extends' | 'implements' | 'field' | 'parameter' | 'classVariable' | 'localVariable' | 'property' | 'identifier';
export interface ApexTypeRef {
namespace?: string;
name: string;
genericArguments?: ApexTypeRef[];
isSystemType: boolean;
source?: ApexTypeRefSource;
}
export declare namespace ApexTypeRef {
function fromString(name: string, source?: ApexTypeRefSource): ApexTypeRef;
function isPrimitiveType(typeName: string): boolean;
function isSystemType(typeName: string): boolean;
function isStandardNamespace(ns: string): boolean;
}
export interface ApexMethodParameter {
name: string;
type: ApexTypeRef;
}
export interface ApexCompilationUnit {
classes: ApexClass[];
interfaces: ApexInterface[];
}
//# sourceMappingURL=types.d.ts.map