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.

66 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. /**
  17. A simple lexical analyser for syntax colouring of C++ code.
  18. @see CodeEditorComponent, CodeDocument
  19. @tags{GUI}
  20. */
  21. class JUCE_API CPlusPlusCodeTokeniser : public CodeTokeniser
  22. {
  23. public:
  24. //==============================================================================
  25. CPlusPlusCodeTokeniser();
  26. ~CPlusPlusCodeTokeniser() override;
  27. //==============================================================================
  28. int readNextToken (CodeDocument::Iterator&) override;
  29. CodeEditorComponent::ColourScheme getDefaultColourScheme() override;
  30. /** This is a handy method for checking whether a string is a c++ reserved keyword. */
  31. static bool isReservedKeyword (const String& token) noexcept;
  32. /** The token values returned by this tokeniser. */
  33. enum TokenType
  34. {
  35. tokenType_error = 0,
  36. tokenType_comment,
  37. tokenType_keyword,
  38. tokenType_operator,
  39. tokenType_identifier,
  40. tokenType_integer,
  41. tokenType_float,
  42. tokenType_string,
  43. tokenType_bracket,
  44. tokenType_punctuation,
  45. tokenType_preprocessor
  46. };
  47. private:
  48. //==============================================================================
  49. JUCE_LEAK_DETECTOR (CPlusPlusCodeTokeniser)
  50. };
  51. } // namespace juce