mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:57:44 +00:00
JSSpecCompiler: Parse arbitrarily large rational numbers in xspec mode
This commit is contained in:
parent
2a2e31f2ed
commit
86d54a8684
9 changed files with 64 additions and 8 deletions
|
@ -62,7 +62,12 @@ void ControlFlowBranch::dump_tree(StringBuilder& builder)
|
|||
|
||||
void MathematicalConstant::dump_tree(StringBuilder& builder)
|
||||
{
|
||||
dump_node(builder, "MathematicalConstant {}", m_number);
|
||||
String representation;
|
||||
if (Crypto::UnsignedBigInteger { 1000 }.divided_by(m_number.denominator()).remainder == 0)
|
||||
representation = MUST(String::from_byte_string(m_number.to_byte_string(3)));
|
||||
else
|
||||
representation = MUST(String::formatted("{}/{}", MUST(m_number.numerator().to_base(10)), MUST(m_number.denominator().to_base(10))));
|
||||
dump_node(builder, "MathematicalConstant {}", representation);
|
||||
}
|
||||
|
||||
void StringLiteral::dump_tree(StringBuilder& builder)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue