Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Feature in Numbers: ' and _ Separators #6

Open
tajmone opened this issue Mar 14, 2017 · 0 comments
Open

Missing Feature in Numbers: ' and _ Separators #6

tajmone opened this issue Mar 14, 2017 · 0 comments

Comments

@tajmone
Copy link

tajmone commented Mar 14, 2017

Long numbers can be visually split with either a ' or character _. Also, decimal numbers can optionally be suffixed with a "d"

I've just written a FASM syntax definition for Highlight, and I stumbled on the same issues, which were pointed out to me by FASM users:

In your source file, the decimal numbers RegEx (lines 198-204):

    { "name": "constant.numeric.dec",
      "match": "\\b([0-9]+)\\b",
      "captures": {
          "1": { "name": "constant.numeric.dec" }
      },
      "comment": "Decimal numbers"
    },

The RegEx \\b([0-9]+)\\b should be changed to \\b([0-9_']+[dD]?)\\b.

The same goes for all number types (hex, octal, binary, floats, etc.): all occurences of [0-9] should become [0-9_'], and for hex nums all [0-9a-fA-F] become [0-9a-fA-F_'], for binaries [0-1] become [0-1_'].

Also octals should follow the rule, but I didn't find an octal-specific definition. It might be worthy implementing a specific definition for octals because they have their custom suffixes: either "o" or "q" (the "q" variant was introduced in Fasm v1.71.56). This is the octals RegEx I used in my Highlight definition file: \b[0-7_']+[oOqQ]\b.

I would love to contribute these fixes myself with a PR, but I'm not sure hwo to handle the Assembly x86 Intel.tmLanguage file — I've never worked on ST packages before, and I don't understand the role of this XML file, it seems a variant of the JSON file but I wouldn't know how to make changes reflect correctly in both files. I'll do some research, and if I work it out I'll try to make a PR linked to this issue.

This is my Fasm language definition for Highlight, if you want to cross-compare:

It's fully commented, and all keywords are grouped by categories. Of course, it's not for live editing, so performance is not an issue there, and I didn't need to worry about RegEx performance hits too much.

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

No branches or pull requests

1 participant