Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ShTokenizer.hpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright 2003-2005 Serious Hack Inc.
00004 // 
00005 // This software is provided 'as-is', without any express or implied
00006 // warranty. In no event will the authors be held liable for any damages
00007 // arising from the use of this software.
00008 // 
00009 // Permission is granted to anyone to use this software for any purpose,
00010 // including commercial applications, and to alter it and redistribute it
00011 // freely, subject to the following restrictions:
00012 // 
00013 // 1. The origin of this software must not be misrepresented; you must
00014 // not claim that you wrote the original software. If you use this
00015 // software in a product, an acknowledgment in the product documentation
00016 // would be appreciated but is not required.
00017 // 
00018 // 2. Altered source versions must be plainly marked as such, and must
00019 // not be misrepresented as being the original software.
00020 // 
00021 // 3. This notice may not be removed or altered from any source
00022 // distribution.
00024 #ifndef SHTOKENIZER_HPP
00025 #define SHTOKENIZER_HPP
00026 
00027 #include <stack>
00028 #include <queue>
00029 #include <vector>
00030 #include <iosfwd>
00031 #include "ShDllExport.hpp"
00032 #include "ShRefCount.hpp"
00033 #include "ShVariable.hpp"
00034 #include "ShBlock.hpp"
00035 #include "ShException.hpp"
00036 #include "ShToken.hpp"
00037 
00038 namespace SH {
00039 
00045 struct 
00046 SH_DLLEXPORT ShTokenArgument {
00047   ShTokenArgument(const ShVariable& result, const ShBlockListPtr& blockList)
00048     : result(result), blockList(blockList)
00049   {
00050   }
00051   
00052   ShVariable result; 
00053   ShBlockListPtr blockList; 
00054 };
00055 
00060 class 
00061 SH_DLLEXPORT ShTokenizerException : public ShException {
00062 public:
00063   ShTokenizerException(const std::string& error);
00064 };
00065   
00075 class 
00076 SH_DLLEXPORT ShTokenizer {
00077 public:
00078   ShTokenizer();
00079 
00085 
00086 
00087   bool pushArgQueue();
00089   bool pushArg();
00091   bool processArg(const ShVariable& result);
00093 
00095 
00096 
00097   ShTokenArgument getArgument();
00099   void popArgQueue();
00101 
00103   ShBlockListPtr blockList();
00104 
00105 private:
00106   std::stack<ShBlockListPtr> m_listStack;
00107   std::stack< std::queue<ShTokenArgument> > m_argQueueStack;
00108 };
00109 
00110 }
00111 
00112 #endif

Generated on Wed Jun 15 18:12:42 2005 for Sh by  doxygen 1.4.3-20050530