Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Support syntax highlighting for changes to number literals introduced in Go 1.13 #174

Open
tohjustin opened this issue Sep 8, 2019 · 2 comments

Comments

@tohjustin
Copy link

Summary

In Go 1.13, there are changes made to number literals & the current language-go package's grammar support them yet (i.e. not all number literals in a .go file are being highlighted correctly)

Motivation

The updated grammar should support syntax highlighting for the following:

  • Binary integer literals: The prefix 0b or 0B indicates a binary integer literal such as 0b1011.
  • Octal integer literals: The prefix 0o or 0O indicates an octal integer literal such as 0o660. The existing octal notation indicated by a leading 0 followed by octal digits remains valid.
  • Hexadecimal floating point literals: The prefix 0x or 0X may now be used to express the mantissa of a floating-point number in hexadecimal format such as 0x1.0p-1021. A hexadecimal floating-point number must always have an exponent, written as the letter p or P followed by an exponent in decimal. The exponent scales the mantissa by 2 to the power of the exponent.
  • Imaginary literals: The imaginary suffix i may now be used with any (binary, decimal, hexadecimal) integer or floating-point literal.
  • Digit separators: The digits of any number literal may now be separated (grouped) using underscores, such as in 1_000_000, 0b_1010_0110, or 3.1415_9265. An underscore may appear between any two digits or the literal prefix and the first digit.

(taken from Go 1.13 Release Notes)

Describe alternatives you've considered

Currently there isn't any existing TextMate grammar that supports syntax highlighting for changes to number literals introduced in Go 1.13.

Here's a list of repositories that I've checked:

Additional context

@tohjustin
Copy link
Author

Just submitted a working implementation for this feature #175

@rsese
Copy link

rsese commented Sep 18, 2019

Thanks @tohjustin for the fix on the Tree-sitter side - keeping this issue open since we still need to pull in the Tree-sitter changes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants