Skip to content

Commit

Permalink
Added highlight bad coding in directives.
Browse files Browse the repository at this point in the history
  • Loading branch information
calculuswhiz committed Feb 8, 2015
1 parent 90bd9a0 commit c689363
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Assembly x86 AT&T.JSON-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@
"comment":"cpuid | grep -i 'xsaveopt'"
},
{ "name": "support.constant.preprocessor",
"match": "(?<!\\w)(#\\s*(#|include|define|undef|if|ifn?def|else|elsif|endif|pragma|warning))|__(FILE|LINE|DATE|TIME(STAMP)?|STDC_(VERSION|HOSTED)?|GNUC|GNUC_MINOR|GNUC_PATCHLEVEL|VERSION|STRICT_ANSI|BASE_FILE|INCLUDE_LEVEL|OPTIMIZE|OPTIMIZE_SIZE|NO_INLINE|CHAR_UNSIGNED|CHAR_BIT|INT_SHORT|SCHAR_MAX|SHRT_MAX|INT_MAX|LONG_MAX|LONG_LONG_MAX|REGISTER_PREFIX|USER_LABEL_PREFIX)__\\b"
"match": "(?<!\\w)(#(#|include|define|undef|if|ifn?def|else|elsif|endif|pragma|warning))|__(FILE|LINE|DATE|TIME(STAMP)?|STDC_(VERSION|HOSTED)?|GNUC|GNUC_MINOR|GNUC_PATCHLEVEL|VERSION|STRICT_ANSI|BASE_FILE|INCLUDE_LEVEL|OPTIMIZE|OPTIMIZE_SIZE|NO_INLINE|CHAR_UNSIGNED|CHAR_BIT|INT_SHORT|SCHAR_MAX|SHRT_MAX|INT_MAX|LONG_MAX|LONG_LONG_MAX|REGISTER_PREFIX|USER_LABEL_PREFIX)__\\b"
},
{ "name": "invalid.warnings",
"match": "(?<!\\w)(#\\s+(#|include|define|undef|if|ifn?def|else|elsif|endif|pragma|warning))\\b"
},
{
"name": "comment.assembly",
Expand Down
8 changes: 7 additions & 1 deletion Assembly x86 AT&T.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,16 @@
</dict>
<dict>
<key>match</key>
<string>(?&lt;!\w)(#\s*(#|include|define|undef|if|ifn?def|else|elsif|endif|pragma|warning))|__(FILE|LINE|DATE|TIME(STAMP)?|STDC_(VERSION|HOSTED)?|GNUC|GNUC_MINOR|GNUC_PATCHLEVEL|VERSION|STRICT_ANSI|BASE_FILE|INCLUDE_LEVEL|OPTIMIZE|OPTIMIZE_SIZE|NO_INLINE|CHAR_UNSIGNED|CHAR_BIT|INT_SHORT|SCHAR_MAX|SHRT_MAX|INT_MAX|LONG_MAX|LONG_LONG_MAX|REGISTER_PREFIX|USER_LABEL_PREFIX)__\b</string>
<string>(?&lt;!\w)(#(#|include|define|undef|if|ifn?def|else|elsif|endif|pragma|warning))|__(FILE|LINE|DATE|TIME(STAMP)?|STDC_(VERSION|HOSTED)?|GNUC|GNUC_MINOR|GNUC_PATCHLEVEL|VERSION|STRICT_ANSI|BASE_FILE|INCLUDE_LEVEL|OPTIMIZE|OPTIMIZE_SIZE|NO_INLINE|CHAR_UNSIGNED|CHAR_BIT|INT_SHORT|SCHAR_MAX|SHRT_MAX|INT_MAX|LONG_MAX|LONG_LONG_MAX|REGISTER_PREFIX|USER_LABEL_PREFIX)__\b</string>
<key>name</key>
<string>support.constant.preprocessor</string>
</dict>
<dict>
<key>match</key>
<string>(?&lt;!\w)(#\s+(#|include|define|undef|if|ifn?def|else|elsif|endif|pragma|warning))\b</string>
<key>name</key>
<string>invalid.warnings</string>
</dict>
<dict>
<key>match</key>
<string>#.*$</string>
Expand Down
2 changes: 2 additions & 0 deletions messages/1.1.2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
v1.1.2 !!ACHTUNG!!

The commenting shortcut will now insert `#:' instead of `# '. This was done to help prevent people accidentally putting directives in their comments.

I will also highlight valid directives if there is some number of spaces between it and the # that precedes it.

0 comments on commit c689363

Please sign in to comment.