Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
GLSLShaderTokenProvider.cs
Go to the documentation of this file.
1 #region Header Licence
2 // ---------------------------------------------------------------------
3 //
4 // Copyright (c) 2009 Alexandre Mutel and Microsoft Corporation.
5 // All rights reserved.
6 //
7 // This code module is part of NShader, a plugin for visual studio
8 // to provide syntax highlighting for shader languages (hlsl, glsl, cg)
9 //
10 // ------------------------------------------------------------------
11 //
12 // This code is licensed under the Microsoft Public License.
13 // See the file License.txt for the license details.
14 // More info on: http://nshader.codeplex.com
15 //
16 // ------------------------------------------------------------------
17 #endregion
18 using System.Collections.Generic;
19 using NShader.Lexer;
20 
21 namespace NShader
22 {
24  {
25  private static EnumMap<ShaderToken> map;
26 
28  {
29  map = new EnumMap<ShaderToken>();
30  map.Load("GLSLKeywords.map");
31  }
32 
33  public ShaderToken GetTokenFromSemantics(string text)
34  {
35  text = text.Replace(" ", "");
36  ShaderToken token;
37  if (!map.TryGetValue(text.ToUpper(), out token))
38  {
39  token = ShaderToken.IDENTIFIER;
40  }
41  return token;
42  }
43 
44  public ShaderToken GetTokenFromIdentifier(string text)
45  {
46  ShaderToken token;
47  if (!map.TryGetValue(text, out token))
48  {
49  token = ShaderToken.IDENTIFIER;
50  }
51  return token;
52  }
53  }
54 }
ShaderToken GetTokenFromIdentifier(string text)
ShaderToken GetTokenFromSemantics(string text)