Commit 6d79e0b4 by Zachary Snow

updated number literals

parent 149d16d8
......@@ -43,8 +43,8 @@ import Language.SystemVerilog.Parser.Tokens
-- Numbers
$nonZeroDecimalDigit = [1-9]
$decimalDigit = [0-9]
@nonZeroDecimalDigit = [1-9]
@decimalDigit = [0-9]
@xDigit = [xX]
@zDigit = [zZ\?]
@binaryDigit = @xDigit | @zDigit | [0-1]
......@@ -56,33 +56,40 @@ $decimalDigit = [0-9]
@octalBase = "'" [sS]? [oO]
@hexBase = "'" [sS]? [hH]
@binaryValue = @binaryDigit ("_" | @binaryDigit)*
@octalValue = @octalDigit ("_" | @octalDigit)*
@hexValue = @hexDigit ("_" | @hexDigit)*
@unsignedNumber = $decimalDigit ("_" | $decimalDigit)*
@nonZeroUnsignedNumber = @nonZeroDecimalDigit ("_" | @decimalDigit)*
@unsignedNumber = @decimalDigit ("_" | @decimalDigit)*
@binaryValue = @binaryDigit ("_" | @binaryDigit )*
@octalValue = @octalDigit ("_" | @octalDigit )*
@hexValue = @hexDigit ("_" | @hexDigit )*
@exp = [eE]
@sign = [\-\+]
@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
@octalNumber = @size? @octalBase " "? @octalValue
@hexNumber = @size? @hexBase " "? @hexValue
@realNumber = @fixedPointNumber | @floatingPointNumber
@unbasedUnsizedLiteral = "'" ( 0 | 1 | x | X | z | Z )
@number
@decimalNumber
= @unsignedNumber
| @decimalNumber
| @size? @decimalBase " "? @unsignedNumber
| @size? @decimalBase " "? @xDigit "_"*
| @size? @decimalBase " "? @zDigit "_"*
@integralNumber
= @decimalNumber
| @octalNumber
| @binaryNumber
| @hexNumber
| @unbasedUnsizedLiteral
@number
= @integralNumber
| @realNumber
-- 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