Table of Contents

Class OdfMathToken

Namespace
OdfKit.Formula
Assembly
OdfKit.dll

Represents a lightweight MathML token. 表示一個簡易 MathML token。

public sealed class OdfMathToken
Inheritance
OdfMathToken
Inherited Members

Properties

Attributes

Gets the common MathML attributes set on this token. 取得此 token 上設定的 MathML 通用屬性。

public IReadOnlyDictionary<string, string>? Attributes { get; }

Property Value

IReadOnlyDictionary<string, string>

Remarks

Examples include mathvariant, displaystyle, mathsize, mathcolor, mathbackground, stretchy, lspace, and rspace. 例如 mathvariantdisplaystylemathsizemathcolormathbackgroundstretchylspacerspace

Base

Gets the first child token for binary composite tokens. 取得二元複合 token 的第一個子 token。

public OdfMathToken? Base { get; }

Property Value

OdfMathToken

Remarks

This applies to superscript, subscript, fraction, radical, and upper/lower mark tokens. 這適用於上標、下標、分數、根號與上下方標記 token。

Children

Gets the child token list for multi-child composite tokens. 取得多元複合 token 的子 token 清單。

public IReadOnlyList<OdfMathToken>? Children { get; }

Property Value

IReadOnlyList<OdfMathToken>

Remarks

This applies to Row, Matrix, and UnderOver. 這適用於 RowMatrixUnderOver

Denominator

Gets the denominator of a Fraction token (the mfrac second child). 取得分數(Fraction,對應 mfrac)token 的分母。

public OdfMathToken Denominator { get; }

Property Value

OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Fraction. / 當此 token 不是分數時擲出。

Exponent

Gets the exponent of a Superscript token (the msup second child). 取得上標(Superscript,對應 msup)token 的指數。

public OdfMathToken Exponent { get; }

Property Value

OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Superscript. / 當此 token 不是上標時擲出。

Kind

Gets the token kind. 取得 token 類型。

public OdfMathTokenKind Kind { get; }

Property Value

OdfMathTokenKind

Numerator

Gets the numerator of a Fraction token (the mfrac first child). 取得分數(Fraction,對應 mfrac)token 的分子。

public OdfMathToken Numerator { get; }

Property Value

OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Fraction. / 當此 token 不是分數時擲出。

Radicand

Gets the radicand of a Radical token (the value under the root). 取得根號(Radical)token 的被開方數。

public OdfMathToken Radicand { get; }

Property Value

OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Radical. / 當此 token 不是根號時擲出。

RootIndex

Gets the root index of a Radical token; null for a plain square root. 取得根號(Radical)token 的根指數;平方根時為 null。

public OdfMathToken? RootIndex { get; }

Property Value

OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Radical. / 當此 token 不是根號時擲出。

RowCount

Gets the number of rows of a Matrix token (the mtable row count). 取得矩陣(Matrix,對應 mtable)token 的列數。

public int RowCount { get; }

Property Value

int

Exceptions

InvalidOperationException

When this token is not a Matrix. / 當此 token 不是矩陣時擲出。

Script

Gets the second child token for binary composite tokens. 取得二元複合 token 的第二個子 token。

public OdfMathToken? Script { get; }

Property Value

OdfMathToken

Remarks

This applies to superscript, subscript, fraction, radical, and upper/lower mark tokens. 這適用於上標、下標、分數、根號與上下方標記 token。

SubscriptIndex

Gets the subscript index of a Subscript token (the msub second child). 取得下標(Subscript,對應 msub)token 的下標索引。

public OdfMathToken SubscriptIndex { get; }

Property Value

OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Subscript. / 當此 token 不是下標時擲出。

Text

Gets leaf-token text, or auxiliary data for composite tokens. 取得葉節點 token 文字,或複合 token 的輔助資料。

public string Text { get; }

Property Value

string

Remarks

Composite tokens usually use an empty string, except for auxiliary data such as delimiters for Fenced or the displaystyle setting for Style. 複合 token 通常使用空字串,例外為 Fenced 的開閉括號或 Style 的 displaystyle 設定等輔助資料。

Methods

AddRow(OdfMathToken)

Returns a new Matrix token with the specified row appended at the end (the original token is not modified). 回傳在尾端新增一列後的新矩陣 token(原 token 不會被修改)。

public OdfMathToken AddRow(OdfMathToken row)

Parameters

row OdfMathToken

The row token to append, built with Row(params OdfMathToken[]). / 要新增的列 token,須以 Row(params OdfMathToken[]) 建立。

Returns

OdfMathToken

The new OdfMathToken with the appended row. / 新增列後的新 OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Matrix. / 當此 token 不是矩陣時擲出。

ArgumentNullException

When row is null. / 當 row 為 null 時擲出。

Apply(string, params OdfMathToken[])

Creates a basic Content MathML apply semantic token. 建立 Content MathML apply 語意標記 token(基礎支援)。

public static OdfMathToken Apply(string operatorName, params OdfMathToken[] operands)

Parameters

operatorName string

The operator name, such as plus, times, or eq; it is serialized as the corresponding empty element. / 運算子名稱,例如 plustimeseq;序列化為對應的空元素。

operands OdfMathToken[]

The operand token list. / 運算元 token 清單。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

Exceptions

ArgumentException

When operatorName is blank or operands is empty. / 當 operatorName 為空白,或 operands 為空時擲出。

Fenced(OdfMathToken)

Short overload of Fenced that accepts inner; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 inner;其餘可選參數使用預設值並轉呼叫最長 Fenced 多載。

public static OdfMathToken Fenced(OdfMathToken inner)

Parameters

inner OdfMathToken

Returns

OdfMathToken

Fenced(OdfMathToken, string)

Short overload of Fenced that accepts inner and open; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 inner 與 open;其餘可選參數使用預設值並轉呼叫最長 Fenced 多載。

public static OdfMathToken Fenced(OdfMathToken inner, string open)

Parameters

inner OdfMathToken
open string

Returns

OdfMathToken

Fenced(OdfMathToken, string, string)

Creates a fenced group token serialized as mrow with leading and trailing mo delimiters. 建立以括號包圍內容的群組 token(序列化為 mrow 搭配前後 mo 分隔符號)。

public static OdfMathToken Fenced(OdfMathToken inner, string open, string close)

Parameters

inner OdfMathToken

The token content inside the delimiters. / 括號內的內容 token。

open string

The opening delimiter text; defaults to (. / 開括號文字,預設為 (

close string

The closing delimiter text; defaults to ). / 閉括號文字,預設為 )

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

FindFirst(OdfMathTokenKind)

Recursively finds the first token matching the specified kind. 遞迴尋找第一個符合指定種類的 token。

public OdfMathToken? FindFirst(OdfMathTokenKind kind)

Parameters

kind OdfMathTokenKind

The target token kind. / 目標 token 種類。

Returns

OdfMathToken

The first matching token, or null when none exists. / 找到的第一個 token;若不存在則為 null

Fraction(OdfMathToken, OdfMathToken)

Creates a MathML mfrac fraction token. 建立 MathML mfrac 分數 token。

public static OdfMathToken Fraction(OdfMathToken numerator, OdfMathToken denominator)

Parameters

numerator OdfMathToken

The numerator token. / 分子 token。

denominator OdfMathToken

The denominator token. / 分母 token。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

GetAll(OdfMathTokenKind)

Recursively enumerates all tokens matching the specified kind. 遞迴列舉所有符合指定種類的 token。

public IEnumerable<OdfMathToken> GetAll(OdfMathTokenKind kind)

Parameters

kind OdfMathTokenKind

The target token kind. / 目標 token 種類。

Returns

IEnumerable<OdfMathToken>

The matching token sequence. / 符合條件的 token 序列。

GetCell(int, int)

Gets the cell at the specified row and column of a Matrix token. 取得矩陣 token 指定列、欄位置的儲存格 token。

public OdfMathToken GetCell(int rowIndex, int columnIndex)

Parameters

rowIndex int

The zero-based row index. / 以零起始的列索引。

columnIndex int

The zero-based column index. / 以零起始的欄索引。

Returns

OdfMathToken

The cell token at the specified position. / 指定位置的儲存格 token。

Exceptions

InvalidOperationException

When this token is not a Matrix. / 當此 token 不是矩陣時擲出。

ArgumentOutOfRangeException

When rowIndex or columnIndex is out of range. / 當 rowIndexcolumnIndex 超出範圍時擲出。

GetRow(int)

Gets the row at the specified index of a Matrix token (a Row token). 取得矩陣 token 指定索引的一列(一個 Row token)。

public OdfMathToken GetRow(int rowIndex)

Parameters

rowIndex int

The zero-based row index. / 以零起始的列索引。

Returns

OdfMathToken

The row token at the specified index. / 指定索引的列 token。

Exceptions

InvalidOperationException

When this token is not a Matrix. / 當此 token 不是矩陣時擲出。

ArgumentOutOfRangeException

When rowIndex is out of range. / 當 rowIndex 超出範圍時擲出。

Identifier(string)

Creates a MathML mi identifier token. 建立 MathML mi 識別名稱 token。

public static OdfMathToken Identifier(string text)

Parameters

text string

The identifier text. / 識別名稱文字。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

Matrix(params OdfMathToken[])

Creates a MathML mtable matrix token. 建立 MathML mtable 矩陣 token。

public static OdfMathToken Matrix(params OdfMathToken[] rows)

Parameters

rows OdfMathToken[]

The matrix rows, each created by Row(params OdfMathToken[]). / 矩陣的每一列,須為 Row(params OdfMathToken[]) 所建立的 token。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

Number(string)

Creates a MathML mn number token. 建立 MathML mn 數值 token。

public static OdfMathToken Number(string text)

Parameters

text string

The number text. / 數值文字。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

Operator(string)

Creates a MathML mo operator token. 建立 MathML mo 運算子 token。

public static OdfMathToken Operator(string text)

Parameters

text string

The operator text. / 運算子文字。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

Over(OdfMathToken, OdfMathToken)

Creates a MathML mover overscript token. 建立 MathML mover 上方標記 token。

public static OdfMathToken Over(OdfMathToken baseToken, OdfMathToken over)

Parameters

baseToken OdfMathToken

The base token. / 底數 token。

over OdfMathToken

The overscript token. / 上方標記 token。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

Radical(OdfMathToken)

Short overload of Radical that accepts radicand; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 radicand;其餘可選參數使用預設值並轉呼叫最長 Radical 多載。

public static OdfMathToken Radical(OdfMathToken radicand)

Parameters

radicand OdfMathToken

Returns

OdfMathToken

Radical(OdfMathToken, OdfMathToken?)

Creates a MathML msqrt or mroot radical token. 建立 MathML msqrt(無索引)或 mroot(具索引)根號 token。

public static OdfMathToken Radical(OdfMathToken radicand, OdfMathToken? index)

Parameters

radicand OdfMathToken

The radicand token. / 被開方數 token。

index OdfMathToken

The optional root index token; null means square root. / 選用的根指數 token;null 表示平方根。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

RemoveRow(int)

Returns a new Matrix token with the row at the specified index removed (the original token is not modified). 回傳移除指定列後的新矩陣 token(原 token 不會被修改)。

public OdfMathToken RemoveRow(int rowIndex)

Parameters

rowIndex int

The zero-based row index to remove. / 要移除的以零起始列索引。

Returns

OdfMathToken

The new OdfMathToken with the row removed. / 移除指定列後的新 OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Matrix, or when removing would leave the matrix without any row. / 當此 token 不是矩陣,或移除後矩陣將不剩任何列時擲出。

ArgumentOutOfRangeException

When rowIndex is out of range. / 當 rowIndex 超出範圍時擲出。

ReplaceFirst(OdfMathTokenKind, OdfMathToken)

Recursively finds the first token with the specified kind and replaces it with the specified token. 遞迴尋找第一個指定種類的 token,並以指定 token 取代。

public OdfMathToken ReplaceFirst(OdfMathTokenKind kind, OdfMathToken replacement)

Parameters

kind OdfMathTokenKind

The target token kind. / 目標 token 種類。

replacement OdfMathToken

The replacement token. / 替換後的新 token。

Returns

OdfMathToken

The new token after replacement, or the current token when no token is matched. / 替換後的新 token;若未命中任何 token,則回傳目前 token。

Exceptions

ArgumentNullException

When replacement is null. / 當 replacementnull 時擲出。

ReplaceFirst(Func<OdfMathToken, bool>, Func<OdfMathToken, OdfMathToken>)

Recursively finds the first token matching the predicate and replaces it with a token created by the specified factory. 遞迴尋找第一個符合條件的 token,並以指定 factory 建立的新 token 取代。

public OdfMathToken ReplaceFirst(Func<OdfMathToken, bool> predicate, Func<OdfMathToken, OdfMathToken> replacementFactory)

Parameters

predicate Func<OdfMathToken, bool>

The delegate that determines whether a token is the replacement target. / 判斷 token 是否為替換目標的委派。

replacementFactory Func<OdfMathToken, OdfMathToken>

The delegate that creates a replacement token from the matched token. / 根據命中的 token 建立替換 token 的委派。

Returns

OdfMathToken

The new token after replacement, or the current token when no token is matched. / 替換後的新 token;若未命中任何 token,則回傳目前 token。

Exceptions

ArgumentNullException

When predicate or replacementFactory is null. / 當 predicatereplacementFactorynull 時擲出。

Row(params OdfMathToken[])

Creates a MathML mrow row token. 建立 MathML mrow 群組列 token。

public static OdfMathToken Row(params OdfMathToken[] children)

Parameters

children OdfMathToken[]

The child token list in the row. / 群組中的子 token 清單。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

Style(OdfMathToken)

Short overload of Style that accepts inner; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 inner;其餘可選參數使用預設值並轉呼叫最長 Style 多載。

public static OdfMathToken Style(OdfMathToken inner)

Parameters

inner OdfMathToken

Returns

OdfMathToken

Style(OdfMathToken, bool?)

Creates a MathML mstyle style group token. 建立 MathML mstyle 樣式群組 token。

public static OdfMathToken Style(OdfMathToken inner, bool? displayStyle)

Parameters

inner OdfMathToken

The style group content token. / 樣式群組的內容 token。

displayStyle bool?

The optional displaystyle setting. / 選用的 displaystyle 設定。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

Subscript(OdfMathToken, OdfMathToken)

Creates a MathML msub subscript token. 建立 MathML msub 下標 token。

public static OdfMathToken Subscript(OdfMathToken baseToken, OdfMathToken scriptToken)

Parameters

baseToken OdfMathToken

The base token. / 底數 token。

scriptToken OdfMathToken

The subscript token. / 下標 token。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

Superscript(OdfMathToken, OdfMathToken)

Creates a MathML msup superscript token. 建立 MathML msup 上標 token。

public static OdfMathToken Superscript(OdfMathToken baseToken, OdfMathToken scriptToken)

Parameters

baseToken OdfMathToken

The base token. / 底數 token。

scriptToken OdfMathToken

The superscript token. / 上標 token。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

TextToken(string)

Creates a MathML mtext text token. 建立 MathML mtext 文字 token。

public static OdfMathToken TextToken(string text)

Parameters

text string

The text content. / 文字內容。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

Under(OdfMathToken, OdfMathToken)

Creates a MathML munder underscript token. 建立 MathML munder 下方標記 token。

public static OdfMathToken Under(OdfMathToken baseToken, OdfMathToken under)

Parameters

baseToken OdfMathToken

The base token. / 底數 token。

under OdfMathToken

The underscript token. / 下方標記 token。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

UnderOver(OdfMathToken, OdfMathToken, OdfMathToken)

Creates a MathML munderover under-over token. 建立 MathML munderover 上下方標記 token。

public static OdfMathToken UnderOver(OdfMathToken baseToken, OdfMathToken under, OdfMathToken over)

Parameters

baseToken OdfMathToken

The base token. / 底數 token。

under OdfMathToken

The underscript token. / 下方標記 token。

over OdfMathToken

The overscript token. / 上方標記 token。

Returns

OdfMathToken

A new OdfMathToken. / 新的 OdfMathToken

WithAttribute(string, string)

Creates a new token with the specified MathML attribute added, leaving the original token unchanged. 建立一個附加指定 MathML 屬性的新 token(原 token 不會被修改)。

public OdfMathToken WithAttribute(string name, string value)

Parameters

name string

The attribute name, such as mathvariant. / 屬性名稱,例如 mathvariant

value string

The attribute value. / 屬性值。

Returns

OdfMathToken

A new OdfMathToken with the added attribute. / 附加屬性後的新 OdfMathToken

Exceptions

ArgumentException

When name is blank. / 當 name 為空白時擲出。

ArgumentNullException

When value is null. / 當 valuenull 時擲出。

WithCell(int, int, OdfMathToken)

Returns a new Matrix token with the cell at the specified row and column replaced (the original token is not modified). 回傳替換指定列、欄儲存格後的新矩陣 token(原 token 不會被修改)。

public OdfMathToken WithCell(int rowIndex, int columnIndex, OdfMathToken cell)

Parameters

rowIndex int

The zero-based row index. / 以零起始的列索引。

columnIndex int

The zero-based column index. / 以零起始的欄索引。

cell OdfMathToken

The new cell token. / 新的儲存格 token。

Returns

OdfMathToken

The new OdfMathToken with the replaced cell. / 替換指定儲存格後的新 OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Matrix. / 當此 token 不是矩陣時擲出。

ArgumentNullException

When cell is null. / 當 cell 為 null 時擲出。

ArgumentOutOfRangeException

When rowIndex or columnIndex is out of range. / 當 rowIndexcolumnIndex 超出範圍時擲出。

WithChild(int, OdfMathToken)

Returns a new token with the specified child replaced, leaving the original token unchanged. 回傳替換指定子節點後的新 token(原 token 不會被修改)。

public OdfMathToken WithChild(int index, OdfMathToken replacement)

Parameters

index int

The child index to replace. / 要替換的子節點索引。

replacement OdfMathToken

The replacement child token. / 替換後的新子節點。

Returns

OdfMathToken

The new OdfMathToken with the replacement applied. / 替換完成的新 OdfMathToken

Exceptions

ArgumentNullException

When replacement is null. / 當 replacementnull 時擲出。

ArgumentOutOfRangeException

When index is outside the available child range. / 當 index 超出可用子節點範圍時擲出。

WithDenominator(OdfMathToken)

Returns a new Fraction token with the denominator replaced (the original token is not modified). 回傳替換分母後的新分數 token(原 token 不會被修改)。

public OdfMathToken WithDenominator(OdfMathToken denominator)

Parameters

denominator OdfMathToken

The new denominator token. / 新的分母 token。

Returns

OdfMathToken

The new OdfMathToken with the replaced denominator. / 替換分母後的新 OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Fraction. / 當此 token 不是分數時擲出。

ArgumentNullException

When denominator is null. / 當 denominator 為 null 時擲出。

WithExponent(OdfMathToken)

Returns a new Superscript token with the exponent replaced (the original token is not modified). 回傳替換指數後的新上標 token(原 token 不會被修改)。

public OdfMathToken WithExponent(OdfMathToken exponent)

Parameters

exponent OdfMathToken

The new exponent token. / 新的指數 token。

Returns

OdfMathToken

The new OdfMathToken with the replaced exponent. / 替換指數後的新 OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Superscript. / 當此 token 不是上標時擲出。

ArgumentNullException

When exponent is null. / 當 exponent 為 null 時擲出。

WithNumerator(OdfMathToken)

Returns a new Fraction token with the numerator replaced (the original token is not modified). 回傳替換分子後的新分數 token(原 token 不會被修改)。

public OdfMathToken WithNumerator(OdfMathToken numerator)

Parameters

numerator OdfMathToken

The new numerator token. / 新的分子 token。

Returns

OdfMathToken

The new OdfMathToken with the replaced numerator. / 替換分子後的新 OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Fraction. / 當此 token 不是分數時擲出。

ArgumentNullException

When numerator is null. / 當 numerator 為 null 時擲出。

WithRadicand(OdfMathToken)

Returns a new Radical token with the radicand replaced (the original token is not modified). 回傳替換被開方數後的新根號 token(原 token 不會被修改)。

public OdfMathToken WithRadicand(OdfMathToken radicand)

Parameters

radicand OdfMathToken

The new radicand token. / 新的被開方數 token。

Returns

OdfMathToken

The new OdfMathToken with the replaced radicand. / 替換被開方數後的新 OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Radical. / 當此 token 不是根號時擲出。

ArgumentNullException

When radicand is null. / 當 radicand 為 null 時擲出。

WithRootIndex(OdfMathToken?)

Returns a new Radical token with the root index replaced; pass null to turn it back into a plain square root. 回傳替換根指數後的新根號 token;傳入 null 可還原為平方根(原 token 不會被修改)。

public OdfMathToken WithRootIndex(OdfMathToken? rootIndex)

Parameters

rootIndex OdfMathToken

The new root index token, or null for a square root. / 新的根指數 token,或 null 表示平方根。

Returns

OdfMathToken

The new OdfMathToken with the replaced root index. / 替換根指數後的新 OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Radical. / 當此 token 不是根號時擲出。

WithRow(int, OdfMathToken)

Returns a new Matrix token with the row at the specified index replaced (the original token is not modified). 回傳替換指定列後的新矩陣 token(原 token 不會被修改)。

public OdfMathToken WithRow(int rowIndex, OdfMathToken row)

Parameters

rowIndex int

The zero-based row index to replace. / 要替換的以零起始列索引。

row OdfMathToken

The new row token. / 新的列 token。

Returns

OdfMathToken

The new OdfMathToken with the replaced row. / 替換指定列後的新 OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Matrix. / 當此 token 不是矩陣時擲出。

ArgumentNullException

When row is null. / 當 row 為 null 時擲出。

ArgumentOutOfRangeException

When rowIndex is out of range. / 當 rowIndex 超出範圍時擲出。

WithSubscriptIndex(OdfMathToken)

Returns a new Subscript token with the subscript index replaced (the original token is not modified). 回傳替換下標索引後的新下標 token(原 token 不會被修改)。

public OdfMathToken WithSubscriptIndex(OdfMathToken subscriptIndex)

Parameters

subscriptIndex OdfMathToken

The new subscript index token. / 新的下標索引 token。

Returns

OdfMathToken

The new OdfMathToken with the replaced subscript index. / 替換下標索引後的新 OdfMathToken

Exceptions

InvalidOperationException

When this token is not a Subscript. / 當此 token 不是下標時擲出。

ArgumentNullException

When subscriptIndex is null. / 當 subscriptIndex 為 null 時擲出。