ConceptPortal-public/rsconcept/frontend/src/features/rsform/models/rslang.ts

61 lines
986 B
TypeScript
Raw Normal View History

/**
* Module: Models for RSLanguage.
*/
2023-09-11 20:31:54 +03:00
2025-02-18 19:40:24 +03:00
import { TokenID } from '../backend/types';
/**
* Represents alias mapping.
*/
export type AliasMapping = Record<string, string>;
/**
* Represents AST node.
2023-12-28 14:04:44 +03:00
*/
2023-09-11 20:31:54 +03:00
export interface ISyntaxTreeNode {
2023-12-28 14:04:44 +03:00
uid: number;
parent: number;
typeID: TokenID;
start: number;
finish: number;
2023-09-11 20:31:54 +03:00
data: {
2023-12-28 14:04:44 +03:00
dataType: string;
value: unknown;
};
2023-09-11 20:31:54 +03:00
}
/**
* Represents Syntax tree for RSLang expression.
2023-12-28 14:04:44 +03:00
*/
export type SyntaxTree = ISyntaxTreeNode[];
2023-09-11 20:31:54 +03:00
/**
* Represents function argument definition.
2023-12-28 14:04:44 +03:00
*/
2023-11-06 02:20:16 +03:00
export interface IArgumentInfo {
2023-12-28 14:04:44 +03:00
alias: string;
typification: string;
2023-09-11 20:31:54 +03:00
}
2024-11-20 00:33:25 +03:00
/** Represents global identifier type info. */
export interface ITypeInfo {
alias: string;
result: string;
args: IArgumentInfo[];
}
/**
* Represents function argument value.
2023-12-28 14:04:44 +03:00
*/
export interface IArgumentValue extends IArgumentInfo {
2023-12-28 14:04:44 +03:00
value?: string;
2023-11-06 02:20:16 +03:00
}
2025-02-18 19:40:24 +03:00
/** Represents error class. */
2023-09-11 20:31:54 +03:00
export enum RSErrorClass {
LEXER,
PARSER,
SEMANTIC,
UNKNOWN
2023-12-28 14:04:44 +03:00
}