|
下表使用 <> (角括號) 註記使用者使用「合法值」欄顯示的值定義的可能語法。
|
建構受支援單位字串的語法
|
|
語法
|
合法值
|
<compound_unit>
|
• < known_compound_unit>
• <unknown_compound_unit>
• (<compound_unit>)
• <compound_unit><integer_power>
• <compound_unit><operation><compound_unit>
|
<integer_power>
|
• ** int
• ^ int
|
<real_power>
|
• ** real
^ real
|
<operation>
|
• *
• /
|
<pure_unit>
|
• 任何來自純單位表的符號
|
<base_unit>
|
• 任何來自基本單位表的符號
|
<unit_prefix>
|
• 任何來自單位前綴表的符號
|
<known_unit>
|
• <pure_unit>
• <unit_prefix> <pure_unit>
|
< known_compound_unit>
|
• <known _unit>
• (<known_compound_unit>)
• < known_compound_unit><integer_power>
• < known_compound_unit><operation><known_compound_unit>
|
<unknown_unit>
|
• 非 <known_unit> 的任何符號
|
<unknown_compound_unit>
|
• <unknown_unit>
• <known_compound_unit><real_power>
• <unknown_compound_unit><real_power>
|
<base_compound_unit>
|
• <base_unit>
• <base_unit><integer_power> (其中 base_unit 索引大於 0,integer_power 大於 0)
• <base_compound_unit><operation><base_unit> (其中 base_unit 索引大於 base_compound_unit 中的所有 base_unit 索引)
|
運算子
|
描述
|
優先順序
|
()
|
圓括號
|
1
|
**
|
次方
|
2
|
^
|
次方
|
2
|
*
|
乘
|
3
|
/
|
除
|
3
|
受支援單位字串範例
|
||
受支援單位字串:
|
範例:
|
定義
|
基本單位字串:
|
• kg*m/s**2
• cd/m**2
|
基底單位字串是所有的 <base_compound_unit> 字串。
所有基本單位字串皆為可轉換單位字串。
|
可轉換單位字串:
|
• kg*m/s**2
• A**2/kg/m**2*s**4
• 1/ um
• oz/s
• ( N*m )**-3
|
可轉換單位字串是所有的 <known_compound_unit> 字串。
|
不可轉換單位字串:
|
• foo
• foo**1.4
• W**0.5
|
不可轉換單位字串是所有的 <unknown_compound_unit> 字串。
可轉換單位字串和不可轉換單位字串沒有交集。
|