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.

68 lines
2.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. namespace juce
  14. {
  15. //==============================================================================
  16. CPlusPlusCodeTokeniser::CPlusPlusCodeTokeniser() {}
  17. CPlusPlusCodeTokeniser::~CPlusPlusCodeTokeniser() {}
  18. int CPlusPlusCodeTokeniser::readNextToken (CodeDocument::Iterator& source)
  19. {
  20. return CppTokeniserFunctions::readNextToken (source);
  21. }
  22. CodeEditorComponent::ColourScheme CPlusPlusCodeTokeniser::getDefaultColourScheme()
  23. {
  24. struct Type
  25. {
  26. const char* name;
  27. uint32 colour;
  28. };
  29. const Type types[] =
  30. {
  31. { "Error", 0xffcc0000 },
  32. { "Comment", 0xff00aa00 },
  33. { "Keyword", 0xff0000cc },
  34. { "Operator", 0xff225500 },
  35. { "Identifier", 0xff000000 },
  36. { "Integer", 0xff880000 },
  37. { "Float", 0xff885500 },
  38. { "String", 0xff990099 },
  39. { "Bracket", 0xff000055 },
  40. { "Punctuation", 0xff004400 },
  41. { "Preprocessor Text", 0xff660000 }
  42. };
  43. CodeEditorComponent::ColourScheme cs;
  44. for (auto& t : types)
  45. cs.set (t.name, Colour (t.colour));
  46. return cs;
  47. }
  48. bool CPlusPlusCodeTokeniser::isReservedKeyword (const String& token) noexcept
  49. {
  50. return CppTokeniserFunctions::isReservedKeyword (token.getCharPointer(), token.length());
  51. }
  52. } // namespace juce