/xbmc/visualizations/Vortex/angelscript/angelscript/source/as_tokenizer.h

http://github.com/xbmc/xbmc · C++ Header · 75 lines · 25 code · 16 blank · 34 comment · 0 complexity · 2f75bde83cb8330be75c35156a4aaaa1 MD5 · raw file

  1. /*
  2. AngelCode Scripting Library
  3. Copyright (c) 2003-2008 Andreas Jonsson
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any
  6. damages arising from the use of this software.
  7. Permission is granted to anyone to use this software for any
  8. purpose, including commercial applications, and to alter it and
  9. redistribute it freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you
  11. must not claim that you wrote the original software. If you use
  12. this software in a product, an acknowledgment in the product
  13. documentation would be appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and
  15. must not be misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source
  17. distribution.
  18. The original version of this library can be located at:
  19. http://www.angelcode.com/angelscript/
  20. Andreas Jonsson
  21. andreas@angelcode.com
  22. */
  23. //
  24. // as_tokenizer.cpp
  25. //
  26. // This class identifies tokens from the script code
  27. //
  28. #ifndef AS_TOKENIZER_H
  29. #define AS_TOKENIZER_H
  30. #include "as_tokendef.h"
  31. BEGIN_AS_NAMESPACE
  32. const char *asGetTokenDefinition(int tokenType);
  33. class asCTokenizer
  34. {
  35. public:
  36. asCTokenizer();
  37. ~asCTokenizer();
  38. eTokenType GetToken(const char *source, size_t sourceLength, size_t *tokenLength, asETokenClass *tc = 0);
  39. protected:
  40. asETokenClass ParseToken();
  41. bool IsWhiteSpace();
  42. bool IsComment();
  43. bool IsConstant();
  44. bool IsKeyWord();
  45. bool IsIdentifier();
  46. const char *source;
  47. size_t sourceLength;
  48. eTokenType tokenType;
  49. size_t tokenLength;
  50. };
  51. END_AS_NAMESPACE
  52. #endif