Numbers with a trailing dot (eg. `1.`) should be highlighted as floats, not as ints · Issue #41 · vim-python/python-syntax · GitHub
Skip to content

Numbers with a trailing dot (eg. 1.) should be highlighted as floats, not as ints #41

Closed

Description

@anntzer

... because they are floats, not ints.

Activity

  1. anntzer commented on Mar 29, 2018

    @anntzer
    ContributorAuthor

    I think just

    diff --git a/syntax/python.vim b/syntax/python.vim
    index 913da9d..72d13c4 100644
    --- a/syntax/python.vim
    +++ b/syntax/python.vim
    @@ -326,7 +326,7 @@ else
     
       syn match   pythonFloat       '\.\d\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=\>' display
       syn match   pythonFloat       '\<\d\%([_0-9]*\d\)\=[eE][+-]\=\d\%([_0-9]*\d\)\=[jJ]\=\>' display
    -  syn match   pythonFloat       '\<\d\%([_0-9]*\d\)\=\.\d\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=' display
    +  syn match   pythonFloat       '\<\d\%([_0-9]*\d\)\=\.\d\=\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=' display
     endif
     
     "
    

    (i.e. adding a = after the \d after the decimal dot) fixes the issue.

  2. nfnty commented on Jul 7, 2018

    @nfnty
    Member

    Open a PR and I'll merge it.

  3. anntzer commented on Jul 7, 2018

    @anntzer
    ContributorAuthor

    Please apply the patch above.

  4. nfnty commented on Jan 9, 2019

    @nfnty
    Member

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions