Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Highlight storage class separate from statement (in, out)

  • Loading branch information...
commit 75074e79c03ea70a8edbada8483086716c5b9c03 1 parent bdb5ab7
@JesseKPhillips authored
Showing with 22 additions and 4 deletions.
  1. +8 −4 syntax/d.vim
  2. +14 −0 tests/hybrid.d
View
12 syntax/d.vim
@@ -95,14 +95,15 @@ syn keyword dExceptions throw try catch finally
syn keyword dScopeDecl public protected private export package
syn keyword dStatement debug return with
syn keyword dStatement function delegate __ctfe mixin macro __simd
-syn keyword dStorageClass in out inout ref lazy body
-syn keyword dStorageClass pure nothrow
+syn keyword dStatement in out body
+syn keyword dStorageClass contained in out
+syn keyword dStorageClass inout ref lazy pure nothrow
syn keyword dStorageClass auto static override final abstract volatile
syn keyword dStorageClass __gshared __vector
syn keyword dStorageClass synchronized shared immutable const lazy
syn keyword dPragma pragma
-syn keyword dIdentifier _arguments _argptr __vptr __monitor _ctor _dtor
-syn keyword dIdentifier __argTypes __overloadset
+syn keyword dIdentifier _arguments _argptr __vptr __monitor
+syn keyword dIdentifier _ctor _dtor __argTypes __overloadset
syn keyword dScopeIdentifier contained exit success failure
syn keyword dTraitsIdentifier contained isAbstractClass isArithmetic isAssociativeArray
syn keyword dTraitsIdentifier contained isFinalClass isFloating isIntegral isScalar
@@ -172,12 +173,15 @@ syn match dType "^\<string\>"
syn match dAssert "[^.]\<assert\>"ms=s+1
syn match dAssert "^\<assert\>"
+
" dTokens is used by the token string highlighting
syn cluster dTokens contains=dExternal,dConditional,dBranch,dRepeat,dBoolean
syn cluster dTokens add=dConstant,dTypedef,dStructure,dOperator,dOpOverload
syn cluster dTokens add=dType,dDebug,dExceptions,dScopeDecl,dStatement
syn cluster dTokens add=dStorageClass,dPragma,dAssert,dAnnotation
+" Create a match for parameter lists to identify storage class
+syn region paramlist start="(" end=")" contains=@dTokens
" Labels
"
View
14 tests/hybrid.d
@@ -0,0 +1,14 @@
+// This files presents highlighting issues due to hybrid usage of keywords.
+
+void foo(in int a,
+ out string b)
+in {
+ assert(a == 0);
+} out {
+ assert(b == "bye");
+} body {
+ return "bye";
+}
+
+void bar(string a, string file = __FILE__)
+if(typeof(a) : string) {}
Please sign in to comment.
Something went wrong with that request. Please try again.