public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] Expression spec: update format to support flexible Pcd format
@ 2018-01-31 22:58 Yonghong Zhu
  0 siblings, 0 replies; only message in thread
From: Yonghong Zhu @ 2018-01-31 22:58 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao, Michael Kinney, Kevin W Shaw

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Kevin W Shaw <kevin.w.shaw@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 2_expression_overview.md | 13 +++++++------
 3_expression_format.md   | 30 +++++++++++++++++++++++-------
 2 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/2_expression_overview.md b/2_expression_overview.md
index 34ceb97..2f3dffa 100644
--- a/2_expression_overview.md
+++ b/2_expression_overview.md
@@ -63,26 +63,27 @@ directives section do not apply.
 5. Between the previous and next sequence, an object shall have its stored
    value modified at most once by the evaluation of an expression.
 
 6. Some operators (the unary operator, ~, and the binary operators, `<<, >>`,
    &, | and ^ collectively described as bitwise operators) are required to have
-   operands that are integer (base10) or hexadecimal (base16) types.
+   operands that can be translated  to integer (base10) or hexadecimal (base16)
+   types.
 
-7. The unary arithmetic operators, +, - and ~ must have an operand that is an
-   integer (base10) or hexadecimal (base16) type, while the scalar unary
-   operators, ! and NOT, must have operands that are of type scalar.
+7. The unary arithmetic operators, +, - and ~ must have an operand that can be
+   translated to an integer (base10) or hexadecimal (base16) type, while the
+   scalar unary operators, ! and NOT, must have operands that are of type scalar.
 
 8. The Boolean values, False, FALSE and false have a numerical value of zero.
    The Boolean values, True, TRUE and true have a numerical value of one.
 
 9. Tools may be required to translate the expression sequence into an
    expression format that is comprehended by the tool's native language. For
    example, a tool written in Python may require changing the exact syntax of
    an expression to a syntax that can be processed by Python's eval() function.
 
-10. Multiplicative and additive operators require both operands to be
-    arithmetic in type.
+10. Multiplicative and additive operators require both operands that can be
+    translated to arithmetic in type.
 
 11. Relational and equality operators require both operands to be of the same
     type. Relational comparison on string literals and byte arrays must be
     performed comparing the byte values, left to right. The first pair of bytes
     (or a single extra byte) that is not equal will determine the result of the
diff --git a/3_expression_format.md b/3_expression_format.md
index 50b94c4..8a5c873 100644
--- a/3_expression_format.md
+++ b/3_expression_format.md
@@ -74,11 +74,11 @@ GRACEFULLY._
 
 #### Prototype
 
 ```c
 <PrimaryExpression>     ::= {<Identifier>} {<Constant>} {<StringLiteral>} {<Function>}
-                            {"(" <Expression> ")"} {<Expression>}
+                            {"(" <Expression> ")"} {<Expression>} {<UintMac>}
 <Identifier>            ::= {<CName>} {<MACROVAL>}
 <MACROVAL>              ::= "$(" <MACRO> ")"
 <MACRO>                 ::= (A-Z) [(A-Z0-9_)]*
 <Function>              ::= <CName> "(" <Argument> [<CSP> <Argument>]* ")"
 <Argument>              ::= <PrimaryExpression>
@@ -92,11 +92,13 @@ GRACEFULLY._
 <Base10>                ::= {(0-9)} {(1-9) [(0-9)]*}
 <HexNumber>             ::= <Base16>
 <Base16>                ::= <HexPrefix> [<HexDigit>]+
 <HexDigit>              ::= (a-fA-F0-9)
 <HexPrefix>             ::= {"0x"} {"0X"}
-<GuidValue>             ::= {<RformatGuid>} {<CformatGuid>}
+<GuidValue>             ::= "GUID(" <GuidVal> ")"
+<GuidVal>               ::= {<DblQuote> <RegistryFormatGUID> <DblQuote>}
+                            {<CformatGuid>} {<CName>}
 Rhex2                   ::= [<HexDigit>] <HexDigit>
 Rhex4                   ::= [<HexDigit>] [<HexDigit>] Rhex2
 Rhex8                   ::= [<HexDigit>] [<HexDigit>] [<HexDigit>] [<HexDigit>] Rhex4
 <RformatGuid>           ::= Rghex8 "-" Rghex4 "-" Rghex4 "-" Rghex4 "-" Rghex12
 Rghex2                  ::= <HexDigit> <HexDigit>
@@ -111,19 +113,33 @@ Rghex12                 ::= <HexDigit> <HexDigit> <HexDigit> <HexDigit> Rghex8
 <CformatGuid>           ::= "{" [<TSP>]* <Hex32> <CSP> <Hex16> <CSP> <Part2>
 <Part2>                 ::= <Hex16> <CSP> "{" [<TSP>]* <Byte> <CSP> <Part3>
 <Part3>                 ::= <Byte> <CSP> <Byte> <CSP> <Byte> <CSP> <Part4>
 <Part4>                 ::= <Byte> <CSP> <Byte> <CSP> <Byte> <CSP> <Part5>
 <Part5>                 ::= <Byte> [<TSP>]* "}" [<TSP>]* "}"
-<Array>                 ::= {<EmptyArray>} {<Array>}
+<Array>                 ::= {<EmptyArray>} {<NonEmptyArray>}
 <EmptyArray>            ::= "{" <TSP>* "}"
-<ByteArray>             ::= "{" <TSP>* <Byte> [<CSP> <Byte>]* "}"
+<NonEmptyArray>         ::= "{" <TSP>* [<Lable>] <ArrayVal> 
+                             [<CSP> [<Lable>] <ArrayVal>]* "}"
+<ArrayVal>              ::= {<TrueFalse>} {<Number>} {<StringLiteral>} {<Offset>}
+<Lable>                 ::= "LABEL(" <CName> ")"
+<Offset>                ::= "OFFSET_OF(" <CName> ")"
 <StringLiteral>         ::= {<QuotedString>} {"L" <QuotedString>}
+                            {<SglQuotedString>} {"L" <SglQuotedString>}
 <DblQuote>              ::= 0x22
+<SglQuote>              ::= 0x27
 <QuotedString>          ::= <DblQuote> [<CCHAR>]* <DblQuote>
+<SglQuotedString>       ::= <SglQuote> [<CCHAR>]* <SglQuote>
 <CCHAR>                 ::= {<SingleChars>} {<EscapeCharSeq>}
-<SingleChars>           ::= {0x20} {0x21} {(0x23 - 0x5B)} {(0x5D - 0x7E)}
-<EscapeCharSeq>         ::= "\" {"n"} {"r"} {"t"} {"f"} {"b"} {"0"} {"\"} {<DblQuote>}
+<SingleChars>           ::= {0x21} {(0x23 - 0x26)} {(0x28 - 0x5B)}
+                            {(0x5D - 0x7E)} {<EscapeSequence>}
+<EscapeCharSeq>         ::= "\" {"n"} {"r"} {"t"} {"f"} {"b"} {"0"} {"\"}
+                            {<DblQuote>} {<SglQuote>}
+<UintMac>               ::= {<Uint8Mac>} {<Uint16Mac>} {<Uint32Mac>} {<Uint64Mac>}
+<Uint8Mac>              ::= "UINT8(" <Argument> ")"
+<Uint16Mac>             ::= "UINT16(" <Argument> ")"
+<Uint32Mac>             ::= "UINT32(" <Argument> ")"
+<Uint64Mac>             ::= "UINT64(" <Argument> ")"
 <PostFixExpression>     ::= {<PrimaryExpression>} {<PcdName>}
 <PcdName>               ::= <CName> "." <CName>
 <UnaryExpression>       ::= {<PostFixExpression>} {<UnaryOp> <UnaryExpression>}
 <UnaryOp>               ::= {<IntegerOps>} {<ScalarOps>}
 <IntegerOps>            ::= {"+"} {"-"} {"~"}
@@ -187,11 +203,11 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress | !gCrownBayTokenSpaceGuid.
 
 This is the value of the MACRO assigned in a DEFINE statement.
 
 **Expressions**
 
-If the "|" character is used in an expression, the expression must be
+If the "|" or "||"character is used in an expression, the expression must be
 encapsulated by parenthesis.
 
 ## 3.2 Conditional Directive Expressions
 
 Conditional directive statements are defined in the EDK II Platform Description
-- 
2.6.1.windows.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-01-31 22:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-31 22:58 [Patch] Expression spec: update format to support flexible Pcd format Yonghong Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox