diff --git a/crates/solidity/inputs/language/src/definition.rs b/crates/solidity/inputs/language/src/definition.rs index d730b4295a..9a214de8c3 100644 --- a/crates/solidity/inputs/language/src/definition.rs +++ b/crates/solidity/inputs/language/src/definition.rs @@ -3671,44 +3671,44 @@ codegen_language_macros::compile!(Language( Token( name = DecimalLiteral, definitions = [ - // An integer (without a dot or a fraction) is enabled in all versions: - TokenDefinition( - scanner = TrailingContext( - scanner = Sequence([ - Fragment(DecimalDigits), - Optional(Fragment(DecimalExponent)) - ]), - not_followed_by = Fragment(IdentifierStart) - ) - ), - // An integer and a dot (without a fraction) is disabled in "0.5.0" + // An integer, optionally with a dot that may not be followed by a fraction, is disabled in "0.5.0": TokenDefinition( enabled = Till("0.5.0"), scanner = TrailingContext( scanner = Sequence([ - Fragment(DecimalDigits), - Atom("."), + Sequence([ + Fragment(DecimalDigits), + Optional(Sequence([ + Atom("."), + Optional(Fragment(DecimalDigits)) + ])) + ]), Optional(Fragment(DecimalExponent)) ]), not_followed_by = Fragment(IdentifierStart) ) ), - // A dot and a fraction (without an integer) is enabled in all versions: + // An integer, optionally with dot that is always followed by a fraction, is enabled in "0.5.0": TokenDefinition( + enabled = From("0.5.0"), scanner = TrailingContext( scanner = Sequence([ - Atom("."), - Fragment(DecimalDigits), + Sequence([ + Fragment(DecimalDigits), + Optional(Sequence([ + Atom("."), + Fragment(DecimalDigits) + ])) + ]), Optional(Fragment(DecimalExponent)) ]), not_followed_by = Fragment(IdentifierStart) ) ), - // An integer, a dot, and a fraction is enabled in all versions: + // A dot and a fraction (without an integer) is enabled in all versions: TokenDefinition( scanner = TrailingContext( scanner = Sequence([ - Fragment(DecimalDigits), Atom("."), Fragment(DecimalDigits), Optional(Fragment(DecimalExponent))