chunkypixel / atari-dev-studio

Homebrew game creation for the Atari 8-bit consoles (VS Code Extension)
http://atariage.com/forums/topic/290365-atari-dev-studio-for-homebrew-development-release/
GNU General Public License v3.0
76 stars 8 forks source link

Syntax highlighter - labels #11

Closed mengstr closed 5 years ago

mengstr commented 5 years ago

Looking at the dasm man page that says the following for symbols:

 name   -beginning with an alpha character and containing letters,
         numbers, or '_'.  Represents some global symbol name.

and also at the code

const char *pushsymbol(const char *str)
  {
      SYMBOL *sym;
      const char *ptr;
      unsigned char macro = 0;

      for (ptr = str;
      *ptr == '_' ||
          *ptr == '.' ||
          (*ptr >= 'a' && *ptr <= 'z') ||
          (*ptr >= 'A' && *ptr <= 'Z') ||
          (*ptr >= '0' && *ptr <= '9');
     ++ptr

it is apparent (even if they disagree on the dot/period) that both a dot and an underscore are valid parts of a label. And that a label must start with a upper/lowercase letter as well.

I updated the dasm.tmLanguage.json to match this:

                "labels": {
                        "patterns": [
                                {
                                        "name": "keyword.control.label.dasm",
                                        "match": "^[a-zA-Z][a-zA-Z0-9_.]+\\b",
                                        "comment": "Label"
                                }
                        ]
                },
chunkypixel commented 5 years ago

Completed in v0.1.7 Awesome thanks for the update Mats!