Commit 6d79e0b4 by Zachary Snow

updated number literals

parent 149d16d8
...@@ -43,8 +43,8 @@ import Language.SystemVerilog.Parser.Tokens ...@@ -43,8 +43,8 @@ import Language.SystemVerilog.Parser.Tokens
-- Numbers -- Numbers
$nonZeroDecimalDigit = [1-9] @nonZeroDecimalDigit = [1-9]
$decimalDigit = [0-9] @decimalDigit = [0-9]
@xDigit = [xX] @xDigit = [xX]
@zDigit = [zZ\?] @zDigit = [zZ\?]
@binaryDigit = @xDigit | @zDigit | [0-1] @binaryDigit = @xDigit | @zDigit | [0-1]
...@@ -56,33 +56,40 @@ $decimalDigit = [0-9] ...@@ -56,33 +56,40 @@ $decimalDigit = [0-9]
@octalBase = "'" [sS]? [oO] @octalBase = "'" [sS]? [oO]
@hexBase = "'" [sS]? [hH] @hexBase = "'" [sS]? [hH]
@binaryValue = @binaryDigit ("_" | @binaryDigit)* @nonZeroUnsignedNumber = @nonZeroDecimalDigit ("_" | @decimalDigit)*
@octalValue = @octalDigit ("_" | @octalDigit)* @unsignedNumber = @decimalDigit ("_" | @decimalDigit)*
@hexValue = @hexDigit ("_" | @hexDigit)* @binaryValue = @binaryDigit ("_" | @binaryDigit )*
@octalValue = @octalDigit ("_" | @octalDigit )*
@unsignedNumber = $decimalDigit ("_" | $decimalDigit)* @hexValue = @hexDigit ("_" | @hexDigit )*
@exp = [eE]
@sign = [\-\+] @sign = [\-\+]
@fixedPointNumber = @unsignedNumber "." @unsignedNumber @fixedPointNumber = @unsignedNumber "." @unsignedNumber
@floatingPointNumber = @unsignedNumber ("." @unsignedNumber)? [eE] @sign? @unsignedNumber @realNumber
= @fixedPointNumber
| @unsignedNumber ("." @unsignedNumber)? @exp @sign? @unsignedNumber
@size = @unsignedNumber " "? @size = @nonZeroUnsignedNumber " "?
@decimalNumber = @size? @decimalBase " "? @unsignedNumber @binaryNumber = @size? @binaryBase " "? @binaryValue
@binaryNumber = @size? @binaryBase " "? @binaryValue @octalNumber = @size? @octalBase " "? @octalValue
@octalNumber = @size? @octalBase " "? @octalValue @hexNumber = @size? @hexBase " "? @hexValue
@hexNumber = @size? @hexBase " "? @hexValue
@realNumber = @fixedPointNumber | @floatingPointNumber
@unbasedUnsizedLiteral = "'" ( 0 | 1 | x | X | z | Z ) @unbasedUnsizedLiteral = "'" ( 0 | 1 | x | X | z | Z )
@number @decimalNumber
= @unsignedNumber = @unsignedNumber
| @decimalNumber | @size? @decimalBase " "? @unsignedNumber
| @size? @decimalBase " "? @xDigit "_"*
| @size? @decimalBase " "? @zDigit "_"*
@integralNumber
= @decimalNumber
| @octalNumber | @octalNumber
| @binaryNumber | @binaryNumber
| @hexNumber | @hexNumber
| @unbasedUnsizedLiteral | @unbasedUnsizedLiteral
@number
= @integralNumber
| @realNumber | @realNumber
-- Strings -- Strings
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment