/** * A library for compiling and running TI-Basic. * * @packageDocumentation */ /** * @alpha */ declare const ANS = "ANS"; /** * @alpha */ declare interface Ans { type: typeof ANS; } /** * @alpha */ declare type Assignable = Variable | ListIndex; /** * @alpha */ declare const AssignmentStatement = "AssignmentStatement"; /** * @alpha */ declare interface AssignmentStatement { type: typeof AssignmentStatement; value: ValueExpression; assignable: Assignable; } /** * @alpha */ declare const BinaryExpression = "BinaryExpression"; /** * @alpha */ declare interface BinaryExpression { type: typeof BinaryExpression; operator: string; left: ValueExpression; right: ValueExpression; } /** * @alpha */ export declare interface CanvasLike { width: number; height: number; style?: { border?: string; backgroundColor?: string; imageRendering?: string; }; getContext(contextId: string, options?: { willReadFrequently?: boolean; }): CanvasRenderingContext2DLike | null; } /** * @alpha */ export declare interface CanvasRenderingContext2DLike { fillStyle: string; fillRect(x: number, y: number, width: number, height: number): void; getImageData(x: number, y: number, width: number, height: number): ImageData; putImageData(imageData: ImageData, x: number, y: number): void; } /** * @alpha */ declare const ClrHome = "ClrHome"; /** * @alpha */ declare interface ClrHome { type: typeof ClrHome; } /** * @alpha */ declare const ClrTable = "ClrTable"; /** * @alpha */ declare interface ClrTable { type: typeof ClrTable; } /** * @alpha */ declare type CtlStatement = IfStatement | ThenStatement | ElseStatement | ForLoop | WhileLoop | RepeatLoop | EndStatement | PauseStatement | LabelStatement | GotoStatement | IncrementSkip | DecrementSkip | MenuStatement | ProgramStatement | ReturnStatement | StopStatement | DelVarStatement | GraphStyleStatement | OpenLibStatement | ExecLibStatement; /** * @alpha */ declare const DecrementSkip = "DecrementSkip"; /** * @alpha */ declare interface DecrementSkip { type: typeof DecrementSkip; variable: Variable | null; end: ValueExpression | null; } /** * @alpha */ declare const DelVarStatement = "DelVarStatement"; /** * @alpha */ declare interface DelVarStatement { type: typeof DelVarStatement; variable: Variable | null; } /** * @alpha */ declare const DispGraph = "DispGraph"; /** * @alpha */ declare interface DispGraph { type: typeof DispGraph; } /** * @alpha */ declare const Display = "Display"; /** * @alpha */ declare interface Display { type: typeof Display; value: ValueExpression | null; } /** * @alpha */ declare const DispTable = "DispTable"; /** * @alpha */ declare interface DispTable { type: typeof DispTable; } /** * @alpha */ declare const ElseStatement = "ElseStatement"; /** * @alpha */ declare interface ElseStatement { type: typeof ElseStatement; extra: boolean | null; } /** * @alpha */ declare const EmptyStatement = "EmptyStatement"; /** * @alpha */ declare interface EmptyStatement { type: typeof EmptyStatement; } /** * @alpha */ declare const EndStatement = "EndStatement"; /** * @alpha */ declare interface EndStatement { type: typeof EndStatement; extra: boolean | null; } /** * @alpha */ export declare function exec(source: string, callback: (output: string) => void): void; /** * @alpha */ declare const ExecLibStatement = "ExecLibStatement"; /** * @alpha */ declare interface ExecLibStatement { type: typeof ExecLibStatement; name: string; } /** * @alpha */ declare const ForLoop = "ForLoop"; /** * @alpha */ declare interface ForLoop { type: typeof ForLoop; variable: Variable | null; start: ValueExpression | null; end: ValueExpression | null; step: ValueExpression | null; args: boolean; extra: boolean | null; } /** * @alpha */ declare const Get = "Get"; /** * @alpha */ declare interface Get { type: typeof Get; variable: Variable | null; } /** * @alpha */ export declare function getBuildTime(): string; /** * @alpha */ declare const GetCalc = "GetCalc"; /** * @alpha */ declare interface GetCalc { type: typeof GetCalc; variable: Variable | null; portflag: ValueExpression | null; } /** * @alpha */ declare const GetKey = "GetKey"; /** * @alpha */ declare interface GetKey { type: typeof GetKey; } /** * @alpha */ export declare function getVersion(): string; /** * @alpha */ declare const GotoStatement = "GotoStatement"; /** * @alpha */ declare interface GotoStatement { type: typeof GotoStatement; location: string; } /** * @alpha */ declare const GraphStyleStatement = "GraphStyleStatement"; /** * @alpha */ declare interface GraphStyleStatement { type: typeof GraphStyleStatement; equation: ValueExpression | null; style: ValueExpression | null; } /** * @alpha */ declare const IfStatement = "IfStatement"; /** * @alpha */ declare interface IfStatement { type: typeof IfStatement; value: ValueExpression | null; extra: boolean | null; } /** * @alpha */ declare const IncrementSkip = "IncrementSkip"; /** * @alpha */ declare interface IncrementSkip { type: typeof IncrementSkip; variable: Variable | null; end: ValueExpression | null; } /** * @alpha */ declare const Input = "Input"; /** * @alpha */ declare interface Input { type: typeof Input; text: ValueExpression | null; variable: Variable | null; } /** * @alpha */ declare type IoStatement = Input | Prompt | Display | DispGraph | DispTable | Output | ClrHome | ClrTable | GetCalc | Get | Send; /** * @alpha */ declare const LabelStatement = "LabelStatement"; /** * @alpha */ declare interface LabelStatement { type: typeof LabelStatement; location: string; } /** * @alpha */ declare interface Line { statement: Statement; source: string | undefined; } /** * @alpha */ declare const ListIndex = "ListIndex"; /** * @alpha */ declare interface ListIndex { type: typeof ListIndex; list: ListVariable; index: ValueExpression; } /** * @alpha */ declare interface ListLiteral { type: typeof TiList; resolved: false; elements: ValueExpression[]; } /** * @alpha */ declare interface ListResolved { type: typeof TiList; resolved: true; elements: NumberResolved[]; } /** * @alpha */ declare const ListVariable = "ListVariable"; /** * @alpha */ declare interface ListVariable { type: typeof ListVariable; name: string; custom: boolean; } /** * @alpha */ declare const ListVariablePrefix = "List"; /** * @alpha */ declare interface MenuChoice { option: TiString; location: string; } /** * @alpha */ declare const MenuStatement = "MenuStatement"; /** * @alpha */ declare interface MenuStatement { type: typeof MenuStatement; title: ValueExpression | null; choices: MenuChoice[]; } /** * @alpha */ declare interface NumberLiteral { type: typeof TiNumber; resolved: false; integer?: number; fraction?: number | null; exponent?: number | null; } /** * @alpha */ declare interface NumberResolved { type: typeof TiNumber; resolved: true; float: number; } /** * @alpha */ declare const NumberVariable = "NumberVariable"; /** * @alpha */ declare interface NumberVariable { type: typeof NumberVariable; name: string; } /** * @alpha */ export declare function on(type: string, listener: () => void): void; /** * @alpha */ declare const OpenLibStatement = "OpenLibStatement"; /** * @alpha */ declare interface OpenLibStatement { type: typeof OpenLibStatement; name: string; } /** * @alpha */ declare const Output = "Output"; /** * @alpha */ declare interface Output { type: typeof Output; row: ValueExpression | null; column: ValueExpression | null; value: ValueExpression | null; } /** * @alpha */ export declare function parse(source: string, options?: ParseOptions): types.Line[]; /** * @alpha */ export declare interface ParseOptions { sourceMap?: string; } /** * @alpha */ declare const PauseStatement = "PauseStatement"; /** * @alpha */ declare interface PauseStatement { type: typeof PauseStatement; } /** * @alpha */ export declare interface ProgramHandle { getStatus(): string; isActive(): boolean; stop(): void; } /** * @alpha */ declare const ProgramStatement = "ProgramStatement"; /** * @alpha */ declare interface ProgramStatement { type: typeof ProgramStatement; name: string; } /** * @alpha */ declare const Prompt = "Prompt"; /** * @alpha */ declare interface Prompt { type: typeof Prompt; variable: Variable | null; } /** * @alpha */ declare const RepeatLoop = "RepeatLoop"; /** * @alpha */ declare interface RepeatLoop { type: typeof RepeatLoop; value: ValueExpression | null; extra: boolean | null; } /** * @alpha */ declare const ReturnStatement = "ReturnStatement"; /** * @alpha */ declare interface ReturnStatement { type: typeof ReturnStatement; } /** * @alpha */ export declare function run(lines: types.Line[], options?: RunOptions): ProgramHandle; /** * @alpha */ export declare interface RunOptions { source?: string | string[]; frequencyMs?: number; outputCallback?: (value: string, newline: boolean) => void; elem?: JQuery; screenElem?: JQuery; screenCanvas?: CanvasLike; debug?: boolean; callback?: (status: string) => void; input?: JQuery; stdin?: string; includeErrors?: boolean; includeLibErrors?: boolean; includeLineNumbers?: boolean; includeSource?: boolean; } /** * @alpha */ declare const Send = "Send"; /** * @alpha */ declare interface Send { type: typeof Send; variable: Variable | null; } /** * @alpha */ declare type Statement = EmptyStatement | TiSyntaxError | AssignmentStatement | CtlStatement | IoStatement | ValueStatement; /** * @alpha */ declare const StopStatement = "StopStatement"; /** * @alpha */ declare interface StopStatement { type: typeof StopStatement; } /** * @alpha */ declare const StringVariable = "StringVariable"; /** * @alpha */ declare interface StringVariable { type: typeof StringVariable; name: string; } /** * @alpha */ declare const ThenStatement = "ThenStatement"; /** * @alpha */ declare interface ThenStatement { type: typeof ThenStatement; extra: boolean | null; } /** * @alpha */ declare const TiList = "TiList"; /** * @alpha */ declare type TiList = ListLiteral | ListResolved; /** * @alpha */ declare const TiNumber = "TiNumber"; /** * @alpha */ declare type TiNumber = NumberLiteral | NumberResolved; /** * @alpha */ declare const TiString = "TiString"; /** * @alpha */ declare interface TiString { type: typeof TiString; chars: string; } /** * @alpha */ declare const TiSyntaxError = "TiSyntaxError"; /** * @alpha */ declare interface TiSyntaxError { type: typeof TiSyntaxError; } declare namespace types { export { TiSyntaxError, TiNumber, NumberLiteral, NumberResolved, TiString, ListVariablePrefix, TiList, ListLiteral, ListResolved, ValueResolved, ANS, Ans, GetKey, NumberVariable, StringVariable, ListVariable, ListIndex, Variable, Assignable, BinaryExpression, UnaryExpression, ValueExpression, EmptyStatement, ValueStatement, AssignmentStatement, IfStatement, ThenStatement, ElseStatement, ForLoop, WhileLoop, RepeatLoop, EndStatement, PauseStatement, LabelStatement, GotoStatement, IncrementSkip, DecrementSkip, MenuChoice, MenuStatement, ProgramStatement, ReturnStatement, StopStatement, DelVarStatement, GraphStyleStatement, OpenLibStatement, ExecLibStatement, CtlStatement, Input, Prompt, Display, DispGraph, DispTable, Output, ClrHome, ClrTable, GetCalc, Get, Send, IoStatement, Statement, Line } } export { types } /** * @alpha */ declare const UnaryExpression = "UnaryExpression"; /** * @alpha */ declare interface UnaryExpression { type: typeof UnaryExpression; operator: string; argument: ValueExpression; } /** * @alpha */ declare type ValueExpression = TiNumber | TiString | TiList | Assignable | BinaryExpression | UnaryExpression | TiSyntaxError | Ans | GetKey; /** * @alpha */ declare type ValueResolved = NumberResolved | TiString | ListResolved; /** * @alpha */ declare const ValueStatement = "ValueStatement"; /** * @alpha */ declare interface ValueStatement { type: typeof ValueStatement; value: ValueExpression; } /** * @alpha */ declare type Variable = NumberVariable | StringVariable | ListVariable; /** * @alpha */ declare const WhileLoop = "WhileLoop"; /** * @alpha */ declare interface WhileLoop { type: typeof WhileLoop; value: ValueExpression | null; extra: boolean | null; } export { }