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 library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
00018 // MA  02110-1301, USA
00020 #ifndef SHTOKENIZER_HPP
00021 #define SHTOKENIZER_HPP
00022 
00023 #include <stack>
00024 #include <queue>
00025 #include <vector>
00026 #include <iosfwd>
00027 #include "ShDllExport.hpp"
00028 #include "ShRefCount.hpp"
00029 #include "ShVariable.hpp"
00030 #include "ShBlock.hpp"
00031 #include "ShException.hpp"
00032 #include "ShToken.hpp"
00033 
00034 namespace SH {
00035 
00041 struct 
00042 SH_DLLEXPORT ShTokenArgument {
00043   ShTokenArgument(const ShVariable& result, const ShBlockListPtr& blockList)
00044     : result(result), blockList(blockList)
00045   {
00046   }
00047   
00048   ShVariable result; 
00049   ShBlockListPtr blockList; 
00050 };
00051 
00056 class 
00057 SH_DLLEXPORT ShTokenizerException : public ShException {
00058 public:
00059   ShTokenizerException(const std::string& error);
00060 };
00061   
00071 class 
00072 SH_DLLEXPORT ShTokenizer {
00073 public:
00074   ShTokenizer();
00075 
00081 
00082 
00083   bool pushArgQueue();
00085   bool pushArg();
00087   bool processArg(const ShVariable& result);
00089 
00091 
00092 
00093   ShTokenArgument getArgument();
00095   void popArgQueue();
00097 
00099   ShBlockListPtr blockList();
00100 
00101 private:
00102   std::stack<ShBlockListPtr> m_listStack;
00103   std::stack< std::queue<ShTokenArgument> > m_argQueueStack;
00104 };
00105 
00106 }
00107 
00108 #endif

Generated on Thu Jul 28 17:33:06 2005 for Sh by  doxygen 1.4.3-20050530