The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.6KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #include "juce_CPlusPlusCodeTokeniserFunctions.h"
  19. //==============================================================================
  20. CPlusPlusCodeTokeniser::CPlusPlusCodeTokeniser() {}
  21. CPlusPlusCodeTokeniser::~CPlusPlusCodeTokeniser() {}
  22. int CPlusPlusCodeTokeniser::readNextToken (CodeDocument::Iterator& source)
  23. {
  24. return CppTokeniserFunctions::readNextToken (source);
  25. }
  26. CodeEditorComponent::ColourScheme CPlusPlusCodeTokeniser::getDefaultColourScheme()
  27. {
  28. struct Type
  29. {
  30. const char* name;
  31. uint32 colour;
  32. };
  33. const Type types[] =
  34. {
  35. { "Error", 0xffcc0000 },
  36. { "Comment", 0xff00aa00 },
  37. { "Keyword", 0xff0000cc },
  38. { "Operator", 0xff225500 },
  39. { "Identifier", 0xff000000 },
  40. { "Integer", 0xff880000 },
  41. { "Float", 0xff885500 },
  42. { "String", 0xff990099 },
  43. { "Bracket", 0xff000055 },
  44. { "Punctuation", 0xff004400 },
  45. { "Preprocessor Text", 0xff660000 }
  46. };
  47. CodeEditorComponent::ColourScheme cs;
  48. for (int i = 0; i < sizeof (types) / sizeof (types[0]); ++i) // (NB: numElementsInArray doesn't work here in GCC4.2)
  49. cs.set (types[i].name, Colour (types[i].colour));
  50. return cs;
  51. }
  52. bool CPlusPlusCodeTokeniser::isReservedKeyword (const String& token) noexcept
  53. {
  54. return CppTokeniserFunctions::isReservedKeyword (token.getCharPointer(), token.length());
  55. }