2.12 VFR Expression Statement Definition
The VFR expression is defined in C-style language.
The syntax of VFR expression is defined as a tree. The positions in the tree
are determined according to the priority of the operator (for example: + - *
/). At the root of it are the terms of OR
, followed by the terms of AND
,
because the priority of operator OR
is lower than the operator AND
(s). The
leaves of the tree are sub- expressions of built-in-functions, unary operators,
ternary operators, and constants.
2.12.1 OR
vfrStatementExpression ::=
andTerm ( "OR" andTerm )*
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_OR
op-codes.
2.12.2 AND
andTerm ::=
bitwiseorTerm ( "AND" bitwiseorTerm )*
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_AND
op-codes.
2.12.3 bitwiseor
bitwiseorTerm ::=
bitwiseandTerm ( "|" bitwiseandTerm )*
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_BITWISE_OR
op-codes.
2.12.4 bitwiseand
bitwiseandTerm ::=
equalTerm ( "&" equalTerm )*
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_BITWISE_AND
op-codes.
2.12.5 equal
equalTerm ::=
compareTerm
(
"==" compareTerm
| "!=" compareTerm
)*
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_EQUAL
or EFI_IFR_NOT_EQUAL
op-codes.
2.12.6 compare
compareTerm ::=
shiftTerm
(
"<" shiftTerm
| "<=" shiftTerm
| ">" shiftTerm
| ">=" shiftTerm
)*
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_LESS_THAN EFI_IFR_LESS_EQUAL, EFI_IFR_IFR_GREATER_EQUAL,
or
EFI_IFR_GREATER_THAN
op-codes.
2.12.7 shift
shiftTerm ::=
addMinusTerm
(
"<<" addMinusTerm
| ">>" addMinusTerm
)*
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_SHIFT_LEFT
or EFI_IFR_SHIFT_RIGHT
op-codes.
2.12.8 add/minus
addMinusTerm ::=
multdivmodTerm
(
"+" multdivmodTerm
| "-" multdivmodTerm
)*
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_ADD
or EFI_IFR_SUBTRACT
op-codes.
2.12.9 multiply/divide/modulo
multdivmodTerm ::=
castTerm
(
"*" castTerm
| "/" castTerm
| "%" castTerm
)*
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_MULTIPLY EFI_IFR_MODULO
or EFI_IFR_DIVIDE
op-codes.
2.12.10 cast terms
castTerm ::=
(
"("
(
"BOOLEAN"
| "UINT64"
| "UINT32"
| "UINT16"
| "UINT8"
)
")"
)*
atomTerm
BEHAVIORS AND RESTRICTIONS
The VFR supports the C-style type conversion. The values can be converted into
one of the following types: BOOLEAN
, UINT64
, UINT32
, UINT16
, UINT8
.
2.12.11 atom terms
atomTerm ::=
vfrExpressionCatenate
| vfrExpressionMatch
| vfrExpressionParen
| vfrExpressionBuildInFunction
| vfrExpressionConstant
| vfrExpressionUnaryOp
| vfrExpressionTernaryOp
| vfrExpressionMap
| ( "NOT" atomTerm )
| vfrExpressionMatch2
2.12.11.1 catenate
vfrExpressionCatenate ::=
"catenate"
"(" vfrStatementExpression "," vfrStatementExpression ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_CATENATE
op-codes.
Example
string varid = MyData.String,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minsize = 6,
maxsize = 40,
inconsistentif prompt = STRING_TOKEN(STR_CHECK),
pushthis != catenate(stringref(STRING_TOKEN(STR_STRING_RIGHT)),
stringref(STRING_TOKEN(STR_STRING_LEFT))),
endif
endstring;
2.12.11.2 match
vfrExpressionMatch ::=
"match"
"(" vfrStatementExpression "," vfrStatementExpression ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_MATCH
op-codes.
Example
grayoutif match(stringref(STRING_TOKEN(STR_PATTERN)),
stringref(STRING_TOKEN(STR_STRING)))
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 243,
endnumeric;
endif;
2.12.11.3 parenthesis
vfrExpressionParen ::=
"(" vfrStatementExpression ")"
BEHAVIORS AND RESTRICTIONS
Changes the order of the calculation.
2.12.11.4 build-in functions
vfrExpressionBuildInFunction ::=
dupExp
| ideqvalExp
| ideqidExp
| ideqvallistExp
| questionref1Exp
| rulerefExp
| stringref1Exp
| pushthisExp
| securityExp
| getExp
2.12.11.4.1 dup
dupExp ::=
"dup"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_DUP
op-codes.
Example
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 0xf0,
default value = 2 + dup,
endnumeric;
2.12.11.4.2 ideqval
ideqvalExp ::=
"ideqval"
vfrQuestionDataFieldName "==" Number
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_EQ_ID_VAL
op-codes.
Example
grayoutif ideqval MyData.Data1 == 99;
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 0xf0,
endnumeric;
endif;
2.12.11.4.3 ideqid
ideqidExp ::=
"ideqid"
vfrQuestionDataFieldName "==" vfrQuestionDataFieldName
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_EQ_ID_ID
op-codes.
Example
grayoutif ideqid MyData.Data2 == MyData.Data3;
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 0xf0,
endnumeric;
endif;
2.12.11.4.4 ideqvallist
ideqvallistExp ::=
"ideqvallist"
vfrQuestionDataFieldName "==" ( Number )+
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_EQ_ID_LIST
op-codes.
grayoutif ideqvallist MyData.Data1 == 1 3;
numeric name = MyNumeric,
varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 0xf0,
endnumeric;
endif;
2.12.11.4.5 questionref
questionref1Exp ::=
"questionref"
"(" StringIdentifier | Number ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_QUESTION_REF1
op-codes.
Example
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 0xf0,
default value = questionref(MyNumeric),
endnumeric;
2.12.11.4.6 ruleref
rulerefExp ::=
"ruleref" "(" StringIdentifier ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_RULE_REF
op-codes.
Example
grayoutif ruleref(MyRule) == 1;
string varid = MyData.String,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minsize = 6,
maxsize = 40,
endstring;
endif;
2.12.11.4.7 stringref
stringref1Exp ::=
"stringref" "(" getStringId ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_STRING_REF1
op-codes.
Example
grayoutif stringref(STRING_TOKEN(STR_STRING)) == 1;
string varid = MyData.String,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minsize = 6,
maxsize = 40,
endstring;
endif;
2.12.11.4.8 pushthis
pushthisExp ::=
"pushthis"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_THIS
op-codes.
Example
string varid = MyData.String,
prompt = STRING_TOKEN(STR_PROMPT), help = STRING_TOKEN(STR_HELP),
minsize = 6,
maxsize = 40,
inconsistentif prompt = STRING_TOKEN(STR_CHECK),
pushthis != stringref(STRING_TOKEN(STR_STRING))
endif
endstring;
2.12.11.4.9 security
securityExp ::=
"security" "(" guidDefinition ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_SECURITY
op-codes.
Example
grayoutif NOT security(EFI_GUID);
text
help = STRING_TOKEN(STR_HELP),
text = STRING_TOKEN(STR_TEXT);
endif;
2.12.11.4.10 get
getExp ::=
"get" "(" vfrStorageVarId { "|" "flags" "=" vfrNumericFlags } ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_GET
op-codes.
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 255,
read get(MyData.Data1);
endnumeric;
2.12.11.5 constant
vfrExpressionConstant ::=
"TRUE"
| "FALSE" | "ONE"
| "ONES"
| "ZERO"
| "UNDEFINED"
| "VERSION"
| Number
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_TRUE EFI_IFR_FALSE
, EFI_IFR_ONE EFI_IFR_ONES
,
EFI_IFR_ZERO
, EFI_IFR_UNDEFINED
, or EFI_IFR_VERSION
op-codes.
2.12.11.6 unary operators
vfrExpressionUnaryOp ::=
lengthExp
| bitwisenotExp
| question23refExp
| stringref2Exp
| toboolExp
| tostringExp
| unintExp
| toupperExp
| tolwerExp
| setExp
2.12.11.6.1 length
lengthExp ::=
"length" "(" vfrStatementExpression ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_LENGTH
op-codes.
Example
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 255,
default value = length(stringref(STRING_TOKEN(STR_STRING))),
endnumeric;
2.12.11.6.2 bitwisenot
bitwisenotExp ::=
"~" "(" vfrStatementExpression ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_BITWISENOT
op-codes.
Example
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 255,
default value = ~(length(stringref(STRING_TOKEN(STR_STRING)))),
endnumeric;
2.12.11.6.3 questionrefval
question23refExp ::=
"questionrefval"
"("
{
DevicePath "=" "STRING_TOKEN" "\(" S:Number "\)" ","
}
{
Uuid "=" guidDefinition[Guid] ","
}
vfrStatementExpression
")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_QUESTION_REF2
or EFI_IFR_QUESTION_REF3
op-codes.
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 255,
default value = questionrefval(QuestionID),
endnumeric;
2.12.11.6.4 stringrefval
stringref2Exp ::=
"stringrefval" "(" vfrStatementExpression ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_STRING_REF2
op-codes.
Example
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 255,
default value = length(stringrefval(STR_STRING)),
endnumeric;
2.12.11.6.5 boolval
toboolExp ::=
"boolval" "(" vfrStatementExpression ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_TO_BOOLEAN
op-codes.
Example
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 255, default value = boolval(12),
endnumeric;
2.12.11.6.6 stringval
tostringExp ::=
"stringval" { "format" "=" Number "," }
"(" vfrStatementExpression ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_TO_STRING
op-codes.
Example
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 255,
default value = length(stringval(format = 8, 12)),
endnumeric;
2.12.11.6.7 unintval
unintExp ::=
"unintval" "(" vfrStatementExpression ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_TO_UINT
op-codes.
Example
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 255,
default value = unintval(12 * 3),
endnumeric;
2.12.11.6.8 toupper
toupperExp ::=
"toupper" "(" vfrStatementExpression ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_TO_UPPER
op-codes.
Example
grayoutif length(toupper(stringref(STRING_TOKEN(STR_STRING))))==1;
string varid = MyData.String,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minsize = 6,
maxsize = 40,
endstring;
endif;
2.12.11.6.9 tolower
tolwerExp ::=
"tolower" "(" vfrStatementExpression ")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_TO_LOWER
op-codes.
grayoutif length(tolower(stringref(STRING_TOKEN(STR_STRING))))==2;
string varid = MyData.String,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minsize = 6,
maxsize = 40,
endstring;
endif;
2.12.11.6.10 set
setExp ::=
"set"
"("
vfrStorageVarId { "|" "flags" "=" vfrNumericFlags } ","
vfrStatementExpression
")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_SET
op-codes.
Example
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 255,
write set(MyData.Data1,10);
endnumeric;
2.12.11.7 ternary operators
vfrExpressionTernaryOp ::=
conditionalExp
| findExp
| midExp
| tokenExp
| spanExp
2.12.11.7.1 cond
conditionalExp ::=
"cond"
"("
vfrStatementExpression1
"?"
vfrStatementExpression2
":"
vfrStatementExpression3
")"
BEHAVIORS AND RESTRICTIONS
If (Expr1) then x = Expr3 else Expr2
Generates EFI_IFR_CONDITIONAL
op-codes.
Example
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 255,
default value = cond(2 == 1 ? 5 : 10),
endnumeric;
2.12.11.7.2 find
findExp ::=
"find"
"("
findFormat ( "|" findFormat )*
","
vfrStatementExpression
","
vfrStatementExpression
","
vfrStatementExpression
")"
findFormat ::=
"SENSITIVE"
| "INSENSITIVE"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_FIND
op-codes.
Example
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 255,
default value =
find(INSENSITIVE, (stringref(STRING_TOKEN(STR_STRING1))),
(stringref(STRING_TOKEN(STR_STRING2))), 1),
endnumeric;
2.12.11.7.3 mid
midExp ::=
"mid"
"("
vfrStatementExpression
","
vfrStatementExpression
","
vfrStatementExpression
")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_MID
op-codes.
Example
grayoutif length(mid(stringref(STRING_TOKEN(STR_STRING)),6,8))==1;
string varid = MyData.String,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minsize = 6,
maxsize = 40,
endstring;
endif;
2.12.11.7.4 tok
tokenExp ::=
"token"
"("
vfrStatementExpression
","
vfrStatementExpression
","
vfrStatementExpression
")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_TOKEN
op-codes.
Example
grayoutif length(token(stringref(STRING_TOKEN(STR_STRING1)),
stringref(STRING_TOKEN(STR_STRING2)), 0)) == 2;
string varid = MyData.String,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minsize = 6,
maxsize = 40,
endstring;
endif;
2.12.11.7.5 span
spanExp ::=
"span"
"("
"flags" "=" spanFlags ( "|" spanFlags )*
","
vfrStatementExpression
","
vfrStatementExpression
","
vfrStatementExpression
")"
spanFlags ::=
Number
| "LAST_NON_MATCH"
| "FIRST_NON_MATCH"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_SPAN
op-codes.
Example
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 255,
default value = span(flags = LAST_NON_MATCH,
stringref(STRING_TOKEN(STR_STRING1)),
stringref(STRING_TOKEN(STR_STRING2)),0),
endnumeric;
2.12.11.8 map
vfrExpressionMap ::=
"map"
"("
vfrStatementExpression
":"
(
vfrStatementExpression
","
vfrStatementExpression
";"
)*
")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_MAP
op-codes.
Example
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 255,
default value = map(pushthis:0,10;1,2;3,5;6,8;),
endnumeric;
2.12.11.9 match2
vfrExpressionMatch ::=
"match2"
"("
vfrStatementExpressionPattern
","
vfrStatementExpressionString
","
guidDefinition[Guid]
")"
BEHAVIORS AND RESTRICTIONS
Generates EFI_IFR_MATCH2
op-codes.
Example
grayoutif match2(stringref(STRING_TOKEN(STR_PATTERN)),
stringref(STRING_TOKEN(STR_STRING)),
PERL_GUID);
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 243,
endnumeric;
endif;