@imc-trading/svlangserver
Version:
A language server for systemverilog
97 lines (96 loc) • 3.3 kB
TypeScript
import { TextDocument } from "vscode-languageserver/node";
import { GrammarToken } from './grammar_engine';
import { SystemVerilogSymbol, SystemVerilogSymbolJSON } from "./svsymbol";
declare enum MacroAction {
Add = 0,
Del = 1,
DelAll = 2
}
export declare class PostToken {
text: string;
index: number;
endIndex: number;
}
export declare type TokenOrderEntry = {
file: string;
tokenNum: number;
};
declare type TokenOrderEntryJSON = [string, number];
export declare type MacroInfo = {
args: Map<string, number>;
default: GrammarToken[][];
definition: GrammarToken[];
symbol: SystemVerilogSymbol;
file: string;
};
declare type MacroInfoJSON = [[string, number][], GrammarToken[][], GrammarToken[], SystemVerilogSymbolJSON, string];
declare type MacroChange = {
action: MacroAction;
macroName: string;
macroInfo: MacroInfo;
};
declare type MacroChangeJSON = [MacroAction, string, MacroInfoJSON];
export declare type MacroChangeOrderEntry = {
file: string;
index: number;
};
declare type MacroChangeOrderEntryJSON = [string, number];
export declare type PreprocIncInfo = {
symbols: SystemVerilogSymbol[];
postTokens: PostToken[];
tokenOrder: TokenOrderEntry[];
macroChanges: MacroChange[];
macroChangeOrder: MacroChangeOrderEntry[];
includes: Set<string>;
};
export declare type PreprocIncInfoJSON = [SystemVerilogSymbolJSON[], PostToken[], TokenOrderEntryJSON[], MacroChangeJSON[], MacroChangeOrderEntryJSON[], string[]];
export declare type PreprocInfo = {
symbols: SystemVerilogSymbol[];
postTokens: PostToken[];
tokenOrder: TokenOrderEntry[];
includes: Set<string>;
};
export declare type PreprocCacheEntry = {
file: string;
info: PreprocIncInfo;
doc: TextDocument;
};
export declare class SystemVerilogPreprocessor {
private _document;
private _filePath;
private _fileList;
private _includeFilePaths;
private _preprocCache;
private _preprocIncInfo;
private _macroInfo;
private _tokenManager;
private _getElem;
private _printDebugInfo;
private _pushEmptyPostToken;
private _processMacroArgDefault;
private _processMacroArgs;
private _processDefine;
private _processNoArgDirectives;
private _processSingleArgDirectives;
private _processTimescaleDirective;
private _processPragmaDirective;
private _processLineDirective;
private _processBeginKeywordsDirective;
private _skipConditionalBlock;
private _processConditionalDirectives;
private _getAllMacroChanges;
private _applyMacroChanges;
private _processIncludeDirective;
private _replaceSpecialMacros;
private _expandMacroCall;
private _processMacroCall;
static tokenize(preText: string): GrammarToken[];
private _parseInc;
private _getAllPostTokens;
parse(document: TextDocument, includeFilePaths: string[], preprocCache: Map<string, PreprocCacheEntry>, macroInfo: Map<string, MacroInfo>, text?: string): PreprocInfo;
private static macroInfoToJSON;
private static macroInfoFromJSON;
static preprocIncInfoToJSON(preprocIncInfo: PreprocIncInfo): PreprocIncInfoJSON;
static preprocIncInfoFromJSON(fileUri: string, preprocIncInfoJSON: PreprocIncInfoJSON): PreprocIncInfo;
}
export {};