1 /* 2 * Copyright 2014, Rene Gollent, rene@gollent.com. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include "CLanguageFamilySyntaxHighlighter.h" 8 9 #include <new> 10 11 #include <AutoDeleter.h> 12 13 #include "CLanguageFamilySyntaxHighlightInfo.h" 14 #include "CLanguageTokenizer.h" 15 16 17 using CLanguage::Tokenizer; 18 19 20 CLanguageFamilySyntaxHighlighter::CLanguageFamilySyntaxHighlighter() 21 : 22 SyntaxHighlighter() 23 { 24 } 25 26 27 CLanguageFamilySyntaxHighlighter::~CLanguageFamilySyntaxHighlighter() 28 { 29 } 30 31 32 status_t 33 CLanguageFamilySyntaxHighlighter::ParseText(LineDataSource* source, 34 TeamTypeInformation* typeInfo, SyntaxHighlightInfo*& _info) 35 { 36 Tokenizer* tokenizer = new(std::nothrow) Tokenizer(); 37 if (tokenizer == NULL) 38 return B_NO_MEMORY; 39 ObjectDeleter<Tokenizer> deleter(tokenizer); 40 41 _info = new(std::nothrow) CLanguageFamilySyntaxHighlightInfo(source, 42 tokenizer, typeInfo); 43 if (_info == NULL) 44 return B_NO_MEMORY; 45 46 deleter.Detach(); 47 return B_OK; 48 } 49